Changeset 50072 for trunk/src/wp-includes/https-detection.php
- Timestamp:
- 01/29/2021 07:09:49 PM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/https-detection.php
r49909 r50072 10 10 * Checks whether the website is using HTTPS. 11 11 * 12 * This is based on whether the home and site URL are using HTTPS. 13 * 14 * @since 5.7.0 12 * This is based on whether both the home and site URL are using HTTPS. 13 * 14 * @since 5.7.0 15 * @see wp_is_home_url_using_https() 16 * @see wp_is_site_url_using_https() 15 17 * 16 18 * @return bool True if using HTTPS, false otherwise. 17 19 */ 18 20 function wp_is_using_https() { 19 if ( 'https' !== wp_parse_url( home_url(), PHP_URL_SCHEME) ) {21 if ( ! wp_is_home_url_using_https() ) { 20 22 return false; 21 23 } 22 24 25 return wp_is_site_url_using_https(); 26 } 27 28 /** 29 * Checks whether the current site URL is using HTTPS. 30 * 31 * @since 5.7.0 32 * @see home_url() 33 * 34 * @return bool True if using HTTPS, false otherwise. 35 */ 36 function wp_is_home_url_using_https() { 37 return 'https' === wp_parse_url( home_url(), PHP_URL_SCHEME ); 38 } 39 40 /** 41 * Checks whether the current site's URL where WordPress is stored is using HTTPS. 42 * 43 * This checks the URL where WordPress application files (e.g. wp-blog-header.php or the wp-admin/ folder) are 44 * accessible. 45 * 46 * @since 5.7.0 47 * @see site_url() 48 * 49 * @return bool True if using HTTPS, false otherwise. 50 */ 51 function wp_is_site_url_using_https() { 23 52 // Use direct option access for 'siteurl' and manually run the 'site_url' 24 // filter because site_url()will adjust the scheme based on what the53 // filter because `site_url()` will adjust the scheme based on what the 25 54 // current request is using. 26 55 /** This filter is documented in wp-includes/link-template.php */ 27 56 $site_url = apply_filters( 'site_url', get_option( 'siteurl' ), '', null, null ); 28 57 29 if ( 'https' !== wp_parse_url( $site_url, PHP_URL_SCHEME ) ) { 30 return false; 31 } 32 33 return true; 58 return 'https' === wp_parse_url( $site_url, PHP_URL_SCHEME ); 34 59 } 35 60 … … 105 130 if ( 200 !== wp_remote_retrieve_response_code( $response ) ) { 106 131 $support_errors->add( 'bad_response_code', wp_remote_retrieve_response_message( $response ) ); 107 } elseif ( false === wp_is_ owned_html_output( wp_remote_retrieve_body( $response ) ) ) {132 } elseif ( false === wp_is_local_html_output( wp_remote_retrieve_body( $response ) ) ) { 108 133 $support_errors->add( 'bad_response_source', __( 'It looks like the response did not come from this site.' ) ); 109 134 } … … 160 185 * @return bool|null True/false for whether HTML was generated by this site, null if unable to determine. 161 186 */ 162 function wp_is_ owned_html_output( $html ) {187 function wp_is_local_html_output( $html ) { 163 188 // 1. Check if HTML includes the site's Really Simple Discovery link. 164 189 if ( has_action( 'wp_head', 'rsd_link' ) ) {
Note: See TracChangeset
for help on using the changeset viewer.