@@ -19,6 +19,6 @@ |
||
19 | 19 | 'Dang ', 'Ei ', 'Hun ', 'Wen ', 'E ', 'Cheng ', 'Ti ', 'Wu ', 'Wu ', 'Cheng ', 'Jun ', 'Mei ', 'Bei ', 'Ting ', 'Xian ', 'Chuo ', |
20 | 20 | ); |
21 | 21 | |
22 | -$result =& $data; |
|
22 | +$result = & $data; |
|
23 | 23 | unset($data); |
24 | 24 | return $result; |
@@ -19,6 +19,6 @@ |
||
19 | 19 | 'Nian ', 'Shen ', 'Piao ', 'Chun ', 'Wa ', 'Yuan ', 'Lai ', 'Hun ', 'Qing ', 'Yan ', 'Qian ', 'Tian ', 'Miao ', 'Zhi ', 'Yin ', 'Mi ', |
20 | 20 | ); |
21 | 21 | |
22 | -$result =& $data; |
|
22 | +$result = & $data; |
|
23 | 23 | unset($data); |
24 | 24 | return $result; |
@@ -19,6 +19,6 @@ |
||
19 | 19 | 'mu', 'me', 'mo', 'ya', 'yu', 'yo', 'ra', 'ri', 'ru', 're', 'ro', 'wa', 'wi', 'we', 'wo', |
20 | 20 | ); |
21 | 21 | |
22 | -$result =& $data; |
|
22 | +$result = & $data; |
|
23 | 23 | unset($data); |
24 | 24 | return $result; |
@@ -19,6 +19,6 @@ |
||
19 | 19 | 'Lao ', 'Bo ', 'Zhe ', 'Zha ', 'Liang ', 'Ba ', 'Mie ', 'Le ', 'Sui ', 'Fou ', 'Bu ', 'Han ', 'Heng ', 'Geng ', 'Shuo ', 'Ge ', |
20 | 20 | ); |
21 | 21 | |
22 | -$result =& $data; |
|
22 | +$result = & $data; |
|
23 | 23 | unset($data); |
24 | 24 | return $result; |
@@ -19,6 +19,6 @@ |
||
19 | 19 | 'maels', 'maelt', 'maelp', 'maelh', 'maem', 'maeb', 'maebs', 'maes', 'maess', 'maeng', 'maej', 'maec', 'maek', 'maet', 'maep', 'maeh', |
20 | 20 | ); |
21 | 21 | |
22 | -$result =& $data; |
|
22 | +$result = & $data; |
|
23 | 23 | unset($data); |
24 | 24 | return $result; |
@@ -19,6 +19,6 @@ |
||
19 | 19 | 'ggek', 'gget', 'ggep', 'ggeh', 'ggyeo', 'ggyeog', 'ggyeogg', 'ggyeogs', 'ggyeon', 'ggyeonj', 'ggyeonh', 'ggyeod', 'ggyeol', 'ggyeolg', 'ggyeolm', 'ggyeolb', |
20 | 20 | ); |
21 | 21 | |
22 | -$result =& $data; |
|
22 | +$result = & $data; |
|
23 | 23 | unset($data); |
24 | 24 | return $result; |
@@ -19,6 +19,6 @@ |
||
19 | 19 | 'jjass', 'jjang', 'jjaj', 'jjac', 'jjak', 'jjat', 'jjap', 'jjah', 'jjae', 'jjaeg', 'jjaegg', 'jjaegs', 'jjaen', 'jjaenj', 'jjaenh', 'jjaed', |
20 | 20 | ); |
21 | 21 | |
22 | -$result =& $data; |
|
22 | +$result = & $data; |
|
23 | 23 | unset($data); |
24 | 24 | return $result; |
@@ -19,6 +19,6 @@ |
||
19 | 19 | 'siss', 'sing', 'sij', 'sic', 'sik', 'sit', 'sip', 'sih', 'ssa', 'ssag', 'ssagg', 'ssags', 'ssan', 'ssanj', 'ssanh', 'ssad', |
20 | 20 | ); |
21 | 21 | |
22 | -$result =& $data; |
|
22 | +$result = & $data; |
|
23 | 23 | unset($data); |
24 | 24 | return $result; |
@@ -11,18 +11,18 @@ discard block |
||
11 | 11 | */ |
12 | 12 | class Bootup |
13 | 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 | - public static function filterRequestInputs($normalization_form = 4 /* n::NFC */, $leading_combining = 'â—Ś') |
|
25 | - { |
|
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 | + public static function filterRequestInputs($normalization_form = 4 /* n::NFC */, $leading_combining = 'â—Ś') |
|
25 | + { |
|
26 | 26 | $a = array( |
27 | 27 | &$_FILES, |
28 | 28 | &$_ENV, |
@@ -36,47 +36,47 @@ discard block |
||
36 | 36 | /** @noinspection ReferenceMismatchInspection */ |
37 | 37 | /** @noinspection ForeachSourceInspection */ |
38 | 38 | foreach ($a[0] as &$r) { |
39 | - $a[] = array( |
|
40 | - &$r['name'], |
|
41 | - &$r['type'], |
|
42 | - ); |
|
39 | + $a[] = array( |
|
40 | + &$r['name'], |
|
41 | + &$r['type'], |
|
42 | + ); |
|
43 | 43 | } |
44 | 44 | unset($r, $a[0]); |
45 | 45 | |
46 | 46 | $len = count($a) + 1; |
47 | 47 | for ($i = 1; $i < $len; ++$i) { |
48 | - /** @noinspection ReferenceMismatchInspection */ |
|
49 | - /** @noinspection ForeachSourceInspection */ |
|
50 | - foreach ($a[$i] as &$r) { |
|
48 | + /** @noinspection ReferenceMismatchInspection */ |
|
49 | + /** @noinspection ForeachSourceInspection */ |
|
50 | + foreach ($a[$i] as &$r) { |
|
51 | 51 | /** @noinspection ReferenceMismatchInspection */ |
52 | 52 | $s = $r; // $r is a reference, $s a copy |
53 | 53 | if (is_array($s)) { |
54 | - $a[$len++] = &$r; |
|
54 | + $a[$len++] = &$r; |
|
55 | 55 | } else { |
56 | - $r = self::filterString($s, $normalization_form, $leading_combining); |
|
56 | + $r = self::filterString($s, $normalization_form, $leading_combining); |
|
57 | + } |
|
57 | 58 | } |
58 | - } |
|
59 | - unset($r, $a[$i]); |
|
59 | + unset($r, $a[$i]); |
|
60 | 60 | } |
61 | - } |
|
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 | - public static function filterRequestUri($uri = null, $exit = true) |
|
72 | - { |
|
61 | + } |
|
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 | + public static function filterRequestUri($uri = null, $exit = true) |
|
72 | + { |
|
73 | 73 | if (!isset($uri)) { |
74 | 74 | |
75 | - if (!isset($_SERVER['REQUEST_URI'])) { |
|
75 | + if (!isset($_SERVER['REQUEST_URI'])) { |
|
76 | 76 | return false; |
77 | - } |
|
77 | + } |
|
78 | 78 | |
79 | - $uri = $_SERVER['REQUEST_URI']; |
|
79 | + $uri = $_SERVER['REQUEST_URI']; |
|
80 | 80 | } |
81 | 81 | |
82 | 82 | $uriOrig = $uri; |
@@ -86,7 +86,7 @@ discard block |
||
86 | 86 | // |
87 | 87 | |
88 | 88 | if (preg_match('//u', urldecode($uri))) { |
89 | - return $uri; |
|
89 | + return $uri; |
|
90 | 90 | } |
91 | 91 | |
92 | 92 | // |
@@ -96,7 +96,7 @@ discard block |
||
96 | 96 | $uri = preg_replace_callback( |
97 | 97 | '/[\x80-\xFF]+/', |
98 | 98 | function ($m) { |
99 | - return urlencode($m[0]); |
|
99 | + return urlencode($m[0]); |
|
100 | 100 | }, |
101 | 101 | $uri |
102 | 102 | ); |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | $uri = preg_replace_callback( |
105 | 105 | '/(?:%[89A-F][0-9A-F])+/i', |
106 | 106 | function ($m) { |
107 | - return urlencode(UTF8::encode('UTF-8', urldecode($m[0]))); |
|
107 | + return urlencode(UTF8::encode('UTF-8', urldecode($m[0]))); |
|
108 | 108 | }, |
109 | 109 | $uri |
110 | 110 | ); |
@@ -116,81 +116,81 @@ discard block |
||
116 | 116 | && |
117 | 117 | headers_sent() === false |
118 | 118 | ) { |
119 | - // Use ob_start() to buffer content and avoid problem of headers already sent... |
|
120 | - $severProtocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'); |
|
121 | - header($severProtocol . ' 301 Moved Permanently'); |
|
122 | - header('Location: ' . $uri); |
|
123 | - exit(); |
|
119 | + // Use ob_start() to buffer content and avoid problem of headers already sent... |
|
120 | + $severProtocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'); |
|
121 | + header($severProtocol . ' 301 Moved Permanently'); |
|
122 | + header('Location: ' . $uri); |
|
123 | + exit(); |
|
124 | 124 | } |
125 | 125 | |
126 | 126 | return $uri; |
127 | - } |
|
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 | - public static function filterString($s, $normalization_form = 4 /* n::NFC */, $leading_combining = 'â—Ś') |
|
139 | - { |
|
127 | + } |
|
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 | + public static function filterString($s, $normalization_form = 4 /* n::NFC */, $leading_combining = 'â—Ś') |
|
139 | + { |
|
140 | 140 | return UTF8::filter($s, $normalization_form, $leading_combining); |
141 | - } |
|
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 | - public static function get_random_bytes($length) |
|
153 | - { |
|
141 | + } |
|
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 | + public static function get_random_bytes($length) |
|
153 | + { |
|
154 | 154 | if (!$length) { |
155 | - return false; |
|
155 | + return false; |
|
156 | 156 | } |
157 | 157 | |
158 | 158 | $length = (int)$length; |
159 | 159 | |
160 | 160 | if ($length <= 0) { |
161 | - return false; |
|
161 | + return false; |
|
162 | 162 | } |
163 | 163 | |
164 | 164 | return random_bytes($length); |
165 | - } |
|
165 | + } |
|
166 | 166 | |
167 | - /** |
|
168 | - * bootstrap |
|
169 | - */ |
|
170 | - public static function initAll() |
|
171 | - { |
|
167 | + /** |
|
168 | + * bootstrap |
|
169 | + */ |
|
170 | + public static function initAll() |
|
171 | + { |
|
172 | 172 | ini_set('default_charset', 'UTF-8'); |
173 | 173 | |
174 | 174 | // everything is init via composer, so we are done here ... |
175 | - } |
|
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 | - public static function is_php($version) |
|
185 | - { |
|
175 | + } |
|
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 | + public static function is_php($version) |
|
185 | + { |
|
186 | 186 | static $_IS_PHP; |
187 | 187 | |
188 | 188 | $version = (string)$version; |
189 | 189 | |
190 | 190 | if (!isset($_IS_PHP[$version])) { |
191 | - $_IS_PHP[$version] = version_compare(PHP_VERSION, $version, '>='); |
|
191 | + $_IS_PHP[$version] = version_compare(PHP_VERSION, $version, '>='); |
|
192 | 192 | } |
193 | 193 | |
194 | 194 | return $_IS_PHP[$version]; |
195 | - } |
|
195 | + } |
|
196 | 196 | } |
197 | 197 | \ No newline at end of file |
@@ -95,7 +95,7 @@ discard block |
||
95 | 95 | |
96 | 96 | $uri = preg_replace_callback( |
97 | 97 | '/[\x80-\xFF]+/', |
98 | - function ($m) { |
|
98 | + function($m) { |
|
99 | 99 | return urlencode($m[0]); |
100 | 100 | }, |
101 | 101 | $uri |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | |
104 | 104 | $uri = preg_replace_callback( |
105 | 105 | '/(?:%[89A-F][0-9A-F])+/i', |
106 | - function ($m) { |
|
106 | + function($m) { |
|
107 | 107 | return urlencode(UTF8::encode('UTF-8', urldecode($m[0]))); |
108 | 108 | }, |
109 | 109 | $uri |
@@ -118,8 +118,8 @@ discard block |
||
118 | 118 | ) { |
119 | 119 | // Use ob_start() to buffer content and avoid problem of headers already sent... |
120 | 120 | $severProtocol = (isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.1'); |
121 | - header($severProtocol . ' 301 Moved Permanently'); |
|
122 | - header('Location: ' . $uri); |
|
121 | + header($severProtocol.' 301 Moved Permanently'); |
|
122 | + header('Location: '.$uri); |
|
123 | 123 | exit(); |
124 | 124 | } |
125 | 125 | |
@@ -155,7 +155,7 @@ discard block |
||
155 | 155 | return false; |
156 | 156 | } |
157 | 157 | |
158 | - $length = (int)$length; |
|
158 | + $length = (int) $length; |
|
159 | 159 | |
160 | 160 | if ($length <= 0) { |
161 | 161 | return false; |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | { |
186 | 186 | static $_IS_PHP; |
187 | 187 | |
188 | - $version = (string)$version; |
|
188 | + $version = (string) $version; |
|
189 | 189 | |
190 | 190 | if (!isset($_IS_PHP[$version])) { |
191 | 191 | $_IS_PHP[$version] = version_compare(PHP_VERSION, $version, '>='); |