WordPress как на ладони
Недорогой хостинг для сайтов на WordPress: wordpress.jino.ru
функция не описана

Automattic\WooCommerce\Admin\Features

Onboarding::calypso_tests() public WC 1.0

Allows quick access to testing the calypso parts of onboarding.

{} Это метод класса: Onboarding{}

Хуков нет.

Возвращает

Null. Ничего.

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

$result = Onboarding::calypso_tests();

Код Onboarding::calypso_tests() WC 4.7.0

<?php
public static function calypso_tests() {
	$calypso_env = defined( 'WOOCOMMERCE_CALYPSO_ENVIRONMENT' ) && in_array( WOOCOMMERCE_CALYPSO_ENVIRONMENT, array( 'development', 'wpcalypso', 'horizon', 'stage' ), true ) ? WOOCOMMERCE_CALYPSO_ENVIRONMENT : 'production';

	if ( Loader::is_admin_page() && class_exists( 'Jetpack' ) && isset( $_GET['test_wc_jetpack_connect'] ) && 1 === absint( $_GET['test_wc_jetpack_connect'] ) ) { // phpcs:ignore CSRF ok.
		$redirect_url = esc_url_raw(
			add_query_arg(
				array(
					'page' => 'wc-admin',
				),
				admin_url( 'admin.php' )
			)
		);

		$connect_url = \Jetpack::init()->build_connect_url( true, $redirect_url, 'woocommerce-onboarding' );
		$connect_url = add_query_arg( array( 'calypso_env' => $calypso_env ), $connect_url );

		wp_redirect( $connect_url );
		exit;
	}

	if ( Loader::is_admin_page() && isset( $_GET['test_wc_helper_connect'] ) && 1 === absint( $_GET['test_wc_helper_connect'] ) ) { // phpcs:ignore CSRF ok.
		include_once WC_ABSPATH . 'includes/admin/helper/class-wc-helper-api.php';

		$redirect_uri = wc_admin_url( '&task=connect&wccom-connected=1' );

		$request = \WC_Helper_API::post(
			'oauth/request_token',
			array(
				'body' => array(
					'home_url'     => home_url(),
					'redirect_uri' => $redirect_uri,
				),
			)
		);

		$code = wp_remote_retrieve_response_code( $request );
		if ( 200 !== $code ) {
			wp_die( esc_html__( 'WooCommerce Helper was not able to connect to WooCommerce.com.', 'woocommerce' ) );
			exit;
		}

		$secret = json_decode( wp_remote_retrieve_body( $request ) );
		if ( empty( $secret ) ) {
			wp_die( esc_html__( 'WooCommerce Helper was not able to connect to WooCommerce.com.', 'woocommerce' ) );
			exit;
		}

		$connect_url = add_query_arg(
			array(
				'home_url'     => rawurlencode( home_url() ),
				'redirect_uri' => rawurlencode( $redirect_uri ),
				'secret'       => rawurlencode( $secret ),
				'wccom-from'   => 'onboarding',
			),
			\WC_Helper_API::url( 'oauth/authorize' )
		);

		$connect_url = add_query_arg( array( 'calypso_env' => $calypso_env ), $connect_url );

		wp_redirect( $connect_url );
		exit;
	}
}