ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilExcInstructionPurifier.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 // corresponds to "mini" tagset of ilTextAreaInputGUI
24 protected const TAGSET = ["strong", "em", "u", "ol", "li", "ul", "blockquote", "a", "p", "span", "br"];
25
26 public function __construct()
27 {
29 }
30
31 protected function getPurifierConfigInstance() : HTMLPurifier_Config
32 {
33 $config = HTMLPurifier_Config::createDefault();
34 $config->set('HTML.DefinitionID', 'ilias exercise instruction');
35 $config->set('HTML.DefinitionRev', 1);
37 $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
38
39 $tags = $this->makeElementListTinyMceCompliant(self::TAGSET);
40 $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
41 $config->set('HTML.ForbiddenAttributes', 'div@style');
42
43 if ($def = $config->maybeGetRawHTMLDefinition()) {
44 $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
45 }
46
47 return $config;
48 }
49}
An exception for terminatinating execution or to throw for unit testing.
__construct()
ilHtmlPurifierAbstractLibWrapper constructor.
Abstract class wrapping the HTMLPurifier instance.
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc