2 /***************************************************************************
3 * Copyright (C) 2003-2008 Polytechnique.org *
4 * http://opensource.polytechnique.org/ *
6 * This program is free software; you can redistribute it and/or modify *
7 * it under the terms of the GNU General Public License as published by *
8 * the Free Software Foundation; either version 2 of the License, or *
9 * (at your option) any later version. *
11 * This program is distributed in the hope that it will be useful, *
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
14 * GNU General Public License for more details. *
16 * You should have received a copy of the GNU General Public License *
17 * along with this program; if not, write to the Free Software *
19 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA *
20 ***************************************************************************/
24 public static function _get($key, $default)
26 return isset($_REQUEST[$key]) ?
$_REQUEST[$key] : $default;
29 public static function has($key)
31 return isset($_REQUEST[$key]);
34 public static function kill($key)
36 unset($_REQUEST[$key]);
39 public static function v($key, $default = null
)
41 return Env
::_get($key, $default);
44 public static function s($key, $default = '')
46 return (string)Env
::_get($key, $default);
49 public static function t($key, $default = '')
51 return trim(Env
::s($key, $default));
54 public static function blank($key, $strict = false
)
56 if (!Env
::has($key)) {
59 $var = $strict ? Env
::s($key) : Env
::t($key);
63 public static function b($key, $default = false
)
65 return (bool
)Env
::_get($key, $default);
68 public static function i($key, $default = 0)
70 $i = Env
::_get($key, $default);
71 return is_numeric($i) ?
intval($i) : $default;
74 public static function l(array $keys)
76 return array_map(array('Env', 'v'), $keys);
82 public static function _get($key, $default)
84 return isset($_POST[$key]) ?
$_POST[$key] : $default;
87 public static function has($key)
89 return isset($_POST[$key]);
92 public static function kill($key)
97 public static function v($key, $default = null
)
99 return Post
::_get($key, $default);
102 public static function b($key, $default = false
)
104 return (bool
)Post
::_get($key, $default);
107 public static function s($key, $default = '')
109 return (string)Post
::_get($key, $default);
112 public static function t($key, $default = '')
114 return trim(Post
::s($key, $default));
117 public static function blank($key, $strict = false
)
119 if (!Post
::has($key)) {
122 $var = $strict ? Post
::s($key) : Post
::t($key);
126 public static function i($key, $default = 0)
128 $i = Post
::_get($key, $default);
129 return is_numeric($i) ?
intval($i) : $default;
132 public static function l(array $keys)
134 return array_map(array('Post', 'v'), $keys);
140 public static function _get($key, $default)
142 return isset($_GET[$key]) ?
$_GET[$key] : $default;
145 public static function has($key)
147 return isset($_GET[$key]);
150 public static function kill($key)
155 public static function v($key, $default = null
)
157 return Get
::_get($key, $default);
160 public static function b($key, $default = false
)
162 return (bool
)Get
::_get($key, $default);
165 public static function s($key, $default = '')
167 return (string)Get
::_get($key, $default);
170 public static function t($key, $default = '')
172 return trim(Get
::s($key, $default));
175 public static function blank($key, $strict = false
)
177 if (!Get
::has($key)) {
180 $var = $strict ? Get
::s($key) : Get
::t($key);
184 public static function i($key, $default = 0)
186 $i = Get
::_get($key, $default);
187 return is_numeric($i) ?
intval($i) : $default;
190 public static function l(array $keys)
192 return array_map(array('Get', 'v'), $keys);
198 public static function _get($key, $default)
200 return isset($_COOKIE[$key]) ?
$_COOKIE[$key] : $default;
203 public static function has($key)
205 return isset($_COOKIE[$key]);
208 public static function kill($key)
210 unset($_COOKIE[$key]);
213 public static function v($key, $default = null
)
215 return Cookie
::_get($key, $default);
218 public static function s($key, $default = '')
220 return (string)Cookie
::_get($key, $default);
223 public static function t($key, $default = '')
225 return trim(Cookie
::s($key, $default));
228 public static function blank($key, $strict = false
)
230 if (!Cookie
::has($key)) {
233 $var = $strict ? Cookie
::s($key) : Cookie
::t($key);
237 public static function b($key, $default = false
)
239 return (bool
)Cookie
::_get($key, $default);
242 public static function i($key, $default = 0)
244 $i = Cookie
::_get($key, $default);
245 return is_numeric($i) ?
intval($i) : $default;
248 public static function l(array $keys)
250 return array_map(array('Cookie', 'v'), $keys);
254 function fix_gpc_magic(&$item, $key) {
255 if (is_array($item)) {
256 array_walk($item, 'fix_gpc_magic');
258 $item = stripslashes($item);
262 if (ini_get('magic_quotes_gpc') && empty($DONT_FIX_GPC)) {
263 array_walk($_GET, 'fix_gpc_magic');
264 array_walk($_POST, 'fix_gpc_magic');
265 array_walk($_COOKIE, 'fix_gpc_magic');
266 array_walk($_REQUEST, 'fix_gpc_magic');
269 // vim:set et sw=4 sts=4 sws=4 foldmethod=marker enc=utf-8: