english/includes/menu.php
/**
	 * Loads the entire menu table into memory.
	 *
	 * @return array
	 */
Loads the entire menu table into memory.
@return array
Loads the entire menu table into memory . @return array
public function load()
	{	$user = JFactory::getUser();
		$cache = JFactory::getCache('mod_menu', '');  
		if (!$data = $cache->get('menu_items'.JFactory::getLanguage()->getTag().$user->id)) {
			$db		= JFactory::getDbo();
			$app	= JFactory::getApplication();
			$query	= $db->getQuery(true);
			$query->select('m.id, m.menutype, m.title, m.alias, m.path AS route, m.link, m.type, m.level');
			$query->select('m.browserNav, m.access, m.params, m.home, m.img, m.template_style_id, m.component_id, m.parent_id');
			$query->select('m.language');
			$query->select('e.element as component');
			$query->from('#__menu AS m');
			$query->leftJoin('#__extensions AS e ON m.component_id = e.extension_id');
			$query->where('m.published = 1');
			$query->where('m.parent_id > 0');
			$query->where('m.client_id = 0');
			$query->order('m.lft');
			$groups = implode(',', $user->getAuthorisedViewLevels());
			$query->where('m.access IN (' . $groups . ')');
			$db->setQuery($query);
			if (!($menus = $db->loadObjectList('id'))) {
				JError::raiseWarning(500, JText::sprintf('JERROR_LOADING_MENUS', $db->getErrorMsg()));
				return false;
			}
			foreach ($menus as &$menu) {
				$parent_tree = array();
				if (isset($menus[$menu->parent_id])) {
					$parent_tree  = $menus[$menu->parent_id]->tree;
				}
				$parent_tree[] = $menu->id;
				$menu->tree = $parent_tree;
				$url = str_replace('index.php?', '', $menu->link);
				$url = str_replace('&amp;','&',$url);
				parse_str($url, $menu->query);
			}
			$cache->store($menus, 'menu_items'.JFactory::getLanguage()->getTag());
			$this->_items = $menus;
		} else {
			$this->_items = $data;
		}
	}
public function load ( ) { $ user = JFactory :: getUser ( ) ; $ cache = JFactory :: getCache ( 'mod_menu' , '' ) ; if ( ! $ data = $ cache -> get ( 'menu_items' . JFactory :: getLanguage ( ) -> getTag ( ) . $ user -> id ) ) { $ db = JFactory :: getDbo ( ) ; $ app = JFactory :: getApplication ( ) ; $ query = $ db -> getQuery ( true ) ; $ query -> select ( 'm.id, m.menutype, m.title, m.alias, m.path AS route, m.link, m.type, m.level' ) ; $ query -> select ( 'm.browserNav, m.access, m.params, m.home, m.img, m.template_style_id, m.component_id, m.parent_id' ) ; $ query -> select ( 'm.language' ) ; $ query -> select ( 'e.element as component' ) ; $ query -> from ( '#__menu AS m' ) ; $ query -> leftJoin ( '#__extensions AS e ON m.component_id = e.extension_id' ) ; $ query -> where ( 'm.published = 1' ) ; $ query -> where ( 'm.parent_id > 0' ) ; $ query -> where ( 'm.client_id = 0' ) ; $ query -> order ( 'm.lft' ) ; $ groups = implode ( ',' , $ user -> getAuthorisedViewLevels ( ) ) ; $ query -> where ( 'm.access IN (' . $ groups . ')' ) ; $ db -> setQuery ( $ query ) ; if ( ! ( $ menus = $ db -> loadObjectList ( 'id' ) ) ) { JError :: raiseWarning ( 500 , JText :: sprintf ( 'JERROR_LOADING_MENUS' , $ db -> getErrorMsg ( ) ) ) ; return false ; } foreach ( $ menus as & $ menu ) { $ parent_tree = array ( ) ; if ( isset ( $ menus [ $ menu -> parent_id ] ) ) { $ parent_tree = $ menus [ $ menu -> parent_id ] -> tree ; } $ parent_tree [ ] = $ menu -> id ; $ menu -> tree = $ parent_tree ; $ url = str_replace ( 'index.php?' , '' , $ menu -> link ) ; $ url = str_replace ( '&amp;' , '&' , $ url ) ; parse_str ( $ url , $ menu -> query ) ; } $ cache -> store ( $ menus , 'menu_items' . JFactory :: getLanguage ( ) -> getTag ( ) ) ; $ this -> _items = $ menus ; } else { $ this -> _items = $ data ; } }
Loads the entire menu table into memory.
Loads the entire menu table into memory .
// has to be mod_menu or this cache won't get cleaned // Initialise variables. // Set the query // Get parent information. // Create tree. // Create the query array.