mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-14 01:08:41 +00:00
2deb2fc285
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@166 48356398-32a2-884e-a903-53898d9a118a
33 lines
769 B
PHP
33 lines
769 B
PHP
<?php
|
|
|
|
require_once 'HTMLPurifier/AttrTransform.php';
|
|
|
|
class HTMLPurifier_AttrTransform_TextAlign
|
|
extends HTMLPurifier_AttrTransform {
|
|
|
|
function transform($attr) {
|
|
|
|
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;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|