@@ -119,7 +119,7 @@ |
||
119 | 119 | * |
120 | 120 | * @return $this |
121 | 121 | */ |
122 | - public function switch(string $dbname) |
|
122 | + public function switch (string $dbname) |
|
123 | 123 | { |
124 | 124 | $this->query('USE ' . $dbname)->exec(); |
125 | 125 |
@@ -64,7 +64,9 @@ |
||
64 | 64 | //return call_user_func($callback, true); |
65 | 65 | } |
66 | 66 | if (!isset($_POST['g-recaptcha-response'])) { |
67 | - if (ob_get_level()) ob_end_clean(); |
|
67 | + if (ob_get_level()) { |
|
68 | + ob_end_clean(); |
|
69 | + } |
|
68 | 70 | \JSON\json::json(['error' => true, 'message' => 'Recaptcha token required']); |
69 | 71 | exit; |
70 | 72 | } |
@@ -96,7 +96,7 @@ |
||
96 | 96 | * |
97 | 97 | * @return string domain or default |
98 | 98 | */ |
99 | - $savedname = function () { |
|
99 | + $savedname = function() { |
|
100 | 100 | global $url; |
101 | 101 | $savedname = \MVC\helper::url2host($url); |
102 | 102 | if (!$savedname) { |
@@ -270,7 +270,7 @@ discard block |
||
270 | 270 | $header_size = curl_getinfo($ch, CURLINFO_HEADER_SIZE); |
271 | 271 | $headerSent = curl_getinfo($ch, CURLINFO_HEADER_OUT); |
272 | 272 | $headerSent = explode("\n", $headerSent); |
273 | - $headerSent = array_map(function ($v) { |
|
273 | + $headerSent = array_map(function($v) { |
|
274 | 274 | return preg_replace("/\r$/m", '', $v); |
275 | 275 | }, $headerSent); |
276 | 276 | $result['request']['raw'] = $headerSent; |
@@ -281,7 +281,7 @@ discard block |
||
281 | 281 | } |
282 | 282 | |
283 | 283 | $header = explode("\n", $header); |
284 | - $header = array_map(function ($v) { |
|
284 | + $header = array_map(function($v) { |
|
285 | 285 | return preg_replace("/\r$/m", '', $v); |
286 | 286 | }, $header); |
287 | 287 |
@@ -79,13 +79,13 @@ |
||
79 | 79 | |
80 | 80 | // Extract the data |
81 | 81 | $cookie['domain'] = $tokens[0]; // The domain that created AND can read the variable. |
82 | - $cookie['flag'] = $tokens[1]; // A TRUE/FALSE value indicating if all machines within a given domain can access the variable. |
|
83 | - $cookie['path'] = $tokens[2]; // The path within the domain that the variable is valid for. |
|
82 | + $cookie['flag'] = $tokens[1]; // A TRUE/FALSE value indicating if all machines within a given domain can access the variable. |
|
83 | + $cookie['path'] = $tokens[2]; // The path within the domain that the variable is valid for. |
|
84 | 84 | $cookie['secure'] = $tokens[3]; // A TRUE/FALSE value indicating if a secure connection with the domain is needed to access the variable. |
85 | 85 | |
86 | - $cookie['expiration-epoch'] = $tokens[4]; // The UNIX time that the variable will expire on. |
|
87 | - $cookie['name'] = urldecode($tokens[5]); // The name of the variable. |
|
88 | - $cookie['value'] = urldecode($tokens[6]); // The value of the variable. |
|
86 | + $cookie['expiration-epoch'] = $tokens[4]; // The UNIX time that the variable will expire on. |
|
87 | + $cookie['name'] = urldecode($tokens[5]); // The name of the variable. |
|
88 | + $cookie['value'] = urldecode($tokens[6]); // The value of the variable. |
|
89 | 89 | |
90 | 90 | // Convert date to a readable format |
91 | 91 | $cookie['expiration'] = date('Y-m-d h:i:s', $tokens[4]); |
@@ -338,7 +338,7 @@ |
||
338 | 338 | public function render($variables = [], $print = true) |
339 | 339 | { |
340 | 340 | //exit('xxx'); |
341 | - \MVC\helper::trycatch(function () use ($variables, $print) { |
|
341 | + \MVC\helper::trycatch(function() use ($variables, $print) { |
|
342 | 342 | $this->load_render($variables, $print); |
343 | 343 | }); |
344 | 344 |
@@ -76,7 +76,7 @@ |
||
76 | 76 | 'jpm' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], |
77 | 77 | 'mj2' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], |
78 | 78 | 'mjp2' => ['image/jp2', 'video/mj2', 'image/jpx', 'image/jpm'], |
79 | - 'png' => ['image/png', 'image/x-png'], |
|
79 | + 'png' => ['image/png', 'image/x-png'], |
|
80 | 80 | 'tiff' => 'image/tiff', |
81 | 81 | 'tif' => 'image/tiff', |
82 | 82 | 'css' => ['text/css', 'text/plain'], |
@@ -191,7 +191,7 @@ discard block |
||
191 | 191 | */ |
192 | 192 | public static function sass(string $path) |
193 | 193 | { |
194 | - \Cookie\helper::one('sass' . self::$key, 'compiler', 1, function () use ($path) { |
|
194 | + \Cookie\helper::one('sass' . self::$key, 'compiler', 1, function() use ($path) { |
|
195 | 195 | if (is_file($path)) { |
196 | 196 | if (self::is_windows()) { |
197 | 197 | $path = self::fixSlash($path); |
@@ -242,7 +242,7 @@ discard block |
||
242 | 242 | |
243 | 243 | public static function babel(string $path) |
244 | 244 | { |
245 | - \Cookie\helper::one('babel' . self::$key, 'compiler', 1, function () use ($path) { |
|
245 | + \Cookie\helper::one('babel' . self::$key, 'compiler', 1, function() use ($path) { |
|
246 | 246 | if (is_file($path)) { |
247 | 247 | if (self::is_windows()) { |
248 | 248 | $path = self::fixSlash($path); |
@@ -650,7 +650,7 @@ discard block |
||
650 | 650 | header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']); |
651 | 651 | header('Access-Control-Expose-Headers: date,content-type,transfer-encoding,connection,access-control-allow-origin,server,x-xss-protection,x-content-type-options,x-request-id,content-encoding,x-final-url'); |
652 | 652 | header('Access-Control-Allow-Credentials: true'); |
653 | - header('Access-Control-Max-Age: 86400'); // cache for 1 day |
|
653 | + header('Access-Control-Max-Age: 86400'); // cache for 1 day |
|
654 | 654 | if (isset($_SERVER['HTTP_REFERER'])) { |
655 | 655 | $parseRef = parse_url($_SERVER['HTTP_REFERER']); |
656 | 656 | $parseOri = parse_url($_SERVER['HTTP_ORIGIN']); |
@@ -928,7 +928,7 @@ discard block |
||
928 | 928 | */ |
929 | 929 | public static function get_url_path($path, bool $cache = null) |
930 | 930 | { |
931 | - $load = function (string $path) use ($cache) { |
|
931 | + $load = function(string $path) use ($cache) { |
|
932 | 932 | if ($realpath = realpath($path)) { |
933 | 933 | $f = str_replace(realpath($_SERVER['DOCUMENT_ROOT']), '', $realpath); |
934 | 934 | |
@@ -980,9 +980,9 @@ discard block |
||
980 | 980 | return $buffer; |
981 | 981 | } |
982 | 982 | $search = [ |
983 | - '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
984 | - '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
985 | - '/(\s)+/s', // shorten multiple whitespace sequences |
|
983 | + '/\>[^\S ]+/s', // strip whitespaces after tags, except space |
|
984 | + '/[^\S ]+\</s', // strip whitespaces before tags, except space |
|
985 | + '/(\s)+/s', // shorten multiple whitespace sequences |
|
986 | 986 | '/<!--(.|\s)*?-->/', // Remove HTML comments |
987 | 987 | ]; |
988 | 988 |
@@ -386,7 +386,7 @@ |
||
386 | 386 | throw new Exception('Callback must be function', 1); |
387 | 387 | } |
388 | 388 | |
389 | - return array_map(function ($key, $val) use ($callback) { |
|
389 | + return array_map(function($key, $val) use ($callback) { |
|
390 | 390 | return call_user_func($callback, $key, $val); |
391 | 391 | }, array_keys($arr), $arr); |
392 | 392 | } |