Source for file HTMLDefinition.php
Documentation is available at HTMLDefinition.php
* Instance of HTMLPurifier_HTMLDefinition, for easy access
public function render($config) {
$this->def =
$config->getHTMLDefinition();
$ret .=
$this->start('div', array('class' =>
'HTMLPurifier_Printer'));
$ret .=
$this->end('div');
* Renders the Doctype table
$doctype =
$this->def->doctype;
$ret .=
$this->start('table');
$ret .=
$this->element('caption', 'Doctype');
$ret .=
$this->row('Name', $doctype->name);
$ret .=
$this->row('XML', $doctype->xml ?
'Yes' :
'No');
$ret .=
$this->row('Default Modules', implode($doctype->modules, ', '));
$ret .=
$this->row('Default Tidy Modules', implode($doctype->tidyModules, ', '));
$ret .=
$this->end('table');
* Renders environment table, which is miscellaneous info
$ret .=
$this->start('table');
$ret .=
$this->element('caption', 'Environment');
$ret .=
$this->row('Parent of fragment', $def->info_parent);
$ret .=
$this->row('Block wrap name', $def->info_block_wrapper);
$ret .=
$this->start('tr');
$ret .=
$this->element('th', 'Global attributes');
$ret .=
$this->end('tr');
$ret .=
$this->start('tr');
$ret .=
$this->element('th', 'Tag transforms');
foreach ($def->info_tag_transform as $old =>
$new) {
$new =
$this->getClass($new, 'TagTransform_');
$list[] =
"<$old> with $new";
$ret .=
$this->end('tr');
$ret .=
$this->start('tr');
$ret .=
$this->element('th', 'Pre-AttrTransform');
$ret .=
$this->end('tr');
$ret .=
$this->start('tr');
$ret .=
$this->element('th', 'Post-AttrTransform');
$ret .=
$this->end('tr');
$ret .=
$this->end('table');
* Renders the Content Sets table
$ret .=
$this->start('table');
$ret .=
$this->element('caption', 'Content Sets');
foreach ($this->def->info_content_sets as $name =>
$lookup) {
$ret .=
$this->start('tr');
$ret .=
$this->end('tr');
$ret .=
$this->end('table');
* Renders the Elements ($info) table
$ret .=
$this->start('table');
$ret .=
$this->element('caption', 'Elements ($info)');
$ret .=
$this->start('tr');
$ret .=
$this->end('tr');
foreach ($this->def->info as $name =>
$def) {
$ret .=
$this->start('tr');
$ret .=
$this->element('th', "<$name>", array('class'=>
'heavy', 'colspan' =>
2));
$ret .=
$this->end('tr');
$ret .=
$this->start('tr');
$ret .=
$this->element('th', 'Inline content');
$ret .=
$this->element('td', $def->descendants_are_inline ?
'Yes' :
'No');
$ret .=
$this->end('tr');
if (!empty($def->excludes)) {
$ret .=
$this->start('tr');
$ret .=
$this->element('th', 'Excludes');
$ret .=
$this->end('tr');
if (!empty($def->attr_transform_pre)) {
$ret .=
$this->start('tr');
$ret .=
$this->element('th', 'Pre-AttrTransform');
$ret .=
$this->end('tr');
if (!empty($def->attr_transform_post)) {
$ret .=
$this->start('tr');
$ret .=
$this->element('th', 'Post-AttrTransform');
$ret .=
$this->end('tr');
if (!empty($def->auto_close)) {
$ret .=
$this->start('tr');
$ret .=
$this->element('th', 'Auto closed by');
$ret .=
$this->end('tr');
$ret .=
$this->start('tr');
$ret .=
$this->element('th', 'Allowed attributes');
$ret .=
$this->end('tr');
if (!empty($def->required_attr)) {
$ret .=
$this->row('Required attributes', $this->listify($def->required_attr));
$ret .=
$this->end('table');
* Renders a row describing the allowed children of an element
* @param $def HTMLPurifier_ChildDef of pertinent element
$ret .=
$this->start('tr');
if (isset
($def->elements)) {
if ($def->type ==
'strictblockquote') {
$def->validateChildren(array(), $this->config, $context);
$elements =
$def->elements;
if ($def->type ==
'chameleon') {
} elseif ($def->type ==
'empty') {
} elseif ($def->type ==
'table') {
$elements =
array_flip(array('col', 'caption', 'colgroup', 'thead',
'tfoot', 'tbody', 'tr'));
$ret .=
$this->element('th', 'Allowed children', $attr);
if ($def->type ==
'chameleon') {
$ret .=
$this->end('tr');
$ret .=
$this->start('tr');
} elseif ($def->type ==
'custom') {
'<em>'.
ucfirst($def->type).
'</em>: ' .
$ret .=
$this->end('tr');
* Listifies a tag lookup table.
* @param $array Tag lookup array in form of array('tagname' => true)
foreach ($array as $name =>
$discard) {
if ($name !==
'#PCDATA' &&
!isset
($this->def->info[$name])) continue;
* Listifies a list of objects by retrieving class names and internal state
* @param $array List of objects
* @todo Also add information about internal state
foreach ($array as $discard =>
$obj) {
$list[] =
$this->getClass($obj, 'AttrTransform_');
* Listifies a hash of attributes to AttrDef classes
* @param $array Array hash in form of array('attrname' => HTMLPurifier_AttrDef)
foreach ($array as $name =>
$obj) {
if ($obj ===
false) continue;
$list[] =
"$name = <i>" .
$this->getClass($obj, 'AttrDef_') .
'</i>';
* Creates a heavy header row
$ret .=
$this->start('tr');
$ret .=
$this->element('th', $text, array('colspan' =>
$num, 'class' =>
'heavy'));
$ret .=
$this->end('tr');
Documentation generated on Thu, 19 Jun 2008 18:49:27 -0400 by phpDocumentor 1.4.2