本文整理匯總了PHP中FlexicontentHelperRoute::populateLookupTable方法的典型用法代碼示例。如果您正苦於以下問題:PHP FlexicontentHelperRoute::populateLookupTable方法的具體用法?PHP FlexicontentHelperRoute::populateLookupTable怎麽用?PHP FlexicontentHelperRoute::populateLookupTable使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類FlexicontentHelperRoute
的用法示例。
在下文中一共展示了FlexicontentHelperRoute::populateLookupTable方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _findTag
static function _findTag($needles, &$data)
{
if ( !$needles ) return false;
// Get language, item, current (matched) category menu item
$language = $data['language'];
// Set language menu items if not already done
if ( !isset(self::$menuitems[$language]) ) {
FlexicontentHelperRoute::_setMenuitems($language);
}
$component_menuitems = & self::$menuitems[$language];
// *****************************************************************************************************************
// Done ONCE per language: Iterate through menu items pointing to FLEXIcontent component, to create a reverse lookup
// table for the given language, not if given language is missing the an '*' menu item will be allowed in its place
// *****************************************************************************************************************
if ( !isset(self::$lookup[$language]) ) {
FlexicontentHelperRoute::populateLookupTable($language);
}
// Get current menu item, we will prefer current menu if it points to given category,
// thus maintaining current menu item if multiple menu items to same category exist !!
static $active = null;
if ($active == null) {
$menus = JFactory::getApplication()->getMenu('site', array()); // this will work in J1.5 backend too !!!
$active = $menus->getActive();
if ($active && @ $active->query['option']!='com_flexicontent') $active=false;
}
// Now find menu item for given needles
$matched_menu = false;
foreach ($needles as $view => $ids)
{
if ( is_object($ids) ) return $ids; // done, this an already appropriate menu item object
// Lookup if then given ids for the given view exists for the given language
if ( !isset(self::$lookup[$language][$view]) ) continue;
foreach($ids as $id)
{
if ( !isset(self::$lookup[$language][$view][(int)$id]) ) continue; // not found
//echo "$language $view $id : ". self::$lookup[$language][$view][(int)$id] ."<br/>";
$menuid = self::$lookup[$language][$view][(int)$id];
$menuitem = $component_menuitems[$menuid];
// menu item matched, break out
$matched_menu = $menuitem;
break;
}
if ($matched_menu) break;
}
// Prefer current tags menu item if also appropriate
if ($matched_menu && $active && @ $matched_menu->query['view'] == 'tags' &&
@ $matched_menu->query['view'] == @ $active->query['view'] &&
@ $matched_menu->query['id'] == @ $active->query['id']
) {
$matched_menu = $active;
}
return $matched_menu;
}