XOOPS 2.5.6  Final
 All Classes Namespaces Files Functions Variables Pages
Optional.php
Go to the documentation of this file.
1 <?php
2 
11 {
12  public $allow_empty = true;
13  public $type = 'optional';
14  public function validateChildren($tokens_of_children, $config, $context) {
15  $result = parent::validateChildren($tokens_of_children, $config, $context);
16  // we assume that $tokens_of_children is not modified
17  if ($result === false) {
18  if (empty($tokens_of_children)) return true;
19  elseif ($this->whitespace) return $tokens_of_children;
20  else return array();
21  }
22  return $result;
23  }
24 }
25 
26 // vim: et sw=4 sts=4