Add full documentation. Implement deferred ChildDef to HTMLModule. Add missing attrib...
[htmlpurifier.git] / library / HTMLPurifier / HTMLModule / Bdo.php
blobbb8e7ad33a82539ece7a4508b5db38b6cf17486b
1 <?php
3 require_once 'HTMLPurifier/HTMLModule.php';
4 require_once 'HTMLPurifier/AttrTransform/BdoDir.php';
6 /**
7 * XHTML 1.1 Bi-directional Text Module, defines elements that
8 * declare directionality of content. Text Extension Module.
9 */
10 class HTMLPurifier_HTMLModule_Bdo extends HTMLPurifier_HTMLModule
13 var $elements = array('bdo');
14 var $info = array();
15 var $content_sets = array('Inline' => 'bdo');
16 var $attr_collection = array(
17 'I18N' => array('dir' => false)
20 function HTMLPurifier_HTMLModule_Bdo() {
21 $dir = new HTMLPurifier_AttrDef_Enum(array('ltr','rtl'), false);
22 $this->attr_collection['I18N']['dir'] = $dir;
23 $this->info['bdo'] = new HTMLPurifier_ElementDef();
24 $this->info['bdo']->attr = array(
25 0 => array('Core'),
26 'dir' => $dir, // required
27 // The Abstract Module specification has the attribute
28 // inclusions wrong for bdo: bdo allows
29 // xml:lang too (and we'll toss in lang for good measure,
30 // though it is not allowed for XHTML 1.1, this will
31 // be managed with a global attribute transform)
32 'lang' => 'Lang',
33 'xml:lang' => 'Lang'
35 $this->info['bdo']->content_model = '#PCDATA | Inline';
36 $this->info['bdo']->content_model_type = 'optional';
37 // provides fallback behavior if dir's missing (dir is required)
38 $this->info['bdo']->attr_transform_post[] =
39 new HTMLPurifier_AttrTransform_BdoDir();