Don't prepend protocol to relative links. fixes #4017 #4001 for 2.1

git-svn-id: http://svn.automattic.com/wordpress/branches/2.1@5091 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
ryan 2007-03-23 02:57:19 +00:00
parent 8b3415d780
commit d066cef6fe
1 changed files with 5 additions and 0 deletions

View File

@ -1072,6 +1072,11 @@ function clean_url( $url, $protocols = null ) {
$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 &&
substr( $url, 0, 1 ) != '/' && !preg_match('/^[a-z0-9]+.php/i', $url) )
$url = 'http://' . $url;
$url = (strpos($url, '://') === false && substr( $url, 0, 1 ) != '/' ) ? 'http://'.$url : $url;
$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);
if ( !is_array($protocols) )