Reputation: 1233
I am needing the code that will allow my users to input centered text and not have htmlpurifier strip it out.
Thanks!
Upvotes: 3
Views: 1162
Reputation: 6179
Grabbing half the answer from your(?) HTML Purifier thread:
$config = HTMLPurifier_Config::createDefault();
$config->set('CSS.AllowedProperties', 'text-align');
$purifier = new HTMLPurifier($config);
That's the first step. If you want to disallow anything but center
as in that thread, you would change the CSS AttrDef
for text-align
:
$css = $purifier->getCSSDefinition();
$css->info['text-align'] = new HTMLPurifier_AttrDef_Enum(array('center'));
// should allow text-align:center but not text-align:right or the likes:
$purifier->purify(/* ... */);
Upvotes: 3
Reputation: 26742
The default configuration of HTML Purifier will not strip centered text.
Upvotes: 0