HTMLPurifier 4.4.0
/home/ezyang/Dev/htmlpurifier/library/HTMLPurifier/TagTransform/Simple.php
Go to the documentation of this file.
00001 <?php
00002 
00008 class HTMLPurifier_TagTransform_Simple extends HTMLPurifier_TagTransform
00009 {
00010 
00011     protected $style;
00012 
00017     public function __construct($transform_to, $style = null) {
00018         $this->transform_to = $transform_to;
00019         $this->style = $style;
00020     }
00021 
00022     public function transform($tag, $config, $context) {
00023         $new_tag = clone $tag;
00024         $new_tag->name = $this->transform_to;
00025         if (!is_null($this->style) &&
00026             ($new_tag instanceof HTMLPurifier_Token_Start || $new_tag instanceof HTMLPurifier_Token_Empty)
00027         ) {
00028             $this->prependCSS($new_tag->attr, $this->style);
00029         }
00030         return $new_tag;
00031     }
00032 
00033 }
00034 
00035 // vim: et sw=4 sts=4