@@ -100,7 +100,7 @@ discard block |
||
100 | 100 | return \call_user_func_array([$this, self::$functionAliases[$name]], $arguments); |
101 | 101 | } |
102 | 102 | |
103 | - throw new \BadMethodCallException('Method does not exist: ' . $name); |
|
103 | + throw new \BadMethodCallException('Method does not exist: '.$name); |
|
104 | 104 | } |
105 | 105 | |
106 | 106 | /** |
@@ -423,12 +423,12 @@ discard block |
||
423 | 423 | $regExSpecialScript = '/<script(?<attr>[^>]*?)>(?<content>.*)<\/script>/isU'; |
424 | 424 | $htmlTmp = \preg_replace_callback( |
425 | 425 | $regExSpecialScript, |
426 | - static function ($scripts) { |
|
426 | + static function($scripts) { |
|
427 | 427 | if (empty($scripts['content'])) { |
428 | 428 | return $scripts[0]; |
429 | 429 | } |
430 | 430 | |
431 | - return '<script' . $scripts['attr'] . '>' . \str_replace('</', '<\/', $scripts['content']) . '</script>'; |
|
431 | + return '<script'.$scripts['attr'].'>'.\str_replace('</', '<\/', $scripts['content']).'</script>'; |
|
432 | 432 | }, |
433 | 433 | $html |
434 | 434 | ); |
@@ -463,20 +463,20 @@ discard block |
||
463 | 463 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start'] = ''; |
464 | 464 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end'] = ''; |
465 | 465 | |
466 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start_broken'] = self::$domHtmlWrapperHelper . '>'; |
|
467 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end_broken'] = '</' . self::$domHtmlWrapperHelper; |
|
466 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start_broken'] = self::$domHtmlWrapperHelper.'>'; |
|
467 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end_broken'] = '</'.self::$domHtmlWrapperHelper; |
|
468 | 468 | |
469 | 469 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start_broken'] = ''; |
470 | 470 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end_broken'] = ''; |
471 | 471 | |
472 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<' . self::$domHtmlSpecialScriptHelper; |
|
473 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</' . self::$domHtmlSpecialScriptHelper . '>'; |
|
472 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<'.self::$domHtmlSpecialScriptHelper; |
|
473 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</'.self::$domHtmlSpecialScriptHelper.'>'; |
|
474 | 474 | |
475 | 475 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__start'] = '<script'; |
476 | 476 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__end'] = '</script>'; |
477 | 477 | |
478 | 478 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start_broken'] = self::$domHtmlSpecialScriptHelper; |
479 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end_broken'] = '</' . self::$domHtmlSpecialScriptHelper; |
|
479 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end_broken'] = '</'.self::$domHtmlSpecialScriptHelper; |
|
480 | 480 | |
481 | 481 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__start_broken'] = 'script'; |
482 | 482 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__end_broken'] = '</script'; |
@@ -204,7 +204,7 @@ discard block |
||
204 | 204 | return \call_user_func_array([$this, self::$functionAliases[$name]], $arguments); |
205 | 205 | } |
206 | 206 | |
207 | - throw new \BadMethodCallException('Method does not exist: ' . $name); |
|
207 | + throw new \BadMethodCallException('Method does not exist: '.$name); |
|
208 | 208 | } |
209 | 209 | |
210 | 210 | /** |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | && |
377 | 377 | \trim($matches_after_html[1]) |
378 | 378 | ) { |
379 | - $html = \str_replace($matches_after_html[0], $matches_after_html[1] . '</html>', $html); |
|
379 | + $html = \str_replace($matches_after_html[0], $matches_after_html[1].'</html>', $html); |
|
380 | 380 | } |
381 | 381 | } |
382 | 382 | |
@@ -412,11 +412,11 @@ discard block |
||
412 | 412 | } |
413 | 413 | |
414 | 414 | $html = \str_replace( |
415 | - \array_map(static function ($e) { |
|
416 | - return '<' . $e . '>'; |
|
415 | + \array_map(static function($e) { |
|
416 | + return '<'.$e.'>'; |
|
417 | 417 | }, $this->selfClosingTags), |
418 | - \array_map(static function ($e) { |
|
419 | - return '<' . $e . '/>'; |
|
418 | + \array_map(static function($e) { |
|
419 | + return '<'.$e.'/>'; |
|
420 | 420 | }, $this->selfClosingTags), |
421 | 421 | $html |
422 | 422 | ); |
@@ -462,7 +462,7 @@ discard block |
||
462 | 462 | $this->keepBrokenHtml |
463 | 463 | ) |
464 | 464 | ) { |
465 | - $html = self::$domHtmlWrapperStart . $html . self::$domHtmlWrapperEnd; |
|
465 | + $html = self::$domHtmlWrapperStart.$html.self::$domHtmlWrapperEnd; |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | $html = self::replaceToPreserveHtmlEntities($html); |
@@ -483,7 +483,7 @@ discard block |
||
483 | 483 | $xmlHackUsed = false; |
484 | 484 | if (\stripos('<?xml', $html) !== 0) { |
485 | 485 | $xmlHackUsed = true; |
486 | - $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html; |
|
486 | + $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html; |
|
487 | 487 | } |
488 | 488 | |
489 | 489 | if ($html !== '') { |
@@ -705,8 +705,8 @@ discard block |
||
705 | 705 | |
706 | 706 | // https://bugs.php.net/bug.php?id=73175 |
707 | 707 | $content = \str_replace( |
708 | - \array_map(static function ($e) { |
|
709 | - return '</' . $e . '>'; |
|
708 | + \array_map(static function($e) { |
|
709 | + return '</'.$e.'>'; |
|
710 | 710 | }, $this->selfClosingTags), |
711 | 711 | '', |
712 | 712 | $content |
@@ -749,7 +749,7 @@ discard block |
||
749 | 749 | */ |
750 | 750 | public function getElementByClass(string $class): SimpleHtmlDomNodeInterface |
751 | 751 | { |
752 | - return $this->findMulti('.' . $class); |
|
752 | + return $this->findMulti('.'.$class); |
|
753 | 753 | } |
754 | 754 | |
755 | 755 | /** |
@@ -761,7 +761,7 @@ discard block |
||
761 | 761 | */ |
762 | 762 | public function getElementById(string $id): SimpleHtmlDomInterface |
763 | 763 | { |
764 | - return $this->findOne('#' . $id); |
|
764 | + return $this->findOne('#'.$id); |
|
765 | 765 | } |
766 | 766 | |
767 | 767 | /** |
@@ -792,7 +792,7 @@ discard block |
||
792 | 792 | */ |
793 | 793 | public function getElementsById(string $id, $idx = null) |
794 | 794 | { |
795 | - return $this->find('#' . $id, $idx); |
|
795 | + return $this->find('#'.$id, $idx); |
|
796 | 796 | } |
797 | 797 | |
798 | 798 | /** |
@@ -892,7 +892,7 @@ discard block |
||
892 | 892 | && |
893 | 893 | !\file_exists($filePath) |
894 | 894 | ) { |
895 | - throw new \RuntimeException('File ' . $filePath . ' not found'); |
|
895 | + throw new \RuntimeException('File '.$filePath.' not found'); |
|
896 | 896 | } |
897 | 897 | |
898 | 898 | try { |
@@ -902,11 +902,11 @@ discard block |
||
902 | 902 | $html = \file_get_contents($filePath); |
903 | 903 | } |
904 | 904 | } catch (\Exception $e) { |
905 | - throw new \RuntimeException('Could not load file ' . $filePath); |
|
905 | + throw new \RuntimeException('Could not load file '.$filePath); |
|
906 | 906 | } |
907 | 907 | |
908 | 908 | if ($html === false) { |
909 | - throw new \RuntimeException('Could not load file ' . $filePath); |
|
909 | + throw new \RuntimeException('Could not load file '.$filePath); |
|
910 | 910 | } |
911 | 911 | |
912 | 912 | return $this->loadHtml($html, $libXMLExtraOptions, $useDefaultLibXMLOptions); |
@@ -1035,11 +1035,11 @@ discard block |
||
1035 | 1035 | |
1036 | 1036 | $html = (string) \preg_replace_callback( |
1037 | 1037 | '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui', |
1038 | - static function ($matches) { |
|
1039 | - return $matches['start'] . |
|
1040 | - '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' . |
|
1041 | - $matches['value'] . |
|
1042 | - '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' . |
|
1038 | + static function($matches) { |
|
1039 | + return $matches['start']. |
|
1040 | + '°lt_simple_html_dom__voku_°'.$matches['element_start'].$matches['element_start_addon'].'°gt_simple_html_dom__voku_°'. |
|
1041 | + $matches['value']. |
|
1042 | + '°lt/_simple_html_dom__voku_°'.$matches['element_end'].'°gt_simple_html_dom__voku_°'. |
|
1043 | 1043 | $matches['end']; |
1044 | 1044 | }, |
1045 | 1045 | $html |
@@ -1051,7 +1051,7 @@ discard block |
||
1051 | 1051 | |
1052 | 1052 | $html = (string) \preg_replace_callback( |
1053 | 1053 | '/(?<start>[^<]*)?(?<broken>(?:<\/\w+(?:\s+\w+=\"[^"]+\")*+[^<]+>)+)(?<end>.*)/u', |
1054 | - static function ($matches) { |
|
1054 | + static function($matches) { |
|
1055 | 1055 | $matches['broken'] = \str_replace( |
1056 | 1056 | ['°lt/_simple_html_dom__voku_°', '°lt_simple_html_dom__voku_°', '°gt_simple_html_dom__voku_°'], |
1057 | 1057 | ['</', '<', '>'], |
@@ -1059,9 +1059,9 @@ discard block |
||
1059 | 1059 | ); |
1060 | 1060 | |
1061 | 1061 | self::$domBrokenReplaceHelper['orig'][] = $matches['broken']; |
1062 | - self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($matches['broken']); |
|
1062 | + self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($matches['broken']); |
|
1063 | 1063 | |
1064 | - return $matches['start'] . $matchesHash . $matches['end']; |
|
1064 | + return $matches['start'].$matchesHash.$matches['end']; |
|
1065 | 1065 | }, |
1066 | 1066 | $html |
1067 | 1067 | ); |
@@ -1088,16 +1088,16 @@ discard block |
||
1088 | 1088 | $regExSpecialSvg = '/\((["\'])?(?<start>data:image\/svg.*)<svg(?<attr>[^>]*?)>(?<content>.*)<\/svg>\1\)/isU'; |
1089 | 1089 | $htmlTmp = \preg_replace_callback( |
1090 | 1090 | $regExSpecialSvg, |
1091 | - static function ($svgs) { |
|
1091 | + static function($svgs) { |
|
1092 | 1092 | if (empty($svgs['content'])) { |
1093 | 1093 | return $svgs[0]; |
1094 | 1094 | } |
1095 | 1095 | |
1096 | - $content = '<svg' . $svgs['attr'] . '>' . $svgs['content'] . '</svg>'; |
|
1096 | + $content = '<svg'.$svgs['attr'].'>'.$svgs['content'].'</svg>'; |
|
1097 | 1097 | self::$domBrokenReplaceHelper['orig'][] = $content; |
1098 | - self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($content); |
|
1098 | + self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($content); |
|
1099 | 1099 | |
1100 | - return '(' . $svgs[1] . $svgs['start'] . $matchesHash . $svgs[1] . ')'; |
|
1100 | + return '('.$svgs[1].$svgs['start'].$matchesHash.$svgs[1].')'; |
|
1101 | 1101 | }, |
1102 | 1102 | $html |
1103 | 1103 | ); |
@@ -1116,14 +1116,14 @@ discard block |
||
1116 | 1116 | { |
1117 | 1117 | // regEx for e.g.: [<script id="elements-image-1" type="text/html">...</script>] |
1118 | 1118 | $tags = \implode('|', \array_map( |
1119 | - static function ($value) { |
|
1119 | + static function($value) { |
|
1120 | 1120 | return \preg_quote($value, '/'); |
1121 | 1121 | }, |
1122 | 1122 | $this->specialScriptTags |
1123 | 1123 | )); |
1124 | 1124 | $html = (string) \preg_replace_callback( |
1125 | - '/(?<start>(<script [^>]*type=["\']?(?:' . $tags . ')+[^>]*>))(?<innerContent>.*)(?<end><\/script>)/isU', |
|
1126 | - function ($matches) { |
|
1125 | + '/(?<start>(<script [^>]*type=["\']?(?:'.$tags.')+[^>]*>))(?<innerContent>.*)(?<end><\/script>)/isU', |
|
1126 | + function($matches) { |
|
1127 | 1127 | |
1128 | 1128 | // Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>], |
1129 | 1129 | // because often this looks like non-valid html in the template itself. |
@@ -1133,18 +1133,18 @@ discard block |
||
1133 | 1133 | $matches['innerContent'] = \str_replace('<\/', '</', $matches['innerContent']); |
1134 | 1134 | |
1135 | 1135 | self::$domBrokenReplaceHelper['orig'][] = $matches['innerContent']; |
1136 | - self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($matches['innerContent']); |
|
1136 | + self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($matches['innerContent']); |
|
1137 | 1137 | |
1138 | - return $matches['start'] . $matchesHash . $matches['end']; |
|
1138 | + return $matches['start'].$matchesHash.$matches['end']; |
|
1139 | 1139 | } |
1140 | 1140 | } |
1141 | 1141 | |
1142 | 1142 | // remove the html5 fallback |
1143 | 1143 | $matches[0] = \str_replace('<\/', '</', $matches[0]); |
1144 | 1144 | |
1145 | - $specialNonScript = '<' . self::$domHtmlSpecialScriptHelper . \substr($matches[0], \strlen('<script')); |
|
1145 | + $specialNonScript = '<'.self::$domHtmlSpecialScriptHelper.\substr($matches[0], \strlen('<script')); |
|
1146 | 1146 | |
1147 | - return \substr($specialNonScript, 0, -\strlen('</script>')) . '</' . self::$domHtmlSpecialScriptHelper . '>'; |
|
1147 | + return \substr($specialNonScript, 0, -\strlen('</script>')).'</'.self::$domHtmlSpecialScriptHelper.'>'; |
|
1148 | 1148 | }, |
1149 | 1149 | $html |
1150 | 1150 | ); |