fix(web): prevent warning from HTMLPurifier
All checks were successful
continuous-integration/drone/push Build is passing

ref: http://htmlpurifier.org/docs/enduser-customize.html#optimized
This commit is contained in:
Baoshuo Ren 2022-10-22 10:11:36 +08:00
parent 054cb76481
commit bae26f1c16
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -167,9 +167,6 @@ class HTML {
public static function purifier() {
$config = HTMLPurifier_Config::createDefault();
// $config->set('Cache.DefinitionImpl', null);
$config->set('HTML.DefinitionID', 'UOJ__HTML::purifier()');
$config->set('HTML.DefinitionRev', 1);
$config->set('Output.Newline', true);
$def = $config->getHTMLDefinition(true);
@ -210,8 +207,6 @@ class HTML {
'span' => ['data-realname' => 'Text', 'data-uoj-username' => 'Number'],
];
$config = HTMLPurifier_Config::createDefault();
$allowed_elements = [];
$allowed_attributes = [];
@ -222,12 +217,9 @@ class HTML {
}
}
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.AllowedElements', $allowed_elements);
$config->set('HTML.AllowedAttributes', $allowed_attributes);
// $config->set('Cache.DefinitionImpl', null);
$config->set('HTML.DefinitionID', 'UOJ__HTML::purifier_inline()');
$config->set('HTML.DefinitionRev', 1);
$def = $config->getHTMLDefinition(true);
foreach ($allowed_html as $element => $attributes) {