ILIAS  release_7 Revision v7.30-3-g800a261c036
ilHtmlForumPostPurifier Class Reference

Concrete class for sanitizing html of forum posts. More...

+ Inheritance diagram for ilHtmlForumPostPurifier:
+ Collaboration diagram for ilHtmlForumPostPurifier:

Public Member Functions

 __construct ()
 ilHtmlForumPostPurifier constructor. More...
 
- Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
 __construct ()
 ilHtmlPurifierAbstractLibWrapper constructor. More...
 
 purify (string $html)
 @inheritDoc More...
 
 purifyArray (array $htmlCollection)
 @inheritDoc More...
 
 purify (string $html)
 Filters an HTML snippet/document to be XSS-free and standards-compliant. More...
 
 purifyArray (array $htmlCollection)
 Filters an array of HTML snippets/documents to be XSS-free and standards-compliant. More...
 

Protected Member Functions

 getPurifierConfigInstance ()
 Concrete function which builds a html purifier config instance. More...
 
- Protected Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
 getPurifierConfigInstance ()
 
 setPurifier (HTMLPurifier $purifier)
 
 getPurifier ()
 
 removeUnsupportedElements (array $elements)
 Removes all unsupported elements. More...
 
 makeElementListTinyMceCompliant (array $elements)
 

Additional Inherited Members

- Static Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
static _getCacheDirectory ()
 
- Protected Attributes inherited from ilHtmlPurifierAbstractLibWrapper
 $purifier
 

Detailed Description

Concrete class for sanitizing html of forum posts.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 8 of file class.ilHtmlForumPostPurifier.php.

Constructor & Destructor Documentation

◆ __construct()

ilHtmlForumPostPurifier::__construct ( )

ilHtmlForumPostPurifier constructor.

Reimplemented from ilHtmlPurifierAbstractLibWrapper.

Definition at line 13 of file class.ilHtmlForumPostPurifier.php.

14 {
16 }
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References ILIAS\GlobalScreen\Provider\__construct().

+ Here is the call graph for this function:

Member Function Documentation

◆ getPurifierConfigInstance()

ilHtmlForumPostPurifier::getPurifierConfigInstance ( )
protected

Concrete function which builds a html purifier config instance.

Returns
HTMLPurifier_Config Instance of HTMLPurifier_Config

Reimplemented from ilHtmlPurifierAbstractLibWrapper.

Definition at line 22 of file class.ilHtmlForumPostPurifier.php.

22 : 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 }
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

References $config, ilHtmlPurifierAbstractLibWrapper\_getCacheDirectory(), ilObjAdvancedEditing\_getUsedHTMLTags(), ilHtmlPurifierAbstractLibWrapper\makeElementListTinyMceCompliant(), and ilHtmlPurifierAbstractLibWrapper\removeUnsupportedElements().

+ Here is the call graph for this function:

The documentation for this class was generated from the following file: