From d2e3a6fbf820b819bd7b2abc4794766f4c1d4e1a Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 12 Mar 2014 16:22:46 +0200 Subject: Add support for protocol-relative URLs in HTML helpers img(), link_tag() --- system/helpers/html_helper.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'system/helpers') diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php index 239f24ccc..d8c3e6d89 100644 --- a/system/helpers/html_helper.php +++ b/system/helpers/html_helper.php @@ -181,7 +181,7 @@ if ( ! function_exists('img')) foreach ($src as $k => $v) { - if ($k === 'src' && ! preg_match('#^https?://#i', $v)) + if ($k === 'src' && ! preg_match('#^([a-z]+:)?//#i', $v)) { if ($index_page === TRUE) { @@ -273,7 +273,7 @@ if ( ! function_exists('link_tag')) { foreach ($href as $k => $v) { - if ($k === 'href' && strpos($v, '://') === FALSE) + if ($k === 'href' && ! preg_match('#^([a-z]+:)?//#i', $v)) { if ($index_page === TRUE) { @@ -292,7 +292,7 @@ if ( ! function_exists('link_tag')) } else { - if (strpos($href, '://') !== FALSE) + if ( ! preg_match('#^([a-z]+:)?//#i', $href)) { $link .= 'href="'.$href.'" '; } -- cgit v1.2.3-24-g4f1b