diff options
author | Ted Wood <ted@thedigitalorchard.ca> | 2013-01-07 19:52:21 +0100 |
---|---|---|
committer | Ted Wood <ted@thedigitalorchard.ca> | 2013-01-07 19:52:21 +0100 |
commit | 325e91ab502b1062e99085d8729c833c24d18076 (patch) | |
tree | 5a92f1e4fdd1000cefcc765d80cfeea942fb357b /system | |
parent | 85adeed0ab67bcde7b5c57ddb44022c75e82078a (diff) |
minor tweaks and optimizations: minimize function calls in _fetch_uri_string(); use constant PHP_SAPI instead of function php_sapi_name()
Diffstat (limited to 'system')
-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'); } // -------------------------------------------------------------------- |