3declare(strict_types=1);
28 $this->text = $purified_html_content;
31 public function isValid(): bool
33 if (!preg_match(
'/<[^>]+?>/', $this->text)) {
38 $dom =
new DOMDocument();
39 if (!$dom->loadHTML($this->text)) {
43 $iter =
new RecursiveIteratorIterator(
45 RecursiveIteratorIterator::SELF_FIRST
47 foreach ($iter as $element) {
49 if (strtolower($element->nodeName) ===
'body') {
53 if ($element->nodeType === XML_ELEMENT_NODE) {
57 }
catch (Exception|Throwable
$e) {
Class ilHtmlDomNodeIterator.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(string $purified_html_content)