From d842e5093fe5caa4667a0897c18f1b750bde044b Mon Sep 17 00:00:00 2001 From: ryan Date: Tue, 11 Jul 2006 03:30:12 +0000 Subject: [PATCH] Make clickable fix from whooami. fixes #2889 git-svn-id: http://svn.automattic.com/wordpress/trunk@4011 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index cc5e76bdb5..7735d581a4 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -582,10 +582,11 @@ function antispambot($emailaddy, $mailto=0) { } function make_clickable($ret) { - $ret = ' ' . $ret . ' '; - $ret = preg_replace("#([\s>])(https?)://([^\s<>{}()]+[^\s.,<>{}()])#i", "$1$2://$3", $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\-_.]+)@([a-z0-9\-_.]+)\.([^,< \n\r]+)#i", "$1$2@$3.$4", $ret); + $ret = ' ' . $ret; + $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1$2", $ret); + $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1$2", $ret); + $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([^,< \n\r]+)#i", "$1$2@$3", $ret); + $ret = substr($ret, 1); $ret = trim($ret); return $ret; }