@@ -450,7 +450,7 @@ discard block |
||
450 | 450 | # http://www.whatwg.org/specs/web-apps/current-work/multipage/syntax.html#attributes-0 |
451 | 451 | $omitquotes = $attribute->value != '' && 0 == \preg_match('/["\'=<>` \t\r\n\f]+/', $attribute->value); |
452 | 452 | $attr_val = $attribute->value; |
453 | - $attrstr .= ($omitquotes ? '' : '"') . $attr_val . ($omitquotes ? '' : '"'); |
|
453 | + $attrstr .= ($omitquotes ? '' : '"').$attr_val.($omitquotes ? '' : '"'); |
|
454 | 454 | $attrstr .= ' '; |
455 | 455 | } |
456 | 456 | } |
@@ -576,11 +576,11 @@ discard block |
||
576 | 576 | |
577 | 577 | } else if ($child instanceof \DOMElement) { |
578 | 578 | |
579 | - $htmlstr .= trim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); |
|
580 | - $htmlstr .= '>' . $this->domNodeToString($child); |
|
579 | + $htmlstr .= trim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child)); |
|
580 | + $htmlstr .= '>'.$this->domNodeToString($child); |
|
581 | 581 | |
582 | 582 | if (!$this->domNodeClosingTagOptional($child)) { |
583 | - $htmlstr .= '</' . $child->tagName . '>'; |
|
583 | + $htmlstr .= '</'.$child->tagName.'>'; |
|
584 | 584 | } |
585 | 585 | |
586 | 586 | } else if ($child instanceof \DOMText) { |
@@ -603,7 +603,7 @@ discard block |
||
603 | 603 | |
604 | 604 | } else { |
605 | 605 | |
606 | - throw new \Exception('Error by: ' . print_r($child, true)); |
|
606 | + throw new \Exception('Error by: '.print_r($child, true)); |
|
607 | 607 | |
608 | 608 | } |
609 | 609 | } |
@@ -653,7 +653,7 @@ discard block |
||
653 | 653 | */ |
654 | 654 | public function minify($html, $decodeUtf8Specials = false) |
655 | 655 | { |
656 | - $html = (string)$html; |
|
656 | + $html = (string) $html; |
|
657 | 657 | if (!isset($html[0])) { |
658 | 658 | return ''; |
659 | 659 | } |
@@ -689,10 +689,10 @@ discard block |
||
689 | 689 | // ------------------------------------------------------------------------- |
690 | 690 | |
691 | 691 | // Remove extra white-space(s) between HTML attribute(s) |
692 | - $html = (string)\preg_replace_callback( |
|
692 | + $html = (string) \preg_replace_callback( |
|
693 | 693 | '#<([^\/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(\/?)>#', |
694 | - function ($matches) { |
|
695 | - return '<' . $matches[1] . (string)\preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]) . $matches[3] . '>'; |
|
694 | + function($matches) { |
|
695 | + return '<'.$matches[1].(string) \preg_replace('#([^\s=]+)(\=([\'"]?)(.*?)\3)?(\s+|$)#s', ' $1$2', $matches[2]).$matches[3].'>'; |
|
696 | 696 | }, |
697 | 697 | $html |
698 | 698 | ); |
@@ -700,15 +700,15 @@ discard block |
||
700 | 700 | |
701 | 701 | if ($this->doRemoveSpacesBetweenTags === true) { |
702 | 702 | // Remove spaces that are between > and < |
703 | - $html = (string)\preg_replace('/(>) (<)/', '>$2', $html); |
|
703 | + $html = (string) \preg_replace('/(>) (<)/', '>$2', $html); |
|
704 | 704 | } |
705 | 705 | |
706 | 706 | // ------------------------------------------------------------------------- |
707 | 707 | // Restore protected HTML-code. |
708 | 708 | // ------------------------------------------------------------------------- |
709 | 709 | |
710 | - $html = (string)\preg_replace_callback( |
|
711 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', |
|
710 | + $html = (string) \preg_replace_callback( |
|
711 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', |
|
712 | 712 | array($this, 'restoreProtectedHtml'), |
713 | 713 | $html |
714 | 714 | ); |
@@ -729,14 +729,14 @@ discard block |
||
729 | 729 | |
730 | 730 | $html = \str_replace( |
731 | 731 | array( |
732 | - 'html>' . "\n", |
|
733 | - "\n" . '<html', |
|
734 | - 'html/>' . "\n", |
|
735 | - "\n" . '</html', |
|
736 | - 'head>' . "\n", |
|
737 | - "\n" . '<head', |
|
738 | - 'head/>' . "\n", |
|
739 | - "\n" . '</head', |
|
732 | + 'html>'."\n", |
|
733 | + "\n".'<html', |
|
734 | + 'html/>'."\n", |
|
735 | + "\n".'</html', |
|
736 | + 'head>'."\n", |
|
737 | + "\n".'<head', |
|
738 | + 'head/>'."\n", |
|
739 | + "\n".'</head', |
|
740 | 740 | ), |
741 | 741 | array( |
742 | 742 | 'html>', |
@@ -755,10 +755,10 @@ discard block |
||
755 | 755 | $replace = array(); |
756 | 756 | $replacement = array(); |
757 | 757 | foreach (self::$selfClosingTags as $selfClosingTag) { |
758 | - $replace[] = '<' . $selfClosingTag . '/>'; |
|
759 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
760 | - $replace[] = '<' . $selfClosingTag . ' />'; |
|
761 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
758 | + $replace[] = '<'.$selfClosingTag.'/>'; |
|
759 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
760 | + $replace[] = '<'.$selfClosingTag.' />'; |
|
761 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
762 | 762 | } |
763 | 763 | $html = \str_replace( |
764 | 764 | $replace, |
@@ -861,7 +861,7 @@ discard block |
||
861 | 861 | } |
862 | 862 | |
863 | 863 | $attrs = array(); |
864 | - foreach ((array)$attributes as $attrName => $attrValue) { |
|
864 | + foreach ((array) $attributes as $attrName => $attrValue) { |
|
865 | 865 | |
866 | 866 | if (isset(self::$booleanAttributes[$attrName])) { |
867 | 867 | continue; |
@@ -940,7 +940,7 @@ discard block |
||
940 | 940 | } |
941 | 941 | |
942 | 942 | $this->protectedChildNodes[$counter] = $element->text(); |
943 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
943 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
944 | 944 | |
945 | 945 | ++$counter; |
946 | 946 | } |
@@ -955,11 +955,11 @@ discard block |
||
955 | 955 | continue; |
956 | 956 | } |
957 | 957 | |
958 | - $this->protectedChildNodes[$counter] = '<!--' . $text . '-->'; |
|
958 | + $this->protectedChildNodes[$counter] = '<!--'.$text.'-->'; |
|
959 | 959 | |
960 | 960 | /* @var $node \DOMComment */ |
961 | 961 | $node = $element->getNode(); |
962 | - $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $counter . '"></' . $this->protectedChildNodesHelper . '>'); |
|
962 | + $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$counter.'"></'.$this->protectedChildNodesHelper.'>'); |
|
963 | 963 | $element->getNode()->parentNode->replaceChild($child, $node); |
964 | 964 | |
965 | 965 | ++$counter; |
@@ -1156,7 +1156,7 @@ discard block |
||
1156 | 1156 | continue; |
1157 | 1157 | } |
1158 | 1158 | |
1159 | - $attrValue .= \trim($class) . ' '; |
|
1159 | + $attrValue .= \trim($class).' '; |
|
1160 | 1160 | } |
1161 | 1161 | $attrValue = \trim($attrValue); |
1162 | 1162 |