[3.0.0] Convert all $context calls away from references
[htmlpurifier.git] / library / HTMLPurifier / AttrTransform / BdoDir.php
blob15f9188e0940d921b8f29ac827d6c556a7d78d07
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 public function transform($attr, $config, $context) {
24 if (isset($attr['dir'])) return $attr;
25 $attr['dir'] = $config->get('Attr', 'DefaultTextDir');
26 return $attr;