1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-10 01:06:20 +02:00

[1.7.0] Convert Image, Legacy and List to use new format.

- Make attribute array parameter optional
- Optimize contents parsing for keywords

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1041 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2007-05-09 22:01:07 +00:00
parent b81fb0af90
commit 7f39e1e2c3
5 changed files with 52 additions and 44 deletions

View File

@ -22,22 +22,22 @@ class HTMLPurifier_HTMLModule_Legacy extends HTMLPurifier_HTMLModule
// incomplete
var $name = 'Legacy';
var $elements = array('u', 's', 'strike');
var $non_standalone_elements = array('li', 'ol', 'address', 'blockquote');
function HTMLPurifier_HTMLModule_Legacy() {
// setup new elements
foreach ($this->elements as $name) {
$this->info[$name] = new HTMLPurifier_ElementDef();
// for u, s, strike, as more elements get added, add
// conditionals as necessary
$this->info[$name]->content_model = 'Inline | #PCDATA';
$this->info[$name]->content_model_type = 'optional';
$this->info[$name]->attr[0] = array('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
foreach ($this->non_standalone_elements as $name) {
// perhaps we could make some convenience functions for these...
$elements = array('li', 'ol', 'address', 'blockquote');
foreach ($elements as $name) {
$this->info[$name] = new HTMLPurifier_ElementDef();
$this->info[$name]->standalone = false;
}