本文整理汇总了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;
}