HTMLPurifier 4.4.0
|
00001 <?php 00002 00007 class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule 00008 { 00009 00010 public $name = 'Edit'; 00011 00012 public function setup($config) { 00013 $contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow'; 00014 $attr = array( 00015 'cite' => 'URI', 00016 // 'datetime' => 'Datetime', // not implemented 00017 ); 00018 $this->addElement('del', 'Inline', $contents, 'Common', $attr); 00019 $this->addElement('ins', 'Inline', $contents, 'Common', $attr); 00020 } 00021 00022 // HTML 4.01 specifies that ins/del must not contain block 00023 // elements when used in an inline context, chameleon is 00024 // a complicated workaround to acheive this effect 00025 00026 // Inline context ! Block context (exclamation mark is 00027 // separator, see getChildDef for parsing) 00028 00029 public $defines_child_def = true; 00030 public function getChildDef($def) { 00031 if ($def->content_model_type != 'chameleon') return false; 00032 $value = explode('!', $def->content_model); 00033 return new HTMLPurifier_ChildDef_Chameleon($value[0], $value[1]); 00034 } 00035 00036 } 00037 00038 // vim: et sw=4 sts=4