ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
HTMLPurifier_Printer_ConfigForm_default Class Reference

Swiss-army knife configuration form field printer. More...

+ Inheritance diagram for HTMLPurifier_Printer_ConfigForm_default:
+ Collaboration diagram for HTMLPurifier_Printer_ConfigForm_default:

Public Member Functions

 render ($ns, $directive, $value, $name, $config)
 
- Public Member Functions inherited from HTMLPurifier_Printer
 __construct ()
 Initialize $generator. More...
 
 prepareGenerator ($config)
 Give generator necessary configuration if possible. More...
 

Data Fields

 $cols = 18
 @type int More...
 
 $rows = 5
 @type int More...
 

Additional Inherited Members

- Protected Member Functions inherited from HTMLPurifier_Printer
 start ($tag, $attr=array())
 Main function that renders object or aspect of that object. More...
 
 end ($tag)
 Returns an end tag. More...
 
 element ($tag, $contents, $attr=array(), $escape=true)
 Prints a complete element with content inside. More...
 
 elementEmpty ($tag, $attr=array())
 
 text ($text)
 
 row ($name, $value)
 Prints a simple key/value row in a table. More...
 
 escape ($string)
 Escapes a string for HTML output. More...
 
 listify ($array, $polite=false)
 Takes a list of strings and turns them into a single list. More...
 
 getClass ($obj, $sec_prefix='')
 Retrieves the class of an object without prefixes, as well as metadata. More...
 
- Protected Attributes inherited from HTMLPurifier_Printer
 $generator
 For HTML generation convenience funcs. More...
 
 $config
 For easy access. More...
 

Detailed Description

Swiss-army knife configuration form field printer.

Definition at line 278 of file ConfigForm.php.

Member Function Documentation

◆ render()

HTMLPurifier_Printer_ConfigForm_default::render (   $ns,
  $directive,
  $value,
  $name,
  $config 
)
Parameters
string$ns
string$directive
string$value
string$name
HTMLPurifier_Config | array$config
Returns
string

Definition at line 298 of file ConfigForm.php.

299 {
300 if (is_array($config) && isset($config[0])) {
301 $gen_config = $config[0];
302 $config = $config[1];
303 } else {
304 $gen_config = $config;
305 }
306 $this->prepareGenerator($gen_config);
307 // this should probably be split up a little
308 $ret = '';
309 $def = $config->def->info["$ns.$directive"];
310 if (is_int($def)) {
311 $type = abs($def);
312 } else {
313 $type = $def->type;
314 }
315 if (is_array($value)) {
316 switch ($type) {
318 $array = $value;
319 $value = array();
320 foreach ($array as $val => $b) {
321 $value[] = $val;
322 }
323 //TODO does this need a break?
325 $value = implode(PHP_EOL, $value);
326 break;
328 $nvalue = '';
329 foreach ($value as $i => $v) {
330 if (is_array($v)) {
331 // HACK
332 $v = implode(";", $v);
333 }
334 $nvalue .= "$i:$v" . PHP_EOL;
335 }
336 $value = $nvalue;
337 break;
338 default:
339 $value = '';
340 }
341 }
343 return 'Not supported';
344 $value = serialize($value);
345 }
346 $attr = array(
347 'name' => "$name" . "[$ns.$directive]",
348 'id' => "$name:$ns.$directive"
349 );
350 if ($value === null) {
351 $attr['disabled'] = 'disabled';
352 }
353 if (isset($def->allowed)) {
354 $ret .= $this->start('select', $attr);
355 foreach ($def->allowed as $val => $b) {
356 $attr = array();
357 if ($value == $val) {
358 $attr['selected'] = 'selected';
359 }
360 $ret .= $this->element('option', $val, $attr);
361 }
362 $ret .= $this->end('select');
363 } elseif ($type === HTMLPurifier_VarParser::TEXT ||
368 $attr['cols'] = $this->cols;
369 $attr['rows'] = $this->rows;
370 $ret .= $this->start('textarea', $attr);
371 $ret .= $this->text($value);
372 $ret .= $this->end('textarea');
373 } else {
374 $attr['value'] = $value;
375 $attr['type'] = 'text';
376 $ret .= $this->elementEmpty('input', $attr);
377 }
378 return $ret;
379 }
element($tag, $contents, $attr=array(), $escape=true)
Prints a complete element with content inside.
Definition: Printer.php:78
$config
For easy access.
Definition: Printer.php:19
end($tag)
Returns an end tag.
Definition: Printer.php:63
elementEmpty($tag, $attr=array())
Definition: Printer.php:90
prepareGenerator($config)
Give generator necessary configuration if possible.
Definition: Printer.php:32
start($tag, $attr=array())
Main function that renders object or aspect of that object.
Definition: Printer.php:51
$def
Definition: croninfo.php:21
$i
Definition: disco.tpl.php:19
$ret
Definition: parser.php:6
$type

References $cols, HTMLPurifier_Printer\$config, $def, $i, $ret, $rows, $type, HTMLPurifier_VarParser\ALIST, HTMLPurifier_Printer\element(), HTMLPurifier_Printer\elementEmpty(), HTMLPurifier_Printer\end(), HTMLPurifier_VarParser\HASH, HTMLPurifier_VarParser\ITEXT, HTMLPurifier_VarParser\LOOKUP, HTMLPurifier_VarParser\MIXED, PHP_EOL, HTMLPurifier_Printer\prepareGenerator(), HTMLPurifier_Printer\start(), HTMLPurifier_Printer\text(), and HTMLPurifier_VarParser\TEXT.

+ Here is the call graph for this function:

Field Documentation

◆ $cols

HTMLPurifier_Printer_ConfigForm_default::$cols = 18

@type int

Definition at line 283 of file ConfigForm.php.

Referenced by render().

◆ $rows

HTMLPurifier_Printer_ConfigForm_default::$rows = 5

@type int

Definition at line 288 of file ConfigForm.php.

Referenced by render().


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