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


PHP TagsHelperRoute::lookup方法代码示例

本文整理汇总了PHP中TagsHelperRoute::lookup方法的典型用法代码示例。如果您正苦于以下问题:PHP TagsHelperRoute::lookup方法的具体用法?PHP TagsHelperRoute::lookup怎么用?PHP TagsHelperRoute::lookup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TagsHelperRoute的用法示例。


在下文中一共展示了TagsHelperRoute::lookup方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _findItem

 /**
  * Find Item static function
  *
  * @param   array  $needles  Array used to get the language value
  *
  * @return null
  *
  * @throws Exception
  */
 protected static function _findItem($needles = null)
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu('site');
     $language = isset($needles['language']) ? $needles['language'] : '*';
     // Prepare the reverse lookup array.
     if (self::$lookup === null) {
         self::$lookup = array();
         $component = JComponentHelper::getComponent('com_tags');
         $items = $menus->getItems('component_id', $component->id);
         if ($items) {
             foreach ($items as $item) {
                 if (isset($item->query) && isset($item->query['view'])) {
                     $lang = $item->language != '' ? $item->language : '*';
                     if (!isset(self::$lookup[$lang])) {
                         self::$lookup[$lang] = array();
                     }
                     $view = $item->query['view'];
                     if (!isset(self::$lookup[$lang][$view])) {
                         self::$lookup[$lang][$view] = array();
                     }
                     // Only match menu items that list one tag
                     if (isset($item->query['id']) && is_array($item->query['id'])) {
                         foreach ($item->query['id'] as $position => $tagId) {
                             if (!isset(self::$lookup[$lang][$view][$item->query['id'][$position]]) || count($item->query['id']) == 1) {
                                 self::$lookup[$lang][$view][$item->query['id'][$position]] = $item->id;
                             }
                         }
                     }
                 }
             }
         }
     }
     if ($needles) {
         foreach ($needles as $view => $ids) {
             if (isset(self::$lookup[$language][$view])) {
                 foreach ($ids as $id) {
                     if (isset(self::$lookup[$language][$view][(int) $id])) {
                         return self::$lookup[$language][$view][(int) $id];
                     }
                 }
             }
         }
     } else {
         $active = $menus->getActive();
         if ($active) {
             return $active->id;
         }
     }
     return null;
 }
开发者ID:deenison,项目名称:joomla-cms,代码行数:60,代码来源:route.php

示例2: _findItem

 protected static function _findItem($needles = null)
 {
     $app = JFactory::getApplication();
     $menus = $app->getMenu('site');
     $language = isset($needles['language']) ? $needles['language'] : '*';
     // Prepare the reverse lookup array.
     if (self::$lookup === null) {
         self::$lookup = array();
         $component = JComponentHelper::getComponent('com_tags');
         $items = $menus->getItems('component_id', $component->id);
         if ($items) {
             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();
                     }
                     // Only match menu items that list one tag
                     if (isset($item->query['id'][0]) && count($item->query['id']) == 1) {
                         // Here it will become a bit tricky
                         // language != * can override existing entries
                         // language == * cannot override existing entries
                         if (!isset(self::$lookup[$language][$view][$item->query['id'][0]]) || $item->language != '*') {
                             self::$lookup[$language][$view][$item->query['id'][0]] = $item->id;
                         }
                         self::$lookup[$view][$item->query['id'][0]] = $item->id;
                     }
                     if (isset($item->query["tag_list_language_filter"]) && $item->query["tag_list_language_filter"] != '') {
                         $language = $item->query["tag_list_language_filter"];
                     }
                 }
             }
         }
     }
     if ($needles) {
         foreach ($needles as $view => $ids) {
             if (isset(self::$lookup[$view])) {
                 foreach ($ids as $id) {
                     if (isset(self::$lookup[$view][(int) $id])) {
                         return self::$lookup[$view][(int) $id];
                     }
                 }
             }
         }
     } else {
         $active = $menus->getActive();
         if ($active) {
             return $active->id;
         }
     }
     return null;
 }
开发者ID:WineWorld,项目名称:joomlatrialcmbg,代码行数:52,代码来源:route.php


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