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 (in_array(strtolower($element->nodeName), [
'body'])) {
53 if ($element->nodeType === XML_ELEMENT_NODE) {
59 }
catch (Exception | Throwable
$e) {
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(string $text)
Class ilHtmlDomNodeIterator.