http://atutor.ca/atutor/mantis/view.php?id=4454
authorharris wong <hwong@ocad.ca>
Thu, 12 Aug 2010 18:12:49 +0000 (18:12 -0000)
committerharris wong <hwong@ocad.ca>
Thu, 12 Aug 2010 18:12:49 +0000 (18:12 -0000)
line 742, changed the regex for emails.

docs/include/lib/output.inc.php

index fe08c1f..0093930 100644 (file)
@@ -736,12 +736,14 @@ function make_clickable($text) {
 //                                                     "<a href=\"mailto:\\1\">\\1</a>",
 //                                                     $text);
 
-       $text = preg_replace("/(.*)(http[s]?):\/\/(.*)(\s|$|<|>|\\\|\(|\))(.*)/U",  
-                            "\\1<a href=\"\\2://\\3\">\\3</a>\\4\\5", $text);
+//     $text = preg_replace("/(.*)(http[s]?):\/\/(.*)(\s|$|<|>|\\\|\(|\))(.*)/U",  
+//                          "\\1<a href=\"\\2://\\3\">\\3</a>\\4\\5", $text);
        
-       $text = preg_replace('/([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.
-                                               '\@'.'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+)/i',
-                                               "<a href=\"mailto:\\1\">\\1</a>",
+       $text = preg_replace('/(?|<a href="mailto[\s]*:[\s]*([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'\@'
+                            .'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+)">(.*)<\/a>'
+                            .'|((((([_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'\@'
+                            .'[_a-zA-Z0-9\-]+(\.[_a-zA-Z0-9\-]+)*'.'(\.[a-zA-Z]{1,6})+))))))/i',
+                                               "<a href=\"mailto:\\1\">\\5</a>",
                                                $text);
        return $text;
 }