Merge pull request #22531 from rellect/fix_ssl_check
Fix ssl check in case shop page no longer exists
This commit is contained in:
commit
20330b01bd
|
@ -404,7 +404,7 @@ class WC_Admin_Notices {
|
||||||
* @since 3.5.1
|
* @since 3.5.1
|
||||||
*/
|
*/
|
||||||
protected static function is_ssl() {
|
protected static function is_ssl() {
|
||||||
$shop_page = 0 < wc_get_page_id( 'shop' ) ? get_permalink( wc_get_page_id( 'shop' ) ) : get_home_url();
|
$shop_page = wc_get_page_permalink( 'shop' );
|
||||||
|
|
||||||
return ( is_ssl() && 'https' === substr( $shop_page, 0, 5 ) );
|
return ( is_ssl() && 'https' === substr( $shop_page, 0, 5 ) );
|
||||||
}
|
}
|
||||||
|
|
|
@ -989,7 +989,7 @@ class WC_REST_System_Status_V2_Controller extends WC_REST_Controller {
|
||||||
* @return array
|
* @return array
|
||||||
*/
|
*/
|
||||||
public function get_security_info() {
|
public function get_security_info() {
|
||||||
$check_page = 0 < wc_get_page_id( 'shop' ) ? get_permalink( wc_get_page_id( 'shop' ) ) : get_home_url();
|
$check_page = wc_get_page_permalink( 'shop' );
|
||||||
return array(
|
return array(
|
||||||
'secure_connection' => 'https' === substr( $check_page, 0, 5 ),
|
'secure_connection' => 'https' === substr( $check_page, 0, 5 ),
|
||||||
'hide_errors' => ! ( defined( 'WP_DEBUG' ) && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG && WP_DEBUG_DISPLAY ) || 0 === intval( ini_get( 'display_errors' ) ),
|
'hide_errors' => ! ( defined( 'WP_DEBUG' ) && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG && WP_DEBUG_DISPLAY ) || 0 === intval( ini_get( 'display_errors' ) ),
|
||||||
|
|
|
@ -81,7 +81,7 @@ class WC_Tests_REST_System_Status extends WC_REST_Unit_Test_Case {
|
||||||
$data = $response->get_data();
|
$data = $response->get_data();
|
||||||
$environment = (array) $data['environment'];
|
$environment = (array) $data['environment'];
|
||||||
|
|
||||||
// Make sure all expected data is present
|
// Make sure all expected data is present.
|
||||||
$this->assertEquals( 32, count( $environment ) );
|
$this->assertEquals( 32, count( $environment ) );
|
||||||
|
|
||||||
// Test some responses to make sure they match up.
|
// Test some responses to make sure they match up.
|
||||||
|
@ -183,7 +183,7 @@ class WC_Tests_REST_System_Status extends WC_REST_Unit_Test_Case {
|
||||||
$settings = (array) $data['security'];
|
$settings = (array) $data['security'];
|
||||||
|
|
||||||
$this->assertEquals( 2, count( $settings ) );
|
$this->assertEquals( 2, count( $settings ) );
|
||||||
$this->assertEquals( 'https' === substr( get_permalink( wc_get_page_id( 'shop' ) ), 0, 5 ), $settings['secure_connection'] );
|
$this->assertEquals( 'https' === substr( wc_get_page_permalink( 'shop' ), 0, 5 ), $settings['secure_connection'] );
|
||||||
$this->assertEquals( ! ( defined( 'WP_DEBUG' ) && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG && WP_DEBUG_DISPLAY ) || 0 === intval( ini_get( 'display_errors' ) ), $settings['hide_errors'] );
|
$this->assertEquals( ! ( defined( 'WP_DEBUG' ) && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG && WP_DEBUG_DISPLAY ) || 0 === intval( ini_get( 'display_errors' ) ), $settings['hide_errors'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -78,7 +78,7 @@ class WC_Tests_REST_System_Status_V2 extends WC_REST_Unit_Test_Case {
|
||||||
$data = $response->get_data();
|
$data = $response->get_data();
|
||||||
$environment = (array) $data['environment'];
|
$environment = (array) $data['environment'];
|
||||||
|
|
||||||
// Make sure all expected data is present
|
// Make sure all expected data is present.
|
||||||
$this->assertEquals( 32, count( $environment ) );
|
$this->assertEquals( 32, count( $environment ) );
|
||||||
|
|
||||||
// Test some responses to make sure they match up.
|
// Test some responses to make sure they match up.
|
||||||
|
@ -180,7 +180,7 @@ class WC_Tests_REST_System_Status_V2 extends WC_REST_Unit_Test_Case {
|
||||||
$settings = (array) $data['security'];
|
$settings = (array) $data['security'];
|
||||||
|
|
||||||
$this->assertEquals( 2, count( $settings ) );
|
$this->assertEquals( 2, count( $settings ) );
|
||||||
$this->assertEquals( 'https' === substr( get_permalink( wc_get_page_id( 'shop' ) ), 0, 5 ), $settings['secure_connection'] );
|
$this->assertEquals( 'https' === substr( wc_get_page_permalink( 'shop' ), 0, 5 ), $settings['secure_connection'] );
|
||||||
$this->assertEquals( ! ( defined( 'WP_DEBUG' ) && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG && WP_DEBUG_DISPLAY ) || 0 === intval( ini_get( 'display_errors' ) ), $settings['hide_errors'] );
|
$this->assertEquals( ! ( defined( 'WP_DEBUG' ) && defined( 'WP_DEBUG_DISPLAY' ) && WP_DEBUG && WP_DEBUG_DISPLAY ) || 0 === intval( ini_get( 'display_errors' ) ), $settings['hide_errors'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue