Welcome! » Log In » Create A New Profile

Negative Margins

Posted by MarkWade508 
Negative Margins
February 08, 2016 09:01AM

What is the easiest way to configure HTMLPurifier to not allow negative margins on elements?

Re: Negative Margins
February 08, 2016 04:44PM

Look at

        $margin =
            $this->info['margin-top'] =
            $this->info['margin-bottom'] =
            $this->info['margin-left'] =
            $this->info['margin-right'] = new HTMLPurifier_AttrDef_CSS_Composite(
                    new HTMLPurifier_AttrDef_CSS_Length(),
                    new HTMLPurifier_AttrDef_CSS_Percentage(),
                    new HTMLPurifier_AttrDef_Enum(array('auto'))

        $this->info['margin'] = new HTMLPurifier_AttrDef_CSS_Multiple($margin);

in CSSDefinition.php you want to pass some bounds to the Length constructor and maybe the others. You can use getCSSDefinition to get a copy of CSSDefinition to modify yourself if you don't want to patch source code.

Sorry, you do not have permission to post/reply in this forum.