@@ -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 |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | $attr_val = $attribute->value; |
704 | 704 | } |
705 | 705 | |
706 | - $attr_str .= ($omit_quotes ? '' : $quoteTmp) . $attr_val . ($omit_quotes ? '' : $quoteTmp); |
|
706 | + $attr_str .= ($omit_quotes ? '' : $quoteTmp).$attr_val.($omit_quotes ? '' : $quoteTmp); |
|
707 | 707 | $attr_str .= ' '; |
708 | 708 | } |
709 | 709 | } |
@@ -994,8 +994,8 @@ discard block |
||
994 | 994 | } |
995 | 995 | |
996 | 996 | if ($child instanceof \DOMElement) { |
997 | - $html .= \rtrim('<' . $child->tagName . ' ' . $this->domNodeAttributesToString($child)); |
|
998 | - $html .= '>' . $this->domNodeToString($child); |
|
997 | + $html .= \rtrim('<'.$child->tagName.' '.$this->domNodeAttributesToString($child)); |
|
998 | + $html .= '>'.$this->domNodeToString($child); |
|
999 | 999 | |
1000 | 1000 | if ( |
1001 | 1001 | !( |
@@ -1008,7 +1008,7 @@ discard block |
||
1008 | 1008 | $this->domNodeClosingTagOptional($child) |
1009 | 1009 | ) |
1010 | 1010 | ) { |
1011 | - $html .= '</' . $child->tagName . '>'; |
|
1011 | + $html .= '</'.$child->tagName.'>'; |
|
1012 | 1012 | } |
1013 | 1013 | |
1014 | 1014 | if (!$this->doRemoveWhitespaceAroundTags) { |
@@ -1073,7 +1073,7 @@ discard block |
||
1073 | 1073 | $html .= $child->wholeText; |
1074 | 1074 | } |
1075 | 1075 | } elseif ($child instanceof \DOMComment) { |
1076 | - $html .= '<!--' . $child->textContent . '-->'; |
|
1076 | + $html .= '<!--'.$child->textContent.'-->'; |
|
1077 | 1077 | } |
1078 | 1078 | } |
1079 | 1079 | |
@@ -1106,9 +1106,9 @@ discard block |
||
1106 | 1106 | $tmpTypePublic = 'PUBLIC'; |
1107 | 1107 | } |
1108 | 1108 | |
1109 | - return '<!DOCTYPE ' . $child->name |
|
1110 | - . ($child->publicId ? ' ' . $tmpTypePublic . ' "' . $child->publicId . '"' : '') |
|
1111 | - . ($child->systemId ? ' ' . $tmpTypeSystem . ' "' . $child->systemId . '"' : '') |
|
1109 | + return '<!DOCTYPE '.$child->name |
|
1110 | + . ($child->publicId ? ' '.$tmpTypePublic.' "'.$child->publicId.'"' : '') |
|
1111 | + . ($child->systemId ? ' '.$tmpTypeSystem.' "'.$child->systemId.'"' : '') |
|
1112 | 1112 | . '>'; |
1113 | 1113 | } |
1114 | 1114 | } |
@@ -1373,18 +1373,18 @@ discard block |
||
1373 | 1373 | if (\strpos($html, ' ') !== false) { |
1374 | 1374 | $htmlCleaned = \preg_replace_callback( |
1375 | 1375 | '#<([^/\s<>!]+)(?:\s+([^<>]*?)\s*|\s*)(/?)>#', |
1376 | - static function ($matches) { |
|
1377 | - return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>'; |
|
1376 | + static function($matches) { |
|
1377 | + return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>'; |
|
1378 | 1378 | }, |
1379 | 1379 | $html |
1380 | 1380 | ); |
1381 | 1381 | if ($htmlCleaned !== null) { |
1382 | - $html = (string)$htmlCleaned; |
|
1382 | + $html = (string) $htmlCleaned; |
|
1383 | 1383 | } else { |
1384 | 1384 | $htmlCleaned = (string) \preg_replace_callback( |
1385 | 1385 | '#<([^/\s<>!]+)(?:\s+([^<>]*)\s*|\s*)(/?)>#', |
1386 | - static function ($matches) { |
|
1387 | - return '<' . $matches[1] . \preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]) . $matches[3] . '>'; |
|
1386 | + static function($matches) { |
|
1387 | + return '<'.$matches[1].\preg_replace('#([^\s=]+)(=([\'"]?)(.*?)\3)?(\s+|$)#su', ' $1$2', $matches[2]).$matches[3].'>'; |
|
1388 | 1388 | }, |
1389 | 1389 | $html |
1390 | 1390 | ); |
@@ -1406,7 +1406,7 @@ discard block |
||
1406 | 1406 | |
1407 | 1407 | if (\strpos($html, $this->protectedChildNodesHelper) !== false) { |
1408 | 1408 | $html = (string) \preg_replace_callback( |
1409 | - '/<(?<element>' . $this->protectedChildNodesHelper . ')(?<attributes> [^>]*)?>(?<value>.*?)<\/' . $this->protectedChildNodesHelper . '>/', |
|
1409 | + '/<(?<element>'.$this->protectedChildNodesHelper.')(?<attributes> [^>]*)?>(?<value>.*?)<\/'.$this->protectedChildNodesHelper.'>/', |
|
1410 | 1410 | [$this, 'restoreProtectedHtml'], |
1411 | 1411 | $html |
1412 | 1412 | ); |
@@ -1426,14 +1426,14 @@ discard block |
||
1426 | 1426 | |
1427 | 1427 | $html = \str_replace( |
1428 | 1428 | [ |
1429 | - 'html>' . "\n", |
|
1430 | - "\n" . '<html', |
|
1431 | - 'html/>' . "\n", |
|
1432 | - "\n" . '</html', |
|
1433 | - 'head>' . "\n", |
|
1434 | - "\n" . '<head', |
|
1435 | - 'head/>' . "\n", |
|
1436 | - "\n" . '</head', |
|
1429 | + 'html>'."\n", |
|
1430 | + "\n".'<html', |
|
1431 | + 'html/>'."\n", |
|
1432 | + "\n".'</html', |
|
1433 | + 'head>'."\n", |
|
1434 | + "\n".'<head', |
|
1435 | + 'head/>'."\n", |
|
1436 | + "\n".'</head', |
|
1437 | 1437 | ], |
1438 | 1438 | [ |
1439 | 1439 | 'html>', |
@@ -1452,11 +1452,11 @@ discard block |
||
1452 | 1452 | $replace = []; |
1453 | 1453 | $replacement = []; |
1454 | 1454 | foreach (self::$selfClosingTags as $selfClosingTag) { |
1455 | - $replace[] = '<' . $selfClosingTag . '/>'; |
|
1456 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
1457 | - $replace[] = '<' . $selfClosingTag . ' />'; |
|
1458 | - $replacement[] = '<' . $selfClosingTag . '>'; |
|
1459 | - $replace[] = '></' . $selfClosingTag . '>'; |
|
1455 | + $replace[] = '<'.$selfClosingTag.'/>'; |
|
1456 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
1457 | + $replace[] = '<'.$selfClosingTag.' />'; |
|
1458 | + $replacement[] = '<'.$selfClosingTag.'>'; |
|
1459 | + $replace[] = '></'.$selfClosingTag.'>'; |
|
1460 | 1460 | $replacement[] = '>'; |
1461 | 1461 | } |
1462 | 1462 | $html = \str_replace( |
@@ -1663,7 +1663,7 @@ discard block |
||
1663 | 1663 | // ------------------------------------------------------------------------- |
1664 | 1664 | |
1665 | 1665 | return $dom->fixHtmlOutput( |
1666 | - $doctypeStr . $this->domNodeToString($dom->getDocument()), |
|
1666 | + $doctypeStr.$this->domNodeToString($dom->getDocument()), |
|
1667 | 1667 | $multiDecodeNewHtmlEntity |
1668 | 1668 | ); |
1669 | 1669 | } |
@@ -1708,7 +1708,7 @@ discard block |
||
1708 | 1708 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->parentNode()->innerHtml(); |
1709 | 1709 | $parentNode = $element->getNode()->parentNode; |
1710 | 1710 | if ($parentNode !== null) { |
1711 | - $parentNode->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
1711 | + $parentNode->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
1712 | 1712 | } |
1713 | 1713 | |
1714 | 1714 | ++$this->protected_tags_counter; |
@@ -1742,7 +1742,7 @@ discard block |
||
1742 | 1742 | } |
1743 | 1743 | |
1744 | 1744 | $this->protectedChildNodes[$this->protected_tags_counter] = $element->innerhtml; |
1745 | - $element->getNode()->nodeValue = '<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'; |
|
1745 | + $element->getNode()->nodeValue = '<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'; |
|
1746 | 1746 | |
1747 | 1747 | ++$this->protected_tags_counter; |
1748 | 1748 | } |
@@ -1762,11 +1762,11 @@ discard block |
||
1762 | 1762 | continue; |
1763 | 1763 | } |
1764 | 1764 | |
1765 | - $this->protectedChildNodes[$this->protected_tags_counter] = '<!--' . $text . '-->'; |
|
1765 | + $this->protectedChildNodes[$this->protected_tags_counter] = '<!--'.$text.'-->'; |
|
1766 | 1766 | |
1767 | 1767 | /* @var $node \DOMComment */ |
1768 | 1768 | $node = $element->getNode(); |
1769 | - $child = new \DOMText('<' . $this->protectedChildNodesHelper . ' data-' . $this->protectedChildNodesHelper . '="' . $this->protected_tags_counter . '"></' . $this->protectedChildNodesHelper . '>'); |
|
1769 | + $child = new \DOMText('<'.$this->protectedChildNodesHelper.' data-'.$this->protectedChildNodesHelper.'="'.$this->protected_tags_counter.'"></'.$this->protectedChildNodesHelper.'>'); |
|
1770 | 1770 | $parentNode = $element->getNode()->parentNode; |
1771 | 1771 | if ($parentNode !== null) { |
1772 | 1772 | $parentNode->replaceChild($child, $node); |
@@ -1899,7 +1899,7 @@ discard block |
||
1899 | 1899 | |
1900 | 1900 | $doSkip = false; |
1901 | 1901 | foreach (self::$skipTagsForRemoveWhitespace as $pattern) { |
1902 | - if (\strpos($xp, '/' . $pattern) !== false) { |
|
1902 | + if (\strpos($xp, '/'.$pattern) !== false) { |
|
1903 | 1903 | $doSkip = true; |
1904 | 1904 | |
1905 | 1905 | break; |