summaryrefslogtreecommitdiffstats
path: root/system/helpers
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-03-12 15:22:46 +0100
committerAndrey Andreev <narf@devilix.net>2014-03-12 15:22:46 +0100
commitd2e3a6fbf820b819bd7b2abc4794766f4c1d4e1a (patch)
tree9f3bebdf6c828a3bb32ce473fe04a632112ece46 /system/helpers
parent2095258569bfdf6a16ec66a2db6014e6a04fff6d (diff)
Add support for protocol-relative URLs in HTML helpers img(), link_tag()
Diffstat (limited to 'system/helpers')
-rw-r--r--system/helpers/html_helper.php6
1 files changed, 3 insertions, 3 deletions
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.'" ';
}