當前位置: 首頁>>代碼示例>>PHP>>正文


PHP XenForo_Link::getPrefixHandlerClassName方法代碼示例

本文整理匯總了PHP中XenForo_Link::getPrefixHandlerClassName方法的典型用法代碼示例。如果您正苦於以下問題:PHP XenForo_Link::getPrefixHandlerClassName方法的具體用法?PHP XenForo_Link::getPrefixHandlerClassName怎麽用?PHP XenForo_Link::getPrefixHandlerClassName使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在XenForo_Link的用法示例。


在下文中一共展示了XenForo_Link::getPrefixHandlerClassName方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: match

 /**
  * Attempts to match the routing path.
  * See {@link XenForo_Route_Interface} for further details.
  *
  * @param string Routing path
  * @param Zend_Controller_Request_Http Request object
  * @param XenForo_Router Routing object
  *
  * @return false XenForo_RouteMatch
  */
 public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
 {
     list($prefix) = explode('/', $routePath);
     if ($prefix === '') {
         return false;
     }
     $delimQuoted = preg_quote(XenForo_Application::URL_ID_DELIMITER);
     $extension = '';
     $xenOptions = XenForo_Application::get('options');
     if ($xenOptions->th_shorterRoutes_extension) {
         $extension = preg_quote('.' . $xenOptions->th_shorterRoutes_extension);
     }
     if (!preg_match('#^([^' . $delimQuoted . '^/]*' . $delimQuoted . ')?([a-zA-Z]+)([0-9]+)' . $extension . '#', $prefix, $matches)) {
         return false;
     }
     $title = $matches[1];
     $shorterPrefix = $matches[2];
     $integer = $matches[3];
     if ($shorterPrefix == 'f') {
         $routeClass = XenForo_Link::getPrefixHandlerClassName($this->_routeType, 'forums');
     } elseif ($shorterPrefix == 't') {
         $routeClass = XenForo_Link::getPrefixHandlerClassName($this->_routeType, 'threads');
     } else {
         return false;
     }
     if (!$routeClass) {
         return false;
     }
     $newRoutePath = $title . $integer . '/' . substr($routePath, strlen($prefix) + 1);
     return $this->_loadAndRunSubRule($routeClass, $newRoutePath, $request, $router);
 }
開發者ID:ThemeHouse-XF,項目名稱:ShorterRoutes,代碼行數:41,代碼來源:ShorterRoute.php

示例2: match

 /**
  * Attempts to match the routing path. See {@link XenForo_Route_Interface} for further details.
  *
  * @param string Routing path
  * @param Zend_Controller_Request_Http Request object
  * @param XenForo_Router Routing object
  *
  * @return false|XenForo_RouteMatch
  */
 public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
 {
     list($prefix) = explode('/', $routePath);
     if ($prefix === '') {
         return false;
     }
     if (preg_match('#[^a-zA-Z0-9_-]#', $prefix)) {
         return false;
     }
     $routeClass = XenForo_Link::getPrefixHandlerClassName($this->_routeType, $prefix);
     if (!$routeClass) {
         return false;
     }
     $newRoutePath = substr($routePath, strlen($prefix) + 1);
     if (!is_string($newRoutePath)) {
         $newRoutePath = '';
     }
     return $this->_loadAndRunSubRule($routeClass, $newRoutePath, $request, $router);
 }
開發者ID:Sywooch,項目名稱:forums,代碼行數:28,代碼來源:Prefix.php


注:本文中的XenForo_Link::getPrefixHandlerClassName方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。