How do I get an HTML cleaner to remove content from forbidden tags?

I am using this code to set up my HTML cleaner:

$config   = \HTMLPurifier_Config::createDefault();
$config->set('HTML.Allowed', 'div,p,ol,ul,li,br'); // only allow these tags
$purifier = new \HTMLPurifier($config);

      

I found that while the HTMLPurifier strips tags like style

and table

, the content inside those tags is still included in the stripped output.

How can I get the HTML cleaner to not return content in tags that are not allowed?

EDIT:

I found the Core.HiddenElements setting that makes it seem like the content of the tag style

shouldn't appear in the output, but with my configuration, it does.

I tried adding the following to my code, but it didn't make any difference (the content of the tags style

is still showing):

$config->set('Core.HiddenElements', array (
    'script' => true,
    'style' => true,
    'table' => true
));

      

+3
htmlpurifier


source to share


No one has answered this question yet

Check out similar questions:

five
HTML cleanup - change the default HTML tag settings
3
How to allow inline style tags in HTML filter filter filter
2
Requesting IRC URI Scheme for HTML 4.2.0 Purifier
2
HTML Cleaner - Allowing Links?
2
HTML cleaner - exclude forbidden tags instead of removing
2
Html purifier clears p-label
0
how to use htmlpurifier to pass the whole document including html, head, title, body
0
HTML Purifier - iframes and scripts
0
Why is HTML Purifier ignoring my runtime settings?
0
HTML cleaner to clean up event attributes



All Articles
Loading...
X
Show
Funny
Dev
Pics