16 lines
389 B
PHP
16 lines
389 B
PHP
<?php
|
|
|
|
class stTimeValidator extends sfValidator
|
|
{
|
|
public function execute(&$value, &$error)
|
|
{
|
|
if (!preg_match('/^(0[0-9]|1[0-9]|2[0-3]):[0-5][0-9]$/', $value))
|
|
{
|
|
$error = $this->context->getI18N()->__('Musisz przekazać poprawną godzinę (np. 11:00)', null, 'stDeliveryBackend');
|
|
return false;
|
|
}
|
|
|
|
return true;
|
|
}
|
|
|
|
} |