WC_HTTPS::init()public staticWC 1.0

Hook in our HTTPS functions if we're on the frontend. This will ensure any links output to a page (when viewing via HTTPS) are also served over HTTPS.

Метод класса: WC_HTTPS{}

Хуков нет.

Возвращает

null. Ничего (null).

Использование

$result = WC_HTTPS::init();

Код WC_HTTPS::init() WC 8.7.0

public static function init() {
	if ( 'yes' === get_option( 'woocommerce_force_ssl_checkout' ) && ! is_admin() ) {
		// HTTPS urls with SSL on
		$filters = array(
			'post_thumbnail_html',
			'wp_get_attachment_image_attributes',
			'wp_get_attachment_url',
			'option_stylesheet_url',
			'option_template_url',
			'script_loader_src',
			'style_loader_src',
			'template_directory_uri',
			'stylesheet_directory_uri',
			'site_url',
		);

		foreach ( $filters as $filter ) {
			add_filter( $filter, array( __CLASS__, 'force_https_url' ), 999 );
		}

		add_filter( 'page_link', array( __CLASS__, 'force_https_page_link' ), 10, 2 );
		add_action( 'template_redirect', array( __CLASS__, 'force_https_template_redirect' ) );

		if ( 'yes' == get_option( 'woocommerce_unforce_ssl_checkout' ) ) {
			add_action( 'template_redirect', array( __CLASS__, 'unforce_https_template_redirect' ) );
		}
	}
	add_action( 'http_api_curl', array( __CLASS__, 'http_api_curl' ), 10, 3 );
}