]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fixed #1149: URL auto-linking bug when following colon.
authorSean Murphy <sgmurphy@gmail.com>
Fri, 6 Feb 2009 17:18:15 +0000 (12:18 -0500)
committerSean Murphy <sgmurphy@gmail.com>
Fri, 6 Feb 2009 17:18:15 +0000 (12:18 -0500)
lib/util.php

index e96317520429d6c21213dfbbc638de85a9d4d601..5f95c1a96540b930857030bc119975b8280863d0 100644 (file)
@@ -394,7 +394,21 @@ function common_render_text($text)
 
 function common_replace_urls_callback($text, $callback) {
     // Start off with a regex
-        preg_match_all('#(?:(?:(?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|xmpp|irc)://|(?:mailto|aim|tel):)[^.\s]+\.[^\s]+|(?:[^.\s/]+\.)+(?:museum|travel|[a-z]{2,4})(?:[:/][^\s]*)?)#i', $text, $matches);
+    $regex = '#
+    (?:
+        (?:
+            (?:https?|ftps?|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|xmpp|irc)://
+            |
+            (?:mailto|aim|tel):
+        )
+        [^.\s]+\.[^\s]+
+        |
+        (?:[^.\s/:]+\.)+
+        (?:museum|travel|[a-z]{2,4})
+        (?:[:/][^\s]*)?
+    )
+    #ix';
+    preg_match_all($regex, $text, $matches);
     
     // Then clean up what the regex left behind
     $offset = 0;