diff --git a/administrator/components/com_languages/Controller/DisplayController.php b/administrator/components/com_languages/Controller/DisplayController.php index ce94666392fa3..d2ed2c62a7dac 100644 --- a/administrator/components/com_languages/Controller/DisplayController.php +++ b/administrator/components/com_languages/Controller/DisplayController.php @@ -11,6 +11,8 @@ defined('_JEXEC') or die; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; /** * Languages Controller. @@ -45,8 +47,8 @@ public function display($cachable = false, $urlparams = false) if ($view == 'language' && $layout == 'edit' && !$this->checkEditId('com_languages.edit.language', $id)) { // Somehow the person just went to the form - we don't allow that. - $this->setMessage(\JText::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error'); - $this->setRedirect(\JRoute::_('index.php?option=com_languages&view=languages', false)); + $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_UNHELD_ID', $id), 'error'); + $this->setRedirect(Route::_('index.php?option=com_languages&view=languages', false)); return false; } diff --git a/administrator/components/com_languages/Controller/InstalledController.php b/administrator/components/com_languages/Controller/InstalledController.php index 4022a0a4ec410..a1049e2c79c46 100644 --- a/administrator/components/com_languages/Controller/InstalledController.php +++ b/administrator/components/com_languages/Controller/InstalledController.php @@ -11,6 +11,11 @@ defined('_JEXEC') or die; use Joomla\CMS\MVC\Controller\BaseController; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Language\Language; +use Joomla\CMS\Factory; +use Joomla\CMS\Installer\Installer; /** * Languages Controller. @@ -27,7 +32,7 @@ class InstalledController extends BaseController public function setDefault() { // Check for request forgeries. - \JSession::checkToken() or jexit(\JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $cid = $this->input->get('cid', ''); $model = $this->getModel('installed'); @@ -37,14 +42,14 @@ public function setDefault() // Switching to the new administrator language for the message if ($model->getState('client_id') == 1) { - $language = \JFactory::getLanguage(); - $newLang = \JLanguage::getInstance($cid); - \JFactory::$language = $newLang; - \JFactory::getApplication()->loadLanguage($language = $newLang); + $language = Factory::getLanguage(); + $newLang = Language::getInstance($cid); + Factory::$language = $newLang; + Factory::getApplication()->loadLanguage($language = $newLang); $newLang->load('com_languages', JPATH_ADMINISTRATOR); } - $msg = \JText::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED'); + $msg = Text::_('COM_LANGUAGES_MSG_DEFAULT_LANGUAGE_SAVED'); $type = 'message'; } else @@ -65,26 +70,26 @@ public function setDefault() public function switchAdminLanguage() { // Check for request forgeries. - \JSession::checkToken() or jexit(\JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $cid = $this->input->get('cid', ''); $model = $this->getModel('installed'); // Fetching the language name from the xx-XX.xml $file = JPATH_ADMINISTRATOR . '/language/' . $cid . '/' . $cid . '.xml'; - $info = \JInstaller::parseXMLInstallFile($file); + $info = Installer::parseXMLInstallFile($file); $languageName = $info['name']; if ($model->switchAdminLanguage($cid)) { // Switching to the new language for the message - $language = \JFactory::getLanguage(); - $newLang = \JLanguage::getInstance($cid); - \JFactory::$language = $newLang; - \JFactory::getApplication()->loadLanguage($language = $newLang); + $language = Factory::getLanguage(); + $newLang = Language::getInstance($cid); + Factory::$language = $newLang; + Factory::getApplication()->loadLanguage($language = $newLang); $newLang->load('com_languages', JPATH_ADMINISTRATOR); - $msg = \JText::sprintf('COM_LANGUAGES_MSG_SWITCH_ADMIN_LANGUAGE_SUCCESS', $languageName); + $msg = Text::sprintf('COM_LANGUAGES_MSG_SWITCH_ADMIN_LANGUAGE_SUCCESS', $languageName); $type = 'message'; } else diff --git a/administrator/components/com_languages/Controller/OverrideController.php b/administrator/components/com_languages/Controller/OverrideController.php index 2d68a17d91b87..47706b7e25edc 100644 --- a/administrator/components/com_languages/Controller/OverrideController.php +++ b/administrator/components/com_languages/Controller/OverrideController.php @@ -11,6 +11,10 @@ defined('_JEXEC') or die; use Joomla\CMS\MVC\Controller\FormController; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; +use Joomla\CMS\Factory; /** * Languages Override Controller @@ -34,7 +38,7 @@ public function edit($key = null, $urlVar = null) // Do not cache the response to this, its a redirect $this->app->allowCache(false); - $app = \JFactory::getApplication(); + $app = Factory::getApplication(); $cid = $this->input->post->get('cid', array(), 'array'); $context = "$this->option.edit.$this->context"; @@ -44,8 +48,8 @@ public function edit($key = null, $urlVar = null) // Access check. if (!$this->allowEdit()) { - $this->setMessage(\JText::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'), 'error'); - $this->setRedirect(\JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); + $this->setMessage(Text::_('JLIB_APPLICATION_ERROR_EDIT_NOT_PERMITTED'), 'error'); + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); return; } @@ -67,7 +71,7 @@ public function edit($key = null, $urlVar = null) public function save($key = null, $urlVar = null) { // Check for request forgeries. - \JSession::checkToken() or jexit(\JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $app = $this->app; $model = $this->getModel(); @@ -81,8 +85,8 @@ public function save($key = null, $urlVar = null) // Access check. if (!$this->allowSave($data, 'id')) { - $this->setMessage(\JText::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error'); - $this->setRedirect(\JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); + $this->setMessage(Text::_('JLIB_APPLICATION_ERROR_SAVE_NOT_PERMITTED'), 'error'); + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); return; } @@ -127,7 +131,7 @@ public function save($key = null, $urlVar = null) // Redirect back to the edit screen. $this->setRedirect( - \JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, 'id'), false) + Route::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, 'id'), false) ); return; @@ -140,16 +144,16 @@ public function save($key = null, $urlVar = null) $app->setUserState($context . '.data', $validData); // Redirect back to the edit screen. - $this->setMessage(\JText::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error'); + $this->setMessage(Text::sprintf('JLIB_APPLICATION_ERROR_SAVE_FAILED', $model->getError()), 'error'); $this->setRedirect( - \JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, 'id'), false) + Route::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($recordId, 'id'), false) ); return; } // Add message of success. - $this->setMessage(\JText::_('COM_LANGUAGES_VIEW_OVERRIDE_SAVE_SUCCESS')); + $this->setMessage(Text::_('COM_LANGUAGES_VIEW_OVERRIDE_SAVE_SUCCESS')); // Redirect the user and adjust session state based on the chosen task. switch ($task) @@ -160,7 +164,7 @@ public function save($key = null, $urlVar = null) // Redirect back to the edit screen $this->setRedirect( - \JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($validData['key'], 'id'), false) + Route::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend($validData['key'], 'id'), false) ); break; @@ -170,7 +174,7 @@ public function save($key = null, $urlVar = null) // Redirect back to the edit screen $this->setRedirect( - \JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend(null, 'id'), false) + Route::_('index.php?option=' . $this->option . '&view=' . $this->view_item . $this->getRedirectToItemAppend(null, 'id'), false) ); break; @@ -179,7 +183,7 @@ public function save($key = null, $urlVar = null) $app->setUserState($context . '.data', null); // Redirect to the list screen. - $this->setRedirect(\JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); break; } } @@ -195,11 +199,11 @@ public function save($key = null, $urlVar = null) */ public function cancel($key = null) { - \JSession::checkToken() or jexit(\JText::_('JINVALID_TOKEN')); + Session::checkToken() or jexit(Text::_('JINVALID_TOKEN')); $context = "$this->option.edit.$this->context"; $this->app->setUserState($context . '.data', null); - $this->setRedirect(\JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list . $this->getRedirectToListAppend(), false)); } } diff --git a/administrator/components/com_languages/Controller/OverridesController.php b/administrator/components/com_languages/Controller/OverridesController.php index 401b5a66db247..b2275375fd553 100644 --- a/administrator/components/com_languages/Controller/OverridesController.php +++ b/administrator/components/com_languages/Controller/OverridesController.php @@ -11,6 +11,9 @@ defined('_JEXEC') or die; use Joomla\CMS\MVC\Controller\AdminController; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Session\Session; /** * Languages Overrides Controller. @@ -37,14 +40,14 @@ class OverridesController extends AdminController public function delete() { // Check for request forgeries. - \JSession::checkToken() or die(\JText::_('JINVALID_TOKEN')); + Session::checkToken() or die(Text::_('JINVALID_TOKEN')); // Get items to dlete from the request. $cid = $this->input->get('cid', array(), 'array'); if (!is_array($cid) || count($cid) < 1) { - $this->setMessage(\JText::_($this->text_prefix . '_NO_ITEM_SELECTED'), 'warning'); + $this->setMessage(Text::_($this->text_prefix . '_NO_ITEM_SELECTED'), 'warning'); } else { @@ -54,7 +57,7 @@ public function delete() // Remove the items. if ($model->delete($cid)) { - $this->setMessage(\JText::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid))); + $this->setMessage(Text::plural($this->text_prefix . '_N_ITEMS_DELETED', count($cid))); } else { @@ -62,7 +65,7 @@ public function delete() } } - $this->setRedirect(\JRoute::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); + $this->setRedirect(Route::_('index.php?option=' . $this->option . '&view=' . $this->view_list, false)); } /** @@ -76,6 +79,6 @@ public function purge() { $model = $this->getModel('overrides'); $model->purge(); - $this->setRedirect(\JRoute::_('index.php?option=com_languages&view=overrides', false)); + $this->setRedirect(Route::_('index.php?option=com_languages&view=overrides', false)); } } diff --git a/administrator/components/com_languages/Helper/LanguagesHelper.php b/administrator/components/com_languages/Helper/LanguagesHelper.php index f5d556f279d72..dac6e07d5c8e1 100644 --- a/administrator/components/com_languages/Helper/LanguagesHelper.php +++ b/administrator/components/com_languages/Helper/LanguagesHelper.php @@ -10,6 +10,8 @@ defined('_JEXEC') or die; +use Joomla\CMS\Language\Text; + /** * Languages component helper. * @@ -30,17 +32,17 @@ class LanguagesHelper public static function addSubmenu($vName, $client = 0) { \JHtmlSidebar::addEntry( - \JText::_('COM_LANGUAGES_SUBMENU_INSTALLED'), + Text::_('COM_LANGUAGES_SUBMENU_INSTALLED'), 'index.php?option=com_languages&view=installed', $vName == 'installed' ); \JHtmlSidebar::addEntry( - \JText::_('COM_LANGUAGES_SUBMENU_CONTENT'), + Text::_('COM_LANGUAGES_SUBMENU_CONTENT'), 'index.php?option=com_languages&view=languages', $vName == 'languages' ); \JHtmlSidebar::addEntry( - \JText::_('COM_LANGUAGES_SUBMENU_OVERRIDES'), + Text::_('COM_LANGUAGES_SUBMENU_OVERRIDES'), 'index.php?option=com_languages&view=overrides', $vName == 'overrides' ); diff --git a/administrator/components/com_languages/Helper/MultilangstatusHelper.php b/administrator/components/com_languages/Helper/MultilangstatusHelper.php index a24eb4fe7a729..0adf081d30c69 100644 --- a/administrator/components/com_languages/Helper/MultilangstatusHelper.php +++ b/administrator/components/com_languages/Helper/MultilangstatusHelper.php @@ -8,11 +8,14 @@ */ namespace Joomla\Component\Languages\Administrator\Helper; +defined('_JEXEC') or die; + use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\Language\Multilanguage; use Joomla\Registry\Registry; - -defined('_JEXEC') or die; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Log\Log; +use Joomla\CMS\Factory; /** * Multilang status helper. @@ -29,7 +32,7 @@ abstract class MultilangstatusHelper public static function getHomes() { // Check for multiple Home pages. - $db = \JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('COUNT(*)') ->from($db->quoteName('#__menu')) @@ -49,7 +52,7 @@ public static function getHomes() public static function getLangswitchers() { // Check if switcher is published. - $db = \JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('COUNT(*)') ->from($db->quoteName('#__modules')) @@ -69,7 +72,7 @@ public static function getLangswitchers() public static function getContentlangs() { // Check for published Content Languages. - $db = \JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('a.lang_code AS lang_code') ->select('a.published AS published') @@ -84,15 +87,15 @@ public static function getContentlangs() * * @return array of language extension objects. * - * @deprecated 4.0 Use \JLanguageHelper::getInstalledLanguages(0) instead. + * @deprecated 4.0 Use LanguageHelper::getInstalledLanguages(0) instead. */ public static function getSitelangs() { try { - \JLog::add( - sprintf('%s() is deprecated, use \JLanguageHelper::getInstalledLanguages(0) instead.', __METHOD__), - \JLog::WARNING, + Log::add( + sprintf('%s() is deprecated, use LanguageHelper::getInstalledLanguages(0) instead.', __METHOD__), + Log::WARNING, 'deprecated' ); } @@ -109,15 +112,15 @@ public static function getSitelangs() * * @return array of menu objects. * - * @deprecated 4.0 Use \JLanguageMultilang::getSiteHomePages() instead. + * @deprecated 4.0 Use Multilanguage::getSiteHomePages() instead. */ public static function getHomepages() { try { - \JLog::add( - sprintf('%s() is deprecated, use \JLanguageHelper::getSiteHomePages() instead.', __METHOD__), - \JLog::WARNING, + Log::add( + sprintf('%s() is deprecated, use LanguageHelper::getSiteHomePages() instead.', __METHOD__), + Log::WARNING, 'deprecated' ); } @@ -137,7 +140,7 @@ public static function getHomepages() public static function getStatus() { // Check for combined status. - $db = \JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true); // Select all fields from the languages table. @@ -169,7 +172,7 @@ public static function getStatus() */ public static function getContacts() { - $db = \JFactory::getDbo(); + $db = Factory::getDbo(); $languages = count(LanguageHelper::getLanguages()); // Get the number of contact with all as language @@ -242,7 +245,7 @@ public static function getContacts() public static function getDefaultHomeModule() { // Find Default Home menutype. - $db = \JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select($db->qn('menutype')) ->from($db->qn('#__menu')) @@ -295,7 +298,7 @@ public static function getDefaultHomeModule() */ public static function getModule($moduleName, $instanceTitle = null) { - $db = \JFactory::getDbo(); + $db = Factory::getDbo(); $query = $db->getQuery(true) ->select('id, title, module, position, content, showtitle, params') @@ -317,7 +320,7 @@ public static function getModule($moduleName, $instanceTitle = null) } catch (\RuntimeException $e) { - \JLog::add(\JText::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $e->getMessage()), JLog::WARNING, 'jerror'); + Log::add(Text::sprintf('JLIB_APPLICATION_ERROR_MODULE_LOAD', $e->getMessage()), Log::WARNING, 'jerror'); } return $modules; diff --git a/administrator/components/com_languages/Model/InstalledModel.php b/administrator/components/com_languages/Model/InstalledModel.php index e737748644102..6a8b7de2c173b 100644 --- a/administrator/components/com_languages/Model/InstalledModel.php +++ b/administrator/components/com_languages/Model/InstalledModel.php @@ -17,6 +17,10 @@ use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\CMS\Table\Table; use Joomla\Utilities\ArrayHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Client\ClientHelper; +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Factory; /** * Languages Component Languages Model @@ -173,7 +177,7 @@ public function getFtp() { if (is_null($this->ftp)) { - $this->ftp = \JClientHelper::setCredentialsFromRequest('ftp'); + $this->ftp = ClientHelper::setCredentialsFromRequest('ftp'); } return $this->ftp; @@ -207,7 +211,7 @@ public function getData() { $this->data = array(); - $isCurrentLanguageRtl = \JFactory::getLanguage()->isRtl(); + $isCurrentLanguageRtl = Factory::getLanguage()->isRtl(); $params = ComponentHelper::getParams('com_languages'); $installedLanguages = LanguageHelper::getInstalledLanguages(null, true, true, null, null, null); @@ -396,7 +400,7 @@ public function publish($cid) } else { - $this->setError(\JText::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED')); + $this->setError(Text::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED')); return false; } @@ -422,7 +426,7 @@ protected function getFolders() { $path = $this->getPath(); jimport('joomla.filesystem.folder'); - $this->folders = \JFolder::folders($path, '.', false, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'pdf_fonts', 'overrides')); + $this->folders = Folder::folders($path, '.', false, false, array('.svn', 'CVS', '.DS_Store', '__MACOSX', 'pdf_fonts', 'overrides')); } return $this->folders; @@ -480,12 +484,12 @@ public function switchAdminLanguage($cid) if ($client->name == 'administrator') { - \JFactory::getApplication()->setUserState('application.lang', $cid); + Factory::getApplication()->setUserState('application.lang', $cid); } } else { - \JFactory::getApplication()->enqueueMessage(\JText::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED'), 'error'); + Factory::getApplication()->enqueueMessage(Text::_('COM_LANGUAGES_ERR_NO_LANGUAGE_SELECTED'), 'error'); return false; } diff --git a/administrator/components/com_languages/Model/LanguageModel.php b/administrator/components/com_languages/Model/LanguageModel.php index 4b27e9c9b7a6a..bc0c03fa8a1cb 100644 --- a/administrator/components/com_languages/Model/LanguageModel.php +++ b/administrator/components/com_languages/Model/LanguageModel.php @@ -17,6 +17,8 @@ use Joomla\CMS\Table\Table; use Joomla\Utilities\ArrayHelper; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Factory; /** * Languages Component Language Model @@ -76,7 +78,7 @@ public function getTable($name = '', $prefix = '', $options = array()) */ protected function populateState() { - $app = \JFactory::getApplication(); + $app = Factory::getApplication(); $params = ComponentHelper::getParams('com_languages'); // Load the User state. @@ -117,7 +119,7 @@ public function getItem($langId = null) // Set a valid accesslevel in case '0' is stored due to a bug in the installation SQL (was fixed with PR 2714). if ($table->access == '0') { - $table->access = (int) \JFactory::getConfig()->get('access'); + $table->access = (int) Factory::getConfig()->get('access'); } $properties = $table->getProperties(1); @@ -159,7 +161,7 @@ public function getForm($data = array(), $loadData = true) protected function loadFormData() { // Check the session for previously entered form data. - $data = \JFactory::getApplication()->getUserState('com_languages.edit.language.data', array()); + $data = Factory::getApplication()->getUserState('com_languages.edit.language.data', array()); if (empty($data)) { @@ -205,7 +207,7 @@ public function save($data) // Prevent saving an incorrect language tag if (!preg_match('#\b([a-z]{2,3})[-]([A-Z]{2})\b#', $data['lang_code'])) { - $this->setError(\JText::_('COM_LANGUAGES_ERROR_LANG_TAG')); + $this->setError(Text::_('COM_LANGUAGES_ERROR_LANG_TAG')); return false; } @@ -230,7 +232,7 @@ public function save($data) } // Trigger the before save event. - $result = \JFactory::getApplication()->triggerEvent($this->event_before_save, array($context, &$table, $isNew)); + $result = Factory::getApplication()->triggerEvent($this->event_before_save, array($context, &$table, $isNew)); // Check the event responses. if (in_array(false, $result, true)) @@ -249,7 +251,7 @@ public function save($data) } // Trigger the after save event. - \JFactory::getApplication()->triggerEvent($this->event_after_save, array($context, &$table, $isNew)); + Factory::getApplication()->triggerEvent($this->event_after_save, array($context, &$table, $isNew)); $this->setState('language.id', $table->lang_id); diff --git a/administrator/components/com_languages/Model/OverrideModel.php b/administrator/components/com_languages/Model/OverrideModel.php index 575b303c676d3..8cabe66017245 100644 --- a/administrator/components/com_languages/Model/OverrideModel.php +++ b/administrator/components/com_languages/Model/OverrideModel.php @@ -14,6 +14,9 @@ use Joomla\CMS\Language\LanguageHelper; use Joomla\CMS\MVC\Model\AdminModel; use Joomla\Component\Languages\Administrator\Helper\LanguagesHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filesystem\Path; +use Joomla\CMS\Factory; /** * Languages Override Model @@ -53,9 +56,9 @@ public function getForm($data = array(), $loadData = true) $langName = $language; } - $form->setValue('client', null, \JText::_('COM_LANGUAGES_VIEW_OVERRIDE_CLIENT_' . strtoupper($client))); - $form->setValue('language', null, \JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDE_LANGUAGE', $langName, $language)); - $form->setValue('file', null, \JPath::clean(constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini')); + $form->setValue('client', null, Text::_('COM_LANGUAGES_VIEW_OVERRIDE_CLIENT_' . strtoupper($client))); + $form->setValue('language', null, Text::sprintf('COM_LANGUAGES_VIEW_OVERRIDE_LANGUAGE', $langName, $language)); + $form->setValue('file', null, Path::clean(constant('JPATH_' . strtoupper($client)) . '/language/overrides/' . $language . '.override.ini')); return $form; } @@ -70,7 +73,7 @@ public function getForm($data = array(), $loadData = true) protected function loadFormData() { // Check the session for previously entered form data. - $data = \JFactory::getApplication()->getUserState('com_languages.edit.override.data', array()); + $data = Factory::getApplication()->getUserState('com_languages.edit.override.data', array()); if (empty($data)) { @@ -93,7 +96,7 @@ protected function loadFormData() */ public function getItem($pk = null) { - $input = \JFactory::getApplication()->input; + $input = Factory::getApplication()->input; $pk = (!empty($pk)) ? $pk : $input->get('id'); $filename = constant('JPATH_' . strtoupper($this->getState('filter.client'))) . '/language/overrides/' . $this->getState('filter.language', 'en-GB') . '.override.ini'; @@ -131,7 +134,7 @@ public function save($data, $opposite_client = false) { jimport('joomla.filesystem.file'); - $app = \JFactory::getApplication(); + $app = Factory::getApplication(); $client = $app->getUserState('com_languages.overrides.filter.client', 0); $language = $app->getUserState('com_languages.overrides.filter.language', 'en-GB'); @@ -147,7 +150,7 @@ public function save($data, $opposite_client = false) if (in_array($data['key'], $blacklist)) { - $this->setError(\JText::_('COM_LANGUAGES_OVERRIDE_ERROR_RESERVED_WORDS')); + $this->setError(Text::_('COM_LANGUAGES_OVERRIDE_ERROR_RESERVED_WORDS')); return false; } @@ -207,7 +210,7 @@ public function save($data, $opposite_client = false) */ protected function populateState() { - $app = \JFactory::getApplication(); + $app = Factory::getApplication(); $client = $app->getUserStateFromRequest('com_languages.overrides.filter.client', 'filter_client', 0, 'int') ? 'administrator' : 'site'; $this->setState('filter.client', $client); diff --git a/administrator/components/com_languages/Model/OverridesModel.php b/administrator/components/com_languages/Model/OverridesModel.php index 7e785a298da94..c7936e9ffa0aa 100644 --- a/administrator/components/com_languages/Model/OverridesModel.php +++ b/administrator/components/com_languages/Model/OverridesModel.php @@ -15,6 +15,9 @@ use Joomla\CMS\MVC\Model\ListModel; use Joomla\CMS\MVC\Factory\MVCFactoryInterface; use Joomla\Component\Languages\Administrator\Helper\LanguagesHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Filesystem\File; +use Joomla\CMS\Factory; /** * Languages Overrides Model @@ -70,7 +73,7 @@ public function getOverrides($all = false) // Delete the override.ini file if empty. if (file_exists($filename) && empty($strings)) { - \JFile::delete($filename); + File::delete($filename); } // Filter the loaded strings according to the search box. @@ -158,7 +161,7 @@ public function getTotal() */ protected function populateState($ordering = 'key', $direction = 'asc') { - $app = \JFactory::getApplication(); + $app = Factory::getApplication(); // Use default language of frontend for default filter. $default = ComponentHelper::getParams('com_languages')->get('site') . '0'; @@ -219,12 +222,12 @@ public function getLanguages() // Create a single array of them. foreach ($site_languages as $tag => $language) { - $languages[$tag . '0'] = \JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], \JText::_('JSITE')); + $languages[$tag . '0'] = Text::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], Text::_('JSITE')); } foreach ($admin_languages as $tag => $language) { - $languages[$tag . '1'] = \JText::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], \JText::_('JADMINISTRATOR')); + $languages[$tag . '1'] = Text::sprintf('COM_LANGUAGES_VIEW_OVERRIDES_LANGUAGES_BOX_ITEM', $language['name'], Text::_('JADMINISTRATOR')); } // Sort it by language tag and by client after that. @@ -248,16 +251,16 @@ public function getLanguages() public function delete($cids) { // Check permissions first. - if (!\JFactory::getUser()->authorise('core.delete', 'com_languages')) + if (!Factory::getUser()->authorise('core.delete', 'com_languages')) { - $this->setError(\JText::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED')); + $this->setError(Text::_('JLIB_APPLICATION_ERROR_DELETE_NOT_PERMITTED')); return false; } jimport('joomla.filesystem.file'); - $filterclient = \JFactory::getApplication()->getUserState('com_languages.overrides.filter.client'); + $filterclient = Factory::getApplication()->getUserState('com_languages.overrides.filter.client'); $client = $filterclient == 0 ? 'SITE' : 'ADMINISTRATOR'; // Parse the override.ini file in oder to get the keys and strings. @@ -293,7 +296,7 @@ public function delete($cids) */ public function purge() { - $db = \JFactory::getDbo(); + $db = Factory::getDbo(); // Note: TRUNCATE is a DDL operation // This may or may not mean depending on your database @@ -306,6 +309,6 @@ public function purge() return $e; } - \JFactory::getApplication()->enqueueMessage(\JText::_('COM_LANGUAGES_VIEW_OVERRIDES_PURGE_SUCCESS')); + Factory::getApplication()->enqueueMessage(Text::_('COM_LANGUAGES_VIEW_OVERRIDES_PURGE_SUCCESS')); } } diff --git a/administrator/components/com_languages/Model/StringsModel.php b/administrator/components/com_languages/Model/StringsModel.php index ac07ee4d2ac3a..21efa0d4259f7 100644 --- a/administrator/components/com_languages/Model/StringsModel.php +++ b/administrator/components/com_languages/Model/StringsModel.php @@ -12,6 +12,10 @@ use Joomla\CMS\MVC\Model\BaseDatabaseModel; use Joomla\Component\Languages\Administrator\Helper\LanguagesHelper; +use Joomla\CMS\Filesystem\Path; +use Joomla\CMS\Filesystem\Folder; +use Joomla\CMS\Factory; +use Joomla\CMS\Filter\InputFilter; /** * Languages Strings Model @@ -29,7 +33,7 @@ class StringsModel extends BaseDatabaseModel */ public function refresh() { - $app = \JFactory::getApplication(); + $app = Factory::getApplication(); $db = $this->getDbo(); $app->setUserState('com_languages.overrides.cachedtime', null); @@ -63,20 +67,20 @@ public function refresh() if (is_dir($path)) { - $files = \JFolder::files($path, $language . '.*ini$', false, true); + $files = Folder::files($path, $language . '.*ini$', false, true); } // Parse language directories of components. - $files = array_merge($files, \JFolder::files($base . '/components', $language . '.*ini$', 3, true)); + $files = array_merge($files, Folder::files($base . '/components', $language . '.*ini$', 3, true)); // Parse language directories of modules. - $files = array_merge($files, \JFolder::files($base . '/modules', $language . '.*ini$', 3, true)); + $files = array_merge($files, Folder::files($base . '/modules', $language . '.*ini$', 3, true)); // Parse language directories of templates. - $files = array_merge($files, \JFolder::files($base . '/templates', $language . '.*ini$', 3, true)); + $files = array_merge($files, Folder::files($base . '/templates', $language . '.*ini$', 3, true)); // Parse language directories of plugins. - $files = array_merge($files, \JFolder::files(JPATH_PLUGINS, $language . '.*ini$', 4, true)); + $files = array_merge($files, Folder::files(JPATH_PLUGINS, $language . '.*ini$', 4, true)); // Parse all found ini files and add the strings to the database cache. foreach ($files as $file) @@ -89,7 +93,7 @@ public function refresh() foreach ($strings as $key => $string) { - $query->values($db->quote($key) . ',' . $db->quote($string) . ',' . $db->quote(\JPath::clean($file))); + $query->values($db->quote($key) . ',' . $db->quote($string) . ',' . $db->quote(Path::clean($file))); } try @@ -120,8 +124,8 @@ public function refresh() public function search() { $results = array(); - $input = \JFactory::getApplication()->input; - $filter = \JFilterInput::getInstance(); + $input = Factory::getApplication()->input; + $filter = InputFilter::getInstance(); $db = $this->getDbo(); $searchTerm = $input->getString('searchstring'); diff --git a/administrator/components/com_languages/View/Installed/HtmlView.php b/administrator/components/com_languages/View/Installed/HtmlView.php index 6cb6d6a289169..9defe86f65dd3 100644 --- a/administrator/components/com_languages/View/Installed/HtmlView.php +++ b/administrator/components/com_languages/View/Installed/HtmlView.php @@ -13,6 +13,9 @@ use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\Component\Languages\Administrator\Helper\LanguagesHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\ToolbarHelper; +use Joomla\CMS\Toolbar\Toolbar; /** * Displays a list of the installed languages. @@ -125,39 +128,39 @@ protected function addToolbar() if ((int) $this->state->get('client_id') === 1) { - \JToolbarHelper::title(\JText::_('COM_LANGUAGES_VIEW_INSTALLED_ADMIN_TITLE'), 'comments-2 langmanager'); + ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_INSTALLED_ADMIN_TITLE'), 'comments-2 langmanager'); } else { - \JToolbarHelper::title(\JText::_('COM_LANGUAGES_VIEW_INSTALLED_SITE_TITLE'), 'comments-2 langmanager'); + ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_INSTALLED_SITE_TITLE'), 'comments-2 langmanager'); } if ($canDo->get('core.edit.state')) { - \JToolbarHelper::makeDefault('installed.setDefault'); - \JToolbarHelper::divider(); + ToolbarHelper::makeDefault('installed.setDefault'); + ToolbarHelper::divider(); } if ($canDo->get('core.admin')) { // Add install languages link to the lang installer component. - $bar = \JToolbar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); // Switch administrator language if ($this->state->get('client_id', 0) == 1) { - \JToolbarHelper::custom('installed.switchadminlanguage', 'refresh', 'refresh', 'COM_LANGUAGES_SWITCH_ADMIN', false); - \JToolbarHelper::divider(); + ToolbarHelper::custom('installed.switchadminlanguage', 'refresh', 'refresh', 'COM_LANGUAGES_SWITCH_ADMIN', false); + ToolbarHelper::divider(); } $bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages'); - \JToolbarHelper::divider(); + ToolbarHelper::divider(); - \JToolbarHelper::preferences('com_languages'); - \JToolbarHelper::divider(); + ToolbarHelper::preferences('com_languages'); + ToolbarHelper::divider(); } - \JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_INSTALLED'); + ToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_INSTALLED'); $this->sidebar = \JHtmlSidebar::render(); } diff --git a/administrator/components/com_languages/View/Language/HtmlView.php b/administrator/components/com_languages/View/Language/HtmlView.php index a749bc30a4abb..aed9213770b70 100644 --- a/administrator/components/com_languages/View/Language/HtmlView.php +++ b/administrator/components/com_languages/View/Language/HtmlView.php @@ -13,6 +13,9 @@ use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\Component\Languages\Administrator\Helper\LanguagesHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\ToolbarHelper; +use Joomla\CMS\Factory; /** * HTML View class for the Languages component. @@ -83,12 +86,12 @@ public function display($tpl = null) */ protected function addToolbar() { - \JFactory::getApplication()->input->set('hidemainmenu', 1); + Factory::getApplication()->input->set('hidemainmenu', 1); $isNew = empty($this->item->lang_id); $canDo = $this->canDo; - \JToolbarHelper::title( - \JText::_($isNew ? 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_NEW_TITLE' : 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_EDIT_TITLE'), 'comments-2 langmanager' + ToolbarHelper::title( + Text::_($isNew ? 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_NEW_TITLE' : 'COM_LANGUAGES_VIEW_LANGUAGE_EDIT_EDIT_TITLE'), 'comments-2 langmanager' ); $toolbarButtons = []; @@ -105,21 +108,21 @@ protected function addToolbar() $toolbarButtons[] = ['save2new', 'language.save2new']; } - \JToolbarHelper::saveGroup( + ToolbarHelper::saveGroup( $toolbarButtons, 'btn-success' ); if ($isNew) { - \JToolbarHelper::cancel('language.cancel'); + ToolbarHelper::cancel('language.cancel'); } else { - \JToolbarHelper::cancel('language.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('language.cancel', 'JTOOLBAR_CLOSE'); } - \JToolbarHelper::divider(); - \JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_EDIT'); + ToolbarHelper::divider(); + ToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_EDIT'); } } diff --git a/administrator/components/com_languages/View/Languages/HtmlView.php b/administrator/components/com_languages/View/Languages/HtmlView.php index 901b54f706515..1c6325cc7c6c3 100644 --- a/administrator/components/com_languages/View/Languages/HtmlView.php +++ b/administrator/components/com_languages/View/Languages/HtmlView.php @@ -13,6 +13,9 @@ use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\Component\Languages\Administrator\Helper\LanguagesHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\ToolbarHelper; +use Joomla\CMS\Toolbar\Toolbar; /** * HTML Languages View class for the Languages component. @@ -107,45 +110,45 @@ protected function addToolbar() { $canDo = ContentHelper::getActions('com_languages'); - \JToolbarHelper::title(\JText::_('COM_LANGUAGES_VIEW_LANGUAGES_TITLE'), 'comments-2 langmanager'); + ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_LANGUAGES_TITLE'), 'comments-2 langmanager'); if ($canDo->get('core.create')) { - \JToolbarHelper::addNew('language.add'); + ToolbarHelper::addNew('language.add'); } if ($canDo->get('core.edit.state')) { if ($this->state->get('filter.published') != 2) { - \JToolbarHelper::publishList('languages.publish'); - \JToolbarHelper::unpublishList('languages.unpublish'); + ToolbarHelper::publishList('languages.publish'); + ToolbarHelper::unpublishList('languages.unpublish'); } } if ($this->state->get('filter.published') == -2 && $canDo->get('core.delete')) { - \JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'languages.delete', 'JTOOLBAR_EMPTY_TRASH'); - \JToolbarHelper::divider(); + ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'languages.delete', 'JTOOLBAR_EMPTY_TRASH'); + ToolbarHelper::divider(); } elseif ($canDo->get('core.edit.state')) { - \JToolbarHelper::trash('languages.trash'); - \JToolbarHelper::divider(); + ToolbarHelper::trash('languages.trash'); + ToolbarHelper::divider(); } if ($canDo->get('core.admin')) { // Add install languages link to the lang installer component. - $bar = \JToolbar::getInstance('toolbar'); + $bar = Toolbar::getInstance('toolbar'); $bar->appendButton('Link', 'upload', 'COM_LANGUAGES_INSTALL', 'index.php?option=com_installer&view=languages'); - \JToolbarHelper::divider(); + ToolbarHelper::divider(); - \JToolbarHelper::preferences('com_languages'); - \JToolbarHelper::divider(); + ToolbarHelper::preferences('com_languages'); + ToolbarHelper::divider(); } - \JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_CONTENT'); + ToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_CONTENT'); \JHtmlSidebar::setAction('index.php?option=com_languages&view=languages'); @@ -161,15 +164,15 @@ protected function addToolbar() protected function getSortFields() { return array( - 'a.ordering' => \JText::_('JGRID_HEADING_ORDERING'), - 'a.published' => \JText::_('JSTATUS'), - 'a.title' => \JText::_('JGLOBAL_TITLE'), - 'a.title_native' => \JText::_('COM_LANGUAGES_HEADING_TITLE_NATIVE'), - 'a.lang_code' => \JText::_('COM_LANGUAGES_FIELD_LANG_TAG_LABEL'), - 'a.sef' => \JText::_('COM_LANGUAGES_FIELD_LANG_CODE_LABEL'), - 'a.image' => \JText::_('COM_LANGUAGES_HEADING_LANG_IMAGE'), - 'a.access' => \JText::_('JGRID_HEADING_ACCESS'), - 'a.lang_id' => \JText::_('JGRID_HEADING_ID') + 'a.ordering' => Text::_('JGRID_HEADING_ORDERING'), + 'a.published' => Text::_('JSTATUS'), + 'a.title' => Text::_('JGLOBAL_TITLE'), + 'a.title_native' => Text::_('COM_LANGUAGES_HEADING_TITLE_NATIVE'), + 'a.lang_code' => Text::_('COM_LANGUAGES_FIELD_LANG_TAG_LABEL'), + 'a.sef' => Text::_('COM_LANGUAGES_FIELD_LANG_CODE_LABEL'), + 'a.image' => Text::_('COM_LANGUAGES_HEADING_LANG_IMAGE'), + 'a.access' => Text::_('JGRID_HEADING_ACCESS'), + 'a.lang_id' => Text::_('JGRID_HEADING_ID') ); } } diff --git a/administrator/components/com_languages/View/Override/HtmlView.php b/administrator/components/com_languages/View/Override/HtmlView.php index cd73527459f0a..97c05065612c2 100644 --- a/administrator/components/com_languages/View/Override/HtmlView.php +++ b/administrator/components/com_languages/View/Override/HtmlView.php @@ -12,6 +12,9 @@ use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\ToolbarHelper; +use Joomla\CMS\Factory; /** * View to edit a language override @@ -66,7 +69,7 @@ public function display($tpl = null) } // Check whether the cache has to be refreshed. - $cached_time = \JFactory::getApplication()->getUserState( + $cached_time = Factory::getApplication()->getUserState( 'com_languages.overrides.cachedtime.' . $this->state->get('filter.client') . '.' . $this->state->get('filter.language'), 0 ); @@ -77,8 +80,8 @@ public function display($tpl = null) } // Add strings for translations in \Javascript. - \JText::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS'); - \JText::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR'); + Text::script('COM_LANGUAGES_VIEW_OVERRIDE_NO_RESULTS'); + Text::script('COM_LANGUAGES_VIEW_OVERRIDE_REQUEST_ERROR'); $this->addToolbar(); parent::display($tpl); @@ -93,11 +96,11 @@ public function display($tpl = null) */ protected function addToolbar() { - \JFactory::getApplication()->input->set('hidemainmenu', true); + Factory::getApplication()->input->set('hidemainmenu', true); $canDo = ContentHelper::getActions('com_languages'); - \JToolbarHelper::title(\JText::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_TITLE'), 'comments-2 langmanager'); + ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_TITLE'), 'comments-2 langmanager'); $toolbarButtons = []; @@ -113,21 +116,21 @@ protected function addToolbar() $toolbarButtons[] = ['save2new', 'override.save2new']; } - \JToolbarHelper::saveGroup( + ToolbarHelper::saveGroup( $toolbarButtons, 'btn-success' ); if (empty($this->item->key)) { - \JToolbarHelper::cancel('override.cancel'); + ToolbarHelper::cancel('override.cancel'); } else { - \JToolbarHelper::cancel('override.cancel', 'JTOOLBAR_CLOSE'); + ToolbarHelper::cancel('override.cancel', 'JTOOLBAR_CLOSE'); } - \JToolbarHelper::divider(); - \JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_OVERRIDES_EDIT'); + ToolbarHelper::divider(); + ToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_OVERRIDES_EDIT'); } } diff --git a/administrator/components/com_languages/View/Overrides/HtmlView.php b/administrator/components/com_languages/View/Overrides/HtmlView.php index e0734c4788e20..0fe4cf6541f46 100644 --- a/administrator/components/com_languages/View/Overrides/HtmlView.php +++ b/administrator/components/com_languages/View/Overrides/HtmlView.php @@ -13,6 +13,10 @@ use Joomla\CMS\Helper\ContentHelper; use Joomla\CMS\MVC\View\HtmlView as BaseHtmlView; use Joomla\Component\Languages\Administrator\Helper\LanguagesHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Toolbar\ToolbarHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; /** * View for language overrides list. @@ -101,37 +105,37 @@ protected function addToolbar() // Get the results for each action $canDo = ContentHelper::getActions('com_languages'); - \JToolbarHelper::title(\JText::_('COM_LANGUAGES_VIEW_OVERRIDES_TITLE'), 'comments-2 langmanager'); + ToolbarHelper::title(Text::_('COM_LANGUAGES_VIEW_OVERRIDES_TITLE'), 'comments-2 langmanager'); if ($canDo->get('core.create')) { - \JToolbarHelper::addNew('override.add'); + ToolbarHelper::addNew('override.add'); } if ($canDo->get('core.delete') && $this->pagination->total) { - \JToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'overrides.delete', 'JTOOLBAR_DELETE'); + ToolbarHelper::deleteList('JGLOBAL_CONFIRM_DELETE', 'overrides.delete', 'JTOOLBAR_DELETE'); } - if (\JFactory::getUser()->authorise('core.admin')) + if (Factory::getUser()->authorise('core.admin')) { - \JToolbarHelper::custom('overrides.purge', 'refresh.png', 'refresh_f2.png', 'COM_LANGUAGES_VIEW_OVERRIDES_PURGE', false); + ToolbarHelper::custom('overrides.purge', 'refresh.png', 'refresh_f2.png', 'COM_LANGUAGES_VIEW_OVERRIDES_PURGE', false); } if ($canDo->get('core.admin')) { - \JToolbarHelper::preferences('com_languages'); + ToolbarHelper::preferences('com_languages'); } - \JToolbarHelper::divider(); - \JToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_OVERRIDES'); + ToolbarHelper::divider(); + ToolbarHelper::help('JHELP_EXTENSIONS_LANGUAGE_MANAGER_OVERRIDES'); \JHtmlSidebar::setAction('index.php?option=com_languages&view=overrides'); \JHtmlSidebar::addFilter( '', 'filter_language_client', - \JHtml::_('select.options', $this->languages, null, 'text', $this->state->get('filter.language_client')), + HTMLHelper::_('select.options', $this->languages, null, 'text', $this->state->get('filter.language_client')), true ); diff --git a/administrator/components/com_languages/helpers/html/languages.php b/administrator/components/com_languages/helpers/html/languages.php index f7d51597f1e8e..19f742d681961 100644 --- a/administrator/components/com_languages/helpers/html/languages.php +++ b/administrator/components/com_languages/helpers/html/languages.php @@ -9,6 +9,9 @@ defined('_JEXEC') or die; +use Joomla\CMS\Language\Text; +use Joomla\CMS\HTML\HTMLHelper; + /** * Utility class working with languages * @@ -30,7 +33,7 @@ public static function published($published) return ' '; } - return JHtml::_('image', 'menu/icon-16-default.png', JText::_('COM_LANGUAGES_HEADING_DEFAULT'), null, true); + return HTMLHelper::_('image', 'menu/icon-16-default.png', Text::_('COM_LANGUAGES_HEADING_DEFAULT'), null, true); } /** @@ -61,8 +64,8 @@ public static function id($rowNum, $language) public static function clients() { return array( - JHtml::_('select.option', 0, JText::_('JSITE')), - JHtml::_('select.option', 1, JText::_('JADMINISTRATOR')) + HTMLHelper::_('select.option', 0, Text::_('JSITE')), + HTMLHelper::_('select.option', 1, Text::_('JADMINISTRATOR')) ); } @@ -77,10 +80,10 @@ public static function publishedOptions() { // Build the active state filter options. $options = array(); - $options[] = JHtml::_('select.option', '1', 'JPUBLISHED'); - $options[] = JHtml::_('select.option', '0', 'JUNPUBLISHED'); - $options[] = JHtml::_('select.option', '-2', 'JTRASHED'); - $options[] = JHtml::_('select.option', '*', 'JALL'); + $options[] = HTMLHelper::_('select.option', '1', 'JPUBLISHED'); + $options[] = HTMLHelper::_('select.option', '0', 'JUNPUBLISHED'); + $options[] = HTMLHelper::_('select.option', '-2', 'JTRASHED'); + $options[] = HTMLHelper::_('select.option', '*', 'JALL'); return $options; } diff --git a/administrator/components/com_languages/tmpl/installed/default.php b/administrator/components/com_languages/tmpl/installed/default.php index 3acd32fbf7fe8..79a5a547c52ed 100644 --- a/administrator/components/com_languages/tmpl/installed/default.php +++ b/administrator/components/com_languages/tmpl/installed/default.php @@ -9,23 +9,30 @@ defined('_JEXEC') or die; +use Joomla\CMS\Language\Text; +use Joomla\CMS\String\PunycodeHelper; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; + // Add specific helper files for html generation -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -$user = JFactory::getUser(); +$user = Factory::getUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); ?> -
+
sidebar; ?>
- $this)); ?> + $this)); ?> rows)) : ?> - + @@ -34,31 +41,31 @@   @@ -73,7 +80,7 @@ ?>
- + - + - + - + - + - + - + - + - +
- language); ?> + language); ?> - published, $i, 'installed.', !$row->published && $canChange); ?> + published, $i, 'installed.', !$row->published && $canChange); ?> version, 0, 3) != $minorVersion || substr($row->version, 0, 5) != $currentShortVersion) : ?> - version; ?> + version; ?> version; ?> @@ -105,7 +112,7 @@ escape($row->author); ?> - escape($row->authorEmail)); ?> + escape($row->authorEmail)); ?> escape($row->extension_id); ?> @@ -121,7 +128,7 @@ - + diff --git a/administrator/components/com_languages/tmpl/language/edit.php b/administrator/components/com_languages/tmpl/language/edit.php index c8fe9ae2471a7..afc6dca02c3e0 100644 --- a/administrator/components/com_languages/tmpl/language/edit.php +++ b/administrator/components/com_languages/tmpl/language/edit.php @@ -10,23 +10,26 @@ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Layout\LayoutHelper; -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('behavior.tabstate'); +HTMLHelper::_('behavior.formvalidator'); +HTMLHelper::_('behavior.tabstate'); HTMLHelper::_('script', 'com_languages/admin-language-edit-change-flag.js', ['relative' => true, 'version' => 'auto']); ?> - + - +
- 'details')); ?> + 'details')); ?> - + form->renderField('title'); ?> form->renderField('title_native'); ?> form->renderField('lang_code'); ?> @@ -38,7 +41,7 @@
form->getInput('image'); ?> - form->getValue('image') . '.gif', $this->form->getValue('image'), null, true); ?> + form->getValue('image') . '.gif', $this->form->getValue('image'), null, true); ?>
@@ -49,18 +52,18 @@ form->renderField('access'); ?> form->renderField('description'); ?> form->renderField('lang_id'); ?> - + - + form->renderFieldset('metadata'); ?> - + - + form->renderFieldset('site_name'); ?> - + - +
- + diff --git a/administrator/components/com_languages/tmpl/languages/default.php b/administrator/components/com_languages/tmpl/languages/default.php index e060bcdb7881c..3431a03c71daf 100644 --- a/administrator/components/com_languages/tmpl/languages/default.php +++ b/administrator/components/com_languages/tmpl/languages/default.php @@ -9,11 +9,17 @@ defined('_JEXEC') or die; -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Layout\LayoutHelper; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; -JHtml::_('behavior.multiselect'); +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -$user = JFactory::getUser(); +HTMLHelper::_('behavior.multiselect'); + +$user = Factory::getUser(); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); $saveOrder = $listOrder == 'a.ordering'; @@ -21,55 +27,55 @@ if ($saveOrder) { $saveOrderingUrl = 'index.php?option=com_languages&task=languages.saveOrderAjax&tmpl=component'; - JHtml::_('sortablelist.sortable', 'contentList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); + HTMLHelper::_('sortablelist.sortable', 'contentList', 'adminForm', strtolower($listDirn), $saveOrderingUrl); } ?> -
+
sidebar; ?>
- $this)); ?> + $this)); ?> items)) : ?> - + @@ -87,7 +93,7 @@ $disabledLabel = ''; if (!$saveOrder) : - $disabledLabel = JText::_('JORDERINGDISABLED'); + $disabledLabel = Text::_('JORDERINGDISABLED'); $disableClassName = 'inactive tip-top'; endif; ?> @@ -101,15 +107,15 @@
- + - + - + - + - + - + - + - + - + - + - +
- lang_id); ?> + lang_id); ?> - published, $i, 'languages.', $canChange); ?> + published, $i, 'languages.', $canChange); ?> - + - + escape($item->title); ?> escape($item->title); ?> @@ -127,16 +133,16 @@ image) : ?> - image . '.gif', $item->image, null, true); ?> escape($item->image); ?> + image . '.gif', $item->image, null, true); ?> escape($item->image); ?> - + escape($item->access_level); ?> - home == '1') ? JText::_('JYES') : JText::_('JNO'); ?> + home == '1') ? Text::_('JYES') : Text::_('JNO'); ?> escape($item->lang_id); ?> @@ -152,7 +158,7 @@ - + diff --git a/administrator/components/com_languages/tmpl/multilangstatus/default.php b/administrator/components/com_languages/tmpl/multilangstatus/default.php index 7192818584576..f5027247549c4 100644 --- a/administrator/components/com_languages/tmpl/multilangstatus/default.php +++ b/administrator/components/com_languages/tmpl/multilangstatus/default.php @@ -9,6 +9,8 @@ defined('_JEXEC') or die; +use Joomla\CMS\Language\Text; + $notice_homes = $this->homes == 2 || $this->homes == 1 || $this->homes - 1 != count($this->contentlangs) && ($this->language_filter || $this->switchers != 0); $notice_disabled = !$this->language_filter && ($this->homes > 1 || $this->switchers != 0); $notice_switchers = !$this->switchers && ($this->homes > 1 || $this->language_filter); @@ -16,9 +18,9 @@
language_filter && $this->switchers == 0) : ?> homes == 1) : ?> - + - + @@ -27,10 +29,10 @@ @@ -38,10 +40,10 @@ @@ -49,10 +51,10 @@ @@ -60,10 +62,10 @@ @@ -72,10 +74,10 @@ @@ -83,10 +85,10 @@ @@ -95,14 +97,14 @@ @@ -170,16 +172,16 @@ @@ -195,35 +197,35 @@ element) : ?> lang_code && $status->published) : ?> home_language) : ?> @@ -236,27 +238,27 @@ diff --git a/administrator/components/com_languages/tmpl/override/edit.php b/administrator/components/com_languages/tmpl/override/edit.php index e7ed5eb470476..2ec1bdbf44499 100644 --- a/administrator/components/com_languages/tmpl/override/edit.php +++ b/administrator/components/com_languages/tmpl/override/edit.php @@ -10,28 +10,30 @@ defined('_JEXEC') or die; use Joomla\CMS\HTML\HTMLHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -JHtml::_('behavior.formvalidator'); -JHtml::_('behavior.keepalive'); +HTMLHelper::_('behavior.formvalidator'); +HTMLHelper::_('behavior.keepalive'); $expired = ($this->state->get('cache_expired') == 1 ) ? '1' : ''; -JHtml::_('stylesheet', 'com_languages/overrider.css', array('version' => 'auto', 'relative' => true)); +HTMLHelper::_('stylesheet', 'com_languages/overrider.css', array('version' => 'auto', 'relative' => true)); -JHtml::_('behavior.core'); -JHtml::_('jquery.framework'); -JHtml::_('script', 'com_languages/overrider.min.js', array('version' => 'auto', 'relative' => true)); +HTMLHelper::_('behavior.core'); +HTMLHelper::_('jquery.framework'); +HTMLHelper::_('script', 'com_languages/overrider.min.js', array('version' => 'auto', 'relative' => true)); HTMLHelper::_('script', 'com_languages/admin-override-edit-refresh-searchstring.js', ['relative' => true, 'version' => 'auto']); ?> - +
- item->key) ? JText::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_NEW_OVERRIDE_LEGEND') : JText::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_EDIT_OVERRIDE_LEGEND'); ?> + item->key) ? Text::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_NEW_OVERRIDE_LEGEND') : Text::_('COM_LANGUAGES_VIEW_OVERRIDE_EDIT_EDIT_OVERRIDE_LEGEND'); ?>
form->getLabel('language'); ?> @@ -93,22 +95,22 @@
- + - +
form->getInput('searchstring'); ?>
- +
@@ -123,19 +125,19 @@
- +
- +
- +
diff --git a/administrator/components/com_languages/tmpl/overrides/default.php b/administrator/components/com_languages/tmpl/overrides/default.php index ee77654682779..827cadd8290ae 100644 --- a/administrator/components/com_languages/tmpl/overrides/default.php +++ b/administrator/components/com_languages/tmpl/overrides/default.php @@ -10,20 +10,24 @@ defined('_JEXEC') or die; use Joomla\Component\Languages\Administrator\Helper\LanguagesHelper; +use Joomla\CMS\Language\Text; +use Joomla\CMS\Router\Route; +use Joomla\CMS\Factory; +use Joomla\CMS\HTML\HTMLHelper; -JHtml::addIncludePath(JPATH_COMPONENT . '/helpers/html'); -$client = $this->state->get('filter.client') == '0' ? JText::_('JSITE') : JText::_('JADMINISTRATOR'); +HTMLHelper::addIncludePath(JPATH_COMPONENT . '/helpers/html'); +$client = $this->state->get('filter.client') == '0' ? Text::_('JSITE') : Text::_('JADMINISTRATOR'); $language = $this->state->get('filter.language'); $listOrder = $this->escape($this->state->get('list.ordering')); $listDirn = $this->escape($this->state->get('list.direction')); -$opposite_client = $this->state->get('filter.client') == '1' ? JText::_('JSITE') : JText::_('JADMINISTRATOR'); +$opposite_client = $this->state->get('filter.client') == '1' ? Text::_('JSITE') : Text::_('JADMINISTRATOR'); $opposite_filename = constant('JPATH_' . strtoupper(1 - $this->state->get('filter.client')? 'administrator' : 'site')) . '/language/overrides/' . $this->state->get('filter.language', 'en-GB') . '.override.ini'; $opposite_strings = LanguagesHelper::parseFile($opposite_filename); ?> -
+
sidebar; ?> @@ -33,52 +37,52 @@
- + pagination->getLimitBox(); ?>
items)) : ?> - +
- + - +
- + - +
- + - +
- + - +
- + - lang_code); ?> + lang_code); ?>
- + - lang_code); ?> + lang_code); ?>
- + - +
    listUsersError as $user) : ?>
  • - name); ?> + name); ?>
@@ -115,52 +117,52 @@
- + - +
- + language_filter) : ?> - + - +
- + switchers != 0) : ?> switchers; ?> - +
homes > 1) : ?> - + - + homes > 1) : ?> homes; ?> - +
- + - + - + - +
- + - + - + - + - + - +
- + published) : ?> - + published && array_key_exists($contentlang->lang_code, $this->homepages)) : ?> - + published) : ?> - + lang_code, $this->homepages)) : ?> - + - +
- authorise('core.edit', 'com_languages'); ?> + authorise('core.edit', 'com_languages'); ?> items as $key => $text) : ?>
- + - + - + - + - +
- + - + escape($key); ?> escape($key); ?> @@ -114,7 +118,7 @@ - +