ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
HTMLPurifier.kses.php File Reference

Emulation layer for code that used kses(), substituting in HTML Purifier. More...

Go to the source code of this file.

Functions

 kses ($string, $allowed_html, $allowed_protocols=null)
 

Detailed Description

Emulation layer for code that used kses(), substituting in HTML Purifier.

Definition in file HTMLPurifier.kses.php.

Function Documentation

◆ kses()

kses (   $string,
  $allowed_html,
  $allowed_protocols = null 
)

Definition at line 10 of file HTMLPurifier.kses.php.

References $attributes, $config, $x, HTMLPurifier_Config\createDefault(), and HTMLPurifier().

11 {
13  $allowed_elements = array();
14  $allowed_attributes = array();
15  foreach ($allowed_html as $element => $attributes) {
16  $allowed_elements[$element] = true;
17  foreach ($attributes as $attribute => $x) {
18  $allowed_attributes["$element.$attribute"] = true;
19  }
20  }
21  $config->set('HTML.AllowedElements', $allowed_elements);
22  $config->set('HTML.AllowedAttributes', $allowed_attributes);
23  if ($allowed_protocols !== null) {
24  $config->set('URI.AllowedSchemes', $allowed_protocols);
25  }
26  $purifier = new HTMLPurifier($config);
27  return $purifier->purify($string);
28 }
$config
Definition: bootstrap.php:15
static createDefault()
Convenience constructor that creates a default configuration object.
Definition: Config.php:154
if(array_key_exists('yes', $_REQUEST)) $attributes
Definition: getconsent.php:85
HTMLPurifier($html, $config=null)
Purify HTML.
$x
Definition: complexTest.php:9
+ Here is the call graph for this function: