mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-12-26 18:10:11 +00:00
Fix CS for com_weblinks frontend helpers and global controler file (#230)
* Update route.php * Update icon.php * Update controller.php * Update route.php
This commit is contained in:
parent
1fd0653eb6
commit
276c32922e
@ -20,8 +20,8 @@ class WeblinksController extends JControllerLegacy
|
||||
* Method to display a view.
|
||||
*
|
||||
* @param boolean $cacheable If true, the view output will be cached
|
||||
* @param array $urlparams An array of safe url parameters and their variable types,
|
||||
* for valid values see {@link JFilterInput::clean()}.
|
||||
* @param array $urlparams An array of safe url parameters and their variable types,
|
||||
* for valid values see {@link JFilterInput::clean()}.
|
||||
*
|
||||
* @return WeblinksController This object to support chaining.
|
||||
*
|
||||
@ -29,8 +29,8 @@ class WeblinksController extends JControllerLegacy
|
||||
*/
|
||||
public function display($cacheable = false, $urlparams = false)
|
||||
{
|
||||
$cacheable = true; // Huh? Why not just put that in the constructor?
|
||||
$user = JFactory::getUser();
|
||||
// Huh? Why not just put that in the constructor?
|
||||
$cacheable = true;
|
||||
|
||||
// Set the default view name and format from the Request.
|
||||
// Note we are using w_id to avoid collisions with the router and the return page.
|
||||
@ -45,12 +45,12 @@ class WeblinksController extends JControllerLegacy
|
||||
}
|
||||
|
||||
$safeurlparams = array(
|
||||
'id' => 'INT',
|
||||
'limit' => 'UINT',
|
||||
'limitstart' => 'UINT',
|
||||
'filter_order' => 'CMD',
|
||||
'filter_order_Dir' => 'CMD',
|
||||
'lang' => 'CMD'
|
||||
'id' => 'INT',
|
||||
'limit' => 'UINT',
|
||||
'limitstart' => 'UINT',
|
||||
'filter_order' => 'CMD',
|
||||
'filter_order_Dir' => 'CMD',
|
||||
'lang' => 'CMD'
|
||||
);
|
||||
|
||||
// Check for edit form.
|
||||
|
@ -63,7 +63,7 @@ class JHtmlIcon
|
||||
|
||||
$url = WeblinksHelperRoute::getFormRoute($weblink->id, base64_encode($uri));
|
||||
$icon = $weblink->state ? 'edit.png' : 'edit_unpublished.png';
|
||||
$text = JHtml::_('image', 'system/'.$icon, JText::_('JGLOBAL_EDIT'), null, true);
|
||||
$text = JHtml::_('image', 'system/' . $icon, JText::_('JGLOBAL_EDIT'), null, true);
|
||||
|
||||
if ($weblink->state == 0)
|
||||
{
|
||||
|
@ -21,18 +21,20 @@ abstract class WeblinksHelperRoute
|
||||
protected static $lang_lookup = array();
|
||||
|
||||
/**
|
||||
* @param integer The route of the weblink
|
||||
* Get the route of the weblink
|
||||
*
|
||||
* @param integer $id Web link ID
|
||||
* @param integer $catid Category ID
|
||||
* @param string $language Language
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public static function getWeblinkRoute($id, $catid, $language = 0)
|
||||
{
|
||||
$needles = array(
|
||||
'weblink' => array((int) $id)
|
||||
);
|
||||
$needles = array('weblink' => array((int) $id));
|
||||
|
||||
// Create the link
|
||||
$link = 'index.php?option=com_weblinks&view=weblink&id='. $id;
|
||||
$link = 'index.php?option=com_weblinks&view=weblink&id=' . $id;
|
||||
|
||||
if ($catid > 1)
|
||||
{
|
||||
@ -67,6 +69,8 @@ abstract class WeblinksHelperRoute
|
||||
}
|
||||
|
||||
/**
|
||||
* Ge the form route
|
||||
*
|
||||
* @param integer $id The id of the weblink.
|
||||
* @param string $return The return page variable.
|
||||
*
|
||||
@ -77,7 +81,7 @@ abstract class WeblinksHelperRoute
|
||||
// Create the link.
|
||||
if ($id)
|
||||
{
|
||||
$link = 'index.php?option=com_weblinks&task=weblink.edit&w_id='. $id;
|
||||
$link = 'index.php?option=com_weblinks&task=weblink.edit&w_id=' . $id;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -86,13 +90,15 @@ abstract class WeblinksHelperRoute
|
||||
|
||||
if ($return)
|
||||
{
|
||||
$link .= '&return='.$return;
|
||||
$link .= '&return=' . $return;
|
||||
}
|
||||
|
||||
return $link;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Category Route
|
||||
*
|
||||
* @param JCategoryNode|string|integer $catid JCategoryNode object or category ID
|
||||
* @param integer $language Language code
|
||||
*
|
||||
@ -120,7 +126,7 @@ abstract class WeblinksHelperRoute
|
||||
$needles = array();
|
||||
|
||||
// Create the link
|
||||
$link = 'index.php?option=com_weblinks&view=category&id='.$id;
|
||||
$link = 'index.php?option=com_weblinks&view=category&id=' . $id;
|
||||
|
||||
$catids = array_reverse($category->getPath());
|
||||
$needles['category'] = $catids;
|
||||
@ -139,7 +145,7 @@ abstract class WeblinksHelperRoute
|
||||
|
||||
if ($item = self::_findItem($needles))
|
||||
{
|
||||
$link .= '&Itemid='.$item;
|
||||
$link .= '&Itemid=' . $item;
|
||||
}
|
||||
}
|
||||
|
||||
@ -147,6 +153,8 @@ abstract class WeblinksHelperRoute
|
||||
}
|
||||
|
||||
/**
|
||||
* Do a language lookup
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function buildLanguageLookup()
|
||||
@ -169,6 +177,13 @@ abstract class WeblinksHelperRoute
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Find items per given $needles
|
||||
*
|
||||
* @params array $needles
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected static function _findItem($needles = null)
|
||||
{
|
||||
$app = JFactory::getApplication();
|
||||
@ -208,7 +223,7 @@ abstract class WeblinksHelperRoute
|
||||
|
||||
if (isset($item->query['id']))
|
||||
{
|
||||
// here it will become a bit tricky
|
||||
// Here it will become a bit tricky
|
||||
// language != * can override existing entries
|
||||
// language == * cannot override existing entries
|
||||
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
|
||||
|
Loading…
Reference in New Issue
Block a user