diff --git a/administrator/modules/mod_login/helper.php b/administrator/modules/mod_login/Helper/LoginHelper.php similarity index 68% rename from administrator/modules/mod_login/helper.php rename to administrator/modules/mod_login/Helper/LoginHelper.php index a1bd25b09fdcf..48058f1793946 100644 --- a/administrator/modules/mod_login/helper.php +++ b/administrator/modules/mod_login/Helper/LoginHelper.php @@ -6,15 +6,22 @@ * @copyright Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved. * @license GNU General Public License version 2 or later; see LICENSE.txt */ +namespace Joomla\Module\Login\Administrator\Helper; defined('_JEXEC') or die; +use Joomla\CMS\Factory; +use Joomla\CMS\Helper\AuthenticationHelper; +use Joomla\CMS\Language\LanguageHelper; +use Joomla\CMS\Log\Log; +use Joomla\CMS\Uri\Uri; + /** * Helper for mod_login * * @since 1.6 */ -abstract class ModLoginHelper +abstract class LoginHelper { /** * Get an HTML select list of the available languages. @@ -23,7 +30,7 @@ abstract class ModLoginHelper */ public static function getLanguageList() { - $languages = JLanguageHelper::createLanguageList(null, JPATH_ADMINISTRATOR, false, true); + $languages = LanguageHelper::createLanguageList(null, JPATH_ADMINISTRATOR, false, true); if (count($languages) <= 1) { @@ -39,7 +46,7 @@ function ($a, $b) ); // Fix wrongly set parentheses in RTL languages - if (JFactory::getLanguage()->isRtl()) + if (Factory::getLanguage()->isRtl()) { foreach ($languages as &$language) { @@ -47,9 +54,9 @@ function ($a, $b) } } - array_unshift($languages, JHtml::_('select.option', '', JText::_('JDEFAULTLANGUAGE'))); + array_unshift($languages, \JHtml::_('select.option', '', \JText::_('JDEFAULTLANGUAGE'))); - return JHtml::_('select.genericlist', $languages, 'lang', ' class="custom-select"', 'value', 'text', null); + return \JHtml::_('select.genericlist', $languages, 'lang', ' class="custom-select"', 'value', 'text', null); } /** @@ -59,7 +66,7 @@ function ($a, $b) */ public static function getReturnUri() { - $uri = JUri::getInstance(); + $uri = Uri::getInstance(); $return = 'index.php' . $uri->toString(array('query')); if ($return != 'index.php?option=com_login') @@ -84,17 +91,17 @@ public static function getTwoFactorMethods() { try { - JLog::add( + Log::add( sprintf('%s() is deprecated, use JAuthenticationHelper::getTwoFactorMethods() instead.', __METHOD__), - JLog::WARNING, + Log::WARNING, 'deprecated' ); } - catch (RuntimeException $exception) + catch (\RuntimeException $exception) { // Informational log only } - return JAuthenticationHelper::getTwoFactorMethods(); + return AuthenticationHelper::getTwoFactorMethods(); } } diff --git a/administrator/modules/mod_login/mod_login.php b/administrator/modules/mod_login/mod_login.php index c48860246b61c..b47647f5f9fc3 100644 --- a/administrator/modules/mod_login/mod_login.php +++ b/administrator/modules/mod_login/mod_login.php @@ -9,11 +9,12 @@ defined('_JEXEC') or die; -// Include the login functions only once -JLoader::register('ModLoginHelper', __DIR__ . '/helper.php'); +use Joomla\CMS\Helper\AuthenticationHelper; +use Joomla\CMS\Helper\ModuleHelper; +use Joomla\Module\Login\Administrator\Helper\LoginHelper; -$langs = ModLoginHelper::getLanguageList(); -$twofactormethods = JAuthenticationHelper::getTwoFactorMethods(); -$return = ModLoginHelper::getReturnUri(); +$langs = LoginHelper::getLanguageList(); +$twofactormethods = AuthenticationHelper::getTwoFactorMethods(); +$return = LoginHelper::getReturnUri(); -require JModuleHelper::getLayoutPath('mod_login', $params->get('layout', 'default')); +require ModuleHelper::getLayoutPath('mod_login', $params->get('layout', 'default'));