Completed
Branch master (926d8a)
by Tim
02:49
created
Classes/Service/CleanHtmlService.php 3 patches
Doc Comments   +5 added lines, -1 removed lines patch added patch discarded remove patch
@@ -555,12 +555,16 @@
 block discarded – undo
555 555
 	/**
556 556
 	 * Include configured header comment in HTML content block
557 557
 	 *
558
-	 * @param $html
558
+	 * @param string $html
559 559
 	 */
560 560
 	public function includeHeaderComment(&$html) {
561 561
 		if (!empty($this->headerComment)) {
562 562
 			$html = preg_replace_callback(
563 563
 				'/<meta http-equiv(.*)>/Usi',
564
+
565
+				/**
566
+				 * @param string $matches
567
+				 */
564 568
 				function ($matches) {
565 569
 					return trim($matches[0] . $this->newline . $this->tab . $this->tab . '<!-- ' . $this->headerComment . '-->');
566 570
 				},
Please login to merge, or discard this patch.
Indentation   -1 removed lines patch added patch discarded remove patch
@@ -4,7 +4,6 @@
 block discarded – undo
4 4
 /**
5 5
  * Service: Clean parsed HTML functionality
6 6
  * Based on the extension 'sourceopt'
7
-
8 7
  */
9 8
 class CleanHtmlService implements \TYPO3\CMS\Core\SingletonInterface {
10 9
 
Please login to merge, or discard this patch.
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -201,12 +201,12 @@  discard block
 block discarded – undo
201 201
 		$functionalBoxElements = 'dd|dt|frameset|li|tbody|td|tfoot|th|thead|tr|colgroup';
202 202
 		$usableBoxElements = 'applet|button|del|iframe|ins|map|object|script';
203 203
 		$imagineBoxElements = 'html|body|head|meta|title|link|script|base|!--';
204
-		$allBoxLikeElements = '(?>' . $trueBoxElements . '|' . $functionalBoxElements . '|' . $usableBoxElements . '|' . $imagineBoxElements . ')';
204
+		$allBoxLikeElements = '(?>'.$trueBoxElements.'|'.$functionalBoxElements.'|'.$usableBoxElements.'|'.$imagineBoxElements.')';
205 205
 		$esteticBoxLikeElements = '(?>html|head|body|meta name|title|div|table|h1|h2|h3|h4|h5|h6|p|form|pre|center|!--)';
206 206
 		$structureBoxLikeElements = '(?>html|head|body|div|!--)';
207 207
 
208 208
 		// split html into it's elements
209
-		$html_array_temp = preg_split('/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', $html, -1, PREG_SPLIT_DELIM_CAPTURE | PREG_SPLIT_NO_EMPTY);
209
+		$html_array_temp = preg_split('/(<(?:[^<>]+(?:"[^"]*"|\'[^\']*\')?)+>)/', $html, -1, PREG_SPLIT_DELIM_CAPTURE|PREG_SPLIT_NO_EMPTY);
210 210
 		// remove empty lines
211 211
 		$html_array = array('');
212 212
 		$z = 1;
@@ -233,20 +233,20 @@  discard block
 block discarded – undo
233 233
 				$newline = TRUE;
234 234
 			} elseif ($this->formatType == 2 && ( // minimalistic line break
235 235
 					# this element has a line break before itself
236
-					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
237
-					preg_match('/<\/' . $structureBoxLikeElements . '(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<' . $structureBoxLikeElements . '(.*) \/>/Usi', $html_array[$x - 1]))
236
+					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
237
+					preg_match('/<\/'.$structureBoxLikeElements.'(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<'.$structureBoxLikeElements.'(.*) \/>/Usi', $html_array[$x - 1]))
238 238
 			) {
239 239
 				$newline = TRUE;
240 240
 			} elseif ($this->formatType == 3 && ( // aestetic line break
241 241
 					# this element has a line break before itself
242
-					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
243
-					preg_match('/<\/' . $esteticBoxLikeElements . '(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<' . $esteticBoxLikeElements . '(.*) \/>/Usi', $html_array[$x - 1]))
242
+					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
243
+					preg_match('/<\/'.$esteticBoxLikeElements.'(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<'.$esteticBoxLikeElements.'(.*) \/>/Usi', $html_array[$x - 1]))
244 244
 			) {
245 245
 				$newline = TRUE;
246 246
 			} elseif ($this->formatType >= 4 && ( // logical line break
247 247
 					# this element has a line break before itself
248
-					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
249
-					preg_match('/<\/' . $allBoxLikeElements . '(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<' . $allBoxLikeElements . '(.*) \/>/Usi', $html_array[$x - 1]))
248
+					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
249
+					preg_match('/<\/'.$allBoxLikeElements.'(.*)>/Usi', $html_array[$x - 1]) || substr($html_array[$x - 1], 0, 4) == '<!--' || preg_match('/<'.$allBoxLikeElements.'(.*) \/>/Usi', $html_array[$x - 1]))
250 250
 			) {
251 251
 				$newline = TRUE;
252 252
 			}
@@ -299,7 +299,7 @@  discard block
 block discarded – undo
299 299
 
300 300
 		// include debug comment at the end
301 301
 		if ($tabs != 0 && $this->debugComment === TRUE) {
302
-			$html .= '<!--' . $tabs . " open elements found-->\r\n";
302
+			$html .= '<!--'.$tabs." open elements found-->\r\n";
303 303
 		}
304 304
 	}
305 305
 
@@ -426,7 +426,7 @@  discard block
 block discarded – undo
426 426
 			'textarea',
427 427
 			'pre'
428 428
 		); // eventuell auch: span, script, style
429
-		$peaces = preg_split('#(<(' . implode('|', $splitArray) . ').*>.*</\2>)#Uis', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
429
+		$peaces = preg_split('#(<('.implode('|', $splitArray).').*>.*</\2>)#Uis', $html, -1, PREG_SPLIT_DELIM_CAPTURE);
430 430
 		$html = "";
431 431
 		for ($i = 0; $i < count($peaces); $i++) {
432 432
 			if (($i + 1) % 3 == 0) {
@@ -561,8 +561,8 @@  discard block
 block discarded – undo
561 561
 		if (!empty($this->headerComment)) {
562 562
 			$html = preg_replace_callback(
563 563
 				'/<meta http-equiv(.*)>/Usi',
564
-				function ($matches) {
565
-					return trim($matches[0] . $this->newline . $this->tab . $this->tab . '<!-- ' . $this->headerComment . '-->');
564
+				function($matches) {
565
+					return trim($matches[0].$this->newline.$this->tab.$this->tab.'<!-- '.$this->headerComment.'-->');
566 566
 				},
567 567
 				$html,
568 568
 				1
Please login to merge, or discard this patch.
ext_emconf.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -10,7 +10,7 @@  discard block
 block discarded – undo
10 10
  * writing. "version" and "dependencies" must not be touched!
11 11
  ***************************************************************/
12 12
 
13
-$EM_CONF[$_EXTKEY] = array (
13
+$EM_CONF[$_EXTKEY] = array(
14 14
 	'title' => 'Source Optimization',
15 15
 	'description' => 'Optimization of the final page: reformatting the (x)html output, removal of new lines, and quotes. Move development repository to https://github.com/lochmueller/sourceopt',
16 16
 	'category' => 'fe',
@@ -20,9 +20,9 @@  discard block
 block discarded – undo
20 20
 	'author_email' => '[email protected], [email protected], [email protected]',
21 21
 	'author_company' => NULL,
22 22
 	'constraints' =>
23
-	array (
23
+	array(
24 24
 		'depends' =>
25
-		array (
25
+		array(
26 26
 			'typo3' => '6.2.0-7.99.99',
27 27
 		),
28 28
 	),
Please login to merge, or discard this patch.
Classes/User/FrontendHook.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@
 block discarded – undo
30 30
 	 *
31 31
 	 * @return void
32 32
 	 */
33
-	public function clean(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController &$typoScriptFrontend) {
33
+	public function clean(\TYPO3\CMS\Frontend\Controller\TypoScriptFrontendController&$typoScriptFrontend) {
34 34
 		if ($this->cleanHtmlService instanceof CleanHtmlService) {
35 35
 			$configuration = $typoScriptFrontend->config['config']['sourceopt.'];
36 36
 			$this->cleanHtmlService->clean($typoScriptFrontend->content, $configuration);
Please login to merge, or discard this patch.