@@ -520,7 +520,7 @@ |
||
| 520 | 520 | /** |
| 521 | 521 | * Include configured header comment in HTML content block |
| 522 | 522 | * |
| 523 | - * @param $html |
|
| 523 | + * @param string $html |
|
| 524 | 524 | */ |
| 525 | 525 | public function includeHeaderComment(&$html) |
| 526 | 526 | { |
@@ -74,7 +74,7 @@ discard block |
||
| 74 | 74 | |
| 75 | 75 | if (!empty($config)) { |
| 76 | 76 | if ($config['formatHtml'] && is_numeric($config['formatHtml'])) { |
| 77 | - $this->formatType = (int)$config['formatHtml']; |
|
| 77 | + $this->formatType = (int) $config['formatHtml']; |
|
| 78 | 78 | } |
| 79 | 79 | |
| 80 | 80 | if ($config['formatHtml.']['tabSize'] && is_numeric($config['formatHtml.']['tabSize'])) { |
@@ -82,11 +82,11 @@ discard block |
||
| 82 | 82 | } |
| 83 | 83 | |
| 84 | 84 | if (isset($config['enable_utf'])) { |
| 85 | - $this->utf8 = (bool)$config['enable_utf-8_support']; |
|
| 85 | + $this->utf8 = (bool) $config['enable_utf-8_support']; |
|
| 86 | 86 | } |
| 87 | 87 | |
| 88 | 88 | if (isset($config['formatHtml.']['debugComment'])) { |
| 89 | - $this->debugComment = (bool)$config['formatHtml.']['debugComment']; |
|
| 89 | + $this->debugComment = (bool) $config['formatHtml.']['debugComment']; |
|
| 90 | 90 | } |
| 91 | 91 | |
| 92 | 92 | if (isset($config['headerComment'])) { |
@@ -106,7 +106,7 @@ discard block |
||
| 106 | 106 | public function clean(&$html, $config = []) |
| 107 | 107 | { |
| 108 | 108 | if (!empty($config)) { |
| 109 | - if ((bool)$config['enabled'] === false) { |
|
| 109 | + if ((bool) $config['enabled'] === false) { |
|
| 110 | 110 | return; |
| 111 | 111 | } |
| 112 | 112 | |
@@ -115,15 +115,15 @@ discard block |
||
| 115 | 115 | |
| 116 | 116 | $manipulations = []; |
| 117 | 117 | |
| 118 | - if (isset($config['removeGenerator']) && (bool)$config['removeGenerator']) { |
|
| 118 | + if (isset($config['removeGenerator']) && (bool) $config['removeGenerator']) { |
|
| 119 | 119 | $manipulations['removeGenerator'] = GeneralUtility::makeInstance('HTML\\Sourceopt\\Manipulation\\RemoveGenerator'); |
| 120 | 120 | } |
| 121 | 121 | |
| 122 | - if (isset($config['removeComments']) && (bool)$config['removeComments']) { |
|
| 122 | + if (isset($config['removeComments']) && (bool) $config['removeComments']) { |
|
| 123 | 123 | $manipulations['removeComments'] = GeneralUtility::makeInstance('HTML\\Sourceopt\\Manipulation\\RemoveComments'); |
| 124 | 124 | } |
| 125 | 125 | |
| 126 | - if (isset($config['removeBlurScript']) && (bool)$config['removeBlurScript']) { |
|
| 126 | + if (isset($config['removeBlurScript']) && (bool) $config['removeBlurScript']) { |
|
| 127 | 127 | $manipulations['removeBlurScript'] = GeneralUtility::makeInstance('HTML\\Sourceopt\\Manipulation\\RemoveBlurScript'); |
| 128 | 128 | } |
| 129 | 129 | |
@@ -133,7 +133,7 @@ discard block |
||
| 133 | 133 | |
| 134 | 134 | foreach ($manipulations as $key => $manipulation) { |
| 135 | 135 | /** @var ManipulationInterface $manipulation */ |
| 136 | - $configuration = isset($config[$key . '.']) && is_array($config[$key . '.']) ? $config[$key . '.'] : []; |
|
| 136 | + $configuration = isset($config[$key.'.']) && is_array($config[$key.'.']) ? $config[$key.'.'] : []; |
|
| 137 | 137 | $html = $manipulation->manipulate($html, $configuration); |
| 138 | 138 | } |
| 139 | 139 | |
@@ -177,7 +177,7 @@ discard block |
||
| 177 | 177 | $functionalBoxElements = 'dd|dt|frameset|li|tbody|td|tfoot|th|thead|tr|colgroup'; |
| 178 | 178 | $usableBoxElements = 'applet|button|del|iframe|ins|map|object|script'; |
| 179 | 179 | $imagineBoxElements = 'html|body|head|meta|title|link|script|base|!--'; |
| 180 | - $allBoxLikeElements = '(?>' . $trueBoxElements . '|' . $functionalBoxElements . '|' . $usableBoxElements . '|' . $imagineBoxElements . ')'; |
|
| 180 | + $allBoxLikeElements = '(?>'.$trueBoxElements.'|'.$functionalBoxElements.'|'.$usableBoxElements.'|'.$imagineBoxElements.')'; |
|
| 181 | 181 | $esteticBoxLikeElements = '(?>html|head|body|meta name|title|div|table|h1|h2|h3|h4|h5|h6|p|form|pre|center|!--)'; |
| 182 | 182 | $structureBoxLikeElements = '(?>html|head|body|div|!--)'; |
| 183 | 183 | |
@@ -186,7 +186,7 @@ discard block |
||
| 186 | 186 | '/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', |
| 187 | 187 | $html, |
| 188 | 188 | -1, |
| 189 | - PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY |
|
| 189 | + PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY |
|
| 190 | 190 | ); |
| 191 | 191 | // remove empty lines |
| 192 | 192 | $html_array = ['']; |
@@ -215,52 +215,52 @@ discard block |
||
| 215 | 215 | } elseif ($this->formatType == 2 && ( // minimalistic line break |
| 216 | 216 | # this element has a line break before itself |
| 217 | 217 | preg_match( |
| 218 | - '/<' . $structureBoxLikeElements . '(.*)>/Usi', |
|
| 218 | + '/<'.$structureBoxLikeElements.'(.*)>/Usi', |
|
| 219 | 219 | $html_array[$x] |
| 220 | 220 | ) || preg_match( |
| 221 | - '/<' . $structureBoxLikeElements . '(.*) \/>/Usi', |
|
| 221 | + '/<'.$structureBoxLikeElements.'(.*) \/>/Usi', |
|
| 222 | 222 | $html_array[$x] |
| 223 | 223 | ) || # one element before is a element that has a line break after |
| 224 | 224 | preg_match( |
| 225 | - '/<\/' . $structureBoxLikeElements . '(.*)>/Usi', |
|
| 225 | + '/<\/'.$structureBoxLikeElements.'(.*)>/Usi', |
|
| 226 | 226 | $html_array[$x - 1] |
| 227 | 227 | ) || substr( |
| 228 | 228 | $html_array[$x - 1], |
| 229 | 229 | 0, |
| 230 | 230 | 4 |
| 231 | - ) == '<!--' || preg_match('/<' . $structureBoxLikeElements . '(.*) \/>/Usi', $html_array[$x - 1])) |
|
| 231 | + ) == '<!--' || preg_match('/<'.$structureBoxLikeElements.'(.*) \/>/Usi', $html_array[$x - 1])) |
|
| 232 | 232 | ) { |
| 233 | 233 | $newline = true; |
| 234 | 234 | } elseif ($this->formatType == 3 && ( // aestetic line break |
| 235 | 235 | # this element has a line break before itself |
| 236 | 236 | preg_match( |
| 237 | - '/<' . $esteticBoxLikeElements . '(.*)>/Usi', |
|
| 237 | + '/<'.$esteticBoxLikeElements.'(.*)>/Usi', |
|
| 238 | 238 | $html_array[$x] |
| 239 | 239 | ) || preg_match( |
| 240 | - '/<' . $esteticBoxLikeElements . '(.*) \/>/Usi', |
|
| 240 | + '/<'.$esteticBoxLikeElements.'(.*) \/>/Usi', |
|
| 241 | 241 | $html_array[$x] |
| 242 | 242 | ) || # one element before is a element that has a line break after |
| 243 | - preg_match('/<\/' . $esteticBoxLikeElements . '(.*)>/Usi', $html_array[$x - 1]) || substr( |
|
| 243 | + preg_match('/<\/'.$esteticBoxLikeElements.'(.*)>/Usi', $html_array[$x - 1]) || substr( |
|
| 244 | 244 | $html_array[$x - 1], |
| 245 | 245 | 0, |
| 246 | 246 | 4 |
| 247 | - ) == '<!--' || preg_match('/<' . $esteticBoxLikeElements . '(.*) \/>/Usi', $html_array[$x - 1])) |
|
| 247 | + ) == '<!--' || 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 | 252 | preg_match( |
| 253 | - '/<' . $allBoxLikeElements . '(.*)>/Usi', |
|
| 253 | + '/<'.$allBoxLikeElements.'(.*)>/Usi', |
|
| 254 | 254 | $html_array[$x] |
| 255 | 255 | ) || preg_match( |
| 256 | - '/<' . $allBoxLikeElements . '(.*) \/>/Usi', |
|
| 256 | + '/<'.$allBoxLikeElements.'(.*) \/>/Usi', |
|
| 257 | 257 | $html_array[$x] |
| 258 | 258 | ) || # one element before is a element that has a line break after |
| 259 | - preg_match('/<\/' . $allBoxLikeElements . '(.*)>/Usi', $html_array[$x - 1]) || substr( |
|
| 259 | + preg_match('/<\/'.$allBoxLikeElements.'(.*)>/Usi', $html_array[$x - 1]) || substr( |
|
| 260 | 260 | $html_array[$x - 1], |
| 261 | 261 | 0, |
| 262 | 262 | 4 |
| 263 | - ) == '<!--' || preg_match('/<' . $allBoxLikeElements . '(.*) \/>/Usi', $html_array[$x - 1])) |
|
| 263 | + ) == '<!--' || preg_match('/<'.$allBoxLikeElements.'(.*) \/>/Usi', $html_array[$x - 1])) |
|
| 264 | 264 | ) { |
| 265 | 265 | $newline = true; |
| 266 | 266 | } |
@@ -337,7 +337,7 @@ discard block |
||
| 337 | 337 | |
| 338 | 338 | // include debug comment at the end |
| 339 | 339 | if ($tabs != 0 && $this->debugComment === true) { |
| 340 | - $html .= '<!--' . $tabs . " open elements found-->\r\n"; |
|
| 340 | + $html .= '<!--'.$tabs." open elements found-->\r\n"; |
|
| 341 | 341 | } |
| 342 | 342 | } |
| 343 | 343 | |
@@ -471,7 +471,7 @@ discard block |
||
| 471 | 471 | 'textarea', |
| 472 | 472 | 'pre' |
| 473 | 473 | ]; // eventuell auch: span, script, style |
| 474 | - $peaces = preg_split('#(<(' . implode('|', $splitArray) . ').*>.*</\2>)#Uis', $html, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
| 474 | + $peaces = preg_split('#(<('.implode('|', $splitArray).').*>.*</\2>)#Uis', $html, -1, PREG_SPLIT_DELIM_CAPTURE); |
|
| 475 | 475 | $html = ""; |
| 476 | 476 | for ($i = 0; $i < count($peaces); $i++) { |
| 477 | 477 | if (($i + 1) % 3 == 0) { |
@@ -525,8 +525,8 @@ discard block |
||
| 525 | 525 | public function includeHeaderComment(&$html) |
| 526 | 526 | { |
| 527 | 527 | if (!empty($this->headerComment)) { |
| 528 | - $html = preg_replace_callback('/<meta http-equiv(.*)>/Usi', function ($matches) { |
|
| 529 | - return trim($matches[0] . $this->newline . $this->tab . $this->tab . '<!-- ' . $this->headerComment . '-->'); |
|
| 528 | + $html = preg_replace_callback('/<meta http-equiv(.*)>/Usi', function($matches) { |
|
| 529 | + return trim($matches[0].$this->newline.$this->tab.$this->tab.'<!-- '.$this->headerComment.'-->'); |
|
| 530 | 530 | }, $html, 1); |
| 531 | 531 | } |
| 532 | 532 | } |
@@ -37,7 +37,7 @@ |
||
| 37 | 37 | * |
| 38 | 38 | * @return void |
| 39 | 39 | */ |
| 40 | - public function clean(TypoScriptFrontendController &$typoScriptFrontend) |
|
| 40 | + public function clean(TypoScriptFrontendController&$typoScriptFrontend) |
|
| 41 | 41 | { |
| 42 | 42 | if ($this->cleanHtmlService instanceof CleanHtmlService) { |
| 43 | 43 | $configuration = $typoScriptFrontend->config['config']['sourceopt.']; |