PHP Класс elFinder

Core class.
Автор: Dmitry (dio) Levashov
Автор: Troex Nevelin
Автор: Alexey Sukhotin
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$defaultMimefile string elFinderVolumeDriver default mime.type file path
$instance object elFinder instance
$locale string elFinder global locale
$maxTargets Max allowed numbar of @var targets (0 - no limit)
$mountErrors array Errors from not mounted volumes
$netDrivers array Network mount drivers
$phpErrors array Errors from PHP
$sessionCacheKey string elFinder global sessionCacheKey
$volumesCnt integer Mounted volumes count Required to create unique volume id

Защищенные свойства (Protected)

Свойство Тип Описание
$base64encodeSessionData boolean elFinder base64encodeSessionData elFinder save session data as UTF-8 If the session storage mechanism of the system does not allow UTF-8 And it must be true option 'base64encodeSessionData' of elFinder
$callbackWindowURL URL for callback output window for CORS redirect to this URL when callback output
$commands array Commands and required arguments list
$commonTempPath string elFinder common tempraly path
$debug string Send debug to client?
$default elFinderStorageDriver Default root (storage)
$listeners array Commands listeners
$loaded boolean Is elFinder init correctly?
$maxArcFilesSize integer Max allowed archive files size (0 - no limit)
$netVolumesSessionKey string Session key of net mount volumes
$optionsNetVolumes array Additional volume root options for network mounting volume
$plugins array Plugins instance
$session elFinderSessionInterface elFinder session wrapper object
$sessionCloseEarlier boolean Call session_write_close() before exec command?
$sessionUseCmds array SESSION use commands @see __construct()
$time string script work time for debug
$timeout integer session expires timeout
$uploadDebug string undocumented class variable
$uploadTempPath string Temp dir path for Upload
$version string API version number
$volumes array Storages (root dirs)

Открытые методы

Метод Описание
__construct ( $opts ) Constructor
bind ( $cmd, $handler ) : elFinder Add handler to elFinder command
commandArgsList ( $cmd ) : array Return command required arguments info
commandExists ( $cmd ) : boolean Return true if command exists
curlExec ( resource $curl, array $options = [], array $headers = [] ) : mixed Call curl_exec() with supported redirect on safe_mode or open_basedir
error ( ) : array Normalize error messages
exec ( string $cmd, array $args ) : array Exec command and return result
extendTimeLimit ( Int $time = null ) : void Extend PHP execution time limit
getConnectorUrl ( ) : string Get script url.
getIniBytes ( string $iniName = '', string $val = '' ) : number Return bytes from php.ini value
getSession ( ) : object Return elFinder session wrapper instance
getStaticVar ( $key ) : mixed | null Return elFinder static variable
getStreamByUrl ( array $data, number $redirectLimit = 5 ) : resource | boolean Get stream resource pointer by URL
getVolume ( $hash ) : elFinderStorageDriver Return root - file's owner (public func of volume())
isAnimationGif ( string $path ) : boolean Return Is Animation Gif
isSeekableStream ( resource $resource ) : boolean Return Is seekable stream resource
loaded ( ) : boolean Return true if fm init correctly
phpErrorHandler ( integer $errno, string $errstr, string $errfile, integer $errline ) : void | boolean PHP error handler, catch error types only E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE
realpath ( string $hash ) : string Return file real path
rewind ( resource $resource ) : void Rewind stream resource
sessionDataDecode ( mixed &$var, boolean $checkIs = null ) : boolean | mixed base64_decode and unserialize of session data (If needed)
sessionDataEncode ( mixed $var ) : mixed | string serialize and base64_encode of session data (If needed)
sessionWrite ( ) : void Call session_write_close() if session is restarted
unbind ( $cmd, $handler ) : elFinder Remove event (command exec) handler
updateNetVolumeOption ( string $netKey, string $optionKey, mixed $val ) Update sesstion value of a NetVolume option
version ( ) : string Return version (api) number

Защищенные методы

Метод Описание
archive ( array $args ) : array Create archive
callback ( $args ) Output callback result with JavaScript that control elFinder or HTTP redirect to callbackWindowURL
chmod ( $args ) : array chmod
curl_get_contents ( string &$url, integer $timeout, integer $redirect_max, string $ua, resource $outfp ) : string Get remote contents with cURL
detectFileExtension ( string $path ) : string Detect file type extension by local path
dim ( array $args ) : array Return image dimensions
duplicate ( array $args ) : array Duplicate file - create copy with "copy %d" suffix
ensureDirsRecursively ( object $volume, string $target, string $dirs, string $path = '' ) : array | false Ensure directories recursively
extract ( array $args ) : array Extract files from archive
file ( $args ) : array Required to output file in browser when volume URL is not set Return array contains opened file pointer, root itself and required headers
filter ( array $files ) : array Remove from files list hidden files and files with required mime types
fsock_get_contents ( string &$url, integer $timeout, integer $redirect_max, string $ua, resource $outfp ) : string Get remote contents with fsockopen()
get ( array $args ) : array Return file content
getNetVolumeUniqueId ( array $netVolumes = null, string $prefix = 'nm' ) : string | false Return Network mount volume unique ID
getNetVolumes ( ) : array Return network volumes config.
getPluginInstance ( string $name, array $opts = [] ) : object | boolean Get plugin instance & set to $this->plugins
get_remote_contents ( string &$url, integer $timeout = 30, integer $redirect_max = 5, string $ua = 'Mozilla/5.0', resource $fp = null ) : string Get remote contents
hashes ( array $files ) : array Return fils hashes list
info ( array $args ) : array Return file info (used by client "places" ui)
ls ( $args ) : array Return dir files names list
mkdir ( $args ) : array Create directory
mkfile ( $args ) : array Create empty file
netmount ( $args )
open ( $args ) : array "Open" directory Return array with following elements - cwd - opened dir info - files - opened dir content [and dirs tree if $args[tree]] - api - api version (if $args[init]) - uplMaxSize - if $args[init] - error - on failed
parents ( $args ) : array Return parents dir for required directory
parse_data_scheme ( string $str, array $extTable ) : array Parse Data URI scheme
paste ( $args ) : array Copy/move files into new destination
put ( $args ) : array Save content into text file
removeNetVolume ( string $key, object $volume ) : boolean Remove netmount volume
rename ( array $args ) : array Rename file
resize ( $args ) : array Resize image
rm ( $args ) : array Remove dirs/files
saveNetVolumes ( array $volumes ) : void Save network volumes config.
search ( array $args ) : array Search files
size ( $args ) : array Count total files size
tmb ( $args ) : array Return new created thumbnails list
toArray ( array $data ) : array Return files info array
tree ( $args ) : array Return subdirs for required directory
upload ( $args ) : array Save uploaded files
url ( array $args ) : array Return content URL
utime ( )
volume ( $hash ) : elFinderStorageDriver Return root - file's owner
zipdl ( $args ) : array Download files/folders as an archive file

Приватные методы

Метод Описание
checkChunkedFile ( string $tmpname, string $chunk, string $cid, string $tempDir, null $volume = null ) : array Check chunked upload files
getTempDir ( string $volumeTempPath = null ) : string Get temporary directory path
session_expires ( )

Описание методов

__construct() публичный метод

Constructor
Автор: Dmitry (dio) Levashov
public __construct ( $opts )

archive() защищенный метод

Create archive
Автор: Dmitry (dio) Levashov,
Автор: Alexey Sukhotin
protected archive ( array $args ) : array
$args array command arguments
Результат array

bind() публичный метод

Add handler to elFinder command
Автор: Dmitry (dio) Levashov
public bind ( $cmd, $handler ) : elFinder
Результат elFinder

callback() защищенный метод

Output callback result with JavaScript that control elFinder or HTTP redirect to callbackWindowURL
Автор: Naoki Sawada
protected callback ( $args )

chmod() защищенный метод

chmod
Автор: David Bartle
protected chmod ( $args ) : array
Результат array

commandArgsList() публичный метод

Return command required arguments info
Автор: Dmitry (dio) Levashov
public commandArgsList ( $cmd ) : array
Результат array

commandExists() публичный метод

Return true if command exists
Автор: Dmitry (dio) Levashov
public commandExists ( $cmd ) : boolean
Результат boolean

curlExec() публичный статический метод

Call curl_exec() with supported redirect on safe_mode or open_basedir
Автор: Naoki Sawada
public static curlExec ( resource $curl, array $options = [], array $headers = [] ) : mixed
$curl resource
$options array
$headers array
Результат mixed

curl_get_contents() защищенный метод

Get remote contents with cURL
Автор: Naoki Sawada
protected curl_get_contents ( string &$url, integer $timeout, integer $redirect_max, string $ua, resource $outfp ) : string
$url string target url
$timeout integer timeout (sec)
$redirect_max integer redirect max count
$ua string
$outfp resource
Результат string or bool(false)

detectFileExtension() защищенный метод

Detect file type extension by local path
Автор: Naoki Sawada
protected detectFileExtension ( string $path ) : string
$path string Local path
Результат string file type extension with dot

dim() защищенный метод

Return image dimensions
Автор: Dmitry (dio) Levashov
protected dim ( array $args ) : array
$args array command arguments
Результат array

duplicate() защищенный метод

Duplicate file - create copy with "copy %d" suffix
Автор: Dmitry (dio) Levashov
protected duplicate ( array $args ) : array
$args array command arguments
Результат array

ensureDirsRecursively() защищенный метод

Ensure directories recursively
Автор: Naoki Sawada
protected ensureDirsRecursively ( object $volume, string $target, string $dirs, string $path = '' ) : array | false
$volume object Volume object
$target string Target hash
$dirs string Array of directory tree to ensure
$path string Relative path form target hash
Результат array | false array('stats' => array([stat of maked directory]), 'hashes' => array('[path]' => '[hash]'))

error() публичный метод

Normalize error messages
Автор: Dmitry (dio) Levashov
public error ( ) : array
Результат array

exec() публичный метод

Exec command and return result
Автор: Dmitry (dio) Levashov
public exec ( string $cmd, array $args ) : array
$cmd string command name
$args array command arguments
Результат array

extendTimeLimit() публичный статический метод

Extend PHP execution time limit
public static extendTimeLimit ( Int $time = null ) : void
$time Int
Результат void

extract() защищенный метод

Extract files from archive
Автор: Dmitry (dio) Levashov,
Автор: Alexey Sukhotin
protected extract ( array $args ) : array
$args array command arguments
Результат array

file() защищенный метод

Required to output file in browser when volume URL is not set Return array contains opened file pointer, root itself and required headers
Автор: Dmitry (dio) Levashov
protected file ( $args ) : array
Результат array

filter() защищенный метод

Remove from files list hidden files and files with required mime types
Автор: Dmitry (dio) Levashov
protected filter ( array $files ) : array
$files array files info
Результат array

fsock_get_contents() защищенный метод

Get remote contents with fsockopen()
Автор: Naoki Sawada
protected fsock_get_contents ( string &$url, integer $timeout, integer $redirect_max, string $ua, resource $outfp ) : string
$url string url
$timeout integer timeout (sec)
$redirect_max integer redirect max count
$ua string
$outfp resource
Результат string or bool(false)

get() защищенный метод

Return file content
Автор: Dmitry (dio) Levashov
protected get ( array $args ) : array
$args array command arguments
Результат array

getConnectorUrl() публичный статический метод

Get script url.
Автор: Naoki Sawada
public static getConnectorUrl ( ) : string
Результат string full URL

getIniBytes() публичный статический метод

Return bytes from php.ini value
public static getIniBytes ( string $iniName = '', string $val = '' ) : number
$iniName string
$val string
Результат number

getNetVolumeUniqueId() защищенный метод

Return Network mount volume unique ID
Автор: Naoki Sawada
protected getNetVolumeUniqueId ( array $netVolumes = null, string $prefix = 'nm' ) : string | false
$netVolumes array Saved netvolumes array
$prefix string Id prefix
Результат string | false

getNetVolumes() защищенный метод

Return network volumes config.
Автор: Dmitry (dio) Levashov
protected getNetVolumes ( ) : array
Результат array

getPluginInstance() защищенный метод

Get plugin instance & set to $this->plugins
Автор: Naoki Sawada
protected getPluginInstance ( string $name, array $opts = [] ) : object | boolean
$name string Plugin name (dirctory name)
$opts array Plugin options (optional)
Результат object | boolean | bool Plugin object instance Or false

getSession() публичный метод

Return elFinder session wrapper instance
public getSession ( ) : object
Результат object elFinderSessionInterface

getStaticVar() публичный статический метод

Return elFinder static variable
public static getStaticVar ( $key ) : mixed | null
$key
Результат mixed | null

getStreamByUrl() публичный статический метод

Get stream resource pointer by URL
Автор: Naoki Sawada
public static getStreamByUrl ( array $data, number $redirectLimit = 5 ) : resource | boolean
$data array array('target'=>'URL', 'headers' => array())
$redirectLimit number
Результат resource | boolean

getVolume() публичный метод

Return root - file's owner (public func of volume())
Автор: Naoki Sawada
public getVolume ( $hash ) : elFinderStorageDriver
Результат elFinderStorageDriver

get_remote_contents() защищенный метод

Get remote contents
Автор: Naoki Sawada
protected get_remote_contents ( string &$url, integer $timeout = 30, integer $redirect_max = 5, string $ua = 'Mozilla/5.0', resource $fp = null ) : string
$url string target url
$timeout integer timeout (sec)
$redirect_max integer redirect max count
$ua string
$fp resource
Результат string or bool(false)

hashes() защищенный метод

Return fils hashes list
Автор: Dmitry (dio) Levashov
protected hashes ( array $files ) : array
$files array files info
Результат array

info() защищенный метод

Return file info (used by client "places" ui)
Автор: Dmitry Levashov
protected info ( array $args ) : array
$args array command arguments
Результат array

isAnimationGif() публичный статический метод

Return Is Animation Gif
public static isAnimationGif ( string $path ) : boolean
$path string server local path of target image
Результат boolean

isSeekableStream() публичный статический метод

Return Is seekable stream resource
public static isSeekableStream ( resource $resource ) : boolean
$resource resource
Результат boolean

loaded() публичный метод

Return true if fm init correctly
Автор: Dmitry (dio) Levashov
public loaded ( ) : boolean
Результат boolean

ls() защищенный метод

Return dir files names list
Автор: Dmitry (dio) Levashov
protected ls ( $args ) : array
Результат array

mkdir() защищенный метод

Create directory
Автор: Dmitry (dio) Levashov
protected mkdir ( $args ) : array
Результат array

mkfile() защищенный метод

Create empty file
Автор: Dmitry (dio) Levashov
protected mkfile ( $args ) : array
Результат array

netmount() защищенный метод

protected netmount ( $args )

open() защищенный метод

"Open" directory Return array with following elements - cwd - opened dir info - files - opened dir content [and dirs tree if $args[tree]] - api - api version (if $args[init]) - uplMaxSize - if $args[init] - error - on failed
Автор: Dmitry (dio) Levashov
protected open ( $args ) : array
Результат array

parents() защищенный метод

Return parents dir for required directory
Автор: Dmitry (dio) Levashov
protected parents ( $args ) : array
Результат array

parse_data_scheme() защищенный метод

Parse Data URI scheme
Автор: Naoki Sawada
protected parse_data_scheme ( string $str, array $extTable ) : array
$str string
$extTable array
Результат array

paste() защищенный метод

Copy/move files into new destination
Автор: Dmitry (dio) Levashov
protected paste ( $args ) : array
Результат array

phpErrorHandler() публичный статический метод

PHP error handler, catch error types only E_WARNING | E_NOTICE | E_USER_WARNING | E_USER_NOTICE
public static phpErrorHandler ( integer $errno, string $errstr, string $errfile, integer $errline ) : void | boolean
$errno integer
$errstr string
$errfile string
$errline integer
Результат void | boolean

put() защищенный метод

Save content into text file
Автор: Dmitry (dio) Levashov
protected put ( $args ) : array
$args
Результат array

realpath() публичный метод

Return file real path
Автор: Dmitry (dio) Levashov
public realpath ( string $hash ) : string
$hash string file hash
Результат string

removeNetVolume() защищенный метод

Remove netmount volume
protected removeNetVolume ( string $key, object $volume ) : boolean
$key string netvolume key
$volume object volume driver instance
Результат boolean

rename() защищенный метод

Rename file
Автор: Dmitry (dio) Levashov
protected rename ( array $args ) : array
$args array
Результат array

resize() защищенный метод

Resize image
Автор: Dmitry (dio) Levashov
Автор: Alexey Sukhotin
protected resize ( $args ) : array
Результат array

rewind() публичный статический метод

Rewind stream resource
public static rewind ( resource $resource ) : void
$resource resource
Результат void

rm() защищенный метод

Remove dirs/files
Автор: Dmitry (dio) Levashov
protected rm ( $args ) : array
Результат array

saveNetVolumes() защищенный метод

Save network volumes config.
Автор: Dmitry (dio) Levashov
protected saveNetVolumes ( array $volumes ) : void
$volumes array volumes config
Результат void

sessionDataDecode() публичный статический метод

base64_decode and unserialize of session data (If needed)
Устаревший:
Автор: Naoki Sawada
public static sessionDataDecode ( mixed &$var, boolean $checkIs = null ) : boolean | mixed
$var mixed target variable
$checkIs boolean data type for check (array|string|object|int)
Результат boolean | mixed

sessionDataEncode() публичный статический метод

serialize and base64_encode of session data (If needed)
Устаревший:
Автор: Naoki Sawada
public static sessionDataEncode ( mixed $var ) : mixed | string
$var mixed target variable
Результат mixed | string

sessionWrite() публичный статический метод

Call session_write_close() if session is restarted
Устаревший:
public static sessionWrite ( ) : void
Результат void

size() защищенный метод

Count total files size
Автор: Dmitry (dio) Levashov
protected size ( $args ) : array
Результат array

tmb() защищенный метод

Return new created thumbnails list
Автор: Dmitry (dio) Levashov
protected tmb ( $args ) : array
Результат array

toArray() защищенный метод

Return files info array
Автор: Dmitry (dio) Levashov
protected toArray ( array $data ) : array
$data array one file info or files info
Результат array

tree() защищенный метод

Return subdirs for required directory
Автор: Dmitry (dio) Levashov
protected tree ( $args ) : array
Результат array

unbind() публичный метод

Remove event (command exec) handler
Автор: Dmitry (dio) Levashov
public unbind ( $cmd, $handler ) : elFinder
Результат elFinder

updateNetVolumeOption() публичный метод

Update sesstion value of a NetVolume option
public updateNetVolumeOption ( string $netKey, string $optionKey, mixed $val )
$netKey string
$optionKey string
$val mixed

upload() защищенный метод

Save uploaded files
Автор: Dmitry (dio) Levashov
protected upload ( $args ) : array
Результат array

url() защищенный метод

Return content URL
Автор: Naoki Sawada
protected url ( array $args ) : array
$args array command arguments
Результат array

utime() защищенный метод

protected utime ( )

version() публичный метод

Return version (api) number
Автор: Dmitry (dio) Levashov
public version ( ) : string
Результат string

volume() защищенный метод

Return root - file's owner
Автор: Dmitry (dio) Levashov
protected volume ( $hash ) : elFinderStorageDriver
Результат elFinderStorageDriver

zipdl() защищенный метод

1st: Return srrsy contains download archive file info 2nd: Return array contains opened file pointer, root itself and required headers
Автор: Naoki Sawada
protected zipdl ( $args ) : array
Результат array

Описание свойств

$base64encodeSessionData защищенное статическое свойство

elFinder base64encodeSessionData elFinder save session data as UTF-8 If the session storage mechanism of the system does not allow UTF-8 And it must be true option 'base64encodeSessionData' of elFinder
protected static bool $base64encodeSessionData
Результат boolean

$callbackWindowURL защищенное свойство

URL for callback output window for CORS redirect to this URL when callback output
protected $callbackWindowURL

$commands защищенное свойство

Commands and required arguments list
protected array $commands
Результат array

$commonTempPath защищенное статическое свойство

elFinder common tempraly path
protected static string $commonTempPath
Результат string

$debug защищенное свойство

Send debug to client?
protected string $debug
Результат string

$default защищенное свойство

Default root (storage)
protected elFinderStorageDriver $default
Результат elFinderStorageDriver

$defaultMimefile публичное статическое свойство

elFinderVolumeDriver default mime.type file path
public static string $defaultMimefile
Результат string

$instance публичное статическое свойство

elFinder instance
public static object $instance
Результат object

$listeners защищенное свойство

Commands listeners
protected array $listeners
Результат array

$loaded защищенное свойство

Is elFinder init correctly?
protected bool $loaded
Результат boolean

$locale публичное статическое свойство

elFinder global locale
public static string $locale
Результат string

$maxArcFilesSize защищенное свойство

Max allowed archive files size (0 - no limit)
protected int $maxArcFilesSize
Результат integer

$maxTargets публичное свойство

Max allowed numbar of @var targets (0 - no limit)
public $maxTargets

$mountErrors публичное свойство

Errors from not mounted volumes
public array $mountErrors
Результат array

$netDrivers публичное статическое свойство

Network mount drivers
public static array $netDrivers
Результат array

$netVolumesSessionKey защищенное свойство

Session key of net mount volumes
Устаревший:
protected string $netVolumesSessionKey
Результат string

$optionsNetVolumes защищенное свойство

Additional volume root options for network mounting volume
protected array $optionsNetVolumes
Результат array

$phpErrors публичное статическое свойство

Errors from PHP
public static array $phpErrors
Результат array

$plugins защищенное свойство

Plugins instance
protected array $plugins
Результат array

$session защищенное свойство

elFinder session wrapper object
protected elFinderSessionInterface $session
Результат elFinderSessionInterface

$sessionCacheKey публичное статическое свойство

elFinder global sessionCacheKey
Устаревший:
public static string $sessionCacheKey
Результат string

$sessionCloseEarlier защищенное свойство

Call session_write_close() before exec command?
protected bool $sessionCloseEarlier
Результат boolean

$sessionUseCmds защищенное свойство

SESSION use commands @see __construct()
protected array $sessionUseCmds
Результат array

$time защищенное свойство

script work time for debug
protected string $time
Результат string

$timeout защищенное свойство

session expires timeout
protected int $timeout
Результат integer

$uploadDebug защищенное свойство

undocumented class variable
protected string $uploadDebug
Результат string

$uploadTempPath защищенное свойство

Temp dir path for Upload
protected string $uploadTempPath
Результат string

$version защищенное свойство

API version number
protected string $version
Результат string

$volumes защищенное свойство

Storages (root dirs)
protected array $volumes
Результат array

$volumesCnt публичное статическое свойство

Mounted volumes count Required to create unique volume id
public static int $volumesCnt
Результат integer