From 46e1de4878659cb035024f4daca2f3baee94ca93 Mon Sep 17 00:00:00 2001 From: Andrew Ozz Date: Wed, 19 Aug 2009 23:56:10 +0000 Subject: [PATCH] Removed trailing .) from the URL in make_clickable() git-svn-id: https://develop.svn.wordpress.org/trunk@11844 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 0c620b00c1..8800953599 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1185,10 +1185,18 @@ function antispambot($emailaddy, $mailto=0) { */ function _make_url_clickable_cb($matches) { $url = $matches[2]; + + $after = ''; + if ( preg_match( '|(.+)([).])$|', $url, $split ) ) { + $url = $split[1]; + $after = $split[2]; + } + $url = esc_url($url); if ( empty($url) ) return $matches[0]; - return $matches[1] . "$url"; + + return $matches[1] . "$url$after"; } /** @@ -1210,12 +1218,13 @@ function _make_web_ftp_clickable_cb($matches) { $dest = esc_url($dest); if ( empty($dest) ) return $matches[0]; - // removed trailing [,;:] from URL - if ( in_array(substr($dest, -1), array('.', ',', ';', ':')) === true ) { + + // removed trailing [.,;:)] from URL + if ( in_array( substr($dest, -1), array('.', ',', ';', ':', ')') ) === true ) { $ret = substr($dest, -1); $dest = substr($dest, 0, strlen($dest)-1); } - return $matches[1] . "$dest" . $ret; + return $matches[1] . "$dest$ret"; } /**