PSR-2 reformatting PHPDoc corrections
[htmlpurifier.git] / library / HTMLPurifier / AttrTransform / BoolToCSS.php
blobf25cd01955f85a5d3851016f8a35d569a7bb3459
1 <?php
3 /**
4 * Pre-transform that changes converts a boolean attribute to fixed CSS
5 */
6 class HTMLPurifier_AttrTransform_BoolToCSS extends HTMLPurifier_AttrTransform
8 /**
9 * Name of boolean attribute that is trigger.
10 * @type string
12 protected $attr;
14 /**
15 * CSS declarations to add to style, needs trailing semicolon.
16 * @type string
18 protected $css;
20 /**
21 * @param string $attr attribute name to convert from
22 * @param string $css CSS declarations to add to style (needs semicolon)
24 public function __construct($attr, $css)
26 $this->attr = $attr;
27 $this->css = $css;
30 /**
31 * @param array $attr
32 * @param HTMLPurifier_Config $config
33 * @param HTMLPurifier_Context $context
34 * @return array
36 public function transform($attr, $config, $context)
38 if (!isset($attr[$this->attr])) {
39 return $attr;
41 unset($attr[$this->attr]);
42 $this->prependCSS($attr, $this->css);
43 return $attr;
47 // vim: et sw=4 sts=4