Changeset 34890
- Timestamp:
- 10/07/2015 01:06:58 AM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rewrite-functions.php
r34712 r34890 340 340 $url = $url_split[0]; 341 341 342 // Set the correct URL scheme. 343 $url = set_url_scheme( $url ); 344 342 345 // Add 'www.' if it is absent and should be there 343 346 if ( false !== strpos(home_url(), '://www.') && false === strpos($url, '://www.') ) -
trunk/tests/phpunit/tests/rewrite.php
r34810 r34890 93 93 } 94 94 95 function test_url_to_postid_set_url_scheme_https_to_http() { 96 $post_id = $this->factory->post->create(); 97 $permalink = get_permalink( $post_id ); 98 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) ); 99 100 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) ); 101 $permalink = get_permalink( $post_id ); 102 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'https' ) ) ); 103 } 104 105 function test_url_to_postid_set_url_scheme_http_to_https() { 106 // Save server data for cleanup 107 $is_ssl = is_ssl(); 108 $http_host = $_SERVER['HTTP_HOST']; 109 110 $_SERVER['HTTPS'] = 'on'; 111 112 $post_id = $this->factory->post->create(); 113 $permalink = get_permalink( $post_id ); 114 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) ); 115 116 $post_id = $this->factory->post->create( array( 'post_type' => 'page' ) ); 117 $permalink = get_permalink( $post_id ); 118 $this->assertEquals( $post_id, url_to_postid( set_url_scheme( $permalink, 'http' ) ) ); 119 120 // Cleanup. 121 $_SERVER['HTTPS'] = $is_ssl ? 'on' : 'off'; 122 $_SERVER['HTTP_HOST'] = $http_host; 123 } 124 95 125 function test_url_to_postid_custom_post_type() { 96 126 delete_option( 'rewrite_rules' );
Note: See TracChangeset
for help on using the changeset viewer.