Automatic installer.php lang files by installer_builder (20070726)
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / AttrTransform / TextAlign.php
blob09088fe1768486e329f9a16ee5056969108d3bdc
1 <?php
3 require_once 'HTMLPurifier/AttrTransform.php';
5 /**
6 * Pre-transform that changes deprecated align attribute to text-align.
7 */
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,
19 'right' => 1,
20 'center' => 1,
21 'justify' => 1);
23 if (!isset($values[$align])) {
24 return $attr;
27 $attr['style'] = isset($attr['style']) ? $attr['style'] : '';
28 $attr['style'] = "text-align:$align;" . $attr['style'];
30 return $attr;