WC_Helper_Admin::get_connection_url()public staticWC 1.0

Generates the URL for connecting or disconnecting the store to/from WooCommerce.com. Approach taken from existing helper code that isn't exposed.

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

Хуков нет.

Возвращает

Строку.

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

$result = WC_Helper_Admin::get_connection_url();

Код WC_Helper_Admin::get_connection_url() WC 9.4.2

public static function get_connection_url() {
	global $current_screen;

	$connect_url_args = array(
		'page'    => 'wc-addons',
		'section' => 'helper',
	);

	// No active connection.
	if ( WC_Helper::is_site_connected() ) {
		$connect_url_args['wc-helper-disconnect'] = 1;
		$connect_url_args['wc-helper-nonce']      = wp_create_nonce( 'disconnect' );
	} else {
		$connect_url_args['wc-helper-connect'] = 1;
		$connect_url_args['wc-helper-nonce']   = wp_create_nonce( 'connect' );
	}

	if ( ! empty( $_GET['utm_source'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		$connect_url_args['utm_source'] = wc_clean( wp_unslash( $_GET['utm_source'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
	}

	if ( ! empty( $_GET['utm_campaign'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification.Recommended
		$connect_url_args['utm_campaign'] = wc_clean( wp_unslash( $_GET['utm_campaign'] ) ); // phpcs:ignore WordPress.Security.NonceVerification.Recommended
	}

	return add_query_arg(
		$connect_url_args,
		admin_url( 'admin.php' )
	);
}