ILIAS  trunk Revision v11.0_alpha-1769-g99a433fe2dc
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
ilAccessibilityDocumentHtmlPurifier Class Reference

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V. More...

+ Inheritance diagram for ilAccessibilityDocumentHtmlPurifier:
+ Collaboration diagram for ilAccessibilityDocumentHtmlPurifier:

Public Member Functions

 __construct (?array $allowedTags=null, ?string $cacheDirectory=null)
 
- 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...
 

Protected Member Functions

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

Protected Attributes

string $cacheDirectory = ''
 
- Protected Attributes inherited from ilHtmlPurifierAbstractLibWrapper
HTMLPurifier $purifier
 

Private Attributes

array $allowedTags = []
 

Additional Inherited Members

- Static Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
static _getCacheDirectory ()
 

Detailed Description

This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.

ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.

If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning Class ilAccessibilityDocumentHtmlPurifier

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

Constructor & Destructor Documentation

◆ __construct()

ilAccessibilityDocumentHtmlPurifier::__construct ( ?array  $allowedTags = null,
?string  $cacheDirectory = null 
)

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

References $allowedTags, $cacheDirectory, ILIAS\GlobalScreen\Provider\__construct(), ilHtmlPurifierAbstractLibWrapper\_getCacheDirectory(), ilObjAdvancedEditing\_getUsedHTMLTags(), and null.

28  {
29  if (null === $cacheDirectory) {
31  }
32  $this->cacheDirectory = $cacheDirectory;
33 
34  if (null === $allowedTags) {
36  }
37  $this->allowedTags = $allowedTags;
38 
40  $this->allowedTags = $allowedTags;
41  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
__construct(Container $dic, ilPlugin $plugin)
static _getUsedHTMLTags(string $a_module="")
Returns an array of all allowed HTML tags for text editing.
+ Here is the call graph for this function:

Member Function Documentation

◆ getPurifierConfigInstance()

ilAccessibilityDocumentHtmlPurifier::getPurifierConfigInstance ( )
protected

Definition at line 43 of file class.ilAccessibilityDocumentHtmlPurifier.php.

References $allowedTags, ilHtmlPurifierAbstractLibWrapper\makeElementListTinyMceCompliant(), and ilHtmlPurifierAbstractLibWrapper\removeUnsupportedElements().

44  {
45  $config = HTMLPurifier_Config::createDefault();
46  $config->set('HTML.DefinitionID', 'ilias accessibility document');
47  $config->set('HTML.DefinitionRev', 1);
48  $config->set('HTML.TargetBlank', true);
49  $config->set('Cache.SerializerPath', $this->cacheDirectory);
50  $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
51 
52  $tags = $this->allowedTags;
53  $tags = $this->makeElementListTinyMceCompliant($tags);
54 
55  $tags[] = 'b';
56  $tags[] = 'i';
57 
58  $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
59  $config->set('HTML.ForbiddenAttributes', 'div@style');
60 
61  if ($def = $config->maybeGetRawHTMLDefinition()) {
62  $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
63  }
64 
65  return $config;
66  }
removeUnsupportedElements(array $elements)
Removes all unsupported elements.
+ Here is the call graph for this function:

Field Documentation

◆ $allowedTags

array ilAccessibilityDocumentHtmlPurifier::$allowedTags = []
private

◆ $cacheDirectory

string ilAccessibilityDocumentHtmlPurifier::$cacheDirectory = ''
protected

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

Referenced by __construct().


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