Tribe__PUE__Checker::ajax_validate_key()

Echo JSON results for key validation


Source

File: src/Tribe/PUE/Checker.php

		public function ajax_validate_key() {

			$key   = isset( $_POST['key'] ) ? wp_unslash( $_POST['key'] ) : null;
			$nonce = isset( $_POST['_wpnonce'] ) ? wp_unslash( $_POST['_wpnonce'] ) : null;

			if ( empty( $nonce ) || false === wp_verify_nonce( $nonce, 'pue-validate-key_' . $this->get_slug() ) ) {
				$response = array(
					'status'  => 0,
					'message' => __( 'Please refresh the page and try your request again.', 'tribe-common' ),
				);
			} else {
				$response = $this->validate_key( $key );
			}

			echo json_encode( $response );
			exit;

		}