/** * Sanitizes the incoming data * * @param array $data * @return array */ static function sanitize($data) { foreach ($data as $key => $value) { if (!is_array($value)) { $value = trim(str::stripslashes($value)); } else { $value = self::sanitize($value); } $data[$key] = $value; } return $data; }
function get($key = false, $default = null) { if (empty($key)) { return $_REQUEST; } $value = a::get($_REQUEST, $key, $default); return !is_array($value) ? trim(str::stripslashes($value)) : $value; }
/** * Private method to sanitize incoming request data * * @param array $data * @return array */ protected static function sanitize($data) { if (!is_array($data)) { return trim(str::stripslashes($data)); } foreach ($data as $key => $value) { $data[$key] = static::sanitize($value); } return $data; }
function get($key = false, $default = null) { $request = self::method() == 'GET' ? $_REQUEST : array_merge($_REQUEST, self::body()); if (empty($key)) { return $request; } $value = a::get($request, $key, $default); return !is_array($value) ? trim(str::stripslashes($value)) : $value; }