ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
class.ilHtmlForumPostPurifier.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3 
4 require_once 'Services/Html/classes/class.ilHtmlPurifierAbstractLibWrapper.php';
5 
14 {
24  public static $_type = 'frm_post';
25 
32  public function __construct()
33  {
34  parent::__construct();
35  }
36 
44  protected function getPurifierConfigInstance()
45  {
46  include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
47 
49  $config->set('HTML.DefinitionID', 'ilias forum post');
50  $config->set('HTML.DefinitionRev', 1);
51  $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
52  $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
53 
56  $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
57  $config->set('HTML.ForbiddenAttributes', 'div@style');
58 
59  if ($def = $config->maybeGetRawHTMLDefinition()) {
60  $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
61  }
62 
63  return $config;
64  }
65 }
Concrete class for sanitizing html of forum posts.
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.
getPurifierConfigInstance()
Concrete function which builds a html purifier config instance.
Abstract class wrapping the HTMLPurifier instance.
$tags
Definition: croninfo.php:19
static createDefault()
Convenience constructor that creates a default configuration object.
Definition: Config.php:154
$def
Definition: croninfo.php:21