/**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  array options
  * @return mixed
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (isset($this->options['uri'])) {
         $this->message = __("Code already used");
     }
 }
Exemplo n.º 2
0
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     if (!$this->hasOption('mimetype')) {
         throw new common_Exception("Please define the mimetype option for the FileMimeType Validator");
     }
 }
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  array options
  * @return mixed
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (!isset($this->options['format'])) {
         throw new Exception("Please set the format options (define your regular expression)!");
     }
     $this->message = __('The format of this field is not valid.');
 }
Exemplo n.º 4
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  array options
  * @return mixed
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     $this->message = __('Invalid file type!');
     if (!isset($this->options['mimetype'])) {
         throw new common_Exception("Please define the mimetype option for the FileMimeType Validator");
     }
 }
Exemplo n.º 5
0
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     if (!$this->hasOption('function') && !(($this->hasOption('class') || $this->hasOption('object')) && $this->hasOption('method'))) {
         throw new Exception("Please define a callback function or method");
     }
     if ($this->hasOption('message')) {
         $this->setMessage($this->getOption('message'));
     }
 }
Exemplo n.º 6
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  array options
  * @return mixed
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (isset($this->options['message'])) {
         $this->message = $this->options['message'];
     }
     if (!isset($this->options['function']) && !((isset($this->options['class']) || isset($this->options['object'])) && isset($this->options['method']))) {
         throw new Exception("Please define a callback function or method");
     }
 }
Exemplo n.º 7
0
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     if (!$this->hasOption('format')) {
         throw new common_Exception("Please set the format options (define your regular expression)!");
     }
     if ($this->hasOption('message')) {
         $this->setMessage($this->getOption('message'));
     }
 }
Exemplo n.º 8
0
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     if ($this->hasOption('min') && $this->hasOption('max')) {
         $this->setMessage(__('Invalid file size (minimum %1$s bytes, maximum %2$s bytes)', $this->getOption('min'), $this->getOption('max')));
     } elseif ($this->hasOption('max')) {
         $this->setMessage(__('The uploaded file is too large (maximum %s bytes)', $this->getOption('max')));
         $this->setOption('min', 0);
     } else {
         throw new common_Exception("Please set 'min' and/or 'max' options!");
     }
 }
Exemplo n.º 9
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  array options
  * @return mixed
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (!isset($this->options['reference']) || !$this->options['reference'] instanceof tao_helpers_form_FormElement) {
         throw new common_Exception("No FormElement provided as reference for Equals validator");
     }
     $reference = $this->options['reference'];
     if (isset($this->options['invert']) && $this->options['invert']) {
         $this->message = __('This should not equal ') . $reference->getDescription();
     } else {
         $this->message = __('This should equal ') . $reference->getDescription();
     }
 }
Exemplo n.º 10
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  *
  * @param  array $options
  *
  * @param string $name
  *
  * @throws Exception
  */
 public function __construct(array $options = array(), $name = '')
 {
     parent::__construct($options);
     if (!isset($this->options['format'])) {
         throw new Exception("Please set the format options (define your regular expression)!");
     }
     $this->message = array_key_exists('message', $this->options) ? $this->options['message'] : __('The format of this field is not valid.');
     if (is_string($name) && $name) {
         $this->name = $name;
     } else {
         $this->name = str_replace('tao_helpers_form_validators_', '', get_class($this));
     }
 }
Exemplo n.º 11
0
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     if (!$this->hasOption('reference') || !$this->getOption('reference') instanceof tao_helpers_form_FormElement) {
         throw new common_Exception("No FormElement provided as reference for Equals validator");
     }
     $reference = $this->getOption('reference');
     if ($this->hasOption('invert') && $this->getOption('invert')) {
         $this->setMessage(__('This should not equal %s', $reference->getDescription()));
     } else {
         $this->setMessage(__('This should equal %s', $reference->getDescription()));
     }
 }
Exemplo n.º 12
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  array options
  * @return mixed
  */
 public function __construct($options)
 {
     parent::__construct($options);
     if (isset($this->options['min']) && isset($this->options['max'])) {
         $this->message = __('Invalid file size') . " (minimum " . $this->options['min'] . " octets, maximum " . $this->options['max'] . " octets)";
     } else {
         if (!isset($this->options['min']) && isset($this->options['max'])) {
             $this->options['min'] = 0;
             $this->message = __('The uploaded file is too large') . " (maximum " . $this->options['max'] . " octets)";
         } else {
             throw new common_Exception("Please set 'min' and/or 'max' options!");
         }
     }
 }
Exemplo n.º 13
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  array options
  * @return mixed
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     if (isset($this->options['min']) && isset($this->options['max'])) {
         $this->message = __('Invalid field length') . " (minimum " . $this->options['min'] . ", maximum " . $this->options['max'] . ")";
     } else {
         if (isset($this->options['min']) && !isset($this->options['max'])) {
             $this->message = __('This field is too short') . " (minimum " . $this->options['min'] . ")";
         } else {
             if (!isset($this->options['min']) && isset($this->options['max'])) {
                 $this->message = __('This field is too long') . " (maximum " . $this->options['max'] . ")";
             } else {
                 throw new Exception("Please set 'min' and/or 'max' options!");
             }
         }
     }
 }
Exemplo n.º 14
0
 public function setOptions(array $options)
 {
     parent::setOptions($options);
     if ($this->hasOption('min') && $this->hasOption('max')) {
         $this->setMessage(__('Invalid field length') . " (minimum " . $this->getOption('min') . ", maximum " . $this->getOption('max') . ")");
     } else {
         if ($this->hasOption('min') && !$this->hasOption('max')) {
             $this->setMessage(__('This field is too short') . " (minimum " . $this->getOption('min') . ")");
         } else {
             if (!$this->hasOption('min') && $this->hasOption('max')) {
                 $this->setMessage(__('This field is too long') . " (maximum " . $this->getOption('max') . ")");
             } else {
                 throw new Exception("Please set 'min' and/or 'max' options!");
             }
         }
     }
 }
Exemplo n.º 15
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  array options
  * @return mixed
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     $this->message = __('Passwords are not matching');
 }
Exemplo n.º 16
0
 public function setOptions(array $options)
 {
     unset($this->property);
     parent::setOptions($options);
 }
Exemplo n.º 17
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  array options
  * @return mixed
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     isset($options['message']) ? $this->message = $options['message'] : ($this->message = __('This field is required'));
 }
Exemplo n.º 18
0
 /**
  * Setup email validator
  *
  * @access public
  * @author Aleh Hutnikau <*****@*****.**>
  * @param array Validator options
  * @return void
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     isset($options['message']) ? $this->message = $options['message'] : ($this->message = __('This is not a valid email address.'));
 }
 /**
  * Short description of method addValidator
  *
  * @author Joel Bout, <*****@*****.**>
  * @param  Validator validator
  * @return mixed
  */
 public function addValidator(tao_helpers_form_Validator $validator)
 {
     $this->validators[$validator->getName()] = $validator;
 }
Exemplo n.º 20
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Bertrand Chevrier, <*****@*****.**>
  * @param  array options
  * @return mixed
  */
 public function __construct(array $options = array())
 {
     parent::__construct($options);
 }
Exemplo n.º 21
0
 /**
  * Short description of method __construct
  *
  * @access public
  * @author Joel Bout, <*****@*****.**>
  * @param  array $options
  * @return mixed
  */
 public function __construct($options = array())
 {
     parent::__construct($options);
     isset($options['message']) ? $this->message = $options['message'] : ($this->message = __('Entity with such field already present'));
 }