19declare(strict_types=1);
53 final public function purify(
string $html): string
55 return $this->purifier->purify($html);
58 final public function purifyArray(array $htmlCollection): array
60 foreach ($htmlCollection as $key => $html) {
61 if (!is_string($html)) {
62 throw new InvalidArgumentException(sprintf(
63 'The element on index %s is not of type string: %s',
70 return $this->purifier->purifyArray($htmlCollection);
102 $supportedElements = [];
104 foreach ($elements as $element) {
105 if (!in_array($element, self::NOT_SUPPORTED_TAGS)) {
106 $supportedElements[] = $element;
110 return $supportedElements;
122 if (in_array(
'u', $elements) && !in_array(
'span', $elements)) {
123 $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.
const HTML_PURIFIER_DIRECTORY
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.