- md5
- a7d39352e806bf1bc4dfe73516cc439f
- sha1
- fdec78145235552e17e2173c0a954e632b2a1452
- sha256
- b03b9484c2cd335ffbbfc3c3fe602c7adf634cb43a724d638d7cb525ca0c14f8
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206
<?php
/**
* @package Joomla.Site
* @subpackage com_users
*
* @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE.txt
*/
defined('_JEXEC') or die;
/**
* Users Route Helper
*
* @since 1.6
*/
class UsersHelperRoute
{
/**
* Method to get the menu items for the component.
*
* @return array An array of menu items.
*
* @since 1.6
*/
public static function &getItems()
{
static $items;
// Get the menu items for this component.
if (!isset($items))
{
$app = JFactory::getApplication();
$menu = $app->getMenu();
$com = JComponentHelper::getComponent('com_users');
$items = $menu->getItems('component_id', $com->id);
// If no items found, set to empty array.
if (!$items)
{
$items = array();
}
}
return $items;
}
/**
* Method to get a route configuration for the login view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
* @static
*/
public static function getLoginRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'login')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
/**
* Method to get a route configuration for the profile view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
*/
public static function getProfileRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
// Menu link can only go to users own profile.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'profile')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
/**
* Method to get a route configuration for the registration view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
*/
public static function getRegistrationRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'registration')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
/**
* Method to get a route configuration for the remind view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
*/
public static function getRemindRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'remind')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
/**
* Method to get a route configuration for the resend view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
*/
public static function getResendRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'resend')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
/**
* Method to get a route configuration for the reset view.
*
* @return mixed Integer menu id on success, null on failure.
*
* @since 1.6
*/
public static function getResetRoute()
{
// Get the items.
$items = self::getItems();
$itemid = null;
// Search for a suitable menu id.
foreach ($items as $item)
{
if (isset($item->query['view']) && $item->query['view'] === 'reset')
{
$itemid = $item->id;
break;
}
}
return $itemid;
}
}
The same content is in 28 releases, Joomla 3.5.0-beta2 to 3.6.5. See them all, or every version of this file.