ILIAS  release_9 Revision v9.13-25-g2c18ec4c24f
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 
36  {
37  $config = HTMLPurifier_Config::createDefault();
38  $config->set('HTML.DefinitionID', $this->getPurifierType());
39  $config->set('HTML.DefinitionRev', 1);
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('a', 'target', 'Enum#_blank,_self,_target,_top');
55  }
56 
57  return $config;
58  }
59 
60  private function getAllowedElements(): array
61  {
62  $allowedElements = $this->getElementsUsedForAdvancedEditing();
63 
64  $allowedElements = $this->makeElementListTinyMceCompliant($allowedElements);
65  $allowedElements = $this->removeUnsupportedElements($allowedElements);
66 
67  return $allowedElements;
68  }
69 
70  private function getElementsUsedForAdvancedEditing(): array
71  {
73  }
74 }
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.