2007-02-04 01:52:13 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
require_once 'HTMLPurifier/HTMLModule.php';
|
|
|
|
|
|
|
|
/**
|
2007-02-04 04:41:34 +00:00
|
|
|
* XHTML 1.1 List Module, defines list-oriented elements. Core Module.
|
2007-02-04 01:52:13 +00:00
|
|
|
*/
|
|
|
|
class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule
|
|
|
|
{
|
|
|
|
|
2007-02-14 22:30:17 +00:00
|
|
|
var $name = 'List';
|
2007-02-16 03:01:23 +00:00
|
|
|
var $type = 'define';
|
2007-02-04 01:52:13 +00:00
|
|
|
var $elements = array('dl', 'dt', 'dd', 'ol', 'ul', 'li');
|
|
|
|
var $info = array();
|
2007-02-04 20:09:35 +00:00
|
|
|
// According to the abstract schema, the List content set is a fully formed
|
2007-02-04 01:52:13 +00:00
|
|
|
// one or more expr, but it invariably occurs in an optional declaration
|
|
|
|
// so we're not going to do that subtlety. It might cause trouble
|
|
|
|
// if a user defines "List" and expects that multiple lists are
|
|
|
|
// allowed to be specified, but then again, that's not very intuitive.
|
2007-02-04 20:09:35 +00:00
|
|
|
// Furthermore, the actual XML Schema may disagree. Regardless,
|
|
|
|
// we don't have support for such nested expressions without using
|
|
|
|
// the incredibly inefficient and draconic Custom ChildDef.
|
2007-02-04 01:52:13 +00:00
|
|
|
var $content_sets = array('List' => 'dl | ol | ul', 'Flow' => 'List');
|
|
|
|
|
|
|
|
function HTMLPurifier_HTMLModule_List() {
|
|
|
|
foreach ($this->elements as $element) {
|
|
|
|
$this->info[$element] = new HTMLPurifier_ElementDef();
|
|
|
|
$this->info[$element]->attr = array(0 => array('Common'));
|
|
|
|
if ($element == 'li' || $element == 'dd') {
|
|
|
|
$this->info[$element]->content_model = '#PCDATA | Flow';
|
|
|
|
$this->info[$element]->content_model_type = 'optional';
|
|
|
|
} elseif ($element == 'ol' || $element == 'ul') {
|
|
|
|
$this->info[$element]->content_model = 'li';
|
|
|
|
$this->info[$element]->content_model_type = 'required';
|
|
|
|
}
|
|
|
|
}
|
|
|
|
$this->info['dt']->content_model = '#PCDATA | Inline';
|
|
|
|
$this->info['dt']->content_model_type = 'optional';
|
|
|
|
$this->info['dl']->content_model = 'dt | dd';
|
|
|
|
$this->info['dl']->content_model_type = 'required';
|
2007-02-04 20:09:35 +00:00
|
|
|
// this could be a LOT more robust
|
2007-02-04 15:28:47 +00:00
|
|
|
$this->info['li']->auto_close = array('li' => true);
|
2007-02-04 01:52:13 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
?>
|