|
HTMLPurifier 4.4.0
|
00001 <?php 00002 00006 class HTMLPurifier_HTMLModule_List extends HTMLPurifier_HTMLModule 00007 { 00008 00009 public $name = 'List'; 00010 00011 // According to the abstract schema, the List content set is a fully formed 00012 // one or more expr, but it invariably occurs in an optional declaration 00013 // so we're not going to do that subtlety. It might cause trouble 00014 // if a user defines "List" and expects that multiple lists are 00015 // allowed to be specified, but then again, that's not very intuitive. 00016 // Furthermore, the actual XML Schema may disagree. Regardless, 00017 // we don't have support for such nested expressions without using 00018 // the incredibly inefficient and draconic Custom ChildDef. 00019 00020 public $content_sets = array('Flow' => 'List'); 00021 00022 public function setup($config) { 00023 $ol = $this->addElement('ol', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); 00024 $ul = $this->addElement('ul', 'List', new HTMLPurifier_ChildDef_List(), 'Common'); 00025 // XXX The wrap attribute is handled by MakeWellFormed. This is all 00026 // quite unsatisfactory, because we generated this 00027 // *specifically* for lists, and now a big chunk of the handling 00028 // is done properly by the List ChildDef. So actually, we just 00029 // want enough information to make autoclosing work properly, 00030 // and then hand off the tricky stuff to the ChildDef. 00031 $ol->wrap = 'li'; 00032 $ul->wrap = 'li'; 00033 $this->addElement('dl', 'List', 'Required: dt | dd', 'Common'); 00034 00035 $this->addElement('li', false, 'Flow', 'Common'); 00036 00037 $this->addElement('dd', false, 'Flow', 'Common'); 00038 $this->addElement('dt', false, 'Inline', 'Common'); 00039 } 00040 00041 } 00042 00043 // vim: et sw=4 sts=4