protected function validate() {
		$msg = $this->getMessages();

		// Validate nonce.
		if ( ! isset( $_POST['set_key_auth'] ) || ! check_ajax_referer( 'boldgrid_set_key', 'set_key_auth', false ) ) {
			wp_send_json_error( array( 'message' => $msg->nonce ) );
		}

		// Validate user input.
		if ( empty( $_POST['api_key'] ) ) {
			wp_send_json_error( array( 'message' => $msg->error ) );
		}

		// Validate key.
		$valid = new Library\Key\Validate( sanitize_text_field( $_POST['api_key'] ) );
		if ( ! $valid->getValid() ) {
			wp_send_json_error( array( 'message' => $msg->error ) );
		}

		return $valid->getHash();
	}
protected function validate() {
		$msg = $this->getMessages();

		// Validate nonce.
		if ( ! isset( $_POST['set_key_auth'] ) || ! check_ajax_referer( 'boldgrid_set_key', 'set_key_auth', false ) ) {
			wp_send_json_error( array( 'message' => $msg->nonce ) );
		}

		// Validate user input.
		if ( empty( $_POST['api_key'] ) ) {
			wp_send_json_error( array( 'message' => $msg->error ) );
		}

		// Validate key.
		$valid = new Library\Key\Validate( sanitize_text_field( $_POST['api_key'] ) );
		if ( ! $valid->getValid() ) {
			wp_send_json_error( array( 'message' => $msg->error ) );
		}

		return $valid->getHash();
	}
protected function validate ( ) { $ msg = $ this -> getMessages ( ) ; // Validate nonce. if ( ! isset ( $ _POST [ 'set_key_auth' ] ) || ! check_ajax_referer ( 'boldgrid_set_key' , 'set_key_auth' , false ) ) { wp_send_json_error ( array ( 'message' => $ msg -> nonce ) ) ; } // Validate user input. if ( empty ( $ _POST [ 'api_key' ] ) ) { wp_send_json_error ( array ( 'message' => $ msg -> error ) ) ; } // Validate key. $ valid = new Library \ Key \ Validate ( sanitize_text_field ( $ _POST [ 'api_key' ] ) ) ; if ( ! $ valid -> getValid ( ) ) { wp_send_json_error ( array ( 'message' => $ msg -> error ) ) ; } return $ valid -> getHash ( ) ; }
Handles validation of user input on API key entry form.

@since  1.0.0

@return string The user's validate API key hash.
Handles validation of user input on API key entry form .