Merge in PHP5 strict changes that are applicable to PHP4.
[htmlpurifier.git] / library / HTMLPurifier / AttrTransform / BdoDir.php
blob0ea5eb6dc26ef3aa5d405a5d8b59d3f973aafa2e
1 <?php
3 require_once 'HTMLPurifier/AttrTransform.php';
5 // this MUST be placed in post, as it assumes that any value in dir is valid
7 HTMLPurifier_ConfigSchema::define(
8 'Attr', 'DefaultTextDir', 'ltr', 'string',
9 'Defines the default text direction (ltr or rtl) of the document '.
10 'being parsed. This generally is the same as the value of the dir '.
11 'attribute in HTML, or ltr if that is not specified.'
13 HTMLPurifier_ConfigSchema::defineAllowedValues(
14 'Attr', 'DefaultTextDir', array( 'ltr', 'rtl' )
17 /**
18 * Post-trasnform that ensures that bdo tags have the dir attribute set.
20 class HTMLPurifier_AttrTransform_BdoDir extends HTMLPurifier_AttrTransform
23 function transform($attr, $config, &$context) {
24 if (isset($attr['dir'])) return $attr;
25 $attr['dir'] = $config->get('Attr', 'DefaultTextDir');
26 return $attr;