From 793cc2b3cfedcf067df8a8c88f516c68f30d72a2 Mon Sep 17 00:00:00 2001 From: has2k1 Date: Thu, 17 Nov 2011 11:04:27 -0700 Subject: auto_link() learned to recognize more URLs Problem: auto_link() only works on URLs that are preceded by a new line, space, or open parentheses. As a result the URL in the string below would be missed. 'Google
http://www.google.com/' Solution: Add a word boundary to the list of features that can precede a URL. Credit to: @scaryuncledevin, issue #419 --- system/helpers/url_helper.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'system/helpers') diff --git a/system/helpers/url_helper.php b/system/helpers/url_helper.php index 5d907d00e..5d9afe457 100755 --- a/system/helpers/url_helper.php +++ b/system/helpers/url_helper.php @@ -393,7 +393,7 @@ if ( ! function_exists('auto_link')) { if ($type != 'email') { - if (preg_match_all("#(^|\s|\()((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches)) + if (preg_match_all("#(^|\s|\(|\b)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches)) { $pop = ($popup == TRUE) ? " target=\"_blank\" " : ""; -- cgit v1.2.3-24-g4f1b