Exemple #1
0
 public function __construct($validators, $input)
 {
     // Zend_Filter_Input requires that ALL input fields be present in
     // $validators. Even optional fields must be included with a
     //
     //      array('allowEmpty' => true)
     //
     // validator. For convenience, let's add these here for optional fields.
     $validatorKeys = array_keys($validators);
     $inputKeys = array_keys($input);
     $optionalKeys = array_diff($inputKeys, $validatorKeys);
     foreach ($optionalKeys as $key) {
         $validators[$key] = array('allowEmpty' => true);
     }
     // We will apply one global filter: trim whitespace.
     $filters = array('*' => 'StringTrim');
     // call the Zend_Filter_Input constructor
     parent::__construct($filters, $validators, $input);
 }