File indexing completed on 2024-12-22 05:36:19

0001 <?php
0002 
0003 // this MUST be placed in post, as it assumes that any value in dir is valid
0004 
0005 /**
0006  * Post-trasnform that ensures that bdo tags have the dir attribute set.
0007  */
0008 class HTMLPurifier_AttrTransform_BdoDir extends HTMLPurifier_AttrTransform
0009 {
0010 
0011     /**
0012      * @param array $attr
0013      * @param HTMLPurifier_Config $config
0014      * @param HTMLPurifier_Context $context
0015      * @return array
0016      */
0017     public function transform($attr, $config, $context)
0018     {
0019         if (isset($attr['dir'])) {
0020             return $attr;
0021         }
0022         $attr['dir'] = $config->get('Attr.DefaultTextDir');
0023         return $attr;
0024     }
0025 }
0026 
0027 // vim: et sw=4 sts=4