Make extractBody not terminate prematurely on first </body>.
[htmlpurifier.git] / library / HTMLPurifier / AttrTransform / Length.php
blobea2f30473d6d14a7e77cff3a16f0fcd80712e3b5
1 <?php
3 /**
4 * Class for handling width/height length attribute transformations to CSS
5 */
6 class HTMLPurifier_AttrTransform_Length extends HTMLPurifier_AttrTransform
9 protected $name;
10 protected $cssName;
12 public function __construct($name, $css_name = null) {
13 $this->name = $name;
14 $this->cssName = $css_name ? $css_name : $name;
17 public function transform($attr, $config, $context) {
18 if (!isset($attr[$this->name])) return $attr;
19 $length = $this->confiscateAttr($attr, $this->name);
20 if(ctype_digit($length)) $length .= 'px';
21 $this->prependCSS($attr, $this->cssName . ":$length;");
22 return $attr;
27 // vim: et sw=4 sts=4