ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilAccessibilityDocumentHtmlPurifier Class Reference

Class ilAccessibilityDocumentHtmlPurifier. More...

+ Inheritance diagram for ilAccessibilityDocumentHtmlPurifier:
+ Collaboration diagram for ilAccessibilityDocumentHtmlPurifier:

Public Member Functions

 __construct (array $allowedTags=null, string $cacheDirectory=null)
 ilAccessibilityDocumentHtmlPurifier 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 ()
 
Returns
HTMLPurifier_Config
More...
 
- Protected Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
 getPurifierConfigInstance ()
 
 setPurifier (HTMLPurifier $purifier)
 
 getPurifier ()
 
 removeUnsupportedElements (array $elements)
 Removes all unsupported elements. More...
 
 makeElementListTinyMceCompliant (array $elements)
 

Protected Attributes

 $cacheDirectory = ''
 
- Protected Attributes inherited from ilHtmlPurifierAbstractLibWrapper
 $purifier
 

Private Attributes

 $allowedTags = []
 

Additional Inherited Members

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

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

ilAccessibilityDocumentHtmlPurifier constructor.

Parameters
array | null$allowedTags
string$cacheDirectory

Definition at line 20 of file class.ilAccessibilityDocumentHtmlPurifier.php.

21 {
22 if (null === $cacheDirectory) {
24 }
25 $this->cacheDirectory = $cacheDirectory;
26
27 if (null === $allowedTags) {
29 }
30 $this->allowedTags = $allowedTags;
31
33 $this->allowedTags = $allowedTags;
34 }
static _getUsedHTMLTags($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()

ilAccessibilityDocumentHtmlPurifier::getPurifierConfigInstance ( )
protected

Returns
HTMLPurifier_Config

Reimplemented from ilHtmlPurifierAbstractLibWrapper.

Definition at line 39 of file class.ilAccessibilityDocumentHtmlPurifier.php.

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

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

+ Here is the call graph for this function:

Field Documentation

◆ $allowedTags

ilAccessibilityDocumentHtmlPurifier::$allowedTags = []
private

◆ $cacheDirectory

ilAccessibilityDocumentHtmlPurifier::$cacheDirectory = ''
protected

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

Referenced by __construct().


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