diff options
Diffstat (limited to 'wp-includes/formatting.php')
-rw-r--r-- | wp-includes/formatting.php | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index cc5e76b..7735d58 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<a href='$2://$3' rel='nofollow'>$2://$3</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' rel='nofollow'>www.$2.$3$4</a>", $ret); - $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([a-z0-9\-_.]+)\.([^,< \n\r]+)#i", "$1<a href=\"mailto:$2@$3.$4\">$2@$3.$4</a>", $ret); + $ret = ' ' . $ret; + $ret = preg_replace("#(^|[\n ])([\w]+?://[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1<a href='$2' rel='nofollow'>$2</a>", $ret); + $ret = preg_replace("#(^|[\n ])((www|ftp)\.[\w\#$%&~/.\-;:=,?@\[\]+]*)#is", "$1<a href='http://$2' rel='nofollow'>$2</a>", $ret); + $ret = preg_replace("#(\s)([a-z0-9\-_.]+)@([^,< \n\r]+)#i", "$1<a href=\"mailto:$2@$3\">$2@$3</a>", $ret); + $ret = substr($ret, 1); $ret = trim($ret); return $ret; } |