ILIAS  release_4-3 Revision
 All Data Structures Namespaces Files Functions Variables Groups Pages
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.
 removePurifier (ilHtmlPurifierInterface $a_purifier)
 Removes a node from composite.
 purify ($a_html)
 Filters an HTML snippet/document to be XSS-free and standards-compliant.
 purifyArray (Array $a_array_of_html)
 Filters an array of HTML snippets/documents to be XSS-free and standards-compliant.

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

ilHtmlPurifierComposite::addPurifier ( ilHtmlPurifierInterface  $a_purifier)

Adds a node to composite.

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.

{
$key = array_search($a_purifier, $this->purifiers);
if(false === $key)
{
$this->purifiers[] = $a_purifier;
return true;
}
return false;
}
ilHtmlPurifierComposite::purify (   $a_html)

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

public

Parameters
string$a_htmlHTML snippet/document
Returns
string purified html

Implements ilHtmlPurifierInterface.

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

{
foreach($this->purifiers as $oPurifier)
{
$a_html = $oPurifier->purify($a_html);
}
return $a_html;
}
ilHtmlPurifierComposite::purifyArray ( Array  $a_array_of_html)

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

public

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

Implements ilHtmlPurifierInterface.

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

{
foreach($a_array_of_html as $key => $html)
{
foreach($this->purifiers as $oPurifier)
{
$html = $oPurifier->purify($html);
}
$a_array_of_html[$key] = $html;
}
return $a_array_of_html;
}
ilHtmlPurifierComposite::removePurifier ( ilHtmlPurifierInterface  $a_purifier)

Removes a node from composite.

public

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

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

{
$key = array_search($a_purifier, $this->purifiers);
if(false === $key)
{
return false;
}
unset($this->purifiers[$key]);
return true;
}

Field Documentation

ilHtmlPurifierComposite::$purifiers = array()
protected

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


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