Source for file Composite.php

Documentation is available at Composite.php

  1. <?php
  2.  
  3. /**
  4.  * Allows multiple validators to attempt to validate attribute.
  5.  * 
  6.  * Composite is just what it sounds like: a composite of many validators.
  7.  * This means that multiple HTMLPurifier_AttrDef objects will have a whack
  8.  * at the string.  If one of them passes, that's what is returned.  This is
  9.  * especially useful for CSS values, which often are a choice between
  10.  * an enumerated set of predefined values or a flexible data type.
  11.  */
  12. {
  13.     
  14.     /**
  15.      * List of HTMLPurifier_AttrDef objects that may process strings
  16.      * @todo Make protected
  17.      */
  18.     public $defs;
  19.     
  20.     /**
  21.      * @param $defs List of HTMLPurifier_AttrDef objects
  22.      */
  23.     public function __construct($defs{
  24.         $this->defs = $defs;
  25.     }
  26.     
  27.     public function validate($string$config$context{
  28.         foreach ($this->defs as $i => $def{
  29.             $result $this->defs[$i]->validate($string$config$context);
  30.             if ($result !== falsereturn $result;
  31.         }
  32.         return false;
  33.     }
  34.     
  35. }

Documentation generated on Thu, 19 Jun 2008 18:48:56 -0400 by phpDocumentor 1.4.2