From 49769340cae0ffaafc82b70ed72299085da21b93 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Tue, 11 Jul 2006 03:30:12 +0000 Subject: [PATCH] Make clickable fix from whooami. fixes #2889 git-svn-id: https://develop.svn.wordpress.org/trunk@4011 602fd350-edb4-49c9-b593-d223f7449a82 --- 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; }