1 | <?php |
||
12 | class Bootup |
||
13 | { |
||
14 | /** |
||
15 | * filter request inputs |
||
16 | * |
||
17 | * Ensures inputs are well formed UTF-8 |
||
18 | * When not, assumes Windows-1252 and converts to UTF-8 |
||
19 | * Tests only values, not keys |
||
20 | * |
||
21 | * @param int $normalization_form |
||
22 | * @param string $leading_combining |
||
23 | */ |
||
24 | 1 | public static function filterRequestInputs($normalization_form = 4 /* n::NFC */, $leading_combining = '◌') |
|
62 | |||
63 | /** |
||
64 | * Filter current REQUEST_URI . |
||
65 | * |
||
66 | * @param string|null $uri <p>If null is set, then the server REQUEST_URI will be used.</p> |
||
67 | * @param bool $exit |
||
68 | * |
||
69 | * @return mixed |
||
70 | */ |
||
71 | 1 | public static function filterRequestUri($uri = null, $exit = true) |
|
128 | |||
129 | /** |
||
130 | * Normalizes to UTF-8 NFC, converting from WINDOWS-1252 when needed. |
||
131 | * |
||
132 | * @param string $s |
||
133 | * @param int $normalization_form |
||
134 | * @param string $leading_combining |
||
135 | * |
||
136 | * @return string |
||
137 | */ |
||
138 | 1 | public static function filterString($s, $normalization_form = 4 /* n::NFC */, $leading_combining = '◌') |
|
142 | |||
143 | /** |
||
144 | * Get random bytes via "random_bytes()" (+ polyfill). |
||
145 | * |
||
146 | * @ref https://github.com/paragonie/random_compat/ |
||
147 | * |
||
148 | * @param int $length Output length |
||
149 | * |
||
150 | * @return string|false false on error |
||
151 | */ |
||
152 | 1 | public static function get_random_bytes($length) |
|
166 | |||
167 | /** |
||
168 | * bootstrap |
||
169 | */ |
||
170 | 1 | public static function initAll() |
|
176 | |||
177 | /** |
||
178 | * Determines if the current version of PHP is equal to or greater than the supplied value. |
||
179 | * |
||
180 | * @param string $version |
||
181 | * |
||
182 | * @return bool <p>Return <strong>true</strong> if the current version is $version or higher</p> |
||
183 | */ |
||
184 | 36 | public static function is_php($version) |
|
196 | } |
||
197 |
Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable: