/** * Returns whether the datafield contents are valid * * @return boolean indicating whether the datafield contents are valid */ public function isValid() { $value = trim($this->value); if (!$value) { return parent::isValid(); } return parent::isValid() && preg_match('/^([1-9]\\d*)?\\n[1-9]\\d+\\n[1-9]\\d+(-\\d+)?$/', $value); }
/** * Returns whether the datafield contents are valid * * @return boolean indicating whether the datafield contents are valid */ public function isValid() { $value = trim($this->value); if (!$value) { return parent::isValid(); } return parent::isValid() && strtotime($value) !== false; }
/** * Returns whether the datafield contents are valid * * @return boolean indicating whether the datafield contents are valid */ public function isValid() { $parts = explode(':', $this->value); return parent::isValid() && $parts[0] >= 0 && $parts[0] <= 24 && $parts[1] >= 0 && $parts[1] <= 59; }
/** * Returns whether the datafield contents are valid * * @return boolean indicating whether the datafield contents are valid */ public function isValid() { return parent::isValid() && (!$this->getValue() || filter_var($this->getValue(), FILTER_VALIDATE_URL) && preg_match('%^(https?|ftp)://%', $this->getValue())); }
/** * Returns whether the datafield contents are valid * * @return boolean indicating whether the datafield contents are valid */ public function isValid() { return parent::isValid() && (!$this->getValue() || filter_var($this->getValue(), FILTER_VALIDATE_EMAIL)); }