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

Public Member Functions

 __construct ()
 Initialize $generator.
 prepareGenerator ($config)
 Give generator necessary configuration if possible.

Protected Member Functions

 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

 $generator
 Instance of HTMLPurifier_Generator for HTML generation convenience funcs.
 $config
 Instance of HTMLPurifier_Config, for easy access.

Detailed Description

Definition at line 6 of file Printer.php.

Constructor & Destructor Documentation

HTMLPurifier_Printer::__construct ( )

Initialize $generator.

Definition at line 22 of file Printer.php.

Referenced by HTMLPurifier_Printer_ConfigForm\__construct(), and HTMLPurifier_Printer_ConfigForm_NullDecorator\__construct().

{
}

+ Here is the caller graph for this function:

Member Function Documentation

HTMLPurifier_Printer::element (   $tag,
  $contents,
  $attr = array(),
  $escape = true 
)
protected

Prints a complete element with content inside.

Parameters
$tagTag name
$contentsElement contents
$attrTag attributes
$escapeBool whether or not to escape contents

Definition at line 68 of file Printer.php.

References end(), escape(), and start().

Referenced by HTMLPurifier_Printer_HTMLDefinition\heavyHeader(), HTMLPurifier_Printer_CSSDefinition\render(), HTMLPurifier_Printer_ConfigForm\render(), HTMLPurifier_Printer_ConfigForm_NullDecorator\render(), HTMLPurifier_Printer_ConfigForm_default\render(), HTMLPurifier_Printer_ConfigForm_bool\render(), HTMLPurifier_Printer_HTMLDefinition\renderChildren(), HTMLPurifier_Printer_HTMLDefinition\renderContentSets(), HTMLPurifier_Printer_HTMLDefinition\renderDoctype(), HTMLPurifier_Printer_HTMLDefinition\renderEnvironment(), HTMLPurifier_Printer_HTMLDefinition\renderInfo(), HTMLPurifier_Printer_ConfigForm\renderNamespace(), and row().

{
return $this->start($tag, $attr) .
($escape ? $this->escape($contents) : $contents) .
$this->end($tag);
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer::elementEmpty (   $tag,
  $attr = array() 
)
protected

Definition at line 74 of file Printer.php.

Referenced by HTMLPurifier_Printer_ConfigForm\render(), HTMLPurifier_Printer_ConfigForm_NullDecorator\render(), HTMLPurifier_Printer_ConfigForm_default\render(), and HTMLPurifier_Printer_ConfigForm_bool\render().

{
return $this->generator->generateFromToken(
new HTMLPurifier_Token_Empty($tag, $attr)
);
}

+ Here is the caller graph for this function:

HTMLPurifier_Printer::escape (   $string)
protected

Escapes a string for HTML output.

Parameters
$stringString to escape

Definition at line 105 of file Printer.php.

References HTMLPurifier_Encoder\cleanUTF8().

Referenced by element(), and HTMLPurifier_Printer_HTMLDefinition\renderChildren().

{
$string = HTMLPurifier_Encoder::cleanUTF8($string);
$string = htmlspecialchars($string, ENT_COMPAT, 'UTF-8');
return $string;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer::getClass (   $obj,
  $sec_prefix = '' 
)
protected

Retrieves the class of an object without prefixes, as well as metadata.

Parameters
$objObject to determine class of
$prefixFurther prefix to remove

Definition at line 134 of file Printer.php.

Referenced by HTMLPurifier_Printer_HTMLDefinition\listifyAttr(), HTMLPurifier_Printer_HTMLDefinition\listifyObjectList(), HTMLPurifier_Printer_CSSDefinition\render(), and HTMLPurifier_Printer_HTMLDefinition\renderEnvironment().

{
static $five = null;
if ($five === null) $five = version_compare(PHP_VERSION, '5', '>=');
$prefix = 'HTMLPurifier_' . $sec_prefix;
if (!$five) $prefix = strtolower($prefix);
$class = str_replace($prefix, '', get_class($obj));
$lclass = strtolower($class);
$class .= '(';
switch ($lclass) {
case 'enum':
$values = array();
foreach ($obj->valid_values as $value => $bool) {
$values[] = $value;
}
$class .= implode(', ', $values);
break;
case 'css_composite':
$values = array();
foreach ($obj->defs as $def) {
$values[] = $this->getClass($def, $sec_prefix);
}
$class .= implode(', ', $values);
break;
case 'css_multiple':
$class .= $this->getClass($obj->single, $sec_prefix) . ', ';
$class .= $obj->max;
break;
case 'css_denyelementdecorator':
$class .= $this->getClass($obj->def, $sec_prefix) . ', ';
$class .= $obj->element;
break;
case 'css_importantdecorator':
$class .= $this->getClass($obj->def, $sec_prefix);
if ($obj->allow) $class .= ', !important';
break;
}
$class .= ')';
return $class;
}

+ Here is the caller graph for this function:

HTMLPurifier_Printer::listify (   $array,
  $polite = false 
)
protected

Takes a list of strings and turns them into a single list.

Parameters
$arrayList of strings
$politeBool whether or not to add an end before the last

Definition at line 116 of file Printer.php.

References $ret.

Referenced by HTMLPurifier_Printer_HTMLDefinition\listifyAttr(), HTMLPurifier_Printer_HTMLDefinition\listifyObjectList(), HTMLPurifier_Printer_HTMLDefinition\listifyTagLookup(), HTMLPurifier_Printer_HTMLDefinition\renderEnvironment(), and HTMLPurifier_Printer_HTMLDefinition\renderInfo().

{
if (empty($array)) return 'None';
$ret = '';
$i = count($array);
foreach ($array as $value) {
$i--;
$ret .= $value;
if ($i > 0 && !($polite && $i == 1)) $ret .= ', ';
if ($polite && $i == 1) $ret .= 'and ';
}
return $ret;
}

+ Here is the caller graph for this function:

HTMLPurifier_Printer::prepareGenerator (   $config)

Give generator necessary configuration if possible.

Definition at line 28 of file Printer.php.

References $config.

Referenced by HTMLPurifier_Printer_ConfigForm\render(), HTMLPurifier_Printer_ConfigForm_NullDecorator\render(), HTMLPurifier_Printer_ConfigForm_default\render(), and HTMLPurifier_Printer_ConfigForm_bool\render().

{
$all = $config->getAll();
$context = new HTMLPurifier_Context();
$this->generator = new HTMLPurifier_Generator($config, $context);
}

+ Here is the caller graph for this function:

HTMLPurifier_Printer::row (   $name,
  $value 
)
protected

Prints a simple key/value row in a table.

Parameters
$nameKey
$valueValue

Definition at line 91 of file Printer.php.

References element(), end(), and start().

Referenced by HTMLPurifier_Printer_CSSDefinition\render(), HTMLPurifier_Printer_HTMLDefinition\renderDoctype(), HTMLPurifier_Printer_HTMLDefinition\renderEnvironment(), and HTMLPurifier_Printer_HTMLDefinition\renderInfo().

{
if (is_bool($value)) $value = $value ? 'On' : 'Off';
return
$this->start('tr') . "\n" .
$this->element('th', $name) . "\n" .
$this->element('td', $value) . "\n" .
$this->end('tr')
;
}

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

HTMLPurifier_Printer::text (   $text)
protected

Definition at line 80 of file Printer.php.

Referenced by HTMLPurifier_Printer_ConfigForm_NullDecorator\render(), HTMLPurifier_Printer_ConfigForm_default\render(), and HTMLPurifier_Printer_ConfigForm_bool\render().

{
return $this->generator->generateFromToken(
);
}

+ Here is the caller graph for this function:

Field Documentation

HTMLPurifier_Printer::$generator
protected

Instance of HTMLPurifier_Generator for HTML generation convenience funcs.

Definition at line 12 of file Printer.php.


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