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

Composite for nesting multiple purifiers. More...

+ Inheritance diagram for ilHtmlPurifierComposite:
+ Collaboration diagram for ilHtmlPurifierComposite:

Public Member Functions

 addPurifier (ilHtmlPurifierInterface $purifier)
 Adds a node to composite. More...
 
 removePurifier (ilHtmlPurifierInterface $purifier)
 Removes a node from composite. 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 Attributes

 $purifiers = []
 

Detailed Description

Composite for nesting multiple purifiers.

Author
Michael Jansen mjans.nosp@m.en@d.nosp@m.ataba.nosp@m.y.de

Definition at line 8 of file class.ilHtmlPurifierComposite.php.

Member Function Documentation

◆ addPurifier()

ilHtmlPurifierComposite::addPurifier ( ilHtmlPurifierInterface  $purifier)

Adds a node to composite.

Parameters
ilHtmlPurifierInterface$purifierInstance of ilHtmlPurifierInterface
Returns
bool True if instance could be added, otherwise false

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

20 : bool
21 {
22 $key = array_search($purifier, $this->purifiers);
23 if (false === $key) {
24 $this->purifiers[] = $purifier;
25 return true;
26 }
27
28 return false;
29 }

◆ purify()

ilHtmlPurifierComposite::purify ( string  $html)

@inheritDoc

Implements ilHtmlPurifierInterface.

Definition at line 50 of file class.ilHtmlPurifierComposite.php.

50 : string
51 {
52 foreach ($this->purifiers as $purifier) {
53 $html = $purifier->purify($html);
54 }
55
56 return $html;
57 }

◆ purifyArray()

ilHtmlPurifierComposite::purifyArray ( array  $htmlCollection)

@inheritDoc

Implements ilHtmlPurifierInterface.

Definition at line 62 of file class.ilHtmlPurifierComposite.php.

62 : array
63 {
64 foreach ($htmlCollection as $key => $html) {
65 foreach ($this->purifiers as $purifier) {
66 $html = $purifier->purify($html);
67 }
68
69 $htmlCollection[$key] = $html;
70 }
71
72 return $htmlCollection;
73 }

◆ removePurifier()

ilHtmlPurifierComposite::removePurifier ( ilHtmlPurifierInterface  $purifier)

Removes a node from composite.

Parameters
ilHtmlPurifierInterface$purifierInstance of ilHtmlPurifierInterface
Returns
bool True if instance could be removed, otherwise false

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

36 : bool
37 {
38 $key = array_search($purifier, $this->purifiers);
39 if (false === $key) {
40 return false;
41 }
42 unset($this->purifiers[$key]);
43
44 return true;
45 }

Field Documentation

◆ $purifiers

ilHtmlPurifierComposite::$purifiers = []
protected

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


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