Skip to content

Commit

Permalink
Merge pull request bcit-ci#2059 from aaronadamsTO/develop
Browse files Browse the repository at this point in the history
Fix URL helpers to recognize protocol-relative URLs.
  • Loading branch information
narfbg committed Dec 8, 2012
2 parents c1c99d5 + 16800e4 commit 545a7c8
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
6 changes: 3 additions & 3 deletions system/helpers/url_helper.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ function anchor($uri = '', $title = '', $attributes = '')

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
{
Expand Down Expand Up @@ -191,7 +191,7 @@ function anchor($uri = '', $title = '', $attributes = '')
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 === '')
{
Expand Down Expand Up @@ -535,7 +535,7 @@ function url_title($str, $separator = '-', $lowercase = FALSE)
*/
function redirect($uri = '', $method = 'auto', $code = NULL)
{
if ( ! preg_match('#^https?://#i', $uri))
if ( ! preg_match('#^(\w+:)?//#i', $uri))
{
$uri = site_url($uri);
}
Expand Down
1 change: 1 addition & 0 deletions user_guide_src/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit 545a7c8

Please sign in to comment.