HTMLPurifier 4.4.0
/home/ezyang/Dev/htmlpurifier/library/HTMLPurifier/ChildDef/Optional.php
Go to the documentation of this file.
00001 <?php
00002 
00010 class HTMLPurifier_ChildDef_Optional extends HTMLPurifier_ChildDef_Required
00011 {
00012     public $allow_empty = true;
00013     public $type = 'optional';
00014     public function validateChildren($tokens_of_children, $config, $context) {
00015         $result = parent::validateChildren($tokens_of_children, $config, $context);
00016         // we assume that $tokens_of_children is not modified
00017         if ($result === false) {
00018             if (empty($tokens_of_children)) return true;
00019             elseif ($this->whitespace) return $tokens_of_children;
00020             else return array();
00021         }
00022         return $result;
00023     }
00024 }
00025 
00026 // vim: et sw=4 sts=4