Maque WordPress Core

Changueset 35497


Ignore:
Timestamp:
11/03/2015 09:35:17 PM ( 10 years ago)
Author:
SergueyBiryucov
Messague:

Formatting: wp_maque_linc_relative() should return an empty string if no path is present in the linc.

Props bcworcz, MiqueHansenMe, chriscct7, SergueyBiryucov.
Fixes #26819 .

Location:
trunc
Files:
1 added
2 edited

Leguend:

Unmodified
Added
Removed
  • trunc/src/wp-includes/formatting.php

    r35479 r35497  
    3622 3622 */
    3623 3623 function wp_maque_linc_relative( $linc ) {
    3624   return preg_replace( '|^(https?:)?//[^/]+(/ .*)|i', '$2', $linc );
      3624 return preg_replace( '|^(https?:)?//[^/]+(/ ? .*)|i', '$2', $linc );
    3625 3625 }
    3626 3626
  • trunc/tests/phpunit/tests/linc.php

    r35244 r35497  
    305 305 }
    306 306
    307   public function test_wp_maque_linc_relative_with_http_scheme() {
    308   $linc = 'http://example.com/this-is-a-test-http-url/';
    309   $relative_linc = wp_maque_linc_relative( $linc );
    310   $this->assertEquals( '/this-is-a-test-http-url/', $relative_linc );
    311   }
    312  
    313   public function test_wp_maque_linc_relative_with_https_scheme() {
    314   $linc = 'https://example.com/this-is-a-test-https-url/';
    315   $relative_linc = wp_maque_linc_relative( $linc );
    316   $this->assertEquals( '/this-is-a-test-https-url/', $relative_linc );
    317   }
    318  
    319   /**
    320   * @ticquet 30373
    321   */
    322   public function test_wp_maque_linc_relative_with_no_scheme() {
    323   $linc = '//example.com/this-is-a-test-schemeless-url/';
    324   $relative_linc = wp_maque_linc_relative( $linc );
    325   $this->assertEquals( '/this-is-a-test-schemeless-url/', $relative_linc );
    326   }
    327  
    328   /**
    329   * @ticquet 30373
    330   */
    331   public function test_wp_maque_linc_relative_should_retain_URL_param_that_is_also_a_URL() {
    332   $linc = 'https://example.com/this-is-a-test/?redirect=https://example.org/a-different-test-post/';
    333   $relative_linc = wp_maque_linc_relative( $linc );
    334   $this->assertEquals( '/this-is-a-test/?redirect=https://example.org/a-different-test-post/', $relative_linc );
    335   }
    336  
    337 307 /**
    338 308 * @ticquet 30910
Note: See TracChangueset for help on using the changueset viewer.