getMatches(); if (isset($dateMatches['month'])) { if (($dateMatches['month'] >= 1 && $dateMatches['month'] <= 12) || $maxScope == VALIDATOR_DATE_SCOPE_YEAR ) { if (isset($dateMatches['day'])) { return (checkdate($dateMatches['month'], $dateMatches['day'], $dateMatches['year']) && $maxScope == VALIDATOR_DATE_SCOPE_DAY); } else { return $maxScope < VALIDATOR_DATE_SCOPE_YEAR && $minScope > VALIDATOR_DATE_SCOPE_DAY; } } else { return false; } } else { return ($minScope == VALIDATOR_DATE_SCOPE_YEAR); } } // // Public static methods // /** * Return the regex for a date check. This can be called * statically. * @param $dateFormat integer one of the DATE_FORMAT_* ids. * @return string */ function getRegexp($dateFormat = DATE_FORMAT_ISO) { switch ($dateFormat) { case DATE_FORMAT_ISO: return '/(?P\d{4})(?:-(?P\d{2})(?:-(?P\d{2}))?)?/'; break; default: // FIXME: Additional date formats can be // added to the case list as required. assert(false); } } } ?>