FileExtensionFilter
Utility methods for filtering filenames
Table of Contents
Properties
- $allowedFileExtensions : array<string|int, string>|null
- Allowed file extensions. If NULL, all extensions are allowed.
- $disallowedFileExtensions : array<string|int, string>|null
- Disallowed file extensions. If NULL, no extension is disallowed (i.e. all are allowed).
Methods
- filter() : array<string|int, mixed>
- filterFileList() : bool|int
- Entry method for use as filelist filter.
- getAllowedFileExtensions() : array<string|int, mixed>|null
- getDisallowedFileExtensions() : array<string|int, mixed>|null
- getFilteredFileExtensions() : array<string|int, mixed>
- Compared the current allowed and disallowed lists and returns a filtered list either as allow or as disallow list. The "mode" is indicated by the array key, which is either "allowedFileExtensions" or "disallowedFileExtensions".
- isAllowed() : bool
- Checks whether a file is allowed according to the criteria defined in the class variables ($this->allowedFileExtensions etc.)
- setAllowedFileExtensions() : void
- Set allowed file extensions
- setDisallowedFileExtensions() : void
- Set disallowed file extensions
- convertToLowercaseArray() : array<string|int, mixed>|null
- Converts mixed (string or array) input arguments into an array, NULL if empty.
Properties
$allowedFileExtensions
Allowed file extensions. If NULL, all extensions are allowed.
        protected
            array<string|int, string>|null
    $allowedFileExtensions
     = null
    
    
    
    
    
$disallowedFileExtensions
Disallowed file extensions. If NULL, no extension is disallowed (i.e. all are allowed).
        protected
            array<string|int, string>|null
    $disallowedFileExtensions
     = null
    
    
    
    
    
Methods
filter()
    public
                    filter(array<string|int, mixed> $references, string $allowedFileExtensions, string $disallowedFileExtensions) : array<string|int, mixed>
    Parameters
- $references : array<string|int, mixed>
- $allowedFileExtensions : string
- $disallowedFileExtensions : string
Return values
array<string|int, mixed>filterFileList()
Entry method for use as filelist filter.
    public
                    filterFileList(string $itemName, string $itemIdentifier, string $parentIdentifier, array<string|int, mixed> $additionalInformation, DriverInterface $driver) : bool|int
    We use -1 as the "don't include“ return value, for historic reasons, as call_user_func() used to return FALSE if calling the method failed.
Parameters
- $itemName : string
- $itemIdentifier : string
- $parentIdentifier : string
- $additionalInformation : array<string|int, mixed>
- 
                    Additional information about the inspected item 
- $driver : DriverInterface
Return values
bool|int —-1 if the file should not be included in a listing
getAllowedFileExtensions()
    public
                    getAllowedFileExtensions() : array<string|int, mixed>|null
    Return values
array<string|int, mixed>|nullgetDisallowedFileExtensions()
    public
                    getDisallowedFileExtensions() : array<string|int, mixed>|null
    Return values
array<string|int, mixed>|nullgetFilteredFileExtensions()
Compared the current allowed and disallowed lists and returns a filtered list either as allow or as disallow list. The "mode" is indicated by the array key, which is either "allowedFileExtensions" or "disallowedFileExtensions".
    public
                    getFilteredFileExtensions() : array<string|int, mixed>
    Return values
array<string|int, mixed>isAllowed()
Checks whether a file is allowed according to the criteria defined in the class variables ($this->allowedFileExtensions etc.)
    public
                    isAllowed(string $fileExtension) : bool
    Parameters
- $fileExtension : string
this is used internally for TYPO3 core only
Return values
boolsetAllowedFileExtensions()
Set allowed file extensions
    public
                    setAllowedFileExtensions(mixed $allowedFileExtensions) : void
    Parameters
- $allowedFileExtensions : mixed
- 
                    Comma-separated list or array, of allowed file extensions 
setDisallowedFileExtensions()
Set disallowed file extensions
    public
                    setDisallowedFileExtensions(mixed $disallowedFileExtensions) : void
    Parameters
- $disallowedFileExtensions : mixed
- 
                    Comma-separated list or array, of allowed file extensions 
convertToLowercaseArray()
Converts mixed (string or array) input arguments into an array, NULL if empty.
    protected
                    convertToLowercaseArray(mixed $inputArgument) : array<string|int, mixed>|null
    All array values will be converted to lower case.
Parameters
- $inputArgument : mixed