diff options
author | has2k1 <has2k1@gmail.com> | 2011-11-17 19:04:27 +0100 |
---|---|---|
committer | has2k1 <has2k1@gmail.com> | 2011-11-17 19:04:27 +0100 |
commit | 793cc2b3cfedcf067df8a8c88f516c68f30d72a2 (patch) | |
tree | 11f10df14e36e21dbb48e113bd4477120209bbd0 /system/helpers/url_helper.php | |
parent | dd81c435c145792e79e17f5a51f5c036adbc8044 (diff) |
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<br />http://www.google.com/'
Solution:
Add a word boundary to the list of features that can precede a URL.
Credit to: @scaryuncledevin, issue #419
Diffstat (limited to 'system/helpers/url_helper.php')
-rwxr-xr-x | system/helpers/url_helper.php | 2 |
1 files changed, 1 insertions, 1 deletions
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\" " : ""; |