ILIAS  release_8 Revision v8.24
class.ilHtmlForumPostPurifier.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
27 protected function getPurifierConfigInstance(): HTMLPurifier_Config
28 {
29 $config = HTMLPurifier_Config::createDefault();
30 $config->set('HTML.DefinitionID', 'ilias forum post');
31 $config->set('HTML.DefinitionRev', 1);
33 $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
34
36 $tags = $this->makeElementListTinyMceCompliant($tags);
37 $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
38 $config->set('HTML.ForbiddenAttributes', 'div@style');
39
40 if ($def = $config->maybeGetRawHTMLDefinition()) {
41 $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
42 }
43
44 return $config;
45 }
46}
Concrete class for sanitizing html of forum posts.
Abstract class wrapping the HTMLPurifier instance.
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85