of_sanitize_checkbox

Sanitization for checkbox input.

Description

of_sanitize_checkbox( $input ); 

Parameters (1)

0. $input
String (1 or empty) checkbox state

Usage

  1. if ( !function_exists( 'of_sanitize_checkbox' ) ) { 
  2. require_once '/inc/includes/class-options-sanitize.php'; 
  3.  
  4. // string (1 or empty) checkbox state 
  5. $input = null; 
  6.  
  7. // NOTICE! Understand what this does before running. 
  8. $result = of_sanitize_checkbox($input); 
  9.  

Defined (1)

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

/inc/includes/class-options-sanitize.php  
  1. function of_sanitize_checkbox( $input ) { 
  2. if ( $input ) { 
  3. $output = '1'; 
  4. } else { 
  5. $output = false; 
  6. return $output;