Improved autolink function. http://mosquito.wordpress.org/bug_view_page.php?bug_id=0000236
git-svn-id: https://develop.svn.wordpress.org/trunk@1571 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
b9fc57acbc
commit
d89603ce20
|
@ -326,14 +326,12 @@ function antispambot($emailaddy, $mailto=0) {
|
|||
return $emailNOSPAMaddy;
|
||||
}
|
||||
|
||||
function make_clickable($text) { // original function: phpBB, extended here for AIM & ICQ
|
||||
$ret = " " . $text;
|
||||
$ret = preg_replace("#([\n ])([a-z]+?)://([^, <>{}\n\r]+)#i", "\\1<a href=\"\\2://\\3\" target=\"_blank\">\\2://\\3</a>", $ret);
|
||||
$ret = preg_replace("#([\n ])aim:([^,< \n\r]+)#i", "\\1<a href=\"aim:goim?screenname=\\2\\3&message=Hello\">\\2\\3</a>", $ret);
|
||||
$ret = preg_replace("#([\n ])icq:([^,< \n\r]+)#i", "\\1<a href=\"http://wwp.icq.com/scripts/search.dll?to=\\2\\3\">\\2\\3</a>", $ret);
|
||||
$ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^,< \n\r]*)?)#i", "\\1<a href=\"http://www.\\2.\\3\\4\" target=\"_blank\">www.\\2.\\3\\4</a>", $ret);
|
||||
$ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([^,< \n\r]+)#i", "\\1<a href=\"mailto:\\2@\\3\">\\2@\\3</a>", $ret);
|
||||
$ret = substr($ret, 1);
|
||||
function make_clickable($ret) { // original function: phpBB
|
||||
$ret = ' ' . $ret . ' ';
|
||||
$ret = preg_replace("#(\s)http://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1<a href='http://$2'>http://$2</a>", $ret);
|
||||
$ret = preg_replace("#(\s)www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^ <>{}()\n\r]*[^., <>{}()\n\r]?)?)#i", "$1<a href='http://www.$2.$3$4'>www.$2.$3$4</a>", $ret);
|
||||
$ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([^,< \n\r]+)#i", "$1<a href='mailto:$2@$3\">$2@$3</a>", $ret);
|
||||
$ret = trim($ret);
|
||||
return $ret;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue