Changeset 33858
- Timestamp:
- 09/02/2015 05:19:29 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r33734 r33858 3275 3275 if ( '' == $url ) 3276 3276 return $url; 3277 3278 $url = str_replace( ' ', '%20', $url ); 3277 3279 $url = preg_replace('|[^a-z0-9-~+_.?#=!&;,/:%@$\|*\'()\\x80-\\xff]|i', '', $url); 3278 3280 if ( 0 !== stripos( $url, 'mailto:' ) ) { … … 3280 3282 $url = _deep_replace($strip, $url); 3281 3283 } 3284 3282 3285 $url = str_replace(';//', '://', $url); 3283 3286 /* If the URL doesn't appear to contain a scheme, we -
trunk/tests/phpunit/tests/formatting/EscUrl.php
r33855 r33858 5 5 */ 6 6 class Tests_Formatting_EscUrl extends WP_UnitTestCase { 7 8 /** 9 * @ticket 23605 10 */ 7 11 function test_spaces() { 8 $this->assertEquals('http://example.com/MrWordPress', esc_url('http://example.com/Mr WordPress')); 9 $this->assertEquals('http://example.com/Mr%20WordPress', esc_url('http://example.com/Mr%20WordPress')); 12 $this->assertEquals( 'http://example.com/Mr%20WordPress', esc_url( 'http://example.com/Mr WordPress' ) ); 13 $this->assertEquals( 'http://example.com/Mr%20WordPress', esc_url( 'http://example.com/Mr%20WordPress' ) ); 14 $this->assertEquals( 'http://example.com/Mr%20%20WordPress', esc_url( 'http://example.com/Mr%20%20WordPress' ) ); 15 $this->assertEquals( 'http://example.com/Mr+WordPress', esc_url( 'http://example.com/Mr+WordPress' ) ); 16 17 $this->assertEquals( 'http://example.com/?foo=one%20two%20three&bar=four', esc_url( 'http://example.com/?foo=one two three&bar=four' ) ); 18 $this->assertEquals( 'http://example.com/?foo=one%20two%20three&bar=four', esc_url( 'http://example.com/?foo=one%20two%20three&bar=four' ) ); 10 19 } 11 20 … … 137 146 $this->assertEquals( 'mailto:?body=Hi%20there%2C%0A%0AI%20thought%20you%20might%20want%20to%20sign%20up%20for%20this%20newsletter', $email_link ); 138 147 } 148 139 149 /** 140 150 * @ticket 31632 … … 151 161 } 152 162 163 /** 164 * @ticket 23605 165 */ 166 function test_mailto_with_spaces() { 167 $body = 'Hi there, I thought you might want to sign up for this newsletter'; 168 169 $email_link = 'mailto:?body=' . $body; 170 $email_link = esc_url( $email_link ); 171 $this->assertEquals( 'mailto:?body=Hi%20there,%20I%20thought%20you%20might%20want%20to%20sign%20up%20for%20this%20newsletter', $email_link ); 172 } 173 174 153 175 }
Note: See TracChangeset
for help on using the changeset viewer.