本文整理汇总了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);
}
示例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);
}