ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilTermsOfServiceDocumentHtmlPurifier Class Reference

Class ilTermsOfServiceDocumentHtmlPurifier. More...

+ Inheritance diagram for ilTermsOfServiceDocumentHtmlPurifier:
+ Collaboration diagram for ilTermsOfServiceDocumentHtmlPurifier:

Public Member Functions

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

Protected Member Functions

 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)
 

Protected Attributes

 $cacheDirectory = ''
 
- Protected Attributes inherited from ilHtmlPurifierAbstractLibWrapper
 $oPurifier = null
 

Private Attributes

 $allowedTags = []
 

Additional Inherited Members

- Static Public Member Functions inherited from ilHtmlPurifierAbstractLibWrapper
static _getCacheDirectory ()
 Get the directory for HTMLPurifier cache files. More...
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

ilTermsOfServiceDocumentHtmlPurifier constructor.

Parameters
array | null$allowedTags
string$cacheDirectory

Definition at line 21 of file class.ilTermsOfServiceDocumentHtmlPurifier.php.

References $allowedTags, $cacheDirectory, ilHtmlPurifierAbstractLibWrapper\_getCacheDirectory(), and ilObjAdvancedEditing\_getUsedHTMLTags().

22  {
23  if (null === $cacheDirectory) {
25  }
26  $this->cacheDirectory = $cacheDirectory;
27 
28  if (null === $allowedTags) {
30  }
31  $this->allowedTags = $allowedTags;
32 
33  parent::__construct();
34  $this->allowedTags = $allowedTags;
35  }
static _getCacheDirectory()
Get the directory for HTMLPurifier cache files.
static _getUsedHTMLTags($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()

ilTermsOfServiceDocumentHtmlPurifier::getPurifierConfigInstance ( )
protected

Definition at line 40 of file class.ilTermsOfServiceDocumentHtmlPurifier.php.

References $allowedTags, $config, $def, $tags, HTMLPurifier_Config\createDefault(), ilHtmlPurifierAbstractLibWrapper\makeElementListTinyMceCompliant(), and ilHtmlPurifierAbstractLibWrapper\removeUnsupportedElements().

41  {
43  $config->set('HTML.DefinitionID', 'ilias termsofservice document');
44  $config->set('HTML.DefinitionRev', 1);
45  $config->set('HTML.TargetBlank', true);
46  $config->set('Cache.SerializerPath', $this->cacheDirectory);
47  $config->set('HTML.Doctype', 'XHTML 1.0 Strict');
48 
51 
52  $tags[] = 'b';
53  $tags[] = 'i';
54 
55  $config->set('HTML.AllowedElements', $this->removeUnsupportedElements($tags));
56  $config->set('HTML.ForbiddenAttributes', 'div@style');
57 
58  if ($def = $config->maybeGetRawHTMLDefinition()) {
59  $def->addAttribute('a', 'target', 'Enum#_blank,_self,_target,_top');
60  }
61 
62  return $config;
63  }
$config
Definition: bootstrap.php:15
removeUnsupportedElements($a_array)
Removes all unsupported elements.
$tags
Definition: croninfo.php:19
static createDefault()
Convenience constructor that creates a default configuration object.
Definition: Config.php:154
$def
Definition: croninfo.php:21
+ Here is the call graph for this function:

Field Documentation

◆ $allowedTags

ilTermsOfServiceDocumentHtmlPurifier::$allowedTags = []
private

◆ $cacheDirectory

ilTermsOfServiceDocumentHtmlPurifier::$cacheDirectory = ''
protected

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

Referenced by __construct().


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