ILIAS
trunk Revision v11.0_alpha-2638-g80c1d007f79
◀ ilDoc Overview
class.ilWebDAVMountInstructionsDocumentsContainsHtmlValidator.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
class
ilWebDAVMountInstructionsDocumentsContainsHtmlValidator
22
{
23
public
function
__construct
(
private
string
$text)
24
{
25
}
26
27
public
function
isValid():
bool
28
{
29
if
(!preg_match(
'/<[^>]+?>/'
, $this->text)) {
30
return
false
;
31
}
32
33
try
{
34
$dom =
new
DOMDocument
();
35
if
(!$dom->loadHTML($this->text)) {
36
return
false
;
37
}
38
39
$iter =
new
RecursiveIteratorIterator
(
40
new
ilHtmlDomNodeIterator
($dom),
41
RecursiveIteratorIterator::SELF_FIRST
42
);
43
foreach
($iter as $element) {
45
if
(strtolower((
string
) $element->nodeName) ===
'body'
) {
46
continue
;
47
}
48
49
if
($element->nodeType === XML_ELEMENT_NODE) {
50
return
true
;
51
}
52
}
53
}
catch
(
Exception
|
Throwable
) {
54
return
false
;
55
}
56
57
return
false
;
58
}
59
}
ilWebDAVMountInstructionsDocumentsContainsHtmlValidator\__construct
__construct(private string $text)
Definition:
class.ilWebDAVMountInstructionsDocumentsContainsHtmlValidator.php:23
DOMDocument
ilWebDAVMountInstructionsDocumentsContainsHtmlValidator
Definition:
class.ilWebDAVMountInstructionsDocumentsContainsHtmlValidator.php:21
ilHtmlDomNodeIterator
RecursiveIteratorIterator
Exception
Throwable
components
ILIAS
WebDAV
classes
mount_instructions
class.ilWebDAVMountInstructionsDocumentsContainsHtmlValidator.php
Generated on Sun Aug 31 2025 23:04:20 for ILIAS by
1.8.13 (using
Doxyfile
)