ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
class.ilHtmlForumPostPurifier.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2/* Copyright (c) 1998-2009 ILIAS open source, Extended GPL, see docs/LICENSE */
3
9{
13 public function __construct()
14 {
16 }
17
22 protected function getPurifierConfigInstance() : HTMLPurifier_Config
23 {
24 $config = HTMLPurifier_Config::createDefault();
25 $config->set('HTML.DefinitionID', 'ilias forum post');
26 $config->set('HTML.DefinitionRev', 1);
28 $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
29
31 $tags = $this->makeElementListTinyMceCompliant($tags);
32 $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
33 $config->set('HTML.ForbiddenAttributes', 'div@style');
34
35 if ($def = $config->maybeGetRawHTMLDefinition()) {
36 $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
37 }
38
39 return $config;
40 }
41}
An exception for terminatinating execution or to throw for unit testing.
Concrete class for sanitizing html of forum posts.
getPurifierConfigInstance()
Concrete function which builds a html purifier config instance.
__construct()
ilHtmlForumPostPurifier constructor.
Abstract class wrapping the HTMLPurifier instance.
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc