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

@ -139,7 +139,7 @@ class HTMLPurifier_HTMLModule
* @note See ElementDef for in-depth descriptions of these parameters.
* @protected
*/
function addElement($element, $safe, $type, $contents, $attr_includes, $attr) {
function addElement($element, $safe, $type, $contents, $attr_includes, $attr = array()) {
$this->elements[] = $element;
// parse content_model
list($content_model_type, $content_model) = $this->parseContents($contents);
@ -175,12 +175,12 @@ class HTMLPurifier_HTMLModule
function parseContents($contents) {
switch ($contents) {
// check for shorthand content model forms
case 'Empty':
return array('empty', '');
case 'Inline':
$contents = 'Optional: Inline | #PCDATA';
break;
return array('optional', 'Inline | #PCDATA');
case 'Flow':
$contents = 'Optional: Flow | #PCDATA';
break;
return array('optional', 'Flow | #PCDATA');
}
list($content_model_type, $content_model) = explode(':', $contents);
$content_model_type = strtolower(trim($content_model_type));