Skip to content

Commit

Permalink
Merge pull request bcit-ci#2048 from vlakoff/develop
Browse files Browse the repository at this point in the history
config->site_url() optimizations
  • Loading branch information
narfbg committed Dec 3, 2012
2 parents 74ad0bb + 4d9fd19 commit 6a38949
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions system/core/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,15 +245,18 @@ public function site_url($uri = '')

if ($this->item('enable_query_strings') === FALSE)
{
$suffix = ($this->item('url_suffix') === FALSE) ? '' : $this->item('url_suffix');
$suffix = isset($this->config['url_suffix']) ? $this->config['url_suffix'] : '';

if ($suffix !== '' && ($offset = strpos($uri, '?')) !== FALSE)
if ($suffix !== '')
{
$uri = substr($uri, 0, $offset).$suffix.substr($uri, $offset);
}
else
{
$uri .= $suffix;
if (($offset = strpos($uri, '?')) !== FALSE)
{
$uri = substr($uri, 0, $offset).$suffix.substr($uri, $offset);
}
else
{
$uri .= $suffix;
}
}

return $this->slash_item('base_url').$this->slash_item('index_page').$uri;
Expand Down

0 comments on commit 6a38949

Please sign in to comment.