CoreFiles by mySites.guru
LoginHelper.php82 lines, 1,717 bytes, from Joomla_4.0.0-beta7-Beta-Full_Package.zip
Raw History Compare with 4.0.0-beta6
md5
a0ea7635731ad21a90d7614040085114
sha1
52cb25e59e2a1b5835b01c27ffabcf202c2532b2
sha256
e81534d3274f6df0f3109a5e5f8aefa18c844d062c21ee7c2718506cf50b7387
<?php
/**
 * @package     Joomla.Administrator
 * @subpackage  mod_login
 *
 * @copyright   (C) 2010 Open Source Matters, Inc. <https://www.joomla.org>
 * @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\HTML\HTMLHelper;
use Joomla\CMS\Language\LanguageHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Uri\Uri;

/**
 * Helper for mod_login
 *
 * @since  1.6
 */
abstract class LoginHelper
{
	/**
	 * Get an HTML select list of the available languages.
	 *
	 * @return  string
	 */
	public static function getLanguageList()
	{
		$languages = LanguageHelper::createLanguageList(null, JPATH_ADMINISTRATOR, false, true);

		if (\count($languages) <= 1)
		{
			return '';
		}

		usort(
			$languages,
			function ($a, $b)
			{
				return strcmp($a['value'], $b['value']);
			}
		);

		// Fix wrongly set parentheses in RTL languages
		if (Factory::getApplication()->getLanguage()->isRtl())
		{
			foreach ($languages as &$language)
			{
				$language['text'] = $language['text'] . '&#x200E;';
			}
		}

		array_unshift($languages, HTMLHelper::_('select.option', '', Text::_('JDEFAULTLANGUAGE')));

		return HTMLHelper::_('select.genericlist', $languages, 'lang', 'class="form-select"', 'value', 'text', null);
	}

	/**
	 * Get the redirect URI after login.
	 *
	 * @return  string
	 */
	public static function getReturnUri()
	{
		$uri    = Uri::getInstance();
		$return = 'index.php' . $uri->toString(array('query'));

		if ($return != 'index.php?option=com_login')
		{
			return base64_encode($return);
		}
		else
		{
			return base64_encode('index.php');
		}
	}
}

The same content is in 50 releases, Joomla 4.0.0-beta7 to 4.2.0-beta2. See them all, or every version of this file.