mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-03-15 19:07:05 +00:00
[1.7.0] Migrate Presentation module to new syntax, compactify Edit, Legacy and List declarations.
git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1044 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
parent
7f39e1e2c3
commit
eaea42f827
@ -18,12 +18,8 @@ class HTMLPurifier_HTMLModule_Edit extends HTMLPurifier_HTMLModule
|
||||
'cite' => 'URI',
|
||||
// 'datetime' => 'Datetime', // not implemented
|
||||
);
|
||||
$this->addElement(
|
||||
'del', true, 'Inline', $contents, 'Common', $attr
|
||||
);
|
||||
$this->addElement(
|
||||
'ins', true, 'Inline', $contents, 'Common', $attr
|
||||
);
|
||||
$this->addElement('del', true, 'Inline', $contents, 'Common', $attr);
|
||||
$this->addElement('ins', true, 'Inline', $contents, 'Common', $attr);
|
||||
}
|
||||
|
||||
// HTML 4.01 specifies that ins/del must not contain block
|
||||
|
@ -24,15 +24,9 @@ class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
|
||||
var $name = 'Legacy';
|
||||
|
||||
function HTMLPurifier_HTMLModule_Legacy() {
|
||||
$this->addElement(
|
||||
'u', true, 'Inline', 'Inline', 'Common'
|
||||
);
|
||||
$this->addElement(
|
||||
's', true, 'Inline', 'Inline', 'Common'
|
||||
);
|
||||
$this->addElement(
|
||||
'strike', true, 'Inline', 'Inline', 'Common'
|
||||
);
|
||||
$this->addElement('u', true, 'Inline', 'Inline', 'Common');
|
||||
$this->addElement('s', true, 'Inline', 'Inline', 'Common');
|
||||
$this->addElement('strike', true, 'Inline', 'Inline', 'Common');
|
||||
|
||||
// setup modifications to old elements
|
||||
// perhaps we could make some convenience functions for these...
|
||||
|
@ -22,27 +22,15 @@ class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
|
||||
var $content_sets = array('Flow' => 'List');
|
||||
|
||||
function HTMLPurifier_HTMLModule_List() {
|
||||
$this->addElement(
|
||||
'ol', true, 'List', 'Required: li', 'Common'
|
||||
);
|
||||
$this->addElement(
|
||||
'ul', true, 'List', 'Required: li', 'Common'
|
||||
);
|
||||
$this->addElement(
|
||||
'dl', true, 'List', 'Required: dt | dd', 'Common'
|
||||
);
|
||||
$this->addElement('ol', true, 'List', 'Required: li', 'Common');
|
||||
$this->addElement('ul', true, 'List', 'Required: li', 'Common');
|
||||
$this->addElement('dl', true, 'List', 'Required: dt | dd', 'Common');
|
||||
|
||||
$this->addElement(
|
||||
'li', true, false, 'Flow', 'Common'
|
||||
);
|
||||
$this->addElement('li', true, false, 'Flow', 'Common');
|
||||
$this->info['li']->auto_close = array('li' => true);
|
||||
|
||||
$this->addElement(
|
||||
'dd', true, false, 'Flow', 'Common'
|
||||
);
|
||||
$this->addElement(
|
||||
'dt', true, false, 'Inline', 'Common'
|
||||
);
|
||||
$this->addElement('dd', true, false, 'Flow', 'Common');
|
||||
$this->addElement('dt', true, false, 'Inline', 'Common');
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -16,23 +16,16 @@ class HTMLPurifier_HTMLModule_Presentation extends HTMLPurifier_HTMLModule
|
||||
{
|
||||
|
||||
var $name = 'Presentation';
|
||||
var $elements = array('b', 'big', 'hr', 'i', 'small', 'sub', 'sup', 'tt');
|
||||
var $content_sets = array(
|
||||
'Block' => 'hr',
|
||||
'Inline' => 'b | big | i | small | sub | sup | tt'
|
||||
);
|
||||
|
||||
function HTMLPurifier_HTMLModule_Presentation() {
|
||||
foreach ($this->elements as $element) {
|
||||
$this->info[$element] = new HTMLPurifier_ElementDef();
|
||||
$this->info[$element]->attr = array(0 => array('Common'));
|
||||
if ($element == 'hr') {
|
||||
$this->info[$element]->content_model_type = 'empty';
|
||||
} else {
|
||||
$this->info[$element]->content_model = '#PCDATA | Inline';
|
||||
$this->info[$element]->content_model_type = 'optional';
|
||||
}
|
||||
}
|
||||
$this->addElement('hr', true, 'Block', 'Empty', 'Common');
|
||||
$this->addElement('b', true, 'Inline', 'Inline', 'Common');
|
||||
$this->addElement('big', true, 'Inline', 'Inline', 'Common');
|
||||
$this->addElement('i', true, 'Inline', 'Inline', 'Common');
|
||||
$this->addElement('small', true, 'Inline', 'Inline', 'Common');
|
||||
$this->addElement('sub', true, 'Inline', 'Inline', 'Common');
|
||||
$this->addElement('sup', true, 'Inline', 'Inline', 'Common');
|
||||
$this->addElement('tt', true, 'Inline', 'Inline', 'Common');
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user