ILIAS  Release_5_0_x_branch Revision 61816
 All Data Structures Namespaces Files Functions Variables Groups Pages
ilHtmlPurifierAbstractLibWrapper Class Reference

Abstract class wrapping the HTMLPurifier instance. More...

+ Inheritance diagram for ilHtmlPurifierAbstractLibWrapper:
+ Collaboration diagram for ilHtmlPurifierAbstractLibWrapper:

Public Member Functions

 __construct ()
 Constructor.
 purify ($a_html, $a_config=null)
 Filters an HTML snippet/document to be XSS-free and standards-compliant.
 purifyArray (Array $a_array_of_html, $a_config=null)
 Filters an array of HTML snippets/documents to be XSS-free and standards-compliant.
- Public Member Functions inherited from ilHtmlPurifierInterface
 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.

Static Public Member Functions

static _getCacheDirectory ()
 Get the directory for HTMLPurifier cache files.

Protected Member Functions

 getPurifierConfigInstance ()
 Has to be implemented by subclasses to build the HTMLPurifier_Config instance with object specific configurations.
 setPurifier (HTMLPurifier $oPurifier)
 Set the purifier by subclass.
 getPurifier ()
 Get the purifier.
 removeUnsupportedElements ($a_array)
 Removes all unsupported elements.
 makeElementListTinyMceCompliant ($elements)

Protected Attributes

 $oPurifier = null

Detailed Description

Abstract class wrapping the HTMLPurifier instance.

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

Definition at line 15 of file class.ilHtmlPurifierAbstractLibWrapper.php.

Constructor & Destructor Documentation

ilHtmlPurifierAbstractLibWrapper::__construct ( )

Constructor.

public

Reimplemented in ilHtmlForumPostPurifier.

Definition at line 34 of file class.ilHtmlPurifierAbstractLibWrapper.php.

References getPurifierConfigInstance(), HTMLPurifier(), and setPurifier().

{
$this->setPurifier(
);
}

+ Here is the call graph for this function:

Member Function Documentation

static ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory ( )
staticfinal

Get the directory for HTMLPurifier cache files.

Returns
string Cache directory for HTMLPurifier public

Definition at line 117 of file class.ilHtmlPurifierAbstractLibWrapper.php.

References ilUtil\getDataDir(), and ilUtil\makeDirParents().

Referenced by ilAssHtmlPurifier\getPurifierConfigInstance(), and ilHtmlForumPostPurifier\getPurifierConfigInstance().

{
if(!file_exists(ilUtil::getDataDir().'/HTMLPurifier') ||
!is_dir(ilUtil::getDataDir().'/HTMLPurifier'))
{
}
return ilUtil::getDataDir().'/HTMLPurifier';
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ilHtmlPurifierAbstractLibWrapper::getPurifier ( )
protected

Get the purifier.

Returns
HTMLPurifier instance of HTMLPurifier protected

Definition at line 102 of file class.ilHtmlPurifierAbstractLibWrapper.php.

References $oPurifier.

{
}
ilHtmlPurifierAbstractLibWrapper::getPurifierConfigInstance ( )
abstractprotected

Has to be implemented by subclasses to build the HTMLPurifier_Config instance with object specific configurations.

protected

Reimplemented in ilHtmlForumPostPurifier, and ilAssHtmlPurifier.

Referenced by __construct().

+ Here is the caller graph for this function:

ilHtmlPurifierAbstractLibWrapper::makeElementListTinyMceCompliant (   $elements)
protected

Definition at line 165 of file class.ilHtmlPurifierAbstractLibWrapper.php.

Referenced by ilAssHtmlPurifier\getAllowedElements(), and ilHtmlForumPostPurifier\getPurifierConfigInstance().

{
// Bugfix #5945: Necessary because TinyMCE does not use the "u"
// html element but <span style="text-decoration: underline">E</span>
if( in_array('u', $elements) && !in_array('span', $elements) )
{
$elements[] = 'span';
}
return $elements;
}

+ Here is the caller graph for this function:

ilHtmlPurifierAbstractLibWrapper::purify (   $a_html,
  $a_config = null 
)
final

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

public

Parameters
string$a_htmlHTML snippet/document
Returns
string purified html

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

{
return $this->oPurifier->purify($a_html, $a_config);
}
ilHtmlPurifierAbstractLibWrapper::purifyArray ( Array  $a_array_of_html,
  $a_config = null 
)
final

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

Definition at line 64 of file class.ilHtmlPurifierAbstractLibWrapper.php.

{
return $this->oPurifier->purifyArray($a_array_of_html, $a_config);
}
ilHtmlPurifierAbstractLibWrapper::removeUnsupportedElements (   $a_array)
finalprotected

Removes all unsupported elements.

Parameters
Array$a_arrayarray of all elements
Returns
Array array of supported elements protected

Definition at line 137 of file class.ilHtmlPurifierAbstractLibWrapper.php.

Referenced by ilAssHtmlPurifier\getAllowedElements(), and ilHtmlForumPostPurifier\getPurifierConfigInstance().

{
$supportedElements = array();
$notSupportedTags = array(
'rp',
'rt',
'rb',
'rtc',
'rbc',
'ruby',
'u',
'strike',
'param',
'object'
);
foreach($a_array as $element)
{
if(!in_array($element, $notSupportedTags))
{
$supportedElements[] = $element;
}
}
return $supportedElements;
}

+ Here is the caller graph for this function:

ilHtmlPurifierAbstractLibWrapper::setPurifier ( HTMLPurifier  $oPurifier)
protected

Set the purifier by subclass.

Parameters
HTMLPurifier$oPurifierInstance of HTMLPurifier
Returns
ilHtmlPurifier This reference protected

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

References $oPurifier.

Referenced by __construct().

{
$this->oPurifier = $oPurifier;
return $this;
}

+ Here is the caller graph for this function:

Field Documentation

ilHtmlPurifierAbstractLibWrapper::$oPurifier = null
protected

Definition at line 26 of file class.ilHtmlPurifierAbstractLibWrapper.php.

Referenced by getPurifier(), and setPurifier().


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