Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / AttrTransform / BoolToCSS.php
blobf4a16a7f1725e25e1c44e0fb69f6fbf7e2d48c31
1 <?php
3 require_once 'HTMLPurifier/AttrTransform.php';
5 /**
6 * Pre-transform that changes converts a boolean attribute to fixed CSS
7 */
8 class HTMLPurifier_AttrTransform_BoolToCSS
9 extends HTMLPurifier_AttrTransform {
11 /**
12 * Name of boolean attribute that is trigger
14 var $attr;
16 /**
17 * CSS declarations to add to style, needs trailing semicolon
19 var $css;
21 /**
22 * @param $attr string attribute name to convert from
23 * @param $css string CSS declarations to add to style (needs semicolon)
25 function HTMLPurifier_AttrTransform_BoolToCSS($attr, $css) {
26 $this->attr = $attr;
27 $this->css = $css;
30 function transform($attr, $config, &$context) {
31 if (!isset($attr[$this->attr])) return $attr;
32 unset($attr[$this->attr]);
33 $this->prependCSS($attr, $this->css);
34 return $attr;