ILIAS  release_8 Revision v8.24
ilTermsOfServiceDocumentHtmlPurifier Class Reference

Class ilTermsOfServiceDocumentHtmlPurifier. More...

+ Inheritance diagram for ilTermsOfServiceDocumentHtmlPurifier:
+ Collaboration diagram for ilTermsOfServiceDocumentHtmlPurifier:

Public Member Functions

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

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceDocumentHtmlPurifier::__construct ( array  $allowedTags = null,
string  $cacheDirectory = null 
)

ilTermsOfServiceDocumentHtmlPurifier constructor.

Parameters
string[] | null$allowedTags
string | null$cacheDirectory

Definition at line 36 of file class.ilTermsOfServiceDocumentHtmlPurifier.php.

37 {
38 if (null === $cacheDirectory) {
40 }
41 $this->cacheDirectory = $cacheDirectory;
42
43 if (null === $allowedTags) {
45 }
46 $this->allowedTags = $allowedTags;
47
49 $this->allowedTags = $allowedTags;
50 }
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc

References $allowedTags, $cacheDirectory, ILIAS\GlobalScreen\Provider\__construct(), ilHtmlPurifierAbstractLibWrapper\_getCacheDirectory(), and ilObjAdvancedEditing\_getUsedHTMLTags().

+ Here is the call graph for this function:

Member Function Documentation

◆ getPurifierConfigInstance()

ilTermsOfServiceDocumentHtmlPurifier::getPurifierConfigInstance ( )
protected

Reimplemented from ilHtmlPurifierAbstractLibWrapper.

Definition at line 52 of file class.ilTermsOfServiceDocumentHtmlPurifier.php.

52 : HTMLPurifier_Config
53 {
54 $config = HTMLPurifier_Config::createDefault();
55 $config->set('HTML.DefinitionID', 'ilias termsofservice document');
56 $config->set('HTML.DefinitionRev', 1);
57 $config->set('HTML.TargetBlank', true);
58 $config->set('Cache.SerializerPath', $this->cacheDirectory);
59 $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
60
61 $tags = $this->allowedTags;
62 $tags = $this->makeElementListTinyMceCompliant($tags);
63
64 $tags[] = 'b';
65 $tags[] = 'i';
66
67 $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
68 $config->set('HTML.ForbiddenAttributes', 'div@style');
69
70 if ($def = $config->maybeGetRawHTMLDefinition()) {
71 $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
72 }
73
74 return $config;
75 }
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85

References $allowedTags, $config, ilHtmlPurifierAbstractLibWrapper\makeElementListTinyMceCompliant(), and ilHtmlPurifierAbstractLibWrapper\removeUnsupportedElements().

+ Here is the call graph for this function:

Field Documentation

◆ $allowedTags

array ilTermsOfServiceDocumentHtmlPurifier::$allowedTags
private

◆ $cacheDirectory

string ilTermsOfServiceDocumentHtmlPurifier::$cacheDirectory
protected

Definition at line 29 of file class.ilTermsOfServiceDocumentHtmlPurifier.php.

Referenced by __construct().


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