如何在 HtmlPurifier 中允许自定义(html5 数据-*)属性?
输入:
<img src="/my.jpg" data-type="5" alt="" />
导致错误:
Attribute 'data-type' in element 'img' not supported
(for information on implementing this, see the support forums)
HtmlPurifier 选项设置为:
'HTML.AllowedAttributes' => array('img.src', 'a.href', 'img.data-type')