当前位置: 首页>>代码示例>>PHP>>正文


PHP FlexicontentHelperRoute::populateLookupTable方法代码示例

本文整理汇总了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;
	}
开发者ID:kosmosby,项目名称:medicine-prof,代码行数:68,代码来源:route.php


注:本文中的FlexicontentHelperRoute::populateLookupTable方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。