6 * replaces styles with HTML
13 require_once 'Filter.php';
15 class HTML_Clean_FilterStyleToTag extends HTML_Clean_Filter
20 // what we are going to change..
24 'B' => array( 'font-weight' => 'bold' ),
25 'I' => array( 'font-style' => 'italic' ),
27 // h1.. h6 ?? font-size?
28 'SUP' => array( 'vertical-align' => 'super'),
29 'SUB' => array( 'vertical-align' => 'sub' )
33 function __construct($cfg)
35 parent::__construct($cfg);
36 $this->walk($cfg['node']);
43 function replaceTag($node)
47 if (!$node->hasAttribute("style")) {
51 $style = $this->styleToObject($node, true);
52 foreach ($this->tags as $tn => $kv) {
54 if (!isset($style[$k]) || $style[$k] != $v) {
60 if (!count($inject)) {
63 $this->nodeSetStyle($node, $style);
64 $cn = $this->arrayFrom($node->childNodes);
66 foreach($inject as $t) {
68 $nc = $node->ownerDocument->createElement($t);
69 $nn->appendChild($nc);
73 $node->removeChild($n);
77 return true; /// iterate thru