From 17433d3a325eeeeb30452716ae6e7c4e4bf7db22 Mon Sep 17 00:00:00 2001 From: saxmatt Date: Sat, 28 Aug 2004 08:40:13 +0000 Subject: [PATCH] Improved autolink function. http://mosquito.wordpress.org/bug_view_page.php?bug_id=0000236 git-svn-id: http://svn.automattic.com/wordpress/trunk@1571 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions-formatting.php | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/wp-includes/functions-formatting.php b/wp-includes/functions-formatting.php index 06a2a3f5e..4b3ca708d 100644 --- a/wp-includes/functions-formatting.php +++ b/wp-includes/functions-formatting.php @@ -326,15 +326,13 @@ 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\\2://\\3", $ret); - $ret = preg_replace("#([\n ])aim:([^,< \n\r]+)#i", "\\1\\2\\3", $ret); - $ret = preg_replace("#([\n ])icq:([^,< \n\r]+)#i", "\\1\\2\\3", $ret); - $ret = preg_replace("#([\n ])www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^,< \n\r]*)?)#i", "\\1www.\\2.\\3\\4", $ret); - $ret = preg_replace("#([\n ])([a-z0-9\-_.]+?)@([^,< \n\r]+)#i", "\\1\\2@\\3", $ret); - $ret = substr($ret, 1); - return $ret; +function make_clickable($ret) { // original function: phpBB + $ret = ' ' . $ret . ' '; + $ret = preg_replace("#(\s)http://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1http://$2", $ret); + $ret = preg_replace("#(\s)www\.([a-z0-9\-]+)\.([a-z0-9\-.\~]+)((?:/[^ <>{}()\n\r]*[^., <>{}()\n\r]?)?)#i", "$1www.$2.$3$4", $ret); + $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([^,< \n\r]+)#i", "$1