Release 2.0.1, merged in 1181 to HEAD.
[htmlpurifier.git] / library / HTMLPurifier / HTMLModule / Edit.php
blob37a53c337ab0ba7d5e12fdcfb78a71cb49fdfe21
1 <?php
3 require_once 'HTMLPurifier/HTMLModule.php';
4 require_once 'HTMLPurifier/ChildDef/Chameleon.php';
6 /**
7 * XHTML 1.1 Edit Module, defines editing-related elements. Text Extension
8 * Module.
9 */
10 class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
13 var $name = 'Edit';
15 function HTMLPurifier_HTMLModule_Edit() {
16 $contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow';
17 $attr = array(
18 'cite' => 'URI',
19 // 'datetime' => 'Datetime', // not implemented
21 $this->addElement('del', true, 'Inline', $contents, 'Common', $attr);
22 $this->addElement('ins', true, 'Inline', $contents, 'Common', $attr);
25 // HTML 4.01 specifies that ins/del must not contain block
26 // elements when used in an inline context, chameleon is
27 // a complicated workaround to acheive this effect
29 // Inline context ! Block context (exclamation mark is
30 // separator, see getChildDef for parsing)
32 var $defines_child_def = true;
33 function getChildDef($def) {
34 if ($def->content_model_type != 'chameleon') return false;
35 $value = explode('!', $def->content_model);
36 return new HTMLPurifier_ChildDef_Chameleon($value[0], $value[1]);