【发布时间】:2012-07-31 19:51:59
【问题描述】:
如何在 HTMLPurifier 中允许“类”?我正在尝试净化这个:
<div class="txt_r" id="test">Blah</div>
我得到:
<div id="test">Blah</div>
为什么课堂消失了?我正在使用下一个配置:
$config->set('Attr.EnableID', true);
$config->set('CSS.Trusted', true);
$config->set('HTML.AllowedAttributes', 'style, src, class');
【问题讨论】:
-
你为什么使用 CSS.Trusted?
-
我不确定,是否启用内联 css?
-
不,那是错误的。我真的犯了一个很大的错误,称这些配置指令为“Trusted”,它们真的应该被称为“UnsafeAllowXSS”。如果您不知道为什么要使用它,请将其关闭。
-
好吧 tnx 寻求建议,但如果我关闭它,我不知道如何允许 CSS 像:top、left、bottom、right 等等。
标签: html htmlpurifier