Fixed #1149: URL auto-linking bug when following colon.
This commit is contained in:
parent
e08b7f7205
commit
56d7348ec2
16
lib/util.php
16
lib/util.php
|
@ -394,7 +394,21 @@ function common_render_text($text)
|
||||||
|
|
||||||
function common_replace_urls_callback($text, $callback) {
|
function common_replace_urls_callback($text, $callback) {
|
||||||
// Start off with a regex
|
// 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
|
// Then clean up what the regex left behind
|
||||||
$offset = 0;
|
$offset = 0;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user