ILIAS  trunk Revision v11.0_alpha-1811-gd2d5443e411
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator 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 61 of file class.ilAssHtmlPurifier.php.

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

Referenced by getPurifierConfigInstance().

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

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

Referenced by getAllowedElements().

71  : array
72  {
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 ilHtmlPurifierAbstractLibWrapper\_getCacheDirectory(), getAllowedElements(), and getPurifierType().

36  {
37  $config = HTMLPurifier_Config::createDefault();
38  $config->set('HTML.DefinitionID', $this->getPurifierType());
39  $config->set('HTML.DefinitionRev', 2);
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('img', 'data-id', 'Number');
55  $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
56  }
57 
58  return $config;
59  }
+ 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: