本文整理汇总了PHP中XenForo_Router::getRouteMatch方法的典型用法代码示例。如果您正苦于以下问题:PHP XenForo_Router::getRouteMatch方法的具体用法?PHP XenForo_Router::getRouteMatch怎么用?PHP XenForo_Router::getRouteMatch使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XenForo_Router
的用法示例。
在下文中一共展示了XenForo_Router::getRouteMatch方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: match
/**
*
* @see XenForo_Route_PrefixAdmin_AddOns::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$parts = explode('/', $routePath, 3);
switch ($parts[0]) {
case 'languages':
$parts = array_slice($parts, 1);
$routePath = implode('/', $parts);
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'language_id');
return $router->getRouteMatch('XenForo_ControllerAdmin_Language', $action, 'languages');
case 'phrases':
$parts = array_slice($parts, 1);
$routePath = implode('/', $parts);
return $router->getRouteMatch('XenForo_ControllerAdmin_Phrase', $routePath, 'phrases');
}
if (count($parts) > 1) {
switch ($parts[1]) {
case 'languages':
$action = $router->resolveActionWithStringParam($routePath, $request, 'addon_id');
$parts = array_slice($parts, 2);
$routePath = implode('/', $parts);
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'language_id');
return $router->getRouteMatch('XenForo_ControllerAdmin_Language', $action, 'languages');
case 'phrases':
$action = $router->resolveActionWithStringParam($routePath, $request, 'addon_id');
$parts = array_slice($parts, 2);
$routePath = implode('/', $parts);
return $router->getRouteMatch('XenForo_ControllerAdmin_Phrase', $routePath, 'phrases');
}
}
return parent::match($routePath, $request, $router);
}
示例2: match
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$components = explode('/', $routePath);
$subPrefix = strtolower(array_shift($components));
$controllerName = '';
$action = '';
$intParams = 'page_id';
$strParams = '';
$slice = false;
switch ($subPrefix) {
case 'special':
if (!empty($components[1]) && ($components[0] == 'edit-template' || $components[0] == 'delete-template')) {
unset($components[1]);
}
$controllerName = '_Special';
$slice = true;
break;
case 'archive':
$controllerName = '_Archive';
$intParams = 'history_id';
$slice = true;
break;
default:
$strParams = 'page_slug';
}
$routePathAction = implode('/', array_slice($slice ? $components : explode('/', $routePath), 0, 2)) . '/';
$routePathAction = str_replace('//', '/', $routePathAction);
if ($strParams) {
$action = $router->resolveActionWithStringParam($routePathAction, $request, $strParams);
} else {
$action = $router->resolveActionWithIntegerParam($routePathAction, $request, $intParams);
}
$action = $router->resolveActionAsPageNumber($action, $request);
return $router->getRouteMatch('EWRcarta_ControllerPublic_Wiki' . $controllerName, $action, 'wiki', $routePath);
}
示例3: match
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$components = explode('/', $routePath);
$subPrefix = strtolower(array_shift($components));
$strParams = '';
$slice = false;
switch ($subPrefix) {
case 'options':
$controllerName = '_Options';
$strParams = 'option_id';
$slice = true;
break;
case 'layouts':
$controllerName = '_Layouts';
$strParams = 'layout_id';
$slice = true;
break;
case 'blocks':
$controllerName = '_Blocks';
$strParams = 'block_id';
$slice = true;
break;
case 'categories':
$controllerName = '_Categories';
$strParams = 'category_slug';
$slice = true;
break;
default:
$controllerName = '_Blocks';
}
$routePathAction = $slice ? implode('/', array_slice($components, 0, 2)) : $routePath;
$action = $router->resolveActionWithStringParam($routePathAction, $request, $strParams);
return $router->getRouteMatch('EWRporta_ControllerAdmin' . $controllerName, $action, 'EWRporta', $routePath);
}
示例4: match
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$controller = 'QCPlayers_ControllerPublic_Player';
$routePath .= '/';
$action = $router->resolveActionWithStringParam($routePath, $request, 'username');
return $router->getRouteMatch($controller, $action, 'players', $routePath);
}
示例5: match
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$components = explode('/', $routePath);
$action = strtolower(array_shift($components));
if (count($components) == 1) {
// permission/<action>, etc
$action .= reset($components);
} else {
switch ($action) {
case 'permission':
// permission/<group>/<permission>/<action>
$request->setParam('permission_group_id', array_shift($components));
$request->setParam('permission_id', array_shift($components));
break;
case 'permission-group':
// permission-group/<group>/<action>
$request->setParam('permission_group_id', array_shift($components));
break;
case 'interface-group':
// interface-group/<group>/<action>
$request->setParam('interface_group_id', array_shift($components));
break;
}
$action .= implode('', $components);
}
return $router->getRouteMatch('XenForo_ControllerAdmin_Permission', $action, 'permissionsDevelopment');
}
示例6: match
/**
* Handles routing for view page.
**/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
// Many thanks to Jaxel for his documentation on this (http://xenforo.com/community/threads/13605/)
$components = explode('/', $routePath);
$subPrefix = strtolower(array_shift($components));
$subSplits = explode('.', $subPrefix);
$slice = false;
switch ($subPrefix) {
case 'confirm':
$controller = "Confirm";
break;
case 'delete':
$controller = "Delete";
break;
case 'api':
$controller = "Api";
break;
case 'view':
default:
$controller = 'View';
}
$routePathAction = ($slice ? implode('/', array_slice($components, 0, 2)) : $routePath) . '/';
$routePathAction = str_replace('//', '/', $routePathAction);
$action = $router->resolveActionWithStringParam($routePathAction, $request, "string_id");
return $router->getRouteMatch('AssociationMc_ControllerPublic_' . $controller, $action, 'view');
}
示例7: 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)
{
$lastDot = strrpos($routePath, '.');
if ($lastDot === false) {
return false;
}
$lastSlash = strrpos($routePath, '/');
if ($lastSlash !== false && $lastDot < $lastSlash) {
return false;
}
$responseType = substr($routePath, $lastDot + 1);
if ($responseType === strval(intval($responseType))) {
return false;
}
$newRoutePath = substr($routePath, 0, $lastDot);
if (!is_string($newRoutePath)) {
$newRoutePath = '';
}
$match = $router->getRouteMatch();
$match->setModifiedRoutePath($newRoutePath);
if ($responseType !== '') {
$match->setResponseType($responseType);
}
return $match;
}
示例8: match
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$components = explode('/', $routePath);
if (isset($components[1]) && preg_match('#^([0-9]*)$#', $components[1], $matches)) {
$request->setParam('chapter', $components[1]);
$request->setParam('url_portion', $components[0]);
unset($components[0], $components[1]);
$action = implode('', $components);
} elseif (isset($components[1]) && preg_match('#^([0-9]*):([0-9]*)$#', $components[1], $matches)) {
$request->setParam('chapter', $matches[1]);
$request->setParam('verse', $matches[2]);
$request->setParam('url_portion', $components[0]);
unset($components[0], $components[1]);
$action = implode('', $components);
} elseif (isset($components[1]) && preg_match('#^([0-9]*):([0-9]*)-([0-9]*)$#', $components[1], $matches)) {
$request->setParam('chapter', $matches[1]);
$request->setParam('verse', $matches[2]);
$request->setParam('verse_to', $matches[3]);
$request->setParam('url_portion', $components[0]);
unset($components[0], $components[1]);
$action = implode('', $components);
} else {
$action = $router->resolveActionWithStringParam($routePath, $request, 'url_portion');
}
return $router->getRouteMatch('ThemeHouse_Bible_ControllerPublic_Bible', $action, 'bible');
}
示例9: match
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'id');
$routeMatch = $router->getRouteMatch('Dark_TaigaChat_ControllerPublic_TaigaChat', $action, 'taigachat', $routePath);
//$routeMatch->setResponseType('jsonText');
return $routeMatch;
}
示例10: 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;
}
示例11: match
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
if (preg_match('#^auto/(.*)$#i', $routePath, $match)) {
$action = 'auto' . $router->resolveActionWithIntegerParam($match[1], $request, 'auto_warning_id');
return $router->getRouteMatch('XenForo_ControllerAdmin_Warning', $action, 'userWarnings');
}
return parent::match($routePath, $request, $router);
}
示例12: match
/**
*
* @see XenForo_Route_Prefix_Index::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$xenOptions = XenForo_Application::get('options');
if ($xenOptions->th_noForo_noForum) {
return $router->getRouteMatch('XenForo_ControllerPublic_Index', 'index', 'home');
}
return parent::match($routePath, $request, $router);
}
示例13: match
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$action = $router->getSubComponentAction($this->_subComponents, $routePath, $request, $controller);
if ($action === false) {
$action = $router->resolveActionWithIntegerParam($routePath, $request, 'profile_post_id');
}
return $router->getRouteMatch('XenForo_ControllerPublic_ProfilePost', $action, 'members');
}
示例14: match
/**
* Match a specific route for an already matched prefix.
*
* @see XenForo_Route_Interface::match()
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$parts = explode('/', $routePath, 2);
$controllerPart = str_replace(array('-', '/'), ' ', strtolower($parts[0]));
$controllerPart = str_replace(' ', '', ucwords($controllerPart));
$action = isset($parts[1]) ? $parts[1] : '';
return $router->getRouteMatch('XenForo_ControllerPublic_InlineMod_' . $controllerPart, $action, 'forums');
}
示例15: match
/**
* @see XenForo_Route_Interface::match()
* @param $routePath
* @param \Zend_Controller_Request_Http $request
* @param \XenForo_Router $router
* @return \XenForo_RouteMatch
*/
public function match($routePath, Zend_Controller_Request_Http $request, XenForo_Router $router)
{
$customIndex = XenForo_Application::get('customIndex');
if ($customIndex->params) {
$request->setParams($customIndex->params->toArray());
}
return $router->getRouteMatch($customIndex->controllerClass, $routePath, $customIndex->majorSection, $customIndex->minorSection);
}