2007-02-04 14:56:55 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
2007-02-04 20:09:35 +00:00
|
|
|
* XHTML 1.1 Edit Module, defines editing-related elements. Text Extension
|
|
|
|
* Module.
|
2007-02-04 14:56:55 +00:00
|
|
|
*/
|
|
|
|
class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
|
|
|
|
{
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
public $name = 'Edit';
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2008-05-22 19:36:59 +00:00
|
|
|
public function setup($config) {
|
2007-05-08 03:28:58 +00:00
|
|
|
$contents = 'Chameleon: #PCDATA | Inline ! #PCDATA | Flow';
|
|
|
|
$attr = array(
|
|
|
|
'cite' => 'URI',
|
|
|
|
// 'datetime' => 'Datetime', // not implemented
|
|
|
|
);
|
2008-04-21 23:28:52 +00:00
|
|
|
$this->addElement('del', 'Inline', $contents, 'Common', $attr);
|
|
|
|
$this->addElement('ins', 'Inline', $contents, 'Common', $attr);
|
2007-02-04 14:56:55 +00:00
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-08 03:28:58 +00:00
|
|
|
// HTML 4.01 specifies that ins/del must not contain block
|
|
|
|
// elements when used in an inline context, chameleon is
|
|
|
|
// a complicated workaround to acheive this effect
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-05-08 03:28:58 +00:00
|
|
|
// Inline context ! Block context (exclamation mark is
|
|
|
|
// separator, see getChildDef for parsing)
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-11-25 02:24:39 +00:00
|
|
|
public $defines_child_def = true;
|
|
|
|
public function getChildDef($def) {
|
2007-02-04 20:09:35 +00:00
|
|
|
if ($def->content_model_type != 'chameleon') return false;
|
|
|
|
$value = explode('!', $def->content_model);
|
|
|
|
return new HTMLPurifier_ChildDef_Chameleon($value[0], $value[1]);
|
|
|
|
}
|
2008-12-06 07:28:20 +00:00
|
|
|
|
2007-02-04 14:56:55 +00:00
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|