FileExtensionFilter

Utility methods for filtering filenames

Table of Contents

Properties

$allowedFileExtensions  : array<string|int, mixed>
Allowed file extensions. If NULL, all extensions are allowed.
$disallowedFileExtensions  : array<string|int, mixed>
Disallowed file extensions. If NULL, no extension is disallowed (i.e. all are allowed).

Methods

filterFileList()  : bool|int
Entry method for use as filelist filter.
filterInlineChildren()  : array<string|int, mixed>
Entry method for use as DataHandler "inline" field filter
isAllowed()  : bool
Checks whether a file is allowed according to the criteria defined in the class variables ($this->allowedFileExtensions etc.)
setAllowedFileExtensions()  : mixed
Set allowed file extensions
setDisallowedFileExtensions()  : mixed
Set disallowed file extensions
convertToLowercaseArray()  : array<string|int, mixed>
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, mixed> $allowedFileExtensions

$disallowedFileExtensions

Disallowed file extensions. If NULL, no extension is disallowed (i.e. all are allowed).

protected array<string|int, mixed> $disallowedFileExtensions

Methods

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

filterInlineChildren()

Entry method for use as DataHandler "inline" field filter

public filterInlineChildren(array<string|int, mixed> $parameters, DataHandler $dataHandler) : array<string|int, mixed>
Parameters
$parameters : array<string|int, mixed>
$dataHandler : DataHandler
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 $fileExt) : bool
Parameters
$fileExt : string
Internal

this is used internally for TYPO3 core only

Return values
bool

setAllowedFileExtensions()

Set allowed file extensions

public setAllowedFileExtensions(mixed $allowedFileExtensions) : mixed
Parameters
$allowedFileExtensions : mixed

Comma-separated list or array, of allowed file extensions

setDisallowedFileExtensions()

Set disallowed file extensions

public setDisallowedFileExtensions(mixed $disallowedFileExtensions) : mixed
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>

All array values will be converted to lower case.

Parameters
$inputArgument : mixed

Comma-separated list or array.

Return values
array<string|int, mixed>

        
On this page

Search results