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


PHP XenForo_Link::translateRouteFilterToRegex方法代码示例

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


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

示例1: match

 /**
  * Attempts to match the routing path. See {@link XenForo_Route_Interface} for further details.
  *
  * @param string $routePath Routing path
  * @param Zend_Controller_Request_Http $request Request object
  * @param XenForo_Router $router Routing object
  *
  * @return XenForo_RouteMatch|bool
  */
 public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
 {
     if (!XenForo_Application::isRegistered('routeFiltersIn')) {
         return false;
     }
     $filters = XenForo_Application::get('routeFiltersIn');
     if (!$filters) {
         return false;
     }
     foreach ($filters as $filter) {
         if (isset($filter['match_regex'])) {
             $from = $filter['match_regex'];
             $to = $filter['match_replace'];
         } else {
             list($from, $to) = XenForo_Link::translateRouteFilterToRegex(urldecode($filter['replace_route']), urldecode($filter['find_route']));
         }
         $newRoutePath = preg_replace($from, $to, $routePath);
         if ($newRoutePath != $routePath) {
             $match = $router->getRouteMatch();
             $match->setModifiedRoutePath($newRoutePath);
             return $match;
         }
     }
     return false;
 }
开发者ID:VoDongMy,项目名称:xenforo-laravel5.1,代码行数:34,代码来源:Filter.php

示例2: buildLink

 /**
  *
  * @see XenForo_Route_Prefix_Forums::buildLink()
  */
 public function buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, array &$extraParams)
 {
     if (isset($data['social_forum_id'])) {
         if (ThemeHouse_SocialGroups_SocialForum::hasInstance()) {
             $socialForum = ThemeHouse_SocialGroups_SocialForum::getInstance()->toArray();
         } else {
             $socialForum = $data;
         }
         $class = XenForo_Application::resolveDynamicClass('ThemeHouse_SocialGroups_Route_Prefix_SocialForums', 'route_prefix');
         $router = new $class();
         $link = $router->buildLink('social-forums', 'social-forums', $action, $extension, $socialForum, $extraParams);
         if (XenForo_Application::isRegistered('routeFiltersOut')) {
             $routeFilters = XenForo_Application::get('routeFiltersOut');
             if (isset($routeFilters['social-forums'])) {
                 foreach ($routeFilters['social-forums'] as $filter) {
                     if (array_key_exists('find_route', $filter) && array_key_exists('replace_route', $filter)) {
                         list($from, $to) = XenForo_Link::translateRouteFilterToRegex($filter['find_route'], $filter['replace_route']);
                         $newLink = preg_replace($from, $to, $link);
                     } else {
                         $newLink = $link;
                     }
                     if ($newLink != $link) {
                         $link = $newLink;
                         break;
                     }
                 }
             }
         }
         return $link;
     }
     return parent::buildLink($originalPrefix, $outputPrefix, $action, $extension, $data, $extraParams);
 }
开发者ID:ThemeHouse-XF,项目名称:SocialGroups,代码行数:36,代码来源:Forums.php

示例3: getRouteFiltersForCache

 public function getRouteFiltersForCache()
 {
     $results = $this->_getDb()->query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM xf_route_filter\r\n\t\t\tWHERE route_type = 'public' AND enabled = 1\r\n\t\t\tORDER BY LENGTH(replace_route) DESC\r\n\t\t");
     $in = array();
     while ($res = $results->fetch()) {
         list($from, $to) = XenForo_Link::translateRouteFilterToRegex(urldecode($res['replace_route']), urldecode($res['find_route']));
         $in[$res['route_filter_id']] = array('match_regex' => $from, 'match_replace' => $to);
     }
     $results = $this->_getDb()->query("\r\n\t\t\tSELECT *\r\n\t\t\tFROM xf_route_filter\r\n\t\t\tWHERE route_type = 'public'\r\n\t\t\t\tAND enabled = 1\r\n\t\t\t\tAND url_to_route_only = 0\r\n\t\t\tORDER BY prefix, LENGTH(find_route) DESC\r\n\t\t");
     $out = array();
     while ($res = $results->fetch()) {
         list($from, $to) = XenForo_Link::translateRouteFilterToRegex($res['find_route'], $res['replace_route']);
         $out[$res['prefix']][$res['route_filter_id']] = array('match_regex' => $from, 'match_replace' => $to);
     }
     return array('in' => $in, 'out' => $out);
 }
开发者ID:darkearl,项目名称:projectT122015,代码行数:16,代码来源:RouteFilter.php


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