@@ -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); |
@@ -770,214 +770,214 @@ discard block |
||
770 | 770 | return \in_array($tag_name, self::$optional_end_tags, true) |
771 | 771 | || |
772 | 772 | ( |
773 | - $tag_name === 'li' |
|
773 | + $tag_name === 'li' |
|
774 | 774 | && |
775 | 775 | ( |
776 | - $nextSibling === null |
|
776 | + $nextSibling === null |
|
777 | 777 | || |
778 | 778 | ( |
779 | - $nextSibling instanceof \DOMElement |
|
779 | + $nextSibling instanceof \DOMElement |
|
780 | 780 | && |
781 | 781 | $nextSibling->tagName === 'li' |
782 | - ) |
|
783 | - ) |
|
784 | - ) |
|
782 | + ) |
|
783 | + ) |
|
784 | + ) |
|
785 | 785 | || |
786 | 786 | ( |
787 | - $tag_name === 'optgroup' |
|
787 | + $tag_name === 'optgroup' |
|
788 | 788 | && |
789 | 789 | ( |
790 | - $nextSibling === null |
|
790 | + $nextSibling === null |
|
791 | 791 | || |
792 | 792 | ( |
793 | - $nextSibling instanceof \DOMElement |
|
793 | + $nextSibling instanceof \DOMElement |
|
794 | 794 | && |
795 | 795 | $nextSibling->tagName === 'optgroup' |
796 | - ) |
|
797 | - ) |
|
798 | - ) |
|
796 | + ) |
|
797 | + ) |
|
798 | + ) |
|
799 | 799 | || |
800 | 800 | ( |
801 | - $tag_name === 'rp' |
|
801 | + $tag_name === 'rp' |
|
802 | 802 | && |
803 | 803 | ( |
804 | - $nextSibling === null |
|
804 | + $nextSibling === null |
|
805 | 805 | || |
806 | 806 | ( |
807 | - $nextSibling instanceof \DOMElement |
|
807 | + $nextSibling instanceof \DOMElement |
|
808 | 808 | && |
809 | 809 | ( |
810 | - $nextSibling->tagName === 'rp' |
|
810 | + $nextSibling->tagName === 'rp' |
|
811 | 811 | || |
812 | 812 | $nextSibling->tagName === 'rt' |
813 | - ) |
|
814 | - ) |
|
815 | - ) |
|
816 | - ) |
|
813 | + ) |
|
814 | + ) |
|
815 | + ) |
|
816 | + ) |
|
817 | 817 | || |
818 | 818 | ( |
819 | - $tag_name === 'tr' |
|
819 | + $tag_name === 'tr' |
|
820 | 820 | && |
821 | 821 | ( |
822 | - $nextSibling === null |
|
822 | + $nextSibling === null |
|
823 | 823 | || |
824 | 824 | ( |
825 | - $nextSibling instanceof \DOMElement |
|
825 | + $nextSibling instanceof \DOMElement |
|
826 | 826 | && |
827 | 827 | $nextSibling->tagName === 'tr' |
828 | - ) |
|
829 | - ) |
|
830 | - ) |
|
828 | + ) |
|
829 | + ) |
|
830 | + ) |
|
831 | 831 | || |
832 | 832 | ( |
833 | - $tag_name === 'source' |
|
833 | + $tag_name === 'source' |
|
834 | 834 | && |
835 | 835 | ( |
836 | - $parent_tag_name === 'audio' |
|
836 | + $parent_tag_name === 'audio' |
|
837 | 837 | || |
838 | 838 | $parent_tag_name === 'video' |
839 | 839 | || |
840 | 840 | $parent_tag_name === 'picture' |
841 | 841 | || |
842 | 842 | $parent_tag_name === 'source' |
843 | - ) |
|
843 | + ) |
|
844 | 844 | && |
845 | 845 | ( |
846 | - $nextSibling === null |
|
846 | + $nextSibling === null |
|
847 | 847 | || |
848 | 848 | ( |
849 | - $nextSibling instanceof \DOMElement |
|
849 | + $nextSibling instanceof \DOMElement |
|
850 | 850 | && |
851 | 851 | $nextSibling->tagName === 'source' |
852 | - ) |
|
853 | - ) |
|
854 | - ) |
|
852 | + ) |
|
853 | + ) |
|
854 | + ) |
|
855 | 855 | || |
856 | 856 | ( |
857 | - ( |
|
858 | - $tag_name === 'td' |
|
857 | + ( |
|
858 | + $tag_name === 'td' |
|
859 | 859 | || |
860 | 860 | $tag_name === 'th' |
861 | - ) |
|
861 | + ) |
|
862 | 862 | && |
863 | 863 | ( |
864 | - $nextSibling === null |
|
864 | + $nextSibling === null |
|
865 | 865 | || |
866 | 866 | ( |
867 | - $nextSibling instanceof \DOMElement |
|
867 | + $nextSibling instanceof \DOMElement |
|
868 | 868 | && |
869 | 869 | ( |
870 | - $nextSibling->tagName === 'td' |
|
870 | + $nextSibling->tagName === 'td' |
|
871 | 871 | || |
872 | 872 | $nextSibling->tagName === 'th' |
873 | - ) |
|
874 | - ) |
|
875 | - ) |
|
876 | - ) |
|
873 | + ) |
|
874 | + ) |
|
875 | + ) |
|
876 | + ) |
|
877 | 877 | || |
878 | 878 | ( |
879 | - ( |
|
880 | - $tag_name === 'dd' |
|
879 | + ( |
|
880 | + $tag_name === 'dd' |
|
881 | 881 | || |
882 | 882 | $tag_name === 'dt' |
883 | - ) |
|
883 | + ) |
|
884 | 884 | && |
885 | 885 | ( |
886 | - $nextSibling === null |
|
886 | + $nextSibling === null |
|
887 | 887 | || |
888 | 888 | ( |
889 | - $nextSibling instanceof \DOMElement |
|
889 | + $nextSibling instanceof \DOMElement |
|
890 | 890 | && |
891 | 891 | ( |
892 | - $nextSibling->tagName === 'dd' |
|
892 | + $nextSibling->tagName === 'dd' |
|
893 | 893 | || |
894 | 894 | $nextSibling->tagName === 'dt' |
895 | - ) |
|
896 | - ) |
|
897 | - ) |
|
898 | - ) |
|
895 | + ) |
|
896 | + ) |
|
897 | + ) |
|
898 | + ) |
|
899 | 899 | || |
900 | 900 | ( |
901 | - $tag_name === 'option' |
|
901 | + $tag_name === 'option' |
|
902 | 902 | && |
903 | 903 | ( |
904 | - $nextSibling === null |
|
904 | + $nextSibling === null |
|
905 | 905 | || |
906 | 906 | ( |
907 | - $nextSibling instanceof \DOMElement |
|
907 | + $nextSibling instanceof \DOMElement |
|
908 | 908 | && |
909 | 909 | ( |
910 | - $nextSibling->tagName === 'option' |
|
910 | + $nextSibling->tagName === 'option' |
|
911 | 911 | || |
912 | 912 | $nextSibling->tagName === 'optgroup' |
913 | - ) |
|
914 | - ) |
|
915 | - ) |
|
916 | - ) |
|
913 | + ) |
|
914 | + ) |
|
915 | + ) |
|
916 | + ) |
|
917 | 917 | || |
918 | 918 | ( |
919 | - $tag_name === 'p' |
|
919 | + $tag_name === 'p' |
|
920 | 920 | && |
921 | 921 | ( |
922 | - ( |
|
923 | - $nextSibling === null |
|
922 | + ( |
|
923 | + $nextSibling === null |
|
924 | 924 | && |
925 | 925 | $node->parentNode !== null |
926 | 926 | && |
927 | 927 | !\in_array( |
928 | - $node->parentNode->nodeName, |
|
929 | - [ |
|
930 | - 'a', |
|
931 | - 'audio', |
|
932 | - 'del', |
|
933 | - 'ins', |
|
934 | - 'map', |
|
935 | - 'noscript', |
|
936 | - 'video', |
|
937 | - ], |
|
938 | - true |
|
939 | - ) |
|
940 | - ) |
|
928 | + $node->parentNode->nodeName, |
|
929 | + [ |
|
930 | + 'a', |
|
931 | + 'audio', |
|
932 | + 'del', |
|
933 | + 'ins', |
|
934 | + 'map', |
|
935 | + 'noscript', |
|
936 | + 'video', |
|
937 | + ], |
|
938 | + true |
|
939 | + ) |
|
940 | + ) |
|
941 | 941 | || |
942 | 942 | ( |
943 | - $nextSibling instanceof \DOMElement |
|
943 | + $nextSibling instanceof \DOMElement |
|
944 | 944 | && |
945 | 945 | \in_array( |
946 | - $nextSibling->tagName, |
|
947 | - [ |
|
948 | - 'address', |
|
949 | - 'article', |
|
950 | - 'aside', |
|
951 | - 'blockquote', |
|
952 | - 'dir', |
|
953 | - 'div', |
|
954 | - 'dl', |
|
955 | - 'fieldset', |
|
956 | - 'footer', |
|
957 | - 'form', |
|
958 | - 'h1', |
|
959 | - 'h2', |
|
960 | - 'h3', |
|
961 | - 'h4', |
|
962 | - 'h5', |
|
963 | - 'h6', |
|
964 | - 'header', |
|
965 | - 'hgroup', |
|
966 | - 'hr', |
|
967 | - 'menu', |
|
968 | - 'nav', |
|
969 | - 'ol', |
|
970 | - 'p', |
|
971 | - 'pre', |
|
972 | - 'section', |
|
973 | - 'table', |
|
974 | - 'ul', |
|
975 | - ], |
|
976 | - true |
|
977 | - ) |
|
978 | - ) |
|
979 | - ) |
|
980 | - ); |
|
946 | + $nextSibling->tagName, |
|
947 | + [ |
|
948 | + 'address', |
|
949 | + 'article', |
|
950 | + 'aside', |
|
951 | + 'blockquote', |
|
952 | + 'dir', |
|
953 | + 'div', |
|
954 | + 'dl', |
|
955 | + 'fieldset', |
|
956 | + 'footer', |
|
957 | + 'form', |
|
958 | + 'h1', |
|
959 | + 'h2', |
|
960 | + 'h3', |
|
961 | + 'h4', |
|
962 | + 'h5', |
|
963 | + 'h6', |
|
964 | + 'header', |
|
965 | + 'hgroup', |
|
966 | + 'hr', |
|
967 | + 'menu', |
|
968 | + 'nav', |
|
969 | + 'ol', |
|
970 | + 'p', |
|
971 | + 'pre', |
|
972 | + 'section', |
|
973 | + 'table', |
|
974 | + 'ul', |
|
975 | + ], |
|
976 | + true |
|
977 | + ) |
|
978 | + ) |
|
979 | + ) |
|
980 | + ); |
|
981 | 981 | } |
982 | 982 | |
983 | 983 | protected function domNodeToString(\DOMNode $node): string |
@@ -1107,9 +1107,9 @@ discard block |
||
1107 | 1107 | } |
1108 | 1108 | |
1109 | 1109 | return '<!DOCTYPE ' . $child->name |
1110 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
1111 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
1112 | - . '>'; |
|
1110 | + . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
1111 | + . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
1112 | + . '>'; |
|
1113 | 1113 | } |
1114 | 1114 | } |
1115 | 1115 |
@@ -708,7 +708,7 @@ discard block |
||
708 | 708 | $attr_val = $attribute->value; |
709 | 709 | } |
710 | 710 | |
711 | - $attr_str .= ($omit_quotes ? '' : $quoteTmp) . $attr_val . ($omit_quotes ? '' : $quoteTmp); |
|
711 | + $attr_str .= ($omit_quotes ? '' : $quoteTmp).$attr_val.($omit_quotes ? '' : $quoteTmp); |
|
712 | 712 | $attr_str .= ' '; |
713 | 713 | } |
714 | 714 | } |
@@ -999,8 +999,8 @@ discard block |
||
999 | 999 | } |
1000 | 1000 | |
1001 | 1001 | if ($child instanceof \DOMElement) { |
1002 | - $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); |
|
1003 | - $html .= '>' . $this->domNodeToString($child); |
|
1002 | + $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child)); |
|
1003 | + $html .= '>'.$this->domNodeToString($child); |
|
1004 | 1004 | |
1005 | 1005 | if ( |
1006 | 1006 | !( |
@@ -1013,7 +1013,7 @@ discard block |
||
1013 | 1013 | $this->domNodeClosingTagOptional($child) |
1014 | 1014 | ) |
1015 | 1015 | ) { |
1016 | - $html .= '</' . $child->tagName . '>'; |
|
1016 | + $html .= '</'.$child->tagName.'>'; |
|
1017 | 1017 | } |
1018 | 1018 | |
1019 | 1019 | if (!$this->doRemoveWhitespaceAroundTags) { |
@@ -1078,7 +1078,7 @@ discard block |
||
1078 | 1078 | $html .= $child->wholeText; |
1079 | 1079 | } |
1080 | 1080 | } elseif ($child instanceof \DOMComment) { |
1081 | - $html .= '<!--' . $child->textContent . '-->'; |
|
1081 | + $html .= '<!--'.$child->textContent.'-->'; |
|
1082 | 1082 | } |
1083 | 1083 | } |
1084 | 1084 | |
@@ -1111,9 +1111,9 @@ discard block |
||
1111 | 1111 | $tmpTypePublic = 'PUBLIC'; |
1112 | 1112 | } |
1113 | 1113 | |
1114 | - return '<!DOCTYPE ' . $child->name |
|
1115 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
1116 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
1114 | + return '<!DOCTYPE '.$child->name |
|
1115 | + . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '') |
|
1116 | + . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '') |
|
1117 | 1117 | . '>'; |
1118 | 1118 | } |
1119 | 1119 | } |
@@ -1378,18 +1378,18 @@ discard block |
||
1378 | 1378 | if (\strpos($html, ' ') !== false) { |
1379 | 1379 | $htmlCleaned = \preg_replace_callback( |
1380 | 1380 | '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#', |
1381 | - static function ($matches) { |
|
1382 | - return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>'; |
|
1381 | + static function($matches) { |
|
1382 | + return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>'; |
|
1383 | 1383 | }, |
1384 | 1384 | $html |
1385 | 1385 | ); |
1386 | 1386 | if ($htmlCleaned !== null) { |
1387 | - $html = (string)$htmlCleaned; |
|
1387 | + $html = (string) $htmlCleaned; |
|
1388 | 1388 | } else { |
1389 | 1389 | $htmlCleaned = (string) \preg_replace_callback( |
1390 | 1390 | '#<([^/\s<>!]+)(?:\s+([^<>]*)\s*|\s*)(/?)>#', |
1391 | - static function ($matches) { |
|
1392 | - return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>'; |
|
1391 | + static function($matches) { |
|
1392 | + return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>'; |
|
1393 | 1393 | }, |
1394 | 1394 | $html |
1395 | 1395 | ); |
@@ -1411,7 +1411,7 @@ discard block |
||
1411 | 1411 | |
1412 | 1412 | if (\strpos($html, $this->protectedChildNodesHelper) !== false) { |
1413 | 1413 | $html = (string) \preg_replace_callback( |
1414 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', |
|
1414 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', |
|
1415 | 1415 | [$this, 'restoreProtectedHtml'], |
1416 | 1416 | $html |
1417 | 1417 | ); |
@@ -1431,14 +1431,14 @@ discard block |
||
1431 | 1431 | |
1432 | 1432 | $html = \str_replace( |
1433 | 1433 | [ |
1434 | - 'html>' . "\n", |
|
1435 | - "\n" . '<html', |
|
1436 | - 'html/>' . "\n", |
|
1437 | - "\n" . '</html', |
|
1438 | - 'head>' . "\n", |
|
1439 | - "\n" . '<head', |
|
1440 | - 'head/>' . "\n", |
|
1441 | - "\n" . '</head', |
|
1434 | + 'html>'."\n", |
|
1435 | + "\n".'<html', |
|
1436 | + 'html/>'."\n", |
|
1437 | + "\n".'</html', |
|
1438 | + 'head>'."\n", |
|
1439 | + "\n".'<head', |
|
1440 | + 'head/>'."\n", |
|
1441 | + "\n".'</head', |
|
1442 | 1442 | ], |
1443 | 1443 | [ |
1444 | 1444 | 'html>', |
@@ -1457,11 +1457,11 @@ discard block |
||
1457 | 1457 | $replace = []; |
1458 | 1458 | $replacement = []; |
1459 | 1459 | foreach (self::$selfClosingTags as $selfClosingTag) { |
1460 | - $replace[] = '<' . $selfClosingTag . '/>'; |
|
1461 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
1462 | - $replace[] = '<' . $selfClosingTag . ' />'; |
|
1463 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
1464 | - $replace[] = '></' . $selfClosingTag . '>'; |
|
1460 | + $replace[] = '<'.$selfClosingTag.'/>'; |
|
1461 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
1462 | + $replace[] = '<'.$selfClosingTag.' />'; |
|
1463 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
1464 | + $replace[] = '></'.$selfClosingTag.'>'; |
|
1465 | 1465 | $replacement[] = '>'; |
1466 | 1466 | } |
1467 | 1467 | $html = \str_replace( |
@@ -1671,7 +1671,7 @@ discard block |
||
1671 | 1671 | // ------------------------------------------------------------------------- |
1672 | 1672 | |
1673 | 1673 | return $dom->fixHtmlOutput( |
1674 | - $doctypeStr . $this->domNodeToString($dom->getDocument()), |
|
1674 | + $doctypeStr.$this->domNodeToString($dom->getDocument()), |
|
1675 | 1675 | $multiDecodeNewHtmlEntity |
1676 | 1676 | ); |
1677 | 1677 | } |
@@ -1716,7 +1716,7 @@ discard block |
||
1716 | 1716 | $parentNode = $element->parentNode(); |
1717 | 1717 | if ($parentNode->nodeValue !== null) { |
1718 | 1718 | $this->protectedChildNodes[$this->protected_tags_counter] = $parentNode->innerHtml(); |
1719 | - $parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
1719 | + $parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
1720 | 1720 | } |
1721 | 1721 | |
1722 | 1722 | ++$this->protected_tags_counter; |
@@ -1750,7 +1750,7 @@ discard block |
||
1750 | 1750 | } |
1751 | 1751 | |
1752 | 1752 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->innerhtml; |
1753 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
1753 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
1754 | 1754 | |
1755 | 1755 | ++$this->protected_tags_counter; |
1756 | 1756 | } |
@@ -1770,11 +1770,11 @@ discard block |
||
1770 | 1770 | continue; |
1771 | 1771 | } |
1772 | 1772 | |
1773 | - $this->protectedChildNodes[$this->protected_tags_counter] = '<!--' . $text . '-->'; |
|
1773 | + $this->protectedChildNodes[$this->protected_tags_counter] = '<!--'.$text.'-->'; |
|
1774 | 1774 | |
1775 | 1775 | /* @var $node \DOMComment */ |
1776 | 1776 | $node = $element->getNode(); |
1777 | - $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'); |
|
1777 | + $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'); |
|
1778 | 1778 | $parentNode = $element->getNode()->parentNode; |
1779 | 1779 | if ($parentNode !== null) { |
1780 | 1780 | $parentNode->replaceChild($child, $node); |
@@ -1907,7 +1907,7 @@ discard block |
||
1907 | 1907 | |
1908 | 1908 | $doSkip = false; |
1909 | 1909 | foreach (self::$skipTagsForRemoveWhitespace as $pattern) { |
1910 | - if (\strpos($xp, '/' . $pattern) !== false) { |
|
1910 | + if (\strpos($xp, '/'.$pattern) !== false) { |
|
1911 | 1911 | $doSkip = true; |
1912 | 1912 | |
1913 | 1913 | break; |