Whoops, forgot to edit WHATSNEW
[htmlpurifier.git] / library / HTMLPurifier / HTMLModule / Edit.php
bloba9042a3577bcd89927e707791f896329ac9c003a
1 <?php
3 /**
4 * XHTML 1.1 Edit Module, defines editing-related elements. Text Extension
5 * Module.
6 */
7 class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
10 /**
11 * @type string
13 public $name = 'Edit';
15 /**
16 * @param HTMLPurifier_Config $config
18 public function setup($config)
20 $contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow';
21 $attr = array(
22 'cite' => 'URI',
23 // 'datetime' => 'Datetime', // not implemented
25 $this->addElement('del', 'Inline', $contents, 'Common', $attr);
26 $this->addElement('ins', 'Inline', $contents, 'Common', $attr);
29 // HTML 4.01 specifies that ins/del must not contain block
30 // elements when used in an inline context, chameleon is
31 // a complicated workaround to acheive this effect
33 // Inline context ! Block context (exclamation mark is
34 // separator, see getChildDef for parsing)
36 /**
37 * @type bool
39 public $defines_child_def = true;
41 /**
42 * @param HTMLPurifier_ElementDef $def
43 * @return HTMLPurifier_ChildDef_Chameleon
45 public function getChildDef($def)
47 if ($def->content_model_type != 'chameleon') {
48 return false;
50 $value = explode('!', $def->content_model);
51 return new HTMLPurifier_ChildDef_Chameleon($value[0], $value[1]);
55 // vim: et sw=4 sts=4