From 152256ca635b20d8fdcb4110160fa933389047d8 Mon Sep 17 00:00:00 2001 From: Ryan Boren Date: Fri, 23 Mar 2007 23:31:44 +0000 Subject: [PATCH] Fix relative link mangling in clean_url. fixes #4017 for trunk git-svn-id: https://develop.svn.wordpress.org/trunk@5095 602fd350-edb4-49c9-b593-d223f7449a82 --- wp-includes/formatting.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/wp-includes/formatting.php b/wp-includes/formatting.php index a0c13dbe66..d4978199c0 100644 --- a/wp-includes/formatting.php +++ b/wp-includes/formatting.php @@ -1074,10 +1074,9 @@ function clean_url( $url, $protocols = null ) { $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) ) + 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) ) $protocols = array('http', 'https', 'ftp', 'ftps', 'mailto', 'news', 'irc', 'gopher', 'nntp', 'feed', 'telnet');