[ Index ] |
PHP Cross Reference of Joomla 4.2.2 documentation |
[Summary view] [Print] [Text view]
1 <?php 2 3 /** 4 * @package Joomla.Site 5 * @subpackage mod_login 6 * 7 * @copyright (C) 2006 Open Source Matters, Inc. <https://www.joomla.org> 8 * @license GNU General Public License version 2 or later; see LICENSE.txt 9 */ 10 11 namespace Joomla\Module\Login\Site\Helper; 12 13 use Joomla\CMS\Factory; 14 use Joomla\CMS\Language\Multilanguage; 15 use Joomla\CMS\Uri\Uri; 16 17 // phpcs:disable PSR1.Files.SideEffects 18 \defined('_JEXEC') or die; 19 // phpcs:enable PSR1.Files.SideEffects 20 21 /** 22 * Helper for mod_login 23 * 24 * @since 1.5 25 */ 26 class LoginHelper 27 { 28 /** 29 * Retrieve the URL where the user should be returned after logging in 30 * 31 * @param \Joomla\Registry\Registry $params module parameters 32 * @param string $type return type 33 * 34 * @return string 35 */ 36 public static function getReturnUrl($params, $type) 37 { 38 $item = Factory::getApplication()->getMenu()->getItem($params->get($type)); 39 40 // Stay on the same page 41 $url = Uri::getInstance()->toString(); 42 43 if ($item) { 44 $lang = ''; 45 46 if ($item->language !== '*' && Multilanguage::isEnabled()) { 47 $lang = '&lang=' . $item->language; 48 } 49 50 $url = 'index.php?Itemid=' . $item->id . $lang; 51 } 52 53 return base64_encode($url); 54 } 55 56 /** 57 * Returns the current users type 58 * 59 * @return string 60 */ 61 public static function getType() 62 { 63 $user = Factory::getUser(); 64 65 return (!$user->get('guest')) ? 'logout' : 'login'; 66 } 67 68 /** 69 * Retrieve the URL for the registration page 70 * 71 * @param \Joomla\Registry\Registry $params module parameters 72 * 73 * @return string 74 */ 75 public static function getRegistrationUrl($params) 76 { 77 $regLink = 'index.php?option=com_users&view=registration'; 78 $regLinkMenuId = $params->get('customRegLinkMenu'); 79 80 // If there is a custom menu item set for registration => override default 81 if ($regLinkMenuId) { 82 $item = Factory::getApplication()->getMenu()->getItem($regLinkMenuId); 83 84 if ($item) { 85 $regLink = 'index.php?Itemid=' . $regLinkMenuId; 86 87 if ($item->language !== '*' && Multilanguage::isEnabled()) { 88 $regLink .= '&lang=' . $item->language; 89 } 90 } 91 } 92 93 return $regLink; 94 } 95 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Wed Sep 7 05:41:13 2022 | Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer |