CodeIgniter Forums
auto_link() bug, with fix - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: auto_link() bug, with fix (/thread-44960.html)



auto_link() bug, with fix - El Forum - 09-02-2011

[eluser]jmadsen[/eluser]
fairly simple, but client has a edit screen that wraps each line with
Code:
<p>
tags, so you get:

Code:
<p>www.mysite.com</p>
(but same issue with any other tags) if you post an address on a single line, and auto_link() won't pick it up.

extending Url_helper line 344 and making it:

Code:
if (preg_match_all("#(^|\s|\(|>)((http(s?)://)|(www\.))(\w+[^\s\)\<]+)#i", $str, $matches))

(I added the ">" sign to list) takes care of it.

1) is this an ok fix?

2) should I propose it to CI?

3) how do I do so?

Thanks!