I can't make <label> tag recognizable by HTMLPurifier.
Running
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.Allowed', 'label');
$purifier = new HTMLPurifier($config);
echo $purifier->purify("<label>Link</label>");
Throws Warning: Element 'label' is not supported (for information on implementing this, see the support forums).
Also no luck using addElement()
$config = HTMLPurifier_Config::createDefault();
$config->set('HTML.DefinitionID', 'test');
$config->set('HTML.DefinitionRev', 1);
if ($def = $config->maybeGetRawHTMLDefinition()) {
$def->addElement('label', 'Block', 'Inline', 'Common', array());
}
$purifier = new HTMLPurifier($config);
echo $purifier->purify("<label>Link</label>");
Still returns just Link, where I expect <label>Link</label>. Any thoughts?
Update: Using $config->set('HTML.Trusted', true); does the difference, but it disables XSS protection. Not an option for me.