File indexing completed on 2024-12-22 05:36:19

0001 <?php
0002 
0003 /**
0004  * Pre-transform that changes deprecated border attribute to CSS.
0005  */
0006 class HTMLPurifier_AttrTransform_Border extends HTMLPurifier_AttrTransform
0007 {
0008     /**
0009      * @param array $attr
0010      * @param HTMLPurifier_Config $config
0011      * @param HTMLPurifier_Context $context
0012      * @return array
0013      */
0014     public function transform($attr, $config, $context)
0015     {
0016         if (!isset($attr['border'])) {
0017             return $attr;
0018         }
0019         $border_width = $this->confiscateAttr($attr, 'border');
0020         // some validation should happen here
0021         $this->prependCSS($attr, "border:{$border_width}px solid;");
0022         return $attr;
0023     }
0024 }
0025 
0026 // vim: et sw=4 sts=4