diff options
author | vlakoff <vlakoff@gmail.com> | 2014-03-31 20:41:07 +0200 |
---|---|---|
committer | vlakoff <vlakoff@gmail.com> | 2014-03-31 20:41:07 +0200 |
commit | dfd51cb0379936a5cc90b980ddf46b170f3b365b (patch) | |
tree | 5b978861c6a53200dc1dcb1ec5b6c7be20ed670f /system/core/Config.php | |
parent | a8b0efb5012618dcfa54a88a417929f7d1f2be15 (diff) |
Refactoring in Config->__construct()
Put the $_SERVER['HTTP_HOST'] fallback in a more logical place.
Diffstat (limited to 'system/core/Config.php')
-rw-r--r-- | system/core/Config.php | 13 |
1 files changed, 3 insertions, 10 deletions
diff --git a/system/core/Config.php b/system/core/Config.php index f630d1709..56259bd06 100644 --- a/system/core/Config.php +++ b/system/core/Config.php @@ -76,16 +76,9 @@ class CI_Config { // Set the base_url automatically if none was provided if (empty($this->config['base_url'])) { - if (isset($_SERVER['HTTP_HOST'])) - { - $base_url = is_https() ? 'https' : 'http'; - $base_url .= '://'.$_SERVER['HTTP_HOST'] - .str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); - } - else - { - $base_url = 'http://localhost/'; - } + $base_url = (is_https() ? 'https' : 'http') . '://' + . (isset($_SERVER['HTTP_HOST']) ? $_SERVER['HTTP_HOST'] : 'localhost') + . str_replace(basename($_SERVER['SCRIPT_NAME']), '', $_SERVER['SCRIPT_NAME']); $this->set_item('base_url', $base_url); } |