WPCF7_ConstantContact::load()publicCF7 1.0

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

Хуков нет.

Возвращает

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

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

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

Код WPCF7_ConstantContact::load() CF7 5.9.3

public function load( $action = '' ) {
	if ( 'auth_redirect' == $action ) {
		$code = isset( $_GET['code'] ) ? urldecode( $_GET['code'] ) : '';
		$state = isset( $_GET['state'] ) ? urldecode( $_GET['state'] ) : '';

		if ( $code and $state
		and wpcf7_verify_nonce( $state, 'wpcf7_constant_contact_authorize' ) ) {
			$response = $this->request_token( $code );
		}

		if ( ! empty( $this->access_token ) ) {
			$message = 'success';
		} else {
			$message = 'failed';
		}

		wp_safe_redirect( $this->menu_page_url(
			array(
				'action' => 'setup',
				'message' => $message,
			)
		) );

		exit();
	}

	if ( 'setup' == $action and 'POST' == $_SERVER['REQUEST_METHOD'] ) {
		check_admin_referer( 'wpcf7-constant-contact-setup' );

		if ( ! empty( $_POST['reset'] ) ) {
			$this->reset_data();
		} else {
			$this->client_id = isset( $_POST['client_id'] )
				? trim( $_POST['client_id'] ) : '';

			$this->client_secret = isset( $_POST['client_secret'] )
				? trim( $_POST['client_secret'] ) : '';

			$this->save_data();
			$this->authorize( 'contact_data offline_access' );
		}

		wp_safe_redirect( $this->menu_page_url( 'action=setup' ) );
		exit();
	}
}