Merge commit 'catalyst/MOODLE_19_STABLE' into mdl19-linuxchix
[moodle-linuxchix.git] / lib / htmlpurifier / HTMLPurifier / AttrTransform / BdoDir.php
blobf127feb2b29d3c6ef3977df41200be1bca55458e
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;