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


PHP JRouter::processBuildRules方法代码示例

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


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

示例1: processBuildRules

 /**
  * Process the build uri query data based on custom defined rules
  *
  * @param   JUri  &$uri  The URI
  *
  * @return  void
  *
  * @since   3.2
  */
 protected function processBuildRules(&$uri)
 {
     // Make sure any menu vars are used if no others are specified
     if ($this->_mode != JROUTER_MODE_SEF && $uri->getVar('Itemid') && count($uri->getQuery(true)) == 2) {
         $app = JApplication::getInstance('site');
         $menu = $app->getMenu();
         // Get the active menu item
         $itemid = $uri->getVar('Itemid');
         $item = $menu->getItem($itemid);
         if ($item) {
             $uri->setQuery($item->query);
         }
         $uri->setVar('Itemid', $itemid);
     }
     // Process the attached build rules
     parent::processBuildRules($uri);
     // Get the path data
     $route = $uri->getPath();
     if ($this->_mode == JROUTER_MODE_SEF && $route) {
         if ($limitstart = $uri->getVar('limitstart')) {
             $uri->setVar('start', (int) $limitstart);
             $uri->delVar('limitstart');
         }
     }
     $uri->setPath($route);
 }
开发者ID:ryanshowers,项目名称:joomla-cms,代码行数:35,代码来源:site.php

示例2: processBuildRules

 /**
  * Process the build uri query data based on custom defined rules
  *
  * @param   JUri    &$uri   The URI
  * @param   string  $stage  The stage that should be processed.
  *                          Possible values: 'preprocess', 'postprocess'
  *                          and '' for the main build stage
  *
  * @return  void
  *
  * @since   3.2
  * @deprecated  4.0  The special logic should be implemented as rule
  */
 protected function processBuildRules(&$uri, $stage = self::PROCESS_DURING)
 {
     if ($stage == self::PROCESS_DURING) {
         // Make sure any menu vars are used if no others are specified
         $query = $uri->getQuery(true);
         if ($this->_mode != 1 && isset($query['Itemid']) && (count($query) == 2 || count($query) == 3 && isset($query['lang']))) {
             // Get the active menu item
             $itemid = $uri->getVar('Itemid');
             $lang = $uri->getVar('lang');
             $item = $this->menu->getItem($itemid);
             if ($item) {
                 $uri->setQuery($item->query);
             }
             $uri->setVar('Itemid', $itemid);
             if ($lang) {
                 $uri->setVar('lang', $lang);
             }
         }
     }
     // Process the attached build rules
     parent::processBuildRules($uri, $stage);
     if ($stage == self::PROCESS_BEFORE) {
         // Get the query data
         $query = $uri->getQuery(true);
         if (!isset($query['option'])) {
             return;
         }
         // Build the component route
         $component = preg_replace('/[^A-Z0-9_\\.-]/i', '', $query['option']);
         $router = $this->getComponentRouter($component);
         $query = $router->preprocess($query);
         $uri->setQuery($query);
     }
     if ($stage == self::PROCESS_DURING) {
         // Get the path data
         $route = $uri->getPath();
         if ($this->_mode == JROUTER_MODE_SEF && $route) {
             if ($limitstart = $uri->getVar('limitstart')) {
                 $uri->setVar('start', (int) $limitstart);
                 $uri->delVar('limitstart');
             }
         }
         $uri->setPath($route);
     }
 }
开发者ID:educakanchay,项目名称:educared,代码行数:58,代码来源:site.php


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