From 4726644b8b8eb37418095609b16331468d3a44ac Mon Sep 17 00:00:00 2001 From: ryan Date: Mon, 3 Sep 2007 15:59:12 +0000 Subject: [PATCH] Don't strip @ from url. Fix scheme prefixing. Props pishmishy. fixes #3299 git-svn-id: http://svn.automattic.com/wordpress/trunk@6015 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/formatting.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index 25e7fc1cbc..cb23ab50bb 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1080,12 +1080,15 @@ function clean_url( $url, $protocols = null ) { $original_url = $url; if ('' == $url) return $url; - $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%]|i', '', $url); + $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@]|i', '', $url); $strip = array('%0d', '%0a'); $url = str_replace($strip, '', $url); $url = str_replace(';//', '://', $url); - // Append http unless a relative link starting with / or a php file. - if ( strpos($url, '://') === false && + /* If the URL doesn't appear to contain a scheme, we + * presume it needs http:// appended (unless a relative + * link starting with / or a php file). + */ + if ( strpos($url, ':') === false && substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9-]+?\.php/i', $url) ) $url = 'http://' . $url;