summaryrefslogtreecommitdiffstats
path: root/system/helpers/url_helper.php
diff options
context:
space:
mode:
Diffstat (limited to 'system/helpers/url_helper.php')
-rw-r--r--system/helpers/url_helper.php30
1 files changed, 22 insertions, 8 deletions
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index d0fab3fe0..fbb4a1b24 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -46,13 +46,20 @@ if ( ! function_exists('site_url'))
* Create a local URL based on your basepath. Segments can be passed via the
* first parameter either as a string or an array.
*
- * @param string
+ * @param string $uri
+ * @param string $protocol
* @return string
*/
- function site_url($uri = '')
+ function site_url($uri = '', $protocol = NULL)
{
- $CI =& get_instance();
- return $CI->config->site_url($uri);
+ $uri = get_instance()->config->site_url($uri);
+
+ if (isset($protocol))
+ {
+ return $protocol.substr($uri, strpos($uri, '://'));
+ }
+
+ return $uri;
}
}
@@ -67,13 +74,20 @@ if ( ! function_exists('base_url'))
* Segments can be passed in as a string or an array, same as site_url
* or a URL to a file can be passed in, e.g. to an image file.
*
- * @param string
+ * @param string $uri
+ * @param string $protocol
* @return string
*/
- function base_url($uri = '')
+ function base_url($uri = '', $protocol = NULL)
{
- $CI =& get_instance();
- return $CI->config->base_url($uri);
+ $uri = get_instance()->config->base_url($uri);
+
+ if (isset($protocol))
+ {
+ return $protocol.substr($uri, strpos($uri, '://'));
+ }
+
+ return $uri;
}
}