mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-06-28 22:30:04 +00:00
Correctly encode spaces in URLs passed to esc_url() instead of removing them.
Fixes #23605 Props enshrined, johnbillion git-svn-id: https://develop.svn.wordpress.org/trunk@33858 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
@@ -3274,11 +3274,14 @@ function esc_url( $url, $protocols = null, $_context = 'display' ) {
|
||||
|
||||
if ( '' == $url )
|
||||
return $url;
|
||||
|
||||
$url = str_replace( ' ', '%20', $url );
|
||||
$url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url);
|
||||
if ( 0 !== stripos( $url, 'mailto:' ) ) {
|
||||
$strip = array('%0d', '%0a', '%0D', '%0A');
|
||||
$url = _deep_replace($strip, $url);
|
||||
}
|
||||
|
||||
$url = str_replace(';//', '://', $url);
|
||||
/* If the URL doesn't appear to contain a scheme, we
|
||||
* presume it needs http:// appended (unless a relative
|
||||
|
||||
Reference in New Issue
Block a user