ZenphotoCMS 1.6.3

elFinderVolumeOneDrive extends elFinderVolumeDriver
in package

Simple elFinder driver for OneDrive onedrive api v5.0.

Tags
author

Dmitry (dio) Levashov

author

Cem (discofever)

Table of Contents

Constants

API_URL  = 'https://graph.microsoft.com/v1.0/me/drive/items/'
AUTH_URL  = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'
TOKEN_URL  = 'https://login.microsoftonline.com/common/oauth2/v2.0/token'

Properties

$netMountKey  : string
Net mount key.
$access  : mixed
Access control function/class
$added  : array<string|int, mixed>
Store files added files info
$archivers  : array<string|int, mixed>
Archivers config
$ARGS  : array<string|int, mixed>
Request args $_POST or $_GET values
$attributes  : mixed
Access control function/class
$cache  : array<string|int, mixed>
Cache storage
$cryptLib  : string
Library to crypt files name
$defaults  : array<string|int, mixed>
Defaults permissions
$dirnameValidator  : string
Accepted dirname validator
$dirsCache  : array<string|int, mixed>
Cache by folders
$disabled  : array<string|int, mixed>
List of disabled client's commands
$disabledGetUrl  : string
Is disable of command `url`
$doSearchCurrentQuery  : array<string|int, mixed>
Current query word on doSearch
$driverId  : string
Driver id Must be started from letter and contains [a-z0-9] Used as part of volume id.
$encoding  : string
Server character encoding
$error  : array<string|int, mixed>
Errors from last failed action
$extractToNewdir  : int
Force make dirctory on extract
$finfo  : resource
Finfo resource for mimeDetect == 'finfo'
$getMaxSize  : int|string
Maximum allowed get file size.
$HasdirsCache  : array<string|int, mixed>
hasCache by folders.
$id  : string
Volume id - used as prefix for files hashes
$imgConverter  : array<string|int, mixed>
Video to Image converter
$imgLib  : string
Image manipulation lib name auto|imagick|gd|convert
$maxArcFilesSize  : int|string
Static var of $this->options['maxArcFilesSize']
$mimeDetect  : string
Mimetype detect method
$mimetypes  : array<string|int, mixed>
overwrite extensions/mimetypes to mime.types
$mounted  : bool
Flag - volume "mounted" and available
$nameValidator  : string
Accepted filename validator
$needOnline  : bool
This request require online state
$onlyMimes  : array<string|int, mixed>
Mimetypes allowed to display
$options  : array<string|int, mixed>
Object configuration
$queryOptions  : array<string|int, mixed>
Query options of API call.
$removed  : array<string|int, mixed>
Store files moved or overwrited files info
$root  : string
Root directory path
$rootModified  : bool
Is root modified (for clear root stat cache)
$rootName  : string
Root basename | alias
$searchStart  : int
Search start time
$separator  : string
Directory separator - required by client
$separatorForHash  : string
Directory separator for decode/encode hash
$session  : elFinderSessionInterface
elFinder session wrapper object
$sessionCache  : array<string|int, mixed>
This volume session cache
$sessionCaching  : array<string|int, mixed>
Session caching item list
$startPath  : string
Default directory to open
$subdirsCache  : array<string|int, mixed>
You should use `$this->sessionCache['subdirs']` instead
$systemRoot  : string
System Root path (Unix like: '/', Windows: '\', 'C:\' or 'D:\'...)
$tmbPath  : string
Thumbnails dir path
$tmbPathWritable  : bool
Is thumbnails dir writable
$tmbPrefix  : string
Thumbnail prefix.
$tmbSize  : int
Thumbnails size in px
$tmbURL  : string
Thumbnails base URL
$tmp  : string
Directory for tmp files If not set driver will try to use tmbDir as tmpDir.
$tmpLinkPath  : string
A file save destination path when a temporary content URL is required on a network volume or the like If not specified, it tries to use "Connector Path/../files/.tmb".
$tmpLinkUrl  : string
A file save destination URL when a temporary content URL is required on a network volume or the like If not specified, it tries to use "Connector URL/../files/.tmb".
$today  : int
Today 24:00 timestamp
$token  : object
OneDrive token object.
$treeDeep  : int
How many subdirs levels return for tree
$uploadAllow  : array<string|int, mixed>
Mime types allowed to upload
$uploadDeny  : array<string|int, mixed>
Mime types denied to upload
$uploadMaxSize  : int|string
Maximum allowed upload file size.
$uploadOrder  : array<string|int, mixed>
Order to validate uploadAllow and uploadDeny
$uploadOverwrite  : string
Run time setting of overwrite items on upload
$URL  : string
Base URL
$yesterday  : int
Yesterday 24:00 timestamp
$aTokenFile  : string
Path to access token file for permanent mount
$expires  : int
Current token expires
$mimetypesLoaded  : bool
Flag - mimetypes from externail file was loaded

Methods

__construct()  : mixed
Constructor Extend options with required fields.
added()  : array<string|int, mixed>
Return list of added files
archive()  : array<string|int, mixed>|bool
Add files to archive
chmod()  : array<string|int, mixed>|false
chmod a file or folder
clearcaches()  : mixed
Clear inner stat caches for target hash
clearSessionCache()  : mixed
Remove session cache of this volume
clearstatcache()  : mixed
Clear PHP stat cache & all of inner stat caches
close()  : void
Close file pointer
closest()  : string|false
Return file/dir hash or first founded child hash with required attr == $val
commandDisabled()  : bool
Return true if command disabled in options
convEncIn()  : mixed
Converts character encoding from UTF-8 to server's one
convEncOut()  : mixed
Converts character encoding from server's one to UTF-8
copyFromAllowed()  : bool
Return true if copy from this volume allowed
debug()  : array<string|int, mixed>
Return debug info for client.
defaultPath()  : string
Return root or startPath hash
dimensions()  : array<string|int, mixed>|string
Return image dimensions
driverId()  : string
Return driver id. Used as a part of volume id.
duplicate()  : array<string|int, mixed>|false
Create file copy with suffix "copy number" and return its info
error()  : array<string|int, mixed>
Return error message from last failed action
extract()  : array<string|int, mixed>|bool
Extract files from archive
ffmpegToImg()  : bool
Convert Video To Image by ffmpeg
fstat()  : array<string|int, mixed>
stat a file or folder for elFinder cmd exec
getContents()  : string|false
Return file contents
getContentUrl()  : string
Return content URL.
getExtentionByMime()  : string
Return file extention detected by MIME type
getHash()  : string
Return target path hash
getImageSize()  : array<string|int, mixed>|false
Get image size array with `dimensions`
getMimeTable()  : array<string|int, mixed>
Return Extention/MIME Table (elFinderVolumeDriver::$mimetypes)
getOption()  : null|mixed
Get option value of this volume
getOptionsPlugin()  : null|array<string|int, mixed>
Get plugin values of this options
getPath()  : string
Return decoded path of target hash This method do not check the stat of target Use method `realpath()` to do check of the stat of target
getRootPath()  : string
Return root path
getSession()  : object
Get elFinder sesson wrapper object
getSubstituteImgLink()  : bool
Get URL of substitute image by request args `substitute` or 4th argument $maxSize
getTempLinkInfo()  : bool|array<string|int, mixed>
Get temporary contents link infomation
getTempPath()  : string
Return temp path
getUploadMaxSize()  : int
Return this uploadMaxSize value
getUploadTaget()  : bool|string
(Make &) Get upload taget dirctory hash
id()  : string
Return volume id
imageUtil()  : bool
Image file utility
isReadable()  : bool
Return true if voume is readable.
isUploadableByName()  : bool
Return is uploadable that given file name
ls()  : array<string|int, mixed>|false
Return dir files names list
mimeAccepted()  : bool|null
Return true if mime is required mimes list
mimeTypeNormalize()  : string
Normalize MIME-Type by options['mimeMap']
mkdir()  : array<string|int, mixed>|false
Create directory and return dir info
mkfile()  : array<string|int, mixed>|false
Create empty file and return its info
mount()  : bool
"Mount" volume.
netmountPrepare()  : void
netmountPrepare()  : array<string|int, mixed>
Prepare Call from elFinder::netmout() before volume->mount().
netunmount()  : bool
process of on netunmount Drop `onedrive` & rm thumbs.
open()  : resource|false
Open file for reading and return file pointer
options()  : array<string|int, mixed>
Return volume options required by client:
parents()  : array<string|int, mixed>|false
Return part of dirs tree from required dir up to root dir
path()  : string
Return file path related to root with convert encoging
postNetmount()  : void
putContents()  : array<string|int, mixed>|false
Put content in text file and return file info.
realpath()  : string
Return file real path if file exists
removed()  : array<string|int, mixed>
Return list of moved/overwrited files
rename()  : array<string|int, mixed>|false
Rename file and return file info
resetRemoved()  : void
Clean removed files list
resetResultStat()  : void
Clean added/removed files list
resize()  : array<string|int, mixed>|false
Resize image
rm()  : bool
Remove file/dir
rmdirRecursive()  : bool
Remove directory recursive on local file system
root()  : string
Return root folder hash
saveSessionCache()  : void
Save session cache data Calls this function before umount this volume on elFinder::exec()
scandir()  : array<string|int, mixed>|false
Return directory content or false on error
search()  : array<string|int, mixed>
Search files
setMimesFilter()  : void
Set mimetypes allowed to display to client
setNeedOnline()  : mixed
Sets the need online.
setSession()  : mixed
Assign elFinder session wrapper object
setUploadOverwrite()  : mixed
size()  : array<string|int, mixed>
Return file size / total directory size
subdirs()  : bool
Return has subdirs
tmb()  : false|string
Create thumbnail for required file and return its name or false on failed
tmpfile()  : resource|bool
Creates a temporary file and return file pointer
tree()  : array<string|int, mixed>|false
Return subfolders for required folder or false on error
umount()  : void
Close opened connection.
zipdl()  : array<string|int, mixed>|false
Return path info array to archive of target items
_abspath()  : string
Convert path related to root dir into real path.
_archive()  : string|bool
Create archive and return its path.
_basename()  : string
Return file name.
_checkArchivers()  : void
Detect available archivers.
_chmod()  : bool
chmod implementation.
_copy()  : bool
Copy file into another file.
_dimensions()  : string
Return object width and height Ususaly used for images, but can be realize for video etc.
_dirname()  : string
Return parent directory path.
_extract()  : void
Extract files from archive.
_fclose()  : bool
Close opened file.
_filePutContents()  : bool
Write a string to a file.
_fopen()  : resource|false
Open file and return file pointer.
_getContents()  : string|false
Get file contents.
_inpath()  : bool
Return true if $path is children of $parent.
_joinPath()  : string
Join dir name and file name and retur full path.
_mkdir()  : string|bool
Create dir and return created dir path or false on failed.
_mkfile()  : string|bool
Create file and return it's path or false on failed.
_move()  : string|bool
Move file into another parent dir.
_normpath()  : string
Return normalized path, this works the same as os.path.normpath() in Python.
_od_createCurl()  : resource
Creates a base cURL object which is compatible with the OneDrive API.
_od_getATokenFile()  : string
Get AccessToken file path
_od_getChunkData()  : bool|string
Get chunk data by file pointer to upload session.
_od_getFileRaw()  : array<string|int, mixed>|object
Get raw data(onedrive metadata) from OneDrive.
_od_getInitialToken()  : string
Get Initial Token (MD5 hash)
_od_getThumbnail()  : string
Get thumbnail from OneDrive.com.
_od_obtainAccessToken()  : object|string
Obtains a new access token from OAuth. This token is valid for one hour.
_od_parseRaw()  : array<string|int, mixed>
Parse line from onedrive metadata output and return file stat (array).
_od_prepareCurl()  : resource
Creates a base cURL object which is compatible with the OneDrive API.
_od_query()  : object|array<string|int, mixed>
Drive query and fetchAll.
_od_refreshToken()  : true
Get token and auto refresh.
_od_splitPath()  : array<string|int, mixed>
Get Parent ID, Item ID, Parent Path as an array from path.
_od_uploadSession()  : string
Upload large files with an upload session.
_path()  : string
Return fake path started from root dir.
_relpath()  : string
Return file path related to root dir.
_rmdir()  : bool
Remove dir.
_save()  : bool|string
Create new file and write into it from file pointer.
_scandir()  : array<string|int, mixed>
Return files list in directory.
_stat()  : array<string|int, mixed>|false
Return stat for given path.
_subdirs()  : bool
Return true if path is dir and has at least one childs directory.
_symlink()  : bool
Create symlink. FTP driver does not support symlinks.
_unlink()  : bool
Remove file.
_unpack()  : void
Unpack archive.
abspathCE()  : string
Convert path related to root dir into real path (with convert encoding)
addError()  : false
Add error message
allowCreate()  : bool
Return true if file with given name can be created in given folder.
allowPutMime()  : bool
Return true if file MIME type can save with check uploadOrder config.
attr()  : bool
Check file attribute
basenameCE()  : string
Return file name (with convert encoding)
cacheDir()  : array<string|int, mixed>
Cache dir contents.
canCreateTmb()  : string|bool
Return true if thumnbnail for required file can be created
canResize()  : string|bool
Return true if required file can be resized.
checkExtractItems()  : array<string|int, mixed>
Check and filter the extracted items
childsByAttr()  : string|false
Return first found children with required attr == $val
clearcache()  : void
Clean cache
closestByAttr()  : string|false
If file has required attr == $val - return file path, If dir has child with has required attr == $val - return child path
configure()  : void
Configure after successfull mount.
convEnc()  : mixed
Converts character encoding (base function)
copy()  : string|false
Copy file/recursive copy dir only in current volume.
copyFrom()  : string|false
Copy file from another volume.
countSize()  : array<string|int, mixed>
Return file/total directory size infomation
createTmb()  : string|false
Create thumnbnail and return it's URL on success.
crypt()  : mixed
Return crypted path Not implemented
decode()  : string
Decode path from hash
delTree()  : bool
Delete dirctory trees
dirnameCE()  : string
Return parent directory path (with convert encoding)
doSearch()  : array<string|int, mixed>
Recursive files search
encode()  : string
Encode path into hash
fcloseCE()  : bool
Close opened file (with convert encoding)
gdImage()  : bool
Output gd image to file
gdImageBackground()  : mixed
Assign the proper background to a gd image
gdImageCreate()  : resource|false
Create an gd image according to the specified mime type
getArchivers()  : array<string|int, mixed>
Get server side available archivers
getFullPath()  : string
Resolve relative / (Unix-like)absolute path
getItemsInHand()  : string|false
Copy items to a new temporary directory on the local server
getRootstatCachekey()  : string
Return session rootstat cache key
getRootStatExtra()  : array<string|int, mixed>
Get root stat extra key values
getScandir()  : array<string|int, mixed>
Return required dir's files info.
getTempFile()  : string|false
Get temporary filename. Tempfile will be removed when after script execution finishes or exit() is called.
gettmb()  : string|false
Return thumnbnail name if exists
gettree()  : array<string|int, mixed>
Return subdirs tree
getWorkFile()  : string
File path of local server side work file path
imageMagickConvertPrepare()  : array<string|int, mixed>
Prepare variables for exec convert of ImageMagick
imagickImage()  : bool
Output imagick image to file
imgCrop()  : string|false
Crop image
imgResize()  : string|false
Resize image
imgRotate()  : string|false
Rotate image
imgSquareFit()  : false|string
Put image to square
init()  : bool
Prepare FTP connection Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn.
inpathCE()  : bool
Return true if $path is children of $parent (with convert encoding)
isMyReload()  : mixed
isNameExists()  : array<string|int, mixed>
Return fileinfo based on filename For item ID based path file system Please override if needed on each drivers
isSameType()  : bool
Return true if all mimes is directory or files
joinPathCE()  : string
Join dir name and file name and return full path. (with convert encoding) Some drivers (db) use int as path - so we give to concat path to driver itself
loadMimeTypes()  : mixed
Load file of mime.types
localFindSymlinks()  : bool
Recursive symlinks search
localMoveRecursive()  : bool
Move item recursive on local file system
localRmdirRecursive()  : bool
Remove directory recursive on local file system
localScandir()  : array<string|int, mixed>
Return files of target directory that is dotfiles excludes.
makeArchive()  : string|bool
Create archive and return its path
mimetype()  : string
Return file mimetype
mimetypeInternalDetect()  : string
Detect file mimetype using "internal" method or Loading mime.types with $path = ''
move()  : string|false
Move file Return new file path or false.
nameAccepted()  : bool
Validate file name based on $this->options['acceptedName'] regexp or function
normpathCE()  : string
Return normalized path (with convert encoding)
procExec()  : int
Execute shell command
relpathCE()  : string
Return file path related to root dir (with convert encoding)
remoteArchive()  : string|bool
Create an archive from remote items
remove()  : bool
Remove file/ recursive remove dir.
rmTmb()  : void
Remove thumbnail, also remove recursively if stat is directory
saveCE()  : bool|string
Create new file and write into it from file pointer. (with convert encoding) Return new file path or false on error.
scandirCE()  : array<string|int, mixed>
Return files list in directory (with convert encoding)
searchMatchName()  : bool
Default serach match method (name match)
sessionRestart()  : mixed
setError()  : bool
Save error message
stat()  : array<string|int, mixed>|bool
Return fileinfo
stripos()  : int|bool
Find position of first occurrence of string in a string with multibyte support
subdirsCE()  : bool
Return true if path is dir and has at least one childs directory (with convert encoding)
symlinkCE()  : bool
Create symlink (with convert encoding)
tmbname()  : string
Return thumbnail file name for required file.
uncrypt()  : mixed
Return uncrypted path Not implemented
unpackArchive()  : void
Unpack archive
updateCache()  : array<string|int, mixed>
Put file stat in cache and return it
updateSubdirsCache()  : void
Update subdirs cache data
zipArchiveUnzip()  : bool
Unpack Zip archive using PHP class ZipArchive
zipArchiveZip()  : bool
Create Zip archive using PHP class ZipArchive

Constants

AUTH_URL

public string AUTH_URL = 'https://login.microsoftonline.com/common/oauth2/v2.0/authorize'

The base URL for authorization requests

TOKEN_URL

public string TOKEN_URL = 'https://login.microsoftonline.com/common/oauth2/v2.0/token'

The base URL for token requests

Properties

$archivers

Archivers config

protected array<string|int, mixed> $archivers = array('create' => array(), 'extract' => array())

$defaults

Defaults permissions

protected array<string|int, mixed> $defaults = array('read' => \true, 'write' => \true, 'locked' => \false, 'hidden' => \false)

$doSearchCurrentQuery

Current query word on doSearch

protected array<string|int, mixed> $doSearchCurrentQuery = array()

$driverId

Driver id Must be started from letter and contains [a-z0-9] Used as part of volume id.

protected string $driverId = 'od'

$getMaxSize

Maximum allowed get file size.

protected int|string $getMaxSize = -1

Set as number or string with unit - "10M", "500K", "1G"

$mimetypes

overwrite extensions/mimetypes to mime.types

protected static array<string|int, mixed> $mimetypes = array( // applications 'exe' => 'application/x-executable', 'jar' => 'application/x-jar', // archives 'gz' => 'application/x-gzip', 'tgz' => 'application/x-gzip', 'tbz' => 'application/x-bzip2', 'rar' => 'application/x-rar', // texts 'php' => 'text/x-php', 'js' => 'text/javascript', 'rtfd' => 'application/rtfd', 'py' => 'text/x-python', 'rb' => 'text/x-ruby', 'sh' => 'text/x-shellscript', 'pl' => 'text/x-perl', 'xml' => 'text/xml', 'c' => 'text/x-csrc', 'h' => 'text/x-chdr', 'cpp' => 'text/x-c++src', 'hh' => 'text/x-c++hdr', 'md' => 'text/x-markdown', 'markdown' => 'text/x-markdown', 'yml' => 'text/x-yaml', // images 'bmp' => 'image/x-ms-bmp', 'tga' => 'image/x-targa', 'xbm' => 'image/xbm', 'pxm' => 'image/pxm', //audio 'wav' => 'audio/wav', // video 'dv' => 'video/x-dv', 'wm' => 'video/x-ms-wmv', 'ogm' => 'video/ogg', 'm2ts' => 'video/MP2T', 'mts' => 'video/MP2T', 'ts' => 'video/MP2T', 'm3u8' => 'application/x-mpegURL', 'mpd' => 'application/dash+xml', )

$options

Object configuration

protected array<string|int, mixed> $options = array( // Driver ID (Prefix of volume ID), Normally, the value specified for each volume driver is used. 'driverId' => '', // Id (Suffix of volume ID), Normally, the number incremented according to the specified number of volumes is used. 'id' => '', // revision id of root directory that uses for caching control of root stat 'rootRev' => '', // driver type it uses volume root's CSS class name. e.g. 'group' -> Adds 'elfinder-group' to CSS class name. 'type' => '', // root directory path 'path' => '', // Folder hash value on elFinder to be the parent of this volume 'phash' => '', // Folder hash value on elFinder to trash bin of this volume, it require 'copyJoin' to true 'trashHash' => '', // open this path on initial request instead of root path 'startPath' => '', // how many subdirs levels return per request 'treeDeep' => 1, // root url, not set to URL via the connector. If you want to hide the file URL, do not set this value. (replacement for old "fileURL" option) 'URL' => '', // enable onetime URL to a file - (true, false, 'auto' (true if a temporary directory is available) or callable (A function that return onetime URL)) 'onetimeUrl' => 'auto', // directory link url to own manager url with folder hash (`true`, `false`, `'hide'`(No show) or default `'auto'`: URL is empty then `true` else `false`) 'dirUrlOwn' => 'auto', // directory separator. required by client to show paths correctly 'separator' => \DIRECTORY_SEPARATOR, // Use '/' as directory separator when the path hash encode/decode on the Windows server too 'winHashFix' => \false, // Server character encoding (default is '': UTF-8) 'encoding' => '', // for convert character encoding (default is '': Not change locale) 'locale' => '', // URL of volume icon image 'icon' => '', // CSS Class of volume root in tree 'rootCssClass' => '', // Items to disable session caching 'noSessionCache' => array(), // enable i18n folder name that convert name to elFinderInstance.messages['folder_'+name] 'i18nFolderName' => \false, // Search timeout (sec) 'searchTimeout' => 30, // Search exclusion directory regex pattern (require demiliter e.g. '#/path/to/exclude_directory#i') 'searchExDirReg' => '', // library to crypt/uncrypt files names (not implemented) 'cryptLib' => '', // how to detect files mimetypes. (auto/internal/finfo/mime_content_type) 'mimeDetect' => 'auto', // mime.types file path (for mimeDetect==internal) 'mimefile' => '', // Static extension/MIME of general server side scripts to security issues 'staticMineMap' => array('php:*' => 'text/x-php', 'pht:*' => 'text/x-php', 'php3:*' => 'text/x-php', 'php4:*' => 'text/x-php', 'php5:*' => 'text/x-php', 'php7:*' => 'text/x-php', 'phtml:*' => 'text/x-php', 'phar:*' => 'text/x-php', 'cgi:*' => 'text/x-httpd-cgi', 'pl:*' => 'text/x-perl', 'asp:*' => 'text/x-asap', 'aspx:*' => 'text/x-asap', 'py:*' => 'text/x-python', 'rb:*' => 'text/x-ruby', 'jsp:*' => 'text/x-jsp'), // mime type normalize map : Array '[ext]:[detected mime type]' => '[normalized mime]' 'mimeMap' => array('md:application/x-genesis-rom' => 'text/x-markdown', 'md:text/plain' => 'text/x-markdown', 'markdown:text/plain' => 'text/x-markdown', 'css:text/x-asm' => 'text/css', 'css:text/plain' => 'text/css', 'csv:text/plain' => 'text/csv', 'java:text/x-c' => 'text/x-java-source', 'json:text/plain' => 'application/json', 'sql:text/plain' => 'text/x-sql', 'rtf:text/rtf' => 'application/rtf', 'rtfd:text/rtfd' => 'application/rtfd', 'ico:image/vnd.microsoft.icon' => 'image/x-icon', 'svg:text/plain' => 'image/svg+xml', 'pxd:application/octet-stream' => 'image/x-pixlr-data', 'dng:image/tiff' => 'image/x-adobe-dng', 'sketch:application/zip' => 'image/x-sketch', 'sketch:application/octet-stream' => 'image/x-sketch', 'xcf:application/octet-stream' => 'image/x-xcf', 'amr:application/octet-stream' => 'audio/amr', 'm4a:video/mp4' => 'audio/mp4', 'oga:application/ogg' => 'audio/ogg', 'ogv:application/ogg' => 'video/ogg', 'zip:application/x-zip' => 'application/zip', 'm3u8:text/plain' => 'application/x-mpegURL', 'mpd:text/plain' => 'application/dash+xml', 'mpd:application/xml' => 'application/dash+xml', '*:application/x-dosexec' => 'application/x-executable', 'doc:application/vnd.ms-office' => 'application/msword', 'xls:application/vnd.ms-office' => 'application/vnd.ms-excel', 'ppt:application/vnd.ms-office' => 'application/vnd.ms-powerpoint', 'yml:text/plain' => 'text/x-yaml', 'ai:application/pdf' => 'application/postscript', 'cgm:text/plain' => 'image/cgm', 'dxf:text/plain' => 'image/vnd.dxf', 'dds:application/octet-stream' => 'image/vnd-ms.dds', 'hpgl:text/plain' => 'application/vnd.hp-hpgl', 'igs:text/plain' => 'model/iges', 'iges:text/plain' => 'model/iges', 'plt:application/octet-stream' => 'application/plt', 'plt:text/plain' => 'application/plt', 'sat:text/plain' => 'application/sat', 'step:text/plain' => 'application/step', 'stp:text/plain' => 'application/step'), // An option to add MimeMap to the `mimeMap` option // Array '[ext]:[detected mime type]' => '[normalized mime]' 'additionalMimeMap' => array(), // MIME-Type of filetype detected as unknown 'mimeTypeUnknown' => 'application/octet-stream', // MIME regex of send HTTP header "Content-Disposition: inline" or allow preview in quicklook // '.' is allow inline of all of MIME types // '$^' is not allow inline of all of MIME types 'dispInlineRegex' => '^(?:(?:video|audio)|image/(?!.+\\+xml)|application/(?:ogg|x-mpegURL|dash\\+xml)|(?:text/plain|application/pdf)$)', // temporary content URL's base path 'tmpLinkPath' => '', // temporary content URL's base URL 'tmpLinkUrl' => '', // directory for thumbnails 'tmbPath' => '.tmb', // mode to create thumbnails dir 'tmbPathMode' => 0777, // thumbnails dir URL. Set it if store thumbnails outside root directory 'tmbURL' => '', // thumbnails size (px) 'tmbSize' => 48, // thumbnails crop (true - crop, false - scale image to fit thumbnail size) 'tmbCrop' => \true, // thumbnail URL require custom data as the GET query 'tmbReqCustomData' => \false, // thumbnails background color (hex #rrggbb or 'transparent') 'tmbBgColor' => 'transparent', // image rotate fallback background color (hex #rrggbb) 'bgColorFb' => '#ffffff', // image manipulations library (imagick|gd|convert|auto|none, none - Does not check the image library at all.) 'imgLib' => 'auto', // Fallback self image to thumbnail (nothing imgLib) 'tmbFbSelf' => \true, // Video to Image converters ['TYPE or MIME' => ['func' => function($file){ /* Converts $file to Image */ return true; }, 'maxlen' => (int)TransferLength]] 'imgConverter' => array(), // Max length of transfer to image converter 'tmbVideoConvLen' => 10000000, // Captre point seccond 'tmbVideoConvSec' => 6, // Life time (hour) for thumbnail garbage collection ("0" means no GC) 'tmbGcMaxlifeHour' => 0, // Percentage of garbage collection executed for thumbnail creation command ("1" means "1%") 'tmbGcPercentage' => 1, // Resource path of fallback icon images defailt: php/resouces 'resourcePath' => '', // Jpeg image saveing quality 'jpgQuality' => 100, // Save as progressive JPEG on image editing 'jpgProgressive' => \true, // enable to get substitute image with command `dim` 'substituteImg' => \true, // on paste file - if true - old file will be replaced with new one, if false new file get name - original_name-number.ext 'copyOverwrite' => \true, // if true - join new and old directories content on paste 'copyJoin' => \true, // on upload - if true - old file will be replaced with new one, if false new file get name - original_name-number.ext 'uploadOverwrite' => \true, // mimetypes allowed to upload 'uploadAllow' => array(), // mimetypes not allowed to upload 'uploadDeny' => array(), // order to process uploadAllow and uploadDeny options 'uploadOrder' => array('deny', 'allow'), // maximum upload file size. NOTE - this is size for every uploaded files 'uploadMaxSize' => 0, // Maximum number of folders that can be created at one time. (0: unlimited) 'uploadMaxMkdirs' => 0, // maximum number of chunked upload connection. `-1` to disable chunked upload 'uploadMaxConn' => 3, // maximum get file size. NOTE - Maximum value is 50% of PHP memory_limit 'getMaxSize' => 0, // files dates format 'dateFormat' => 'j M Y H:i', // files time format 'timeFormat' => 'H:i', // if true - every folder will be check for children folders, -1 - every folder will be check asynchronously, false - all folders will be marked as having subfolders 'checkSubfolders' => \true, // true, false or -1 // allow to copy from this volume to other ones? 'copyFrom' => \true, // allow to copy from other volumes to this one? 'copyTo' => \true, // cmd duplicate suffix format e.g. '_%s_' to without spaces 'duplicateSuffix' => ' %s ', // unique name numbar format e.g. '(%d)' to (1), (2)... 'uniqueNumFormat' => '%d', // list of commands disabled on this root 'disabled' => array(), // enable file owner, group & mode info, `false` to inactivate "chmod" command. 'statOwner' => \false, // allow exec chmod of read-only files 'allowChmodReadOnly' => \false, // regexp or function name to validate new file name 'acceptedName' => '/^[^\\.].*/', // Notice: overwritten it in some volume drivers contractor // regexp or function name to validate new directory name 'acceptedDirname' => '', // used `acceptedName` if empty value // function/class method to control files permissions 'accessControl' => \null, // some data required by access control 'accessControlData' => \null, // root stat that return without asking the system when mounted and not the current volume. Query to the system with false. array|false 'rapidRootStat' => array( 'read' => \true, 'write' => \true, 'locked' => \false, 'hidden' => \false, 'size' => 0, // Unknown 'ts' => 0, // Unknown 'dirs' => -1, // Check on demand for subdirectories 'mime' => 'directory', ), // default permissions. 'defaults' => array('read' => \true, 'write' => \true, 'locked' => \false, 'hidden' => \false), // files attributes 'attributes' => array(), // max allowed archive files size (0 - no limit) 'maxArcFilesSize' => '2G', // Allowed archive's mimetypes to create. Leave empty for all available types. 'archiveMimes' => array(), // Manual config for archivers. See example below. Leave empty for auto detect 'archivers' => array(), // Use Archive function for remote volume 'useRemoteArchive' => \false, // plugin settings 'plugin' => array(), // Is support parent directory time stamp update on add|remove|rename item // Default `null` is auto detection that is LocalFileSystem, FTP or Dropbox are `true` 'syncChkAsTs' => \null, // Long pooling sync checker function for syncChkAsTs is true // Calls with args (TARGET DIRCTORY PATH, STAND-BY(sec), OLD TIMESTAMP, VOLUME DRIVER INSTANCE, ELFINDER INSTANCE) // This function must return the following values. Changed: New Timestamp or Same: Old Timestamp or Error: false // Default `null` is try use elFinderVolumeLocalFileSystem::localFileSystemInotify() on LocalFileSystem driver // another driver use elFinder stat() checker 'syncCheckFunc' => \null, // Long polling sync stand-by time (sec) 'plStandby' => 30, // Sleep time (sec) for elFinder stat() checker (syncChkAsTs is true) 'tsPlSleep' => 10, // Sleep time (sec) for elFinder ls() checker (syncChkAsTs is false) 'lsPlSleep' => 30, // Client side sync interval minimum (ms) // Default `null` is auto set to ('tsPlSleep' or 'lsPlSleep') * 1000 // `0` to disable auto sync 'syncMinMs' => \null, // required to fix bug on macos // However, we recommend to use the Normalizer plugin instead this option 'utf8fix' => \false, // й ё Й Ё Ø Å 'utf8patterns' => array("\\u0438\\u0306", "\\u0435\\u0308", "\\u0418\\u0306", "\\u0415\\u0308", "\\u00d8A", "\\u030a"), 'utf8replace' => array("\\u0439", "\\u0451", "\\u0419", "\\u0401", "\\u00d8", "\\u00c5"), // cache control HTTP headers for commands `file` and `get` 'cacheHeaders' => array('Cache-Control: max-age=3600', 'Expires:', 'Pragma:'), // Header to use to accelerate sending local files to clients (e.g. 'X-Sendfile', 'X-Accel-Redirect') 'xsendfile' => '', // Root path to xsendfile target. Probably, this is required for 'X-Accel-Redirect' on Nginx. 'xsendfilePath' => '', )

$sessionCaching

Session caching item list

protected array<string|int, mixed> $sessionCaching = array('rootstat' => \true, 'subdirs' => \true)

$subdirsCache

You should use `$this->sessionCache['subdirs']` instead

protected array<string|int, mixed> $subdirsCache = array()
Tags
deprecated

$systemRoot

System Root path (Unix like: '/', Windows: '\', 'C:\' or 'D:\'...)

protected string $systemRoot = \DIRECTORY_SEPARATOR

$tmpLinkPath

A file save destination path when a temporary content URL is required on a network volume or the like If not specified, it tries to use "Connector Path/../files/.tmb".

protected string $tmpLinkPath = ''

$tmpLinkUrl

A file save destination URL when a temporary content URL is required on a network volume or the like If not specified, it tries to use "Connector URL/../files/.tmb".

protected string $tmpLinkUrl = ''

$uploadMaxSize

Maximum allowed upload file size.

protected int|string $uploadMaxSize = 0

Set as number or string with unit - "10M", "500K", "1G"

$uploadOrder

Order to validate uploadAllow and uploadDeny

protected array<string|int, mixed> $uploadOrder = array()

Methods

__construct()

Constructor Extend options with required fields.

public __construct() : mixed
Tags
author

Dmitry (dio) Levashov

author

Cem (DiscoFever)

added()

Return list of added files

public added() : array<string|int, mixed>
Tags
deprecated
author

Naoki Sawada

Return values
array<string|int, mixed>

archive()

Add files to archive

public archive( $hashes,  $mime[, string $name = '' ]) : array<string|int, mixed>|bool
Parameters
$hashes :
$mime :
$name : string = ''
Tags
throws
Exception
Return values
array<string|int, mixed>|bool

chmod()

chmod a file or folder

public chmod(string $hash, string $mode) : array<string|int, mixed>|false
Parameters
$hash : string

file or folder hash to chmod

$mode : string

octal string representing new permissions

Tags
author

David Bartle

Return values
array<string|int, mixed>|false

clearcaches()

Clear inner stat caches for target hash

public clearcaches([string $hash = null ]) : mixed
Parameters
$hash : string = null

close()

Close file pointer

public close(resource $fp, string $hash) : void
Parameters
$fp : resource

file pointer

$hash : string

file hash

Tags
author

Dmitry (dio) Levashov

closest()

Return file/dir hash or first founded child hash with required attr == $val

public closest(string $hash, string $attr, bool $val) : string|false
Parameters
$hash : string

file hash

$attr : string

attribute name

$val : bool

attribute value

Tags
author

Dmitry (dio) Levashov

Return values
string|false

commandDisabled()

Return true if command disabled in options

public commandDisabled(string $cmd) : bool
Parameters
$cmd : string

command name

Tags
author

Dmitry (dio) Levashov

Return values
bool

convEncIn()

Converts character encoding from UTF-8 to server's one

public convEncIn([mixed $var = null ][, bool $restoreLocale = false ][, string $unknown = '_' ]) : mixed
Parameters
$var : mixed = null

target string or array var

$restoreLocale : bool = false

do retore global locale, default is false

$unknown : string = '_'

replaces character for unknown

Tags
author

Naoki Sawada

convEncOut()

Converts character encoding from server's one to UTF-8

public convEncOut([mixed $var = null ][, bool $restoreLocale = true ][, string $unknown = '_' ]) : mixed
Parameters
$var : mixed = null

target string or array var

$restoreLocale : bool = true

do retore global locale, default is true

$unknown : string = '_'

replaces character for unknown

Tags
author

Naoki Sawada

copyFromAllowed()

Return true if copy from this volume allowed

public copyFromAllowed() : bool
Tags
author

Dmitry (dio) Levashov

Return values
bool

defaultPath()

Return root or startPath hash

public defaultPath() : string
Tags
author

Dmitry (dio) Levashov

Return values
string

dimensions()

Return image dimensions

public dimensions(string $hash) : array<string|int, mixed>|string
Parameters
$hash : string

file hash

Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|string

driverId()

Return driver id. Used as a part of volume id.

public driverId() : string
Tags
author

Dmitry (dio) Levashov

Return values
string

duplicate()

Create file copy with suffix "copy number" and return its info

public duplicate(string $hash[, string $suffix = 'copy' ]) : array<string|int, mixed>|false
Parameters
$hash : string

file hash

$suffix : string = 'copy'

suffix to add to file name

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|false

error()

Return error message from last failed action

public error() : array<string|int, mixed>
Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>

extract()

Extract files from archive

public extract(string $hash[, null $makedir = null ]) : array<string|int, mixed>|bool
Parameters
$hash : string

archive hash

$makedir : null = null
Tags
author

Dmitry (dio) Levashov,

author

Alexey Sukhotin

Return values
array<string|int, mixed>|bool

ffmpegToImg()

Convert Video To Image by ffmpeg

public ffmpegToImg(string $file, array<string|int, mixed> $stat, object $self[, int $ss = null ]) : bool
Parameters
$file : string

video source file path

$stat : array<string|int, mixed>

file stat array

$self : object

volume driver object

$ss : int = null

start seconds

Tags
throws
elFinderAbortException
author

Naoki Sawada

Return values
bool

fstat()

stat a file or folder for elFinder cmd exec

public fstat(string $hash) : array<string|int, mixed>
Parameters
$hash : string

file or folder hash to chmod

Tags
author

Naoki Sawada

Return values
array<string|int, mixed>

getContents()

Return file contents

public getContents(string $hash) : string|false
Parameters
$hash : string

file hash

Tags
author

Dmitry (dio) Levashov

Return values
string|false

getContentUrl()

Return content URL.

public getContentUrl(string $hash[, array<string|int, mixed> $options = array() ]) : string
Parameters
$hash : string

file hash

$options : array<string|int, mixed> = array()

options

Tags
author

Naoki Sawada

Return values
string

getExtentionByMime()

Return file extention detected by MIME type

public getExtentionByMime(string $mime[, string $suffix = '' ]) : string
Parameters
$mime : string

MIME type

$suffix : string = ''

Additional suffix

Tags
author

Naoki Sawada

Return values
string

getHash()

Return target path hash

public getHash(string $path[, string $name = '' ]) : string
Parameters
$path : string
$name : string = ''
Tags
author

Naoki Sawada

Return values
string

getImageSize()

Get image size array with `dimensions`

public getImageSize(string $path[, string $mime = '' ]) : array<string|int, mixed>|false
Parameters
$path : string

path need convert encoding to server encoding

$mime : string = ''

file mime type

Tags
throws
ImagickException
throws
elFinderAbortException
Return values
array<string|int, mixed>|false

getMimeTable()

Return Extention/MIME Table (elFinderVolumeDriver::$mimetypes)

public getMimeTable() : array<string|int, mixed>
Tags
author

Naoki Sawada

Return values
array<string|int, mixed>

getOption()

Get option value of this volume

public getOption(string $name) : null|mixed
Parameters
$name : string

target option name

Tags
author

Naoki Sawada

Return values
null|mixed

target option value

getOptionsPlugin()

Get plugin values of this options

public getOptionsPlugin([string $name = '' ]) : null|array<string|int, mixed>
Parameters
$name : string = ''

Plugin name

Tags
author

Naoki Sawada

Return values
null|array<string|int, mixed>

Plugin values

getPath()

Return decoded path of target hash This method do not check the stat of target Use method `realpath()` to do check of the stat of target

public getPath(string $hash) : string
Parameters
$hash : string
Tags
author

Naoki Sawada

Return values
string

getSession()

Get elFinder sesson wrapper object

public getSession() : object
Return values
object

The session object

Get URL of substitute image by request args `substitute` or 4th argument $maxSize

public getSubstituteImgLink(string $target, array<string|int, mixed> $srcSize[, resource $srcfp = null ][, int $maxSize = null ]) : bool
Parameters
$target : string

Target hash

$srcSize : array<string|int, mixed>

Size info array [width, height]

$srcfp : resource = null

Source file file pointer

$maxSize : int = null

Maximum pixel of substitute image

Tags
throws
ImagickException
throws
elFinderAbortException
Return values
bool

getTempLinkInfo()

Get temporary contents link infomation

public getTempLinkInfo([string $name = null ]) : bool|array<string|int, mixed>
Parameters
$name : string = null
Tags
author

Naoki Sawada

Return values
bool|array<string|int, mixed>

getUploadMaxSize()

Return this uploadMaxSize value

public getUploadMaxSize() : int
Tags
author

Naoki Sawada

Return values
int

getUploadTaget()

(Make &) Get upload taget dirctory hash

public getUploadTaget(string $baseTargetHash, string $path, array<string|int, mixed> &$result) : bool|string
Parameters
$baseTargetHash : string
$path : string
$result : array<string|int, mixed>
Tags
author

Naoki Sawada

Return values
bool|string

imageUtil()

Image file utility

public imageUtil(string $mode, string $src[, array<string|int, mixed> $options = array() ]) : bool
Parameters
$mode : string

'resize', 'rotate', 'propresize', 'crop', 'fitsquare'

$src : string

Image file local path

$options : array<string|int, mixed> = array()

excute options

Tags
throws
ImagickException
throws
elFinderAbortException
author

Naoki Sawada

Return values
bool

isReadable()

Return true if voume is readable.

public isReadable() : bool
Tags
author

Dmitry (dio) Levashov

Return values
bool

isUploadableByName()

Return is uploadable that given file name

public isUploadableByName(string $name[, bool $allowUnknown = false ]) : bool
Parameters
$name : string

file name

$allowUnknown : bool = false
Tags
author

Naoki Sawada

Return values
bool

ls()

Return dir files names list

public ls(string $hash[, null $intersect = null ]) : array<string|int, mixed>|false
Parameters
$hash : string

file hash

$intersect : null = null
Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|false

mimeAccepted()

Return true if mime is required mimes list

public mimeAccepted(string $mime[, array<string|int, mixed> $mimes = null ][, bool|null $empty = true ]) : bool|null
Parameters
$mime : string

mime type to check

$mimes : array<string|int, mixed> = null

allowed mime types list or not set to use client mimes list

$empty : bool|null = true

what to return on empty list

Tags
author

Dmitry (dio) Levashov

author

Troex Nevelin

Return values
bool|null

mimeTypeNormalize()

Normalize MIME-Type by options['mimeMap']

public mimeTypeNormalize(string $type, string $name[, string $ext = '' ]) : string
Parameters
$type : string

MIME-Type

$name : string

Filename

$ext : string = ''

File extention without first dot (optional)

Return values
string

Normalized MIME-Type

mkdir()

Create directory and return dir info

public mkdir(string $dsthash, string $name) : array<string|int, mixed>|false
Parameters
$dsthash : string

destination directory hash

$name : string

directory name

Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|false

mkfile()

Create empty file and return its info

public mkfile(string $dst, string $name) : array<string|int, mixed>|false
Parameters
$dst : string

destination directory

$name : string

file name

Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|false

mount()

"Mount" volume.

public mount(array<string|int, mixed> $opts) : bool

Return true if volume available for read or write, false - otherwise

Parameters
$opts : array<string|int, mixed>
Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Alexey Sukhotin

Return values
bool

netmountPrepare()

public netmountPrepare(array<string|int, mixed> $options) : void
Parameters
$options : array<string|int, mixed>

netmountPrepare()

Prepare Call from elFinder::netmout() before volume->mount().

public netmountPrepare(mixed $options) : array<string|int, mixed>
Parameters
$options : mixed
Tags
author

Naoki Sawada

author

Raja Sharma updating for OneDrive

Return values
array<string|int, mixed>

netunmount()

process of on netunmount Drop `onedrive` & rm thumbs.

public netunmount(mixed $netVolumes, mixed $key) : bool
Parameters
$netVolumes : mixed
$key : mixed
Return values
bool

open()

Open file for reading and return file pointer

public open(mixed $hash) : resource|false
Parameters
$hash : mixed
Tags
author

Dmitry (dio) Levashov

Return values
resource|false

options()

Return volume options required by client:

public options( $hash) : array<string|int, mixed>
Parameters
$hash :
Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>

parents()

Return part of dirs tree from required dir up to root dir

public parents(string $hash[, bool|null $lineal = false ]) : array<string|int, mixed>|false
Parameters
$hash : string

directory hash

$lineal : bool|null = false

only lineal parents

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|false

path()

Return file path related to root with convert encoging

public path(string $hash) : string
Parameters
$hash : string

file hash

Tags
author

Dmitry (dio) Levashov

Return values
string

postNetmount()

public postNetmount(array<string|int, mixed> $options) : void
Parameters
$options : array<string|int, mixed>

putContents()

Put content in text file and return file info.

public putContents(string $hash, string $content) : array<string|int, mixed>|false
Parameters
$hash : string

file hash

$content : string

new file content

Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|false

realpath()

Return file real path if file exists

public realpath(string $hash) : string
Parameters
$hash : string

file hash

Tags
author

Dmitry (dio) Levashov

Return values
string

| false

removed()

Return list of moved/overwrited files

public removed() : array<string|int, mixed>
Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>

rename()

Rename file and return file info

public rename(string $hash, string $name) : array<string|int, mixed>|false
Parameters
$hash : string

file hash

$name : string

new file name

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|false

resize()

Resize image

public resize(string $hash, int $width, int $height, int $x, int $y[, string $mode = 'resize' ][, string $bg = '' ][, int $degree = 0 ][, int $jpgQuality = null ]) : array<string|int, mixed>|false
Parameters
$hash : string

image file

$width : int

new width

$height : int

new height

$x : int

X start poistion for crop

$y : int

Y start poistion for crop

$mode : string = 'resize'

action how to mainpulate image

$bg : string = ''

background color

$degree : int = 0

rotete degree

$jpgQuality : int = null

JEPG quality (1-100)

Tags
throws
ImagickException
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Alexey Sukhotin

author

nao-pon

author

Troex Nevelin

Return values
array<string|int, mixed>|false

rm()

Remove file/dir

public rm(string $hash) : bool
Parameters
$hash : string

file hash

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
bool

rmdirRecursive()

Remove directory recursive on local file system

public rmdirRecursive(string $dir) : bool
Parameters
$dir : string

Target dirctory path

Tags
throws
elFinderAbortException
author

Naoki Sawada

Return values
bool

saveSessionCache()

Save session cache data Calls this function before umount this volume on elFinder::exec()

public saveSessionCache() : void

scandir()

Return directory content or false on error

public scandir(string $hash) : array<string|int, mixed>|false
Parameters
$hash : string

file hash

Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|false

Search files

public search(string $q, array<string|int, mixed> $mimes[, null $hash = null ]) : array<string|int, mixed>
Parameters
$q : string

search string

$mimes : array<string|int, mixed>
$hash : null = null
Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>

setMimesFilter()

Set mimetypes allowed to display to client

public setMimesFilter(array<string|int, mixed> $mimes) : void
Parameters
$mimes : array<string|int, mixed>
Tags
author

Dmitry (dio) Levashov

setNeedOnline()

Sets the need online.

public setNeedOnline([bool $state = null ]) : mixed
Parameters
$state : bool = null

The state

setSession()

Assign elFinder session wrapper object

public setSession( $session) : mixed
Parameters
$session :

elFinderSessionInterface

size()

Return file size / total directory size

public size(mixed $hash) : array<string|int, mixed>
Parameters
$hash : mixed
Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>

subdirs()

Return has subdirs

public subdirs(string $hash) : bool
Parameters
$hash : string

file hash

Tags
author

Naoki Sawada

Return values
bool

tmb()

Create thumbnail for required file and return its name or false on failed

public tmb( $hash) : false|string
Parameters
$hash :
Tags
throws
ImagickException
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
false|string

tmpfile()

Creates a temporary file and return file pointer

public tmpfile() : resource|bool
Return values
resource|bool

tree()

Return subfolders for required folder or false on error

public tree([string $hash = '' ][, int $deep = 0 ][, string $exclude = '' ]) : array<string|int, mixed>|false
Parameters
$hash : string = ''

folder hash or empty string to get tree from root folder

$deep : int = 0

subdir deep

$exclude : string = ''

dir hash which subfolders must be exluded from result, required to not get stat twice on cwd subfolders

Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|false

zipdl()

Return path info array to archive of target items

public zipdl(array<string|int, mixed> $hashes) : array<string|int, mixed>|false
Parameters
$hashes : array<string|int, mixed>
Tags
throws
Exception
author

Naoki Sawada

Return values
array<string|int, mixed>|false

_abspath()

Convert path related to root dir into real path.

protected _abspath(string $path) : string
Parameters
$path : string

file path

Tags
author

Dmitry (dio) Levashov

Return values
string

_archive()

Create archive and return its path.

protected _archive(string $dir, array<string|int, mixed> $files, string $name, array<string|int, mixed> $arc) : string|bool
Parameters
$dir : string

target dir

$files : array<string|int, mixed>

files names list

$name : string

archive name

$arc : array<string|int, mixed>

archiver options

Tags
author

Dmitry (dio) Levashov,

author

Alexey Sukhotin

Return values
string|bool

_basename()

Return file name.

protected _basename(string $path) : string
Parameters
$path : string

file path

Tags
author

Dmitry (dio) Levashov

Return values
string

_chmod()

chmod implementation.

protected _chmod(mixed $path, mixed $mode) : bool
Parameters
$path : mixed

file path

$mode : mixed

octal string such as '0755'

Return values
bool

_copy()

Copy file into another file.

protected _copy(string $source, string $targetDir, string $name) : bool
Parameters
$source : string

source file path

$targetDir : string

target directory path

$name : string

new file name

Tags
author

Dmitry (dio) Levashov

Return values
bool

_dimensions()

Return object width and height Ususaly used for images, but can be realize for video etc.

protected _dimensions(string $path, string $mime) : string

..

Parameters
$path : string

file path

$mime : string

file mime type

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
string

_dirname()

Return parent directory path.

protected _dirname(string $path) : string
Parameters
$path : string

file path

Tags
author

Dmitry (dio) Levashov

Return values
string

_extract()

Extract files from archive.

protected _extract(string $path, array<string|int, mixed> $arc) : void
Parameters
$path : string

archive path

$arc : array<string|int, mixed>

archiver command and arguments (same as in $this->archivers)

Tags
author

Dmitry (dio) Levashov,

author

Alexey Sukhotin

_fclose()

Close opened file.

protected _fclose(resource $fp[, mixed $path = '' ]) : bool
Parameters
$fp : resource

file pointer

$path : mixed = ''

file path

Tags
author

Dmitry (dio) Levashov

Return values
bool

_filePutContents()

Write a string to a file.

protected _filePutContents(string $path, string $content) : bool
Parameters
$path : string

file path

$content : string

new file content

Tags
author

Dmitry (dio) Levashov

Return values
bool

_fopen()

Open file and return file pointer.

protected _fopen(string $path[, mixed $mode = 'rb' ]) : resource|false
Parameters
$path : string

file path

$mode : mixed = 'rb'

open mode

Tags
author

Dmitry (dio) Levashov

Return values
resource|false

_getContents()

Get file contents.

protected _getContents(string $path) : string|false
Parameters
$path : string

file path

Tags
author

Dmitry (dio) Levashov

Return values
string|false

_inpath()

Return true if $path is children of $parent.

protected _inpath(string $path, string $parent) : bool
Parameters
$path : string

path to check

$parent : string

parent path

Tags
author

Dmitry (dio) Levashov

Return values
bool

_joinPath()

Join dir name and file name and retur full path.

protected _joinPath(string $dir, string $name) : string
Parameters
$dir : string
$name : string
Tags
author

Dmitry (dio) Levashov

Return values
string

_mkdir()

Create dir and return created dir path or false on failed.

protected _mkdir(string $path, string $name) : string|bool
Parameters
$path : string

parent dir path

$name : string

new directory name

Tags
author

Dmitry (dio) Levashov

Return values
string|bool

_mkfile()

Create file and return it's path or false on failed.

protected _mkfile(string $path, string $name) : string|bool
Parameters
$path : string

parent dir path

$name : string

new file name

Tags
author

Dmitry (dio) Levashov

Return values
string|bool

_move()

Move file into another parent dir.

protected _move(string $source,  $targetDir, string $name) : string|bool

Return new file path or false.

Parameters
$source : string

source file path

$targetDir :
$name : string

file name

Tags
author

Dmitry (dio) Levashov

Return values
string|bool

_normpath()

Return normalized path, this works the same as os.path.normpath() in Python.

protected _normpath(string $path) : string
Parameters
$path : string

path

Tags
author

Troex Nevelin

Return values
string

_od_createCurl()

Creates a base cURL object which is compatible with the OneDrive API.

protected _od_createCurl(string $path[, bool $contents = false ]) : resource
Parameters
$path : string

The path of the API call (eg. me/skydrive)

$contents : bool = false
Tags
throws
elFinderAbortException
Return values
resource

A compatible cURL object

_od_getATokenFile()

Get AccessToken file path

protected _od_getATokenFile() : string
Return values
string

( description_of_the_return_value )

_od_getChunkData()

Get chunk data by file pointer to upload session.

protected _od_getChunkData(resource $fp) : bool|string
Parameters
$fp : resource

source file pointer

Return values
bool|string

chunked data

_od_getFileRaw()

Get raw data(onedrive metadata) from OneDrive.

protected _od_getFileRaw(string $path) : array<string|int, mixed>|object
Parameters
$path : string
Return values
array<string|int, mixed>|object

onedrive metadata

_od_getThumbnail()

Get thumbnail from OneDrive.com.

protected _od_getThumbnail(string $path) : string
Parameters
$path : string
Return values
string

| boolean

_od_obtainAccessToken()

Obtains a new access token from OAuth. This token is valid for one hour.

protected _od_obtainAccessToken( $client_id,  $client_secret, string $code, mixed $nodeid) : object|string
Parameters
$client_id :
$client_secret :
$code : string

The code returned by OneDrive after successful log in

$nodeid : mixed
Tags
throws
Exception

Thrown if the redirect URI of this Client instance's state is not set

Return values
object|string

_od_parseRaw()

Parse line from onedrive metadata output and return file stat (array).

protected _od_parseRaw(object $raw) : array<string|int, mixed>
Parameters
$raw : object

line from ftp_rawlist() output

Tags
author

Dmitry Levashov

Return values
array<string|int, mixed>

_od_prepareCurl()

Creates a base cURL object which is compatible with the OneDrive API.

protected _od_prepareCurl([mixed $url = null ]) : resource
Parameters
$url : mixed = null
Return values
resource

A compatible cURL object

_od_query()

Drive query and fetchAll.

protected _od_query( $itemId[, bool $fetch_self = false ][, bool $recursive = false ][, array<string|int, mixed> $options = array() ]) : object|array<string|int, mixed>
Parameters
$itemId :
$fetch_self : bool = false
$recursive : bool = false
$options : array<string|int, mixed> = array()
Tags
throws
elFinderAbortException
Return values
object|array<string|int, mixed>

_od_refreshToken()

Get token and auto refresh.

protected _od_refreshToken() : true
Tags
throws
Exception
Return values
true

_od_splitPath()

Get Parent ID, Item ID, Parent Path as an array from path.

protected _od_splitPath(string $path) : array<string|int, mixed>
Parameters
$path : string
Return values
array<string|int, mixed>

_od_uploadSession()

Upload large files with an upload session.

protected _od_uploadSession(resource $fp, number $size, string $name, string $itemId, string $parent, string $parentId) : string
Parameters
$fp : resource

source file pointer

$size : number

total size

$name : string

item name

$itemId : string

item identifier

$parent : string

parent

$parentId : string

parent identifier

Return values
string

The item path

_path()

Return fake path started from root dir.

protected _path(string $path) : string
Parameters
$path : string

file path

Tags
author

Dmitry (dio) Levashov

Return values
string

_relpath()

Return file path related to root dir.

protected _relpath(string $path) : string
Parameters
$path : string

file path

Tags
author

Dmitry (dio) Levashov

Return values
string

_rmdir()

Remove dir.

protected _rmdir(string $path) : bool
Parameters
$path : string

dir path

Tags
author

Dmitry (dio) Levashov

Return values
bool

_save()

Create new file and write into it from file pointer.

protected _save(resource $fp,  $path, string $name, array<string|int, mixed> $stat) : bool|string

Return new file path or false on error.

Parameters
$fp : resource

file pointer

$path :
$name : string

file name

$stat : array<string|int, mixed>

file stat (required by some virtual fs)

Tags
author

Dmitry (dio) Levashov

Return values
bool|string

_scandir()

Return files list in directory.

protected _scandir(string $path) : array<string|int, mixed>
Parameters
$path : string

dir path

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Cem (DiscoFever)

Return values
array<string|int, mixed>

_stat()

Return stat for given path.

protected _stat(string $path) : array<string|int, mixed>|false

Stat contains following fields:

  • (int) size file size in b. required
  • (int) ts file modification time in unix time. required
  • (string) mime mimetype. required for folders, others - optionally
  • (bool) read read permissions. required
  • (bool) write write permissions. required
  • (bool) locked is object locked. optionally
  • (bool) hidden is object hidden. optionally
  • (string) alias for symlinks - link target path relative to root path. optionally
  • (string) target for symlinks - link target path. optionally. If file does not exists - returns empty array or false.
Parameters
$path : string

file path

Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|false

_subdirs()

Return true if path is dir and has at least one childs directory.

protected _subdirs(string $path) : bool
Parameters
$path : string

dir path

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
bool

Create symlink. FTP driver does not support symlinks.

protected _symlink(string $target, string $path, mixed $name) : bool
Parameters
$target : string

link target

$path : string

symlink path

$name : mixed

symlink name

Tags
author

Dmitry (dio) Levashov

Return values
bool

Remove file.

protected _unlink(string $path) : bool
Parameters
$path : string

file path

Tags
author

Dmitry (dio) Levashov

Return values
bool

_unpack()

Unpack archive.

protected _unpack(string $path, array<string|int, mixed> $arc) : void
Parameters
$path : string

archive path

$arc : array<string|int, mixed>

archiver command and arguments (same as in $this->archivers)

Tags
author

Dmitry (dio) Levashov

author

Alexey Sukhotin

abspathCE()

Convert path related to root dir into real path (with convert encoding)

protected abspathCE(string $path) : string
Parameters
$path : string

rel file path

Tags
author

Naoki Sawada

Return values
string

addError()

Add error message

protected addError() : false
Tags
author

Dmitry(dio) Levashov

Return values
false

allowCreate()

Return true if file with given name can be created in given folder.

protected allowCreate(string $dir, string $name[, null $isDir = null ]) : bool
Parameters
$dir : string

parent dir path

$name : string

new file name

$isDir : null = null
Tags
author

Dmitry (dio) Levashov

Return values
bool

allowPutMime()

Return true if file MIME type can save with check uploadOrder config.

protected allowPutMime(string $mime) : bool
Parameters
$mime : string
Return values
bool

attr()

Check file attribute

protected attr(string $path, string $name[, bool $val = null ][, bool $isDir = null ]) : bool
Parameters
$path : string

file path

$name : string

attribute name (read|write|locked|hidden)

$val : bool = null

attribute value returned by file system

$isDir : bool = null

path is directory (true: directory, false: file)

Tags
author

Dmitry (dio) Levashov

Return values
bool

basenameCE()

Return file name (with convert encoding)

protected basenameCE(string $path) : string
Parameters
$path : string

file path

Tags
author

Naoki Sawada

Return values
string

cacheDir()

Cache dir contents.

protected cacheDir(string $path) : array<string|int, mixed>
Parameters
$path : string

dir path

Tags
throws
elFinderAbortException
author

Dmitry Levashov

Return values
array<string|int, mixed>

canCreateTmb()

Return true if thumnbnail for required file can be created

protected canCreateTmb(string $path, array<string|int, mixed> $stat[, bool $checkTmbPath = true ]) : string|bool
Parameters
$path : string

thumnbnail path

$stat : array<string|int, mixed>

file stat

$checkTmbPath : bool = true
Tags
author

Dmitry (dio) Levashov

Return values
string|bool

canResize()

Return true if required file can be resized.

protected canResize(string $path, array<string|int, mixed> $stat) : string|bool

By default - the same as canCreateTmb

Parameters
$path : string

thumnbnail path

$stat : array<string|int, mixed>

file stat

Tags
author

Dmitry (dio) Levashov

Return values
string|bool

checkExtractItems()

Check and filter the extracted items

protected checkExtractItems(string $path[, array<string|int, mixed> $checks = null ]) : array<string|int, mixed>
Parameters
$path : string

target local path

$checks : array<string|int, mixed> = null

types to check default: ['symlink', 'name', 'writable', 'mime']

Tags
throws
elFinderAbortException
throws
Exception
author

Naoki Sawada

Return values
array<string|int, mixed>

['symlinks' => [], 'names' => [], 'writables' => [], 'mimes' => [], 'rmNames' => [], 'totalSize' => 0]

childsByAttr()

Return first found children with required attr == $val

protected childsByAttr(string $path, string $attr, bool $val) : string|false
Parameters
$path : string

file path

$attr : string

attribute name

$val : bool

attribute value

Tags
author

Dmitry (dio) Levashov

Return values
string|false

closestByAttr()

If file has required attr == $val - return file path, If dir has child with has required attr == $val - return child path

protected closestByAttr(string $path, string $attr, bool $val) : string|false
Parameters
$path : string

file path

$attr : string

attribute name

$val : bool

attribute value

Tags
author

Dmitry (dio) Levashov

Return values
string|false

convEnc()

Converts character encoding (base function)

protected convEnc(mixed $var, string $from, string $to, string $locale,  $restoreLocale[, string $unknown = '_' ]) : mixed
Parameters
$var : mixed

target string or array var

$from : string

from character encoding

$to : string

to character encoding

$locale : string

local locale

$restoreLocale :
$unknown : string = '_'

replaces character for unknown

copy()

Copy file/recursive copy dir only in current volume.

protected copy(string $src, string $dst, string $name) : string|false

Return new file path or false.

Parameters
$src : string

source path

$dst : string

destination dir path

$name : string

new file name (optionaly)

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Naoki Sawada

Return values
string|false

copyFrom()

Copy file from another volume.

protected copyFrom(object $volume, string $src, string $destination, string $name) : string|false

Return new file path or false.

Parameters
$volume : object

source volume

$src : string

source file hash

$destination : string

destination dir path

$name : string

file name

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
string|false

countSize()

Return file/total directory size infomation

protected countSize(string $path) : array<string|int, mixed>
Parameters
$path : string

file path

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>

createTmb()

Create thumnbnail and return it's URL on success.

protected createTmb(string $path,  $stat) : string|false
Parameters
$path : string

file path

$stat :
Tags
throws
ImagickException
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Naoki Sawada

Return values
string|false

crypt()

Return crypted path Not implemented

protected crypt(mixed $path) : mixed
Parameters
$path : mixed
Tags
author

Dmitry (dio) Levashov

decode()

Decode path from hash

protected decode(mixed $hash) : string
Parameters
$hash : mixed
Tags
author

Dmitry (dio) Levashov

author

Troex Nevelin

Return values
string

delTree()

Delete dirctory trees

protected delTree(string $localpath) : bool
Parameters
$localpath : string

path need convert encoding to server encoding

Tags
throws
elFinderAbortException
author

Naoki Sawada

Return values
bool

dirnameCE()

Return parent directory path (with convert encoding)

protected dirnameCE(string $path) : string
Parameters
$path : string

file path

Tags
author

Naoki Sawada

Return values
string

doSearch()

Recursive files search

protected doSearch(string $path, string $q, array<string|int, mixed> $mimes) : array<string|int, mixed>
Parameters
$path : string

dir path

$q : string

search string

$mimes : array<string|int, mixed>
Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>

encode()

Encode path into hash

protected encode(mixed $path) : string
Parameters
$path : mixed
Tags
author

Dmitry (dio) Levashov

author

Troex Nevelin

Return values
string

fcloseCE()

Close opened file (with convert encoding)

protected fcloseCE(resource $fp[, string $path = '' ]) : bool
Parameters
$fp : resource

file pointer

$path : string = ''

file path

Tags
author

Naoki Sawada

Return values
bool

gdImage()

Output gd image to file

protected gdImage(resource $image, string $filename, string $destformat, string $mime[, int $jpgQuality = null ]) : bool
Parameters
$image : resource

gd image resource

$filename : string

The path to save the file to.

$destformat : string

The Image type to use for $filename

$mime : string

The original image mime type

$jpgQuality : int = null

JEPG quality (1-100)

Return values
bool

gdImageBackground()

Assign the proper background to a gd image

protected gdImageBackground(resource $image, string $bgcolor) : mixed
Parameters
$image : resource

gd image resource

$bgcolor : string

background color in #rrggbb format

gdImageCreate()

Create an gd image according to the specified mime type

protected gdImageCreate(string $path, string $mime) : resource|false
Parameters
$path : string

image file

$mime : string
Return values
resource|false

GD image resource identifier

getArchivers()

Get server side available archivers

protected getArchivers([bool $use_cache = true ]) : array<string|int, mixed>
Parameters
$use_cache : bool = true
Tags
throws
elFinderAbortException
Return values
array<string|int, mixed>

getFullPath()

Resolve relative / (Unix-like)absolute path

protected getFullPath(string $path, string $base) : string
Parameters
$path : string

target path

$base : string

base path

Return values
string

getItemsInHand()

Copy items to a new temporary directory on the local server

protected getItemsInHand(array<string|int, mixed> $hashes[, string $dir = null ][, string $canLink = null ]) : string|false
Parameters
$hashes : array<string|int, mixed>

target hashes

$dir : string = null

destination directory (for recurcive)

$canLink : string = null

it can use link() (for recurcive)

Tags
throws
elFinderAbortException
author

Naoki Sawada

Return values
string|false

saved path name

getRootstatCachekey()

Return session rootstat cache key

protected getRootstatCachekey() : string
Return values
string

getRootStatExtra()

Get root stat extra key values

protected getRootStatExtra() : array<string|int, mixed>
Tags
author

Naoki Sawada

Return values
array<string|int, mixed>

stat extras

getScandir()

Return required dir's files info.

protected getScandir(string $path) : array<string|int, mixed>

If onlyMimes is set - return only dirs and files of required mimes

Parameters
$path : string

dir path

Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>

getTempFile()

Get temporary filename. Tempfile will be removed when after script execution finishes or exit() is called.

protected getTempFile([string $path = '' ]) : string|false

When needing the unique file to a path, give $path to parameter.

Parameters
$path : string = ''

for get unique file to a path

Tags
author

Naoki Sawada

Return values
string|false

gettmb()

Return thumnbnail name if exists

protected gettmb(string $path, array<string|int, mixed> $stat) : string|false
Parameters
$path : string

file path

$stat : array<string|int, mixed>

file stat

Tags
author

Dmitry (dio) Levashov

Return values
string|false

gettree()

Return subdirs tree

protected gettree(string $path, int $deep[, string $exclude = '' ]) : array<string|int, mixed>
Parameters
$path : string

parent dir path

$deep : int

tree deep

$exclude : string = ''
Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>

getWorkFile()

File path of local server side work file path

protected getWorkFile(string $path) : string
Parameters
$path : string

path need convert encoding to server encoding

Tags
author

Naoki Sawada

Return values
string

imageMagickConvertPrepare()

Prepare variables for exec convert of ImageMagick

protected imageMagickConvertPrepare(string $path, string $destformat, int $jpgQuality[, array<string|int, mixed> $imageSize = null ][, null $mime = null ]) : array<string|int, mixed>
Parameters
$path : string
$destformat : string
$jpgQuality : int
$imageSize : array<string|int, mixed> = null
$mime : null = null
Tags
throws
elFinderAbortException
Return values
array<string|int, mixed>

imagickImage()

Output imagick image to file

protected imagickImage(imagick $img, string $filename, string $destformat[, int $jpgQuality = null ]) : bool
Parameters
$img : imagick

imagick image resource

$filename : string

The path to save the file to.

$destformat : string

The Image type to use for $filename

$jpgQuality : int = null

JEPG quality (1-100)

Return values
bool

imgCrop()

Crop image

protected imgCrop(string $path, int $width, int $height, bool $x, bool $y[, string $destformat = null ][, int $jpgQuality = null ]) : string|false
Parameters
$path : string

image file

$width : int

crop width

$height : int

crop height

$x : bool

crop left offset

$y : bool

crop top offset

$destformat : string = null

image destination format

$jpgQuality : int = null

JEPG quality (1-100)

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Alexey Sukhotin

Return values
string|false

imgResize()

Resize image

protected imgResize(string $path, int $width, int $height[, bool $keepProportions = false ][, bool $resizeByBiggerSide = true ][, string $destformat = null ][, int $jpgQuality = null ][, array<string|int, mixed> $options = array() ]) : string|false
Parameters
$path : string

image file

$width : int

new width

$height : int

new height

$keepProportions : bool = false

crop image

$resizeByBiggerSide : bool = true

resize image based on bigger side if true

$destformat : string = null

image destination format

$jpgQuality : int = null

JEPG quality (1-100)

$options : array<string|int, mixed> = array()

Other extra options

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Alexey Sukhotin

Return values
string|false

imgRotate()

Rotate image

protected imgRotate(string $path, int $degree[, string $bgcolor = '#ffffff' ][, string $destformat = null ][, int $jpgQuality = null ]) : string|false
Parameters
$path : string

image file

$degree : int

rotete degrees

$bgcolor : string = '#ffffff'

square background color in #rrggbb format

$destformat : string = null

image destination format

$jpgQuality : int = null

JEPG quality (1-100)

Tags
throws
elFinderAbortException
author

nao-pon

author

Troex Nevelin

Return values
string|false

imgSquareFit()

Put image to square

protected imgSquareFit(string $path, int $width, int $height[, int|string $align = 'center' ][, int|string $valign = 'middle' ][, string $bgcolor = '#0000ff' ][, string $destformat = null ][, int $jpgQuality = null ]) : false|string
Parameters
$path : string

image file

$width : int

square width

$height : int

square height

$align : int|string = 'center'

reserved

$valign : int|string = 'middle'

reserved

$bgcolor : string = '#0000ff'

square background color in #rrggbb format

$destformat : string = null

image destination format

$jpgQuality : int = null

JEPG quality (1-100)

Tags
throws
ImagickException
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Alexey Sukhotin

Return values
false|string

init()

Prepare FTP connection Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn.

protected init() : bool
Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Cem (DiscoFever)

Return values
bool

inpathCE()

Return true if $path is children of $parent (with convert encoding)

protected inpathCE(string $path, string $parent) : bool
Parameters
$path : string

path to check

$parent : string

parent path

Tags
author

Naoki Sawada

Return values
bool

isMyReload()

protected isMyReload([mixed $target = '' ][, mixed $ARGtarget = '' ]) : mixed
Parameters
$target : mixed = ''
$ARGtarget : mixed = ''

isNameExists()

Return fileinfo based on filename For item ID based path file system Please override if needed on each drivers

protected isNameExists(mixed $path) : array<string|int, mixed>
Parameters
$path : mixed

file cache

Return values
array<string|int, mixed>

isSameType()

Return true if all mimes is directory or files

protected isSameType(string $mime1, string $mime2) : bool
Parameters
$mime1 : string

mimetype

$mime2 : string

mimetype

Tags
author

Dmitry (dio) Levashov

Return values
bool

joinPathCE()

Join dir name and file name and return full path. (with convert encoding) Some drivers (db) use int as path - so we give to concat path to driver itself

protected joinPathCE(string $dir, string $name) : string
Parameters
$dir : string

dir path

$name : string

file name

Tags
author

Naoki Sawada

Return values
string

loadMimeTypes()

Load file of mime.types

protected static loadMimeTypes([string $mimeTypesFile = '' ]) : mixed
Parameters
$mimeTypesFile : string = ''

The mime types file

Recursive symlinks search

protected static localFindSymlinks(string $path) : bool
Parameters
$path : string

file/dir path

Tags
throws
Exception
author

Dmitry (dio) Levashov

Return values
bool

localMoveRecursive()

Move item recursive on local file system

protected static localMoveRecursive(string $src, string $target[, bool $overWrite = true ][, bool $copyJoin = true ]) : bool
Parameters
$src : string
$target : string
$overWrite : bool = true
$copyJoin : bool = true
Tags
throws
elFinderAbortException
throws
Exception
author

Naoki Sawada

Return values
bool

localRmdirRecursive()

Remove directory recursive on local file system

protected static localRmdirRecursive(string $dir) : bool
Parameters
$dir : string

Target dirctory path

Tags
throws
elFinderAbortException
author

Naoki Sawada

Return values
bool

localScandir()

Return files of target directory that is dotfiles excludes.

protected static localScandir(string $dir) : array<string|int, mixed>
Parameters
$dir : string

target directory path

Tags
throws
Exception
author

Naoki Sawada

Return values
array<string|int, mixed>

makeArchive()

Create archive and return its path

protected makeArchive(string $dir, array<string|int, mixed> $files, string $name, array<string|int, mixed> $arc) : string|bool
Parameters
$dir : string

target dir

$files : array<string|int, mixed>

files names list

$name : string

archive name

$arc : array<string|int, mixed>

archiver options

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov,

author

Alexey Sukhotin

author

Naoki Sawada

Return values
string|bool

mimetype()

Return file mimetype

protected mimetype(string $path[, string|bool $name = '' ][, int $size = null ][, string $mime = null ]) : string
Parameters
$path : string

file path

$name : string|bool = ''
$size : int = null
$mime : string = null

was notified from the volume driver

Tags
author

Dmitry (dio) Levashov

Return values
string

mimetypeInternalDetect()

Detect file mimetype using "internal" method or Loading mime.types with $path = ''

protected static mimetypeInternalDetect([string $path = '' ]) : string
Parameters
$path : string = ''

file path

Tags
author

Dmitry (dio) Levashov

Return values
string

move()

Move file Return new file path or false.

protected move(string $src, string $dst, string $name) : string|false
Parameters
$src : string

source path

$dst : string

destination dir path

$name : string

new file name

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

Return values
string|false

nameAccepted()

Validate file name based on $this->options['acceptedName'] regexp or function

protected nameAccepted(string $name[, bool $isDir = false ]) : bool
Parameters
$name : string

file name

$isDir : bool = false
Tags
author

Dmitry (dio) Levashov

Return values
bool

normpathCE()

Return normalized path (with convert encoding)

protected normpathCE(string $path) : string
Parameters
$path : string

file path

Tags
author

Naoki Sawada

Return values
string

procExec()

Execute shell command

protected procExec(string $command[, string &$output = '' ][, int &$return_var = -1 ][, string &$error_output = '' ][, mixed $cwd = null ]) : int
Parameters
$command : string

command line

$output : string = ''

stdout strings

$return_var : int = -1

process exit code

$error_output : string = ''

stderr strings

$cwd : mixed = null
Tags
throws
elFinderAbortException
author

Alexey Sukhotin

Return values
int

exit code

relpathCE()

Return file path related to root dir (with convert encoding)

protected relpathCE(string $path) : string
Parameters
$path : string

file path

Tags
author

Naoki Sawada

Return values
string

remoteArchive()

Create an archive from remote items

protected remoteArchive(array<string|int, mixed> $hashes, string $name, array<string|int, mixed> $arc) : string|bool
Parameters
$hashes : array<string|int, mixed>

files hashes list

$name : string

archive name

$arc : array<string|int, mixed>

archiver options

Tags
throws
Exception
Return values
string|bool

path of created archive

remove()

Remove file/ recursive remove dir.

protected remove(string $path[, bool $force = false ]) : bool
Parameters
$path : string

file path

$force : bool = false

try to remove even if file locked

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Naoki Sawada

Return values
bool

rmTmb()

Remove thumbnail, also remove recursively if stat is directory

protected rmTmb(array<string|int, mixed> $stat) : void
Parameters
$stat : array<string|int, mixed>

file stat

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Naoki Sawada

author

Troex Nevelin

saveCE()

Create new file and write into it from file pointer. (with convert encoding) Return new file path or false on error.

protected saveCE(resource $fp, string $dir, string $name, array<string|int, mixed> $stat) : bool|string
Parameters
$fp : resource

file pointer

$dir : string

target dir path

$name : string

file name

$stat : array<string|int, mixed>

file stat (required by some virtual fs)

Tags
author

Naoki Sawada

Return values
bool|string

scandirCE()

Return files list in directory (with convert encoding)

protected scandirCE(string $path) : array<string|int, mixed>
Parameters
$path : string

dir path

Tags
author

Naoki Sawada

Return values
array<string|int, mixed>

searchMatchName()

Default serach match method (name match)

protected searchMatchName(string $name, string $query, string $path) : bool
Parameters
$name : string

Item name

$query : string

Query word

$path : string

Item path

Return values
bool

@return bool

setError()

Save error message

protected setError() : bool
Tags
author

Naoki Sawada

Return values
bool

false

stat()

Return fileinfo

protected stat(string $path) : array<string|int, mixed>|bool
Parameters
$path : string

file cache

Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>|bool

stripos()

Find position of first occurrence of string in a string with multibyte support

protected stripos(string $haystack, string $needle[, int $offset = 0 ]) : int|bool
Parameters
$haystack : string

The string being checked.

$needle : string

The string to find in haystack.

$offset : int = 0

The search offset. If it is not specified, 0 is used.

Tags
author

Alexey Sukhotin

Return values
int|bool

subdirsCE()

Return true if path is dir and has at least one childs directory (with convert encoding)

protected subdirsCE(string $path) : bool
Parameters
$path : string

dir path

Tags
author

Naoki Sawada

Return values
bool

symlinkCE()

Create symlink (with convert encoding)

protected symlinkCE(string $source, string $targetDir, string $name) : bool
Parameters
$source : string

file to link to

$targetDir : string

folder to create link in

$name : string

symlink name

Tags
author

Naoki Sawada

Return values
bool

tmbname()

Return thumbnail file name for required file.

protected tmbname(array<string|int, mixed> $stat) : string
Parameters
$stat : array<string|int, mixed>

file stat

Tags
author

Dmitry (dio) Levashov

Return values
string

uncrypt()

Return uncrypted path Not implemented

protected uncrypt(mixed $hash) : mixed
Parameters
$hash : mixed
Tags
author

Dmitry (dio) Levashov

unpackArchive()

Unpack archive

protected unpackArchive(string $path, array<string|int, mixed> $arc[, bool|string $mode = true ]) : void
Parameters
$path : string

archive path

$arc : array<string|int, mixed>

archiver command and arguments (same as in $this->archivers)

$mode : bool|string = true

bool: remove archive ( unlink($path) ) | string: extract to directory

Tags
throws
elFinderAbortException
author

Dmitry (dio) Levashov

author

Alexey Sukhotin

author

Naoki Sawada

updateCache()

Put file stat in cache and return it

protected updateCache(string $path, array<string|int, mixed> $stat) : array<string|int, mixed>
Parameters
$path : string

file path

$stat : array<string|int, mixed>

file stat

Tags
author

Dmitry (dio) Levashov

Return values
array<string|int, mixed>

updateSubdirsCache()

Update subdirs cache data

protected updateSubdirsCache(string $path, bool $subdirs) : void
Parameters
$path : string
$subdirs : bool

zipArchiveUnzip()

Unpack Zip archive using PHP class ZipArchive

protected static zipArchiveUnzip(string $zipPath, string $toDir) : bool
Parameters
$zipPath : string

Zip archive name

$toDir : string

Extract to path

Tags
author

Naoki Sawada

Return values
bool

zipArchiveZip()

Create Zip archive using PHP class ZipArchive

protected static zipArchiveZip(string $dir, array<string|int, mixed> $files, string|object $zipPath) : bool
Parameters
$dir : string

target dir

$files : array<string|int, mixed>

files names list

$zipPath : string|object

Zip archive name

Tags
author

Naoki Sawada

Return values
bool

        
On this page

Search results