summaryrefslogtreecommitdiffstats
path: root/system/core/Config.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-06-16 17:48:19 +0200
committerAndrey Andreev <narf@bofh.bg>2012-06-16 17:48:19 +0200
commit1764dd7d4ab6e6e5c799eaa9ce007fce48fa0b63 (patch)
treeb7e5fbfec0d4ecdac67681be0a2164922db52bf8 /system/core/Config.php
parent3c32a11549d31cac470b92f995add25d7fdeff50 (diff)
Fix issue #938 + some related improvements
Diffstat (limited to 'system/core/Config.php')
-rw-r--r--system/core/Config.php20
1 files changed, 7 insertions, 13 deletions
diff --git a/system/core/Config.php b/system/core/Config.php
index 3de1bcb96..656382716 100644
--- a/system/core/Config.php
+++ b/system/core/Config.php
@@ -225,12 +225,12 @@ class CI_Config {
* Site URL
* Returns base_url . index_page [. uri_string]
*
- * @param string the URI string
+ * @param mixed the URI string or an array of segments
* @return string
*/
public function site_url($uri = '')
{
- if ($uri === '')
+ if (empty($uri))
{
return $this->slash_item('base_url').$this->item('index_page');
}
@@ -240,10 +240,12 @@ class CI_Config {
$suffix = ($this->item('url_suffix') === FALSE) ? '' : $this->item('url_suffix');
return $this->slash_item('base_url').$this->slash_item('index_page').$this->_uri_string($uri).$suffix;
}
- else
+ elseif (is_array($uri) OR strpos($uri, '?') === FALSE)
{
- return $this->slash_item('base_url').$this->item('index_page').'?'.$this->_uri_string($uri);
+ $uri = '?'.$this->_uri_string($uri);
}
+
+ return $this->slash_item('base_url').$this->item('index_page').$uri;
}
// -------------------------------------------------------------
@@ -280,15 +282,7 @@ class CI_Config {
}
elseif (is_array($uri))
{
- $i = 0;
- $str = '';
- foreach ($uri as $key => $val)
- {
- $prefix = ($i === 0) ? '' : '&';
- $str .= $prefix.$key.'='.$val;
- $i++;
- }
- return $str;
+ return http_build_query($uri);
}
return $uri;