mirror of
https://github.com/EGroupware/egroupware.git
synced 2024-11-17 13:33:15 +01:00
8f797be836
- can be used via html class like: $clean_html = html::purify($html); - using it now in eTemplate to remove malicious code from html: a) when displaying "formatted text" b) when "formatted text" get's input by the user
53 lines
1.4 KiB
PHP
Executable File
53 lines
1.4 KiB
PHP
Executable File
<?php
|
|
|
|
/**
|
|
* Converts HTMLPurifier_ConfigSchema_Interchange to our runtime
|
|
* representation used to perform checks on user configuration.
|
|
*/
|
|
class HTMLPurifier_ConfigSchema_Builder_ConfigSchema
|
|
{
|
|
|
|
public function build($interchange) {
|
|
$schema = new HTMLPurifier_ConfigSchema();
|
|
foreach ($interchange->namespaces as $n) {
|
|
$schema->addNamespace($n->namespace);
|
|
}
|
|
foreach ($interchange->directives as $d) {
|
|
$schema->add(
|
|
$d->id->namespace,
|
|
$d->id->directive,
|
|
$d->default,
|
|
$d->type,
|
|
$d->typeAllowsNull
|
|
);
|
|
if ($d->allowed !== null) {
|
|
$schema->addAllowedValues(
|
|
$d->id->namespace,
|
|
$d->id->directive,
|
|
$d->allowed
|
|
);
|
|
}
|
|
foreach ($d->aliases as $alias) {
|
|
$schema->addAlias(
|
|
$alias->namespace,
|
|
$alias->directive,
|
|
$d->id->namespace,
|
|
$d->id->directive
|
|
);
|
|
}
|
|
if ($d->valueAliases !== null) {
|
|
$schema->addValueAliases(
|
|
$d->id->namespace,
|
|
$d->id->directive,
|
|
$d->valueAliases
|
|
);
|
|
}
|
|
}
|
|
$schema->postProcess();
|
|
return $schema;
|
|
}
|
|
|
|
}
|
|
|
|
// vim: et sw=4 sts=4
|