Fix percent stripping in clean_url.

git-svn-id: https://develop.svn.wordpress.org/trunk@4148 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Ryan Boren 2006-08-31 17:30:17 +00:00
parent 5d226699f8
commit 732dda9406
1 changed files with 3 additions and 1 deletions

View File

@ -1037,7 +1037,9 @@ function wp_richedit_pre($text) {
function clean_url( $url ) { function clean_url( $url ) {
if ('' == $url) return $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); $url = str_replace(';//', '://', $url);
$url = (!strstr($url, '://')) ? 'http://'.$url : $url; $url = (!strstr($url, '://')) ? 'http://'.$url : $url;
$url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url); $url = preg_replace('/&([^#])(?![a-z]{2,8};)/', '&$1', $url);