ILIAS  release_4-4 Revision
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
 
 $rows = 5
 

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 teg. 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
 Instance of HTMLPurifier_Generator for HTML generation convenience funcs. More...
 
 $config
 Instance of HTMLPurifier_Config, for easy access. More...
 

Detailed Description

Swiss-army knife configuration form field printer.

Definition at line 238 of file ConfigForm.php.

Member Function Documentation

◆ render()

HTMLPurifier_Printer_ConfigForm_default::render (   $ns,
  $directive,
  $value,
  $name,
  $config 
)

Definition at line 241 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().

241  {
242  if (is_array($config) && isset($config[0])) {
243  $gen_config = $config[0];
244  $config = $config[1];
245  } else {
246  $gen_config = $config;
247  }
248  $this->prepareGenerator($gen_config);
249  // this should probably be split up a little
250  $ret = '';
251  $def = $config->def->info["$ns.$directive"];
252  if (is_int($def)) {
253  $type = abs($def);
254  } else {
255  $type = $def->type;
256  }
257  if (is_array($value)) {
258  switch ($type) {
260  $array = $value;
261  $value = array();
262  foreach ($array as $val => $b) {
263  $value[] = $val;
264  }
266  $value = implode(PHP_EOL, $value);
267  break;
269  $nvalue = '';
270  foreach ($value as $i => $v) {
271  $nvalue .= "$i:$v" . PHP_EOL;
272  }
273  $value = $nvalue;
274  break;
275  default:
276  $value = '';
277  }
278  }
279  if ($type === HTMLPurifier_VarParser::MIXED) {
280  return 'Not supported';
281  $value = serialize($value);
282  }
283  $attr = array(
284  'name' => "$name"."[$ns.$directive]",
285  'id' => "$name:$ns.$directive"
286  );
287  if ($value === null) $attr['disabled'] = 'disabled';
288  if (isset($def->allowed)) {
289  $ret .= $this->start('select', $attr);
290  foreach ($def->allowed as $val => $b) {
291  $attr = array();
292  if ($value == $val) $attr['selected'] = 'selected';
293  $ret .= $this->element('option', $val, $attr);
294  }
295  $ret .= $this->end('select');
296  } elseif (
297  $type === HTMLPurifier_VarParser::TEXT ||
298  $type === HTMLPurifier_VarParser::ITEXT ||
299  $type === HTMLPurifier_VarParser::ALIST ||
300  $type === HTMLPurifier_VarParser::HASH ||
302  ) {
303  $attr['cols'] = $this->cols;
304  $attr['rows'] = $this->rows;
305  $ret .= $this->start('textarea', $attr);
306  $ret .= $this->text($value);
307  $ret .= $this->end('textarea');
308  } else {
309  $attr['value'] = $value;
310  $attr['type'] = 'text';
311  $ret .= $this->elementEmpty('input', $attr);
312  }
313  return $ret;
314  }
start($tag, $attr=array())
Main function that renders object or aspect of that object.
Definition: Printer.php:45
elementEmpty($tag, $attr=array())
Definition: Printer.php:74
prepareGenerator($config)
Give generator necessary configuration if possible.
Definition: Printer.php:28
end($tag)
Returns an end teg.
Definition: Printer.php:55
element($tag, $contents, $attr=array(), $escape=true)
Prints a complete element with content inside.
Definition: Printer.php:68
$config
Instance of HTMLPurifier_Config, for easy access.
Definition: Printer.php:17
+ Here is the call graph for this function:

Field Documentation

◆ $cols

HTMLPurifier_Printer_ConfigForm_default::$cols = 18

Definition at line 239 of file ConfigForm.php.

◆ $rows

HTMLPurifier_Printer_ConfigForm_default::$rows = 5

Definition at line 240 of file ConfigForm.php.


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