burzum / cakephp-html-purifier

This is a CakePHP wrapper for the HTML Purifier lib. The plugin includes a trait, a view helper, a behavior and a shell to clean your markup wherever you like, in the view or in the model layer or clean any table and field using the shell.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Table

rudy1976s opened this issue · comments

commented

Hi I have installed this plugin which works well but it always strips out tables tags.
I tried to add table to the AllowedElements but it breaks giving the following error:

Warning (512): Required attribute 'src' in element 'img' was not allowed, which means 'img' will not be allowed either [APP/Plugin/HtmlPurifier/Vendor/HtmlPurifier/library/HTMLPurifier/HTMLDefinition.php, line 305]

I have used your configuration as follow:

$config = HTMLPurifier_Config::createDefault();

$config->set('HTML.AllowedElements', 'a, em, blockquote, table, p, strong, pre, code, span, ul, ol, li, img');
$config->set('HTML.AllowedAttributes', 'a.href, a.title, img.src, img.alt');
$config->set('HTML.AllowedAttributes', "*.style");
$config->set('CSS.AllowedProperties', 'text-decoration');
$config->set('HTML.TidyLevel', 'heavy');
$config->set('HTML.Doctype', 'XHTML 1.0 Transitional');

Purifier::config('HTMLpurifier', $config);

Where do I make mistake?

Thank you in advance

Rudy

Please ask this the author of the HtmlPurifier lib, this isn't related to the plugin code nor do I know the answer, sorry.

Remove that line

`$config->set('HTML.AllowedAttributes', "*.style");

It overrides the line before. I've fixed that in the develop branch for now, going to merge to master later.