diff --git a/administrator/components/com_cpanel/src/Controller/DisplayController.php b/administrator/components/com_cpanel/src/Controller/DisplayController.php index d49c4635b923a..9a68c3f4ef416 100644 --- a/administrator/components/com_cpanel/src/Controller/DisplayController.php +++ b/administrator/components/com_cpanel/src/Controller/DisplayController.php @@ -11,7 +11,6 @@ \defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\CMS\Router\Route; @@ -78,8 +77,8 @@ public function addModule() $position = 'cpanel'; } - Factory::getApplication()->setUserState('com_modules.modules.filter.position', $position); - Factory::getApplication()->setUserState('com_modules.modules.client_id', '1'); + $this->app->setUserState('com_modules.modules.filter.position', $position); + $this->app->setUserState('com_modules.modules.client_id', '1'); $this->setRedirect(Route::_('index.php?option=com_modules&view=select&tmpl=component&layout=modal' . $appendLink, false)); } diff --git a/administrator/components/com_finder/src/Controller/IndexController.php b/administrator/components/com_finder/src/Controller/IndexController.php index cd93c9bb16fdc..2c620bf8863ac 100644 --- a/administrator/components/com_finder/src/Controller/IndexController.php +++ b/administrator/components/com_finder/src/Controller/IndexController.php @@ -11,7 +11,6 @@ \defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\CMS\Plugin\PluginHelper; diff --git a/administrator/components/com_finder/src/Controller/IndexerController.php b/administrator/components/com_finder/src/Controller/IndexerController.php index 2852d7393cda7..28ef045c49fdd 100644 --- a/administrator/components/com_finder/src/Controller/IndexerController.php +++ b/administrator/components/com_finder/src/Controller/IndexerController.php @@ -178,10 +178,10 @@ public function batch() try { // Trigger the onBeforeIndex event. - Factory::getApplication()->triggerEvent('onBeforeIndex'); + $this->app->triggerEvent('onBeforeIndex'); // Trigger the onBuildIndex event. - Factory::getApplication()->triggerEvent('onBuildIndex'); + $this->app->triggerEvent('onBuildIndex'); // Get the indexer state. $state = Indexer::getState(); diff --git a/administrator/components/com_languages/src/Controller/InstalledController.php b/administrator/components/com_languages/src/Controller/InstalledController.php index 67b26265b7bfb..d565f0e89dcf2 100644 --- a/administrator/components/com_languages/src/Controller/InstalledController.php +++ b/administrator/components/com_languages/src/Controller/InstalledController.php @@ -46,7 +46,7 @@ public function setDefault() $language = Factory::getLanguage(); $newLang = Language::getInstance($cid); Factory::$language = $newLang; - Factory::getApplication()->loadLanguage($language = $newLang); + $this->app->loadLanguage($language = $newLang); $newLang->load('com_languages', JPATH_ADMINISTRATOR); } @@ -101,7 +101,7 @@ public function switchAdminLanguage() $language = Factory::getLanguage(); $newLang = Language::getInstance($cid); Factory::$language = $newLang; - Factory::getApplication()->loadLanguage($language = $newLang); + $this->app->loadLanguage($language = $newLang); $newLang->load('com_languages', JPATH_ADMINISTRATOR); $msg = Text::sprintf('COM_LANGUAGES_MSG_SWITCH_ADMIN_LANGUAGE_SUCCESS', $languageName); diff --git a/administrator/components/com_scheduler/src/Controller/TasksController.php b/administrator/components/com_scheduler/src/Controller/TasksController.php index 635e169d520ee..ba2252dddf16c 100644 --- a/administrator/components/com_scheduler/src/Controller/TasksController.php +++ b/administrator/components/com_scheduler/src/Controller/TasksController.php @@ -12,7 +12,6 @@ // Restrict direct access \defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\AdminController; use Joomla\CMS\MVC\Model\BaseDatabaseModel; @@ -84,8 +83,7 @@ public function unlock(): void if ($errors) { - Factory::getApplication() - ->enqueueMessage(Text::plural($this->text_prefix . '_N_ITEMS_FAILED_UNLOCKING', \count($cid)), 'error'); + $this->app->enqueueMessage(Text::plural($this->text_prefix . '_N_ITEMS_FAILED_UNLOCKING', \count($cid)), 'error'); } else { diff --git a/components/com_contact/src/Controller/ContactController.php b/components/com_contact/src/Controller/ContactController.php index 48b1130edb0e6..5b1ee4dcbb45f 100644 --- a/components/com_contact/src/Controller/ContactController.php +++ b/components/com_contact/src/Controller/ContactController.php @@ -80,7 +80,7 @@ public function submit() // Check for request forgeries. $this->checkToken(); - $app = Factory::getApplication(); + $app = $this->app; $model = $this->getModel('contact'); $stub = $this->input->getString('id'); $id = (int) $stub; @@ -301,7 +301,7 @@ private function _sendEmail($data, $contact, $emailCopyToSender) } catch (\RuntimeException $exception) { - Factory::getApplication()->enqueueMessage(Text::_($exception->errorMessage()), 'warning'); + $this->app->enqueueMessage(Text::_($exception->errorMessage()), 'warning'); $sent = false; } diff --git a/components/com_contact/src/Controller/DisplayController.php b/components/com_contact/src/Controller/DisplayController.php index 6c1788b5988f1..477d27adfaaca 100644 --- a/components/com_contact/src/Controller/DisplayController.php +++ b/components/com_contact/src/Controller/DisplayController.php @@ -58,7 +58,7 @@ public function __construct($config = array(), MVCFactoryInterface $factory = nu */ public function display($cachable = false, $urlparams = array()) { - if (Factory::getApplication()->getUserState('com_contact.contact.data') === null) + if ($this->app->getUserState('com_contact.contact.data') === null) { $cachable = true; } diff --git a/components/com_content/src/Controller/ArticleController.php b/components/com_content/src/Controller/ArticleController.php index b6005eb5b9a98..0c8f6c5ed70cc 100644 --- a/components/com_content/src/Controller/ArticleController.php +++ b/components/com_content/src/Controller/ArticleController.php @@ -12,7 +12,6 @@ \defined('_JEXEC') or die; use Joomla\CMS\Application\SiteApplication; -use Joomla\CMS\Factory; use Joomla\CMS\Language\Multilanguage; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\FormController; @@ -173,7 +172,7 @@ public function cancel($key = 'a_id') $result = parent::cancel($key); /** @var SiteApplication $app */ - $app = Factory::getApplication(); + $app = $this->app; // Load the parameters. $params = $app->getParams(); @@ -373,7 +372,7 @@ public function save($key = null, $urlVar = 'a_id') return $result; } - $app = Factory::getApplication(); + $app = $this->app; $articleId = $app->input->getInt('a_id'); // Load the parameters. diff --git a/components/com_finder/src/Controller/DisplayController.php b/components/com_finder/src/Controller/DisplayController.php index 5552cd63f6adb..90d56ab5014c6 100644 --- a/components/com_finder/src/Controller/DisplayController.php +++ b/components/com_finder/src/Controller/DisplayController.php @@ -11,7 +11,6 @@ \defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\Component\Finder\Administrator\Helper\LanguageHelper; @@ -35,7 +34,7 @@ class DisplayController extends BaseController */ public function display($cachable = false, $urlparams = array()) { - $input = Factory::getApplication()->input; + $input = $this->app->input; $cachable = true; // Load plugin language files. diff --git a/components/com_privacy/src/Controller/RequestController.php b/components/com_privacy/src/Controller/RequestController.php index 8147528aa6b66..1611fe222346d 100644 --- a/components/com_privacy/src/Controller/RequestController.php +++ b/components/com_privacy/src/Controller/RequestController.php @@ -11,7 +11,6 @@ \defined('_JEXEC') or die; -use Joomla\CMS\Factory; use Joomla\CMS\Language\Text; use Joomla\CMS\MVC\Controller\BaseController; use Joomla\CMS\Router\Route; @@ -48,7 +47,7 @@ public function confirm() if ($return instanceof \Exception) { // Get the error message to display. - if (Factory::getApplication()->get('error_reporting')) + if ($this->app->get('error_reporting')) { $message = $return->getMessage(); } @@ -102,7 +101,7 @@ public function submit() if ($return instanceof \Exception) { // Get the error message to display. - if (Factory::getApplication()->get('error_reporting')) + if ($this->app->get('error_reporting')) { $message = $return->getMessage(); } @@ -156,7 +155,7 @@ public function remind() if ($return instanceof \Exception) { // Get the error message to display. - if (Factory::getApplication()->get('error_reporting')) + if ($this->app->get('error_reporting')) { $message = $return->getMessage(); }