of_sanitize_enum

Validates that the $input is one of the avilable choices for that specific option.

Description

of_sanitize_enum( (string) $input, $option ); 

Parameters (2)

0. $input (string)
The input.
1. $option
The option.

Usage

  1. if ( !function_exists( 'of_sanitize_enum' ) ) { 
  2. require_once '/admin/includes/class-options-sanitization.php'; 
  3.  
  4. // The input. 
  5. $input = ''; 
  6.  
  7. // The option. 
  8. $option = null; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = of_sanitize_enum($input, $option); 
  12.  

Defined (1)

The function is defined in the following location(s).

/admin/includes/class-options-sanitization.php  
  1. function of_sanitize_enum( $input, $option ) { 
  2. $output = ''; 
  3. if ( $input && array_key_exists( $input, $option['options'] ) ) { 
  4. $output = $input; 
  5. return $output;