validate() public static method

Return values: o array, keys - field path or formset id, values - array of errors when $isPostSource is true values is an empty array to allow for error list cleanup in HTML document o false - when no validators match name(s) given by $validator_id
public static validate ( PMA\libraries\config\ConfigFile $cf, string | array $validator_id, &$values, boolean $isPostSource ) : boolean | array
$cf PMA\libraries\config\ConfigFile Config file instance
$validator_id string | array ID of validator(s) to run
$isPostSource boolean tells whether $values are directly from POST request
return boolean | array
Example #1
0
 /**
  * Runs validation for all registered forms
  *
  * @return void
  */
 private function _validate()
 {
     if ($this->_isValidated) {
         return;
     }
     $paths = array();
     $values = array();
     foreach ($this->_forms as $form) {
         /* @var $form Form */
         $paths[] = $form->name;
         // collect values and paths
         foreach ($form->fields as $path) {
             $work_path = array_search($path, $this->_systemPaths);
             $values[$path] = $this->_configFile->getValue($work_path);
             $paths[] = $path;
         }
     }
     // run validation
     $errors = Validator::validate($this->_configFile, $paths, $values, false);
     // change error keys from canonical paths to work paths
     if (is_array($errors) && count($errors) > 0) {
         $this->_errors = array();
         foreach ($errors as $path => $error_list) {
             $work_path = array_search($path, $this->_systemPaths);
             // field error
             if (!$work_path) {
                 // form error, fix path
                 $work_path = $path;
             }
             $this->_errors[$work_path] = $error_list;
         }
     }
     $this->_isValidated = true;
 }