/** * Sets validator options * * @param string|array|\Zend\Config\Config $mimetype * @return void */ public function __construct($mimetype = array()) { if ($mimetype instanceof \Zend\Config\Config) { $mimetype = $mimetype->toArray(); } $temp = array(); // http://de.wikipedia.org/wiki/Liste_von_Dateiendungen // http://www.iana.org/assignments/media-types/image/ $default = array('application/cdf', 'application/dicom', 'application/fractals', 'application/postscript', 'application/vnd.hp-hpgl', 'application/vnd.oasis.opendocument.graphics', 'application/x-cdf', 'application/x-cmu-raster', 'application/x-ima', 'application/x-inventor', 'application/x-koan', 'application/x-portable-anymap', 'application/x-world-x-3dmf', 'image/bmp', 'image/c', 'image/cgm', 'image/fif', 'image/gif', 'image/jpeg', 'image/jpm', 'image/jpx', 'image/jp2', 'image/naplps', 'image/pjpeg', 'image/png', 'image/svg', 'image/svg+xml', 'image/tiff', 'image/vnd.adobe.photoshop', 'image/vnd.djvu', 'image/vnd.fpx', 'image/vnd.net-fpx', 'image/x-cmu-raster', 'image/x-cmx', 'image/x-coreldraw', 'image/x-cpi', 'image/x-emf', 'image/x-ico', 'image/x-icon', 'image/x-jg', 'image/x-ms-bmp', 'image/x-niff', 'image/x-pict', 'image/x-pcx', 'image/x-portable-anymap', 'image/x-portable-bitmap', 'image/x-portable-greymap', 'image/x-portable-pixmap', 'image/x-quicktime', 'image/x-rgb', 'image/x-tiff', 'image/x-unknown', 'image/x-windows-bmp', 'image/x-xpmi'); if (is_array($mimetype)) { $temp = $mimetype; if (array_key_exists('magicfile', $temp)) { unset($temp['magicfile']); } if (array_key_exists('headerCheck', $temp)) { unset($temp['headerCheck']); } if (empty($temp)) { $mimetype += $default; } } if (empty($mimetype)) { $mimetype = $default; } parent::__construct($mimetype); }
/** * Sets validator options * * @param string|array|\Zend\Config\Config $compression * @return void */ public function __construct($mimetype = array()) { if ($mimetype instanceof \Zend\Config\Config) { $mimetype = $mimetype->toArray(); } $temp = array(); // http://de.wikipedia.org/wiki/Liste_von_Dateiendungen $default = array('application/arj', 'application/gnutar', 'application/lha', 'application/lzx', 'application/vnd.ms-cab-compressed', 'application/x-ace-compressed', 'application/x-arc', 'application/x-archive', 'application/x-arj', 'application/x-bzip', 'application/x-bzip2', 'application/x-cab-compressed', 'application/x-compress', 'application/x-compressed', 'application/x-cpio', 'application/x-debian-package', 'application/x-eet', 'application/x-gzip', 'application/x-java-pack200', 'application/x-lha', 'application/x-lharc', 'application/x-lzh', 'application/x-lzma', 'application/x-lzx', 'application/x-rar', 'application/x-sit', 'application/x-stuffit', 'application/x-tar', 'application/zip', 'application/zoo', 'multipart/x-gzip'); if (is_array($mimetype)) { $temp = $mimetype; if (array_key_exists('magicfile', $temp)) { unset($temp['magicfile']); } if (array_key_exists('headerCheck', $temp)) { unset($temp['headerCheck']); } if (empty($temp)) { $mimetype += $default; } } if (empty($mimetype)) { $mimetype = $default; } parent::__construct($mimetype); }
/** * Sets validator options * * @param string|array|\Zend\Config\Config $compression * @return void */ public function __construct($options = array()) { // http://de.wikipedia.org/wiki/Liste_von_Dateiendungen $default = array('application/arj', 'application/gnutar', 'application/lha', 'application/lzx', 'application/vnd.ms-cab-compressed', 'application/x-ace-compressed', 'application/x-arc', 'application/x-archive', 'application/x-arj', 'application/x-bzip', 'application/x-bzip2', 'application/x-cab-compressed', 'application/x-compress', 'application/x-compressed', 'application/x-cpio', 'application/x-debian-package', 'application/x-eet', 'application/x-gzip', 'application/x-java-pack200', 'application/x-lha', 'application/x-lharc', 'application/x-lzh', 'application/x-lzma', 'application/x-lzx', 'application/x-rar', 'application/x-sit', 'application/x-stuffit', 'application/x-tar', 'application/zip', 'application/zoo', 'multipart/x-gzip'); if (is_array($options) && array_key_exists('magicFile', $options)) { $this->setMagicFile($options['magicFile']); unset($options['magicFile']); } if (is_array($options) && array_key_exists('enableHeaderCheck', $options)) { $this->enableHeaderCheck($options['enableHeaderCheck']); unset($options['enableHeaderCheck']); } if (is_array($options) && !array_key_exists('mimeType', $options)) { $options['mimeType'] = $options; } if (empty($options)) { $options = array('mimeType' => $default); } if (!is_array($options)) { $options = array('mimeType' => $options); } parent::__construct($options); }
/** * Sets validator options * * @param string|array|\Zend\Config\Config $mimetype * @return void */ public function __construct($options = array()) { // http://de.wikipedia.org/wiki/Liste_von_Dateiendungen // http://www.iana.org/assignments/media-types/image/ $default = array('application/cdf', 'application/dicom', 'application/fractals', 'application/postscript', 'application/vnd.hp-hpgl', 'application/vnd.oasis.opendocument.graphics', 'application/x-cdf', 'application/x-cmu-raster', 'application/x-ima', 'application/x-inventor', 'application/x-koan', 'application/x-portable-anymap', 'application/x-world-x-3dmf', 'image/bmp', 'image/c', 'image/cgm', 'image/fif', 'image/gif', 'image/jpeg', 'image/jpm', 'image/jpx', 'image/jp2', 'image/naplps', 'image/pjpeg', 'image/png', 'image/svg', 'image/svg+xml', 'image/tiff', 'image/vnd.adobe.photoshop', 'image/vnd.djvu', 'image/vnd.fpx', 'image/vnd.net-fpx', 'image/x-cmu-raster', 'image/x-cmx', 'image/x-coreldraw', 'image/x-cpi', 'image/x-emf', 'image/x-ico', 'image/x-icon', 'image/x-jg', 'image/x-ms-bmp', 'image/x-niff', 'image/x-pict', 'image/x-pcx', 'image/x-png', 'image/x-portable-anymap', 'image/x-portable-bitmap', 'image/x-portable-greymap', 'image/x-portable-pixmap', 'image/x-quicktime', 'image/x-rgb', 'image/x-tiff', 'image/x-unknown', 'image/x-windows-bmp', 'image/x-xpmi'); if (is_array($options) && array_key_exists('magicFile', $options)) { $this->setMagicFile($options['magicFile']); unset($options['magicFile']); } if (is_array($options) && array_key_exists('enableHeaderCheck', $options)) { $this->enableHeaderCheck($options['enableHeaderCheck']); unset($options['enableHeaderCheck']); } if (is_array($options) && !array_key_exists('mimeType', $options)) { $options['mimeType'] = $options; } if (empty($options)) { $options = array('mimeType' => $default); } if (!is_array($options)) { $options = array('mimeType' => $options); } parent::__construct($options); }