2006-08-14 23:11:28 +00:00
|
|
|
<?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(
|
2006-08-27 18:49:16 +00:00
|
|
|
'Attr', 'DefaultTextDir', 'ltr', 'string',
|
2006-08-14 23:11:28 +00:00
|
|
|
'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.'
|
|
|
|
);
|
2006-08-27 18:49:16 +00:00
|
|
|
HTMLPurifier_ConfigDef::defineAllowedValues(
|
|
|
|
'Attr', 'DefaultTextDir', array( 'ltr', 'rtl' )
|
|
|
|
);
|
2006-08-14 23:11:28 +00:00
|
|
|
|
2006-08-20 21:55:28 +00:00
|
|
|
/**
|
|
|
|
* Post-trasnform that ensures that bdo tags have the dir attribute set.
|
|
|
|
*/
|
2006-08-14 23:11:28 +00:00
|
|
|
class HTMLPurifier_AttrTransform_BdoDir extends HTMLPurifier_AttrTransform
|
|
|
|
{
|
|
|
|
|
2006-08-17 20:29:34 +00:00
|
|
|
function transform($attr, $config) {
|
2006-08-18 01:27:14 +00:00
|
|
|
if (isset($attr['dir'])) return $attr;
|
2006-08-17 20:29:34 +00:00
|
|
|
$attr['dir'] = $config->get('Attr', 'DefaultTextDir');
|
|
|
|
return $attr;
|
2006-08-14 23:11:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|