pods_v_sanitized

Return a sanitized variable (if exists).

Description

pods_v_sanitized( (constant) $var = null, (string) $type = 'get', (constant) $default = null, (constant) $strict = false, (array) $params = array() ); 

Parameters (5)

0. $var — Optional. (constant) => null
The variable name, can also be a modifier for specific types
1. $type — Optional. (string) => 'get'
Super globals, url/url-relative, constants, globals, options, transients, cache, user data, Pod field values, dates
2. $default — Optional. (constant) => null
The default value to set if variable doesn't exist
3. $strict — Optional. (constant) => false
Only allow values (must not be empty)
4. $params — Optional. (array) => array()
Set casting=>true to cast value from $default, allowed=>$allowed to restrict a value to what's allowed

Usage

  1. if ( !function_exists( 'pods_v_sanitized' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'pods-custom-content-types-and-fields/includes/data.php'; 
  3.  
  4. // The variable name, can also be a modifier for specific types 
  5. $var = null; 
  6.  
  7. // (optional) Super globals, url/url-relative, constants, globals, options, transients, cache, user data, Pod field values, dates 
  8. $type = 'get'; 
  9.  
  10. // (optional) The default value to set if variable doesn't exist 
  11. $default = null; 
  12.  
  13. // (optional) Only allow values (must not be empty) 
  14. $strict = false; 
  15.  
  16. // (optional) Set 'casting'=>true to cast value from $default, 'allowed'=>$allowed to restrict a value to what's allowed 
  17. $params = array(); 
  18.  
  19. // NOTICE! Understand what this does before running. 
  20. $result = pods_v_sanitized($var, $type, $default, $strict, $params); 
  21.  

Defined (1)

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

/includes/data.php  
  1. function pods_v_sanitized( $var = null, $type = 'get', $default = null, $strict = false, $params = array() ) { 
  2.  
  3. $output = pods_v( $var, $type, $default, $strict, $params ); 
  4.  
  5. $output = pods_sanitize( $output, $params ); 
  6.  
  7. return $output; 
  8.