PHP 클래스 Airship\Cabin\Bridge\Blueprint\Files

Manage user-provided files.
상속: extends BlueprintGear
파일 보기 프로젝트 열기: paragonie/airship 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$finfo finfo

공개 메소드들

메소드 설명
__construct ( Database $db ) Files constructor.
createDirectory ( integer | null $parent = null, string $cabin = '', string $dirName = '' ) : boolean Create a new directory
deleteDir ( string $cabin, string $root, string $subdirectory ) : boolean Delete a directory
deleteFile ( array $fileInfo ) : boolean Delete a file
dirExists ( null $parent = null, string $cabin = '', string $dirName = '' ) : boolean Does the directory already exist?
ensureDirExists ( string $absolutePath, string $cabin = 'Hull' ) : boolean Programmatically ensure that the directory exists.
getChildrenOf ( mixed $directoryId = null, string $cabin = '' ) : array Get all of the directories beneath the current one
getContentsTree ( string $cabin, string $base, string $thisDir ) : array Get the contents of a given cabin/directory, recursively
getDirectoryCabin ( integer $directoryId ) : string Given a directory ID, get its cabin.
getDirectoryId ( array $parts, string $cabin ) : integer Get a directory ID, should it exist.
getDirectoryTree ( string $cabin = '', string $rootDir = '', string $ignore = '', string $pieces = '' ) : array Build a recursive directory tree
getFileInfo ( string $cabin = '', array $path = null, string $filename = '' ) : array Get detailed file information
getFilesCabin ( integer $fileId ) : string Given a file ID, get its Cabin
getFilesInDirectory ( null $directoryId = null, string $cabin = '' ) : array Get all of the directories beneath the current one
getMimeType ( string $filePath ) : string Get the MIME type for a given file.
isValidName ( string $name ) : boolean Does this file have a valid filename?
isolateFiles ( array $files = [] ) : array Turn PHP's native $_FILES mess into a sane array
moveDir ( string $cabin, string $root, string $subdirectory, array $post = [] ) : boolean Move/rename a directory
moveFile ( array $fileInfo, array $post, string $cabin ) : boolean Move/rename a file
processUpload ( integer | null $directoryId = null, string $cabin = '', array $file = [], array $attribution = [] ) : array Process an upload. Either it returns an array with useful data, OR it throws an UploadError

보호된 메소드들

메소드 설명
getContentsIterative ( integer $parent, string $path, string $cabin ) : array Get a list of all the files in a directory.
getUniqueFileName ( string $name, string $ext, integer | null $directoryId = null, string $cabin = '' ) : string Get a string that doesn't get exist in the DB

비공개 메소드들

메소드 설명
moveUploadedFile ( string $tmp_name ) : string This method is private to avoid it from being accessed outside of the trusted methods (which handle validation). Don't change it.
recursiveDelete ( integer $directory, string $cabin ) : boolean Recursively delete everything in a specific directory

메소드 상세

__construct() 공개 메소드

Files constructor.
public __construct ( Database $db )
$db Database

createDirectory() 공개 메소드

Create a new directory
public createDirectory ( integer | null $parent = null, string $cabin = '', string $dirName = '' ) : boolean
$parent integer | null
$cabin string
$dirName string
리턴 boolean

deleteDir() 공개 메소드

Delete a directory
public deleteDir ( string $cabin, string $root, string $subdirectory ) : boolean
$cabin string
$root string
$subdirectory string
리턴 boolean

deleteFile() 공개 메소드

Delete a file
public deleteFile ( array $fileInfo ) : boolean
$fileInfo array
리턴 boolean

dirExists() 공개 메소드

Does the directory already exist?
public dirExists ( null $parent = null, string $cabin = '', string $dirName = '' ) : boolean
$parent null
$cabin string
$dirName string
리턴 boolean

ensureDirExists() 공개 메소드

Programmatically ensure that the directory exists.
public ensureDirExists ( string $absolutePath, string $cabin = 'Hull' ) : boolean
$absolutePath string
$cabin string
리턴 boolean

getChildrenOf() 공개 메소드

Get all of the directories beneath the current one
public getChildrenOf ( mixed $directoryId = null, string $cabin = '' ) : array
$directoryId mixed (usually an integer, sometimes null)
$cabin string
리턴 array

getContentsIterative() 보호된 메소드

Get a list of all the files in a directory.
protected getContentsIterative ( integer $parent, string $path, string $cabin ) : array
$parent integer
$path string
$cabin string
리턴 array

getContentsTree() 공개 메소드

Get the contents of a given cabin/directory, recursively
public getContentsTree ( string $cabin, string $base, string $thisDir ) : array
$cabin string
$base string
$thisDir string
리턴 array

getDirectoryCabin() 공개 메소드

Given a directory ID, get its cabin.
public getDirectoryCabin ( integer $directoryId ) : string
$directoryId integer
리턴 string

getDirectoryId() 공개 메소드

Get a directory ID, should it exist.
public getDirectoryId ( array $parts, string $cabin ) : integer
$parts array
$cabin string
리턴 integer

getDirectoryTree() 공개 메소드

Build a recursive directory tree
public getDirectoryTree ( string $cabin = '', string $rootDir = '', string $ignore = '', string $pieces = '' ) : array
$cabin string
$rootDir string
$ignore string
$pieces string
리턴 array

getFileInfo() 공개 메소드

Get detailed file information
public getFileInfo ( string $cabin = '', array $path = null, string $filename = '' ) : array
$cabin string
$path array
$filename string
리턴 array

getFilesCabin() 공개 메소드

Given a file ID, get its Cabin
public getFilesCabin ( integer $fileId ) : string
$fileId integer
리턴 string

getFilesInDirectory() 공개 메소드

Get all of the directories beneath the current one
public getFilesInDirectory ( null $directoryId = null, string $cabin = '' ) : array
$directoryId null
$cabin string
리턴 array

getMimeType() 공개 메소드

Get the MIME type for a given file.
public getMimeType ( string $filePath ) : string
$filePath string
리턴 string

getUniqueFileName() 보호된 메소드

Get a string that doesn't get exist in the DB
protected getUniqueFileName ( string $name, string $ext, integer | null $directoryId = null, string $cabin = '' ) : string
$name string
$ext string
$directoryId integer | null
$cabin string
리턴 string

isValidName() 공개 메소드

Does this file have a valid filename?
public isValidName ( string $name ) : boolean
$name string
리턴 boolean

isolateFiles() 공개 메소드

USAGE: $result = $this->isolateFiles($_FILES['some_index']);
public isolateFiles ( array $files = [] ) : array
$files array
리턴 array

moveDir() 공개 메소드

Move/rename a directory
public moveDir ( string $cabin, string $root, string $subdirectory, array $post = [] ) : boolean
$cabin string
$root string
$subdirectory string
$post array
리턴 boolean

moveFile() 공개 메소드

Move/rename a file
public moveFile ( array $fileInfo, array $post, string $cabin ) : boolean
$fileInfo array
$post array
$cabin string
리턴 boolean

processUpload() 공개 메소드

Process an upload. Either it returns an array with useful data, OR it throws an UploadError
public processUpload ( integer | null $directoryId = null, string $cabin = '', array $file = [], array $attribution = [] ) : array
$directoryId integer | null
$cabin string
$file array
$attribution array Who uploaded it?
리턴 array

프로퍼티 상세

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

protected finfo $finfo
리턴 finfo