Form::sanitize_validate( boolean|array $fields = false )
Description #
Validate and sanitize all fields.
Parameters #
- $fieldsboolean | array (Optional) Fields to process. Default value: false
Source #
File: lib/class-form.php
private function sanitize_validate( $fields = false ) { if ( ! ap_isset_post_value( $this->form_name . '_submit' ) ) { return; } if ( false === $this->prepared ) { $this->prepare(); } if ( false === $fields ) { $fields = $this->fields; } foreach ( (array) $fields as $field ) { if ( ! empty( $field->child ) && ! empty( $field->child->fields ) ) { $this->sanitize_validate( $field->child->fields ); } $field->sanitize(); $field->validate(); if ( true === $field->have_errors() ) { $this->add_error( 'fields-error', __( 'Error found in fields, please check and re-submit', 'anspress-question-answer' ) ); } } }
Expand full source code Collapse full source code View on GitHub: lib/class-form.php:408
Add your comment