예제 #1
0
 public function validate($rules, $params = array())
 {
     if (empty($params)) {
         $params = $this->getUserParams();
     } else {
         $params = StringUtil::trim($params);
     }
     return ValidateUtil::validate($params, $rules);
 }
예제 #2
0
 private static function checkDatetime($fieldName, $ruleArgs, $userError)
 {
     $fieldValue = self::getParamValue($fieldName);
     if (StringUtil::strLenth($fieldValue) == 0) {
         return true;
     }
     $format = empty($ruleArgs[0]) ? 'Y-m-d H:i:s' : $ruleArgs[0];
     $checkRes = $fieldValue == date($format, strtotime($fieldValue));
     if (!$checkRes) {
         $errorMsg = sprintf(self::getErrorMsg('ERROR_DATTIME', $userError), $maxCount);
         self::addError($fieldName, $errorMsg);
     }
     return $checkRes;
 }