2006-08-05 02:56:57 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/AttrTransform.php';
|
|
|
|
|
|
|
|
class HTMLPurifier_AttrTransform_TextAlign
|
|
|
|
extends HTMLPurifier_AttrTransform {
|
|
|
|
|
2006-08-14 23:11:28 +00:00
|
|
|
function transform($attr, $config) {
|
2006-08-05 02:56:57 +00:00
|
|
|
|
|
|
|
if (!isset($attr['align'])) return $attr;
|
|
|
|
|
|
|
|
$align = strtolower(trim($attr['align']));
|
|
|
|
unset($attr['align']);
|
|
|
|
|
|
|
|
$values = array('left' => 1,
|
|
|
|
'right' => 1,
|
|
|
|
'center' => 1,
|
|
|
|
'justify' => 1);
|
|
|
|
|
|
|
|
if (!isset($values[$align])) {
|
|
|
|
return $attr;
|
|
|
|
}
|
|
|
|
|
|
|
|
$attr['style'] = isset($attr['style']) ? $attr['style'] : '';
|
|
|
|
$attr['style'] = "text-align:$align;" . $attr['style'];
|
|
|
|
|
|
|
|
return $attr;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|