Add support for protocol-relative URLs in HTML helpers img(), link_tag()
diff --git a/system/helpers/html_helper.php b/system/helpers/html_helper.php
index 239f24c..d8c3e6d 100644
--- a/system/helpers/html_helper.php
+++ b/system/helpers/html_helper.php
@@ -181,7 +181,7 @@
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 @@
{
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 @@
}
else
{
- if (strpos($href, '://') !== FALSE)
+ if ( ! preg_match('#^([a-z]+:)?//#i', $href))
{
$link .= 'href="'.$href.'" ';
}