ILIAS  release_5-2 Revision v5.2.25-18-g3f80b82851
class.ilAssHtmlPurifier.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2013 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Html/classes/class.ilHtmlPurifierAbstractLibWrapper.php';
5 
13 {
14  protected function getPurifierType()
15  {
16  return 'assessment';
17  }
18 
22  protected function getPurifierConfigInstance()
23  {
25  $config->set('HTML.DefinitionID', $this->getPurifierType());
26  $config->set('HTML.DefinitionRev', 1);
27  $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
28  $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
29  $config->set('HTML.AllowedElements', $this->getAllowedElements());
30  $config->set('HTML.ForbiddenAttributes', 'div@style');
31  if ($def = $config->maybeGetRawHTMLDefinition()) {
32  $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
33  }
34 
35  return $config;
36  }
37 
38  private function getAllowedElements()
39  {
40  $allowedElements = $this->getElementsUsedForAdvancedEditing();
41 
42  $allowedElements = $this->makeElementListTinyMceCompliant($allowedElements);
43  $allowedElements = $this->removeUnsupportedElements($allowedElements);
44 
45  return $allowedElements;
46  }
47 
49  {
50  include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
52  }
53 }
static _getCacheDirectory()
Get the directory for HTMLPurifier cache files.
removeUnsupportedElements($a_array)
Removes all unsupported elements.
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
Abstract class wrapping the HTMLPurifier instance.
static createDefault()
Convenience constructor that creates a default configuration object.
Definition: Config.php:154