Source for file Optional.php

Documentation is available at Optional.php

  1. <?php
  2.  
  3. /**
  4.  * Definition that allows a set of elements, and allows no children.
  5.  * @note This is a hack to reuse code from HTMLPurifier_ChildDef_Required,
  6.  *        really, one shouldn't inherit from the other.  Only altered behavior
  7.  *        is to overload a returned false with an array.  Thus, it will never
  8.  *        return false.
  9.  */
  10. {
  11.     public $allow_empty = true;
  12.     public $type = 'optional';
  13.     public function validateChildren($tokens_of_children$config$context{
  14.         $result parent::validateChildren($tokens_of_children$config$context);
  15.         if ($result === false{
  16.             if (empty($tokens_of_children)) return true;
  17.             else return array();
  18.         }
  19.         return $result;
  20.     }
  21. }

Documentation generated on Thu, 19 Jun 2008 18:49:51 -0400 by phpDocumentor 1.4.2