pods_unsanitize

Filter input and return unsanitized output.

Description

(array|mixed|object|string|void) pods_unsanitize( (mixed) $input, (array) $params = array() ); 

Returns (array|mixed|object|string|void)

Parameters (2)

0. $input (mixed)
The string, array, or object to unsanitize
1. $params — Optional. (array) => array()
Additional options

Usage

  1. if ( !function_exists( 'pods_unsanitize' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'pods-custom-content-types-and-fields/includes/data.php'; 
  3.  
  4. // The string, array, or object to unsanitize 
  5. $input = null; 
  6.  
  7. // Additional options 
  8. $params = array(); 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = pods_unsanitize($input, $params); 
  12.  

Defined (1)

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

/includes/data.php  
  1. function pods_unsanitize( $input, $params = array() ) { 
  2.  
  3. if ( '' === $input || is_int( $input ) || is_float( $input ) || empty( $input ) ) { 
  4. return $input; 
  5.  
  6. $output = array(); 
  7.  
  8. if ( empty( $input ) ) { 
  9. $output = $input; 
  10. elseif ( is_object( $input ) ) { 
  11. $input = get_object_vars( $input ); 
  12.  
  13. $n_params = (array) $params; 
  14. $n_params[ 'nested' ] = true; 
  15.  
  16. foreach ( $input as $key => $val ) { 
  17. $output[ pods_unsanitize( $key ) ] = pods_unsanitize( $val, $n_params ); 
  18.  
  19. $output = (object) $output; 
  20. elseif ( is_array( $input ) ) { 
  21. $n_params = (array) $params; 
  22. $n_params[ 'nested' ] = true; 
  23.  
  24. foreach ( $input as $key => $val ) { 
  25. $output[ pods_unsanitize( $key ) ] = pods_unsanitize( $val, $n_params ); 
  26. else { 
  27. // @todo Figure out what to do to unescape mysql_real_escape_string 
  28. if ( pods_version_check( wp, '3.6' ) ) { 
  29. $output = stripslashes( $input ); 
  30. else { 
  31. $output = stripslashes( $input ); 
  32.  
  33. return $output; 
  34.