summaryrefslogtreecommitdiff
path: root/lib/util.php
diff options
context:
space:
mode:
authorSean Murphy <sgmurphy@gmail.com>2009-02-06 12:18:15 -0500
committerSean Murphy <sgmurphy@gmail.com>2009-02-06 12:18:15 -0500
commit56d7348ec2ce6750aed73659a4889f22d31f61c8 (patch)
tree8ac747013e2ed452aee36428832fb7115b6dbf04 /lib/util.php
parente08b7f7205835fcad611e8b059a84c7a250999c7 (diff)
Fixed #1149: URL auto-linking bug when following colon.
Diffstat (limited to 'lib/util.php')
-rw-r--r--lib/util.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/util.php b/lib/util.php
index e96317520..5f95c1a96 100644
--- a/lib/util.php
+++ b/lib/util.php
@@ -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;