Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Public Member Functions | Data Fields | Protected Member Functions | Protected Attributes
Zend_Validate_File_IsCompressed Class Reference
Inheritance diagram for Zend_Validate_File_IsCompressed:
Zend_Validate_File_MimeType Zend_Validate_Abstract Zend_Validate_Interface

Public Member Functions

 __construct ($mimetype=array())
 
- Public Member Functions inherited from Zend_Validate_File_MimeType
 __construct ($mimetype)
 
 getMagicFile ()
 
 setMagicFile ($file)
 
 setTryCommonMagicFilesFlag ($flag=true)
 
 shouldTryCommonMagicFiles ()
 
 getHeaderCheck ()
 
 enableHeaderCheck ($headerCheck=true)
 
 getMimeType ($asArray=false)
 
 setMimeType ($mimetype)
 
 addMimeType ($mimetype)
 
 isValid ($value, $file=null)
 
- Public Member Functions inherited from Zend_Validate_Abstract
 getMessages ()
 
 getMessageVariables ()
 
 getMessageTemplates ()
 
 setMessage ($messageString, $messageKey=null)
 
 setMessages (array $messages)
 
 __get ($property)
 
 getErrors ()
 
 setObscureValue ($flag)
 
 getObscureValue ()
 
 setTranslator ($translator=null)
 
 getTranslator ()
 
 hasTranslator ()
 
 setDisableTranslator ($flag)
 
 translatorIsDisabled ()
 
- Public Member Functions inherited from Zend_Validate_Interface
 isValid ($value)
 

Data Fields

const FALSE_TYPE = 'fileIsCompressedFalseType'
 
const NOT_DETECTED = 'fileIsCompressedNotDetected'
 
const NOT_READABLE = 'fileIsCompressedNotReadable'
 
- Data Fields inherited from Zend_Validate_File_MimeType
const FALSE_TYPE = 'fileMimeTypeFalse'
 
const NOT_DETECTED = 'fileMimeTypeNotDetected'
 
const NOT_READABLE = 'fileMimeTypeNotReadable'
 

Protected Member Functions

 _throw ($file, $errorType)
 
- Protected Member Functions inherited from Zend_Validate_File_MimeType
 _throw ($file, $errorType)
 
 _detectMimeType ($file)
 
 _errorHandler ($errno, $errstr, $errfile, $errline)
 
- Protected Member Functions inherited from Zend_Validate_Abstract
 _createMessage ($messageKey, $value)
 
 _implodeRecursive (array $pieces)
 
 _error ($messageKey, $value=null)
 
 _setValue ($value)
 

Protected Attributes

 $_messageTemplates
 
- Protected Attributes inherited from Zend_Validate_File_MimeType
 $_messageTemplates
 
 $_messageVariables
 
 $_type
 
 $_mimetype
 
 $_magicfile
 
 $_finfo
 
 $_magicFiles
 
 $_tryCommonMagicFiles = true
 
 $_headerCheck = false
 
 $_finfoError
 
- Protected Attributes inherited from Zend_Validate_Abstract
 $_value
 
 $_messageVariables = array()
 
 $_messageTemplates = array()
 
 $_messages = array()
 
 $_obscureValue = false
 
 $_errors = array()
 
 $_translator
 
 $_translatorDisabled = false
 

Additional Inherited Members

- Static Public Member Functions inherited from Zend_Validate_Abstract
static setDefaultTranslator ($translator=null)
 
static getDefaultTranslator ()
 
static hasDefaultTranslator ()
 
static getMessageLength ()
 
static setMessageLength ($length=-1)
 
- Static Protected Attributes inherited from Zend_Validate_Abstract
static $_defaultTranslator
 
static $_messageLength = -1
 

Detailed Description

Definition at line 35 of file IsCompressed.php.

Constructor & Destructor Documentation

◆ __construct()

__construct (   $mimetype = array())

Sets validator options

Parameters
string | array | Zend_Config$mimetype

Definition at line 58 of file IsCompressed.php.

59  {
60  if ($mimetype instanceof Zend_Config) {
61  $mimetype = $mimetype->toArray();
62  }
63 
64  $temp = array();
65  // http://de.wikipedia.org/wiki/Liste_von_Dateiendungen
66  $default = array(
67  'application/arj',
68  'application/gnutar',
69  'application/lha',
70  'application/lzx',
71  'application/vnd.ms-cab-compressed',
72  'application/x-ace-compressed',
73  'application/x-arc',
74  'application/x-archive',
75  'application/x-arj',
76  'application/x-bzip',
77  'application/x-bzip2',
78  'application/x-cab-compressed',
79  'application/x-compress',
80  'application/x-compressed',
81  'application/x-cpio',
82  'application/x-debian-package',
83  'application/x-eet',
84  'application/x-gzip',
85  'application/x-java-pack200',
86  'application/x-lha',
87  'application/x-lharc',
88  'application/x-lzh',
89  'application/x-lzma',
90  'application/x-lzx',
91  'application/x-rar',
92  'application/x-sit',
93  'application/x-stuffit',
94  'application/x-tar',
95  'application/zip',
96  'application/x-zip',
97  'application/zoo',
98  'multipart/x-gzip',
99  );
100 
101  if (is_array($mimetype)) {
102  $temp = $mimetype;
103  if (array_key_exists('magicfile', $temp)) {
104  unset($temp['magicfile']);
105  }
106 
107  if (array_key_exists('headerCheck', $temp)) {
108  unset($temp['headerCheck']);
109  }
110 
111  if (empty($temp)) {
112  $mimetype += $default;
113  }
114  }
115 
116  if (empty($mimetype)) {
117  $mimetype = $default;
118  }
119 
120  parent::__construct($mimetype);
121  }

Member Function Documentation

◆ _throw()

_throw (   $file,
  $errorType 
)
protected

Throws an error of the given type Duplicates parent method due to OOP Problem with late static binding in PHP 5.2

Parameters
string$file
string$errorType
Returns
false

Definition at line 131 of file IsCompressed.php.

132  {
133  $this->_value = $file['name'];
134  switch($errorType) {
136  $errorType = self::FALSE_TYPE;
137  break;
139  $errorType = self::NOT_DETECTED;
140  break;
142  $errorType = self::NOT_READABLE;
143  break;
144  }
145 
146  $this->_error($errorType);
147  return false;
148  }
_error($messageKey, $value=null)
Definition: Abstract.php:284

Field Documentation

◆ $_messageTemplates

$_messageTemplates
protected
Initial value:
= array(
self::FALSE_TYPE => "File '%value%' is not compressed, '%type%' detected",
self::NOT_DETECTED => "The mimetype of file '%value%' could not be detected",
self::NOT_READABLE => "File '%value%' is not readable or does not exist",
)

Definition at line 47 of file IsCompressed.php.

◆ FALSE_TYPE

const FALSE_TYPE = 'fileIsCompressedFalseType'

@const string Error constants

Definition at line 40 of file IsCompressed.php.

◆ NOT_DETECTED

const NOT_DETECTED = 'fileIsCompressedNotDetected'

Definition at line 41 of file IsCompressed.php.

◆ NOT_READABLE

const NOT_READABLE = 'fileIsCompressedNotReadable'

Definition at line 42 of file IsCompressed.php.


The documentation for this class was generated from the following file: