@@ -573,13 +573,17 @@ |
||
573 | 573 | /** |
574 | 574 | * Include configured header comment in HTML content block |
575 | 575 | * |
576 | - * @param $html |
|
576 | + * @param string $html |
|
577 | 577 | */ |
578 | 578 | public function includeHeaderComment(&$html) |
579 | 579 | { |
580 | 580 | if (!empty($this->headerComment)) { |
581 | 581 | $html = preg_replace_callback( |
582 | 582 | '/<meta http-equiv(.*)>/Usi', |
583 | + |
|
584 | + /** |
|
585 | + * @param string $matches |
|
586 | + */ |
|
583 | 587 | function ($matches) { |
584 | 588 | return trim($matches[0] . $this->newline . $this->tab . $this->tab . '<!-- ' . $this->headerComment . '-->'); |
585 | 589 | }, |
@@ -205,12 +205,12 @@ discard block |
||
205 | 205 | $functionalBoxElements = 'dd|dt|frameset|li|tbody|td|tfoot|th|thead|tr|colgroup'; |
206 | 206 | $usableBoxElements = 'applet|button|del|iframe|ins|map|object|script'; |
207 | 207 | $imagineBoxElements = 'html|body|head|meta|title|link|script|base|!--'; |
208 | - $allBoxLikeElements = '(?>' . $trueBoxElements . '|' . $functionalBoxElements . '|' . $usableBoxElements . '|' . $imagineBoxElements . ')'; |
|
208 | + $allBoxLikeElements = '(?>'.$trueBoxElements.'|'.$functionalBoxElements.'|'.$usableBoxElements.'|'.$imagineBoxElements.')'; |
|
209 | 209 | $esteticBoxLikeElements = '(?>html|head|body|meta name|title|div|table|h1|h2|h3|h4|h5|h6|p|form|pre|center|!--)'; |
210 | 210 | $structureBoxLikeElements = '(?>html|head|body|div|!--)'; |
211 | 211 | |
212 | 212 | // split html into it's elements |
213 | - $html_array_temp = preg_split('/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', $html, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY); |
|
213 | + $html_array_temp = preg_split('/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', $html, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY); |
|
214 | 214 | // remove empty lines |
215 | 215 | $html_array = array(''); |
216 | 216 | $z = 1; |
@@ -237,20 +237,20 @@ discard block |
||
237 | 237 | $newline = true; |
238 | 238 | } elseif ($this->formatType == 2 && ( // minimalistic line break |
239 | 239 | # this element has a line break before itself |
240 | - preg_match('/<' . $structureBoxLikeElements . '(.*)>/Usi', $html_array[$x]) || preg_match('/<' . $structureBoxLikeElements . '(.*) \/>/Usi', $html_array[$x]) || # one element before is a element that has a line break after |
|
241 | - preg_match('/<\/' . $structureBoxLikeElements . '(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<' . $structureBoxLikeElements . '(.*) \/>/Usi', $html_array[$x - 1])) |
|
240 | + preg_match('/<'.$structureBoxLikeElements.'(.*)>/Usi', $html_array[$x]) || preg_match('/<'.$structureBoxLikeElements.'(.*) \/>/Usi', $html_array[$x]) || # one element before is a element that has a line break after |
|
241 | + preg_match('/<\/'.$structureBoxLikeElements.'(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<'.$structureBoxLikeElements.'(.*) \/>/Usi', $html_array[$x - 1])) |
|
242 | 242 | ) { |
243 | 243 | $newline = true; |
244 | 244 | } elseif ($this->formatType == 3 && ( // aestetic line break |
245 | 245 | # this element has a line break before itself |
246 | - preg_match('/<' . $esteticBoxLikeElements . '(.*)>/Usi', $html_array[$x]) || preg_match('/<' . $esteticBoxLikeElements . '(.*) \/>/Usi', $html_array[$x]) || # one element before is a element that has a line break after |
|
247 | - preg_match('/<\/' . $esteticBoxLikeElements . '(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<' . $esteticBoxLikeElements . '(.*) \/>/Usi', $html_array[$x - 1])) |
|
246 | + preg_match('/<'.$esteticBoxLikeElements.'(.*)>/Usi', $html_array[$x]) || preg_match('/<'.$esteticBoxLikeElements.'(.*) \/>/Usi', $html_array[$x]) || # one element before is a element that has a line break after |
|
247 | + preg_match('/<\/'.$esteticBoxLikeElements.'(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<'.$esteticBoxLikeElements.'(.*) \/>/Usi', $html_array[$x - 1])) |
|
248 | 248 | ) { |
249 | 249 | $newline = true; |
250 | 250 | } elseif ($this->formatType >= 4 && ( // logical line break |
251 | 251 | # this element has a line break before itself |
252 | - preg_match('/<' . $allBoxLikeElements . '(.*)>/Usi', $html_array[$x]) || preg_match('/<' . $allBoxLikeElements . '(.*) \/>/Usi', $html_array[$x]) || # one element before is a element that has a line break after |
|
253 | - preg_match('/<\/' . $allBoxLikeElements . '(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<' . $allBoxLikeElements . '(.*) \/>/Usi', $html_array[$x - 1])) |
|
252 | + preg_match('/<'.$allBoxLikeElements.'(.*)>/Usi', $html_array[$x]) || preg_match('/<'.$allBoxLikeElements.'(.*) \/>/Usi', $html_array[$x]) || # one element before is a element that has a line break after |
|
253 | + preg_match('/<\/'.$allBoxLikeElements.'(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<'.$allBoxLikeElements.'(.*) \/>/Usi', $html_array[$x - 1])) |
|
254 | 254 | ) { |
255 | 255 | $newline = true; |
256 | 256 | } |
@@ -303,7 +303,7 @@ discard block |
||
303 | 303 | |
304 | 304 | // include debug comment at the end |
305 | 305 | if ($tabs != 0 && $this->debugComment === true) { |
306 | - $html .= '<!--' . $tabs . " open elements found-->\r\n"; |
|
306 | + $html .= '<!--'.$tabs." open elements found-->\r\n"; |
|
307 | 307 | } |
308 | 308 | } |
309 | 309 | |
@@ -437,7 +437,7 @@ discard block |
||
437 | 437 | 'textarea', |
438 | 438 | 'pre' |
439 | 439 | ); // eventuell auch: span, script, style |
440 | - $peaces = preg_split('#(<(' . implode('|', $splitArray) . ').*>.*</\2>)#Uis', $html, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
440 | + $peaces = preg_split('#(<('.implode('|', $splitArray).').*>.*</\2>)#Uis', $html, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
441 | 441 | $html = ""; |
442 | 442 | for ($i = 0; $i < count($peaces); $i++) { |
443 | 443 | if (($i + 1) % 3 == 0) { |
@@ -580,8 +580,8 @@ discard block |
||
580 | 580 | if (!empty($this->headerComment)) { |
581 | 581 | $html = preg_replace_callback( |
582 | 582 | '/<meta http-equiv(.*)>/Usi', |
583 | - function ($matches) { |
|
584 | - return trim($matches[0] . $this->newline . $this->tab . $this->tab . '<!-- ' . $this->headerComment . '-->'); |
|
583 | + function($matches) { |
|
584 | + return trim($matches[0].$this->newline.$this->tab.$this->tab.'<!-- '.$this->headerComment.'-->'); |
|
585 | 585 | }, |
586 | 586 | $html, |
587 | 587 | 1 |
@@ -32,7 +32,7 @@ |
||
32 | 32 | * |
33 | 33 | * @return void |
34 | 34 | */ |
35 | - public function clean(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController &$typoScriptFrontend) |
|
35 | + public function clean(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController&$typoScriptFrontend) |
|
36 | 36 | { |
37 | 37 | if ($this->cleanHtmlService instanceof CleanHtmlService) { |
38 | 38 | $configuration = $typoScriptFrontend->config['config']['sourceopt.']; |