Skip to content

Commit

Permalink
[associations helper] Use JLoader to load the router to make associat…
Browse files Browse the repository at this point in the history
…ion links (#11321)

* use JLoader

* corrections
  • Loading branch information
andrepereiradasilva authored and wilsonge committed Jul 27, 2016
1 parent fe571cd commit 9c11f8c
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 21 deletions.
11 changes: 4 additions & 7 deletions components/com_contact/helpers/association.php
Expand Up @@ -10,6 +10,7 @@
defined('_JEXEC') or die;

JLoader::register('ContactHelper', JPATH_ADMINISTRATOR . '/components/com_contact/helpers/contact.php');
JLoader::register('ContactHelperRoute', JPATH_SITE . '/components/com_contact/helpers/route.php');
JLoader::register('CategoryHelperAssociation', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/association.php');

/**
Expand All @@ -29,15 +30,11 @@ abstract class ContactHelperAssociation extends CategoryHelperAssociation
*
* @since 3.0
*/

public static function getAssociations($id = 0, $view = null)
{
jimport('helper.route', JPATH_COMPONENT_SITE);

$app = JFactory::getApplication();
$jinput = $app->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
$jinput = JFactory::getApplication()->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;

if ($view == 'contact')
{
Expand Down
11 changes: 4 additions & 7 deletions components/com_content/helpers/association.php
Expand Up @@ -10,6 +10,7 @@
defined('_JEXEC') or die;

JLoader::register('ContentHelper', JPATH_ADMINISTRATOR . '/components/com_content/helpers/content.php');
JLoader::register('ContentHelperRoute', JPATH_SITE . '/components/com_content/helpers/route.php');
JLoader::register('CategoryHelperAssociation', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/association.php');

/**
Expand All @@ -29,15 +30,11 @@ abstract class ContentHelperAssociation extends CategoryHelperAssociation
*
* @since 3.0
*/

public static function getAssociations($id = 0, $view = null)
{
jimport('helper.route', JPATH_COMPONENT_SITE);

$app = JFactory::getApplication();
$jinput = $app->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
$jinput = JFactory::getApplication()->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;

if ($view == 'article')
{
Expand Down
11 changes: 4 additions & 7 deletions components/com_newsfeeds/helpers/association.php
Expand Up @@ -10,6 +10,7 @@
defined('_JEXEC') or die;

JLoader::register('NewsfeedsHelper', JPATH_ADMINISTRATOR . '/components/com_newsfeeds/helpers/newsfeeds.php');
JLoader::register('NewsfeedsHelperRoute', JPATH_SITE . '/components/com_newsfeeds/helpers/route.php');
JLoader::register('CategoryHelperAssociation', JPATH_ADMINISTRATOR . '/components/com_categories/helpers/association.php');

/**
Expand All @@ -29,15 +30,11 @@ abstract class NewsfeedsHelperAssociation extends CategoryHelperAssociation
*
* @since 3.0
*/

public static function getAssociations($id = 0, $view = null)
{
jimport('helper.route', JPATH_COMPONENT_SITE);

$app = JFactory::getApplication();
$jinput = $app->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;
$jinput = JFactory::getApplication()->input;
$view = is_null($view) ? $jinput->get('view') : $view;
$id = empty($id) ? $jinput->getInt('id') : $id;

if ($view == 'newsfeed')
{
Expand Down

0 comments on commit 9c11f8c

Please sign in to comment.