/** * Strip slashes from values, and from keys if magic_quotes_gpc = On */ function fw_stripslashes_deep_keys($value) { static $magic_quotes = null; if ($magic_quotes === null) { $magic_quotes = get_magic_quotes_gpc(); } if (is_array($value)) { if ($magic_quotes) { $new_value = array(); foreach ($value as $key => $val) { $new_value[is_string($key) ? stripslashes($key) : $key] = fw_stripslashes_deep_keys($val); } $value = $new_value; unset($new_value); } else { $value = array_map('fw_stripslashes_deep_keys', $value); } } elseif (is_object($value)) { $vars = get_object_vars($value); foreach ($vars as $key => $data) { $value->{$key} = fw_stripslashes_deep_keys($data); } } elseif (is_string($value)) { $value = stripslashes($value); } return $value; }
public static function REQUEST($multikey = null, $default_value = null) { return fw_stripslashes_deep_keys($multikey === null ? $_REQUEST : fw_akg($multikey, $_REQUEST, $default_value)); }