PHP Класс elFinderVolumeDropbox

Автор: Dmitry (dio) Levashov
Автор: Cem (discofever)
Наследование: extends elFinderVolumeDriver
Показать файл Открыть проект Примеры использования класса

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

Свойство Тип Описание
$apiError string Last API error message
$driverId string Driver id Must be started from letter and contains [a-z0-9] Used as part of volume id
$dropbox dropbox Dropbox object
$dropboxUid string Dropbox.com uid
$metaCache string Directory for meta data caches If not set driver not cache meta data
$oauth oauth OAuth object
$tmp string Directory for tmp files If not set driver will try to use tmbDir as tmpDir

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

Метод Описание
__construct ( ) Constructor Extend options with required fields
getContentUrl ( string $hash, array $options = [] ) : array Return content URL
netmountPrepare ( $options ) : Array Prepare Call from elFinder::netmout() before volume->mount()
netunmount ( $netVolumes, $key ) : boolean process of on netunmount Drop table dropbox & rm thumbs
umount ( ) : void Close opened connection

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

Метод Описание
_abspath ( string $path ) : string Convert path related to root dir into real path
_archive ( string $dir, array $files, string $name, array $arc ) : string | boolean Create archive and return its path
_basename ( string $path ) : string Return file name
_checkArchivers ( ) : array Detect available archivers
_chmod ( string $path, string $mode ) : boolean chmod implementation
_copy ( string $source, string $targetDir, string $name ) : boolean Copy file into another file
_dimensions ( string $path, string $mime ) : string Return object width and height Ususaly used for images, but can be realize for video etc.
_dirname ( string $path ) : string Return parent directory path
_extract ( string $path, array $arc ) : true Extract files from archive
_fclose ( resource $fp, string $path = '' ) : boolean Close opened file
_filePutContents ( string $path, string $content ) : boolean Write a string to a file
_findSymlinks ( string $path ) : boolean Recursive symlinks search
_fopen ( string $path, string $mode = 'rb' ) : false | resource Open file and return file pointer
_getContents ( string $path ) : string | false Get file contents
_inpath ( string $path, string $parent ) : boolean Return true if $path is children of $parent
_joinPath ( string $dir, string $name ) : string Join dir name and file name and retur full path
_mkdir ( string $path, string $name ) : string | boolean Create dir and return created dir path or false on failed
_mkfile ( string $path, string $name ) : string | boolean Create file and return it's path or false on failed
_move ( string $source, $targetDir, string $name ) : boolean | string Move file into another parent dir.
_normpath ( string $path ) : string Return normalized path, this works the same as os.path.normpath() in Python
_path ( string $path ) : string Return fake path started from root dir
_relpath ( string $path ) : string Return file path related to root dir
_rmdir ( string $path ) : boolean Remove dir
_save ( resource $fp, string $path, string $name, array $stat ) : boolean | string Create new file and write into it from file pointer.
_scandir ( string $path ) : array Return files list in directory.
_stat ( string $path ) : array | false Return stat for given path.
_subdirs ( string $path ) : boolean Return true if path is dir and has at least one childs directory
_symlink ( string $target, string $path, string $name ) : boolean Create symlink. FTP driver does not support symlinks.
_unlink ( string $path ) : boolean Remove file
_unpack ( string $path, array $arc ) : void Unpack archive
cacheDir ( string $path ) : string Cache dir contents
configure ( ) : string Configure after successful mount.
copy ( string $src, string $dst, string $name ) : string | false Copy file/recursive copy dir only in current volume.
createTmb ( string $path, $stat ) : false | string Create thumnbnail and return it's URL on success
deltaCheck ( boolean $refresh = true ) : true | string Get delta data and DB update
doSearch ( string $path, string $q, array $mimes ) : array Recursive files search
getThumbnail ( string $path, string $size = 'small' ) : string | boolean Get thumbnail from dropbox.com
init ( ) : boolean Prepare FTP connection Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn
parseRaw ( string $raw ) : array Parse line from dropbox metadata output and return file stat (array)
remove ( string $path, boolean $force = false, boolean $recursive = false ) : boolean Remove file/ recursive remove dir
tmbname ( array $stat ) : string Return thumbnail file name for required file

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

Метод Описание
checkDB ( ) : boolean Check DB for delta cache
getDBdat ( string $path ) : array Get dat(dropbox metadata) from DB
getHttpResponseHeader ( string $url ) : string Get HTTP request response header string
query ( string $sql ) : boolean | array DB query and fetchAll
updateDBdat ( string $path, array $dat ) : boolean | array Update DB dat(dropbox metadata)

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

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

Constructor Extend options with required fields
Автор: Dmitry (dio) Levashov
Автор: Cem (DiscoFever)
public __construct ( )

_abspath() защищенный Метод

Convert path related to root dir into real path
Автор: Dmitry (dio) Levashov
protected _abspath ( string $path ) : string
$path string file path
Результат string

_archive() защищенный Метод

Create archive and return its path
Автор: Dmitry (dio) Levashov,
Автор: Alexey Sukhotin
protected _archive ( string $dir, array $files, string $name, array $arc ) : string | boolean
$dir string target dir
$files array files names list
$name string archive name
$arc array archiver options
Результат string | boolean

_basename() защищенный Метод

Return file name
Автор: Dmitry (dio) Levashov
protected _basename ( string $path ) : string
$path string file path
Результат string

_checkArchivers() защищенный Метод

Detect available archivers
protected _checkArchivers ( ) : array
Результат array

_chmod() защищенный Метод

chmod implementation
protected _chmod ( string $path, string $mode ) : boolean
$path string
$mode string
Результат boolean

_copy() защищенный Метод

Copy file into another file
Автор: Dmitry (dio) Levashov
protected _copy ( string $source, string $targetDir, string $name ) : boolean
$source string source file path
$targetDir string target directory path
$name string new file name
Результат boolean

_dimensions() защищенный Метод

..
Автор: Dmitry (dio) Levashov
protected _dimensions ( string $path, string $mime ) : string
$path string file path
$mime string file mime type
Результат string

_dirname() защищенный Метод

Return parent directory path
Автор: Dmitry (dio) Levashov
protected _dirname ( string $path ) : string
$path string file path
Результат string

_extract() защищенный Метод

Extract files from archive
Автор: Dmitry (dio) Levashov,
Автор: Alexey Sukhotin
protected _extract ( string $path, array $arc ) : true
$path string archive path
$arc array archiver command and arguments (same as in $this->archivers)
Результат true

_fclose() защищенный Метод

Close opened file
Автор: Dmitry (dio) Levashov
protected _fclose ( resource $fp, string $path = '' ) : boolean
$fp resource file pointer
$path string
Результат boolean

_filePutContents() защищенный Метод

Write a string to a file
Автор: Dmitry (dio) Levashov
protected _filePutContents ( string $path, string $content ) : boolean
$path string file path
$content string new file content
Результат boolean

_fopen() защищенный Метод

Open file and return file pointer
Автор: Dmitry (dio) Levashov
protected _fopen ( string $path, string $mode = 'rb' ) : false | resource
$path string file path
$mode string
Результат false | resource

_getContents() защищенный Метод

Get file contents
Автор: Dmitry (dio) Levashov
protected _getContents ( string $path ) : string | false
$path string file path
Результат string | false

_inpath() защищенный Метод

Return true if $path is children of $parent
Автор: Dmitry (dio) Levashov
protected _inpath ( string $path, string $parent ) : boolean
$path string path to check
$parent string parent path
Результат boolean

_joinPath() защищенный Метод

Join dir name and file name and retur full path
Автор: Dmitry (dio) Levashov
protected _joinPath ( string $dir, string $name ) : string
$dir string
$name string
Результат string

_mkdir() защищенный Метод

Create dir and return created dir path or false on failed
Автор: Dmitry (dio) Levashov
protected _mkdir ( string $path, string $name ) : string | boolean
$path string parent dir path
$name string new directory name
Результат string | boolean

_mkfile() защищенный Метод

Create file and return it's path or false on failed
Автор: Dmitry (dio) Levashov
protected _mkfile ( string $path, string $name ) : string | boolean
$path string parent dir path
$name string new file name
Результат string | boolean

_move() защищенный Метод

Return new file path or false.
Автор: Dmitry (dio) Levashov
protected _move ( string $source, $targetDir, string $name ) : boolean | string
$source string source file path
$targetDir
$name string file name
Результат boolean | string

_normpath() защищенный Метод

Return normalized path, this works the same as os.path.normpath() in Python
Автор: Troex Nevelin
protected _normpath ( string $path ) : string
$path string path
Результат string

_path() защищенный Метод

Return fake path started from root dir
Автор: Dmitry (dio) Levashov
protected _path ( string $path ) : string
$path string file path
Результат string

_relpath() защищенный Метод

Return file path related to root dir
Автор: Dmitry (dio) Levashov
protected _relpath ( string $path ) : string
$path string file path
Результат string

_rmdir() защищенный Метод

Remove dir
Автор: Dmitry (dio) Levashov
protected _rmdir ( string $path ) : boolean
$path string dir path
Результат boolean

_save() защищенный Метод

Return new file path or false on error.
Автор: Dmitry (dio) Levashov
protected _save ( resource $fp, string $path, string $name, array $stat ) : boolean | string
$fp resource file pointer
$path string
$name string file name
$stat array file stat (required by some virtual fs)
Результат boolean | string

_scandir() защищенный Метод

Return files list in directory.
Автор: Dmitry (dio) Levashov
Автор: Cem (DiscoFever)
protected _scandir ( string $path ) : array
$path string dir path
Результат array

_stat() защищенный Метод

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.
Автор: Dmitry (dio) Levashov
protected _stat ( string $path ) : array | false
$path string file path
Результат array | false

_subdirs() защищенный Метод

Return true if path is dir and has at least one childs directory
Автор: Dmitry (dio) Levashov
protected _subdirs ( string $path ) : boolean
$path string dir path
Результат boolean

_unpack() защищенный Метод

Unpack archive
Автор: Dmitry (dio) Levashov
Автор: Alexey Sukhotin
protected _unpack ( string $path, array $arc ) : void
$path string archive path
$arc array archiver command and arguments (same as in $this->archivers)
Результат void

cacheDir() защищенный Метод

Cache dir contents
Автор: Dmitry Levashov
protected cacheDir ( string $path ) : string
$path string dir path
Результат string

configure() защищенный Метод

Configure after successful mount.
Автор: Dmitry (dio) Levashov
protected configure ( ) : string
Результат string

copy() защищенный Метод

Return new file path or false.
Автор: Dmitry (dio) Levashov
Автор: Naoki Sawada
protected copy ( string $src, string $dst, string $name ) : string | false
$src string source path
$dst string destination dir path
$name string new file name (optionaly)
Результат string | false

createTmb() защищенный Метод

Create thumnbnail and return it's URL on success
Автор: Dmitry (dio) Levashov
Автор: Naoki Sawada
protected createTmb ( string $path, $stat ) : false | string
$path string file path
$stat
Результат false | string

deltaCheck() защищенный Метод

Get delta data and DB update
protected deltaCheck ( boolean $refresh = true ) : true | string
$refresh boolean force refresh
Результат true | string error message

doSearch() защищенный Метод

Recursive files search
Автор: Naoki Sawada
protected doSearch ( string $path, string $q, array $mimes ) : array
$path string dir path
$q string search string
$mimes array
Результат array

getContentUrl() публичный Метод

Return content URL
Автор: Naoki Sawada
public getContentUrl ( string $hash, array $options = [] ) : array
$hash string file hash
$options array options
Результат array

getThumbnail() защищенный Метод

Get thumbnail from dropbox.com
protected getThumbnail ( string $path, string $size = 'small' ) : string | boolean
$path string
$size string
Результат string | boolean | boolean

init() защищенный Метод

Prepare FTP connection Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn
Автор: Dmitry (dio) Levashov
Автор: Cem (DiscoFever)
protected init ( ) : boolean
Результат boolean

netmountPrepare() публичный Метод

Prepare Call from elFinder::netmout() before volume->mount()
Автор: Naoki Sawada
public netmountPrepare ( $options ) : Array
$options
Результат Array

netunmount() публичный Метод

process of on netunmount Drop table dropbox & rm thumbs
public netunmount ( $netVolumes, $key ) : boolean
$netVolumes
$key
Результат boolean

parseRaw() защищенный Метод

Parse line from dropbox metadata output and return file stat (array)
Автор: Dmitry Levashov
protected parseRaw ( string $raw ) : array
$raw string line from ftp_rawlist() output
Результат array

remove() защищенный Метод

Remove file/ recursive remove dir
Автор: Dmitry (dio) Levashov
Автор: Naoki Sawada
protected remove ( string $path, boolean $force = false, boolean $recursive = false ) : boolean
$path string file path
$force boolean try to remove even if file locked
$recursive boolean
Результат boolean

tmbname() защищенный Метод

Return thumbnail file name for required file
Автор: Dmitry (dio) Levashov
protected tmbname ( array $stat ) : string
$stat array file stat
Результат string

umount() публичный Метод

Close opened connection
Автор: Dmitry (dio) Levashov
public umount ( ) : void
Результат void

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

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

Last API error message
protected string $apiError
Результат string

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

Driver id Must be started from letter and contains [a-z0-9] Used as part of volume id
protected string $driverId
Результат string

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

Dropbox object
protected dropbox $dropbox
Результат dropbox

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

Dropbox.com uid
protected string $dropboxUid
Результат string

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

Directory for meta data caches If not set driver not cache meta data
protected string $metaCache
Результат string

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

OAuth object
protected oauth $oauth
Результат oauth

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

Directory for tmp files If not set driver will try to use tmbDir as tmpDir
protected string $tmp
Результат string