MediaWiki
REL1_22
|
PathRouter class. More...
Public Member Functions | |
add ($path, $params=array(), $options=array()) | |
Add a new path pattern to the path router. | |
addStrict ($path, $params=array(), $options=array()) | |
Add a new path pattern to the path router with the strict option on. | |
parse ($path) | |
Parse a path and return the query matches for the path. | |
Protected Member Functions | |
doAdd ($path, $params, $options, $key=null) | |
Protected helper to do the actual bulk work of adding a single pattern. | |
sortByWeight () | |
Protected helper to re-sort our patterns so that the most specific (most heavily weighted) patterns are at the start of the array. | |
Static Protected Member Functions | |
static | extractTitle ($path, $pattern) |
static | makeWeight ($pattern) |
Private Attributes | |
array | $patterns = array() |
PathRouter class.
This class can take patterns such as /wiki/$1 and use them to parse query parameters out of REQUEST_URI paths.
$router->add( "/wiki/$1" );
Path patterns:
Params:
Options:
Definition at line 73 of file PathRouter.php.
PathRouter::add | ( | $ | path, |
$ | params = array() , |
||
$ | options = array() |
||
) |
Add a new path pattern to the path router.
string | array | $path | The path pattern to add |
array | $params | The params for this path pattern |
array | $options | The options for this path pattern |
Definition at line 159 of file PathRouter.php.
Referenced by PathRouterTest\setUp(), and PathRouterTest\testCallback().
PathRouter::addStrict | ( | $ | path, |
$ | params = array() , |
||
$ | options = array() |
||
) |
Add a new path pattern to the path router with the strict option on.
$path | string|array |
$params | array |
$options | array |
Definition at line 176 of file PathRouter.php.
PathRouter::doAdd | ( | $ | path, |
$ | params, | ||
$ | options, | ||
$ | key = null |
||
) | [protected] |
Protected helper to do the actual bulk work of adding a single pattern.
This is in a separate method so that add() can handle the difference between a single string $path and an array() $path that contains multiple path patterns each with an associated $key to pass on.
$path | string |
$params | array |
$options | array |
$key | null|string |
Definition at line 89 of file PathRouter.php.
static PathRouter::extractTitle | ( | $ | path, |
$ | pattern | ||
) | [static, protected] |
$path | string |
$pattern | string |
Definition at line 263 of file PathRouter.php.
static PathRouter::makeWeight | ( | $ | pattern | ) | [static, protected] |
PathRouter::parse | ( | $ | path | ) |
Parse a path and return the query matches for the path.
string | $path | The path to parse |
Definition at line 237 of file PathRouter.php.
PathRouter::sortByWeight | ( | ) | [protected] |
Protected helper to re-sort our patterns so that the most specific (most heavily weighted) patterns are at the start of the array.
Definition at line 185 of file PathRouter.php.
Definition at line 77 of file PathRouter.php.