@@ -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 | /** |
@@ -3,13 +3,13 @@ |
||
3 | 3 | if (isset($_REQUEST['user']) && isset($_REQUEST['pass'])) { |
4 | 4 | $username = $_REQUEST['user']; |
5 | 5 | $password = $_REQUEST['pass']; |
6 | - Google\recaptcha::verifyCaptcha(function () use ($username, $password) { |
|
6 | + Google\recaptcha::verifyCaptcha(function() use ($username, $password) { |
|
7 | 7 | dologin($username, $password); |
8 | 8 | }); |
9 | 9 | } |
10 | 10 | |
11 | 11 | if (isset($_REQUEST['check'])) { |
12 | - user()->check_login(function ($session) { |
|
12 | + user()->check_login(function($session) { |
|
13 | 13 | e($session); |
14 | 14 | }); |
15 | 15 | } |
@@ -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; |
@@ -1,4 +1,4 @@ |
||
1 | 1 | <?php |
2 | -if (!user()->is_admin()){ |
|
2 | +if (!user()->is_admin()) { |
|
3 | 3 | safe_redirect('/'); |
4 | 4 | } |
5 | 5 | \ No newline at end of file |
@@ -22,7 +22,7 @@ discard block |
||
22 | 22 | if (isset($package['devDependencies'])) { |
23 | 23 | $packages = array_merge($package['devDependencies'], $packages); |
24 | 24 | } |
25 | -$packages = array_map(function ($pkg) { |
|
25 | +$packages = array_map(function($pkg) { |
|
26 | 26 | //var_dump($pkg); |
27 | 27 | if (false === strpos($pkg, '@types/')) { |
28 | 28 | return $pkg; |
@@ -31,19 +31,19 @@ discard block |
||
31 | 31 | } |
32 | 32 | }, array_keys($packages)); |
33 | 33 | $packages = array_values(array_filter($packages)); |
34 | -$packages = array_map(function ($pkg) { |
|
34 | +$packages = array_map(function($pkg) { |
|
35 | 35 | return "@types/$pkg"; |
36 | 36 | }, $packages); |
37 | 37 | |
38 | 38 | if (isset($package['devDependencies'])) { |
39 | - array_map(function ($types) { |
|
39 | + array_map(function($types) { |
|
40 | 40 | $package['devDependencies'][$types] = '*'; |
41 | 41 | }, $packages); |
42 | 42 | } |
43 | 43 | |
44 | 44 | \Filemanager\file::file($location, $package, true); |
45 | 45 | |
46 | -$cmd = function ($pkg) { |
|
46 | +$cmd = function($pkg) { |
|
47 | 47 | return 'cd ' . ROOT . ' && echo "Installing ' . $pkg . ' On %cd%" && '; |
48 | 48 | }; |
49 | 49 |
@@ -35,7 +35,7 @@ |
||
35 | 35 | $data = $p->fetchAll(); |
36 | 36 | $result['recordsTotal'] = count($data); |
37 | 37 | $result['recordsFiltered'] = (int) count($data); |
38 | -$data_filter = array_map(function ($map_data) { |
|
38 | +$data_filter = array_map(function($map_data) { |
|
39 | 39 | $i = 0; |
40 | 40 | foreach ($map_data as $key => $value) { |
41 | 41 | if (is_numeric($value)) { |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | * |
140 | 140 | * @return $this |
141 | 141 | */ |
142 | - public function switch(string $dbname) |
|
142 | + public function switch (string $dbname) |
|
143 | 143 | { |
144 | 144 | $this->query('USE ' . $dbname)->exec(); |
145 | 145 | |
@@ -724,7 +724,7 @@ discard block |
||
724 | 724 | $this->query = ''; |
725 | 725 | if ($filter) { |
726 | 726 | if (!empty($exec) && is_array($exec)) { |
727 | - $filtered = array_map(function ($data) use ($filter) { |
|
727 | + $filtered = array_map(function($data) use ($filter) { |
|
728 | 728 | if (isset($data[$filter])) { |
729 | 729 | return $data[$filter]; |
730 | 730 | } |
@@ -263,8 +263,8 @@ discard block |
||
263 | 263 | protected function checkHost($hostName) |
264 | 264 | { |
265 | 265 | return true; // Override and return false if the host is not one that you would expect. |
266 | - // Ex: You only want to accept hosts from the my-domain.com domain, |
|
267 | - // but you receive a host from malicious-site.com instead. |
|
266 | + // Ex: You only want to accept hosts from the my-domain.com domain, |
|
267 | + // but you receive a host from malicious-site.com instead. |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | protected function checkOrigin($origin) |
@@ -285,9 +285,9 @@ discard block |
||
285 | 285 | protected function processProtocol($protocol) |
286 | 286 | { |
287 | 287 | return ''; // return either "Sec-WebSocket-Protocol: SelectedProtocolFromClientList\r\n" or return an empty string. |
288 | - // The carriage return/newline combo must appear at the end of a non-empty string, and must not |
|
289 | - // appear at the beginning of the string nor in an otherwise empty string, or it will be considered part of |
|
290 | - // the response body, which will trigger an error in the client as it will not be formatted correctly. |
|
288 | + // The carriage return/newline combo must appear at the end of a non-empty string, and must not |
|
289 | + // appear at the beginning of the string nor in an otherwise empty string, or it will be considered part of |
|
290 | + // the response body, which will trigger an error in the client as it will not be formatted correctly. |
|
291 | 291 | } |
292 | 292 | |
293 | 293 | protected function processExtensions($extensions) |