@@ -465,6 +465,6 @@ |
||
465 | 465 | */ |
466 | 466 | public function delete() |
467 | 467 | { |
468 | - $this->outertext=''; |
|
468 | + $this->outertext = ''; |
|
469 | 469 | } |
470 | 470 | } |
@@ -9,7 +9,7 @@ |
||
9 | 9 | // add: "<br>" to "<li>" |
10 | 10 | $htmlTmp = HtmlDomParser::str_get_html($templateHtml); |
11 | 11 | foreach ($htmlTmp->findMulti('ul li') as $li) { |
12 | - $li->innerhtml = '<br>' . $li->innerhtml . '<br>'; |
|
12 | + $li->innerhtml = '<br>'.$li->innerhtml.'<br>'; |
|
13 | 13 | } |
14 | 14 | foreach ($htmlTmp->findMulti('br') as $br) { |
15 | 15 | // DEBUG: |
@@ -164,8 +164,8 @@ discard block |
||
164 | 164 | |
165 | 165 | if ($tmpDomString !== $tmpStr) { |
166 | 166 | throw new \RuntimeException( |
167 | - 'Not valid XML fragment!' . "\n" . |
|
168 | - $tmpDomString . "\n" . |
|
167 | + 'Not valid XML fragment!'."\n". |
|
168 | + $tmpDomString."\n". |
|
169 | 169 | $tmpStr |
170 | 170 | ); |
171 | 171 | } |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | |
225 | 225 | if ($tmpDomOuterTextString !== $tmpStr) { |
226 | 226 | throw new \RuntimeException( |
227 | - 'Not valid XML fragment!' . "\n" |
|
228 | - . $tmpDomOuterTextString . "\n" . |
|
227 | + 'Not valid XML fragment!'."\n" |
|
228 | + . $tmpDomOuterTextString."\n". |
|
229 | 229 | $tmpStr |
230 | 230 | ); |
231 | 231 | } |
@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | public function removeAttributes(): SimpleHtmlDomInterface |
173 | 173 | { |
174 | 174 | if ($this->hasAttributes()) { |
175 | - foreach (array_keys((array)$this->getAllAttributes()) as $attribute) { |
|
175 | + foreach (array_keys((array) $this->getAllAttributes()) as $attribute) { |
|
176 | 176 | $this->removeAttribute($attribute); |
177 | 177 | } |
178 | 178 | } |
@@ -197,8 +197,8 @@ discard block |
||
197 | 197 | |
198 | 198 | if ($tmpDomString !== $tmpStr) { |
199 | 199 | throw new \RuntimeException( |
200 | - 'Not valid HTML fragment!' . "\n" . |
|
201 | - $tmpDomString . "\n" . |
|
200 | + 'Not valid HTML fragment!'."\n". |
|
201 | + $tmpDomString."\n". |
|
202 | 202 | $tmpStr |
203 | 203 | ); |
204 | 204 | } |
@@ -258,8 +258,8 @@ discard block |
||
258 | 258 | |
259 | 259 | if ($tmpDomOuterTextString !== $tmpStr) { |
260 | 260 | throw new \RuntimeException( |
261 | - 'Not valid HTML fragment!' . "\n" |
|
262 | - . $tmpDomOuterTextString . "\n" . |
|
261 | + 'Not valid HTML fragment!'."\n" |
|
262 | + . $tmpDomOuterTextString."\n". |
|
263 | 263 | $tmpStr |
264 | 264 | ); |
265 | 265 | } |
@@ -23,7 +23,7 @@ discard block |
||
23 | 23 | } |
24 | 24 | |
25 | 25 | $dom = \voku\helper\HtmlDomParser::str_get_html($html); |
26 | - $domNew = \voku\helper\HtmlDomParser::str_get_html('<textarea ' . $optionStr . '></textarea>'); |
|
26 | + $domNew = \voku\helper\HtmlDomParser::str_get_html('<textarea '.$optionStr.'></textarea>'); |
|
27 | 27 | |
28 | 28 | $domElement = $dom->findOneOrFalse($htmlCssSelector); |
29 | 29 | if ($domElement === false) { |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | \strpos($attributeNameNew, 'on') === 0 // e.g. onClick, ... |
55 | 55 | ) { |
56 | 56 | if (isset($attributes[$attributeNameNew])) { |
57 | - $attributes[$attributeNameNew] .= ' ' . $attributeValueNew; |
|
57 | + $attributes[$attributeNameNew] .= ' '.$attributeValueNew; |
|
58 | 58 | } else { |
59 | 59 | $attributes[$attributeNameNew] = $attributeValueNew; |
60 | 60 | } |
@@ -90,7 +90,7 @@ discard block |
||
90 | 90 | return \call_user_func_array([$this, self::$functionAliases[$name]], $arguments); |
91 | 91 | } |
92 | 92 | |
93 | - throw new \BadMethodCallException('Method does not exist: ' . $name); |
|
93 | + throw new \BadMethodCallException('Method does not exist: '.$name); |
|
94 | 94 | } |
95 | 95 | |
96 | 96 | /** |
@@ -413,12 +413,12 @@ discard block |
||
413 | 413 | $regExSpecialScript = '/<script(?<attr>[^>]*?)>(?<content>.*)<\/script>/isU'; |
414 | 414 | $htmlTmp = \preg_replace_callback( |
415 | 415 | $regExSpecialScript, |
416 | - static function ($scripts) { |
|
416 | + static function($scripts) { |
|
417 | 417 | if (empty($scripts['content'])) { |
418 | 418 | return $scripts[0]; |
419 | 419 | } |
420 | 420 | |
421 | - return '<script' . $scripts['attr'] . '>' . \str_replace('</', '<\/', $scripts['content']) . '</script>'; |
|
421 | + return '<script'.$scripts['attr'].'>'.\str_replace('</', '<\/', $scripts['content']).'</script>'; |
|
422 | 422 | }, |
423 | 423 | $html |
424 | 424 | ); |
@@ -447,26 +447,26 @@ discard block |
||
447 | 447 | self::$domReplaceHelper['orig'] |
448 | 448 | ); |
449 | 449 | |
450 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<' . self::$domHtmlWrapperHelper . '>'; |
|
451 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</' . self::$domHtmlWrapperHelper . '>'; |
|
450 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start'] = '<'.self::$domHtmlWrapperHelper.'>'; |
|
451 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end'] = '</'.self::$domHtmlWrapperHelper.'>'; |
|
452 | 452 | |
453 | 453 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start'] = ''; |
454 | 454 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end'] = ''; |
455 | 455 | |
456 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start_broken'] = self::$domHtmlWrapperHelper . '>'; |
|
457 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end_broken'] = '</' . self::$domHtmlWrapperHelper; |
|
456 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__start_broken'] = self::$domHtmlWrapperHelper.'>'; |
|
457 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_wrapper__end_broken'] = '</'.self::$domHtmlWrapperHelper; |
|
458 | 458 | |
459 | 459 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__start_broken'] = ''; |
460 | 460 | $DOM_REPLACE__HELPER_CACHE['orig']['html_wrapper__end_broken'] = ''; |
461 | 461 | |
462 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<' . self::$domHtmlSpecialScriptHelper; |
|
463 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</' . self::$domHtmlSpecialScriptHelper . '>'; |
|
462 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start'] = '<'.self::$domHtmlSpecialScriptHelper; |
|
463 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end'] = '</'.self::$domHtmlSpecialScriptHelper.'>'; |
|
464 | 464 | |
465 | 465 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__start'] = '<script'; |
466 | 466 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__end'] = '</script>'; |
467 | 467 | |
468 | 468 | $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__start_broken'] = self::$domHtmlSpecialScriptHelper; |
469 | - $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end_broken'] = '</' . self::$domHtmlSpecialScriptHelper; |
|
469 | + $DOM_REPLACE__HELPER_CACHE['tmp']['html_special_script__end_broken'] = '</'.self::$domHtmlSpecialScriptHelper; |
|
470 | 470 | |
471 | 471 | $DOM_REPLACE__HELPER_CACHE['orig']['html_special_script__start_broken'] = 'script'; |
472 | 472 | $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::$domHtmlWrapperHelper . '>' . $html . '</' . self::$domHtmlWrapperHelper . '>'; |
|
465 | + $html = '<'.self::$domHtmlWrapperHelper.'>'.$html.'</'.self::$domHtmlWrapperHelper.'>'; |
|
466 | 466 | } |
467 | 467 | |
468 | 468 | $html = self::replaceToPreserveHtmlEntities($html); |
@@ -482,7 +482,7 @@ discard block |
||
482 | 482 | $xmlHackUsed = false; |
483 | 483 | if (\stripos('<?xml', $html) !== 0) { |
484 | 484 | $xmlHackUsed = true; |
485 | - $html = '<?xml encoding="' . $this->getEncoding() . '" ?>' . $html; |
|
485 | + $html = '<?xml encoding="'.$this->getEncoding().'" ?>'.$html; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | if ($html !== '') { |
@@ -704,8 +704,8 @@ discard block |
||
704 | 704 | |
705 | 705 | // https://bugs.php.net/bug.php?id=73175 |
706 | 706 | $content = \str_replace( |
707 | - \array_map(static function ($e) { |
|
708 | - return '</' . $e . '>'; |
|
707 | + \array_map(static function($e) { |
|
708 | + return '</'.$e.'>'; |
|
709 | 709 | }, $this->selfClosingTags), |
710 | 710 | '', |
711 | 711 | $content |
@@ -748,7 +748,7 @@ discard block |
||
748 | 748 | */ |
749 | 749 | public function getElementByClass(string $class): SimpleHtmlDomNodeInterface |
750 | 750 | { |
751 | - return $this->findMulti('.' . $class); |
|
751 | + return $this->findMulti('.'.$class); |
|
752 | 752 | } |
753 | 753 | |
754 | 754 | /** |
@@ -760,7 +760,7 @@ discard block |
||
760 | 760 | */ |
761 | 761 | public function getElementById(string $id): SimpleHtmlDomInterface |
762 | 762 | { |
763 | - return $this->findOne('#' . $id); |
|
763 | + return $this->findOne('#'.$id); |
|
764 | 764 | } |
765 | 765 | |
766 | 766 | /** |
@@ -791,7 +791,7 @@ discard block |
||
791 | 791 | */ |
792 | 792 | public function getElementsById(string $id, $idx = null) |
793 | 793 | { |
794 | - return $this->find('#' . $id, $idx); |
|
794 | + return $this->find('#'.$id, $idx); |
|
795 | 795 | } |
796 | 796 | |
797 | 797 | /** |
@@ -891,7 +891,7 @@ discard block |
||
891 | 891 | && |
892 | 892 | !\file_exists($filePath) |
893 | 893 | ) { |
894 | - throw new \RuntimeException('File ' . $filePath . ' not found'); |
|
894 | + throw new \RuntimeException('File '.$filePath.' not found'); |
|
895 | 895 | } |
896 | 896 | |
897 | 897 | try { |
@@ -901,11 +901,11 @@ discard block |
||
901 | 901 | $html = \file_get_contents($filePath); |
902 | 902 | } |
903 | 903 | } catch (\Exception $e) { |
904 | - throw new \RuntimeException('Could not load file ' . $filePath); |
|
904 | + throw new \RuntimeException('Could not load file '.$filePath); |
|
905 | 905 | } |
906 | 906 | |
907 | 907 | if ($html === false) { |
908 | - throw new \RuntimeException('Could not load file ' . $filePath); |
|
908 | + throw new \RuntimeException('Could not load file '.$filePath); |
|
909 | 909 | } |
910 | 910 | |
911 | 911 | return $this->loadHtml($html, $libXMLExtraOptions, $useDefaultLibXMLOptions); |
@@ -1034,11 +1034,11 @@ discard block |
||
1034 | 1034 | |
1035 | 1035 | $html = (string) \preg_replace_callback( |
1036 | 1036 | '/(?<start>.*)<(?<element_start>[a-z]+)(?<element_start_addon> [^>]*)?>(?<value>.*?)<\/(?<element_end>\2)>(?<end>.*)/sui', |
1037 | - static function ($matches) { |
|
1038 | - return $matches['start'] . |
|
1039 | - '°lt_simple_html_dom__voku_°' . $matches['element_start'] . $matches['element_start_addon'] . '°gt_simple_html_dom__voku_°' . |
|
1040 | - $matches['value'] . |
|
1041 | - '°lt/_simple_html_dom__voku_°' . $matches['element_end'] . '°gt_simple_html_dom__voku_°' . |
|
1037 | + static function($matches) { |
|
1038 | + return $matches['start']. |
|
1039 | + '°lt_simple_html_dom__voku_°'.$matches['element_start'].$matches['element_start_addon'].'°gt_simple_html_dom__voku_°'. |
|
1040 | + $matches['value']. |
|
1041 | + '°lt/_simple_html_dom__voku_°'.$matches['element_end'].'°gt_simple_html_dom__voku_°'. |
|
1042 | 1042 | $matches['end']; |
1043 | 1043 | }, |
1044 | 1044 | $html |
@@ -1050,7 +1050,7 @@ discard block |
||
1050 | 1050 | |
1051 | 1051 | $html = (string) \preg_replace_callback( |
1052 | 1052 | '/(?<start>[^<]*)?(?<broken>(?:<\/\w+(?:\s+\w+=\"[^"]+\")*+[^<]+>)+)(?<end>.*)/u', |
1053 | - static function ($matches) { |
|
1053 | + static function($matches) { |
|
1054 | 1054 | $matches['broken'] = \str_replace( |
1055 | 1055 | ['°lt/_simple_html_dom__voku_°', '°lt_simple_html_dom__voku_°', '°gt_simple_html_dom__voku_°'], |
1056 | 1056 | ['</', '<', '>'], |
@@ -1058,9 +1058,9 @@ discard block |
||
1058 | 1058 | ); |
1059 | 1059 | |
1060 | 1060 | self::$domBrokenReplaceHelper['orig'][] = $matches['broken']; |
1061 | - self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($matches['broken']); |
|
1061 | + self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($matches['broken']); |
|
1062 | 1062 | |
1063 | - return $matches['start'] . $matchesHash . $matches['end']; |
|
1063 | + return $matches['start'].$matchesHash.$matches['end']; |
|
1064 | 1064 | }, |
1065 | 1065 | $html |
1066 | 1066 | ); |
@@ -1087,16 +1087,16 @@ discard block |
||
1087 | 1087 | $regExSpecialSvg = '/\((["\'])?(?<start>data:image\/svg.*)<svg(?<attr>[^>]*?)>(?<content>.*)<\/svg>\1\)/isU'; |
1088 | 1088 | $htmlTmp = \preg_replace_callback( |
1089 | 1089 | $regExSpecialSvg, |
1090 | - static function ($svgs) { |
|
1090 | + static function($svgs) { |
|
1091 | 1091 | if (empty($svgs['content'])) { |
1092 | 1092 | return $svgs[0]; |
1093 | 1093 | } |
1094 | 1094 | |
1095 | - $content = '<svg' . $svgs['attr'] . '>' . $svgs['content'] . '</svg>'; |
|
1095 | + $content = '<svg'.$svgs['attr'].'>'.$svgs['content'].'</svg>'; |
|
1096 | 1096 | self::$domBrokenReplaceHelper['orig'][] = $content; |
1097 | - self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($content); |
|
1097 | + self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($content); |
|
1098 | 1098 | |
1099 | - return '(' . $svgs[1] . $svgs['start'] . $matchesHash . $svgs[1] . ')'; |
|
1099 | + return '('.$svgs[1].$svgs['start'].$matchesHash.$svgs[1].')'; |
|
1100 | 1100 | }, |
1101 | 1101 | $html |
1102 | 1102 | ); |
@@ -1115,14 +1115,14 @@ discard block |
||
1115 | 1115 | { |
1116 | 1116 | // regEx for e.g.: [<script id="elements-image-1" type="text/html">...</script>] |
1117 | 1117 | $tags = \implode('|', \array_map( |
1118 | - static function ($value) { |
|
1118 | + static function($value) { |
|
1119 | 1119 | return \preg_quote($value, '/'); |
1120 | 1120 | }, |
1121 | 1121 | $this->specialScriptTags |
1122 | 1122 | )); |
1123 | 1123 | $html = (string) \preg_replace_callback( |
1124 | - '/(?<start>(<script [^>]*type=["\']?(?:' . $tags . ')+[^>]*>))(?<innerContent>.*)(?<end><\/script>)/isU', |
|
1125 | - function ($matches) { |
|
1124 | + '/(?<start>(<script [^>]*type=["\']?(?:'.$tags.')+[^>]*>))(?<innerContent>.*)(?<end><\/script>)/isU', |
|
1125 | + function($matches) { |
|
1126 | 1126 | // Check for logic in special script tags, like [<% _.each(tierPrices, function(item, key) { %>], |
1127 | 1127 | // because often this looks like non-valid html in the template itself. |
1128 | 1128 | foreach ($this->templateLogicSyntaxInSpecialScriptTags as $logicSyntaxInSpecialScriptTag) { |
@@ -1131,18 +1131,18 @@ discard block |
||
1131 | 1131 | $matches['innerContent'] = \str_replace('<\/', '</', $matches['innerContent']); |
1132 | 1132 | |
1133 | 1133 | self::$domBrokenReplaceHelper['orig'][] = $matches['innerContent']; |
1134 | - self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper . \crc32($matches['innerContent']); |
|
1134 | + self::$domBrokenReplaceHelper['tmp'][] = $matchesHash = self::$domHtmlBrokenHtmlHelper.\crc32($matches['innerContent']); |
|
1135 | 1135 | |
1136 | - return $matches['start'] . $matchesHash . $matches['end']; |
|
1136 | + return $matches['start'].$matchesHash.$matches['end']; |
|
1137 | 1137 | } |
1138 | 1138 | } |
1139 | 1139 | |
1140 | 1140 | // remove the html5 fallback |
1141 | 1141 | $matches[0] = \str_replace('<\/', '</', $matches[0]); |
1142 | 1142 | |
1143 | - $specialNonScript = '<' . self::$domHtmlSpecialScriptHelper . \substr($matches[0], \strlen('<script')); |
|
1143 | + $specialNonScript = '<'.self::$domHtmlSpecialScriptHelper.\substr($matches[0], \strlen('<script')); |
|
1144 | 1144 | |
1145 | - return \substr($specialNonScript, 0, -\strlen('</script>')) . '</' . self::$domHtmlSpecialScriptHelper . '>'; |
|
1145 | + return \substr($specialNonScript, 0, -\strlen('</script>')).'</'.self::$domHtmlSpecialScriptHelper.'>'; |
|
1146 | 1146 | }, |
1147 | 1147 | $html |
1148 | 1148 | ); |
@@ -177,7 +177,7 @@ |
||
177 | 177 | if ($this->node && \property_exists($this->node, $nameOrig)) { |
178 | 178 | // INFO: Cannot assign null to property DOMNode::* of type string |
179 | 179 | if (in_array($nameOrig, self::$stringDomNodes)) { |
180 | - $value = (string)$value; |
|
180 | + $value = (string) $value; |
|
181 | 181 | } |
182 | 182 | |
183 | 183 | if (!is_null($value)) { |