ILIAS  trunk Revision v12.0_alpha-1540-g00f839d5fa1
ILIAS\WebDAV\Mount\DocumentPurifier Class Reference
+ Inheritance diagram for ILIAS\WebDAV\Mount\DocumentPurifier:
+ Collaboration diagram for ILIAS\WebDAV\Mount\DocumentPurifier:

Public Member Functions

 __construct (?array $allowedTags=null, ?string $cacheDirectory=null)
 
- 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...
 

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)
 

Protected Attributes

string $cacheDirectory
 
- Protected Attributes inherited from ilHtmlPurifierAbstractLibWrapper
HTMLPurifier $purifier
 

Private Attributes

array $allowedTags
 

Additional Inherited Members

- Static Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
static _getCacheDirectory ()
 

Detailed Description

Definition at line 27 of file DocumentPurifier.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\WebDAV\Mount\DocumentPurifier::__construct ( ?array  $allowedTags = null,
?string  $cacheDirectory = null 
)

Member Function Documentation

◆ getPurifierConfigInstance()

ILIAS\WebDAV\Mount\DocumentPurifier::getPurifierConfigInstance ( )
protected

Reimplemented from ilHtmlPurifierAbstractLibWrapper.

Definition at line 40 of file DocumentPurifier.php.

40 : HTMLPurifier_Config
41 {
42 $config = HTMLPurifier_Config::createDefault();
43 $config->set('HTML.DefinitionID', 'ilias termsofservice document');
44 $config->set('HTML.DefinitionRev', 1);
45 $config->set('HTML.TargetBlank', true);
46 $config->set('Cache.SerializerPath', $this->cacheDirectory);
47 $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
48
49 $tags = $this->allowedTags;
50 $tags = $this->makeElementListTinyMceCompliant($tags);
51
52 $tags[] = 'b';
53 $tags[] = 'i';
54
55 $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
56 $config->set('HTML.ForbiddenAttributes', 'div@style');
57
58 if ($def = $config->maybeGetRawHTMLDefinition()) {
59 $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
60 }
61
62 return $config;
63 }
removeUnsupportedElements(array $elements)
Removes all unsupported elements.

References ILIAS\WebDAV\Mount\DocumentPurifier\$allowedTags, ilHtmlPurifierAbstractLibWrapper\makeElementListTinyMceCompliant(), and ilHtmlPurifierAbstractLibWrapper\removeUnsupportedElements().

+ Here is the call graph for this function:

Field Documentation

◆ $allowedTags

array ILIAS\WebDAV\Mount\DocumentPurifier::$allowedTags
private

◆ $cacheDirectory

string ILIAS\WebDAV\Mount\DocumentPurifier::$cacheDirectory
protected

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