|
|
@ -14,22 +14,24 @@ |
|
|
|
class Env |
|
|
|
{ |
|
|
|
|
|
|
|
static protected $request = null; |
|
|
|
static protected $request = array(); |
|
|
|
|
|
|
|
static protected $params = array(); |
|
|
|
|
|
|
|
static public function getRequestUri() |
|
|
|
static public function getRequestUri($trim_base = false) |
|
|
|
{ |
|
|
|
if (self::$request === null) { |
|
|
|
if (!isset(self::$request[$trim_base])) { |
|
|
|
// removes get params
|
|
|
|
list(self::$request, ) = explode('?', Env::Server('REQUEST_URI')); |
|
|
|
// removes base url
|
|
|
|
$base = FrontController::getInstance()->getBaseUrl(); |
|
|
|
if (($length = strlen($base)) > 0 && strpos(self::$request, $base) === 0) { |
|
|
|
self::$request = (string) substr(self::$request, $length); |
|
|
|
list(self::$request[$trim_base], ) = explode('?', Env::Server('REQUEST_URI')); |
|
|
|
if ($trim_base) { |
|
|
|
// removes base url
|
|
|
|
$base = FrontController::getInstance()->getBaseUrl(); |
|
|
|
if (($length = strlen($base)) > 0 && strpos(self::$request[$trim_base], $base) === 0) { |
|
|
|
self::$request[$trim_base] = (string) substr(self::$request[$trim_base], $length); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return self::$request; |
|
|
|
return self::$request[$trim_base]; |
|
|
|
} |
|
|
|
|
|
|
|
static public function Get($key = null, $default = null) |
|
|
|