public function validate($rules, $params = array()) { if (empty($params)) { $params = $this->getUserParams(); } else { $params = StringUtil::trim($params); } return ValidateUtil::validate($params, $rules); }
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; }