WPCF7_Submission::validate()privateCF7 1.0

Runs user input validation.

{} Это метод класса: WPCF7_Submission{}

Хуки из метода

Возвращает

true|false. True if no invalid field is found.

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

// private - только в коде основоного (родительского) класса
$result = $this->validate();

Код WPCF7_Submission::validate() CF7 5.6.3

private function validate() {
	if ( $this->invalid_fields ) {
		return false;
	}

	$result = new WPCF7_Validation();

	$this->contact_form->validate_schema(
		array(
			'text' => true,
			'file' => false,
			'field' => array(),
		),
		$result
	);

	$tags = $this->contact_form->scan_form_tags( array(
	  'feature' => '! file-uploading',
	) );

	foreach ( $tags as $tag ) {
		$type = $tag->type;
		$result = apply_filters( "wpcf7_validate_{$type}", $result, $tag );
	}

	$result = apply_filters( 'wpcf7_validate', $result, $tags );

	$this->invalid_fields = $result->get_invalid_fields();

	return $result->is_valid();
}