public function validateData(MessageStack $errors, Entry $entry, $data = null) { if (self::STATUS_OK != parent::validateData($errors, $entry, $data)) { return self::STATUS_ERROR; } if (!isset($data->value)) { return self::STATUS_OK; } if (!is_numeric($data->value)) { $errors->append(null, (object) array('message' => __("'%s' must be a number.", array($this->{'name'})), 'code' => self::ERROR_INVALID)); return self::STATUS_ERROR; } return self::STATUS_OK; }
public function validateData(MessageStack $errors, Entry $entry = null, $data = null) { if (empty($data)) { return self::STATUS_OK; } if (self::STATUS_OK != parent::validateData($errors, $entry, $data)) { return self::STATUS_ERROR; } if (!is_null($data->value) && strlen(trim($data->value)) > 0 && !self::__isValidDateString($data->value)) { $errors->append(null, (object) array('message' => __("The date specified in '%s' is invalid.", array($this->{'publish-label'})), 'code' => self::ERROR_INVALID)); return self::STATUS_ERROR; } return self::STATUS_OK; }
public function validateData(MessageStack $errors, Entry $entry = null, $data = null) { if (!is_array($data)) { $data = array($data); } $value = NULL; foreach ($data as $d) { $value .= $d->value; } return parent::validateData($errors, $entry, $this->processData($value, $entry)); }
public function validateData(MessageStack $errors, Entry $entry, $data = null) { $length = (int) $this->{'text-length'}; if (self::STATUS_OK != parent::validateData($errors, $entry, $data)) { return self::STATUS_ERROR; } if (!isset($data->value)) { return self::STATUS_OK; } if (!$this->applyValidationRules($data->value)) { $errors->append(null, (object) array('message' => __("'%s' contains invalid data. Please check the contents.", array($this->name)), 'code' => self::ERROR_INVALID)); return self::STATUS_ERROR; } if ($length > 0 and $length < strlen($data->value)) { $errors->append(null, (object) array('message' => __("'%s' must be no longer than %s characters.", array($this->{'name'}, $length)), 'code' => self::ERROR_INVALID)); return self::STATUS_ERROR; } return self::STATUS_OK; }