3 require_once 'HTMLPurifier/HTMLModule.php';
6 * XHTML 1.1 List Module, defines list-oriented elements. Core Module.
8 class HTMLPurifier_HTMLModule_List
extends HTMLPurifier_HTMLModule
12 var $elements = array('dl', 'dt', 'dd', 'ol', 'ul', 'li');
14 // According to the abstract schema, the List content set is a fully formed
15 // one or more expr, but it invariably occurs in an optional declaration
16 // so we're not going to do that subtlety. It might cause trouble
17 // if a user defines "List" and expects that multiple lists are
18 // allowed to be specified, but then again, that's not very intuitive.
19 // Furthermore, the actual XML Schema may disagree. Regardless,
20 // we don't have support for such nested expressions without using
21 // the incredibly inefficient and draconic Custom ChildDef.
22 var $content_sets = array('List' => 'dl | ol | ul', 'Flow' => 'List');
24 function HTMLPurifier_HTMLModule_List() {
25 foreach ($this->elements
as $element) {
26 $this->info
[$element] = new HTMLPurifier_ElementDef();
27 $this->info
[$element]->attr
= array(0 => array('Common'));
28 if ($element == 'li' ||
$element == 'dd') {
29 $this->info
[$element]->content_model
= '#PCDATA | Flow';
30 $this->info
[$element]->content_model_type
= 'optional';
31 } elseif ($element == 'ol' ||
$element == 'ul') {
32 $this->info
[$element]->content_model
= 'li';
33 $this->info
[$element]->content_model_type
= 'required';
36 $this->info
['dt']->content_model
= '#PCDATA | Inline';
37 $this->info
['dt']->content_model_type
= 'optional';
38 $this->info
['dl']->content_model
= 'dt | dd';
39 $this->info
['dl']->content_model_type
= 'required';
40 // this could be a LOT more robust
41 $this->info
['li']->auto_close
= array('li' => true);