Popmake_Fields::sanitize_field( $args,  $value = null )


Description Description


Source Source

File: includes/class-popmake-fields.php

	public function sanitize_field( $args, $value = null ) {

		// If no type default to text.
		$type = ! empty( $args['type'] ) ? $args['type'] : 'text';

		/**
		 * Check if any actions hooked to this type of field and load run those.
		 */
		if ( has_filter( "pum_{$type}_sanitize" ) ) {
			$value = apply_filters( "pum_{$type}_sanitize", $value, $args );
		} else {
			/**
			 * Check if override or custom function exists and load that.
			 */
			if ( function_exists( "pum_{$type}_sanitize" ) ) {
				$function_name = "pum_{$type}_sanitize";
			} /**
			 * Check if core method exists and load that.
			 */ elseif ( method_exists( $this, $type . '_sanitize' ) ) {
				$function_name = array( $this, $type . '_sanitize' );
			} else {
				$function_name = null;
			}

			if ( $function_name ) {
				/**
				 * Call the determined method, passing the field args & $value to the callback.
				 */
				$value = call_user_func_array( $function_name, array( $value, $args ) );
			}

		}

		$value = apply_filters( 'pum_settings_sanitize', $value, $args );

		return $value;
	}


Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.