]> git.mxchange.org Git - quix0rs-gnu-social.git/blobdiff - lib/util.php
Merge branch 'sgmurphy-clone/0.7.x' into 0.7.x
[quix0rs-gnu-social.git] / lib / util.php
index 0655ebf276e4677ad9852b47a000bf6cd58b0a91..7ce4e229eb76f93a8a49568b2283f9fd95e33d4c 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;