Source for file Printer.php
Documentation is available at Printer.php
// OUT OF DATE, NEEDS UPDATING!
* Instance of HTMLPurifier_Generator for HTML generation convenience funcs
* Instance of HTMLPurifier_Config, for easy access
* Give generator necessary configuration if possible
$all =
$config->getAll();
* Main function that renders object or aspect of that object
* @note Parameters vary depending on printer
* @param $attr Attribute array
protected function start($tag, $attr =
array()) {
protected function end($tag) {
* Prints a complete element with content inside
* @param $contents Element contents
* @param $attr Tag attributes
* @param $escape Bool whether or not to escape contents
protected function element($tag, $contents, $attr =
array(), $escape =
true) {
return $this->start($tag, $attr) .
($escape ?
$this->escape($contents) :
$contents) .
protected function text($text) {
* Prints a simple key/value row in a table.
protected function row($name, $value) {
if (is_bool($value)) $value =
$value ?
'On' :
'Off';
$this->start('tr') .
"\n" .
$this->element('th', $name) .
"\n" .
$this->element('td', $value) .
"\n" .
* Escapes a string for HTML output.
* @param $string String to escape
protected function escape($string) {
* Takes a list of strings and turns them into a single list
* @param $array List of strings
* @param $polite Bool whether or not to add an end before the last
protected function listify($array, $polite =
false) {
if (empty($array)) return 'None';
foreach ($array as $value) {
if ($i >
0 &&
!($polite &&
$i ==
1)) $ret .=
', ';
if ($polite &&
$i ==
1) $ret .=
'and ';
* Retrieves the class of an object without prefixes, as well as metadata
* @param $obj Object to determine class of
* @param $prefix Further prefix to remove
protected function getClass($obj, $sec_prefix =
'') {
if ($five ===
null) $five =
version_compare(PHP_VERSION, '5', '>=');
$prefix =
'HTMLPurifier_' .
$sec_prefix;
foreach ($obj->valid_values as $value =>
$bool) {
foreach ($obj->defs as $def) {
$values[] =
$this->getClass($def, $sec_prefix);
$class .=
$this->getClass($obj->single, $sec_prefix) .
', ';
Documentation generated on Thu, 19 Jun 2008 18:50:13 -0400 by phpDocumentor 1.4.2