ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilWebDAVMountInstructionsDocumentPurifier.php
Go to the documentation of this file.
1 <?php
2 
3 
5 {
7  private $allowedTags = [];
8 
10  protected $cacheDirectory = '';
11 
17  public function __construct(array $allowedTags = null, string $cacheDirectory = null)
18  {
19  if (null === $cacheDirectory) {
21  }
22  $this->cacheDirectory = $cacheDirectory;
23 
24  if (null === $allowedTags) {
26  }
27  $this->allowedTags = $allowedTags;
28 
30  $this->allowedTags = $allowedTags;
31  }
32 
36  protected function getPurifierConfigInstance() : HTMLPurifier_Config
37  {
38  $config = HTMLPurifier_Config::createDefault();
39  $config->set('HTML.DefinitionID', 'ilias termsofservice document');
40  $config->set('HTML.DefinitionRev', 1);
41  $config->set('HTML.TargetBlank', true);
42  $config->set('Cache.SerializerPath', $this->cacheDirectory);
43  $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
44 
45  $tags = $this->allowedTags;
46  $tags = $this->makeElementListTinyMceCompliant($tags);
47 
48  $tags[] = 'b';
49  $tags[] = 'i';
50 
51  $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
52  $config->set('HTML.ForbiddenAttributes', 'div@style');
53 
54  if ($def = $config->maybeGetRawHTMLDefinition()) {
55  $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
56  }
57 
58  return $config;
59  }
60 }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
Abstract class wrapping the HTMLPurifier instance.
__construct(array $allowedTags=null, string $cacheDirectory=null)
ilTermsOfServiceDocumentHtmlPurifier constructor.
__construct(Container $dic, ilPlugin $plugin)