summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-12-08 14:50:22 +0100
committerAndrey Andreev <narf@bofh.bg>2012-12-08 14:50:22 +0100
commit545a7c86701875e1412bcde316e9bcc76d9a23a0 (patch)
tree3ad3f05eea022a3369328d95a1a92c533f2ac1c6
parentc1c99d5f8e6f2f58697b0de94e5445a092ca0562 (diff)
parent16800e4e356fa1aa3d92d368e6e495b97b64ad83 (diff)
Merge pull request #2059 from aaronadamsTO/develop
Fix URL helpers to recognize protocol-relative URLs.
-rw-r--r--system/helpers/url_helper.php6
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 4 insertions, 3 deletions
diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php
index 14c216afe..36ff0ff2c 100644
--- a/system/helpers/url_helper.php
+++ b/system/helpers/url_helper.php
@@ -152,7 +152,7 @@ if ( ! function_exists('anchor'))
if ( ! is_array($uri))
{
- $site_url = preg_match('!^\w+://! i', $uri) ? $uri : site_url($uri);
+ $site_url = preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri);
}
else
{
@@ -191,7 +191,7 @@ if ( ! function_exists('anchor_popup'))
function anchor_popup($uri = '', $title = '', $attributes = FALSE)
{
$title = (string) $title;
- $site_url = preg_match('!^\w+://! i', $uri) ? $uri : site_url($uri);
+ $site_url = preg_match('#^(\w+:)?//#i', $uri) ? $uri : site_url($uri);
if ($title === '')
{
@@ -535,7 +535,7 @@ if ( ! function_exists('redirect'))
*/
function redirect($uri = '', $method = 'auto', $code = NULL)
{
- if ( ! preg_match('#^https?://#i', $uri))
+ if ( ! preg_match('#^(\w+:)?//#i', $uri))
{
$uri = site_url($uri);
}
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 5cecffeea..daf796504 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -73,6 +73,7 @@ Release Date: Not Released
- Added JS window name support to the :php:func:`anchor_popup()` function.
- Added support (auto-detection) for HTTP/1.1 response code 303 in :php:func:`redirect()`.
- Changed :php:func:`redirect()` to only choose the **refresh** method only on IIS servers, instead of all servers on Windows (when **auto** is used).
+ - Changed :php:func:`anchor()`, :php:func:`anchor_popup()`, and :php:func:`redirect()` to support protocol-relative URLs, such as `redirect('//ellislab.com/codeigniter')`.
- Added XHTML Basic 1.1 doctype to :doc:`HTML Helper <helpers/html_helper>`.
- :doc:`Inflector Helper <helpers/inflector_helper>` changes include:
- Changed :php:func:`humanize()` to allow passing an input separator as its second parameter.