【发布时间】:2015-02-04 08:26:04
【问题描述】:
我使用 HTMLPurifier 4.6.0 过滤 HTML。我的 HTML 有这一行:
<pre style="overflow-x: scroll; word-wrap: normal; white-space: pre;">
提交后被截断:
<pre style="white-space: pre;">
我只想允许
样式“overflow-x:scroll”和“word-wrap:normal”。我找到了这个页面http://htmlpurifier.org/docs/enduser-customize.html并尝试了:
$config->set('HTML.DefinitionID', 'enduser-customize.html'); $config->set('HTML.DefinitionRev', 1); $config->set('Cache.DefinitionImpl', null); // TODO: remove this later! if ($def = $config->maybeGetRawHTMLDefinition()) { $def->addAttribute('pre', 'style', 'overflow-x'); }我在设置addAttribute() 时遇到问题。有人可以在这里帮助我吗?谢谢!
【问题讨论】:
标签: htmlpurifier