-
Notifications
You must be signed in to change notification settings - Fork 0
/
globals.php
58 lines (51 loc) · 1.11 KB
/
globals.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
<?
class globals
{
static function __callStatic($method, $arguments)
{
$server_var = "_" . strtoupper($method);
$default = NULL;
if(isset($arguments[1]))
{
$default = $arguments[1];
}
$overwrite_empty_string = FALSE;
if(isset($arguments[2]) && $arguments[2] == TRUE)
{
$overwrite_empty_string = TRUE;
}
if($server_var == "_POSTGET")
{
$data = array_merge($_GET, $_POST);
}
elseif($server_var == "_GETPOST")
{
$data = array_merge($_POST, $_GET);
}
else
{
$data = $GLOBALS[$server_var];
}
if(!isset($arguments[0]))
{
return $data;
}
$var = $arguments[0];
if($overwrite_empty_string)
{
if(empty($data[$var]))
{
return $default;
}
}
else
{
if(!isset($data[$var]))
{
return $default;
}
}
return $data[$var];
}
}
?>