51 $method = strtoupper(
$_SERVER[
'REQUEST_METHOD']);
85 public static function getVar(
$name, $default = null, $hash =
'default',
$type =
'none', $mask = 0)
88 $hash = strtoupper($hash);
89 if ($hash ===
'METHOD') {
90 $hash = self::getMethod();
120 if (isset($input[
$name]) && $input[$name] !== null) {
122 $var = self::cleanVar($input[$name], $mask,
$type);
125 if (get_magic_quotes_gpc() && (
$var != $default) && ($hash !=
'FILES')) {
126 $var = self::stripSlashesRecursive(
$var);
129 if ($default !== null) {
131 $var = self::cleanVar($default, $mask,
$type);
153 public static function getInt(
$name, $default = 0, $hash =
'default')
155 return self::getVar(
$name, $default, $hash,
'int');
173 return self::getVar(
$name, $default, $hash,
'float');
189 public static function getBool(
$name, $default =
false, $hash =
'default')
191 return self::getVar(
$name, $default, $hash,
'bool');
207 public static function getWord(
$name, $default =
'', $hash =
'default')
209 return self::getVar(
$name, $default, $hash,
'word');
225 public static function getCmd(
$name, $default =
'', $hash =
'default')
227 return self::getVar(
$name, $default, $hash,
'cmd');
244 public static function getString(
$name, $default =
'', $hash =
'default', $mask = 0)
247 return (
string) self::getVar(
$name, $default, $hash,
'string', $mask);
259 public static function getArray(
$name, $default = array(), $hash =
'default')
261 return self::getVar(
$name, $default, $hash,
'array');
273 public static function getText(
$name, $default =
'', $hash =
'default')
275 return (
string) self::getVar(
$name, $default, $hash,
'string', self::ALLOWRAW);
287 public static function getUrl(
$name, $default =
'', $hash =
'default')
289 return (
string) self::getVar(
$name, $default, $hash,
'weburl');
301 public static function getPath(
$name, $default =
'', $hash =
'default')
303 return (
string) self::getVar(
$name, $default, $hash,
'path');
317 $ret = (string) self::getVar(
$name, $default, $hash,
'email');
318 return empty($ret) ? $default : $ret;
330 public static function getIP(
$name, $default =
'', $hash =
'default')
332 $ret = (string) self::getVar(
$name, $default, $hash,
'ip');
333 return empty($ret) ? $default : $ret;
346 public static function setVar(
$name, $value = null, $hash =
'method', $overwrite =
true)
348 $hash = strtoupper($hash);
349 if ($hash ===
'METHOD') {
350 $hash = strtoupper(
$_SERVER[
'REQUEST_METHOD']);
354 $original = self::get($hash, self::ALLOWRAW);
355 if (isset($original[
$name])) {
356 $previous = $original[
$name];
368 $_GET[
$name] = $value;
369 $_REQUEST[
$name] = $value;
372 $_POST[
$name] = $value;
373 $_REQUEST[
$name] = $value;
376 $_REQUEST[
$name] = $value;
379 $_COOKIE[
$name] = $value;
380 $_REQUEST[
$name] = $value;
383 $_FILES[
$name] = $value;
386 $_ENV[
'name'] = $value;
419 public static function get($hash =
'default', $mask = 0)
421 $hash = strtoupper($hash);
423 if ($hash ===
'METHOD') {
424 $hash = strtoupper(
$_SERVER[
'REQUEST_METHOD']);
452 if (get_magic_quotes_gpc() && ($hash !=
'FILES')) {
453 $input = self::stripSlashesRecursive($input);
456 $result = self::cleanVars($input, $mask);
470 public static function set($array, $hash =
'default', $overwrite =
true)
472 foreach ($array as $key => $value) {
473 self::setVar($key, $value, $hash, $overwrite);
495 static $noHtmlFilter = null;
496 static $safeHtmlFilter = null;
499 if (strtolower(
$type) ==
'array' && !is_array(
$var)) {
504 if (!($mask & 1) && is_string(
$var)) {
514 if (is_null($safeHtmlFilter)) {
520 if (is_null($noHtmlFilter)) {
541 if (is_string(
$var)) {
544 foreach (
$var as $key => &$value) {
545 $value = self::cleanVars($value, $mask,
$type);
562 $value = is_array($value) ? array_map(array(
'Xoops\Core\Request',
'stripSlashesRecursive'), $value)
563 : stripslashes($value);
static getCmd($name, $default= '', $hash= 'default')
static cleanVars($var, $mask=0, $type=null)
static getWord($name, $default= '', $hash= 'default')
static getFloat($name, $default=0.0, $hash= 'default')
static getVar($name, $default=null, $hash= 'default', $type= 'none', $mask=0)
static cleanVar($var, $mask=0, $type=null)
static set($array, $hash= 'default', $overwrite=true)
static getPath($name, $default= '', $hash= 'default')
static getText($name, $default= '', $hash= 'default')
static getInt($name, $default=0, $hash= 'default')
static getEmail($name, $default= '', $hash= 'default')
static stripSlashesRecursive($value)
static getString($name, $default= '', $hash= 'default', $mask=0)
static setVar($name, $value=null, $hash= 'method', $overwrite=true)
static getIP($name, $default= '', $hash= 'default')
static getUrl($name, $default= '', $hash= 'default')
static getArray($name, $default=array(), $hash= 'default')
static getBool($name, $default=false, $hash= 'default')