PHP Class elFinderVolumeBox

Author: Dmitry (dio) Levashov
Author: Cem (discofever)
Inheritance: extends elFinderVolumeDriver
Afficher le fichier Open project: studio-42/elfinder

Méthodes publiques

Свойство Type Description
$netMountKey string Net mount key.

Protected Properties

Свойство Type Description
$HasdirsCache array hasCache by folders.
$driverId string Driver id Must be started from letter and contains [a-z0-9] Used as part of volume id.
$tmp string Directory for tmp files If not set driver will try to use tmbDir as tmpDir.
$token object Box.com token object.

Méthodes publiques

Méthode Description
__construct ( ) Constructor Extend options with required fields.
getContentUrl ( string $hash, array $options = [] ) : string Return content URL.
netmountPrepare ( $options ) : array Prepare Call from elFinder::netmout() before volume->mount().
netunmount ( $netVolumes, $key ) : boolean process of on netunmount Drop box & rm thumbs.
umount ( ) Close opened connection.

Méthodes protégées

Méthode Description
_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.
_bd_curlExec ( resource $curl, boolean | string $decodeOrParent = true, array $headers = [] ) : mixed Call curl_exec().
_bd_fetch ( $url, $contents = false ) : resource Creates a base cURL object which is compatible with the Box.com API.
_bd_getRawItem ( string $path ) : array Get dat(box metadata) from Box.com.
_bd_getThumbnail ( string $path ) : string | boolean Get thumbnail from Box.com.
_bd_obtainAccessToken ( $client_id, $client_secret, string $code ) Obtains a new access token from OAuth. This token is valid for one hour.
_bd_parseRaw ( string $raw ) : array Parse line from box metadata output and return file stat (array).
_bd_prepareCurl ( array $options = [] ) : resource Creates a base cURL object which is compatible with the Box.com API.
_bd_query ( $itemId, $fetch_self = false, $recursive = false ) : boolean | array Drive query and fetchAll.
_bd_refreshToken ( ) : true | string Get token and auto refresh.
_bd_splitPath ( string $path ) : array Get Parent ID, Item ID, Parent Path as an array from path.
_bd_unlink ( string $path, $type = null ) : boolean Remove item.
_checkArchivers ( ) Detect available archivers.
_chmod ( $path, $mode ) : boolean chmod implementation.
_copy ( string $source, string $targetDir, string $name ) : string | false 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, $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, $mode = 'rb' ) : resource | false 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 ) : string | boolean 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, $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, $name ) : boolean Create symlink. FTP driver does not support symlinks.
_unlink ( string $path ) : boolean Remove file.
_unpack ( string $path, array $arc ) : true Unpack archive.
cacheDir ( string $path ) Cache dir contents.
configure ( ) Configure after successfull mount.
copy ( string $src, string $dst, string $name ) : string | false Copy file/recursive copy dir only in current volume.
createTmb ( string $path, $stat ) : string | false Create thumnbnail and return it's URL on success.
getSharedWebContentLink ( array $raw ) : array Return content URL.
init ( ) : boolean Prepare FTP connection Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn.
isNameExists ( string $path ) : array Return fileinfo based on filename For item ID based path file system Please override if needed on each drivers.
remove ( string $path, boolean $force = false ) : boolean Remove file/ recursive remove dir.
tmbname ( array $stat ) : string Return thumbnail file name for required file.

Method Details

__construct() public méthode

Constructor Extend options with required fields.
Author: Dmitry (dio) Levashov
Author: Cem (DiscoFever)
public __construct ( )

_abspath() protected méthode

Convert path related to root dir into real path.
Author: Dmitry (dio) Levashov
protected _abspath ( string $path ) : string
$path string file path
Résultat string

_archive() protected méthode

Create archive and return its path.
Author: Dmitry (dio) Levashov,
Author: 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
Résultat string | boolean

_basename() protected méthode

Return file name.
Author: Dmitry (dio) Levashov
protected _basename ( string $path ) : string
$path string file path
Résultat string

_bd_curlExec() protected méthode

Call curl_exec().
protected _bd_curlExec ( resource $curl, boolean | string $decodeOrParent = true, array $headers = [] ) : mixed
$curl resource
$decodeOrParent boolean | string
$headers array
Résultat mixed

_bd_fetch() protected méthode

Creates a base cURL object which is compatible with the Box.com API.
protected _bd_fetch ( $url, $contents = false ) : resource
Résultat resource A compatible cURL object

_bd_getRawItem() protected méthode

Get dat(box metadata) from Box.com.
protected _bd_getRawItem ( string $path ) : array
$path string
Résultat array box metadata

_bd_getThumbnail() protected méthode

Get thumbnail from Box.com.
protected _bd_getThumbnail ( string $path ) : string | boolean
$path string
Résultat string | boolean | boolean

_bd_obtainAccessToken() protected méthode

Obtains a new access token from OAuth. This token is valid for one hour.
protected _bd_obtainAccessToken ( $client_id, $client_secret, string $code )
$code string The code returned by Box after successful log in

_bd_parseRaw() protected méthode

Parse line from box metadata output and return file stat (array).
Author: Dmitry Levashov
protected _bd_parseRaw ( string $raw ) : array
$raw string line from ftp_rawlist() output
Résultat array

_bd_prepareCurl() protected méthode

Creates a base cURL object which is compatible with the Box.com API.
protected _bd_prepareCurl ( array $options = [] ) : resource
$options array cURL options
Résultat resource A compatible cURL object

_bd_query() protected méthode

Drive query and fetchAll.
protected _bd_query ( $itemId, $fetch_self = false, $recursive = false ) : boolean | array
Résultat boolean | array

_bd_refreshToken() protected méthode

Get token and auto refresh.
protected _bd_refreshToken ( ) : true | string
Résultat true | string error message

_bd_splitPath() protected méthode

Get Parent ID, Item ID, Parent Path as an array from path.
protected _bd_splitPath ( string $path ) : array
$path string
Résultat array

_checkArchivers() protected méthode

Detect available archivers.
protected _checkArchivers ( )

_chmod() protected méthode

chmod implementation.
protected _chmod ( $path, $mode ) : boolean
Résultat boolean

_copy() protected méthode

Copy file into another file.
Author: Dmitry (dio) Levashov
protected _copy ( string $source, string $targetDir, string $name ) : string | false
$source string source file path
$targetDir string target directory path
$name string new file name
Résultat string | false

_dimensions() protected méthode

..
Author: Dmitry (dio) Levashov
protected _dimensions ( string $path, string $mime ) : string
$path string file path
$mime string file mime type
Résultat string

_dirname() protected méthode

Return parent directory path.
Author: Dmitry (dio) Levashov
protected _dirname ( string $path ) : string
$path string file path
Résultat string

_extract() protected méthode

Extract files from archive.
Author: Dmitry (dio) Levashov,
Author: Alexey Sukhotin
protected _extract ( string $path, array $arc ) : true
$path string archive path
$arc array archiver command and arguments (same as in $this->archivers)
Résultat true

_fclose() protected méthode

Close opened file.
Author: Dmitry (dio) Levashov
protected _fclose ( resource $fp, $path = '' ) : boolean
$fp resource file pointer
Résultat boolean

_filePutContents() protected méthode

Write a string to a file.
Author: Dmitry (dio) Levashov
protected _filePutContents ( string $path, string $content ) : boolean
$path string file path
$content string new file content
Résultat boolean

_fopen() protected méthode

Open file and return file pointer.
Author: Dmitry (dio) Levashov
protected _fopen ( string $path, $mode = 'rb' ) : resource | false
$path string file path
Résultat resource | false

_getContents() protected méthode

Get file contents.
Author: Dmitry (dio) Levashov
protected _getContents ( string $path ) : string | false
$path string file path
Résultat string | false

_inpath() protected méthode

Return true if $path is children of $parent.
Author: Dmitry (dio) Levashov
protected _inpath ( string $path, string $parent ) : boolean
$path string path to check
$parent string parent path
Résultat boolean

_joinPath() protected méthode

Join dir name and file name and retur full path.
Author: Dmitry (dio) Levashov
protected _joinPath ( string $dir, string $name ) : string
$dir string
$name string
Résultat string

_mkdir() protected méthode

Create dir and return created dir path or false on failed.
Author: Dmitry (dio) Levashov
protected _mkdir ( string $path, string $name ) : string | boolean
$path string parent dir path
$name string new directory name
Résultat string | boolean

_mkfile() protected méthode

Create file and return it's path or false on failed.
Author: Dmitry (dio) Levashov
protected _mkfile ( string $path, string $name ) : string | boolean
$path string parent dir path
$name string new file name
Résultat string | boolean

_move() protected méthode

Return new file path or false.
Author: Dmitry (dio) Levashov
protected _move ( string $source, $targetDir, string $name ) : string | boolean
$source string source file path
$name string file name
Résultat string | boolean

_normpath() protected méthode

Return normalized path, this works the same as os.path.normpath() in Python.
Author: Troex Nevelin
protected _normpath ( string $path ) : string
$path string path
Résultat string

_path() protected méthode

Return fake path started from root dir.
Author: Dmitry (dio) Levashov
protected _path ( string $path ) : string
$path string file path
Résultat string

_relpath() protected méthode

Return file path related to root dir.
Author: Dmitry (dio) Levashov
protected _relpath ( string $path ) : string
$path string file path
Résultat string

_rmdir() protected méthode

Remove dir.
Author: Dmitry (dio) Levashov
protected _rmdir ( string $path ) : boolean
$path string dir path
Résultat boolean

_save() protected méthode

Return new file path or false on error.
Author: Dmitry (dio) Levashov
protected _save ( resource $fp, $path, string $name, array $stat ) : boolean | string
$fp resource file pointer
$name string file name
$stat array file stat (required by some virtual fs)
Résultat boolean | string

_scandir() protected méthode

Return files list in directory.
Author: Dmitry (dio) Levashov
Author: Cem (DiscoFever)
protected _scandir ( string $path ) : array
$path string dir path
Résultat array

_stat() protected méthode

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.
Author: Dmitry (dio) Levashov
protected _stat ( string $path ) : array | false
$path string file path
Résultat array | false

_subdirs() protected méthode

Return true if path is dir and has at least one childs directory.
Author: Dmitry (dio) Levashov
protected _subdirs ( string $path ) : boolean
$path string dir path
Résultat boolean

_unpack() protected méthode

Unpack archive.
Author: Dmitry (dio) Levashov
Author: Alexey Sukhotin
protected _unpack ( string $path, array $arc ) : true
$path string archive path
$arc array archiver command and arguments (same as in $this->archivers)
Résultat true

cacheDir() protected méthode

Cache dir contents.
Author: Dmitry Levashov
protected cacheDir ( string $path )
$path string dir path

configure() protected méthode

Configure after successfull mount.
Author: Dmitry (dio) Levashov
protected configure ( )

copy() protected méthode

Return new file path or false.
Author: Dmitry (dio) Levashov
Author: 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)
Résultat string | false

createTmb() protected méthode

Create thumnbnail and return it's URL on success.
Author: Dmitry (dio) Levashov
Author: Naoki Sawada
protected createTmb ( string $path, $stat ) : string | false
$path string file path
Résultat string | false

getContentUrl() public méthode

Return content URL.
Author: Naoki Sawada
public getContentUrl ( string $hash, array $options = [] ) : string
$hash string file hash
$options array options
Résultat string

init() protected méthode

Prepare FTP connection Connect to remote server and check if credentials are correct, if so, store the connection id in $ftp_conn.
Author: Dmitry (dio) Levashov
Author: Cem (DiscoFever)
protected init ( ) : boolean
Résultat boolean

isNameExists() protected méthode

Return fileinfo based on filename For item ID based path file system Please override if needed on each drivers.
protected isNameExists ( string $path ) : array
$path string file cache
Résultat array

netmountPrepare() public méthode

Prepare Call from elFinder::netmout() before volume->mount().
Author: Naoki Sawada
Author: Raja Sharma updating for Box
public netmountPrepare ( $options ) : array
Résultat array

netunmount() public méthode

process of on netunmount Drop box & rm thumbs.
public netunmount ( $netVolumes, $key ) : boolean
Résultat boolean

remove() protected méthode

Remove file/ recursive remove dir.
Author: Dmitry (dio) Levashov
Author: Naoki Sawada
protected remove ( string $path, boolean $force = false ) : boolean
$path string file path
$force boolean try to remove even if file locked
Résultat boolean

tmbname() protected méthode

Return thumbnail file name for required file.
Author: Dmitry (dio) Levashov
protected tmbname ( array $stat ) : string
$stat array file stat
Résultat string

umount() public méthode

Close opened connection.
Author: Dmitry (dio) Levashov
public umount ( )

Property Details

$HasdirsCache protected_oe property

hasCache by folders.
protected array $HasdirsCache
Résultat array

$driverId protected_oe property

Driver id Must be started from letter and contains [a-z0-9] Used as part of volume id.
protected string $driverId
Résultat string

$netMountKey public_oe property

Net mount key.
public string $netMountKey
Résultat string

$tmp protected_oe property

Directory for tmp files If not set driver will try to use tmbDir as tmpDir.
protected string $tmp
Résultat string

$token protected_oe property

Box.com token object.
protected object $token
Résultat object