mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-14 09:18:41 +00:00
25 lines
711 B
PHP
25 lines
711 B
PHP
|
<?php
|
||
|
|
||
|
require_once 'HTMLPurifier/AttrTransform.php';
|
||
|
|
||
|
// this MUST be placed in post, as it assumes that any value in dir is valid
|
||
|
|
||
|
HTMLPurifier_ConfigDef::define(
|
||
|
'Attr', 'DefaultTextDir', 'ltr',
|
||
|
'Defines the default text direction (ltr or rtl) of the document '.
|
||
|
'being parsed. This generally is the same as the value of the dir '.
|
||
|
'attribute in HTML, or ltr if that is not specified.'
|
||
|
);
|
||
|
|
||
|
class HTMLPurifier_AttrTransform_BdoDir extends HTMLPurifier_AttrTransform
|
||
|
{
|
||
|
|
||
|
function transform($attributes, $config) {
|
||
|
if (isset($attributes['dir'])) return $attributes;
|
||
|
$attributes['dir'] = $config->get('Attr', 'DefaultTextDir');
|
||
|
return $attributes;
|
||
|
}
|
||
|
|
||
|
}
|
||
|
|
||
|
?>
|