Automattic\WooCommerce\Admin\Notes
WooCommercePayments::install_on_action() public WC 1.0
Install & activate WooCommerce Payments plugin, and redirect to setup.
{} Это метод класса: WooCommercePayments{}
Хуков нет.
Возвращает
Null. Ничего.
Использование
$WooCommercePayments = new WooCommercePayments(); $WooCommercePayments->install_on_action();
Код WooCommercePayments::install_on_action() WooCommercePayments::install on action WC 5.0.0
public function install_on_action() {
// TODO: Need to validate this request more strictly since we're taking install actions directly?
/* phpcs:disable WordPress.Security.NonceVerification */
if (
! isset( $_GET['page'] ) ||
'wc-admin' !== $_GET['page'] ||
! isset( $_GET['action'] ) ||
'setup-woocommerce-payments' !== $_GET['action']
) {
return;
}
/* phpcs:enable */
if ( ! current_user_can( 'install_plugins' ) ) {
return;
}
$this->install_and_activate_wcpay();
// WooCommerce Payments is installed at this point, so link straight into the onboarding flow.
$connect_url = add_query_arg(
array(
'wcpay-connect' => '1',
'_wpnonce' => wp_create_nonce( 'wcpay-connect' ),
),
admin_url()
);
wp_safe_redirect( $connect_url );
exit;
}