ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 
- 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

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

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

27  : HTMLPurifier_Config
28  {
29  $config = HTMLPurifier_Config::createDefault();
30  $config->set('HTML.DefinitionID', 'ilias forum post');
31  $config->set('HTML.DefinitionRev', 1);
32  $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
33  $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
34 
35  $tags = ilObjAdvancedEditing::_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()) {
41  $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
42  }
43 
44  return $config;
45  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
+ Here is the call graph for this function:

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