PHP 클래스 MetaModels\Helper\ToolboxFile

파일 보기 프로젝트 열기: metamodels/core 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$acceptedExtensions array Allowed file extensions.
$baseLanguage string Base language, used for retrieving meta.txt information.
$blnShowImages boolean Determines if we want to generate images or not.
$fallbackLanguage string The fallback language, used for retrieving meta.txt information.
$foundFiles array The files to process in this instance.
$metaInformation array Meta information for files.
$modifiedTime array Buffered modification timestamps.
$outputBuffer array Buffered file information.
$pendingIds array The pending uuids to collect from DB.
$pendingPaths string[] The pending paths to collect from DB.
$resizeImages array Image resize information.
$strLightboxId string The id to use in lightboxes.
$uuidMap string[] File id mapping for files.

공개 메소드들

메소드 설명
__construct ( ) Create a new instance.
addPath ( string $strPath ) : ToolboxFile Add path to file or folder list.
addPathById ( string $strId ) : ToolboxFile Contao 3 DBAFS Support.
convertUuidsOrPathsToMetaModels ( array $values ) : array Convert an uuid or path to a value to be handled by MetaModels.
convertValueToPath ( string $varValue ) : string Translate the file ID to file path.
convertValuesToDatabase ( array $values ) : array Convert an array of values handled by MetaModels to a value to be stored in the database (array of bin uuid).
convertValuesToMetaModels ( array $values ) : array Convert an array of values stored in the database (array of bin uuid) to a value to be handled by MetaModels.
getAcceptedExtensions ( ) : array Retrieve the allowed file extensions.
getBaseLanguage ( ) : string Retrieve the base language.
getFallbackLanguage ( ) : string Retrieve the fallback language.
getFiles ( ) : array Returns the file list.
getLightboxId ( ) : string Retrieve the lightbox id to use.
getResizeImages ( ) : array Retrieve the resize information.
getShowImages ( ) : boolean Retrieve the flag if images shall be rendered as images.
resolveFiles ( ) : ToolboxFile Process all folders and resolve to a valid file list.
setAcceptedExtensions ( string | array $acceptedExtensions ) : void Set the allowed file extensions.
setBaseLanguage ( string $baseLanguage ) : ToolboxFile Set the base language.
setFallbackLanguage ( string $fallbackLanguage ) : ToolboxFile Set the fallback language.
setLightboxId ( string $strLightboxId ) : ToolboxFile Sets the Id to use for the lightbox.
setResizeImages ( array $resizeImages ) : ToolboxFile Set the resize information.
setShowImages ( boolean $blnShowImages ) : ToolboxFile Set to show/prepare images or not.
sortFiles ( string $sortType, array $sortIds = [] ) : array Sorts the internal file list by a given condition.

보호된 메소드들

메소드 설명
addClasses ( array &$arrSource ) : void Attach first, last and even/odd classes to the given array.
collectFiles ( ) : void Walks the list of pending folders via ToolboxFile::addPath().
fetchAdditionalData ( ) : void Walk all files and fetch desired additional information like image sizes etc.
getDownloadLink ( string $strFile ) : string Generate an URL for downloading the given file.
remapSorting ( array $arrFiles, array $arrSource ) : array Maps the sorting from the files to the source.
sortByDate ( boolean $blnAscending = true ) : array Sort by modification time.
sortByIdList ( array $sortIds ) : array Sort by passed id list.
sortByName ( boolean $blnAscending = true ) : array Sort by filename.
sortByRandom ( ) : array Shuffle the file list.

비공개 메소드들

메소드 설명
addFileModels ( FilesModel[] $files, array $skipPaths = [] ) : void Add the passed file model collection to the current buffer if the extension is allowed.
stringToUuid ( string $uuid ) : string Map a string to it's binary uuid representation.
uuidToString ( string $uuid ) : string Map a binary uuid to it's string representation.

메소드 상세

__construct() 공개 메소드

Create a new instance.
public __construct ( )

addClasses() 보호된 메소드

Attach first, last and even/odd classes to the given array.
protected addClasses ( array &$arrSource ) : void
$arrSource array The array reference of the array to which the classes shall be added to.
리턴 void

addPath() 공개 메소드

Add path to file or folder list.
public addPath ( string $strPath ) : ToolboxFile
$strPath string The path to be added.
리턴 ToolboxFile

addPathById() 공개 메소드

Contao 3 DBAFS Support.
public addPathById ( string $strId ) : ToolboxFile
$strId string String uuid of the file.
리턴 ToolboxFile

collectFiles() 보호된 메소드

Walks the list of pending folders via ToolboxFile::addPath().
protected collectFiles ( ) : void
리턴 void

convertUuidsOrPathsToMetaModels() 공개 정적인 메소드

The output array will have the following layout: array( 'bin' => array() // the binary id. 'value' => array() // the uuid. 'path' => array() // the path. )
public static convertUuidsOrPathsToMetaModels ( array $values ) : array
$values array The binary uuids or paths to convert.
리턴 array

convertValueToPath() 공개 정적인 메소드

Translate the file ID to file path.
public static convertValueToPath ( string $varValue ) : string
$varValue string The file id.
리턴 string

convertValuesToDatabase() 공개 정적인 메소드

The input array must have the following layout: array( 'bin' => array() // list of the binary ids. 'value' => array() // list of the uuids. 'path' => array() // list of the paths. )
public static convertValuesToDatabase ( array $values ) : array
$values array The values to convert.
리턴 array

convertValuesToMetaModels() 공개 정적인 메소드

The output array will have the following layout: array( 'bin' => array() // list of the binary ids. 'value' => array() // list of the uuids. 'path' => array() // list of the paths. )
public static convertValuesToMetaModels ( array $values ) : array
$values array The binary uuid values to convert.
리턴 array

fetchAdditionalData() 보호된 메소드

Walk all files and fetch desired additional information like image sizes etc.
protected fetchAdditionalData ( ) : void
리턴 void

getAcceptedExtensions() 공개 메소드

Retrieve the allowed file extensions.
public getAcceptedExtensions ( ) : array
리턴 array

getBaseLanguage() 공개 메소드

Retrieve the base language.
public getBaseLanguage ( ) : string
리턴 string

getFallbackLanguage() 공개 메소드

Retrieve the fallback language.
public getFallbackLanguage ( ) : string
리턴 string

getFiles() 공개 메소드

NOTE: you must call resolveFiles() beforehand as otherwise folders are not being evaluated.
public getFiles ( ) : array
리턴 array

getLightboxId() 공개 메소드

Retrieve the lightbox id to use.
public getLightboxId ( ) : string
리턴 string

getResizeImages() 공개 메소드

Retrieve the resize information.
public getResizeImages ( ) : array
리턴 array

getShowImages() 공개 메소드

Retrieve the flag if images shall be rendered as images.
public getShowImages ( ) : boolean
리턴 boolean

remapSorting() 보호된 메소드

All files from $arrFiles are being walked and the corresponding entry from source gets pulled in. Additionally, the css classes are applied to the returned 'source' array. This returns an array like: array('files' => array(), 'source' => array())
protected remapSorting ( array $arrFiles, array $arrSource ) : array
$arrFiles array The files to sort.
$arrSource array The source list.
리턴 array The mapped result.

resolveFiles() 공개 메소드

Process all folders and resolve to a valid file list.
public resolveFiles ( ) : ToolboxFile
리턴 ToolboxFile

setAcceptedExtensions() 공개 메소드

Set the allowed file extensions.
public setAcceptedExtensions ( string | array $acceptedExtensions ) : void
$acceptedExtensions string | array The list of accepted file extensions.
리턴 void

setBaseLanguage() 공개 메소드

Set the base language.
public setBaseLanguage ( string $baseLanguage ) : ToolboxFile
$baseLanguage string The base language to use.
리턴 ToolboxFile

setFallbackLanguage() 공개 메소드

Set the fallback language.
public setFallbackLanguage ( string $fallbackLanguage ) : ToolboxFile
$fallbackLanguage string The fallback language to use.
리턴 ToolboxFile

setLightboxId() 공개 메소드

Sets the Id to use for the lightbox.
public setLightboxId ( string $strLightboxId ) : ToolboxFile
$strLightboxId string The lightbox id to use.
리턴 ToolboxFile

setResizeImages() 공개 메소드

Set the resize information.
public setResizeImages ( array $resizeImages ) : ToolboxFile
$resizeImages array The resize information. Array of 3 elements: 0: Width, 1: Height, 2: Mode.
리턴 ToolboxFile

setShowImages() 공개 메소드

Set to show/prepare images or not.
public setShowImages ( boolean $blnShowImages ) : ToolboxFile
$blnShowImages boolean True to show images, false otherwise.
리턴 ToolboxFile

sortByDate() 보호된 메소드

Sort by modification time.
protected sortByDate ( boolean $blnAscending = true ) : array
$blnAscending boolean Flag to determine if sorting shall be applied ascending (default) or descending.
리턴 array

sortByIdList() 보호된 메소드

Sort by passed id list.
protected sortByIdList ( array $sortIds ) : array
$sortIds array The list of binary ids to sort by.
리턴 array

sortByName() 보호된 메소드

Sort by filename.
protected sortByName ( boolean $blnAscending = true ) : array
$blnAscending boolean Flag to determine if sorting shall be applied ascending (default) or descending.
리턴 array

sortByRandom() 보호된 메소드

Shuffle the file list.
protected sortByRandom ( ) : array
리턴 array

sortFiles() 공개 메소드

Allowed sort types are: name_asc - Sort by filename ascending. name_desc - Sort by filename descending date_asc - Sort by modification time ascending. date_desc - Sort by modification time descending. manual - Sort by passed id array, the array must contain the binary ids of the files. random - Shuffle all the files around.
public sortFiles ( string $sortType, array $sortIds = [] ) : array
$sortType string The sort condition to be applied.
$sortIds array The list of binary ids to sort by (sort type "manual" only).
리턴 array The sorted file list.

프로퍼티 상세

$acceptedExtensions 보호되어 있는 프로퍼티

Allowed file extensions.
protected array $acceptedExtensions
리턴 array

$baseLanguage 보호되어 있는 프로퍼티

Base language, used for retrieving meta.txt information.
protected string $baseLanguage
리턴 string

$blnShowImages 보호되어 있는 프로퍼티

Determines if we want to generate images or not.
protected bool $blnShowImages
리턴 boolean

$fallbackLanguage 보호되어 있는 프로퍼티

The fallback language, used for retrieving meta.txt information.
protected string $fallbackLanguage
리턴 string

$foundFiles 보호되어 있는 프로퍼티

The files to process in this instance.
protected array $foundFiles
리턴 array

$metaInformation 보호되어 있는 프로퍼티

Meta information for files.
protected array $metaInformation
리턴 array

$modifiedTime 보호되어 있는 프로퍼티

Buffered modification timestamps.
protected array $modifiedTime
리턴 array

$outputBuffer 보호되어 있는 프로퍼티

Buffered file information.
protected array $outputBuffer
리턴 array

$pendingIds 보호되어 있는 프로퍼티

The pending uuids to collect from DB.
protected array $pendingIds
리턴 array

$pendingPaths 보호되어 있는 프로퍼티

The pending paths to collect from DB.
protected string[] $pendingPaths
리턴 string[]

$resizeImages 보호되어 있는 프로퍼티

Image resize information.
protected array $resizeImages
리턴 array

$strLightboxId 보호되어 있는 프로퍼티

The id to use in lightboxes.
protected string $strLightboxId
리턴 string

$uuidMap 보호되어 있는 프로퍼티

File id mapping for files.
protected string[] $uuidMap
리턴 string[]