mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2024-11-09 23:28:42 +00:00
Implement Edit module.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@712 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
d0018a2696
commit
cfe50ff8ae
30
library/HTMLPurifier/HTMLModule/Edit.php
Normal file
30
library/HTMLPurifier/HTMLModule/Edit.php
Normal file
@ -0,0 +1,30 @@
|
||||
<?php
|
||||
|
||||
require_once 'HTMLPurifier/HTMLModule.php';
|
||||
|
||||
/**
|
||||
* XHTML 1.1 Edit Module, defines editing-related elements. Text Extension Module.
|
||||
*/
|
||||
class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
|
||||
{
|
||||
|
||||
var $elements = array('del', 'ins');
|
||||
var $info = array();
|
||||
var $content_sets = array('Inline' => 'del | ins');
|
||||
|
||||
function HTMLPurifier_HTMLModule_Edit() {
|
||||
foreach ($this->elements as $element) {
|
||||
$this->info[$element] = new HTMLPurifier_ElementDef();
|
||||
$this->info[$element]->attr = array(
|
||||
0 => array('Common'),
|
||||
'cite' => 'URI',
|
||||
// 'datetime' => 'Datetime' // Datetime not implemented
|
||||
);
|
||||
$this->info[$element]->content_model = '#PCDATA | Inline ! #PCDATA | Flow';
|
||||
$this->info[$element]->content_model_type = 'chameleon';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
?>
|
@ -10,6 +10,7 @@ require_once 'HTMLPurifier/HTMLModule/Text.php';
|
||||
require_once 'HTMLPurifier/HTMLModule/Hypertext.php';
|
||||
require_once 'HTMLPurifier/HTMLModule/List.php';
|
||||
require_once 'HTMLPurifier/HTMLModule/Presentation.php';
|
||||
require_once 'HTMLPurifier/HTMLModule/Edit.php';
|
||||
|
||||
/**
|
||||
* Next-generation HTML definition that will supplant HTMLPurifier_HTMLDefinition
|
||||
@ -24,10 +25,11 @@ class HTMLPurifier_XHTMLDefinition extends HTMLPurifier_HTMLDefinition
|
||||
|
||||
function HTMLPurifier_XHTMLDefinition($config) {
|
||||
|
||||
$this->modules['Text'] = new HTMLPurifier_HTMLModule_Text();
|
||||
$this->modules['Hypertext'] = new HTMLPurifier_HTMLModule_Hypertext();
|
||||
$this->modules['List'] = new HTMLPurifier_HTMLModule_List();
|
||||
$this->modules['Presentation'] = new HTMLPurifier_HTMLModule_Presentation();
|
||||
$this->modules['Text'] = new HTMLPurifier_HTMLModule_Text();
|
||||
$this->modules['Hypertext'] = new HTMLPurifier_HTMLModule_Hypertext();
|
||||
$this->modules['List'] = new HTMLPurifier_HTMLModule_List();
|
||||
$this->modules['Presentation'] = new HTMLPurifier_HTMLModule_Presentation();
|
||||
$this->modules['Edit'] = new HTMLPurifier_HTMLModule_Edit();
|
||||
|
||||
$this->attr_types = new HTMLPurifier_AttrTypes();
|
||||
$this->attr_collection = new HTMLPurifier_AttrCollection();
|
||||
@ -117,6 +119,7 @@ class HTMLPurifier_XHTMLDefinition extends HTMLPurifier_HTMLDefinition
|
||||
case 'table':
|
||||
return new HTMLPurifier_ChildDef_Table();
|
||||
case 'chameleon':
|
||||
$value = explode('!', $value);
|
||||
return new HTMLPurifier_ChildDef_Chameleon($value[0], $value[1]);
|
||||
case 'custom':
|
||||
return new HTMLPurifier_ChildDef_Custom($value);
|
||||
|
Loading…
Reference in New Issue
Block a user