示例#1
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");
     }
 }
示例#2
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'));
     }
 }
示例#3
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'));
     }
 }
示例#4
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!");
     }
 }
示例#5
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()));
     }
 }
示例#6
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!");
             }
         }
     }
 }
示例#7
0
 public function setOptions(array $options)
 {
     unset($this->property);
     parent::setOptions($options);
 }