WPCF7_Turnstile::load │ public │ CF7 1.0

The loading process of the service configuration page.

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

Хуков нет.

Возвращает

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

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

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

Код WPCF7_Turnstile::load() CF7 6.1.7

public function load( $action = '' ) {
	if (
		'setup' === $action and
		'POST' === wpcf7_superglobal_server( 'REQUEST_METHOD' )
	) {
		check_admin_referer( 'wpcf7-turnstile-setup' );

		if ( wpcf7_superglobal_post( 'reset' ) ) {
			$this->reset_data();
			$redirect_to = $this->menu_page_url( 'action=setup' );
		} else {
			$sitekey = wpcf7_superglobal_post( 'sitekey' );
			$secret = wpcf7_superglobal_post( 'secret' );

			if ( $sitekey and $secret ) {
				$this->sitekeys = array( $sitekey => $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();
	}
}