Link rtsp, mms & tel URI schemes, correct pseudo-protocol ones.
This patch builds on the work of user `candrews` at http://laconi.ca/trac/ticket/529#comment:2
This commit is contained in:
parent
87b99540ef
commit
a381bff4da
|
@ -370,8 +370,6 @@ function common_canonical_email($email)
|
||||||
return $email;
|
return $email;
|
||||||
}
|
}
|
||||||
|
|
||||||
define('URL_REGEX', '^|[ \t\r\n])((ftp|http|https|gopher|mailto|news|nntp|telnet|wais|file|prospero|aim|webcal):(([A-Za-z0-9$_.+!*(),;/?:@&~=-])|%[A-Fa-f0-9]{2}){2,}(#([a-zA-Z0-9][a-zA-Z0-9$_.+!*(),;/?:@&~=%-]*))?([A-Za-z0-9$_+!*();/?:~-]))');
|
|
||||||
|
|
||||||
function common_render_content($text, $notice)
|
function common_render_content($text, $notice)
|
||||||
{
|
{
|
||||||
$r = common_render_text($text);
|
$r = common_render_text($text);
|
||||||
|
@ -388,7 +386,8 @@ function common_render_text($text)
|
||||||
$r = htmlspecialchars($text);
|
$r = htmlspecialchars($text);
|
||||||
|
|
||||||
$r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r);
|
$r = preg_replace('/[\x{0}-\x{8}\x{b}-\x{c}\x{e}-\x{19}]/', '', $r);
|
||||||
$r = preg_replace_callback('@https?://[^\]>\s]+@', 'common_render_uri_thingy', $r);
|
$r = preg_replace_callback('@(ftp|http|https|mms|rtsp|gopher|news|nntp|telnet|wais|file|prospero|webcal|xmpp|irc)://[^\]>\s]+@', 'common_render_uri_thingy', $r);
|
||||||
|
$r = preg_replace_callback('@(mailto|aim|tel):[^\]>\s]+@', 'common_render_uri_thingy', $r); // Pseudo-protocols don't require '//' after ':'.
|
||||||
$r = preg_replace('/(^|\s+)#([A-Za-z0-9_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r);
|
$r = preg_replace('/(^|\s+)#([A-Za-z0-9_\-\.]{1,64})/e', "'\\1#'.common_tag_link('\\2')", $r);
|
||||||
// XXX: machine tags
|
// XXX: machine tags
|
||||||
return $r;
|
return $r;
|
||||||
|
|
Loading…
Reference in New Issue
Block a user