mirror of
git://develop.git.wordpress.org/
synced 2025-01-17 21:08:44 +01:00
Formatting: Trim leading whitespace in esc_url()
.
Props toszcze. Fixes #36369. git-svn-id: https://develop.svn.wordpress.org/trunk@45578 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
77f9bf0aeb
commit
78e096fe98
@ -4202,7 +4202,7 @@ function esc_url( $url, $protocols = null, $_context = 'display' ) {
|
||||
return $url;
|
||||
}
|
||||
|
||||
$url = str_replace( ' ', '%20', $url );
|
||||
$url = str_replace( ' ', '%20', ltrim( $url ) );
|
||||
$url = preg_replace( '|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\[\]\\x80-\\xff]|i', '', $url );
|
||||
|
||||
if ( '' === $url ) {
|
||||
|
@ -13,6 +13,7 @@ class Tests_Formatting_EscUrl extends WP_UnitTestCase {
|
||||
$this->assertEquals( 'http://example.com/Mr%20WordPress', esc_url( 'http://example.com/Mr%20WordPress' ) );
|
||||
$this->assertEquals( 'http://example.com/Mr%20%20WordPress', esc_url( 'http://example.com/Mr%20%20WordPress' ) );
|
||||
$this->assertEquals( 'http://example.com/Mr+WordPress', esc_url( 'http://example.com/Mr+WordPress' ) );
|
||||
$this->assertEquals( 'http://example.com/Mr+WordPress', esc_url( ' http://example.com/Mr+WordPress' ) );
|
||||
|
||||
$this->assertEquals( 'http://example.com/?foo=one%20two%20three&bar=four', esc_url( 'http://example.com/?foo=one two three&bar=four' ) );
|
||||
$this->assertEquals( 'http://example.com/?foo=one%20two%20three&bar=four', esc_url( 'http://example.com/?foo=one%20two%20three&bar=four' ) );
|
||||
|
Loading…
x
Reference in New Issue
Block a user