ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilExcInstructionPurifier.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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);
36  $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
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 }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
Abstract class wrapping the HTMLPurifier instance.
__construct(Container $dic, ilPlugin $plugin)