diff options
author | Andrey Andreev <narf@bofh.bg> | 2013-01-10 14:43:56 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2013-01-10 14:43:56 +0100 |
commit | 55899a0ed6a2f5be1c9d800c39051c8c0ce8fcab (patch) | |
tree | 83c1eb49ee87c71884c372729d89a554c085832b | |
parent | be999666179d34a2282bd46271b74364f22f3144 (diff) | |
parent | 325e91ab502b1062e99085d8729c833c24d18076 (diff) |
Merge pull request #2127 from TheDigitalOrchard/uri-lib-optimizations
minor tweaks and optimizations to URI library
-rw-r--r-- | system/core/URI.php | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/system/core/URI.php b/system/core/URI.php index fb8540118..b3603bbb1 100644 --- a/system/core/URI.php +++ b/system/core/URI.php @@ -94,7 +94,9 @@ class CI_URI { */ public function _fetch_uri_string() { - if (strtoupper($this->config->item('uri_protocol')) === 'AUTO') + $protocol = strtoupper($this->config->item('uri_protocol')); + + if ($protocol === 'AUTO') { // Is the request coming from the command line? if ($this->_is_cli_request()) @@ -136,20 +138,18 @@ class CI_URI { return; } - $uri = strtoupper($this->config->item('uri_protocol')); - - if ($uri === 'CLI') + if ($protocol === 'CLI') { $this->_set_uri_string($this->_parse_argv()); return; } - elseif (method_exists($this, ($method = '_parse_'.strtolower($uri)))) + elseif (method_exists($this, ($method = '_parse_'.strtolower($protocol)))) { $this->_set_uri_string($this->$method()); return; } - $uri = isset($_SERVER[$uri]) ? $_SERVER[$uri] : @getenv($uri); + $uri = isset($_SERVER[$protocol]) ? $_SERVER[$protocol] : @getenv($protocol); $this->_set_uri_string($uri); } @@ -291,7 +291,7 @@ class CI_URI { */ protected function _is_cli_request() { - return (php_sapi_name() === 'cli') OR defined('STDIN'); + return (PHP_SAPI === 'cli') OR defined('STDIN'); } // -------------------------------------------------------------------- |