ILIAS  Release_4_4_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
class.ilAssHtmlUserSolutionPurifier.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  const TYPE = 'qpl_usersolution';
15 
19  protected function getPurifierConfigInstance()
20  {
22  $config->set('HTML.DefinitionID', 'ilias forum post');
23  $config->set('HTML.DefinitionRev', 1);
24  $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
25  $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
26  $config->set('HTML.AllowedElements', $this->getAllowedElements());
27  $config->set('HTML.ForbiddenAttributes', 'div@style');
28 
29  if ($def = $config->maybeGetRawHTMLDefinition()) {
30  $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
31  }
32 
33  return $config;
34  }
35 
36  private function getAllowedElements()
37  {
38  $allowedElements = $this->getElementsUsedForAdvancedEditing();
39 
40  $allowedElements = $this->makeElementListTinyMceCompliant($allowedElements);
41  $allowedElements = $this->removeUnsupportedElements($allowedElements);
42 
43  return $allowedElements;
44  }
45 
47  {
48  include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
49  return ilObjAdvancedEditing::_getUsedHTMLTags(self::TYPE);
50  }
51 }