wpcf7_is_time()
Checks whether the given text is a valid time.
Хуки из функции
Возвращает
null. Ничего (null).
Использование
wpcf7_is_time( $text );
- $text(обязательный)
- .
Код wpcf7_is_time() wpcf7 is time CF7 6.1.5
function wpcf7_is_time( $text ) {
$result = preg_match(
'/^([0-9]{2})\:([0-9]{2})(?:\:([0-9]{2}))?$/',
$text,
$matches
);
if ( $result ) {
$hour = (int) $matches[1];
$minute = (int) $matches[2];
$second = empty( $matches[3] ) ? 0 : (int) $matches[3];
$result = (
0 <= $hour && $hour <= 23 &&
0 <= $minute && $minute <= 59 &&
0 <= $second && $second <= 59
);
}
return apply_filters( 'wpcf7_is_time', $result, $text );
}