39 parent::__construct();
40 $this->docURL = $doc_url;
54 if ($cols) $this->fields[
'default']->cols = $cols;
55 if ($rows) $this->fields[
'default']->rows = $rows;
62 return file_get_contents(HTMLPURIFIER_PREFIX .
'/HTMLPurifier/Printer/ConfigForm.css');
69 return file_get_contents(HTMLPURIFIER_PREFIX .
'/HTMLPurifier/Printer/ConfigForm.js');
87 $this->genConfig = $gen_config;
93 list($ns, $directive) = $key;
94 $all[$ns][$directive] =
$config->get($ns .
'.'. $directive);
98 $ret .= $this->
start(
'table', array(
'class' =>
'hp-config'));
101 $ret .= $this->
element(
'th',
'Directive', array(
'class' =>
'hp-directive'));
102 $ret .= $this->
element(
'th',
'Value', array(
'class' =>
'hp-value'));
105 foreach ($all as $ns => $directives) {
108 if ($render_controls) {
111 $ret .= $this->
start(
'td', array(
'colspan' => 2,
'class' =>
'controls'));
112 $ret .= $this->
elementEmpty(
'input', array(
'type' =>
'submit',
'value' =>
'Submit'));
113 $ret .=
'[<a href="?">Reset</a>]';
129 $ret .= $this->
start(
'tbody', array(
'class' =>
'namespace'));
131 $ret .= $this->
element(
'th', $ns, array(
'colspan' => 2));
135 foreach ($directives as $directive => $value) {
139 $url = str_replace(
'%s', urlencode(
"$ns.$directive"), $this->docURL);
142 $attr = array(
'for' =>
"{$this->name}:$ns.$directive");
145 if (!$this->compress || (strlen($directive) < $this->compress)) {
146 $directive_disp = $directive;
148 $directive_disp = substr($directive, 0, $this->compress - 2) .
'...';
149 $attr[
'title'] = $directive;
158 if ($this->docURL)
$ret .= $this->
end(
'a');
162 $def = $this->config->def->info[
"$ns.$directive"];
164 $allow_null = $def < 0;
168 $allow_null = isset($def->allow_null);
170 if (!isset($this->fields[
$type])) $type = 0;
171 $type_obj = $this->fields[
$type];
175 $ret .= $type_obj->render($ns, $directive, $value, $this->name, array($this->genConfig, $this->config));
197 parent::__construct();
210 $ret .= $this->
start(
'label', array(
'for' =>
"$name:Null_$ns.$directive"));
211 $ret .= $this->
element(
'span',
"$ns.$directive:", array(
'class' =>
'verbose'));
212 $ret .= $this->
text(
' Null/Disabled');
215 'type' =>
'checkbox',
217 'class' =>
'null-toggle',
218 'name' =>
"$name".
"[Null_$ns.$directive]",
219 'id' =>
"$name:Null_$ns.$directive",
220 'onclick' =>
"toggleWriteability('$name:$ns.$directive',checked)"
224 $attr[
'onclick'] =
"toggleWriteability('$name:Yes_$ns.$directive',checked);toggleWriteability('$name:No_$ns.$directive',checked)";
226 if ($value === null) $attr[
'checked'] =
'checked';
230 $ret .= $this->obj->render($ns, $directive, $value, $name, array($gen_config,
$config));
251 $def =
$config->def->info[
"$ns.$directive"];
257 if (is_array($value)) {
262 foreach ($array as $val => $b) {
266 $value = implode(PHP_EOL, $value);
270 foreach ($value as
$i => $v) {
271 $nvalue .=
"$i:$v" . PHP_EOL;
280 return 'Not supported';
281 $value = serialize($value);
284 'name' =>
"$name".
"[$ns.$directive]",
285 'id' =>
"$name:$ns.$directive"
287 if ($value === null) $attr[
'disabled'] =
'disabled';
288 if (isset($def->allowed)) {
290 foreach ($def->allowed as $val => $b) {
292 if ($value == $val) $attr[
'selected'] =
'selected';
307 $ret .= $this->
end(
'textarea');
309 $attr[
'value'] = $value;
310 $attr[
'type'] =
'text';
330 $ret .= $this->
start(
'div', array(
'id' =>
"$name:$ns.$directive"));
332 $ret .= $this->
start(
'label', array(
'for' =>
"$name:Yes_$ns.$directive"));
333 $ret .= $this->
element(
'span',
"$ns.$directive:", array(
'class' =>
'verbose'));
339 'name' =>
"$name".
"[$ns.$directive]",
340 'id' =>
"$name:Yes_$ns.$directive",
343 if ($value ===
true) $attr[
'checked'] =
'checked';
344 if ($value === null) $attr[
'disabled'] =
'disabled';
347 $ret .= $this->
start(
'label', array(
'for' =>
"$name:No_$ns.$directive"));
348 $ret .= $this->
element(
'span',
"$ns.$directive:", array(
'class' =>
'verbose'));
354 'name' =>
"$name".
"[$ns.$directive]",
355 'id' =>
"$name:No_$ns.$directive",
358 if ($value ===
false) $attr[
'checked'] =
'checked';
359 if ($value === null) $attr[
'disabled'] =
'disabled';