ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ilHtmlForumPostPurifier Class Reference

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

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

Protected Member Functions

 getPurifierConfigInstance ()
 
- 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

- Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
 __construct ()
 ilHtmlPurifierAbstractLibWrapper constructor. 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...
 
 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...
 
- Static Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
static _getCacheDirectory ()
 
- Protected Attributes inherited from ilHtmlPurifierAbstractLibWrapper
HTMLPurifier $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 25 of file class.ilHtmlForumPostPurifier.php.

Member Function Documentation

◆ getPurifierConfigInstance()

ilHtmlForumPostPurifier::getPurifierConfigInstance ( )
protected

Reimplemented from ilHtmlPurifierAbstractLibWrapper.

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

27 : HTMLPurifier_Config
28 {
29 $config = HTMLPurifier_Config::createDefault();
30 $config->set('HTML.DefinitionID', 'ilias forum post');
31 $config->set('HTML.DefinitionRev', 2);
32 $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
33 $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
34
35 $tags = ilRTESettings::_getUsedHTMLTags('frm_post');
36 $tags = $this->makeElementListTinyMceCompliant($tags);
37 $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
38 $config->set('HTML.ForbiddenAttributes', 'div@style');
39
40 if (($def = $config->maybeGetRawHTMLDefinition()) !== null) {
41 $def->addAttribute('img', 'data-id', 'Number');
42 $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
43 }
44
45 return $config;
46 }
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
static _getUsedHTMLTags(string $module='')

References ilHtmlPurifierAbstractLibWrapper\_getCacheDirectory(), ilRTESettings\_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: