Changeset 50156
- Timestamp:
- 02/02/2021 07:01:18 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/link-template.php
r50132 r50156 3254 3254 * @since 3.0.0 3255 3255 * 3256 * @global string $pagenow3257 *3258 3256 * @param int $blog_id Optional. Site ID. Default null (current site). 3259 3257 * @param string $path Optional. Path relative to the home URL. Default empty. … … 3263 3261 */ 3264 3262 function get_home_url( $blog_id = null, $path = '', $scheme = null ) { 3265 global $pagenow;3266 3267 3263 $orig_scheme = $scheme; 3268 3264 … … 3276 3272 3277 3273 if ( ! in_array( $scheme, array( 'http', 'https', 'relative' ), true ) ) { 3278 if ( is_ssl() && ! is_admin() && 'wp-login.php' !== $pagenow) {3274 if ( is_ssl() ) { 3279 3275 $scheme = 'https'; 3280 3276 } else { -
trunk/tests/phpunit/tests/rest-api.php
r50005 r50156 790 790 $_SERVER['HTTPS'] = 'on'; 791 791 $url = get_rest_url(); 792 $this->assertSame( 'http ', parse_url( $url, PHP_URL_SCHEME ) );792 $this->assertSame( 'https', parse_url( $url, PHP_URL_SCHEME ) ); 793 793 794 794 // Reset. -
trunk/tests/phpunit/tests/url.php
r48937 r50156 204 204 // Pretend to be in the site admin. 205 205 set_current_screen( 'dashboard' ); 206 $home = get_option( 'home' ); 207 208 // home_url() should return http when in the admin. 209 $_SERVER['HTTPS'] = 'on'; 210 $this->assertSame( $home, home_url() ); 206 $home = get_option( 'home' ); 207 $home_https = str_replace( 'http://', 'https://', $home ); 208 209 // is_ssl() should determine the scheme in the admin. 210 $_SERVER['HTTPS'] = 'on'; 211 $this->assertSame( $home_https, home_url() ); 211 212 212 213 $_SERVER['HTTPS'] = 'off'; 213 214 $this->assertSame( $home, home_url() ); 214 215 215 // If not in the admin, is_ssl() should determine the scheme.216 // is_ssl() should determine the scheme on front end too. 216 217 set_current_screen( 'front' ); 217 218 $this->assertSame( $home, home_url() ); 218 $_SERVER['HTTPS'] = 'on'; 219 $ home = str_replace( 'http://', 'https://', $home );220 $this->assertSame( $home , home_url() );219 220 $_SERVER['HTTPS'] = 'on'; 221 $this->assertSame( $home_https, home_url() ); 221 222 222 223 // Test with https in home. … … 252 253 // Pretend to be in the site admin. 253 254 set_current_screen( 'dashboard' ); 254 $home = network_home_url(); 255 256 // home_url() should return http when in the admin. 255 $home = network_home_url(); 256 $home_https = str_replace( 'http://', 'https://', $home ); 257 258 // is_ssl() should determine the scheme in the admin. 257 259 $this->assertSame( 0, strpos( $home, 'http://' ) ); 258 260 $_SERVER['HTTPS'] = 'on'; 259 $this->assertSame( $home , network_home_url() );261 $this->assertSame( $home_https, network_home_url() ); 260 262 261 263 $_SERVER['HTTPS'] = 'off'; 262 264 $this->assertSame( $home, network_home_url() ); 263 265 264 // If not in the admin, is_ssl() should determine the scheme.266 // is_ssl() should determine the scheme on front end too. 265 267 set_current_screen( 'front' ); 266 268 $this->assertSame( $home, network_home_url() ); 267 269 $_SERVER['HTTPS'] = 'on'; 268 $home = str_replace( 'http://', 'https://', $home ); 269 $this->assertSame( $home, network_home_url() ); 270 $this->assertSame( $home_https, network_home_url() ); 270 271 271 272 $GLOBALS['current_screen'] = $screen;
Note: See TracChangeset
for help on using the changeset viewer.