summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlyourself.ca>2009-02-06 14:27:06 -0500
committerEvan Prodromou <evan@controlyourself.ca>2009-02-06 14:27:06 -0500
commitadcbb483623f10fa7ed76cc85c6c20e3647fa9f3 (patch)
treea7e1494148dcb28469078dcd3b8ec7820ec4888d /lib
parentde4ed67b7a406189cfd4120f3ef158abc966f48d (diff)
parent56d7348ec2ce6750aed73659a4889f22d31f61c8 (diff)
Merge branch '0.7.x' of git://gitorious.org/laconica/sgmurphy-clone into sgmurphy-clone/0.7.x
Diffstat (limited to 'lib')
-rw-r--r--lib/util.php16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/util.php b/lib/util.php
index 330e5d12d..35a9d0bd4 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;