@@ -264,7 +264,7 @@ discard block |
||
264 | 264 | $attrName === 'action' |
265 | 265 | ) |
266 | 266 | ) { |
267 | - $attrValue = \str_replace($scheme . '://', '//', $attrValue); |
|
267 | + $attrValue = \str_replace($scheme.'://', '//', $attrValue); |
|
268 | 268 | } |
269 | 269 | |
270 | 270 | return $attrValue; |
@@ -293,7 +293,7 @@ discard block |
||
293 | 293 | continue; |
294 | 294 | } |
295 | 295 | |
296 | - $attrValue .= \trim($class) . ' '; |
|
296 | + $attrValue .= \trim($class).' '; |
|
297 | 297 | } |
298 | 298 | |
299 | 299 | return \trim($attrValue); |
@@ -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 | } |
@@ -935,8 +935,8 @@ discard block |
||
935 | 935 | } |
936 | 936 | |
937 | 937 | if ($child instanceof \DOMElement) { |
938 | - $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); |
|
939 | - $html .= '>' . $this->domNodeToString($child); |
|
938 | + $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child)); |
|
939 | + $html .= '>'.$this->domNodeToString($child); |
|
940 | 940 | |
941 | 941 | if ( |
942 | 942 | !( |
@@ -949,7 +949,7 @@ discard block |
||
949 | 949 | $this->domNodeClosingTagOptional($child) |
950 | 950 | ) |
951 | 951 | ) { |
952 | - $html .= '</' . $child->tagName . '>'; |
|
952 | + $html .= '</'.$child->tagName.'>'; |
|
953 | 953 | } |
954 | 954 | |
955 | 955 | if (!$this->doRemoveWhitespaceAroundTags) { |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | $html .= $child->wholeText; |
1014 | 1014 | } |
1015 | 1015 | } elseif ($child instanceof \DOMComment) { |
1016 | - $html .= '<!--' . $child->textContent . '-->'; |
|
1016 | + $html .= '<!--'.$child->textContent.'-->'; |
|
1017 | 1017 | } |
1018 | 1018 | } |
1019 | 1019 | |
@@ -1046,9 +1046,9 @@ discard block |
||
1046 | 1046 | $tmpTypePublic = 'PUBLIC'; |
1047 | 1047 | } |
1048 | 1048 | |
1049 | - return '<!DOCTYPE ' . $child->name . '' |
|
1050 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
1051 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
1049 | + return '<!DOCTYPE '.$child->name.'' |
|
1050 | + . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '') |
|
1051 | + . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '') |
|
1052 | 1052 | . '>'; |
1053 | 1053 | } |
1054 | 1054 | } |
@@ -1289,8 +1289,8 @@ discard block |
||
1289 | 1289 | if (\strpos($html, ' ') !== false) { |
1290 | 1290 | $html = (string) \preg_replace_callback( |
1291 | 1291 | '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#', |
1292 | - static function ($matches) { |
|
1293 | - return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>'; |
|
1292 | + static function($matches) { |
|
1293 | + return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>'; |
|
1294 | 1294 | }, |
1295 | 1295 | $html |
1296 | 1296 | ); |
@@ -1310,7 +1310,7 @@ discard block |
||
1310 | 1310 | |
1311 | 1311 | if (\strpos($html, $this->protectedChildNodesHelper) !== false) { |
1312 | 1312 | $html = (string) \preg_replace_callback( |
1313 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', |
|
1313 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', |
|
1314 | 1314 | [$this, 'restoreProtectedHtml'], |
1315 | 1315 | $html |
1316 | 1316 | ); |
@@ -1330,14 +1330,14 @@ discard block |
||
1330 | 1330 | |
1331 | 1331 | $html = \str_replace( |
1332 | 1332 | [ |
1333 | - 'html>' . "\n", |
|
1334 | - "\n" . '<html', |
|
1335 | - 'html/>' . "\n", |
|
1336 | - "\n" . '</html', |
|
1337 | - 'head>' . "\n", |
|
1338 | - "\n" . '<head', |
|
1339 | - 'head/>' . "\n", |
|
1340 | - "\n" . '</head', |
|
1333 | + 'html>'."\n", |
|
1334 | + "\n".'<html', |
|
1335 | + 'html/>'."\n", |
|
1336 | + "\n".'</html', |
|
1337 | + 'head>'."\n", |
|
1338 | + "\n".'<head', |
|
1339 | + 'head/>'."\n", |
|
1340 | + "\n".'</head', |
|
1341 | 1341 | ], |
1342 | 1342 | [ |
1343 | 1343 | 'html>', |
@@ -1356,11 +1356,11 @@ discard block |
||
1356 | 1356 | $replace = []; |
1357 | 1357 | $replacement = []; |
1358 | 1358 | foreach (self::$selfClosingTags as $selfClosingTag) { |
1359 | - $replace[] = '<' . $selfClosingTag . '/>'; |
|
1360 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
1361 | - $replace[] = '<' . $selfClosingTag . ' />'; |
|
1362 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
1363 | - $replace[] = '></' . $selfClosingTag . '>'; |
|
1359 | + $replace[] = '<'.$selfClosingTag.'/>'; |
|
1360 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
1361 | + $replace[] = '<'.$selfClosingTag.' />'; |
|
1362 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
1363 | + $replace[] = '></'.$selfClosingTag.'>'; |
|
1364 | 1364 | $replacement[] = '>'; |
1365 | 1365 | } |
1366 | 1366 | $html = \str_replace( |
@@ -1515,7 +1515,7 @@ discard block |
||
1515 | 1515 | // ------------------------------------------------------------------------- |
1516 | 1516 | |
1517 | 1517 | return $dom->fixHtmlOutput( |
1518 | - $doctypeStr . $this->domNodeToString($dom->getDocument()), |
|
1518 | + $doctypeStr.$this->domNodeToString($dom->getDocument()), |
|
1519 | 1519 | $multiDecodeNewHtmlEntity |
1520 | 1520 | ); |
1521 | 1521 | } |
@@ -1560,7 +1560,7 @@ discard block |
||
1560 | 1560 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->parentNode()->innerHtml(); |
1561 | 1561 | $parentNode = $element->getNode()->parentNode; |
1562 | 1562 | if ($parentNode !== null) { |
1563 | - $parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
1563 | + $parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
1564 | 1564 | } |
1565 | 1565 | |
1566 | 1566 | ++$this->protected_tags_counter; |
@@ -1594,7 +1594,7 @@ discard block |
||
1594 | 1594 | } |
1595 | 1595 | |
1596 | 1596 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->innerhtml; |
1597 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
1597 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
1598 | 1598 | |
1599 | 1599 | ++$this->protected_tags_counter; |
1600 | 1600 | } |
@@ -1611,11 +1611,11 @@ discard block |
||
1611 | 1611 | continue; |
1612 | 1612 | } |
1613 | 1613 | |
1614 | - $this->protectedChildNodes[$this->protected_tags_counter] = '<!--' . $text . '-->'; |
|
1614 | + $this->protectedChildNodes[$this->protected_tags_counter] = '<!--'.$text.'-->'; |
|
1615 | 1615 | |
1616 | 1616 | /* @var $node \DOMComment */ |
1617 | 1617 | $node = $element->getNode(); |
1618 | - $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'); |
|
1618 | + $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'); |
|
1619 | 1619 | $parentNode = $element->getNode()->parentNode; |
1620 | 1620 | if ($parentNode !== null) { |
1621 | 1621 | $parentNode->replaceChild($child, $node); |
@@ -761,214 +761,214 @@ discard block |
||
761 | 761 | return \in_array($tag_name, self::$optional_end_tags, true) |
762 | 762 | || |
763 | 763 | ( |
764 | - $tag_name === 'li' |
|
764 | + $tag_name === 'li' |
|
765 | 765 | && |
766 | 766 | ( |
767 | - $nextSibling === null |
|
767 | + $nextSibling === null |
|
768 | 768 | || |
769 | 769 | ( |
770 | - $nextSibling instanceof \DOMElement |
|
770 | + $nextSibling instanceof \DOMElement |
|
771 | 771 | && |
772 | 772 | $nextSibling->tagName === 'li' |
773 | - ) |
|
774 | - ) |
|
775 | - ) |
|
773 | + ) |
|
774 | + ) |
|
775 | + ) |
|
776 | 776 | || |
777 | 777 | ( |
778 | - $tag_name === 'optgroup' |
|
778 | + $tag_name === 'optgroup' |
|
779 | 779 | && |
780 | 780 | ( |
781 | - $nextSibling === null |
|
781 | + $nextSibling === null |
|
782 | 782 | || |
783 | 783 | ( |
784 | - $nextSibling instanceof \DOMElement |
|
784 | + $nextSibling instanceof \DOMElement |
|
785 | 785 | && |
786 | 786 | $nextSibling->tagName === 'optgroup' |
787 | - ) |
|
788 | - ) |
|
789 | - ) |
|
787 | + ) |
|
788 | + ) |
|
789 | + ) |
|
790 | 790 | || |
791 | 791 | ( |
792 | - $tag_name === 'rp' |
|
792 | + $tag_name === 'rp' |
|
793 | 793 | && |
794 | 794 | ( |
795 | - $nextSibling === null |
|
795 | + $nextSibling === null |
|
796 | 796 | || |
797 | 797 | ( |
798 | - $nextSibling instanceof \DOMElement |
|
798 | + $nextSibling instanceof \DOMElement |
|
799 | 799 | && |
800 | 800 | ( |
801 | - $nextSibling->tagName === 'rp' |
|
801 | + $nextSibling->tagName === 'rp' |
|
802 | 802 | || |
803 | 803 | $nextSibling->tagName === 'rt' |
804 | - ) |
|
805 | - ) |
|
806 | - ) |
|
807 | - ) |
|
804 | + ) |
|
805 | + ) |
|
806 | + ) |
|
807 | + ) |
|
808 | 808 | || |
809 | 809 | ( |
810 | - $tag_name === 'tr' |
|
810 | + $tag_name === 'tr' |
|
811 | 811 | && |
812 | 812 | ( |
813 | - $nextSibling === null |
|
813 | + $nextSibling === null |
|
814 | 814 | || |
815 | 815 | ( |
816 | - $nextSibling instanceof \DOMElement |
|
816 | + $nextSibling instanceof \DOMElement |
|
817 | 817 | && |
818 | 818 | $nextSibling->tagName === 'tr' |
819 | - ) |
|
820 | - ) |
|
821 | - ) |
|
819 | + ) |
|
820 | + ) |
|
821 | + ) |
|
822 | 822 | || |
823 | 823 | ( |
824 | - $tag_name === 'source' |
|
824 | + $tag_name === 'source' |
|
825 | 825 | && |
826 | 826 | ( |
827 | - $parent_tag_name === 'audio' |
|
827 | + $parent_tag_name === 'audio' |
|
828 | 828 | || |
829 | 829 | $parent_tag_name === 'video' |
830 | 830 | || |
831 | 831 | $parent_tag_name === 'picture' |
832 | 832 | || |
833 | 833 | $parent_tag_name === 'source' |
834 | - ) |
|
834 | + ) |
|
835 | 835 | && |
836 | 836 | ( |
837 | - $nextSibling === null |
|
837 | + $nextSibling === null |
|
838 | 838 | || |
839 | 839 | ( |
840 | - $nextSibling instanceof \DOMElement |
|
840 | + $nextSibling instanceof \DOMElement |
|
841 | 841 | && |
842 | 842 | $nextSibling->tagName === 'source' |
843 | - ) |
|
844 | - ) |
|
845 | - ) |
|
843 | + ) |
|
844 | + ) |
|
845 | + ) |
|
846 | 846 | || |
847 | 847 | ( |
848 | - ( |
|
849 | - $tag_name === 'td' |
|
848 | + ( |
|
849 | + $tag_name === 'td' |
|
850 | 850 | || |
851 | 851 | $tag_name === 'th' |
852 | - ) |
|
852 | + ) |
|
853 | 853 | && |
854 | 854 | ( |
855 | - $nextSibling === null |
|
855 | + $nextSibling === null |
|
856 | 856 | || |
857 | 857 | ( |
858 | - $nextSibling instanceof \DOMElement |
|
858 | + $nextSibling instanceof \DOMElement |
|
859 | 859 | && |
860 | 860 | ( |
861 | - $nextSibling->tagName === 'td' |
|
861 | + $nextSibling->tagName === 'td' |
|
862 | 862 | || |
863 | 863 | $nextSibling->tagName === 'th' |
864 | - ) |
|
865 | - ) |
|
866 | - ) |
|
867 | - ) |
|
864 | + ) |
|
865 | + ) |
|
866 | + ) |
|
867 | + ) |
|
868 | 868 | || |
869 | 869 | ( |
870 | - ( |
|
871 | - $tag_name === 'dd' |
|
870 | + ( |
|
871 | + $tag_name === 'dd' |
|
872 | 872 | || |
873 | 873 | $tag_name === 'dt' |
874 | - ) |
|
874 | + ) |
|
875 | 875 | && |
876 | 876 | ( |
877 | - $nextSibling === null |
|
877 | + $nextSibling === null |
|
878 | 878 | || |
879 | 879 | ( |
880 | - $nextSibling instanceof \DOMElement |
|
880 | + $nextSibling instanceof \DOMElement |
|
881 | 881 | && |
882 | 882 | ( |
883 | - $nextSibling->tagName === 'dd' |
|
883 | + $nextSibling->tagName === 'dd' |
|
884 | 884 | || |
885 | 885 | $nextSibling->tagName === 'dt' |
886 | - ) |
|
887 | - ) |
|
888 | - ) |
|
889 | - ) |
|
886 | + ) |
|
887 | + ) |
|
888 | + ) |
|
889 | + ) |
|
890 | 890 | || |
891 | 891 | ( |
892 | - $tag_name === 'option' |
|
892 | + $tag_name === 'option' |
|
893 | 893 | && |
894 | 894 | ( |
895 | - $nextSibling === null |
|
895 | + $nextSibling === null |
|
896 | 896 | || |
897 | 897 | ( |
898 | - $nextSibling instanceof \DOMElement |
|
898 | + $nextSibling instanceof \DOMElement |
|
899 | 899 | && |
900 | 900 | ( |
901 | - $nextSibling->tagName === 'option' |
|
901 | + $nextSibling->tagName === 'option' |
|
902 | 902 | || |
903 | 903 | $nextSibling->tagName === 'optgroup' |
904 | - ) |
|
905 | - ) |
|
906 | - ) |
|
907 | - ) |
|
904 | + ) |
|
905 | + ) |
|
906 | + ) |
|
907 | + ) |
|
908 | 908 | || |
909 | 909 | ( |
910 | - $tag_name === 'p' |
|
910 | + $tag_name === 'p' |
|
911 | 911 | && |
912 | 912 | ( |
913 | - ( |
|
914 | - $nextSibling === null |
|
913 | + ( |
|
914 | + $nextSibling === null |
|
915 | 915 | && |
916 | 916 | $node->parentNode !== null |
917 | 917 | && |
918 | 918 | !\in_array( |
919 | - $node->parentNode->nodeName, |
|
920 | - [ |
|
921 | - 'a', |
|
922 | - 'audio', |
|
923 | - 'del', |
|
924 | - 'ins', |
|
925 | - 'map', |
|
926 | - 'noscript', |
|
927 | - 'video', |
|
928 | - ], |
|
929 | - true |
|
930 | - ) |
|
931 | - ) |
|
919 | + $node->parentNode->nodeName, |
|
920 | + [ |
|
921 | + 'a', |
|
922 | + 'audio', |
|
923 | + 'del', |
|
924 | + 'ins', |
|
925 | + 'map', |
|
926 | + 'noscript', |
|
927 | + 'video', |
|
928 | + ], |
|
929 | + true |
|
930 | + ) |
|
931 | + ) |
|
932 | 932 | || |
933 | 933 | ( |
934 | - $nextSibling instanceof \DOMElement |
|
934 | + $nextSibling instanceof \DOMElement |
|
935 | 935 | && |
936 | 936 | \in_array( |
937 | - $nextSibling->tagName, |
|
938 | - [ |
|
939 | - 'address', |
|
940 | - 'article', |
|
941 | - 'aside', |
|
942 | - 'blockquote', |
|
943 | - 'dir', |
|
944 | - 'div', |
|
945 | - 'dl', |
|
946 | - 'fieldset', |
|
947 | - 'footer', |
|
948 | - 'form', |
|
949 | - 'h1', |
|
950 | - 'h2', |
|
951 | - 'h3', |
|
952 | - 'h4', |
|
953 | - 'h5', |
|
954 | - 'h6', |
|
955 | - 'header', |
|
956 | - 'hgroup', |
|
957 | - 'hr', |
|
958 | - 'menu', |
|
959 | - 'nav', |
|
960 | - 'ol', |
|
961 | - 'p', |
|
962 | - 'pre', |
|
963 | - 'section', |
|
964 | - 'table', |
|
965 | - 'ul', |
|
966 | - ], |
|
967 | - true |
|
968 | - ) |
|
969 | - ) |
|
970 | - ) |
|
971 | - ); |
|
937 | + $nextSibling->tagName, |
|
938 | + [ |
|
939 | + 'address', |
|
940 | + 'article', |
|
941 | + 'aside', |
|
942 | + 'blockquote', |
|
943 | + 'dir', |
|
944 | + 'div', |
|
945 | + 'dl', |
|
946 | + 'fieldset', |
|
947 | + 'footer', |
|
948 | + 'form', |
|
949 | + 'h1', |
|
950 | + 'h2', |
|
951 | + 'h3', |
|
952 | + 'h4', |
|
953 | + 'h5', |
|
954 | + 'h6', |
|
955 | + 'header', |
|
956 | + 'hgroup', |
|
957 | + 'hr', |
|
958 | + 'menu', |
|
959 | + 'nav', |
|
960 | + 'ol', |
|
961 | + 'p', |
|
962 | + 'pre', |
|
963 | + 'section', |
|
964 | + 'table', |
|
965 | + 'ul', |
|
966 | + ], |
|
967 | + true |
|
968 | + ) |
|
969 | + ) |
|
970 | + ) |
|
971 | + ); |
|
972 | 972 | } |
973 | 973 | |
974 | 974 | protected function domNodeToString(\DOMNode $node): string |
@@ -1097,9 +1097,9 @@ discard block |
||
1097 | 1097 | } |
1098 | 1098 | |
1099 | 1099 | return '<!DOCTYPE ' . $child->name . '' |
1100 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
1101 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
1102 | - . '>'; |
|
1100 | + . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
1101 | + . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
1102 | + . '>'; |
|
1103 | 1103 | } |
1104 | 1104 | } |
1105 | 1105 |