WPCF7_Stripe::load()publicCF7 1.0

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

Хуков нет.

Возвращает

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

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

$WPCF7_Stripe = new WPCF7_Stripe();
$WPCF7_Stripe->load( $action );
$action **
-
По умолчанию: ''

Код WPCF7_Stripe::load() CF7 5.9.8

public function load( $action = '' ) {
	if ( 'setup' == $action and 'POST' == $_SERVER['REQUEST_METHOD'] ) {
		check_admin_referer( 'wpcf7-stripe-setup' );

		if ( ! empty( $_POST['reset'] ) ) {
			$this->reset_data();
			$redirect_to = $this->menu_page_url( 'action=setup' );
		} else {
			$publishable = trim( $_POST['publishable'] ?? '' );
			$secret = trim( $_POST['secret'] ?? '' );

			if ( $publishable and $secret ) {
				$this->api_keys = array(
					'publishable' => $publishable,
					'secret' => $secret,
				);
				$this->save_data();

				$redirect_to = $this->menu_page_url( array(
					'message' => 'success',
				) );
			} else {
				$redirect_to = $this->menu_page_url( array(
					'action' => 'setup',
					'message' => 'invalid',
				) );
			}
		}

		wp_safe_redirect( $redirect_to );
		exit();
	}
}