ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilAssHtmlPurifier.php
Go to the documentation of this file.
1<?php
2
26{
27 protected function getPurifierType(): string
28 {
29 return 'assessment';
30 }
31
35 protected function getPurifierConfigInstance(): HTMLPurifier_Config
36 {
37 $config = HTMLPurifier_Config::createDefault();
38 $config->set('HTML.DefinitionID', $this->getPurifierType());
39 $config->set('HTML.DefinitionRev', 2);
40 $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
41 $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
42 $config->set('HTML.AllowedElements', $this->getAllowedElements());
43 $config->set('HTML.ForbiddenAttributes', 'div@style');
44 $config->autoFinalize = false;
45 $config->set(
46 'URI.AllowedSchemes',
47 array_merge(
48 $config->get('URI.AllowedSchemes'),
49 ['data' => true]
50 )
51 );
52 $config->autoFinalize = true;
53 if ($def = $config->maybeGetRawHTMLDefinition()) {
54 $def->addAttribute('img', 'data-id', 'Number');
55 $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
56 }
57
58 return $config;
59 }
60
61 private function getAllowedElements(): array
62 {
63 $allowedElements = $this->getElementsUsedForAdvancedEditing();
64
65 $allowedElements = $this->makeElementListTinyMceCompliant($allowedElements);
66 $allowedElements = $this->removeUnsupportedElements($allowedElements);
67
68 return $allowedElements;
69 }
70
71 private function getElementsUsedForAdvancedEditing(): array
72 {
74 }
75}
Abstract class wrapping the HTMLPurifier instance.
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
static _getUsedHTMLTags(string $module='')