Changeset 35497
- Timestamp:
- 11/03/2015 09:35:17 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/formatting.php
r35479 r35497 3622 3622 */ 3623 3623 function wp_make_link_relative( $link ) { 3624 return preg_replace( '|^(https?:)?//[^/]+(/ .*)|i', '$2', $link );3624 return preg_replace( '|^(https?:)?//[^/]+(/?.*)|i', '$2', $link ); 3625 3625 } 3626 3626 -
trunk/tests/phpunit/tests/link.php
r35244 r35497 305 305 } 306 306 307 public function test_wp_make_link_relative_with_http_scheme() {308 $link = 'http://example.com/this-is-a-test-http-url/';309 $relative_link = wp_make_link_relative( $link );310 $this->assertEquals( '/this-is-a-test-http-url/', $relative_link );311 }312 313 public function test_wp_make_link_relative_with_https_scheme() {314 $link = 'https://example.com/this-is-a-test-https-url/';315 $relative_link = wp_make_link_relative( $link );316 $this->assertEquals( '/this-is-a-test-https-url/', $relative_link );317 }318 319 /**320 * @ticket 30373321 */322 public function test_wp_make_link_relative_with_no_scheme() {323 $link = '//example.com/this-is-a-test-schemeless-url/';324 $relative_link = wp_make_link_relative( $link );325 $this->assertEquals( '/this-is-a-test-schemeless-url/', $relative_link );326 }327 328 /**329 * @ticket 30373330 */331 public function test_wp_make_link_relative_should_retain_URL_param_that_is_also_a_URL() {332 $link = 'https://example.com/this-is-a-test/?redirect=https://example.org/a-different-test-post/';333 $relative_link = wp_make_link_relative( $link );334 $this->assertEquals( '/this-is-a-test/?redirect=https://example.org/a-different-test-post/', $relative_link );335 }336 337 307 /** 338 308 * @ticket 30910
Note: See TracChangeset
for help on using the changeset viewer.