3 require_once 'HTMLPurifier/AttrTransform.php';
6 * Pre-transform that changes deprecated align attribute to text-align.
8 class HTMLPurifier_AttrTransform_TextAlign
9 extends HTMLPurifier_AttrTransform
{
11 function transform($attr, $config, &$context) {
13 if (!isset($attr['align'])) return $attr;
15 $align = strtolower(trim($attr['align']));
16 unset($attr['align']);
18 $values = array('left' => 1,
23 if (!isset($values[$align])) {
27 $attr['style'] = isset($attr['style']) ?
$attr['style'] : '';
28 $attr['style'] = "text-align:$align;" . $attr['style'];