simcal_sanitize_input

Sanitize a variable of unknown type.

Description

(array|string) simcal_sanitize_input( (mixed) $var, (string) $func = 'sanitize_text_field' ); 

Recursive helper function to sanitize a variable from input, which could also be a multidimensional array of variable depth.

Returns (array|string)

Sanitized variable

Parameters (2)

0. $var (mixed)
Variable to sanitize.
1. $func — Optional. (string) => 'sanitize_text_field'
Function to use for sanitizing text strings (default sanitize_text_field)

Usage

  1. if ( !function_exists( 'simcal_sanitize_input' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'simple-calendar/includes/functions/admin.php'; 
  3.  
  4. // Variable to sanitize. 
  5. $var = null; 
  6.  
  7. // Function to use for sanitizing text strings (default 'sanitize_text_field') 
  8. $func = 'sanitize_text_field'; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = simcal_sanitize_input($var, $func); 
  12.  

Defined (1)

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

/includes/functions/admin.php