@@ -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 |
@@ -297,14 +297,16 @@ |
||
297 | 297 | $str = ''; |
298 | 298 | foreach ($trace as $caller) { |
299 | 299 | $str .= " -- Called by {$caller['function']}"; |
300 | - if (isset($caller['class'])) |
|
301 | - $str .= " From Class {$caller['class']}"; |
|
300 | + if (isset($caller['class'])) { |
|
301 | + $str .= " From Class {$caller['class']}"; |
|
302 | + } |
|
302 | 303 | } |
303 | 304 | } else { |
304 | 305 | $caller = $trace[2]; |
305 | 306 | $str = "Called by {$caller['function']}"; |
306 | - if (isset($caller['class'])) |
|
307 | - $str .= " From Class {$caller['class']}"; |
|
307 | + if (isset($caller['class'])) { |
|
308 | + $str .= " From Class {$caller['class']}"; |
|
309 | + } |
|
308 | 310 | } |
309 | 311 | return $str; |
310 | 312 | } |
@@ -17,7 +17,7 @@ discard block |
||
17 | 17 | */ |
18 | 18 | function sort_iterable(array $arrayObj) |
19 | 19 | { |
20 | - $arrayObj = array_map(function ($object) { |
|
20 | + $arrayObj = array_map(function($object) { |
|
21 | 21 | if (\ArrayHelper\helper::is_iterable($object)) { |
22 | 22 | $object = sort_iterable($object); |
23 | 23 | } |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | /** |
40 | 40 | * @var string|null $get |
41 | 41 | */ |
42 | - $get = function (string $location) { |
|
42 | + $get = function(string $location) { |
|
43 | 43 | if (file_exists($location)) { |
44 | 44 | return \MVC\helper::get_url_path($location, true); |
45 | 45 | } |
@@ -37,83 +37,83 @@ |
||
37 | 37 | */ |
38 | 38 | class JSLikeHTMLElement extends DOMElement |
39 | 39 | { |
40 | - /** |
|
41 | - * Used for setting innerHTML like it's done in JavaScript:. |
|
42 | - * |
|
43 | - * @code |
|
44 | - * $div->innerHTML = '<h2>Chapter 2</h2><p>The story begins...</p>'; |
|
45 | - * @endcode |
|
46 | - */ |
|
47 | - public function __set($name, $value) |
|
48 | - { |
|
49 | - if ('innerHTML' == $name) { |
|
50 | - // first, empty the element |
|
51 | - for ($x = $this->childNodes->length - 1; $x >= 0; --$x) { |
|
52 | - $this->removeChild($this->childNodes->item($x)); |
|
53 | - } |
|
54 | - // $value holds our new inner HTML |
|
55 | - if ('' != $value) { |
|
56 | - $f = $this->ownerDocument->createDocumentFragment(); |
|
57 | - // appendXML() expects well-formed markup (XHTML) |
|
58 | - $result = @$f->appendXML($value); // @ to suppress PHP warnings |
|
59 | - if ($result) { |
|
60 | - if ($f->hasChildNodes()) { |
|
61 | - $this->appendChild($f); |
|
62 | - } |
|
63 | - } else { |
|
64 | - // $value is probably ill-formed |
|
65 | - $f = new DOMDocument(); |
|
66 | - $value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8'); |
|
67 | - // Using <htmlfragment> will generate a warning, but so will bad HTML |
|
68 | - // (and by this point, bad HTML is what we've got). |
|
69 | - // We use it (and suppress the warning) because an HTML fragment will |
|
70 | - // be wrapped around <html><body> tags which we don't really want to keep. |
|
71 | - // Note: despite the warning, if loadHTML succeeds it will return true. |
|
72 | - $result = @$f->loadHTML('<htmlfragment>' . $value . '</htmlfragment>'); |
|
73 | - if ($result) { |
|
74 | - $import = $f->getElementsByTagName('htmlfragment')->item(0); |
|
75 | - foreach ($import->childNodes as $child) { |
|
76 | - $importedNode = $this->ownerDocument->importNode($child, true); |
|
77 | - $this->appendChild($importedNode); |
|
78 | - } |
|
79 | - } else { |
|
80 | - // oh well, we tried, we really did. :( |
|
81 | - // this element is now empty |
|
82 | - } |
|
83 | - } |
|
84 | - } |
|
85 | - } else { |
|
86 | - $trace = debug_backtrace(); |
|
87 | - trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE); |
|
88 | - } |
|
89 | - } |
|
40 | + /** |
|
41 | + * Used for setting innerHTML like it's done in JavaScript:. |
|
42 | + * |
|
43 | + * @code |
|
44 | + * $div->innerHTML = '<h2>Chapter 2</h2><p>The story begins...</p>'; |
|
45 | + * @endcode |
|
46 | + */ |
|
47 | + public function __set($name, $value) |
|
48 | + { |
|
49 | + if ('innerHTML' == $name) { |
|
50 | + // first, empty the element |
|
51 | + for ($x = $this->childNodes->length - 1; $x >= 0; --$x) { |
|
52 | + $this->removeChild($this->childNodes->item($x)); |
|
53 | + } |
|
54 | + // $value holds our new inner HTML |
|
55 | + if ('' != $value) { |
|
56 | + $f = $this->ownerDocument->createDocumentFragment(); |
|
57 | + // appendXML() expects well-formed markup (XHTML) |
|
58 | + $result = @$f->appendXML($value); // @ to suppress PHP warnings |
|
59 | + if ($result) { |
|
60 | + if ($f->hasChildNodes()) { |
|
61 | + $this->appendChild($f); |
|
62 | + } |
|
63 | + } else { |
|
64 | + // $value is probably ill-formed |
|
65 | + $f = new DOMDocument(); |
|
66 | + $value = mb_convert_encoding($value, 'HTML-ENTITIES', 'UTF-8'); |
|
67 | + // Using <htmlfragment> will generate a warning, but so will bad HTML |
|
68 | + // (and by this point, bad HTML is what we've got). |
|
69 | + // We use it (and suppress the warning) because an HTML fragment will |
|
70 | + // be wrapped around <html><body> tags which we don't really want to keep. |
|
71 | + // Note: despite the warning, if loadHTML succeeds it will return true. |
|
72 | + $result = @$f->loadHTML('<htmlfragment>' . $value . '</htmlfragment>'); |
|
73 | + if ($result) { |
|
74 | + $import = $f->getElementsByTagName('htmlfragment')->item(0); |
|
75 | + foreach ($import->childNodes as $child) { |
|
76 | + $importedNode = $this->ownerDocument->importNode($child, true); |
|
77 | + $this->appendChild($importedNode); |
|
78 | + } |
|
79 | + } else { |
|
80 | + // oh well, we tried, we really did. :( |
|
81 | + // this element is now empty |
|
82 | + } |
|
83 | + } |
|
84 | + } |
|
85 | + } else { |
|
86 | + $trace = debug_backtrace(); |
|
87 | + trigger_error('Undefined property via __set(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE); |
|
88 | + } |
|
89 | + } |
|
90 | 90 | |
91 | - /** |
|
92 | - * Used for getting innerHTML like it's done in JavaScript:. |
|
93 | - * |
|
94 | - * @code |
|
95 | - * $string = $div->innerHTML; |
|
96 | - * @endcode |
|
97 | - */ |
|
98 | - public function __get($name) |
|
99 | - { |
|
100 | - if ('innerHTML' == $name) { |
|
101 | - $inner = ''; |
|
102 | - foreach ($this->childNodes as $child) { |
|
103 | - $inner .= $this->ownerDocument->saveXML($child); |
|
104 | - } |
|
91 | + /** |
|
92 | + * Used for getting innerHTML like it's done in JavaScript:. |
|
93 | + * |
|
94 | + * @code |
|
95 | + * $string = $div->innerHTML; |
|
96 | + * @endcode |
|
97 | + */ |
|
98 | + public function __get($name) |
|
99 | + { |
|
100 | + if ('innerHTML' == $name) { |
|
101 | + $inner = ''; |
|
102 | + foreach ($this->childNodes as $child) { |
|
103 | + $inner .= $this->ownerDocument->saveXML($child); |
|
104 | + } |
|
105 | 105 | |
106 | - return $inner; |
|
107 | - } |
|
106 | + return $inner; |
|
107 | + } |
|
108 | 108 | |
109 | - $trace = debug_backtrace(); |
|
110 | - trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE); |
|
109 | + $trace = debug_backtrace(); |
|
110 | + trigger_error('Undefined property via __get(): ' . $name . ' in ' . $trace[0]['file'] . ' on line ' . $trace[0]['line'], E_USER_NOTICE); |
|
111 | 111 | |
112 | - return null; |
|
113 | - } |
|
112 | + return null; |
|
113 | + } |
|
114 | 114 | |
115 | - public function __toString() |
|
116 | - { |
|
117 | - return '[' . $this->tagName . ']'; |
|
118 | - } |
|
115 | + public function __toString() |
|
116 | + { |
|
117 | + return '[' . $this->tagName . ']'; |
|
118 | + } |
|
119 | 119 | } |
@@ -63,7 +63,7 @@ |
||
63 | 63 | foreach ($read as $files) { |
64 | 64 | $flist[] = \MVC\helper::get_url_path($files['path']); |
65 | 65 | } |
66 | - $flist = array_map(function ($path) use ($app) { |
|
66 | + $flist = array_map(function($path) use ($app) { |
|
67 | 67 | //strip extensions |
68 | 68 | $withoutExt = preg_replace('/\\.[^.\\s]{3,4}$/', '', $path); |
69 | 69 | /** |
@@ -6,7 +6,7 @@ |
||
6 | 6 | |
7 | 7 | if (isset($_POST['config'])) { |
8 | 8 | unset($_POST['config']); |
9 | - array_walk_recursive($_POST, function (&$key, $value) { |
|
9 | + array_walk_recursive($_POST, function(&$key, $value) { |
|
10 | 10 | if (preg_match('/^(true|false)$/s', $key, $match)) { |
11 | 11 | if ($match[0] == 'true') { |
12 | 12 | $key = true; |