Input::CleanMagicQuotes PHP Method

CleanMagicQuotes() public static method

Please see: {@link http://ca.php.net/manual/en/function.get-magic-quotes-gpc.php this PHP.net page specifically the user note by php at kaiundina dot de}, for why this is so complicated.
public static CleanMagicQuotes ( array $p_array ) : array
$p_array array
return array
    public static function CleanMagicQuotes($p_array)
    {
        $gpcList = array();
        foreach ($p_array as $key => $value) {
            $decodedKey = stripslashes($key);
            if (is_array($value)) {
                $decodedValue = Input::CleanMagicQuotes($value);
            } else {
                $decodedValue = stripslashes($value);
            }
            $gpcList[$decodedKey] = $decodedValue;
        }
        return $gpcList;
    }

Usage Example

Example #1
0
 /**
  * Initializes the input parameters array
  *
  * @param string $p_reqMethod
  */
 private static function InitInput(&$p_reqMethod) {
     self::TranslateMethod($p_reqMethod);
     if (!isset($GLOBALS['CampRequestInput'][$p_reqMethod])) {
     	switch($p_reqMethod) {
     		case 'GET':
     			$input = &$_GET;
     			break;
     		case 'POST':
     			$input = &$_POST;
     			break;
     		case 'COOKIE':
     			$input = &$_COOKIE;
     			break;
     		case 'FILES':
     			$input = &$_FILES;
     			break;
     		case 'DEFAULT':
     			$input = array_merge($_COOKIE, $_REQUEST);
     			break;
     		default:
     			return;
     	}
     	require_once($GLOBALS['g_campsiteDir'].'/classes/Input.php');
         $GLOBALS['CampRequestInput'][$p_reqMethod] = Input::CleanMagicQuotes($input);
     }
 }
All Usage Examples Of Input::CleanMagicQuotes