ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
ilAssHtmlPurifier Class Reference
+ Inheritance diagram for ilAssHtmlPurifier:
+ Collaboration diagram for ilAssHtmlPurifier:

Protected Member Functions

 getPurifierType ()
 
 getPurifierConfigInstance ()
 
- Protected Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
 getPurifierConfigInstance ()
 Has to be implemented by subclasses to build the HTMLPurifier_Config instance with object specific configurations. More...
 
 setPurifier (HTMLPurifier $oPurifier)
 Set the purifier by subclass. More...
 
 getPurifier ()
 Get the purifier. More...
 
 removeUnsupportedElements ($a_array)
 Removes all unsupported elements. More...
 
 makeElementListTinyMceCompliant ($elements)
 

Private Member Functions

 getAllowedElements ()
 
 getElementsUsedForAdvancedEditing ()
 

Additional Inherited Members

- Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
 __construct ()
 Constructor. More...
 
 purify ($a_html, $a_config=null)
 Filters an HTML snippet/document to be XSS-free and standards-compliant. More...
 
 purifyArray (Array $a_array_of_html, $a_config=null)
 Filters an array of HTML snippets/documents to be XSS-free and standards-compliant. More...
 
- Public Member Functions inherited from ilHtmlPurifierInterface
 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...
 
- Static Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
static _getCacheDirectory ()
 Get the directory for HTMLPurifier cache files. More...
 
- Protected Attributes inherited from ilHtmlPurifierAbstractLibWrapper
 $oPurifier = null
 

Detailed Description

Definition at line 12 of file class.ilAssHtmlPurifier.php.

Member Function Documentation

◆ getAllowedElements()

ilAssHtmlPurifier::getAllowedElements ( )
private

Definition at line 38 of file class.ilAssHtmlPurifier.php.

References getElementsUsedForAdvancedEditing(), ilHtmlPurifierAbstractLibWrapper\makeElementListTinyMceCompliant(), and ilHtmlPurifierAbstractLibWrapper\removeUnsupportedElements().

Referenced by getPurifierConfigInstance().

39  {
40  $allowedElements = $this->getElementsUsedForAdvancedEditing();
41 
42  $allowedElements = $this->makeElementListTinyMceCompliant($allowedElements);
43  $allowedElements = $this->removeUnsupportedElements($allowedElements);
44 
45  return $allowedElements;
46  }
removeUnsupportedElements($a_array)
Removes all unsupported elements.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getElementsUsedForAdvancedEditing()

ilAssHtmlPurifier::getElementsUsedForAdvancedEditing ( )
private

Definition at line 48 of file class.ilAssHtmlPurifier.php.

References ilObjAdvancedEditing\_getUsedHTMLTags(), and getPurifierType().

Referenced by getAllowedElements().

49  {
50  include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
52  }
static _getUsedHTMLTags($a_module="")
Returns an array of all allowed HTML tags for text editing.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getPurifierConfigInstance()

ilAssHtmlPurifier::getPurifierConfigInstance ( )
protected
Returns
HTMLPurifier_Config Instance of HTMLPurifier_Config

Definition at line 22 of file class.ilAssHtmlPurifier.php.

References $config, ilHtmlPurifierAbstractLibWrapper\_getCacheDirectory(), HTMLPurifier_Config\createDefault(), getAllowedElements(), and getPurifierType().

23  {
25  $config->set('HTML.DefinitionID', $this->getPurifierType());
26  $config->set('HTML.DefinitionRev', 1);
27  $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
28  $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
29  $config->set('HTML.AllowedElements', $this->getAllowedElements());
30  $config->set('HTML.ForbiddenAttributes', 'div@style');
31  if ($def = $config->maybeGetRawHTMLDefinition()) {
32  $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
33  }
34 
35  return $config;
36  }
static _getCacheDirectory()
Get the directory for HTMLPurifier cache files.
static createDefault()
Convenience constructor that creates a default configuration object.
Definition: Config.php:154
+ Here is the call graph for this function:

◆ getPurifierType()

ilAssHtmlPurifier::getPurifierType ( )
protected

Definition at line 14 of file class.ilAssHtmlPurifier.php.

Referenced by getElementsUsedForAdvancedEditing(), and getPurifierConfigInstance().

15  {
16  return 'assessment';
17  }
+ Here is the caller graph for this function:

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