@@ -37,10 +37,10 @@ discard block |
||
37 | 37 | |
38 | 38 | // Set required paths |
39 | 39 | $this->dirs = ['base' => $this->settings['base_path'] ?? base_path()]; |
40 | - $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'] .'/'. config('thinktomorrow.chief.domain.path', 'src'); |
|
41 | - $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'] . '/resources/views'; |
|
42 | - $this->dirs['controller'] = $this->settings['controller_path'] ?? $this->dirs['base'] . '/app/Http/Controllers'; |
|
43 | - $this->files['routes'] = $this->settings['routes_file'] ?? $this->dirs['base'] . '/routes/web.php'; |
|
40 | + $this->dirs['model'] = $this->settings['model_path'] ?? $this->dirs['base'].'/'.config('thinktomorrow.chief.domain.path', 'src'); |
|
41 | + $this->dirs['views'] = $this->settings['views_path'] ?? $this->dirs['base'].'/resources/views'; |
|
42 | + $this->dirs['controller'] = $this->settings['controller_path'] ?? $this->dirs['base'].'/app/Http/Controllers'; |
|
43 | + $this->files['routes'] = $this->settings['routes_file'] ?? $this->dirs['base'].'/routes/web.php'; |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | public function handle() |
@@ -62,8 +62,8 @@ discard block |
||
62 | 62 | private function publishModel() |
63 | 63 | { |
64 | 64 | $this->publishFile( |
65 | - __DIR__ . '/stubs/model.php.stub', |
|
66 | - $to = $this->dirs['model'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php', |
|
65 | + __DIR__.'/stubs/model.php.stub', |
|
66 | + $to = $this->dirs['model'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php', |
|
67 | 67 | 'model' |
68 | 68 | ); |
69 | 69 | |
@@ -73,8 +73,8 @@ discard block |
||
73 | 73 | private function publishController() |
74 | 74 | { |
75 | 75 | $this->publishFile( |
76 | - __DIR__ . '/stubs/controller.php.stub', |
|
77 | - $to = $this->dirs['controller'] . '/' . ucfirst($this->plural) . '/' . ucfirst($this->singular) . '.php', |
|
76 | + __DIR__.'/stubs/controller.php.stub', |
|
77 | + $to = $this->dirs['controller'].'/'.ucfirst($this->plural).'/'.ucfirst($this->singular).'.php', |
|
78 | 78 | 'controller' |
79 | 79 | ); |
80 | 80 | } |
@@ -113,8 +113,8 @@ discard block |
||
113 | 113 | private function modelTraits() |
114 | 114 | { |
115 | 115 | return [ |
116 | - '\\' . Publishable::class, |
|
117 | - '\\' . Sortable::class, |
|
116 | + '\\'.Publishable::class, |
|
117 | + '\\'.Sortable::class, |
|
118 | 118 | 'q' => 'Proceed.', |
119 | 119 | ]; |
120 | 120 | } |
@@ -129,7 +129,7 @@ discard block |
||
129 | 129 | protected function publishFile($from, $to, $type) |
130 | 130 | { |
131 | 131 | if ($this->filesystem->exists($to) && !$this->option('force')) { |
132 | - if (!$this->confirm('File [' . $to . '] already exists? Overwrite this file?')) { |
|
132 | + if (!$this->confirm('File ['.$to.'] already exists? Overwrite this file?')) { |
|
133 | 133 | return; |
134 | 134 | } |
135 | 135 | } |
@@ -168,7 +168,7 @@ discard block |
||
168 | 168 | |
169 | 169 | $to = str_replace($this->dirs['base'], '', realpath($to)); |
170 | 170 | |
171 | - $this->line('<info>Copied ' . $type . '</info> <comment>[' . $from . ']</comment> <info>To</info> <comment>[' . $to . ']</comment>'); |
|
171 | + $this->line('<info>Copied '.$type.'</info> <comment>['.$from.']</comment> <info>To</info> <comment>['.$to.']</comment>'); |
|
172 | 172 | } |
173 | 173 | |
174 | 174 | protected function replacePlaceholders($content) |
@@ -187,16 +187,16 @@ discard block |
||
187 | 187 | private function generateImportStatements(): string |
188 | 188 | { |
189 | 189 | return collect(['\\'.Page::class]) |
190 | - ->map(function ($statement) { |
|
191 | - return 'use ' . $statement . ";\n "; |
|
190 | + ->map(function($statement) { |
|
191 | + return 'use '.$statement.";\n "; |
|
192 | 192 | })->implode(''); |
193 | 193 | } |
194 | 194 | |
195 | 195 | private function generateTraitStatements(): string |
196 | 196 | { |
197 | 197 | return collect($this->chosenTraits) |
198 | - ->map(function ($statement) { |
|
199 | - return 'use ' . $statement . ";\n "; |
|
198 | + ->map(function($statement) { |
|
199 | + return 'use '.$statement.";\n "; |
|
200 | 200 | })->implode(''); |
201 | 201 | } |
202 | 202 | |
@@ -215,7 +215,7 @@ discard block |
||
215 | 215 | |
216 | 216 | // We make an estimated guess based on the project name. At Think Tomorrow, we |
217 | 217 | // have a src folder which is PSR-4 namespaced by the project name itself. |
218 | - return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')).'\\'. ucfirst($this->plural)); |
|
218 | + return str_replace('\\\\', '\\', ucfirst(config('thinktomorrow.chief.domain.namespace', 'App')).'\\'.ucfirst($this->plural)); |
|
219 | 219 | } |
220 | 220 | |
221 | 221 | private function addToConfig($configKey, $value) |
@@ -34,7 +34,7 @@ discard block |
||
34 | 34 | { |
35 | 35 | // Constraints |
36 | 36 | if (!isset($values['action'])) { |
37 | - throw new \InvalidArgumentException('Set reference array is missing required values for the "action" keys. Given: ' . print_r($values, true)); |
|
37 | + throw new \InvalidArgumentException('Set reference array is missing required values for the "action" keys. Given: '.print_r($values, true)); |
|
38 | 38 | } |
39 | 39 | |
40 | 40 | return new static( |
@@ -49,14 +49,14 @@ discard block |
||
49 | 49 | { |
50 | 50 | $sets = config('thinktomorrow.chief.sets', []); |
51 | 51 | |
52 | - return collect($sets)->map(function ($set, $key) { |
|
52 | + return collect($sets)->map(function($set, $key) { |
|
53 | 53 | return SetReference::fromArray($key, $set); |
54 | 54 | }); |
55 | 55 | } |
56 | 56 | |
57 | 57 | public static function find($key): ?SetReference |
58 | 58 | { |
59 | - return static::all()->filter(function ($ref) use ($key) { |
|
59 | + return static::all()->filter(function($ref) use ($key) { |
|
60 | 60 | return $ref->key() == $key; |
61 | 61 | })->first(); |
62 | 62 | } |
@@ -73,9 +73,9 @@ discard block |
||
73 | 73 | |
74 | 74 | $this->validateAction($class, $method); |
75 | 75 | |
76 | - $result = call_user_func_array([app($class),$method], $this->parameters); |
|
76 | + $result = call_user_func_array([app($class), $method], $this->parameters); |
|
77 | 77 | |
78 | - if (! $result instanceof Set && $result instanceof Collection) { |
|
78 | + if (!$result instanceof Set && $result instanceof Collection) { |
|
79 | 79 | return new Set($result->all(), $this->key); |
80 | 80 | } |
81 | 81 | |
@@ -107,7 +107,7 @@ discard block |
||
107 | 107 | |
108 | 108 | private static function validateAction($class, $method) |
109 | 109 | { |
110 | - if (! class_exists($class)) { |
|
110 | + if (!class_exists($class)) { |
|
111 | 111 | throw new \InvalidArgumentException('The class ['.$class.'] isn\'t a valid class reference or does not exist in the chief-settings.sets config entry.'); |
112 | 112 | } |
113 | 113 |
@@ -35,12 +35,12 @@ |
||
35 | 35 | |
36 | 36 | public function toReference(): SetReference |
37 | 37 | { |
38 | - $reference = SetReference::all()->first(function ($setReference) { |
|
38 | + $reference = SetReference::all()->first(function($setReference) { |
|
39 | 39 | return $setReference->key() == $this->key; |
40 | 40 | }); |
41 | 41 | |
42 | 42 | if (!$reference) { |
43 | - throw new \Exception('No query set found by key ['. $this->key. ']. Make sure that this '.$this->key.' set is added to the chief.sets config array.'); |
|
43 | + throw new \Exception('No query set found by key ['.$this->key.']. Make sure that this '.$this->key.' set is added to the chief.sets config array.'); |
|
44 | 44 | } |
45 | 45 | |
46 | 46 | return $reference; |
@@ -8,9 +8,9 @@ discard block |
||
8 | 8 | |
9 | 9 | See htmLawed_README.txt/htm |
10 | 10 | */ |
11 | -if(!function_exists('htmLawed')){ |
|
11 | +if (!function_exists('htmLawed')) { |
|
12 | 12 | |
13 | - function htmLawed($t, $C=1, $S=array()) |
|
13 | + function htmLawed($t, $C = 1, $S = array()) |
|
14 | 14 | { |
15 | 15 | $C = is_array($C) ? $C : array(); |
16 | 16 | if (!empty($C['valid_xhtml'])) { |
@@ -28,26 +28,26 @@ discard block |
||
28 | 28 | $e = array(); |
29 | 29 | } elseif (strpos($x, '*') === false) { |
30 | 30 | $e = array_flip(explode(',', $x)); |
31 | - } else { |
|
31 | + }else { |
|
32 | 32 | if (isset($x[1])) { |
33 | 33 | preg_match_all('`(?:^|-|\+)[^\-+]+?(?=-|\+|$)`', $x, $m, PREG_SET_ORDER); |
34 | - for ($i=count($m); --$i>=0;) { |
|
34 | + for ($i = count($m); --$i >= 0;) { |
|
35 | 35 | $m[$i] = $m[$i][0]; |
36 | 36 | } |
37 | 37 | foreach ($m as $v) { |
38 | 38 | if ($v[0] == '+') { |
39 | 39 | $e[substr($v, 1)] = 1; |
40 | 40 | } |
41 | - if ($v[0] == '-' && isset($e[($v = substr($v, 1))]) && !in_array('+'. $v, $m)) { |
|
41 | + if ($v[0] == '-' && isset($e[($v = substr($v, 1))]) && !in_array('+'.$v, $m)) { |
|
42 | 42 | unset($e[$v]); |
43 | 43 | } |
44 | 44 | } |
45 | 45 | } |
46 | 46 | } |
47 | - $C['elements'] =& $e; |
|
47 | + $C['elements'] = & $e; |
|
48 | 48 | // config attrs |
49 | 49 | $x = !empty($C['deny_attribute']) ? str_replace(array("\n", "\r", "\t", ' '), '', $C['deny_attribute']) : ''; |
50 | - $x = array_flip((isset($x[0]) && $x[0] == '*') ? explode('-', $x) : explode(',', $x. (!empty($C['safe']) ? ',on*' : ''))); |
|
50 | + $x = array_flip((isset($x[0]) && $x[0] == '*') ? explode('-', $x) : explode(',', $x.(!empty($C['safe']) ? ',on*' : ''))); |
|
51 | 51 | if (isset($x['on*'])) { |
52 | 52 | unset($x['on*']); |
53 | 53 | $x += array('onblur'=>1, 'onchange'=>1, 'onclick'=>1, 'ondblclick'=>1, 'onfocus'=>1, 'onkeydown'=>1, 'onkeypress'=>1, 'onkeyup'=>1, 'onmousedown'=>1, 'onmousemove'=>1, 'onmouseout'=>1, 'onmouseover'=>1, 'onmouseup'=>1, 'onreset'=>1, 'onselect'=>1, 'onsubmit'=>1); |
@@ -111,7 +111,7 @@ discard block |
||
111 | 111 | $t = preg_replace('`[\x00-\x08\x0b-\x0c\x0e-\x1f]`', '', $t); |
112 | 112 | if ($C['clean_ms_char']) { |
113 | 113 | $x = array("\x7f"=>'', "\x80"=>'€', "\x81"=>'', "\x83"=>'ƒ', "\x85"=>'…', "\x86"=>'†', "\x87"=>'‡', "\x88"=>'ˆ', "\x89"=>'‰', "\x8a"=>'Š', "\x8b"=>'‹', "\x8c"=>'Œ', "\x8d"=>'', "\x8e"=>'Ž', "\x8f"=>'', "\x90"=>'', "\x95"=>'•', "\x96"=>'–', "\x97"=>'—', "\x98"=>'˜', "\x99"=>'™', "\x9a"=>'š', "\x9b"=>'›', "\x9c"=>'œ', "\x9d"=>'', "\x9e"=>'ž', "\x9f"=>'Ÿ'); |
114 | - $x = $x + ($C['clean_ms_char'] == 1 ? array("\x82"=>'‚', "\x84"=>'„', "\x91"=>'‘', "\x92"=>'’', "\x93"=>'“', "\x94"=>'”') : array("\x82"=>'\'', "\x84"=>'"', "\x91"=>'\'', "\x92"=>'\'', "\x93"=>'"', "\x94"=>'"')); |
|
114 | + $x = $x+($C['clean_ms_char'] == 1 ? array("\x82"=>'‚', "\x84"=>'„', "\x91"=>'‘', "\x92"=>'’', "\x93"=>'“', "\x94"=>'”') : array("\x82"=>'\'', "\x84"=>'"', "\x91"=>'\'', "\x92"=>'\'', "\x93"=>'"', "\x94"=>'"')); |
|
115 | 115 | $t = strtr($t, $x); |
116 | 116 | } |
117 | 117 | if ($C['cdata'] or $C['comment']) { |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | // eof |
198 | 198 | } |
199 | 199 | |
200 | - function hl_bal($t, $do=1, $in='div') |
|
200 | + function hl_bal($t, $do = 1, $in = 'div') |
|
201 | 201 | { |
202 | 202 | // balance tags |
203 | 203 | // by content |
@@ -219,7 +219,7 @@ discard block |
||
219 | 219 | $eI = array('#pcdata'=>1, 'a'=>1, 'abbr'=>1, 'acronym'=>1, 'applet'=>1, 'b'=>1, 'bdo'=>1, 'big'=>1, 'br'=>1, 'button'=>1, 'cite'=>1, 'code'=>1, 'del'=>1, 'dfn'=>1, 'em'=>1, 'embed'=>1, 'font'=>1, 'i'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'ins'=>1, 'kbd'=>1, 'label'=>1, 'map'=>1, 'object'=>1, 'q'=>1, 'ruby'=>1, 's'=>1, 'samp'=>1, 'select'=>1, 'script'=>1, 'small'=>1, 'span'=>1, 'strike'=>1, 'strong'=>1, 'sub'=>1, 'sup'=>1, 'textarea'=>1, 'tt'=>1, 'u'=>1, 'var'=>1); |
220 | 220 | $eN = array('a'=>1, 'big'=>1, 'button'=>1, 'fieldset'=>1, 'font'=>1, 'form'=>1, 'iframe'=>1, 'img'=>1, 'input'=>1, 'label'=>1, 'object'=>1, 'ruby'=>1, 'script'=>1, 'select'=>1, 'small'=>1, 'sub'=>1, 'sup'=>1, 'textarea'=>1); // Exclude from specific ele; $cN values |
221 | 221 | $eO = array('area'=>1, 'caption'=>1, 'col'=>1, 'colgroup'=>1, 'dd'=>1, 'dt'=>1, 'legend'=>1, 'li'=>1, 'optgroup'=>1, 'option'=>1, 'param'=>1, 'rb'=>1, 'rbc'=>1, 'rp'=>1, 'rt'=>1, 'rtc'=>1, 'script'=>1, 'tbody'=>1, 'td'=>1, 'tfoot'=>1, 'thead'=>1, 'th'=>1, 'tr'=>1); // Missing in $eB & $eI |
222 | - $eF = $eB + $eI; |
|
222 | + $eF = $eB+$eI; |
|
223 | 223 | |
224 | 224 | // $in sets allowed child |
225 | 225 | $in = ((isset($eF[$in]) && $in != '#pcdata') or isset($eO[$in])) ? $in : 'div'; |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | unset($cI['del'], $cI['ins']); |
241 | 241 | } |
242 | 242 | if (isset($cO[$in])) { |
243 | - $inOk = $inOk + $cO[$in]; |
|
243 | + $inOk = $inOk+$cO[$in]; |
|
244 | 244 | } |
245 | 245 | if (isset($cN[$in])) { |
246 | 246 | $inOk = array_diff_assoc($inOk, $cN[$in]); |
@@ -250,7 +250,7 @@ discard block |
||
250 | 250 | $ok = $q = array(); // $q seq list of open non-empty ele |
251 | 251 | ob_start(); |
252 | 252 | |
253 | - for ($i=-1, $ci=count($t); ++$i<$ci;) { |
|
253 | + for ($i = -1, $ci = count($t); ++$i < $ci;) { |
|
254 | 254 | // allowed $ok in parent $p |
255 | 255 | if ($ql = count($q)) { |
256 | 256 | $p = array_pop($q); |
@@ -269,12 +269,12 @@ discard block |
||
269 | 269 | unset($cI['del'], $cI['ins']); |
270 | 270 | } |
271 | 271 | if (isset($cO[$p])) { |
272 | - $ok = $ok + $cO[$p]; |
|
272 | + $ok = $ok+$cO[$p]; |
|
273 | 273 | } |
274 | 274 | if (isset($cN[$p])) { |
275 | 275 | $ok = array_diff_assoc($ok, $cN[$p]); |
276 | 276 | } |
277 | - } else { |
|
277 | + }else { |
|
278 | 278 | $ok = $inOk; |
279 | 279 | unset($cI['del'], $cI['ins']); |
280 | 280 | } |
@@ -317,10 +317,10 @@ discard block |
||
317 | 317 | continue; |
318 | 318 | } // Last open |
319 | 319 | $add = ''; // Nesting - close open tags that need to be |
320 | - for ($j=-1, $cj=count($q); ++$j<$cj;) { |
|
320 | + for ($j = -1, $cj = count($q); ++$j < $cj;) { |
|
321 | 321 | if (($d = array_pop($q)) == $e) { |
322 | 322 | break; |
323 | - } else { |
|
323 | + }else { |
|
324 | 324 | $add .= "</{$d}>"; |
325 | 325 | } |
326 | 326 | } |
@@ -332,7 +332,7 @@ discard block |
||
332 | 332 | // $cB ele needs $eB ele as child |
333 | 333 | if (isset($cB[$e]) && strlen(trim($x))) { |
334 | 334 | $t[$i] = "{$e}{$a}>"; |
335 | - array_splice($t, $i+1, 0, 'div>'. $x); |
|
335 | + array_splice($t, $i+1, 0, 'div>'.$x); |
|
336 | 336 | unset($e, $x); |
337 | 337 | ++$ci; |
338 | 338 | --$i; |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | // nesting |
375 | 375 | $add = ''; |
376 | 376 | $q2 = array(); |
377 | - for ($k=-1, $kc=count($q); ++$k<$kc;) { |
|
377 | + for ($k = -1, $kc = count($q); ++$k < $kc;) { |
|
378 | 378 | $d = $q[$k]; |
379 | 379 | $ok2 = array(); |
380 | 380 | if (isset($cS[$d])) { |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | } |
384 | 384 | $ok2 = isset($cI[$d]) ? $eI : $eF; |
385 | 385 | if (isset($cO[$d])) { |
386 | - $ok2 = $ok2 + $cO[$d]; |
|
386 | + $ok2 = $ok2+$cO[$d]; |
|
387 | 387 | } |
388 | 388 | if (isset($cN[$d])) { |
389 | 389 | $ok2 = array_diff_assoc($ok2, $cN[$d]); |
@@ -393,11 +393,11 @@ discard block |
||
393 | 393 | continue 2; |
394 | 394 | } |
395 | 395 | $add = "</{$d}>"; |
396 | - for (;++$k<$kc;) { |
|
396 | + for (;++$k < $kc;) { |
|
397 | 397 | $add = "</{$q[$k]}>{$add}"; |
398 | 398 | } |
399 | 399 | break; |
400 | - } else { |
|
400 | + }else { |
|
401 | 401 | $q2[] = $d; |
402 | 402 | } |
403 | 403 | } |
@@ -428,12 +428,12 @@ discard block |
||
428 | 428 | unset($cI['del'], $cI['ins']); |
429 | 429 | } |
430 | 430 | if (isset($cO[$p])) { |
431 | - $ok = $ok + $cO[$p]; |
|
431 | + $ok = $ok+$cO[$p]; |
|
432 | 432 | } |
433 | 433 | if (isset($cN[$p])) { |
434 | 434 | $ok = array_diff_assoc($ok, $cN[$p]); |
435 | 435 | } |
436 | - } else { |
|
436 | + }else { |
|
437 | 437 | $ok = $inOk; |
438 | 438 | unset($cI['del'], $cI['ins']); |
439 | 439 | } |
@@ -477,7 +477,7 @@ discard block |
||
477 | 477 | if (substr(($t = preg_replace('`--+`', '-', substr($t, 4, -3))), -1) != ' ') { |
478 | 478 | $t .= ' '; |
479 | 479 | } |
480 | - } else { |
|
480 | + }else { |
|
481 | 481 | $t = substr($t, 1, -1); |
482 | 482 | } |
483 | 483 | $t = $v == 2 ? str_replace(array('&', '<', '>'), array('&', '<', '>'), $t) : $t; |
@@ -490,19 +490,19 @@ discard block |
||
490 | 490 | // entitity handler |
491 | 491 | global $C; |
492 | 492 | $t = $t[1]; |
493 | - static $U = array('quot'=>1,'amp'=>1,'lt'=>1,'gt'=>1); |
|
494 | - static $N = array('fnof'=>'402', 'Alpha'=>'913', 'Beta'=>'914', 'Gamma'=>'915', 'Delta'=>'916', 'Epsilon'=>'917', 'Zeta'=>'918', 'Eta'=>'919', 'Theta'=>'920', 'Iota'=>'921', 'Kappa'=>'922', 'Lambda'=>'923', 'Mu'=>'924', 'Nu'=>'925', 'Xi'=>'926', 'Omicron'=>'927', 'Pi'=>'928', 'Rho'=>'929', 'Sigma'=>'931', 'Tau'=>'932', 'Upsilon'=>'933', 'Phi'=>'934', 'Chi'=>'935', 'Psi'=>'936', 'Omega'=>'937', 'alpha'=>'945', 'beta'=>'946', 'gamma'=>'947', 'delta'=>'948', 'epsilon'=>'949', 'zeta'=>'950', 'eta'=>'951', 'theta'=>'952', 'iota'=>'953', 'kappa'=>'954', 'lambda'=>'955', 'mu'=>'956', 'nu'=>'957', 'xi'=>'958', 'omicron'=>'959', 'pi'=>'960', 'rho'=>'961', 'sigmaf'=>'962', 'sigma'=>'963', 'tau'=>'964', 'upsilon'=>'965', 'phi'=>'966', 'chi'=>'967', 'psi'=>'968', 'omega'=>'969', 'thetasym'=>'977', 'upsih'=>'978', 'piv'=>'982', 'bull'=>'8226', 'hellip'=>'8230', 'prime'=>'8242', 'Prime'=>'8243', 'oline'=>'8254', 'frasl'=>'8260', 'weierp'=>'8472', 'image'=>'8465', 'real'=>'8476', 'trade'=>'8482', 'alefsym'=>'8501', 'larr'=>'8592', 'uarr'=>'8593', 'rarr'=>'8594', 'darr'=>'8595', 'harr'=>'8596', 'crarr'=>'8629', 'lArr'=>'8656', 'uArr'=>'8657', 'rArr'=>'8658', 'dArr'=>'8659', 'hArr'=>'8660', 'forall'=>'8704', 'part'=>'8706', 'exist'=>'8707', 'empty'=>'8709', 'nabla'=>'8711', 'isin'=>'8712', 'notin'=>'8713', 'ni'=>'8715', 'prod'=>'8719', 'sum'=>'8721', 'minus'=>'8722', 'lowast'=>'8727', 'radic'=>'8730', 'prop'=>'8733', 'infin'=>'8734', 'ang'=>'8736', 'and'=>'8743', 'or'=>'8744', 'cap'=>'8745', 'cup'=>'8746', 'int'=>'8747', 'there4'=>'8756', 'sim'=>'8764', 'cong'=>'8773', 'asymp'=>'8776', 'ne'=>'8800', 'equiv'=>'8801', 'le'=>'8804', 'ge'=>'8805', 'sub'=>'8834', 'sup'=>'8835', 'nsub'=>'8836', 'sube'=>'8838', 'supe'=>'8839', 'oplus'=>'8853', 'otimes'=>'8855', 'perp'=>'8869', 'sdot'=>'8901', 'lceil'=>'8968', 'rceil'=>'8969', 'lfloor'=>'8970', 'rfloor'=>'8971', 'lang'=>'9001', 'rang'=>'9002', 'loz'=>'9674', 'spades'=>'9824', 'clubs'=>'9827', 'hearts'=>'9829', 'diams'=>'9830', 'apos'=>'39', 'OElig'=>'338', 'oelig'=>'339', 'Scaron'=>'352', 'scaron'=>'353', 'Yuml'=>'376', 'circ'=>'710', 'tilde'=>'732', 'ensp'=>'8194', 'emsp'=>'8195', 'thinsp'=>'8201', 'zwnj'=>'8204', 'zwj'=>'8205', 'lrm'=>'8206', 'rlm'=>'8207', 'ndash'=>'8211', 'mdash'=>'8212', 'lsquo'=>'8216', 'rsquo'=>'8217', 'sbquo'=>'8218', 'ldquo'=>'8220', 'rdquo'=>'8221', 'bdquo'=>'8222', 'dagger'=>'8224', 'Dagger'=>'8225', 'permil'=>'8240', 'lsaquo'=>'8249', 'rsaquo'=>'8250', 'euro'=>'8364', 'nbsp'=>'160', 'iexcl'=>'161', 'cent'=>'162', 'pound'=>'163', 'curren'=>'164', 'yen'=>'165', 'brvbar'=>'166', 'sect'=>'167', 'uml'=>'168', 'copy'=>'169', 'ordf'=>'170', 'laquo'=>'171', 'not'=>'172', 'shy'=>'173', 'reg'=>'174', 'macr'=>'175', 'deg'=>'176', 'plusmn'=>'177', 'sup2'=>'178', 'sup3'=>'179', 'acute'=>'180', 'micro'=>'181', 'para'=>'182', 'middot'=>'183', 'cedil'=>'184', 'sup1'=>'185', 'ordm'=>'186', 'raquo'=>'187', 'frac14'=>'188', 'frac12'=>'189', 'frac34'=>'190', 'iquest'=>'191', 'Agrave'=>'192', 'Aacute'=>'193', 'Acirc'=>'194', 'Atilde'=>'195', 'Auml'=>'196', 'Aring'=>'197', 'AElig'=>'198', 'Ccedil'=>'199', 'Egrave'=>'200', 'Eacute'=>'201', 'Ecirc'=>'202', 'Euml'=>'203', 'Igrave'=>'204', 'Iacute'=>'205', 'Icirc'=>'206', 'Iuml'=>'207', 'ETH'=>'208', 'Ntilde'=>'209', 'Ograve'=>'210', 'Oacute'=>'211', 'Ocirc'=>'212', 'Otilde'=>'213', 'Ouml'=>'214', 'times'=>'215', 'Oslash'=>'216', 'Ugrave'=>'217', 'Uacute'=>'218', 'Ucirc'=>'219', 'Uuml'=>'220', 'Yacute'=>'221', 'THORN'=>'222', 'szlig'=>'223', 'agrave'=>'224', 'aacute'=>'225', 'acirc'=>'226', 'atilde'=>'227', 'auml'=>'228', 'aring'=>'229', 'aelig'=>'230', 'ccedil'=>'231', 'egrave'=>'232', 'eacute'=>'233', 'ecirc'=>'234', 'euml'=>'235', 'igrave'=>'236', 'iacute'=>'237', 'icirc'=>'238', 'iuml'=>'239', 'eth'=>'240', 'ntilde'=>'241', 'ograve'=>'242', 'oacute'=>'243', 'ocirc'=>'244', 'otilde'=>'245', 'ouml'=>'246', 'divide'=>'247', 'oslash'=>'248', 'ugrave'=>'249', 'uacute'=>'250', 'ucirc'=>'251', 'uuml'=>'252', 'yacute'=>'253', 'thorn'=>'254', 'yuml'=>'255'); |
|
493 | + static $U = array('quot'=>1, 'amp'=>1, 'lt'=>1, 'gt'=>1); |
|
494 | + static $N = array('fnof'=>'402', 'Alpha'=>'913', 'Beta'=>'914', 'Gamma'=>'915', 'Delta'=>'916', 'Epsilon'=>'917', 'Zeta'=>'918', 'Eta'=>'919', 'Theta'=>'920', 'Iota'=>'921', 'Kappa'=>'922', 'Lambda'=>'923', 'Mu'=>'924', 'Nu'=>'925', 'Xi'=>'926', 'Omicron'=>'927', 'Pi'=>'928', 'Rho'=>'929', 'Sigma'=>'931', 'Tau'=>'932', 'Upsilon'=>'933', 'Phi'=>'934', 'Chi'=>'935', 'Psi'=>'936', 'Omega'=>'937', 'alpha'=>'945', 'beta'=>'946', 'gamma'=>'947', 'delta'=>'948', 'epsilon'=>'949', 'zeta'=>'950', 'eta'=>'951', 'theta'=>'952', 'iota'=>'953', 'kappa'=>'954', 'lambda'=>'955', 'mu'=>'956', 'nu'=>'957', 'xi'=>'958', 'omicron'=>'959', 'pi'=>'960', 'rho'=>'961', 'sigmaf'=>'962', 'sigma'=>'963', 'tau'=>'964', 'upsilon'=>'965', 'phi'=>'966', 'chi'=>'967', 'psi'=>'968', 'omega'=>'969', 'thetasym'=>'977', 'upsih'=>'978', 'piv'=>'982', 'bull'=>'8226', 'hellip'=>'8230', 'prime'=>'8242', 'Prime'=>'8243', 'oline'=>'8254', 'frasl'=>'8260', 'weierp'=>'8472', 'image'=>'8465', 'real'=>'8476', 'trade'=>'8482', 'alefsym'=>'8501', 'larr'=>'8592', 'uarr'=>'8593', 'rarr'=>'8594', 'darr'=>'8595', 'harr'=>'8596', 'crarr'=>'8629', 'lArr'=>'8656', 'uArr'=>'8657', 'rArr'=>'8658', 'dArr'=>'8659', 'hArr'=>'8660', 'forall'=>'8704', 'part'=>'8706', 'exist'=>'8707', 'empty'=>'8709', 'nabla'=>'8711', 'isin'=>'8712', 'notin'=>'8713', 'ni'=>'8715', 'prod'=>'8719', 'sum'=>'8721', 'minus'=>'8722', 'lowast'=>'8727', 'radic'=>'8730', 'prop'=>'8733', 'infin'=>'8734', 'ang'=>'8736', 'and'=>'8743', 'or'=>'8744', 'cap'=>'8745', 'cup'=>'8746', 'int'=>'8747', 'there4'=>'8756', 'sim'=>'8764', 'cong'=>'8773', 'asymp'=>'8776', 'ne'=>'8800', 'equiv'=>'8801', 'le'=>'8804', 'ge'=>'8805', 'sub'=>'8834', 'sup'=>'8835', 'nsub'=>'8836', 'sube'=>'8838', 'supe'=>'8839', 'oplus'=>'8853', 'otimes'=>'8855', 'perp'=>'8869', 'sdot'=>'8901', 'lceil'=>'8968', 'rceil'=>'8969', 'lfloor'=>'8970', 'rfloor'=>'8971', 'lang'=>'9001', 'rang'=>'9002', 'loz'=>'9674', 'spades'=>'9824', 'clubs'=>'9827', 'hearts'=>'9829', 'diams'=>'9830', 'apos'=>'39', 'OElig'=>'338', 'oelig'=>'339', 'Scaron'=>'352', 'scaron'=>'353', 'Yuml'=>'376', 'circ'=>'710', 'tilde'=>'732', 'ensp'=>'8194', 'emsp'=>'8195', 'thinsp'=>'8201', 'zwnj'=>'8204', 'zwj'=>'8205', 'lrm'=>'8206', 'rlm'=>'8207', 'ndash'=>'8211', 'mdash'=>'8212', 'lsquo'=>'8216', 'rsquo'=>'8217', 'sbquo'=>'8218', 'ldquo'=>'8220', 'rdquo'=>'8221', 'bdquo'=>'8222', 'dagger'=>'8224', 'Dagger'=>'8225', 'permil'=>'8240', 'lsaquo'=>'8249', 'rsaquo'=>'8250', 'euro'=>'8364', 'nbsp'=>'160', 'iexcl'=>'161', 'cent'=>'162', 'pound'=>'163', 'curren'=>'164', 'yen'=>'165', 'brvbar'=>'166', 'sect'=>'167', 'uml'=>'168', 'copy'=>'169', 'ordf'=>'170', 'laquo'=>'171', 'not'=>'172', 'shy'=>'173', 'reg'=>'174', 'macr'=>'175', 'deg'=>'176', 'plusmn'=>'177', 'sup2'=>'178', 'sup3'=>'179', 'acute'=>'180', 'micro'=>'181', 'para'=>'182', 'middot'=>'183', 'cedil'=>'184', 'sup1'=>'185', 'ordm'=>'186', 'raquo'=>'187', 'frac14'=>'188', 'frac12'=>'189', 'frac34'=>'190', 'iquest'=>'191', 'Agrave'=>'192', 'Aacute'=>'193', 'Acirc'=>'194', 'Atilde'=>'195', 'Auml'=>'196', 'Aring'=>'197', 'AElig'=>'198', 'Ccedil'=>'199', 'Egrave'=>'200', 'Eacute'=>'201', 'Ecirc'=>'202', 'Euml'=>'203', 'Igrave'=>'204', 'Iacute'=>'205', 'Icirc'=>'206', 'Iuml'=>'207', 'ETH'=>'208', 'Ntilde'=>'209', 'Ograve'=>'210', 'Oacute'=>'211', 'Ocirc'=>'212', 'Otilde'=>'213', 'Ouml'=>'214', 'times'=>'215', 'Oslash'=>'216', 'Ugrave'=>'217', 'Uacute'=>'218', 'Ucirc'=>'219', 'Uuml'=>'220', 'Yacute'=>'221', 'THORN'=>'222', 'szlig'=>'223', 'agrave'=>'224', 'aacute'=>'225', 'acirc'=>'226', 'atilde'=>'227', 'auml'=>'228', 'aring'=>'229', 'aelig'=>'230', 'ccedil'=>'231', 'egrave'=>'232', 'eacute'=>'233', 'ecirc'=>'234', 'euml'=>'235', 'igrave'=>'236', 'iacute'=>'237', 'icirc'=>'238', 'iuml'=>'239', 'eth'=>'240', 'ntilde'=>'241', 'ograve'=>'242', 'oacute'=>'243', 'ocirc'=>'244', 'otilde'=>'245', 'ouml'=>'246', 'divide'=>'247', 'oslash'=>'248', 'ugrave'=>'249', 'uacute'=>'250', 'ucirc'=>'251', 'uuml'=>'252', 'yacute'=>'253', 'thorn'=>'254', 'yuml'=>'255'); |
|
495 | 495 | if ($t[0] != '#') { |
496 | - return ($C['and_mark'] ? "\x06" : '&'). (isset($U[$t]) ? $t : (isset($N[$t]) ? (!$C['named_entity'] ? '#'. ($C['hexdec_entity'] > 1 ? 'x'. dechex($N[$t]) : $N[$t]) : $t) : 'amp;'. $t)). ';'; |
|
496 | + return ($C['and_mark'] ? "\x06" : '&').(isset($U[$t]) ? $t : (isset($N[$t]) ? (!$C['named_entity'] ? '#'.($C['hexdec_entity'] > 1 ? 'x'.dechex($N[$t]) : $N[$t]) : $t) : 'amp;'.$t)).';'; |
|
497 | 497 | } |
498 | 498 | if (($n = ctype_digit($t = substr($t, 1)) ? intval($t) : hexdec(substr($t, 1))) < 9 or ($n > 13 && $n < 32) or $n == 11 or $n == 12 or ($n > 126 && $n < 160 && $n != 133) or ($n > 55295 && ($n < 57344 or ($n > 64975 && $n < 64992) or $n == 65534 or $n == 65535 or $n > 1114111))) { |
499 | - return ($C['and_mark'] ? "\x06" : '&'). "amp;#{$t};"; |
|
499 | + return ($C['and_mark'] ? "\x06" : '&')."amp;#{$t};"; |
|
500 | 500 | } |
501 | - return ($C['and_mark'] ? "\x06" : '&'). '#'. (((ctype_digit($t) && $C['hexdec_entity'] < 2) or !$C['hexdec_entity']) ? $n : 'x'. dechex($n)). ';'; |
|
501 | + return ($C['and_mark'] ? "\x06" : '&').'#'.(((ctype_digit($t) && $C['hexdec_entity'] < 2) or !$C['hexdec_entity']) ? $n : 'x'.dechex($n)).';'; |
|
502 | 502 | // eof |
503 | 503 | } |
504 | 504 | |
505 | - function hl_prot($p, $c=null) |
|
505 | + function hl_prot($p, $c = null) |
|
506 | 506 | { |
507 | 507 | // check URL scheme |
508 | 508 | global $C; |
@@ -529,18 +529,18 @@ discard block |
||
529 | 529 | $p = substr($p, strlen($C['base_url'])); |
530 | 530 | } elseif (empty($m[1])) { // Make URL abs |
531 | 531 | if (substr($p, 0, 2) == '//') { |
532 | - $p = substr($C['base_url'], 0, strpos($C['base_url'], ':')+1). $p; |
|
532 | + $p = substr($C['base_url'], 0, strpos($C['base_url'], ':')+1).$p; |
|
533 | 533 | } elseif ($p[0] == '/') { |
534 | - $p = preg_replace('`(^.+?://[^/]+)(.*)`', '$1', $C['base_url']). $p; |
|
534 | + $p = preg_replace('`(^.+?://[^/]+)(.*)`', '$1', $C['base_url']).$p; |
|
535 | 535 | } elseif (strcspn($p, './')) { |
536 | - $p = $C['base_url']. $p; |
|
537 | - } else { |
|
536 | + $p = $C['base_url'].$p; |
|
537 | + }else { |
|
538 | 538 | preg_match('`^([a-zA-Z\d\-+.]+://[^/]+)(.*)`', $C['base_url'], $m); |
539 | - $p = preg_replace('`(?<=/)\./`', '', $m[2]. $p); |
|
539 | + $p = preg_replace('`(?<=/)\./`', '', $m[2].$p); |
|
540 | 540 | while (preg_match('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', $p)) { |
541 | 541 | $p = preg_replace('`(?<=/)([^/]{3,}|[^/.]+?|\.[^/.]|[^/.]\.)/\.\./`', '', $p); |
542 | 542 | } |
543 | - $p = $m[1]. $p; |
|
543 | + $p = $m[1].$p; |
|
544 | 544 | } |
545 | 545 | } |
546 | 546 | } |
@@ -556,7 +556,7 @@ discard block |
||
556 | 556 | } |
557 | 557 | if ($t = ini_get('track_errors')) { |
558 | 558 | $o = isset($php_errormsg) ? $php_errormsg : null; |
559 | - } else { |
|
559 | + }else { |
|
560 | 560 | ini_set('track_errors', 1); |
561 | 561 | } |
562 | 562 | unset($php_errormsg); |
@@ -570,7 +570,7 @@ discard block |
||
570 | 570 | $r = isset($php_errormsg) ? 0 : 1; |
571 | 571 | if ($t) { |
572 | 572 | $php_errormsg = isset($o) ? $o : null; |
573 | - } else { |
|
573 | + }else { |
|
574 | 574 | ini_set('track_errors', 0); |
575 | 575 | } |
576 | 576 | return $r; |
@@ -582,9 +582,9 @@ discard block |
||
582 | 582 | // final $spec |
583 | 583 | $s = array(); |
584 | 584 | $t = str_replace(array("\t", "\r", "\n", ' '), '', preg_replace_callback('/"(?>(`.|[^"])*)"/sm', create_function('$m', 'return substr(str_replace(array(";", "|", "~", " ", ",", "/", "(", ")", \'`"\'), array("\x01", "\x02", "\x03", "\x04", "\x05", "\x06", "\x07", "\x08", "\""), $m[0]), 1, -1);'), trim($t))); |
585 | - for ($i = count(($t = explode(';', $t))); --$i>=0;) { |
|
585 | + for ($i = count(($t = explode(';', $t))); --$i >= 0;) { |
|
586 | 586 | $w = $t[$i]; |
587 | - if (empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a = substr($w, $e+1)))) { |
|
587 | + if (empty($w) or ($e = strpos($w, '=')) === false or !strlen(($a = substr($w, $e+1)))) { |
|
588 | 588 | continue; |
589 | 589 | } |
590 | 590 | $y = $n = array(); |
@@ -652,7 +652,7 @@ discard block |
||
652 | 652 | if (!preg_match('`^<(/?)([a-zA-Z][a-zA-Z1-6]*)([^>]*?)\s?>$`m', $t, $m)) { |
653 | 653 | return str_replace(array('<', '>'), array('<', '>'), $t); |
654 | 654 | } elseif (!isset($C['elements'][($e = strtolower($m[2]))])) { |
655 | - return (($C['keep_bad']%2) ? str_replace(array('<', '>'), array('<', '>'), $t) : ''); |
|
655 | + return (($C['keep_bad'] % 2) ? str_replace(array('<', '>'), array('<', '>'), $t) : ''); |
|
656 | 656 | } |
657 | 657 | // attr string |
658 | 658 | $a = str_replace(array("\n", "\r", "\t"), ' ', trim($m[3])); |
@@ -661,13 +661,13 @@ discard block |
||
661 | 661 | if ($C['make_tag_strict'] && isset($eD[$e])) { |
662 | 662 | $trt = hl_tag2($e, $a, $C['make_tag_strict']); |
663 | 663 | if (!$e) { |
664 | - return (($C['keep_bad']%2) ? str_replace(array('<', '>'), array('<', '>'), $t) : ''); |
|
664 | + return (($C['keep_bad'] % 2) ? str_replace(array('<', '>'), array('<', '>'), $t) : ''); |
|
665 | 665 | } |
666 | 666 | } |
667 | 667 | // close tag |
668 | 668 | static $eE = array('area'=>1, 'br'=>1, 'col'=>1, 'embed'=>1, 'hr'=>1, 'img'=>1, 'input'=>1, 'isindex'=>1, 'param'=>1); // Empty ele |
669 | 669 | if (!empty($m[1])) { |
670 | - return (!isset($eE[$e]) ? (empty($C['hook_tag']) ? "</$e>" : $C['hook_tag']($e)) : (($C['keep_bad'])%2 ? str_replace(array('<', '>'), array('<', '>'), $t) : '')); |
|
670 | + return (!isset($eE[$e]) ? (empty($C['hook_tag']) ? "</$e>" : $C['hook_tag']($e)) : (($C['keep_bad']) % 2 ? str_replace(array('<', '>'), array('<', '>'), $t) : '')); |
|
671 | 671 | } |
672 | 672 | |
673 | 673 | // open tag & attr |
@@ -712,7 +712,7 @@ discard block |
||
712 | 712 | $w = 1; |
713 | 713 | $mode = 2; |
714 | 714 | $a = ltrim($a, '= '); |
715 | - } else { // No val |
|
715 | + }else { // No val |
|
716 | 716 | $w = 1; |
717 | 717 | $mode = 0; |
718 | 718 | $a = ltrim($a); |
@@ -777,7 +777,7 @@ discard block |
||
777 | 777 | if (!preg_match('`\bnofollow\b`i', $aA['rel'])) { |
778 | 778 | $nfr = 1; |
779 | 779 | } |
780 | - } else { |
|
780 | + }else { |
|
781 | 781 | $a['rel'] = 'nofollow'; |
782 | 782 | } |
783 | 783 | } |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | } |
792 | 792 | } |
793 | 793 | if ($nfr) { |
794 | - $a['rel'] = isset($a['rel']) ? $a['rel']. ' nofollow' : 'nofollow'; |
|
794 | + $a['rel'] = isset($a['rel']) ? $a['rel'].' nofollow' : 'nofollow'; |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | // rqd attr |
@@ -814,36 +814,36 @@ discard block |
||
814 | 814 | if ($k == 'align') { |
815 | 815 | unset($a['align']); |
816 | 816 | if ($e == 'img' && ($v == 'left' or $v == 'right')) { |
817 | - $c[] = 'float: '. $v; |
|
817 | + $c[] = 'float: '.$v; |
|
818 | 818 | } elseif (($e == 'div' or $e == 'table') && $v == 'center') { |
819 | 819 | $c[] = 'margin: auto'; |
820 | - } else { |
|
821 | - $c[] = 'text-align: '. $v; |
|
820 | + }else { |
|
821 | + $c[] = 'text-align: '.$v; |
|
822 | 822 | } |
823 | 823 | } elseif ($k == 'bgcolor') { |
824 | 824 | unset($a['bgcolor']); |
825 | - $c[] = 'background-color: '. $v; |
|
825 | + $c[] = 'background-color: '.$v; |
|
826 | 826 | } elseif ($k == 'border') { |
827 | 827 | unset($a['border']); |
828 | 828 | $c[] = "border: {$v}px"; |
829 | 829 | } elseif ($k == 'bordercolor') { |
830 | 830 | unset($a['bordercolor']); |
831 | - $c[] = 'border-color: '. $v; |
|
831 | + $c[] = 'border-color: '.$v; |
|
832 | 832 | } elseif ($k == 'clear') { |
833 | 833 | unset($a['clear']); |
834 | - $c[] = 'clear: '. ($v != 'all' ? $v : 'both'); |
|
834 | + $c[] = 'clear: '.($v != 'all' ? $v : 'both'); |
|
835 | 835 | } elseif ($k == 'compact') { |
836 | 836 | unset($a['compact']); |
837 | 837 | $c[] = 'font-size: 85%'; |
838 | 838 | } elseif ($k == 'height' or $k == 'width') { |
839 | 839 | unset($a[$k]); |
840 | - $c[] = $k. ': '. ($v[0] != '*' ? $v. (ctype_digit($v) ? 'px' : '') : 'auto'); |
|
840 | + $c[] = $k.': '.($v[0] != '*' ? $v.(ctype_digit($v) ? 'px' : '') : 'auto'); |
|
841 | 841 | } elseif ($k == 'hspace') { |
842 | 842 | unset($a['hspace']); |
843 | 843 | $c[] = "margin-left: {$v}px; margin-right: {$v}px"; |
844 | 844 | } elseif ($k == 'language' && !isset($a['type'])) { |
845 | 845 | unset($a['language']); |
846 | - $a['type'] = 'text/'. strtolower($v); |
|
846 | + $a['type'] = 'text/'.strtolower($v); |
|
847 | 847 | } elseif ($k == 'name') { |
848 | 848 | if ($C['no_deprecated_attr'] == 2 or ($e != 'a' && $e != 'map')) { |
849 | 849 | unset($a['name']); |
@@ -859,13 +859,13 @@ discard block |
||
859 | 859 | $c[] = 'white-space: nowrap'; |
860 | 860 | } elseif ($k == 'size') { |
861 | 861 | unset($a['size']); |
862 | - $c[] = 'size: '. $v. 'px'; |
|
862 | + $c[] = 'size: '.$v.'px'; |
|
863 | 863 | } elseif ($k == 'start' or $k == 'value') { |
864 | 864 | unset($a[$k]); |
865 | 865 | } elseif ($k == 'type') { |
866 | 866 | unset($a['type']); |
867 | 867 | static $ol_type = array('i'=>'lower-roman', 'I'=>'upper-roman', 'a'=>'lower-latin', 'A'=>'upper-latin', '1'=>'decimal'); |
868 | - $c[] = 'list-style-type: '. (isset($ol_type[$v]) ? $ol_type[$v] : 'decimal'); |
|
868 | + $c[] = 'list-style-type: '.(isset($ol_type[$v]) ? $ol_type[$v] : 'decimal'); |
|
869 | 869 | } elseif ($k == 'vspace') { |
870 | 870 | unset($a['vspace']); |
871 | 871 | $c[] = "margin-top: {$v}px; margin-bottom: {$v}px"; |
@@ -873,16 +873,16 @@ discard block |
||
873 | 873 | } |
874 | 874 | if (count($c)) { |
875 | 875 | $c = implode('; ', $c); |
876 | - $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;'). '; '. $c. ';': $c. ';'; |
|
876 | + $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;').'; '.$c.';' : $c.';'; |
|
877 | 877 | } |
878 | 878 | } |
879 | 879 | // unique ID |
880 | 880 | if ($C['unique_ids'] && isset($a['id'])) { |
881 | 881 | if (!preg_match('`^[A-Za-z][A-Za-z0-9_\-.:]*$`', ($id = $a['id'])) or (isset($GLOBALS['hl_Ids'][$id]) && $C['unique_ids'] == 1)) { |
882 | 882 | unset($a['id']); |
883 | - } else { |
|
883 | + }else { |
|
884 | 884 | while (isset($GLOBALS['hl_Ids'][$id])) { |
885 | - $id = $C['unique_ids']. $id; |
|
885 | + $id = $C['unique_ids'].$id; |
|
886 | 886 | } |
887 | 887 | $GLOBALS['hl_Ids'][($a['id'] = $id)] = 1; |
888 | 888 | } |
@@ -896,7 +896,7 @@ discard block |
||
896 | 896 | } |
897 | 897 | // for transformed tag |
898 | 898 | if (!empty($trt)) { |
899 | - $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;'). '; '. $trt : $trt; |
|
899 | + $a['style'] = isset($a['style']) ? rtrim($a['style'], ' ;').'; '.$trt : $trt; |
|
900 | 900 | } |
901 | 901 | // return with empty ele / |
902 | 902 | if (empty($C['hook_tag'])) { |
@@ -904,14 +904,14 @@ discard block |
||
904 | 904 | foreach ($a as $k=>$v) { |
905 | 905 | $aA .= " {$k}=\"{$v}\""; |
906 | 906 | } |
907 | - return "<{$e}{$aA}". (isset($eE[$e]) ? ' /' : ''). '>'; |
|
908 | - } else { |
|
907 | + return "<{$e}{$aA}".(isset($eE[$e]) ? ' /' : '').'>'; |
|
908 | + }else { |
|
909 | 909 | return $C['hook_tag']($e, $a); |
910 | 910 | } |
911 | 911 | // eof |
912 | 912 | } |
913 | 913 | |
914 | - function hl_tag2(&$e, &$a, $t=1) |
|
914 | + function hl_tag2(&$e, &$a, $t = 1) |
|
915 | 915 | { |
916 | 916 | // transform tag |
917 | 917 | if ($e == 'center') { |
@@ -934,13 +934,13 @@ discard block |
||
934 | 934 | if ($e == 'font') { |
935 | 935 | $a2 = ''; |
936 | 936 | if (preg_match('`face\s*=\s*(\'|")([^=]+?)\\1`i', $a, $m) or preg_match('`face\s*=(\s*)(\S+)`i', $a, $m)) { |
937 | - $a2 .= ' font-family: '. str_replace('"', '\'', trim($m[2])). ';'; |
|
937 | + $a2 .= ' font-family: '.str_replace('"', '\'', trim($m[2])).';'; |
|
938 | 938 | } |
939 | 939 | if (preg_match('`color\s*=\s*(\'|")?(.+?)(\\1|\s|$)`i', $a, $m)) { |
940 | - $a2 .= ' color: '. trim($m[2]). ';'; |
|
940 | + $a2 .= ' color: '.trim($m[2]).';'; |
|
941 | 941 | } |
942 | 942 | if (preg_match('`size\s*=\s*(\'|")?(.+?)(\\1|\s|$)`i', $a, $m) && isset($fs[($m = trim($m[2]))])) { |
943 | - $a2 .= ' font-size: '. $fs[$m]. ';'; |
|
943 | + $a2 .= ' font-size: '.$fs[$m].';'; |
|
944 | 944 | } |
945 | 945 | $e = 'span'; |
946 | 946 | return ltrim($a2); |
@@ -980,7 +980,7 @@ discard block |
||
980 | 980 | echo str_repeat($s, ++$n); |
981 | 981 | } |
982 | 982 | echo ltrim(array_shift($t)); |
983 | - for ($i=-1, $j=count($t); ++$i<$j;) { |
|
983 | + for ($i = -1, $j = count($t); ++$i < $j;) { |
|
984 | 984 | $r = ''; |
985 | 985 | list($e, $r) = explode('>', $t[$i]); |
986 | 986 | $x = $e[0] == '/' ? 0 : (substr($e, -1) == '/' ? 1 : ($e[0] != '!' ? 2 : -1)); |
@@ -990,22 +990,22 @@ discard block |
||
990 | 990 | if (!$x) { |
991 | 991 | if ($n) { |
992 | 992 | echo "\n", str_repeat($s, --$n), "$e\n", str_repeat($s, $n); |
993 | - } else { |
|
993 | + }else { |
|
994 | 994 | ++$N; |
995 | 995 | ob_end_clean(); |
996 | 996 | continue 2; |
997 | 997 | } |
998 | - } else { |
|
998 | + }else { |
|
999 | 999 | echo "\n", str_repeat($s, $n), "$e\n", str_repeat($s, ($x != 1 ? ++$n : $n)); |
1000 | 1000 | } |
1001 | 1001 | echo $r; |
1002 | 1002 | continue; |
1003 | 1003 | } |
1004 | - $f = "\n". str_repeat($s, $n); |
|
1004 | + $f = "\n".str_repeat($s, $n); |
|
1005 | 1005 | if (isset($c[$y])) { |
1006 | 1006 | if (!$x) { |
1007 | 1007 | echo $e, $f, $r; |
1008 | - } else { |
|
1008 | + }else { |
|
1009 | 1009 | echo $f, $e, $r; |
1010 | 1010 | } |
1011 | 1011 | } elseif (isset($b[$y])) { |
@@ -1014,7 +1014,7 @@ discard block |
||
1014 | 1014 | echo $e, $f, $r; |
1015 | 1015 | } elseif (!$y) { |
1016 | 1016 | echo $f, $e, $f, $r; |
1017 | - } else { |
|
1017 | + }else { |
|
1018 | 1018 | echo $e, $r; |
1019 | 1019 | } |
1020 | 1020 | } |
@@ -1036,7 +1036,7 @@ discard block |
||
1036 | 1036 | // eof |
1037 | 1037 | } |
1038 | 1038 | |
1039 | - function kses($t, $h, $p=array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'gopher', 'mailto')) |
|
1039 | + function kses($t, $h, $p = array('http', 'https', 'ftp', 'news', 'nntp', 'telnet', 'gopher', 'mailto')) |
|
1040 | 1040 | { |
1041 | 1041 | // kses compat |
1042 | 1042 | foreach ($h as $k=>$v) { |
@@ -1046,7 +1046,7 @@ discard block |
||
1046 | 1046 | $C['keep_bad'] = 1; |
1047 | 1047 | $C['elements'] = count($h) ? strtolower(implode(',', array_keys($h))) : '-*'; |
1048 | 1048 | $C['hook'] = 'kses_hook'; |
1049 | - $C['schemes'] = '*:'. implode(',', $p); |
|
1049 | + $C['schemes'] = '*:'.implode(',', $p); |
|
1050 | 1050 | return htmLawed($t, $C, $h); |
1051 | 1051 | // eof |
1052 | 1052 | } |
@@ -87,7 +87,7 @@ discard block |
||
87 | 87 | $empty = true; |
88 | 88 | |
89 | 89 | foreach ($values as $value) { |
90 | - if (! $value || !trim($value)) { |
|
90 | + if (!$value || !trim($value)) { |
|
91 | 91 | continue; |
92 | 92 | } |
93 | 93 | $empty = false; |
@@ -97,7 +97,7 @@ discard block |
||
97 | 97 | } |
98 | 98 | } |
99 | 99 | |
100 | -if (! function_exists('contract')) { |
|
100 | +if (!function_exists('contract')) { |
|
101 | 101 | function contract($instance, $contract) |
102 | 102 | { |
103 | 103 | return $instance instanceof $contract; |
@@ -126,7 +126,7 @@ discard block |
||
126 | 126 | $text = cleanupHTML($text, $clean); |
127 | 127 | } |
128 | 128 | $teaser = substr($text, 0, $max); |
129 | - return strlen($text) <= $max ? $teaser : $teaser . $ending; |
|
129 | + return strlen($text) <= $max ? $teaser : $teaser.$ending; |
|
130 | 130 | } |
131 | 131 | } |
132 | 132 | |
@@ -165,7 +165,7 @@ discard block |
||
165 | 165 | function cleanupHTML($value, $whitelist = null) |
166 | 166 | { |
167 | 167 | if (!function_exists('cleanupHTML')) { |
168 | - require_once __DIR__ . '/vendors/htmlLawed.php'; |
|
168 | + require_once __DIR__.'/vendors/htmlLawed.php'; |
|
169 | 169 | } |
170 | 170 | if (is_null($whitelist)) { |
171 | 171 | $whitelist = '<code><span><div><label><a><br><p><b><i><del><strike><u><img><video><audio><iframe><object><embed><param><blockquote><mark><cite><small><ul><ol><li><hr><dl><dt><dd><sup><sub><big><pre><code><figure><figcaption><strong><em><table><tr><td><th><tbody><thead><tfoot><h1><h2><h3><h4><h5><h6>'; |
@@ -251,16 +251,16 @@ discard block |
||
251 | 251 | 'scheme', 'host', 'port', 'path', 'query', 'fragment' |
252 | 252 | ], null), $parsed_url, $overrides); |
253 | 253 | |
254 | - $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'] . '://' : null; |
|
255 | - $port = $parsed_url['port'] ? ':' . $parsed_url['port'] : null; |
|
256 | - $fragment = $parsed_url['fragment'] ? '#' . $parsed_url['fragment'] : null; |
|
254 | + $scheme = $parsed_url['scheme'] ? $parsed_url['scheme'].'://' : null; |
|
255 | + $port = $parsed_url['port'] ? ':'.$parsed_url['port'] : null; |
|
256 | + $fragment = $parsed_url['fragment'] ? '#'.$parsed_url['fragment'] : null; |
|
257 | 257 | |
258 | - $baseurl = $scheme . $parsed_url['host'] . $port . $parsed_url['path']; |
|
258 | + $baseurl = $scheme.$parsed_url['host'].$port.$parsed_url['path']; |
|
259 | 259 | $current_query = []; |
260 | 260 | |
261 | 261 | $_query = explode('&', $parsed_url['query']); |
262 | 262 | |
263 | - array_map(function ($v) use (&$current_query) { |
|
263 | + array_map(function($v) use (&$current_query) { |
|
264 | 264 | if (!$v) { |
265 | 265 | return; |
266 | 266 | } |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | |
279 | 279 | $query = urldecode(http_build_query(array_merge($current_query, $query_params))); |
280 | 280 | |
281 | - return $baseurl . '?' . $query . $fragment; |
|
281 | + return $baseurl.'?'.$query.$fragment; |
|
282 | 282 | } |
283 | 283 | } |
284 | 284 | |
@@ -287,9 +287,9 @@ discard block |
||
287 | 287 | { |
288 | 288 | $trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1); |
289 | 289 | if (php_sapi_name() == 'cli') { |
290 | - print_r("\e[1;30m dumped at: " . str_replace(base_path(), '', $trace[0]['file']). ", line: " . $trace[0]['line'] . "\e[40m\n"); |
|
291 | - } else { |
|
292 | - print_r("[dumped at: " . str_replace(base_path(), '', $trace[0]['file']). ", line: " . $trace[0]['line'] . "]\n"); |
|
290 | + print_r("\e[1;30m dumped at: ".str_replace(base_path(), '', $trace[0]['file']).", line: ".$trace[0]['line']."\e[40m\n"); |
|
291 | + }else { |
|
292 | + print_r("[dumped at: ".str_replace(base_path(), '', $trace[0]['file']).", line: ".$trace[0]['line']."]\n"); |
|
293 | 293 | } |
294 | 294 | return dd($var, ...$moreVars); |
295 | 295 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | |
20 | 20 | public static function fromKeys($keys) |
21 | 21 | { |
22 | - $keys = (array) $keys; |
|
22 | + $keys = (array)$keys; |
|
23 | 23 | $collection = collect(); |
24 | 24 | |
25 | 25 | /** @var Managers */ |
@@ -33,7 +33,7 @@ discard block |
||
33 | 33 | |
34 | 34 | public static function fromTags($tags) |
35 | 35 | { |
36 | - $tags = (array) $tags; |
|
36 | + $tags = (array)$tags; |
|
37 | 37 | $collection = collect(); |
38 | 38 | |
39 | 39 | /** @var Managers */ |
@@ -52,9 +52,9 @@ discard block |
||
52 | 52 | |
53 | 53 | private static function fromManagers(Collection $collection) |
54 | 54 | { |
55 | - return new static(...$collection->reject(function ($manager) { |
|
55 | + return new static(...$collection->reject(function($manager) { |
|
56 | 56 | return !$manager->can('index'); |
57 | - })->map(function ($manager) { |
|
57 | + })->map(function($manager) { |
|
58 | 58 | return new NavItem($manager->details()->plural, $manager->route('index'), [ |
59 | 59 | 'key' => $manager->details()->key, |
60 | 60 | 'tags' => app(Register::class)->filterByKey($manager->details()->key)->first()->tags() |
@@ -64,7 +64,7 @@ discard block |
||
64 | 64 | |
65 | 65 | public function rejectKeys($keys) |
66 | 66 | { |
67 | - $keys = (array) $keys; |
|
67 | + $keys = (array)$keys; |
|
68 | 68 | |
69 | 69 | foreach ($this->items as $k => $item) { |
70 | 70 | if (in_array($item->details('key', ''), $keys)) { |
@@ -77,7 +77,7 @@ discard block |
||
77 | 77 | |
78 | 78 | public function rejectTags($tags) |
79 | 79 | { |
80 | - $tags = (array) $tags; |
|
80 | + $tags = (array)$tags; |
|
81 | 81 | |
82 | 82 | foreach ($this->items as $k => $item) { |
83 | 83 | if (count(array_intersect($item->details('tags', []), $tags)) > 0) { |
@@ -119,7 +119,7 @@ discard block |
||
119 | 119 | $output = ''; |
120 | 120 | |
121 | 121 | foreach ($this->items as $item) { |
122 | - $output .= '<a class="block nav-item ' . (isActiveUrl($item->url()) ? 'active' : '') . '" href="'.$item->url().'">'; |
|
122 | + $output .= '<a class="block nav-item '.(isActiveUrl($item->url()) ? 'active' : '').'" href="'.$item->url().'">'; |
|
123 | 123 | $output .= $title ?? ucfirst($item->title()); |
124 | 124 | $output .= '</a>'; |
125 | 125 | } |
@@ -146,14 +146,14 @@ discard block |
||
146 | 146 | |
147 | 147 | $items = ''; |
148 | 148 | foreach ($this->items as $item) { |
149 | - $items .= '<a class="block squished --link-with-bg ' . (isActiveUrl($item->url()) ? 'active' : '') . '" href="'.$item->url().'">'; |
|
149 | + $items .= '<a class="block squished --link-with-bg '.(isActiveUrl($item->url()) ? 'active' : '').'" href="'.$item->url().'">'; |
|
150 | 150 | $items .= $item->title(); |
151 | 151 | $items .= '</a>'; |
152 | 152 | } |
153 | 153 | |
154 | 154 | // Surround within vue dropdown |
155 | 155 | $output = '<dropdown>'; |
156 | - $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'. ($title ?? 'Collecties') .'</span>'; |
|
156 | + $output .= '<span class="center-y nav-item" slot="trigger" slot-scope="{ toggle, isActive }" @click="toggle">'.($title ?? 'Collecties').'</span>'; |
|
157 | 157 | $output .= '<div v-cloak class="dropdown-box inset-s">'; |
158 | 158 | $output .= $items; |
159 | 159 | $output .= '</div>'; |
@@ -18,7 +18,7 @@ discard block |
||
18 | 18 | |
19 | 19 | public static function rolesForSelect($includeDeveloperRole = false) |
20 | 20 | { |
21 | - $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function ($role) { |
|
21 | + $roles = $includeDeveloperRole ? static::all() : static::all()->reject(function($role) { |
|
22 | 22 | return $role->name == 'developer'; |
23 | 23 | }); |
24 | 24 | |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | |
40 | 40 | public function getPermissionsForIndex() |
41 | 41 | { |
42 | - $this->permissions->each(function ($permission) { |
|
42 | + $this->permissions->each(function($permission) { |
|
43 | 43 | $model = explode("_", $permission->name, 2)[1]; |
44 | 44 | $temp = $this->permission; |
45 | 45 | $temp[$model][] = explode("_", $permission->name, 2)[0]; |
@@ -63,15 +63,15 @@ discard block |
||
63 | 63 | { |
64 | 64 | $permission = 'update-page'; |
65 | 65 | |
66 | - if (in_array($verb, ['index','show'])) { |
|
66 | + if (in_array($verb, ['index', 'show'])) { |
|
67 | 67 | $permission = 'view-page'; |
68 | - } elseif (in_array($verb, ['create','store'])) { |
|
68 | + } elseif (in_array($verb, ['create', 'store'])) { |
|
69 | 69 | $permission = 'create-page'; |
70 | 70 | } elseif (in_array($verb, ['delete'])) { |
71 | 71 | $permission = 'delete-page'; |
72 | 72 | } |
73 | 73 | |
74 | - if (! auth()->guard('chief')->user()->hasPermissionTo($permission)) { |
|
74 | + if (!auth()->guard('chief')->user()->hasPermissionTo($permission)) { |
|
75 | 75 | throw NotAllowedManagerRoute::notAllowedPermission($permission, $this); |
76 | 76 | } |
77 | 77 | } |
@@ -103,7 +103,7 @@ discard block |
||
103 | 103 | public function saveFields(): Manager |
104 | 104 | { |
105 | 105 | // Store the morph_key upon creation |
106 | - if (! $this->model->morph_key) { |
|
106 | + if (!$this->model->morph_key) { |
|
107 | 107 | $this->model->morph_key = $this->model->morphKey(); |
108 | 108 | } |
109 | 109 | |
@@ -142,7 +142,7 @@ discard block |
||
142 | 142 | if (is_array_empty($translation)) { |
143 | 143 | |
144 | 144 | // Nullify all values |
145 | - $trans[$locale] = array_map(function ($value) { |
|
145 | + $trans[$locale] = array_map(function($value) { |
|
146 | 146 | return null; |
147 | 147 | }, $translation); |
148 | 148 | continue; |
@@ -59,7 +59,7 @@ discard block |
||
59 | 59 | if (is_string($file)) { |
60 | 60 | $image_name = json_decode($file)->output->name; |
61 | 61 | $asset = $this->addAsset(json_decode($file)->output->image, $type, null, $image_name, $model); |
62 | - } else { |
|
62 | + }else { |
|
63 | 63 | $image_name = $file->getClientOriginalName(); |
64 | 64 | $asset = $this->addAsset($file, $type, null, $image_name, $model); |
65 | 65 | } |
@@ -82,7 +82,7 @@ discard block |
||
82 | 82 | |
83 | 83 | if (is_string($file)) { |
84 | 84 | $asset = AssetUploader::uploadFromBase64($file, $filename); |
85 | - } else { |
|
85 | + }else { |
|
86 | 86 | $asset = AssetUploader::upload($file, $filename); |
87 | 87 | } |
88 | 88 | |
@@ -126,9 +126,9 @@ discard block |
||
126 | 126 | */ |
127 | 127 | private function sluggifyFilename($filename): string |
128 | 128 | { |
129 | - $extension = substr($filename, strrpos($filename, '.') + 1); |
|
129 | + $extension = substr($filename, strrpos($filename, '.')+1); |
|
130 | 130 | $filename = substr($filename, 0, strrpos($filename, '.')); |
131 | - $filename = str_slug($filename) . '.' . $extension; |
|
131 | + $filename = str_slug($filename).'.'.$extension; |
|
132 | 132 | |
133 | 133 | return $filename; |
134 | 134 | } |
@@ -144,9 +144,9 @@ discard block |
||
144 | 144 | if ($file instanceof UploadedFile && !$file->isValid()) { |
145 | 145 | if ($file->getError() == UPLOAD_ERR_INI_SIZE) { |
146 | 146 | throw new FileTooBigException( |
147 | - 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. ' . |
|
148 | - 'upload_max_filesize: ' . (int)ini_get('upload_max_filesize') . 'MB, ' . |
|
149 | - 'post_max_size: ' . (int)(ini_get('post_max_size')) . 'MB' |
|
147 | + 'Cannot upload file because it exceeded the allowed upload_max_filesize: upload_max_filesize is smaller than post size. '. |
|
148 | + 'upload_max_filesize: '.(int)ini_get('upload_max_filesize').'MB, '. |
|
149 | + 'post_max_size: '.(int)(ini_get('post_max_size')).'MB' |
|
150 | 150 | ); |
151 | 151 | } |
152 | 152 | } |