19declare(strict_types=1);
39 final public function purify(
string $html): string
41 return $this->purifier->purify($html);
44 final public function purifyArray(array $htmlCollection): array
46 foreach ($htmlCollection as
$key => $html) {
47 if (!is_string($html)) {
48 throw new InvalidArgumentException(sprintf(
49 'The element on index %s is not of type string: %s',
56 return $this->purifier->purifyArray($htmlCollection);
88 $supportedElements = [];
103 foreach ($elements as $element) {
104 if (!in_array($element, $notSupportedTags)) {
105 $supportedElements[] = $element;
109 return $supportedElements;
121 if (in_array(
'u', $elements) && !in_array(
'span', $elements)) {
122 $elements[] =
'span';
static makeDirParents(string $a_dir)
Create a new directory and all parent directories.
static getDataDir()
get data directory (outside webspace)
Abstract class wrapping the HTMLPurifier instance.
purify(string $html)
Filters an HTML snippet/document to be XSS-free and standards-compliant.
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
purifyArray(array $htmlCollection)
Filters an array of HTML snippets/documents to be XSS-free and standards-compliant.
setPurifier(HTMLPurifier $purifier)
getPurifierConfigInstance()
makeElementListTinyMceCompliant(array $elements)
__construct()
ilHtmlPurifierAbstractLibWrapper constructor.
static _getCacheDirectory()
Interface for html sanitizing functionality.