AnsPress_Validation::sanitize( string $field, array $actions )

Description #

Sanitize field based on actions passed

Parameters #

  • $field
    string (Required)
  • $actions
    array (Required)

Changelog #

VersionDescription
2.0.1Introduced.

Source #

File: includes/class/validation.php

	private function sanitize($field, $actions) {

		foreach ( $actions as $type ) {
			switch ( $type ) {
				case 'sanitize_text_field':
					$this->sanitize_text_field( $field );
					break;

				case 'only_boolean':
					$this->only_boolean( $field );
					break;

				case 'only_int':
					$this->only_int( $field );
					break;

				case 'wp_kses':
					$this->wp_kses( $field );
					break;

				case 'remove_more':
					$this->remove_more( $field );
					break;

				case 'strip_shortcodes':
					$this->strip_shortcodes( $field );
					break;

				case 'encode_pre_code':
					$this->encode_pre_code( $field );
					break;

				case 'strip_tags':
					$this->strip_tags( $field );
					break;

				case 'sanitize_tags':
					$this->sanitize_tags( $field );
					break;

				case 'is_email':
					$this->is_email( $field );
					break;

				case 'sanitize_description':
					$this->sanitize_description( $field );
					break;

				default:
					$this->fields[$field] = apply_filters( 'ap_validation_sanitize_field', $field, $actions );
					break;
			}
		}
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment