make_clickable(): improve regular expression of converting URL to ignore the beginnin...
authorCindy Li <cli@ocad.ca>
Tue, 24 Aug 2010 14:20:57 +0000 (14:20 -0000)
committerCindy Li <cli@ocad.ca>
Tue, 24 Aug 2010 14:20:57 +0000 (14:20 -0000)
docs/include/lib/output.inc.php

index 672cb81..6aa0d81 100644 (file)
@@ -677,7 +677,7 @@ function make_clickable($text) {
        $text = preg_replace("/(\[media\])([\s]*)(.*)(\[\/media\])/", '$1$3$4', $text);
        $text = preg_replace("/(\[media\])(.*)([\s]*)(\[\/media\])/U", '$1$2$4', $text);
        // 2. convert URL
-       $text = preg_replace('/(^|[\n ])([\w]*?)((?<!(\[media\]))http(s)?:\/\/[\w]+[^ \,\"\n\r\t<]*)/is', 
+       $text = preg_replace('/(^|[\n ])([\w]*?[\"]*)((?<!(\[media\]))http(s)?:\/\/[\w]+[^ \,\"\n\r\t\)<]*)/is', 
                             '$1$2<a href="$3">$3</a>', $text);
        
        // convert email address to clickable URL that pops up "send email" interface with the address filled in