ILIAS  Release_4_1_x_branch Revision 61804
 All Data Structures Namespaces Files Functions Variables Groups Pages
HTMLPurifier_Printer_HTMLDefinition Class Reference
+ Inheritance diagram for HTMLPurifier_Printer_HTMLDefinition:
+ Collaboration diagram for HTMLPurifier_Printer_HTMLDefinition:

Public Member Functions

 render ($config)
- Public Member Functions inherited from HTMLPurifier_Printer
 __construct ()
 Initialize $generator.
 prepareGenerator ($config)
 Give generator necessary configuration if possible.

Protected Member Functions

 renderDoctype ()
 Renders the Doctype table.
 renderEnvironment ()
 Renders environment table, which is miscellaneous info.
 renderContentSets ()
 Renders the Content Sets table.
 renderInfo ()
 Renders the Elements ($info) table.
 renderChildren ($def)
 Renders a row describing the allowed children of an element.
 listifyTagLookup ($array)
 Listifies a tag lookup table.
 listifyObjectList ($array)
 Listifies a list of objects by retrieving class names and internal state.
 listifyAttr ($array)
 Listifies a hash of attributes to AttrDef classes.
 heavyHeader ($text, $num=1)
 Creates a heavy header row.
- Protected Member Functions inherited from HTMLPurifier_Printer
 start ($tag, $attr=array())
 Main function that renders object or aspect of that object.
 end ($tag)
 Returns an end teg.
 element ($tag, $contents, $attr=array(), $escape=true)
 Prints a complete element with content inside.
 elementEmpty ($tag, $attr=array())
 text ($text)
 row ($name, $value)
 Prints a simple key/value row in a table.
 escape ($string)
 Escapes a string for HTML output.
 listify ($array, $polite=false)
 Takes a list of strings and turns them into a single list.
 getClass ($obj, $sec_prefix= '')
 Retrieves the class of an object without prefixes, as well as metadata.

Protected Attributes

 $def
 Instance of HTMLPurifier_HTMLDefinition, for easy access.
- Protected Attributes inherited from HTMLPurifier_Printer
 $generator
 Instance of HTMLPurifier_Generator for HTML generation convenience funcs.
 $config
 Instance of HTMLPurifier_Config, for easy access.

Detailed Description

Definition at line 3 of file HTMLDefinition.php.

Member Function Documentation

HTMLPurifier_Printer_HTMLDefinition::heavyHeader (   $text,
  $num = 1 
)
protected

Creates a heavy header row.

Definition at line 262 of file HTMLDefinition.php.

References $ret, HTMLPurifier_Printer\element(), HTMLPurifier_Printer\end(), and HTMLPurifier_Printer\start().

Referenced by renderContentSets(), and renderInfo().

{
$ret = '';
$ret .= $this->start('tr');
$ret .= $this->element('th', $text, array('colspan' => $num, 'class' => 'heavy'));
$ret .= $this->end('tr');
return $ret;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer_HTMLDefinition::listifyAttr (   $array)
protected

Listifies a hash of attributes to AttrDef classes.

Parameters
$arrayArray hash in form of array('attrname' => HTMLPurifier_AttrDef)

Definition at line 249 of file HTMLDefinition.php.

References HTMLPurifier_Printer\getClass(), and HTMLPurifier_Printer\listify().

Referenced by renderEnvironment(), and renderInfo().

{
ksort($array);
$list = array();
foreach ($array as $name => $obj) {
if ($obj === false) continue;
$list[] = "$name&nbsp;=&nbsp;<i>" . $this->getClass($obj, 'AttrDef_') . '</i>';
}
return $this->listify($list);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer_HTMLDefinition::listifyObjectList (   $array)
protected

Listifies a list of objects by retrieving class names and internal state.

Parameters
$arrayList of objects
Todo:
Also add information about internal state

Definition at line 236 of file HTMLDefinition.php.

References HTMLPurifier_Printer\getClass(), and HTMLPurifier_Printer\listify().

Referenced by renderEnvironment(), and renderInfo().

{
ksort($array);
$list = array();
foreach ($array as $discard => $obj) {
$list[] = $this->getClass($obj, 'AttrTransform_');
}
return $this->listify($list);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer_HTMLDefinition::listifyTagLookup (   $array)
protected

Listifies a tag lookup table.

Parameters
$arrayTag lookup array in form of array('tagname' => true)

Definition at line 221 of file HTMLDefinition.php.

References HTMLPurifier_Printer\listify().

Referenced by renderChildren(), renderContentSets(), and renderInfo().

{
ksort($array);
$list = array();
foreach ($array as $name => $discard) {
if ($name !== '#PCDATA' && !isset($this->def->info[$name])) continue;
$list[] = $name;
}
return $this->listify($list);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer_HTMLDefinition::render (   $config)

Definition at line 11 of file HTMLDefinition.php.

References HTMLPurifier_Printer\$config, $ret, HTMLPurifier_Printer\end(), renderContentSets(), renderDoctype(), renderEnvironment(), renderInfo(), and HTMLPurifier_Printer\start().

{
$ret = '';
$this->config =& $config;
$this->def = $config->getHTMLDefinition();
$ret .= $this->start('div', array('class' => 'HTMLPurifier_Printer'));
$ret .= $this->renderDoctype();
$ret .= $this->renderEnvironment();
$ret .= $this->renderContentSets();
$ret .= $this->renderInfo();
$ret .= $this->end('div');
return $ret;
}

+ Here is the call graph for this function:

HTMLPurifier_Printer_HTMLDefinition::renderChildren (   $def)
protected

Renders a row describing the allowed children of an element.

Parameters
$defHTMLPurifier_ChildDef of pertinent element

Definition at line 170 of file HTMLDefinition.php.

References $def, $ret, HTMLPurifier_Printer\element(), HTMLPurifier_Printer\end(), HTMLPurifier_Printer\escape(), listifyTagLookup(), and HTMLPurifier_Printer\start().

Referenced by renderEnvironment(), and renderInfo().

{
$context = new HTMLPurifier_Context();
$ret = '';
$ret .= $this->start('tr');
$elements = array();
$attr = array();
if (isset($def->elements)) {
if ($def->type == 'strictblockquote') {
$def->validateChildren(array(), $this->config, $context);
}
$elements = $def->elements;
}
if ($def->type == 'chameleon') {
$attr['rowspan'] = 2;
} elseif ($def->type == 'empty') {
$elements = array();
} 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->element('td',
'<em>Block</em>: ' .
$this->escape($this->listifyTagLookup($def->block->elements)),0,0);
$ret .= $this->end('tr');
$ret .= $this->start('tr');
$ret .= $this->element('td',
'<em>Inline</em>: ' .
$this->escape($this->listifyTagLookup($def->inline->elements)),0,0);
} elseif ($def->type == 'custom') {
$ret .= $this->element('td', '<em>'.ucfirst($def->type).'</em>: ' .
$def->dtd_regex);
} else {
$ret .= $this->element('td',
'<em>'.ucfirst($def->type).'</em>: ' .
$this->escape($this->listifyTagLookup($elements)),0,0);
}
$ret .= $this->end('tr');
return $ret;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer_HTMLDefinition::renderContentSets ( )
protected

Renders the Content Sets table.

Definition at line 93 of file HTMLDefinition.php.

References $ret, HTMLPurifier_Printer\element(), HTMLPurifier_Printer\end(), heavyHeader(), listifyTagLookup(), and HTMLPurifier_Printer\start().

Referenced by render().

{
$ret = '';
$ret .= $this->start('table');
$ret .= $this->element('caption', 'Content Sets');
foreach ($this->def->info_content_sets as $name => $lookup) {
$ret .= $this->heavyHeader($name);
$ret .= $this->start('tr');
$ret .= $this->element('td', $this->listifyTagLookup($lookup));
$ret .= $this->end('tr');
}
$ret .= $this->end('table');
return $ret;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer_HTMLDefinition::renderDoctype ( )
protected

Renders the Doctype table.

Definition at line 32 of file HTMLDefinition.php.

References $ret, HTMLPurifier_Printer\element(), HTMLPurifier_Printer\end(), HTMLPurifier_Printer\row(), and HTMLPurifier_Printer\start().

Referenced by render().

{
$doctype = $this->def->doctype;
$ret = '';
$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');
return $ret;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer_HTMLDefinition::renderEnvironment ( )
protected

Renders environment table, which is miscellaneous info.

Definition at line 49 of file HTMLDefinition.php.

References $def, $ret, HTMLPurifier_Printer\element(), HTMLPurifier_Printer\end(), HTMLPurifier_Printer\getClass(), HTMLPurifier_Printer\listify(), listifyAttr(), listifyObjectList(), renderChildren(), HTMLPurifier_Printer\row(), and HTMLPurifier_Printer\start().

Referenced by render().

{
$ret = '';
$ret .= $this->start('table');
$ret .= $this->element('caption', 'Environment');
$ret .= $this->row('Parent of fragment', $def->info_parent);
$ret .= $this->renderChildren($def->info_parent_def->child);
$ret .= $this->row('Block wrap name', $def->info_block_wrapper);
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Global attributes');
$ret .= $this->element('td', $this->listifyAttr($def->info_global_attr),0,0);
$ret .= $this->end('tr');
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Tag transforms');
$list = array();
foreach ($def->info_tag_transform as $old => $new) {
$new = $this->getClass($new, 'TagTransform_');
$list[] = "<$old> with $new";
}
$ret .= $this->element('td', $this->listify($list));
$ret .= $this->end('tr');
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Pre-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_pre));
$ret .= $this->end('tr');
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Post-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->info_attr_transform_post));
$ret .= $this->end('tr');
$ret .= $this->end('table');
return $ret;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer_HTMLDefinition::renderInfo ( )
protected

Renders the Elements ($info) table.

Definition at line 110 of file HTMLDefinition.php.

References $def, $ret, HTMLPurifier_Printer\element(), HTMLPurifier_Printer\end(), heavyHeader(), HTMLPurifier_Printer\listify(), listifyAttr(), listifyObjectList(), listifyTagLookup(), renderChildren(), HTMLPurifier_Printer\row(), and HTMLPurifier_Printer\start().

Referenced by render().

{
$ret = '';
$ret .= $this->start('table');
$ret .= $this->element('caption', 'Elements ($info)');
ksort($this->def->info);
$ret .= $this->heavyHeader('Allowed tags', 2);
$ret .= $this->start('tr');
$ret .= $this->element('td', $this->listifyTagLookup($this->def->info), array('colspan' => 2));
$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->element('td', $this->listifyTagLookup($def->excludes));
$ret .= $this->end('tr');
}
if (!empty($def->attr_transform_pre)) {
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Pre-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_pre));
$ret .= $this->end('tr');
}
if (!empty($def->attr_transform_post)) {
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Post-AttrTransform');
$ret .= $this->element('td', $this->listifyObjectList($def->attr_transform_post));
$ret .= $this->end('tr');
}
if (!empty($def->auto_close)) {
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Auto closed by');
$ret .= $this->element('td', $this->listifyTagLookup($def->auto_close));
$ret .= $this->end('tr');
}
$ret .= $this->start('tr');
$ret .= $this->element('th', 'Allowed attributes');
$ret .= $this->element('td',$this->listifyAttr($def->attr), array(), 0);
$ret .= $this->end('tr');
if (!empty($def->required_attr)) {
$ret .= $this->row('Required attributes', $this->listify($def->required_attr));
}
$ret .= $this->renderChildren($def->child);
}
$ret .= $this->end('table');
return $ret;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Field Documentation

HTMLPurifier_Printer_HTMLDefinition::$def
protected

Instance of HTMLPurifier_HTMLDefinition, for easy access.

Definition at line 9 of file HTMLDefinition.php.

Referenced by renderChildren(), renderEnvironment(), and renderInfo().


The documentation for this class was generated from the following file: