blob: 1bc540a22c07ffb989baeef92d64d65ef8a2ff3c (
plain)
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
|
<?php
/**
* Http helper for test scripts.
*/
class CinisisHttpHelper {
/**
* Get an argument.
*
* @param $name
* Argument name.
*
* @param $default
* Default value.
*
* @return
* Argument value.
*/
static function getArg($name, $default = 1) {
// Get the query parameter.
if (isset($_GET[$name]) && ! empty($_GET[$name])) {
$arg = $_GET[$name];
}
else {
$arg = $default;
}
return $arg;
}
/**
* Get a numeric argument.
*
* @param $name
* Argument name.
*
* @return
* Argument value.
*/
static function getNumericArg($name) {
return (int) self::getArg($name, 1);
}
/**
* Get a string argument.
*
* @param $name
* Argument name.
*
* @return
* Argument value.
*/
static function getTextualArg($name) {
return htmlspecialchars((string) self::getArg($name, 'a'));
}
}
|