25 #require_once 'Zend/Validate/Abstract.php'; 45 self::INVALID =>
"Invalid type given. String, integer, array or Zend_Date expected",
46 self::INVALID_DATE =>
"'%value%' does not appear to be a valid date",
47 self::FALSEFORMAT =>
"'%value%' does not fit the date format '%format%'",
82 $temp[
'format'] = array_shift(
$options);
84 $temp[
'locale'] = array_shift(
$options);
90 if (array_key_exists(
'format',
$options)) {
94 if (!array_key_exists(
'locale',
$options)) {
95 #require_once 'Zend/Registry.php'; 101 if (array_key_exists(
'locale',
$options)) {
124 #require_once 'Zend/Locale.php'; 165 $this->
_error(self::INVALID);
171 if (($this->_format !==
null) || ($this->_locale !==
null) || is_array(
$value) ||
173 #require_once 'Zend/Date.php'; 174 if (!Zend_Date::isDate(
$value, $this->_format, $this->_locale)) {
175 if ($this->_checkFormat(
$value) ===
false) {
176 $this->
_error(self::FALSEFORMAT);
178 $this->
_error(self::INVALID_DATE);
183 if (!preg_match(
'/^\d{4}-\d{2}-\d{2}$/',
$value)) {
184 $this->_format =
'yyyy-MM-dd';
185 $this->
_error(self::FALSEFORMAT);
186 $this->_format =
null;
190 list($year, $month, $day) = sscanf(
$value,
'%d-%d-%d');
192 if (!checkdate($month, $day, $year)) {
193 $this->
_error(self::INVALID_DATE);
207 private function _checkFormat(
$value)
210 #require_once 'Zend/Locale/Format.php'; 212 'date_format' => $this->_format,
'format_type' =>
'iso',
213 'fix_date' =>
false));
214 if (isset($parsed[
'year']) and ((strpos(strtoupper($this->_format),
'YY') !==
false) and
215 (strpos(strtoupper($this->_format),
'YYYY') ===
false))) {
216 $parsed[
'year'] = Zend_Date::getFullYear($parsed[
'year']);
218 }
catch (Exception $e) {
223 if (((strpos($this->_format,
'Y') !==
false) or (strpos($this->_format,
'y') !==
false)) and
224 (!isset($parsed[
'year']))) {
229 if ((strpos($this->_format,
'M') !==
false) and (!isset($parsed[
'month']))) {
234 if ((strpos($this->_format,
'd') !==
false) and (!isset($parsed[
'day']))) {
239 if (((strpos($this->_format,
'H') !==
false) or (strpos($this->_format,
'h') !==
false)) and
240 (!isset($parsed[
'hour']))) {
245 if ((strpos($this->_format,
'm') !==
false) and (!isset($parsed[
'minute']))) {
250 if ((strpos($this->_format,
's') !==
false) and (!isset($parsed[
'second']))) {
__construct($options=array())
_error($messageKey, $value=null)
static isRegistered($index)
static findLocale($locale=null)