ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilWebDAVMountInstructionsDocumentPurifier.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 private array $allowedTags;
24 protected string $cacheDirectory;
25
26 public function __construct(?array $allowedTags = null, ?string $cacheDirectory = null)
27 {
29 $this->allowedTags = $allowedTags ?? ilRTESettings::_getUsedHTMLTags('textarea');
30
32 }
33
34 protected function getPurifierConfigInstance(): HTMLPurifier_Config
35 {
36 $config = HTMLPurifier_Config::createDefault();
37 $config->set('HTML.DefinitionID', 'ilias termsofservice document');
38 $config->set('HTML.DefinitionRev', 1);
39 $config->set('HTML.TargetBlank', true);
40 $config->set('Cache.SerializerPath', $this->cacheDirectory);
41 $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
42
43 $tags = $this->allowedTags;
44 $tags = $this->makeElementListTinyMceCompliant($tags);
45
46 $tags[] = 'b';
47 $tags[] = 'i';
48
49 $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
50 $config->set('HTML.ForbiddenAttributes', 'div@style');
51
52 if ($def = $config->maybeGetRawHTMLDefinition()) {
53 $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
54 }
55
56 return $config;
57 }
58}
Abstract class wrapping the HTMLPurifier instance.
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
static _getUsedHTMLTags(string $module='')
__construct(?array $allowedTags=null, ?string $cacheDirectory=null)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc