Пример #1
0
 /**
  * Sets validator options
  *
  * Min limits the used diskspace for all files, when used with max=null it is the maximum filesize
  * It also accepts an array with the keys 'min' and 'max'
  *
  * @param  integer|array|Zend_Config $options Options for this validator
  * @throws Zend_Validate_Exception
  */
 public function __construct($options)
 {
     $this->_files = array();
     $this->_setSize(0);
     if ($options instanceof Zend_Config) {
         $options = $options->toArray();
     } elseif (is_scalar($options)) {
         $options = array('max' => $options);
     } elseif (!is_array($options)) {
         throw new Zend_Validate_Exception('Invalid options to validator provided');
     }
     if (1 < func_num_args()) {
         $argv = func_get_args();
         array_shift($argv);
         $options['max'] = array_shift($argv);
         if (!empty($argv)) {
             $options['bytestring'] = array_shift($argv);
         }
     }
     parent::__construct($options);
 }
Пример #2
0
 /**
  * Sets validator options
  *
  * Min limits the used diskspace for all files, when used with max=null it is the maximum filesize
  * It also accepts an array with the keys 'min' and 'max'
  *
  * @param  integer|array $min        Minimum diskspace for all files
  * @param  integer       $max        Maximum diskspace for all files (deprecated)
  * @param  boolean       $bytestring Use bytestring or real size ? (deprecated)
  * @return void
  */
 public function __construct($options)
 {
     $this->_files = array();
     $this->_setSize(0);
     if (1 < func_num_args()) {
         trigger_error('Multiple constructor options are deprecated in favor of a single options array', E_USER_NOTICE);
         if ($options instanceof Zend_Config) {
             $options = $options->toArray();
         } elseif (is_scalar($options)) {
             $options = array('min' => $options);
         } elseif (!is_array($options)) {
             #require_once 'Zend/Validate/Exception.php';
             throw new Zend_Validate_Exception('Invalid options to validator provided');
         }
         $argv = func_get_args();
         array_shift($argv);
         $options['max'] = array_shift($argv);
         if (!empty($argv)) {
             $options['bytestring'] = array_shift($argv);
         }
     }
     parent::__construct($options);
 }
Пример #3
0
 /**
  * Sets validator options
  *
  * Min limits the used diskspace for all files, when used with max=null it is the maximum filesize
  * It also accepts an array with the keys 'min' and 'max'
  *
  * @param  integer|array $min Minimum diskspace for all files
  * @param  integer       $max Maximum diskspace for all files
  * @return void
  */
 public function __construct($min, $max = null)
 {
     $this->_files = array();
     $this->_size = 0;
     parent::__construct($min, $max);
 }
Пример #4
0
 /**
  * Sets validator options
  *
  * Min limits the used diskspace for all files, when used with max=null it is the maximum filesize
  * It also accepts an array with the keys 'min' and 'max'
  *
  * @param  integer|array $min        Minimum diskspace for all files
  * @param  integer       $max        Maximum diskspace for all files
  * @param  boolean       $bytestring Use bytestring or real size ?
  * @return void
  */
 public function __construct($min, $max = null, $bytestring = true)
 {
     $this->_files = array();
     $this->_size = 0;
     parent::__construct($min, $max, $bytestring);
 }