53 return $this->generator->generateFromToken(
65 return $this->generator->generateFromToken(
78 protected function element(
$tag, $contents, $attr = array(), $escape =
true)
81 ($escape ? $this->
escape($contents) : $contents) .
92 return $this->generator->generateFromToken(
103 return $this->generator->generateFromToken(
116 if (is_bool($value)) {
117 $value = $value ?
'On' :
'Off';
120 $this->
start(
'tr') .
"\n" .
122 $this->
element(
'td', $value) .
"\n" .
134 $string = htmlspecialchars($string, ENT_COMPAT,
'UTF-8');
144 protected function listify($array, $polite =
false)
151 foreach ($array as $value) {
154 if (
$i > 0 && !($polite &&
$i == 1)) {
157 if ($polite &&
$i == 1) {
170 protected function getClass($obj, $sec_prefix =
'')
173 if ($five === null) {
174 $five = version_compare(PHP_VERSION,
'5',
'>=');
176 $prefix =
'HTMLPurifier_' . $sec_prefix;
178 $prefix = strtolower($prefix);
180 $class = str_replace($prefix,
'', get_class($obj));
181 $lclass = strtolower($class);
186 foreach ($obj->valid_values as $value => $bool) {
189 $class .= implode(
', ',
$values);
191 case 'css_composite':
193 foreach ($obj->defs as
$def) {
196 $class .= implode(
', ',
$values);
199 $class .= $this->
getClass($obj->single, $sec_prefix) .
', ';
202 case 'css_denyelementdecorator':
203 $class .= $this->
getClass($obj->def, $sec_prefix) .
', ';
204 $class .= $obj->element;
206 case 'css_importantdecorator':
207 $class .= $this->
getClass($obj->def, $sec_prefix);
209 $class .=
', !important';
Concrete end token class.
start($tag, $attr=array())
Main function that renders object or aspect of that object.
listify($array, $polite=false)
Takes a list of strings and turns them into a single list.
escape($string)
Escapes a string for HTML output.
Generates HTML from tokens.
Concrete start token class.
row($name, $value)
Prints a simple key/value row in a table.
elementEmpty($tag, $attr=array())
prepareGenerator($config)
Give generator necessary configuration if possible.
end($tag)
Returns an end tag.
static cleanUTF8($str, $force_php=false)
Cleans a UTF-8 string for well-formedness and SGML validity.
__construct()
Initialize $generator.
$generator
For HTML generation convenience funcs.
getClass($obj, $sec_prefix='')
Retrieves the class of an object without prefixes, as well as metadata.
Concrete empty token class.
element($tag, $contents, $attr=array(), $escape=true)
Prints a complete element with content inside.
Registry object that contains information about the current context.
Concrete text token class.
if(function_exists('posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag