@@ -83,7 +83,7 @@ discard block |
||
83 | 83 | } |
84 | 84 | |
85 | 85 | if ($htmlMin->isDoMakeSameDomainLinksRelative()) { |
86 | - if (!$htmlMin->isLocalDomainSet()){ |
|
86 | + if (!$htmlMin->isLocalDomainSet()) { |
|
87 | 87 | $htmlMin->setLocalDomain(); |
88 | 88 | } |
89 | 89 | $localDomain = $htmlMin->getLocalDomain(); |
@@ -237,7 +237,7 @@ discard block |
||
237 | 237 | && |
238 | 238 | !(isset($attributes['target']) && $attributes['target'] === '_blank') |
239 | 239 | ) { |
240 | - $attrValue = \str_replace($scheme . '://', '//', $attrValue); |
|
240 | + $attrValue = \str_replace($scheme.'://', '//', $attrValue); |
|
241 | 241 | } |
242 | 242 | |
243 | 243 | return $attrValue; |
@@ -266,7 +266,7 @@ discard block |
||
266 | 266 | continue; |
267 | 267 | } |
268 | 268 | |
269 | - $attrValue .= \trim($class) . ' '; |
|
269 | + $attrValue .= \trim($class).' '; |
|
270 | 270 | } |
271 | 271 | |
272 | 272 | return \trim($attrValue); |
@@ -468,9 +468,9 @@ discard block |
||
468 | 468 | */ |
469 | 469 | public function setLocalDomain(string $localDomain = ''): self |
470 | 470 | { |
471 | - if ($localDomain === ''){ |
|
471 | + if ($localDomain === '') { |
|
472 | 472 | $this->localDomain = $_SERVER['SERVER_NAME']; |
473 | - }else{ |
|
473 | + } else { |
|
474 | 474 | $this->localDomain = rtrim(preg_replace('/(https?:)?\/\//', '', $localDomain), '/'); |
475 | 475 | } |
476 | 476 | |
@@ -637,7 +637,7 @@ discard block |
||
637 | 637 | $attr_val = $attribute->value; |
638 | 638 | } |
639 | 639 | |
640 | - $attr_str .= ($omit_quotes ? '' : $quoteTmp) . $attr_val . ($omit_quotes ? '' : $quoteTmp); |
|
640 | + $attr_str .= ($omit_quotes ? '' : $quoteTmp).$attr_val.($omit_quotes ? '' : $quoteTmp); |
|
641 | 641 | $attr_str .= ' '; |
642 | 642 | } |
643 | 643 | } |
@@ -934,21 +934,21 @@ discard block |
||
934 | 934 | $tmpTypePublic = 'PUBLIC'; |
935 | 935 | } |
936 | 936 | |
937 | - $html .= '<!DOCTYPE ' . $child->name . '' |
|
938 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
939 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
937 | + $html .= '<!DOCTYPE '.$child->name.'' |
|
938 | + . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '') |
|
939 | + . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '') |
|
940 | 940 | . '>'; |
941 | 941 | } |
942 | 942 | } elseif ($child instanceof \DOMElement) { |
943 | - $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); |
|
944 | - $html .= '>' . $this->domNodeToString($child); |
|
943 | + $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child)); |
|
944 | + $html .= '>'.$this->domNodeToString($child); |
|
945 | 945 | |
946 | 946 | if ( |
947 | 947 | !$this->doRemoveOmittedHtmlTags |
948 | 948 | || |
949 | 949 | !$this->domNodeClosingTagOptional($child) |
950 | 950 | ) { |
951 | - $html .= '</' . $child->tagName . '>'; |
|
951 | + $html .= '</'.$child->tagName.'>'; |
|
952 | 952 | } |
953 | 953 | |
954 | 954 | if (!$this->doRemoveWhitespaceAroundTags) { |
@@ -1012,7 +1012,7 @@ discard block |
||
1012 | 1012 | $html .= $child->wholeText; |
1013 | 1013 | } |
1014 | 1014 | } elseif ($child instanceof \DOMComment) { |
1015 | - $html .= '<!--' . $child->textContent . '-->'; |
|
1015 | + $html .= '<!--'.$child->textContent.'-->'; |
|
1016 | 1016 | } |
1017 | 1017 | } |
1018 | 1018 | |
@@ -1244,8 +1244,8 @@ discard block |
||
1244 | 1244 | if (\strpos($html, ' ') !== false) { |
1245 | 1245 | $html = (string) \preg_replace_callback( |
1246 | 1246 | '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#', |
1247 | - static function ($matches) { |
|
1248 | - return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>'; |
|
1247 | + static function($matches) { |
|
1248 | + return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>'; |
|
1249 | 1249 | }, |
1250 | 1250 | $html |
1251 | 1251 | ); |
@@ -1265,7 +1265,7 @@ discard block |
||
1265 | 1265 | |
1266 | 1266 | if (\strpos($html, $this->protectedChildNodesHelper) !== false) { |
1267 | 1267 | $html = (string) \preg_replace_callback( |
1268 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', |
|
1268 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', |
|
1269 | 1269 | [$this, 'restoreProtectedHtml'], |
1270 | 1270 | $html |
1271 | 1271 | ); |
@@ -1285,14 +1285,14 @@ discard block |
||
1285 | 1285 | |
1286 | 1286 | $html = \str_replace( |
1287 | 1287 | [ |
1288 | - 'html>' . "\n", |
|
1289 | - "\n" . '<html', |
|
1290 | - 'html/>' . "\n", |
|
1291 | - "\n" . '</html', |
|
1292 | - 'head>' . "\n", |
|
1293 | - "\n" . '<head', |
|
1294 | - 'head/>' . "\n", |
|
1295 | - "\n" . '</head', |
|
1288 | + 'html>'."\n", |
|
1289 | + "\n".'<html', |
|
1290 | + 'html/>'."\n", |
|
1291 | + "\n".'</html', |
|
1292 | + 'head>'."\n", |
|
1293 | + "\n".'<head', |
|
1294 | + 'head/>'."\n", |
|
1295 | + "\n".'</head', |
|
1296 | 1296 | ], |
1297 | 1297 | [ |
1298 | 1298 | 'html>', |
@@ -1311,11 +1311,11 @@ discard block |
||
1311 | 1311 | $replace = []; |
1312 | 1312 | $replacement = []; |
1313 | 1313 | foreach (self::$selfClosingTags as $selfClosingTag) { |
1314 | - $replace[] = '<' . $selfClosingTag . '/>'; |
|
1315 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
1316 | - $replace[] = '<' . $selfClosingTag . ' />'; |
|
1317 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
1318 | - $replace[] = '></' . $selfClosingTag . '>'; |
|
1314 | + $replace[] = '<'.$selfClosingTag.'/>'; |
|
1315 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
1316 | + $replace[] = '<'.$selfClosingTag.' />'; |
|
1317 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
1318 | + $replace[] = '></'.$selfClosingTag.'>'; |
|
1319 | 1319 | $replacement[] = '>'; |
1320 | 1320 | } |
1321 | 1321 | $html = \str_replace( |
@@ -1506,7 +1506,7 @@ discard block |
||
1506 | 1506 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->parentNode()->innerHtml(); |
1507 | 1507 | $parentNode = $element->getNode()->parentNode; |
1508 | 1508 | if ($parentNode !== null) { |
1509 | - $parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
1509 | + $parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
1510 | 1510 | } |
1511 | 1511 | |
1512 | 1512 | ++$this->protected_tags_counter; |
@@ -1540,7 +1540,7 @@ discard block |
||
1540 | 1540 | } |
1541 | 1541 | |
1542 | 1542 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->innerhtml; |
1543 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
1543 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
1544 | 1544 | |
1545 | 1545 | ++$this->protected_tags_counter; |
1546 | 1546 | } |
@@ -1557,11 +1557,11 @@ discard block |
||
1557 | 1557 | continue; |
1558 | 1558 | } |
1559 | 1559 | |
1560 | - $this->protectedChildNodes[$this->protected_tags_counter] = '<!--' . $text . '-->'; |
|
1560 | + $this->protectedChildNodes[$this->protected_tags_counter] = '<!--'.$text.'-->'; |
|
1561 | 1561 | |
1562 | 1562 | /* @var $node \DOMComment */ |
1563 | 1563 | $node = $element->getNode(); |
1564 | - $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'); |
|
1564 | + $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'); |
|
1565 | 1565 | $parentNode = $element->getNode()->parentNode; |
1566 | 1566 | if ($parentNode !== null) { |
1567 | 1567 | $parentNode->replaceChild($child, $node); |