Module::verify_request( bool|awsmug\Torro_Forms\Modules\Protectors\WP_Error $verified, array $data, awsmug\Torro_Forms\DB_Objects\Forms\Form $form, awsmug\Torro_Forms\DB_Objects\Submissions\Submission|null $submission = null )

Verifies a request by ensuring that it is not spammy.

Description

See also

Parameters

$verified

(bool|awsmug\Torro_Forms\Modules\Protectors\WP_Error) (Required) Either a boolean or an error object must be returned. Default true.

$data

(array) (Required) Submission POST data.

$form

(awsmug\Torro_Forms\DB_Objects\Forms\Form) (Required) Form object.

$submission

(awsmug\Torro_Forms\DB_Objects\Submissions\Submission|null) (Optional) Submission object, or null if a new submission.

Default value: null

Return

(bool|awsmug\Torro_Forms\Modules\Protectors\WP_Error) A possibly modified $verified value.

Source

File: src/modules/protectors/module.php

	protected function verify_request( $verified, $data, $form, $submission = null ) {
		if ( ! $verified ) {
			return $verified;
		}

		// Protectors are only applied before submission completion.
		if ( ! $this->is_final_submit_request( $form, $submission ) ) {
			return $verified;
		}

		foreach ( $this->submodules as $slug => $protector ) {
			if ( ! $protector->enabled( $form ) ) {
				continue;
			}

			$sub_verified = $protector->verify_request( $data, $form, $submission );
			if ( ! $sub_verified || is_wp_error( $sub_verified ) ) {
				return $sub_verified;
			}
		}

		return $verified;
	}

Changelog

Changelog
Version Description
1.0.0 Introduced.