You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
62 lines
1.4 KiB
62 lines
1.4 KiB
<?php
|
|
/**
|
|
* Класс для работы с переменными окружения.
|
|
*
|
|
* @copyright
|
|
* @link
|
|
* @package Majestic
|
|
* @subpackage Core
|
|
* @since
|
|
* @version SVN: $Id$
|
|
* @filesource $URL$
|
|
*/
|
|
final class Env
|
|
{
|
|
static public $params = array();
|
|
|
|
static function Get($var, $default = false)
|
|
{
|
|
return isset($_GET[$var]) ? $_GET[$var] : $default;
|
|
}
|
|
|
|
static function Post($var, $default = false)
|
|
{
|
|
return isset($_POST[$var]) ? $_POST[$var] : $default;
|
|
}
|
|
|
|
static function Server($var, $default = false)
|
|
{
|
|
return isset($_SERVER[$var]) ? $_SERVER[$var] : $default;
|
|
}
|
|
|
|
static function Session($var, $default = false)
|
|
{
|
|
return isset($_SESSION[$var]) ? $_SESSION[$var] : $default;
|
|
}
|
|
|
|
static function getCookie($var, $default = false)
|
|
{
|
|
return isset($_COOKIE[$var]) ? $_COOKIE[$var] : $default;
|
|
}
|
|
|
|
static function setCookie($var, $value, $time = 0, $path = '/')
|
|
{
|
|
return setcookie($var, $value, $time, $path);
|
|
}
|
|
|
|
static function getParam($var, $default = false)
|
|
{
|
|
return isset(self::$params[$var]) ? self::$params[$var] : $default;
|
|
}
|
|
|
|
static function setParam($var, $val)
|
|
{
|
|
self::$params[$var] = $val;
|
|
}
|
|
|
|
static function setParams($params=array())
|
|
{
|
|
self::$params = self::$params + $params;
|
|
}
|
|
}
|
|
?>
|