|
@ -18,6 +18,7 @@ final class Router |
|
|
|
|
|
|
|
|
static protected $rewrite_base = ''; |
|
|
static protected $rewrite_base = ''; |
|
|
static protected $decorator = DEFAULT_DECORATOR; |
|
|
static protected $decorator = DEFAULT_DECORATOR; |
|
|
|
|
|
static protected $route_name = ''; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
@ -55,10 +56,8 @@ final class Router |
|
|
*/ |
|
|
*/ |
|
|
function proccess($path) |
|
|
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); |
|
|
$path = explode('/', $path); |
|
@ -67,6 +66,7 @@ final class Router |
|
|
if ($route->match($path)) { |
|
|
if ($route->match($path)) { |
|
|
$route->action .= ACTION_POSTFIX; |
|
|
$route->action .= ACTION_POSTFIX; |
|
|
Env::setParams($route->params); |
|
|
Env::setParams($route->params); |
|
|
|
|
|
self::$route_name = $name; |
|
|
return $route; |
|
|
return $route; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
@ -87,6 +87,11 @@ final class Router |
|
|
{ |
|
|
{ |
|
|
self::$decorator = $decorator.DECORATOR_POSTFIX; |
|
|
self::$decorator = $decorator.DECORATOR_POSTFIX; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
static public function getRouteName() |
|
|
|
|
|
{ |
|
|
|
|
|
return self::$route_name; |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|