summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/helpers/url_helper.php4
-rw-r--r--user_guide/changelog.html1
-rw-r--r--user_guide/helpers/url_helper.html2
3 files changed, 4 insertions, 3 deletions
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 86caa278c..7707d6854 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -431,7 +431,7 @@ if ( ! function_exists('auto_link'))
/**
* Prep URL
*
- * Simply adds the http:// part if missing
+ * Simply adds the http:// part if no scheme is included
*
* @access public
* @param string the URL
@@ -446,7 +446,7 @@ if ( ! function_exists('prep_url'))
return '';
}
- if (!preg_match('/^[a-z]{3,6}:\/\//', $str))
+ if ( ! parse_url($str, PHP_URL_SCHEME))
{
$str = 'http://'.$str;
}
diff --git a/user_guide/changelog.html b/user_guide/changelog.html
index 45c698289..21e1bf142 100644
--- a/user_guide/changelog.html
+++ b/user_guide/changelog.html
@@ -114,6 +114,7 @@ Hg Tag: </p>
<li>Modified <kbd>delete_files()</kbd> in the <a href="helpers/file_helper.html">File Helper</a> to return FALSE on failure.</li>
<li>Added an optional second parameter to <kbd>byte_format()</kbd> in the <a href="helpers/number_helper.html">Number Helper</a> to allow for decimal precision.</li>
<li>Added alpha, and sha1 string types to <kbd>random_string()</kbd> in the <a href="helpers/string_helper.html">String Helper</a>.</li>
+ <li>Modified <kbd>prep_url()</kbd> so as to not prepend http:// if the supplied string already has a scheme.</li>
</ul>
</li>
<li>Other Changes
diff --git a/user_guide/helpers/url_helper.html b/user_guide/helpers/url_helper.html
index dbc5969fa..96da0c62b 100644
--- a/user_guide/helpers/url_helper.html
+++ b/user_guide/helpers/url_helper.html
@@ -236,7 +236,7 @@ $url_title = url_title($title, 'underscore', TRUE);<br />
</code>
<h3>prep_url()</h3>
-<p>This function will add <kbd>http://</kbd> in the event it is missing from a URL. Pass the URL string to the function like this:</p>
+<p>This function will add <kbd>http://</kbd> in the event that a scheme is missing from a URL. Pass the URL string to the function like this:</p>
<code>
$url = "example.com";<br /><br />
$url = prep_url($url);</code>