Emulation layer for code that used kses(), substituting in HTML Purifier.
More...
Go to the source code of this file.
|
| kses ($string, $allowed_html, $allowed_protocols=null) |
|
Emulation layer for code that used kses(), substituting in HTML Purifier.
Definition in file HTMLPurifier.kses.php.
◆ kses()
kses |
( |
|
$string, |
|
|
|
$allowed_html, |
|
|
|
$allowed_protocols = null |
|
) |
| |
Definition at line 10 of file HTMLPurifier.kses.php.
References HTMLPurifier_Config\createDefault(), and HTMLPurifier().
12 $allowed_elements = array();
13 $allowed_attributes = array();
14 foreach ($allowed_html as $element => $attributes) {
15 $allowed_elements[$element] =
true;
16 foreach ($attributes as $attribute => $x) {
17 $allowed_attributes[
"$element.$attribute"] =
true;
20 $config->set(
'HTML.AllowedElements', $allowed_elements);
21 $config->set(
'HTML.AllowedAttributes', $allowed_attributes);
22 $allowed_schemes = array();
23 if ($allowed_protocols !== null) {
24 $config->set(
'URI.AllowedSchemes', $allowed_protocols);
27 return $purifier->purify($string);
static createDefault()
Convenience constructor that creates a default configuration object.
HTMLPurifier($html, $config=null)
Purify HTML.