/** * Validate field value * * @throws Exception when empty or not valid email address */ function _validate() { parent::_validate(); $value = $this->getParam('value'); if (!is_null($value) && $value !== '@MAIL@' && !mail_isvalid($value)) { throw new Exception(sprintf($this->getLang('e_email'), hsc($this->getParam('display')))); } }
/** * Validate field input * * @throws Exception when empty or wrong time format */ protected function _validate() { parent::_validate(); $value = $this->getParam('value'); if (!is_null($value) && !preg_match('/^\\d{1,2}:\\d{2}(?::\\d{2})?$/', $value)) { throw new Exception(sprintf($this->getLang('e_time'), hsc($this->getParam('display')))); } }
/** * Validate field value * * @throws Exception when not a number */ protected function _validate() { $value = $this->getParam('value'); if (!is_null($value) && !is_numeric($value)) { throw new Exception(sprintf($this->getLang('e_numeric'), hsc($this->getParam('display')))); } parent::_validate(); }
/** * Validate value of field * * @throws Exception when user not exists */ protected function _validate() { parent::_validate(); /** @var DokuWiki_Auth_Plugin $auth */ global $auth; $value = $this->getParam('value'); if (!is_null($value) && $auth->getUserData($value) === false) { throw new Exception(sprintf($this->getLang('e_user'), hsc($this->getParam('display')))); } }
/** * Validate value of field * * @throws Exception when user not exists */ protected function _validate() { parent::_validate(); /** @var DokuWiki_Auth_Plugin $auth */ global $auth; $users = array_filter(preg_split('/\\s*,\\s*/', $this->getParam('value'))); foreach ($users as $user) { if ($auth->getUserData($user) === false) { throw new Exception(sprintf($this->getLang('e_users'), hsc($this->getParam('display')))); } } }