protected function _find($type, $id) { // load config require_once JPATH_ADMINISTRATOR . '/components/com_zoo/config.php'; // get ZOO app $app = App::getInstance('zoo'); if (self::$_menu_items == null) { $component_id = $app->joomla->isVersion('1.5') ? 'componentid' : 'component_id'; $menu_items = $app->object->create('JSite')->getMenu()->getItems($component_id, JComponentHelper::getComponent('com_zoo')->id); $menu_items = $menu_items ? $menu_items : array(); self::$_menu_items = array_fill_keys(array('category', 'frontpage', 'item'), array()); foreach ($menu_items as $menu_item) { switch (@$menu_item->query['view']) { case 'frontpage': self::$_menu_items['frontpage'][$app->parameter->create($menu_item->params)->get('application')] = $menu_item; break; case 'category': self::$_menu_items['category'][$app->parameter->create($menu_item->params)->get('category')] = $menu_item; break; case 'item': self::$_menu_items['item'][$app->parameter->create($menu_item->params)->get('item_id')] = $menu_item; break; } } } return @self::$_menu_items[$type][$id]; }
function getTree(&$xmap, &$parent, &$params) { $link_query = parse_url($parent->link); parse_str(html_entity_decode($link_query['query']), $link_vars); $view = JArrayHelper::getValue($link_vars, 'view', 0); if ($view == 'item') { return true; } $include_categories = JArrayHelper::getValue($params, 'include_categories', 1, ''); $include_categories = $include_categories == 1 || $include_categories == 2 && $xmap->view == 'xml' || $include_categories == 3 && $xmap->view == 'html' || $xmap->view == 'navigator'; $params['include_categories'] = $include_categories; $include_items = JArrayHelper::getValue($params, 'include_items', 1, ''); $include_items = $include_items == 1 || $include_items == 2 && $xmap->view == 'xml' || $include_items == 3 && $xmap->view == 'html' || $xmap->view == 'navigator'; $params['include_items'] = $include_items; $priority = JArrayHelper::getValue($params, 'cat_priority', $parent->priority, ''); $changefreq = JArrayHelper::getValue($params, 'cat_changefreq', $parent->changefreq, ''); if ($priority == '-1') { $priority = $parent->priority; } if ($changefreq == '-1') { $changefreq = $parent->changefreq; } $params['cat_priority'] = $priority; $params['cat_changefreq'] = $changefreq; $priority = JArrayHelper::getValue($params, 'item_priority', $parent->priority, ''); $changefreq = JArrayHelper::getValue($params, 'item_changefreq', $parent->changefreq, ''); if ($priority == '-1') { $priority = $parent->priority; } if ($changefreq == '-1') { $changefreq = $parent->changefreq; } $params['item_priority'] = $priority; $params['item_changefreq'] = $changefreq; xmap_com_zoo::getCategoryTree($xmap, $parent, $params); }