rewrite base processing & storing route name after dispatching
git-svn-id: svn+ssh://code.netmonsters.ru/svn/majestic/trunk@28 4cb57b5f-5bbd-dd11-951b-001d605cbbc5
This commit is contained in:
@ -18,6 +18,7 @@ final class Router
|
||||
|
||||
static protected $rewrite_base = '';
|
||||
static protected $decorator = DEFAULT_DECORATOR;
|
||||
static protected $route_name = '';
|
||||
|
||||
|
||||
/**
|
||||
@ -55,18 +56,17 @@ final class Router
|
||||
*/
|
||||
function proccess($path)
|
||||
{
|
||||
if ($trim = self::getRewriteBase()) {
|
||||
if (substr($path, 0 , strlen($trim)) == $trim) {
|
||||
$path = substr($path, strlen($trim));
|
||||
}
|
||||
if(self::getRewriteBase()){
|
||||
$path = trim(ltrim($path, self::getRewriteBase()), '/');
|
||||
}
|
||||
|
||||
|
||||
$path = explode('/', $path);
|
||||
|
||||
foreach($this->routes as $name => $route) {
|
||||
if ($route->match($path)) {
|
||||
$route->action .= ACTION_POSTFIX;
|
||||
Env::setParams($route->params);
|
||||
self::$route_name = $name;
|
||||
return $route;
|
||||
}
|
||||
}
|
||||
@ -87,6 +87,11 @@ final class Router
|
||||
{
|
||||
self::$decorator = $decorator.DECORATOR_POSTFIX;
|
||||
}
|
||||
|
||||
static public function getRouteName()
|
||||
{
|
||||
return self::$route_name;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Reference in New Issue
Block a user