From b3727f5cb0dd27b5ce253b407c2d802ddaac4376 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Wed, 21 Mar 2007 00:29:40 +0000 Subject: [PATCH] Don't add http:// to relative links. Props donncha. fixes #4001 git-svn-id: https://develop.svn.wordpress.org/trunk@5065 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index b10d53c32f..a36de22477 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1072,7 +1072,7 @@ function clean_url( $url, $protocols = null ) { $strip = array('%0d', '%0a'); $url = str_replace($strip, '', $url); $url = str_replace(';//', '://', $url); - $url = (strpos($url, '://') === false) ? 'http://'.$url : $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) ) $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');