mirror of
https://github.com/joomla-extensions/weblinks.git
synced 2024-05-31 21:40:50 +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.
|
* Method to display a view.
|
||||||
*
|
*
|
||||||
* @param boolean $cacheable If true, the view output will be cached
|
* @param boolean $cacheable If true, the view output will be cached
|
||||||
* @param array $urlparams An array of safe url parameters and their variable types,
|
* @param array $urlparams An array of safe url parameters and their variable types,
|
||||||
* for valid values see {@link JFilterInput::clean()}.
|
* for valid values see {@link JFilterInput::clean()}.
|
||||||
*
|
*
|
||||||
* @return WeblinksController This object to support chaining.
|
* @return WeblinksController This object to support chaining.
|
||||||
*
|
*
|
||||||
|
@ -29,8 +29,8 @@ class WeblinksController extends JControllerLegacy
|
||||||
*/
|
*/
|
||||||
public function display($cacheable = false, $urlparams = false)
|
public function display($cacheable = false, $urlparams = false)
|
||||||
{
|
{
|
||||||
$cacheable = true; // Huh? Why not just put that in the constructor?
|
// Huh? Why not just put that in the constructor?
|
||||||
$user = JFactory::getUser();
|
$cacheable = true;
|
||||||
|
|
||||||
// Set the default view name and format from the Request.
|
// 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.
|
// 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(
|
$safeurlparams = array(
|
||||||
'id' => 'INT',
|
'id' => 'INT',
|
||||||
'limit' => 'UINT',
|
'limit' => 'UINT',
|
||||||
'limitstart' => 'UINT',
|
'limitstart' => 'UINT',
|
||||||
'filter_order' => 'CMD',
|
'filter_order' => 'CMD',
|
||||||
'filter_order_Dir' => 'CMD',
|
'filter_order_Dir' => 'CMD',
|
||||||
'lang' => 'CMD'
|
'lang' => 'CMD'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Check for edit form.
|
// Check for edit form.
|
||||||
|
|
|
@ -63,7 +63,7 @@ class JHtmlIcon
|
||||||
|
|
||||||
$url = WeblinksHelperRoute::getFormRoute($weblink->id, base64_encode($uri));
|
$url = WeblinksHelperRoute::getFormRoute($weblink->id, base64_encode($uri));
|
||||||
$icon = $weblink->state ? 'edit.png' : 'edit_unpublished.png';
|
$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)
|
if ($weblink->state == 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,18 +21,20 @@ abstract class WeblinksHelperRoute
|
||||||
protected static $lang_lookup = array();
|
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
|
* @return string
|
||||||
*/
|
*/
|
||||||
public static function getWeblinkRoute($id, $catid, $language = 0)
|
public static function getWeblinkRoute($id, $catid, $language = 0)
|
||||||
{
|
{
|
||||||
$needles = array(
|
$needles = array('weblink' => array((int) $id));
|
||||||
'weblink' => array((int) $id)
|
|
||||||
);
|
|
||||||
|
|
||||||
// Create the link
|
// 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)
|
if ($catid > 1)
|
||||||
{
|
{
|
||||||
|
@ -67,6 +69,8 @@ abstract class WeblinksHelperRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Ge the form route
|
||||||
|
*
|
||||||
* @param integer $id The id of the weblink.
|
* @param integer $id The id of the weblink.
|
||||||
* @param string $return The return page variable.
|
* @param string $return The return page variable.
|
||||||
*
|
*
|
||||||
|
@ -77,7 +81,7 @@ abstract class WeblinksHelperRoute
|
||||||
// Create the link.
|
// Create the link.
|
||||||
if ($id)
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -86,13 +90,15 @@ abstract class WeblinksHelperRoute
|
||||||
|
|
||||||
if ($return)
|
if ($return)
|
||||||
{
|
{
|
||||||
$link .= '&return='.$return;
|
$link .= '&return=' . $return;
|
||||||
}
|
}
|
||||||
|
|
||||||
return $link;
|
return $link;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Get the Category Route
|
||||||
|
*
|
||||||
* @param JCategoryNode|string|integer $catid JCategoryNode object or category ID
|
* @param JCategoryNode|string|integer $catid JCategoryNode object or category ID
|
||||||
* @param integer $language Language code
|
* @param integer $language Language code
|
||||||
*
|
*
|
||||||
|
@ -120,7 +126,7 @@ abstract class WeblinksHelperRoute
|
||||||
$needles = array();
|
$needles = array();
|
||||||
|
|
||||||
// Create the link
|
// 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());
|
$catids = array_reverse($category->getPath());
|
||||||
$needles['category'] = $catids;
|
$needles['category'] = $catids;
|
||||||
|
@ -139,7 +145,7 @@ abstract class WeblinksHelperRoute
|
||||||
|
|
||||||
if ($item = self::_findItem($needles))
|
if ($item = self::_findItem($needles))
|
||||||
{
|
{
|
||||||
$link .= '&Itemid='.$item;
|
$link .= '&Itemid=' . $item;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -147,6 +153,8 @@ abstract class WeblinksHelperRoute
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Do a language lookup
|
||||||
|
*
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
protected static function buildLanguageLookup()
|
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)
|
protected static function _findItem($needles = null)
|
||||||
{
|
{
|
||||||
$app = JFactory::getApplication();
|
$app = JFactory::getApplication();
|
||||||
|
@ -208,7 +223,7 @@ abstract class WeblinksHelperRoute
|
||||||
|
|
||||||
if (isset($item->query['id']))
|
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 != * can override existing entries
|
||||||
// language == * cannot override existing entries
|
// language == * cannot override existing entries
|
||||||
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
|
if (!isset(self::$lookup[$language][$view][$item->query['id']]) || $item->language != '*')
|
||||||
|
|
Loading…
Reference in New Issue
Block a user