Source for file menu.php
Documentation is available at menu.php
* @package Joomla.Libraries
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved.
* @license GNU General Public License version 2 or later; see LICENSE
* @package Joomla.Libraries
* Array to hold the menu items
* @deprecated 4.0 Will convert to $items
* Identifier of the default menu item
* @deprecated 4.0 Will convert to $default
* Identifier of the active menu item
* @deprecated 4.0 Will convert to $active
* @var array JMenu instances container.
protected static $instances =
array();
* @param array $options An array of configuration options.
foreach ($this->_items as $item)
// Decode the item params
$result->loadString($item->params);
* @param string $client The name of the client
* @param array $options An associative array of options
* @return JMenu A menu object.
public static function getInstance($client, $options =
array())
if (empty(self::$instances[$client]))
$classname =
'JMenu' .
ucfirst($client);
// @deprecated 4.0 Everything in this block is deprecated but the warning is only logged after the file_exists
$path =
$info->path .
'/includes/menu.php';
JLog::add('Non-autoloadable JMenu subclasses are deprecated, support will be removed in 4.0.', JLog::WARNING, 'deprecated');
self::$instances[$client] =
new $classname($options);
throw
new Exception(JText::sprintf('JLIB_APPLICATION_ERROR_MENU_LOAD', $client), 500);
return self::$instances[$client];
* @param integer $id The item id
* @return mixed The item object, or null if not found
if (isset
($this->_items[$id]))
$result =
&$this->_items[$id];
* Set the default item by id and language code.
* @param integer $id The menu item id.
* @param string $language The language cod (since 1.6).
* @return boolean True, if successful
if (isset
($this->_items[$id]))
* Get the default item by language code.
* @param string $language The language code, default value of * means all.
* @return object The item object
* Set the default item by id
* @param integer $id The item id
* @return mixed If successful the active item, otherwise null
if (isset
($this->_items[$id]))
$result =
&$this->_items[$id];
* @return object The item object.
* Gets menu items by attribute
* @param mixed $attributes The field name(s).
* @param mixed $values The value(s) of the field. If an array, need to match field names
* each attribute may have multiple values to lookup for.
* @param boolean $firstonly If true, only returns the first item found
public function getItems($attributes, $values, $firstonly =
false)
$attributes = (array)
$attributes;
$values = (array)
$values;
foreach ($this->_items as $item)
for ($i =
0, $count =
count($attributes); $i <
$count; $i++
)
if (!in_array($item->$attributes[$i], $values[$i]))
if ($item->$attributes[$i] !=
$values[$i])
* Gets the parameter object for a certain menu item
* @param integer $id The item id
* @return JRegistry A JRegistry object
* Getter for the menu array
* Method to check JMenu object authorization against an access control
* object and optionally an access extension object
* @param integer $id The menu id
* @return boolean True if authorised
return in_array((int)
$menu->access, $user->getAuthorisedViewLevels());
Documentation generated on Tue, 19 Nov 2013 15:07:54 +0100 by phpDocumentor 1.4.3