ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
ilAssHtmlPurifier Class Reference
+ Inheritance diagram for ilAssHtmlPurifier:
+ Collaboration diagram for ilAssHtmlPurifier:

Protected Member Functions

 getPurifierType ()
 
 getPurifierConfigInstance ()
 
- Protected Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
 getPurifierConfigInstance ()
 
 setPurifier (HTMLPurifier $purifier)
 
 getPurifier ()
 
 removeUnsupportedElements (array $elements)
 Removes all unsupported elements. More...
 
 makeElementListTinyMceCompliant (array $elements)
 

Private Member Functions

 getAllowedElements ()
 
 getElementsUsedForAdvancedEditing ()
 

Additional Inherited Members

- Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
 __construct ()
 ilHtmlPurifierAbstractLibWrapper constructor. 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...
 
- Static Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
static _getCacheDirectory ()
 
- Protected Attributes inherited from ilHtmlPurifierAbstractLibWrapper
HTMLPurifier $purifier
 

Detailed Description

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

Member Function Documentation

◆ getAllowedElements()

ilAssHtmlPurifier::getAllowedElements ( )
private

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

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

Referenced by getPurifierConfigInstance().

60  : array
61  {
62  $allowedElements = $this->getElementsUsedForAdvancedEditing();
63 
64  $allowedElements = $this->makeElementListTinyMceCompliant($allowedElements);
65  $allowedElements = $this->removeUnsupportedElements($allowedElements);
66 
67  return $allowedElements;
68  }
removeUnsupportedElements(array $elements)
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 70 of file class.ilAssHtmlPurifier.php.

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

Referenced by getAllowedElements().

70  : array
71  {
72  include_once 'Services/AdvancedEditing/classes/class.ilObjAdvancedEditing.php';
74  }
static _getUsedHTMLTags(string $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 35 of file class.ilAssHtmlPurifier.php.

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

35  : HTMLPurifier_Config
36  {
37  $config = HTMLPurifier_Config::createDefault();
38  $config->set('HTML.DefinitionID', $this->getPurifierType());
39  $config->set('HTML.DefinitionRev', 1);
40  $config->set('Cache.SerializerPath', ilHtmlPurifierAbstractLibWrapper::_getCacheDirectory());
41  $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
42  $config->set('HTML.AllowedElements', $this->getAllowedElements());
43  $config->set('HTML.ForbiddenAttributes', 'div@style');
44  $config->autoFinalize = false;
45  $config->set(
46  'URI.AllowedSchemes',
47  array_merge(
48  $config->get('URI.AllowedSchemes'),
49  ['data' => true]
50  )
51  );
52  $config->autoFinalize = true;
53  if ($def = $config->maybeGetRawHTMLDefinition()) {
54  $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
55  }
56 
57  return $config;
58  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
+ Here is the call graph for this function:

◆ getPurifierType()

ilAssHtmlPurifier::getPurifierType ( )
protected

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

Referenced by getElementsUsedForAdvancedEditing(), and getPurifierConfigInstance().

27  : string
28  {
29  return 'assessment';
30  }
+ Here is the caller graph for this function:

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