function _validate()
 {
     parent::_validate();
     $value = $this->getParam('value');
     if (!is_null($value) && !mail_isvalid($value)) {
         throw new Exception(sprintf($this->getLang('e_email'), hsc($this->getParam('label'))));
     }
 }
Esempio n. 2
0
 /**
  * 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();
 }
 function _validate()
 {
     parent::_validate();
     $value = $this->getParam('value');
     if (!is_null($value) && !preg_match('/^\\d{4}-\\d{2}-\\d{2}$/', $value)) {
         throw new Exception(sprintf($this->getLang('e_date'), hsc($this->getParam('label'))));
     }
 }
 function _validate()
 {
     parent::_validate();
     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('label'))));
     }
 }
Esempio n. 5
0
 /**
  * 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'))));
     }
 }
 function _validate()
 {
     parent::_validate();
     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('label'))));
         }
     }
 }
Esempio n. 7
0
 /**
  * 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'))));
         }
     }
 }