X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FPathRouter.php;h=d367e4da3aafdf85579c1b3528851eb6e933901a;hb=d920741fc227983fe851696d9239593de8b3a766;hp=fc891bb37550478209919389fbb3c84256f7c33f;hpb=b929f19df9a1c89f3b1b91ee3bd67c57839a4e7d;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/PathRouter.php b/includes/PathRouter.php index fc891bb375..d367e4da3a 100644 --- a/includes/PathRouter.php +++ b/includes/PathRouter.php @@ -27,7 +27,7 @@ * * $router->add( "/wiki/$1" ); * - Matches /wiki/Foo style urls and extracts the title - * $router->add( array( 'edit' => "/edit/$1" ), array( 'action' => '$key' ) ); + * $router->add( array( 'edit' => "/edit/$key" ), array( 'action' => '$key' ) ); * - Matches /edit/Foo style urls and sets action=edit * $router->add( '/$2/$1', * array( 'variant' => '$2' ), @@ -141,10 +141,10 @@ class PathRouter { } $pattern = (object)array( - 'path' => $path, - 'params' => $params, + 'path' => $path, + 'params' => $params, 'options' => $options, - 'key' => $key, + 'key' => $key, ); $pattern->weight = self::makeWeight( $pattern ); $this->patterns[] = $pattern; @@ -185,7 +185,7 @@ class PathRouter { */ protected function sortByWeight() { $weights = array(); - foreach( $this->patterns as $key => $pattern ) { + foreach ( $this->patterns as $key => $pattern ) { $weights[$key] = $pattern->weight; } array_multisort( $weights, SORT_DESC, SORT_NUMERIC, $this->patterns ); @@ -203,7 +203,7 @@ class PathRouter { $path = explode( '/', $pattern->path ); # For each level of the path - foreach( $path as $piece ) { + foreach ( $path as $piece ) { if ( preg_match( '/^\$(\d+|key)$/u', $piece ) ) { # For a piece that is only a $1 variable add 1 points of weight $weight += 1;