51 protected function start($tag, $attr = array())
53 return $this->generator->generateFromToken(
63 protected function end($tag)
65 return $this->generator->generateFromToken(
78 protected function element($tag, $contents, $attr = array(), $escape =
true)
80 return $this->
start($tag, $attr) .
81 ($escape ? $this->
escape($contents) : $contents) .
92 return $this->generator->generateFromToken(
103 return $this->generator->generateFromToken(
114 protected function row($name, $value)
116 if (is_bool($value)) {
117 $value = $value ?
'On' :
'Off';
120 $this->
start(
'tr') .
"\n" .
121 $this->
element(
'th', $name) .
"\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) {
194 $values[] = $this->
getClass($def, $sec_prefix);
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';