bb_global_sanitize

Sanitizes user input en-masse.

Description

bb_global_sanitize( (mixed) $array, (bool) $trim = true ); 

Parameters (2)

0. $array (mixed)
The array of values or a single value to sanitize, usually a global variable like $_GET or $_POST.
1. $trim — Optional. (bool) => true
Whether to trim the value or not. Default is true.

Usage

  1. if ( !function_exists( 'bb_global_sanitize' ) ) { 
  2. require_once ABSPATH . PLUGINDIR . 'buddypress/bp-forums/bbpress/bb-includes/functions.bb-core.php'; 
  3.  
  4. // The array of values or a single value to sanitize, usually a global variable like $_GET or $_POST. 
  5. $array = null; 
  6.  
  7. // Optional. Whether to trim the value or not. Default is true. 
  8. $trim = true; 
  9.  
  10. // NOTICE! Understand what this does before running. 
  11. $result = bb_global_sanitize($array, $trim); 
  12.  

Defined (1)

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

/bp-forums/bbpress/bb-includes/functions.bb-core.php  
  1. function bb_global_sanitize( $array, $trim = true ) 
  2. foreach ( $array as $k => $v ) { 
  3. if ( is_array( $v ) ) { 
  4. $array[$k] = bb_global_sanitize( $v ); 
  5. } else { 
  6. if ( !get_magic_quotes_gpc() ) { 
  7. $array[$k] = addslashes( $v ); 
  8. if ( $trim ) { 
  9. $array[$k] = trim( $array[$k] ); 
  10.  
  11. return $array;