19 declare(strict_types=1);
37 if (!in_array($purifier, $this->purifiers,
true)) {
38 $this->purifiers[] = $purifier;
52 $key = array_search($purifier, $this->purifiers,
true);
56 unset($this->purifiers[$key]);
61 public function purify(
string $html): string
63 foreach ($this->purifiers as $purifier) {
64 $html = $purifier->purify($html);
72 foreach ($htmlCollection as $key => $html) {
73 if (!is_string($html)) {
75 'The element on index %s is not of type string: %s',
82 foreach ($htmlCollection as $key => $html) {
83 foreach ($this->purifiers as $purifier) {
84 $html = $purifier->purify($html);
87 $htmlCollection[$key] = $html;
90 return $htmlCollection;
addPurifier(ilHtmlPurifierInterface $purifier)
Adds a node to composite.
purifyArray(array $htmlCollection)
Filters an array of HTML snippets/documents to be XSS-free and standards-compliant.
Composite for nesting multiple purifiers.
Interface for html sanitizing functionality.
removePurifier(ilHtmlPurifierInterface $purifier)
Removes a node from composite.
purify(string $html)
Filters an HTML snippet/document to be XSS-free and standards-compliant.