ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilHtmlPurifierComposite Class Reference

Composite for nesting multiple purifiers. More...

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

Public Member Functions

 addPurifier (ilHtmlPurifierInterface $a_purifier)
 Adds a node to composite. More...
 
 removePurifier (ilHtmlPurifierInterface $a_purifier)
 Removes a node from composite. More...
 
 purify ($a_html)
 Filters an HTML snippet/document to be XSS-free and standards-compliant. More...
 
 purifyArray (array $a_array_of_html)
 Filters an array of HTML snippets/documents to be XSS-free and standards-compliant. More...
 
 purify ($a_html)
 Filters an HTML snippet/document to be XSS-free and standards-compliant. More...
 
 purifyArray (array $a_array_of_html)
 Filters an array of HTML snippets/documents to be XSS-free and standards-compliant. More...
 

Protected Attributes

 $purifiers = array()
 

Detailed Description

Composite for nesting multiple purifiers.

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

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

Member Function Documentation

◆ addPurifier()

ilHtmlPurifierComposite::addPurifier ( ilHtmlPurifierInterface  $a_purifier)

Adds a node to composite.

@access public

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

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

34 {
35 $key = array_search($a_purifier, $this->purifiers);
36 if (false === $key) {
37 $this->purifiers[] = $a_purifier;
38 return true;
39 }
40
41 return false;
42 }
$key
Definition: croninfo.php:18

References $key.

◆ purify()

ilHtmlPurifierComposite::purify (   $a_html)

Filters an HTML snippet/document to be XSS-free and standards-compliant.

@access public

Parameters
string$a_htmlHTML snippet/document
Returns
string purified html

Implements ilHtmlPurifierInterface.

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

72 {
73 foreach ($this->purifiers as $oPurifier) {
74 $a_html = $oPurifier->purify($a_html);
75 }
76
77 return $a_html;
78 }

◆ purifyArray()

ilHtmlPurifierComposite::purifyArray ( array  $a_array_of_html)

Filters an array of HTML snippets/documents to be XSS-free and standards-compliant.

@access public

Parameters
array$a_array_of_htmlHTML snippet/document
Returns
array Array of HTML snippets/documents

Implements ilHtmlPurifierInterface.

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

89 {
90 foreach ($a_array_of_html as $key => $html) {
91 foreach ($this->purifiers as $oPurifier) {
92 $html = $oPurifier->purify($html);
93 }
94
95 $a_array_of_html[$key] = $html;
96 }
97
98 return $a_array_of_html;
99 }
$html
Definition: example_001.php:87

References $html, and $key.

◆ removePurifier()

ilHtmlPurifierComposite::removePurifier ( ilHtmlPurifierInterface  $a_purifier)

Removes a node from composite.

@access public

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

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

53 {
54 $key = array_search($a_purifier, $this->purifiers);
55 if (false === $key) {
56 return false;
57 }
58 unset($this->purifiers[$key]);
59
60 return true;
61 }

References $key.

Field Documentation

◆ $purifiers

ilHtmlPurifierComposite::$purifiers = array()
protected

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


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