ILIAS  release_5-0 Revision 5.0.0-1144-gc4397b1f870
All Data Structures Namespaces Files Functions Variables Modules Pages
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
 int More...
 
 $rows = 5
 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.

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

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  $nvalue .= "$i:$v" . PHP_EOL;
331  }
332  $value = $nvalue;
333  break;
334  default:
335  $value = '';
336  }
337  }
338  if ($type === HTMLPurifier_VarParser::MIXED) {
339  return 'Not supported';
340  $value = serialize($value);
341  }
342  $attr = array(
343  'name' => "$name" . "[$ns.$directive]",
344  'id' => "$name:$ns.$directive"
345  );
346  if ($value === null) {
347  $attr['disabled'] = 'disabled';
348  }
349  if (isset($def->allowed)) {
350  $ret .= $this->start('select', $attr);
351  foreach ($def->allowed as $val => $b) {
352  $attr = array();
353  if ($value == $val) {
354  $attr['selected'] = 'selected';
355  }
356  $ret .= $this->element('option', $val, $attr);
357  }
358  $ret .= $this->end('select');
359  } elseif ($type === HTMLPurifier_VarParser::TEXT ||
360  $type === HTMLPurifier_VarParser::ITEXT ||
361  $type === HTMLPurifier_VarParser::ALIST ||
362  $type === HTMLPurifier_VarParser::HASH ||
363  $type === HTMLPurifier_VarParser::LOOKUP) {
364  $attr['cols'] = $this->cols;
365  $attr['rows'] = $this->rows;
366  $ret .= $this->start('textarea', $attr);
367  $ret .= $this->text($value);
368  $ret .= $this->end('textarea');
369  } else {
370  $attr['value'] = $value;
371  $attr['type'] = 'text';
372  $ret .= $this->elementEmpty('input', $attr);
373  }
374  return $ret;
375  }
start($tag, $attr=array())
Main function that renders object or aspect of that object.
Definition: Printer.php:51
elementEmpty($tag, $attr=array())
Definition: Printer.php:90
prepareGenerator($config)
Give generator necessary configuration if possible.
Definition: Printer.php:32
end($tag)
Returns an end tag.
Definition: Printer.php:63
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
+ Here is the call graph for this function:

Field Documentation

◆ $cols

HTMLPurifier_Printer_ConfigForm_default::$cols = 18

int

Definition at line 283 of file ConfigForm.php.

◆ $rows

HTMLPurifier_Printer_ConfigForm_default::$rows = 5

int

Definition at line 288 of file ConfigForm.php.


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