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
This commit is contained in:
ryan 2007-09-03 15:59:12 +00:00
parent 97918578a4
commit 4726644b8b

View File

@ -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;