Skip to content

Commit

Permalink
Clean up Factory calls (#25679)
Browse files Browse the repository at this point in the history
  • Loading branch information
SharkyKZ authored and wilsonge committed Jul 24, 2019
1 parent 1e8198a commit 0649e2c
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions plugins/system/languagefilter/languagefilter.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

use Joomla\CMS\Application\ApplicationHelper;
use Joomla\CMS\Application\CMSApplication;
use Joomla\CMS\Application\CMSApplicationInterface;
use Joomla\CMS\Association\AssociationServiceInterface;
use Joomla\CMS\Component\ComponentHelper;
use Joomla\CMS\Event\BeforeExecuteEvent;
Expand Down Expand Up @@ -87,7 +88,7 @@ class PlgSystemLanguageFilter extends CMSPlugin
/**
* Application object.
*
* @var JApplicationCms
* @var CMSApplicationInterface
* @since 3.3
*/
protected $app;
Expand All @@ -104,8 +105,6 @@ public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);

$this->app = Factory::getApplication();

// Setup language data.
$this->mode_sef = $this->app->get('sef', 0);
$this->sefs = LanguageHelper::getLanguages('sef');
Expand All @@ -115,7 +114,7 @@ public function __construct(&$subject, $config)
// If language filter plugin is executed in a site page.
if ($this->app->isClient('site'))
{
$levels = Factory::getUser()->getAuthorisedViewLevels();
$levels = $this->app->getIdentity()->getAuthorisedViewLevels();

foreach ($this->sefs as $sef => $language)
{
Expand Down Expand Up @@ -524,7 +523,7 @@ public function parseRule(&$router, &$uri)
// Set the request var.
$this->app->input->set('language', $lang_code);
$this->app->set('language', $lang_code);
$language = Factory::getLanguage();
$language = $this->app->getLanguage();

if ($language->getTag() !== $lang_code)
{
Expand Down Expand Up @@ -780,15 +779,15 @@ public function onUserLogin($user, $options = array())
*/
public function onAfterDispatch()
{
$doc = Factory::getDocument();
$doc = $this->app->getDocument();

if ($this->app->isClient('site') && $this->params->get('alternate_meta', 1) && $doc->getType() === 'html')
{
$languages = $this->lang_codes;
$homes = Multilanguage::getSiteHomePages();
$menu = $this->app->getMenu();
$active = $menu->getActive();
$levels = Factory::getUser()->getAuthorisedViewLevels();
$levels = $this->app->getIdentity()->getAuthorisedViewLevels();
$remove_default_prefix = $this->params->get('remove_default_prefix', 0);
$server = Uri::getInstance()->toString(array('scheme', 'host', 'port'));
$is_home = false;
Expand Down

0 comments on commit 0649e2c

Please sign in to comment.