protected static function _findItemId($needles) { // Prepare the reverse lookup array. if (self::$lookup === null) { self::$lookup = array(); $component =& JComponentHelper::getComponent('com_contact'); $menus =& JApplication::getMenu('site', array()); $items = $menus->getItems('component_id', $component->id); foreach ($items as &$item) { if (isset($item->query) && isset($item->query['view'])) { $view = $item->query['view']; if (!isset(self::$lookup[$view])) { self::$lookup[$view] = array(); } if (isset($item->query['id'])) { self::$lookup[$view][$item->query['id']] = $item->id; } } } } $match = null; foreach ($needles as $view => $id) { if (isset(self::$lookup[$view])) { if (isset(self::$lookup[$view][$id])) { return self::$lookup[$view][$id]; } } } return null; }