|
| send ($options=null) |
|
| receive ($options=null) |
|
| isSent ($files=null) |
|
| isReceived ($files=null) |
|
| isUploaded ($files=null) |
|
| isFiltered ($files=null) |
|
| setPluginLoader (Zend_Loader_PluginLoader_Interface $loader, $type) |
|
| getPluginLoader ($type) |
|
| addPrefixPath ($prefix, $path, $type=null) |
|
| addPrefixPaths (array $spec) |
|
| addValidator ($validator, $breakChainOnFailure=false, $options=null, $files=null) |
|
| addValidators (array $validators, $files=null) |
|
| setValidators (array $validators, $files=null) |
|
| hasValidator ($name) |
|
| getValidator ($name) |
|
| getValidators ($files=null) |
|
| removeValidator ($name) |
|
| clearValidators () |
|
| setOptions ($options=array(), $files=null) |
|
| getOptions ($files=null) |
|
| isValid ($files=null) |
|
| getMessages () |
|
| getErrors () |
|
| hasErrors () |
|
| addFilter ($filter, $options=null, $files=null) |
|
| addFilters (array $filters, $files=null) |
|
| setFilters (array $filters, $files=null) |
|
| hasFilter ($name) |
|
| getFilter ($name) |
|
| getFilters ($files=null) |
|
| removeFilter ($name) |
|
| clearFilters () |
|
| getFile () |
|
| getFileName ($file=null, $path=true) |
|
| getFileInfo ($file=null) |
|
| addFile ($file, $validator=null, $filter=null) |
|
| getType () |
|
| addType ($type, $validator=null, $filter=null) |
|
| setDestination ($destination, $files=null) |
|
| getDestination ($files=null) |
|
| setTranslator ($translator=null) |
|
| getTranslator () |
|
| setDisableTranslator ($flag) |
|
| translatorIsDisabled () |
|
| getHash ($hash='crc32', $files=null) |
|
| getFileSize ($files=null) |
|
| getMimeType ($files=null) |
|
Definition at line 30 of file Abstract.php.
◆ _detectFileSize()
_detectFileSize |
( |
|
$value | ) |
|
|
protected |
Internal method to detect the size of a file
- Parameters
-
- Returns
- string Filesize of given file
Definition at line 1239 of file Abstract.php.
1241 if (file_exists(
$value[
'name'])) {
1243 }
else if (file_exists(
$value[
'tmp_name'])) {
◆ _detectMimeType()
_detectMimeType |
( |
|
$value | ) |
|
|
protected |
Internal method to detect the mime type of a file
- Parameters
-
- Returns
- string Mimetype of given file
Definition at line 1288 of file Abstract.php.
1290 if (file_exists(
$value[
'name'])) {
1292 }
else if (file_exists(
$value[
'tmp_name'])) {
1293 $file =
$value[
'tmp_name'];
1299 $const = defined(
'FILEINFO_MIME_TYPE') ? FILEINFO_MIME_TYPE : FILEINFO_MIME;
1300 if (!empty(
$value[
'options'][
'magicFile'])) {
1301 $mime = @finfo_open($const,
$value[
'options'][
'magicFile']);
1305 $mime = @finfo_open($const);
1308 if (!empty($mime)) {
1309 $result = finfo_file($mime, $file);
1316 &&
ini_get(
'mime_magic.magicfile'))) {
1321 $result =
'application/octet-stream';
◆ _filter()
Internal function to filter all given files
- Parameters
-
string | array | $files | (Optional) Files to check |
- Returns
- boolean False on error
Definition at line 1349 of file Abstract.php.
1353 if (array_key_exists(
'filters',
$content)) {
1355 $filter = $this->_filters[
$class];
1359 $this->_files[
$name][
'destination'] = dirname(
$result);
1362 $this->_messages += array($e->getMessage());
1368 if (count($this->_messages) > 0) {
getFileName($file=null, $path=true)
$_option $_optionId $class
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
if(!isset($_GET['name'])) $name
◆ _getFiles()
_getFiles |
( |
|
$files, |
|
|
|
$names = false , |
|
|
|
$noexception = false |
|
) |
| |
|
protected |
Returns found files based on internal file array and given files
- Parameters
-
string | array | $files | (Optional) Files to return |
boolean | $names | (Optional) Returns only names on true, else complete info |
boolean | $noexception | (Optional) Allows throwing an exception, otherwise returns an empty array |
- Returns
- array Found files
- Exceptions
-
Definition at line 1464 of file Abstract.php.
1473 foreach (
$files as $find) {
1475 foreach ($this->_files as $file =>
$content) {
1481 foreach (
$content[
'multifiles'] as $multifile) {
1482 $found[] = $multifile;
1487 if ($file === $find) {
1498 if (empty($found)) {
1499 if ($noexception !==
false) {
1503 #require_once 'Zend/File/Transfer/Exception.php'; 1515 $keys = array_keys($check);
1516 foreach ($keys as $key) {
1517 if (isset($check[$key][
'multifiles'])) {
1518 unset($check[$key]);
1524 $check = array_keys($check);
foreach($appDirs as $dir) $files
◆ _getFilterIdentifier()
_getFilterIdentifier |
( |
|
$name | ) |
|
|
protected |
Retrieve internal identifier for a named filter
- Parameters
-
- Returns
- string
Definition at line 1557 of file Abstract.php.
1559 if (array_key_exists(
$name, $this->_filters)) {
1563 foreach (array_keys($this->_filters) as $test) {
1564 if (preg_match(
'/' . preg_quote(
$name) .
'$/i', $test)) {
if(!isset($_GET['name'])) $name
◆ _getTmpDir()
Determine system TMP directory and detect if we have read access
- Returns
- string
- Exceptions
-
Definition at line 1381 of file Abstract.php.
1383 if (
null === $this->_tmpDir) {
1386 $tmpdir[] = sys_get_temp_dir();
1389 if (!empty($_ENV[
'TMP'])) {
1390 $tmpdir[] = realpath($_ENV[
'TMP']);
1393 if (!empty($_ENV[
'TMPDIR'])) {
1394 $tmpdir[] = realpath($_ENV[
'TMPDIR']);
1397 if (!empty($_ENV[
'TEMP'])) {
1398 $tmpdir[] = realpath($_ENV[
'TEMP']);
1401 $upload =
ini_get(
'upload_tmp_dir');
1403 $tmpdir[] = realpath($upload);
1406 foreach($tmpdir as $directory) {
1408 $this->_tmpDir = $directory;
1412 if (empty($this->_tmpDir)) {
1414 $tempFile = tempnam(md5(uniqid(rand(), TRUE)),
'');
1416 $this->_tmpDir = realpath(dirname($tempFile));
1419 #require_once 'Zend/File/Transfer/Exception.php'; 1424 $this->_tmpDir = rtrim($this->_tmpDir,
"/\\");
◆ _getValidatorIdentifier()
_getValidatorIdentifier |
( |
|
$name | ) |
|
|
protected |
Retrieve internal identifier for a named validator
- Parameters
-
- Returns
- string
Definition at line 1536 of file Abstract.php.
1538 if (array_key_exists(
$name, $this->_validators)) {
1542 foreach (array_keys($this->_validators) as $test) {
1543 if (preg_match(
'/' . preg_quote(
$name) .
'$/i', $test)) {
if(!isset($_GET['name'])) $name
◆ _isPathWriteable()
_isPathWriteable |
( |
|
$path | ) |
|
|
protected |
Tries to detect if we can read and write to the given path
- Parameters
-
- Returns
- bool
Definition at line 1435 of file Abstract.php.
1437 $tempFile = rtrim(
$path,
"/\\");
1438 $tempFile .=
'/' .
'test.1';
◆ _toByteString()
static _toByteString |
( |
|
$size | ) |
|
|
staticprotected |
Returns the formatted size
- Parameters
-
- Returns
- string
Definition at line 1333 of file Abstract.php.
1335 $sizes = array(
'B',
'kB',
'MB',
'GB',
'TB',
'PB',
'EB',
'ZB',
'YB');
1336 for (
$i=0; $size >= 1024 &&
$i < 9;
$i++) {
1340 return round($size, 2) . $sizes[
$i];
◆ addFile()
addFile |
( |
|
$file, |
|
|
|
$validator = null , |
|
|
|
$filter = null |
|
) |
| |
Adds one or more files
- Parameters
-
string | array | $file | File to add |
string | array | $validator | Validators to use for this file, must be set before |
string | array | $filter | Filters to use for this file, must be set before |
- Returns
- Zend_File_Transfer_Adapter_Abstract
- Exceptions
-
Definition at line 988 of file Abstract.php.
990 #require_once 'Zend/File/Transfer/Exception.php';
◆ addFilter()
addFilter |
( |
|
$filter, |
|
|
|
$options = null , |
|
|
|
$files = null |
|
) |
| |
Adds a new filter for this class
- Parameters
-
string | array | $filter | Type of filter to add |
string | array | $options | Options to set for the filter |
string | array | $files | Files to limit this filter to |
- Returns
- Zend_File_Transfer_Adapter
Definition at line 750 of file Abstract.php.
753 $class = get_class($filter);
754 }
elseif (is_string($filter)) {
758 #require_once 'Zend/File/Transfer/Exception.php'; 762 $this->_filters[
$class] = $filter;
764 foreach (
$files as $file) {
765 $this->_files[$file][
'filters'][] =
$class;
elseif(isset( $params[ 'redirect_parent']))
$_option $_optionId $class
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ addFilters()
addFilters |
( |
array |
$filters, |
|
|
|
$files = null |
|
) |
| |
Add Multiple filters at once
- Parameters
-
array | $filters | |
string | array | $files | |
- Returns
- Zend_File_Transfer_Adapter_Abstract
Definition at line 778 of file Abstract.php.
780 foreach (
$filters as $key => $spec) {
786 if (is_string($key)) {
792 if (is_string($spec)) {
797 if (is_array($spec)) {
798 if (!array_key_exists(
'filter', $spec)) {
802 $filter = $spec[
'filter'];
803 unset($spec[
'filter']);
addFilter($filter, $options=null, $files=null)
foreach($appDirs as $dir) $files
◆ addPrefixPath()
addPrefixPath |
( |
|
$prefix, |
|
|
|
$path, |
|
|
|
$type = null |
|
) |
| |
Add prefix path for plugin loader
If no $type specified, assumes it is a base path for both filters and validators, and sets each according to the following rules:
- filters: $prefix = $prefix . '_Filter'
- validators: $prefix = $prefix . '_Validate'
Otherwise, the path prefix is set on the appropriate plugin loader.
- Parameters
-
string | $prefix | |
string | $path | |
string | $type | |
- Returns
- Zend_File_Transfer_Adapter_Abstract
- Exceptions
-
Definition at line 256 of file Abstract.php.
268 foreach (array(self::FILTER, self::VALIDATE) as
$type) {
269 $cType = ucfirst(strtolower(
$type));
270 $pluginPath =
$path . DIRECTORY_SEPARATOR . $cType . DIRECTORY_SEPARATOR;
271 $pluginPrefix =
$prefix .
'_' . $cType;
273 $loader->addPrefixPath($pluginPrefix, $pluginPath);
277 #require_once 'Zend/File/Transfer/Exception.php';
◆ addPrefixPaths()
addPrefixPaths |
( |
array |
$spec | ) |
|
Add many prefix paths at once
- Parameters
-
- Returns
- Zend_File_Transfer_Exception
Definition at line 288 of file Abstract.php.
290 if (isset($spec[
'prefix']) && isset($spec[
'path'])) {
297 if (isset(
$paths[
'type'])) {
303 if (!isset(
$paths[
'prefix']) || !isset(
$paths[
'path'])) {
305 if (is_array($spec)) {
306 foreach ($spec as
$path) {
307 if (!is_string(
$path)) {
312 }
elseif (is_string($spec)) {
addPrefixPath($prefix, $path, $type=null)
elseif(isset( $params[ 'redirect_parent']))
◆ addType()
addType |
( |
|
$type, |
|
|
|
$validator = null , |
|
|
|
$filter = null |
|
) |
| |
Adds one or more type of files
- Parameters
-
string | array | $type | Type of files to add |
string | array | $validator | Validators to use for this file, must be set before |
string | array | $filter | Filters to use for this file, must be set before |
- Returns
- Zend_File_Transfer_Adapter_Abstract
- Exceptions
-
Definition at line 1015 of file Abstract.php.
1017 #require_once 'Zend/File/Transfer/Exception.php';
◆ addValidator()
addValidator |
( |
|
$validator, |
|
|
|
$breakChainOnFailure = false , |
|
|
|
$options = null , |
|
|
|
$files = null |
|
) |
| |
Adds a new validator for this class
- Parameters
-
string | array | $validator | Type of validator to add |
boolean | $breakChainOnFailure | If the validation chain should stop an failure |
string | array | $options | Options to set for the validator |
string | array | $files | Files to limit this validator to |
- Returns
- Zend_File_Transfer_Adapter
Definition at line 333 of file Abstract.php.
336 $name = get_class($validator);
337 }
elseif (is_string($validator)) {
341 if (is_array(
$options[
'messages'])) {
342 $validator->setMessages(
$options[
'messages']);
344 $validator->setMessage(
$options[
'messages']);
350 #require_once 'Zend/File/Transfer/Exception.php'; 354 $this->_validators[
$name] = $validator;
355 $this->_break[
$name] = $breakChainOnFailure;
357 foreach (
$files as $file) {
358 if (
$name ==
'NotEmpty') {
359 $temp = $this->_files[$file][
'validators'];
360 $this->_files[$file][
'validators'] = array(
$name);
361 $this->_files[$file][
'validators'] += $temp;
363 $this->_files[$file][
'validators'][] =
$name;
366 $this->_files[$file][
'validated'] =
false;
elseif(isset( $params[ 'redirect_parent']))
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
if(!isset($_GET['name'])) $name
◆ addValidators()
addValidators |
( |
array |
$validators, |
|
|
|
$files = null |
|
) |
| |
Add Multiple validators at once
- Parameters
-
array | $validators | |
string | array | $files | |
- Returns
- Zend_File_Transfer_Adapter_Abstract
Definition at line 379 of file Abstract.php.
381 foreach ($validators as
$name => $validatorInfo) {
384 }
else if (is_string($validatorInfo)) {
385 if (!is_int(
$name)) {
390 }
else if (is_array($validatorInfo)) {
391 $argc = count($validatorInfo);
392 $breakChainOnFailure =
false;
394 if (isset($validatorInfo[
'validator'])) {
395 $validator = $validatorInfo[
'validator'];
396 if (isset($validatorInfo[
'breakChainOnFailure'])) {
397 $breakChainOnFailure = $validatorInfo[
'breakChainOnFailure'];
400 if (isset($validatorInfo[
'options'])) {
401 $options = $validatorInfo[
'options'];
406 if (is_string(
$name)) {
416 $validator = array_shift($validatorInfo);
418 $breakChainOnFailure = array_shift($validatorInfo);
420 $options = array_shift($validatorInfo);
422 if (!empty($validatorInfo)) {
423 $file = array_shift($validatorInfo);
432 #require_once 'Zend/File/Transfer/Exception.php'; addValidator($validator, $breakChainOnFailure=false, $options=null, $files=null)
foreach($appDirs as $dir) $files
if(!isset($_GET['name'])) $name
◆ clearFilters()
◆ clearValidators()
Remove all validators
- Returns
- Zend_File_Transfer_Adapter_Abstract
Definition at line 542 of file Abstract.php.
544 $this->_validators = array();
545 foreach (array_keys($this->_files) as $file) {
546 $this->_files[$file][
'validators'] = array();
547 $this->_files[$file][
'validated'] =
false;
◆ getDestination()
getDestination |
( |
|
$files = null | ) |
|
Retrieve destination directory value
- Parameters
-
null | string | array | $files | |
- Returns
- null|string|array
- Exceptions
-
Definition at line 1073 of file Abstract.php.
1077 $destinations = array();
1078 if (empty(
$files) and is_string($orig)) {
1079 if (isset($this->_files[$orig][
'destination'])) {
1080 $destinations[$orig] = $this->_files[$orig][
'destination'];
1082 #require_once 'Zend/File/Transfer/Exception.php'; 1088 if (isset($this->_files[$key][
'destination'])) {
1089 $destinations[$key] = $this->_files[$key][
'destination'];
1093 $destinations[$key] = $tmpdir;
1097 if (empty($destinations)) {
1099 }
else if (count($destinations) == 1) {
1100 $destinations = current($destinations);
1103 return $destinations;
setDestination($destination, $files=null)
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ getErrors()
Retrieve error codes
- Returns
- array
Definition at line 727 of file Abstract.php.
729 return array_keys($this->_messages);
◆ getFile()
Returns all set files
- Returns
- array List of set files
- Exceptions
-
Definition at line 931 of file Abstract.php.
933 #require_once 'Zend/File/Transfer/Exception.php';
◆ getFileInfo()
getFileInfo |
( |
|
$file = null | ) |
|
Retrieve additional internal file informations for files
- Parameters
-
string | $file | (Optional) File to get informations for |
- Returns
- array
Definition at line 974 of file Abstract.php.
_getFiles($files, $names=false, $noexception=false)
◆ getFileName()
getFileName |
( |
|
$file = null , |
|
|
|
$path = true |
|
) |
| |
Retrieves the filename of transferred files.
- Parameters
-
string | null | $file | |
boolean | $path | (Optional) Should the path also be returned ? |
- Returns
- string|array
Definition at line 944 of file Abstract.php.
949 foreach(
$files as $file) {
950 if (empty($this->_files[$file][
'name'])) {
954 if (
$path ===
true) {
958 $result[$file] = $directory . $this->_files[$file][
'name'];
getDestination($files=null)
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ getFileSize()
getFileSize |
( |
|
$files = null | ) |
|
Returns the real filesize of the file
- Parameters
-
string | array | $files | Files to get the filesize from |
- Exceptions
-
- Returns
- string|array Filesize
Definition at line 1207 of file Abstract.php.
1212 if (file_exists(
$value[
'name']) || file_exists(
$value[
'tmp_name'])) {
1213 if (
$value[
'options'][
'useByteString']) {
1218 }
else if (empty(
$value[
'options'][
'ignoreNoFile'])) {
1219 #require_once 'Zend/File/Transfer/Exception.php';
static _toByteString($size)
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ getFilter()
Retrieve individual filter
- Parameters
-
- Returns
- Zend_Filter_Interface|null
Definition at line 845 of file Abstract.php.
850 return $this->_filters[$identifier];
_getFilterIdentifier($name)
if(!isset($_GET['name'])) $name
◆ getFilters()
getFilters |
( |
|
$files = null | ) |
|
Returns all set filters
- Parameters
-
string | array | $files | (Optional) Returns the filter for this files |
- Returns
- array List of set filters
- Exceptions
-
Definition at line 860 of file Abstract.php.
868 foreach (
$files as $file) {
869 if (!empty($this->_files[$file][
'filters'])) {
870 $filters += $this->_files[$file][
'filters'];
877 $result[] = $this->_filters[$filter];
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ getHash()
getHash |
( |
|
$hash = 'crc32' , |
|
|
|
$files = null |
|
) |
| |
Returns the hash for a given file
- Parameters
-
string | $hash | Hash algorithm to use |
string | array | $files | Files to return the hash for |
- Returns
- string|array Hashstring
- Exceptions
-
Definition at line 1173 of file Abstract.php.
1175 if (!in_array($hash, hash_algos())) {
1176 #require_once 'Zend/File/Transfer/Exception.php'; 1183 if (file_exists(
$value[
'name'])) {
1185 }
else if (file_exists(
$value[
'tmp_name'])) {
1187 }
else if (empty(
$value[
'options'][
'ignoreNoFile'])) {
1188 #require_once 'Zend/File/Transfer/Exception.php';
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ getMessages()
Returns found validation messages
- Returns
- array
Definition at line 717 of file Abstract.php.
◆ getMimeType()
getMimeType |
( |
|
$files = null | ) |
|
Returns the real mimetype of the file Uses fileinfo, when not available mime_magic and as last fallback a manual given mimetype
- Parameters
-
string | array | $files | Files to get the mimetype from |
- Exceptions
-
- Returns
- string|array MimeType
Definition at line 1260 of file Abstract.php.
1265 if (file_exists(
$value[
'name']) || file_exists(
$value[
'tmp_name'])) {
1267 }
else if (empty(
$value[
'options'][
'ignoreNoFile'])) {
1268 #require_once 'Zend/File/Transfer/Exception.php';
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ getOptions()
getOptions |
( |
|
$files = null | ) |
|
Returns set options for adapters or files
- Parameters
-
array | $files | (Optional) Files to return the options for |
- Returns
- array Options for given files
Definition at line 598 of file Abstract.php.
601 foreach ($file as $key =>
$content) {
602 if (isset($this->_files[$key][
'options'])) {
603 $options[$key] = $this->_files[$key][
'options'];
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ getPluginLoader()
Retrieve plugin loader for validator or filter chain
Instantiates with default rules if none available for that type. Use 'filter' or 'validate' for $type.
- Parameters
-
- Returns
- Zend_Loader_PluginLoader
- Exceptions
-
Definition at line 210 of file Abstract.php.
216 $prefixSegment = ucfirst(strtolower(
$type));
217 $pathSegment = $prefixSegment;
218 if (!isset($this->_loaders[
$type])) {
220 'Zend_' . $prefixSegment .
'_' =>
'Zend/' . $pathSegment .
'/',
221 'Zend_' . $prefixSegment .
'_File' =>
'Zend/' . $pathSegment .
'/File',
224 #require_once 'Zend/Loader/PluginLoader.php'; 225 $this->_loaders[
$type] =
new Zend_Loader_PluginLoader(
$paths);
228 $prefix =
'Zend_' . $prefixSegment .
'_File_';
233 return $this->_loaders[
$type];
235 #require_once 'Zend/File/Transfer/Exception.php';
◆ getProgress()
Retrieve progress of transfer
- Returns
- float
Definition at line 172 of file Abstract.php.
174 #require_once 'Zend/File/Transfer/Exception.php';
◆ getTranslator()
Retrieve localization translator object
- Returns
- Zend_Translate_Adapter|null
Definition at line 1134 of file Abstract.php.
◆ getType()
Returns all set types
- Returns
- array List of set types
- Exceptions
-
Definition at line 1000 of file Abstract.php.
1002 #require_once 'Zend/File/Transfer/Exception.php';
◆ getValidator()
Retrieve individual validator
- Parameters
-
- Returns
- Zend_Validate_Interface|null
Definition at line 470 of file Abstract.php.
475 return $this->_validators[$identifier];
_getValidatorIdentifier($name)
if(!isset($_GET['name'])) $name
◆ getValidators()
getValidators |
( |
|
$files = null | ) |
|
Returns all set validators
- Parameters
-
string | array | $files | (Optional) Returns the validator for this files |
- Returns
- null|array List of set validators
Definition at line 484 of file Abstract.php.
491 $validators = array();
492 foreach (
$files as $file) {
493 if (!empty($this->_files[$file][
'validators'])) {
494 $validators += $this->_files[$file][
'validators'];
498 $validators = array_unique($validators);
500 foreach ($validators as $validator) {
501 $result[$validator] = $this->_validators[$validator];
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ hasErrors()
Are there errors registered?
- Returns
- boolean
Definition at line 737 of file Abstract.php.
739 return (!empty($this->_messages));
◆ hasFilter()
Determine if a given filter has already been registered
- Parameters
-
- Returns
- bool
Definition at line 834 of file Abstract.php.
_getFilterIdentifier($name)
if(!isset($_GET['name'])) $name
◆ hasValidator()
Determine if a given validator has already been registered
- Parameters
-
- Returns
- bool
Definition at line 459 of file Abstract.php.
_getValidatorIdentifier($name)
if(!isset($_GET['name'])) $name
◆ isFiltered()
isFiltered |
( |
|
$files = null | ) |
|
|
abstract |
Has the file been filtered ?
- Parameters
-
array | string | null | $files | |
- Returns
- bool
◆ isReceived()
isReceived |
( |
|
$files = null | ) |
|
|
abstract |
Is file received?
- Parameters
-
array | string | null | $files | |
- Returns
- bool
◆ isSent()
Is file sent?
- Parameters
-
array | string | null | $files | |
- Returns
- bool
◆ isUploaded()
isUploaded |
( |
|
$files = null | ) |
|
|
abstract |
Has a file been uploaded ?
- Parameters
-
array | string | null | $files | |
- Returns
- bool
◆ isValid()
Checks if the files are valid
- Parameters
-
string | array | $files | (Optional) Files to check |
- Returns
- boolean True if all checks are valid
Definition at line 618 of file Abstract.php.
626 $this->_messages = array();
628 foreach($check as $key =>
$content) {
629 if (array_key_exists(
'validators',
$content) &&
630 in_array(
'Zend_Validate_File_Count',
$content[
'validators'])) {
631 $validator = $this->_validators[
'Zend_Validate_File_Count'];
637 if (array_key_exists(
'destination',
$content)) {
640 $checkit = dirname(
$content[
'tmp_name']);
643 $checkit .= DIRECTORY_SEPARATOR .
$content[
'name'];
644 $validator->addFile($checkit);
650 $this->_messages += $validator->getMessages();
654 foreach ($check as $key =>
$content) {
655 $fileerrors = array();
660 if (array_key_exists(
'validators',
$content)) {
662 $validator = $this->_validators[
$class];
663 if (method_exists($validator,
'setTranslator')) {
664 $validator->setTranslator($translator);
667 if ((
$class ===
'Zend_Validate_File_Upload') and (empty(
$content[
'tmp_name']))) {
673 if (!$validator->isValid($tocheck,
$content)) {
674 $fileerrors += $validator->getMessages();
677 if (!empty(
$content[
'options'][
'ignoreNoFile']) and (isset($fileerrors[
'fileUploadErrorNoFile']))) {
678 unset($fileerrors[
'fileUploadErrorNoFile']);
682 if ((
$class ===
'Zend_Validate_File_Upload') and (count($fileerrors) > 0)) {
686 if (($this->_break[
$class]) and (count($fileerrors) > 0)) {
693 if (count($fileerrors) > 0) {
694 $this->_files[$key][
'validated'] =
false;
696 $this->_files[$key][
'validated'] =
true;
699 $this->_messages += $fileerrors;
705 if (count($this->_messages) > 0) {
$_option $_optionId $class
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ receive()
receive |
( |
|
$options = null | ) |
|
|
abstract |
Receive file
- Parameters
-
- Returns
- bool
◆ removeFilter()
Remove an individual filter
- Parameters
-
- Returns
- Zend_File_Transfer_Adapter_Abstract
Definition at line 889 of file Abstract.php.
895 unset($this->_filters[$key]);
896 foreach (array_keys($this->_files) as $file) {
897 if (empty($this->_files[$file][
'filters'])) {
901 $index = array_search($key, $this->_files[$file][
'filters']);
906 unset($this->_files[$file][
'filters'][
$index]);
_getFilterIdentifier($name)
if(!isset($_GET['name'])) $name
◆ removeValidator()
Remove an individual validator
- Parameters
-
- Returns
- Zend_File_Transfer_Adapter_Abstract
Definition at line 513 of file Abstract.php.
519 unset($this->_validators[$key]);
520 foreach (array_keys($this->_files) as $file) {
521 if (empty($this->_files[$file][
'validators'])) {
525 $index = array_search($key, $this->_files[$file][
'validators']);
530 unset($this->_files[$file][
'validators'][
$index]);
531 $this->_files[$file][
'validated'] =
false;
_getValidatorIdentifier($name)
if(!isset($_GET['name'])) $name
◆ send()
Send file
- Parameters
-
- Returns
- bool
◆ setDestination()
setDestination |
( |
|
$destination, |
|
|
|
$files = null |
|
) |
| |
Sets a new destination for the given files
- Deprecated:
- Will be changed to be a filter!!!
- Parameters
-
string | $destination | New destination directory |
string | array | $files | Files to set the new destination for |
- Returns
- Zend_File_Transfer_Abstract
- Exceptions
-
Definition at line 1030 of file Abstract.php.
1033 $destination = rtrim($destination,
"/\\");
1034 if (!
is_dir($destination)) {
1035 #require_once 'Zend/File/Transfer/Exception.php'; 1037 'The given destination is not a directory or does not exist' 1042 #require_once 'Zend/File/Transfer/Exception.php'; 1044 'The given destination is not writable' 1049 foreach ($this->_files as $file =>
$content) {
1050 $this->_files[$file][
'destination'] = $destination;
1054 if (empty(
$files) and is_string($orig)) {
1055 $this->_files[$orig][
'destination'] = $destination;
1058 foreach (
$files as $file) {
1059 $this->_files[$file][
'destination'] = $destination;
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
◆ setDisableTranslator()
setDisableTranslator |
( |
|
$flag | ) |
|
Indicate whether or not translation should be disabled
- Parameters
-
- Returns
- Zend_File_Transfer_Abstract
Definition at line 1149 of file Abstract.php.
1151 $this->_translatorDisabled = (bool) $flag;
◆ setFilters()
setFilters |
( |
array |
$filters, |
|
|
|
$files = null |
|
) |
| |
Sets a filter for the class, erasing all previous set
- Parameters
-
string | array | $filter | Filter to set |
string | array | $files | Files to limit this filter to |
- Returns
- Zend_File_Transfer_Adapter
Definition at line 822 of file Abstract.php.
addFilters(array $filters, $files=null)
foreach($appDirs as $dir) $files
◆ setOptions()
setOptions |
( |
|
$options = array() , |
|
|
|
$files = null |
|
) |
| |
Sets Options for adapters
- Parameters
-
array | $options | Options to set |
array | $files | (Optional) Files to set the options for |
- Returns
- Zend_File_Transfer_Adapter_Abstract
Definition at line 560 of file Abstract.php.
565 $this->_options = array_merge($this->_options,
$options);
569 foreach ($file as $key =>
$content) {
572 $this->_files[$key][
'options'][
$name] = (string)
$value;
575 case 'ignoreNoFile' :
576 case 'useByteString' :
578 $this->_files[$key][
'options'][
$name] = (boolean)
$value;
582 #require_once 'Zend/File/Transfer/Exception.php';
_getFiles($files, $names=false, $noexception=false)
foreach($appDirs as $dir) $files
if(!isset($_GET['name'])) $name
◆ setPluginLoader()
◆ setTranslator()
setTranslator |
( |
|
$translator = null | ) |
|
Set translator object for localization
- Parameters
-
- Returns
- Zend_File_Transfer_Abstract
- Exceptions
-
Definition at line 1113 of file Abstract.php.
1115 if (
null === $translator) {
1116 $this->_translator =
null;
1118 $this->_translator = $translator;
1120 $this->_translator = $translator->getAdapter();
1122 #require_once 'Zend/File/Transfer/Exception.php'; elseif(isset( $params[ 'redirect_parent']))
◆ setValidators()
setValidators |
( |
array |
$validators, |
|
|
|
$files = null |
|
) |
| |
Sets a validator for the class, erasing all previous set
- Parameters
-
string | array | $validator | Validator to set |
string | array | $files | Files to limit this validator to |
- Returns
- Zend_File_Transfer_Adapter
Definition at line 447 of file Abstract.php.
addValidators(array $validators, $files=null)
foreach($appDirs as $dir) $files
◆ translatorIsDisabled()
Is translation disabled?
- Returns
- bool
Definition at line 1160 of file Abstract.php.
◆ $_break
◆ $_files
◆ $_filters
◆ $_loaders
◆ $_messages
◆ $_options
Initial value:= array(
'ignoreNoFile' => false,
'useByteString' => true,
'magicFile' => null,
'detectInfos' => true,
)
Available options for file transfers
Definition at line 112 of file Abstract.php.
◆ $_tmpDir
◆ $_translator
◆ $_translatorDisabled
$_translatorDisabled = false |
|
protected |
◆ $_validators
◆ FILTER
◆ VALIDATE
const VALIDATE = 'VALIDATE' |
The documentation for this class was generated from the following file:
- vendor/magento/zendframework1/library/Zend/File/Transfer/Adapter/Abstract.php