TYPO3  7.6
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
FileExtensionFilter Class Reference

Public Member Functions

 filterInlineChildren (array $parameters,\TYPO3\CMS\Core\DataHandling\DataHandler $tceMain)
 
 filterFileList ($itemName, $itemIdentifier, $parentIdentifier, array $additionalInformation,\TYPO3\CMS\Core\Resource\Driver\DriverInterface $driver)
 
 setAllowedFileExtensions ($allowedFileExtensions)
 
 setDisallowedFileExtensions ($disallowedFileExtensions)
 

Protected Member Functions

 isAllowed ($fileName)
 
 convertToLowercaseArray ($inputArgument)
 

Protected Attributes

 $allowedFileExtensions = null
 
 $disallowedFileExtensions = null
 

Detailed Description

Utility methods for filtering filenames

Definition at line 20 of file FileExtensionFilter.php.

Member Function Documentation

convertToLowercaseArray (   $inputArgument)
protected

Converts mixed (string or array) input arguments into an array, NULL if empty.

All array values will be converted to lower case.

Parameters
mixed$inputArgumentComma-separated list or array.
Returns
array

Definition at line 151 of file FileExtensionFilter.php.

References elseif.

Referenced by FileExtensionFilter\setAllowedFileExtensions(), and FileExtensionFilter\setDisallowedFileExtensions().

filterFileList (   $itemName,
  $itemIdentifier,
  $parentIdentifier,
array  $additionalInformation,
\TYPO3\CMS\Core\Resource\Driver\DriverInterface  $driver 
)

Entry method for use as filelist filter.

We have to use -1 as the „don't include“ return value, as call_user_func() will return FALSE if calling the method failed and thus we can't use that as a return value.

Parameters
string$itemName
string$itemIdentifier
string$parentIdentifier
array$additionalInformationAdditional information about the inspected item
\TYPO3\CMS\Core\Resource\Driver\DriverInterface$driver
Returns
bool|int -1 if the file should not be included in a listing

Definition at line 86 of file FileExtensionFilter.php.

References FileExtensionFilter\isAllowed().

filterInlineChildren ( array  $parameters,
\TYPO3\CMS\Core\DataHandling\DataHandler  $tceMain 
)

Entry method for use as TCEMain "inline" field filter

Parameters
array$parameters
\TYPO3\CMS\Core\DataHandling\DataHandler$tceMain
Returns
array

Definition at line 43 of file FileExtensionFilter.php.

References FileExtensionFilter\isAllowed(), FileExtensionFilter\setAllowedFileExtensions(), and FileExtensionFilter\setDisallowedFileExtensions().

isAllowed (   $fileName)
protected

Checks whether a file is allowed according to the criteria defined in the class variables ($this->allowedFileExtensions etc.)

Parameters
\TYPO3\CMS\Core\Resource\FileInterface$file
Returns
bool

Definition at line 108 of file FileExtensionFilter.php.

Referenced by FileExtensionFilter\filterFileList(), and FileExtensionFilter\filterInlineChildren().

setAllowedFileExtensions (   $allowedFileExtensions)

Set allowed file extensions

Parameters
mixed$allowedFileExtensionsComma-separated list or array, of allowed file extensions

Definition at line 128 of file FileExtensionFilter.php.

References FileExtensionFilter\$allowedFileExtensions, and FileExtensionFilter\convertToLowercaseArray().

Referenced by FileExtensionFilter\filterInlineChildren().

setDisallowedFileExtensions (   $disallowedFileExtensions)

Set disallowed file extensions

Parameters
mixed$disallowedFileExtensionsComma-separated list or array, of allowed file extensions

Definition at line 138 of file FileExtensionFilter.php.

References FileExtensionFilter\$disallowedFileExtensions, and FileExtensionFilter\convertToLowercaseArray().

Referenced by FileExtensionFilter\filterInlineChildren().

Member Data Documentation

$allowedFileExtensions = null
protected
$disallowedFileExtensions = null
protected