PHP Class Dropbox_API, dropbox-php

显示文件 Open project: dropbox-php/dropbox-php Class Usage Examples

Public Properties

Property Type Description
$chunkSize unknown Chunked file size limit

Protected Properties

Property Type Description
$api_content_url Content API URl
$api_url API URl
$oauth Dropbox_OAuth OAuth object
$root string Default root-path, this will most likely be 'sandbox' or 'dropbox'
$useSSL

Public Methods

Method Description
__construct ( Dropbox_OAuth $oauth, string $root = self::ROOT_DROPBOX, $useSSL = true ) Constructor
chunkedUpload ( string $path, $handle, $root = null, boolean $overwrite = true, $offset, $uploadID = null ) : stdClass Uploads large files to Dropbox in mulitple chunks
copy ( string $from, string $to, string $root = null ) : stdclass Copies a file or directory from one location to another
copy_ref ( type $path, type $root = null ) : type Creates and returns a copy_ref to a file. This reference string can be used to copy that file to another user's Dropbox by passing it in as the from_copy_ref parameter on /fileops/copy.
createFolder ( string $path, string $root = null ) : stdclass Creates a new folder
delete ( string $path, string $root = null ) : array Deletes a file or folder.
delta ( string $cursor ) : stdclass A way of letting you keep up with changes to files and folders in a user's Dropbox. You can periodically call /delta to get a list of "delta entries", which are instructions on how to update your local state to match the server's state.
getAccountInfo ( ) : stdclass Returns information about the current dropbox account
getFile ( string $path = '', string $root = null ) : string Returns a file's contents
getMetaData ( string $path, boolean $list = true, string $hash = null, integer $fileLimit = null, string $root = null ) : array | true Returns file and directory information
getThumbnail ( string $path, string $size = 'small', string $root = null ) : string Returns a thumbnail (as a string) for a file path.
media ( type $path, type $root = null ) : type Returns a link directly to a file.
move ( mixed $from, mixed $to, string $root = null ) : stdclass Moves a file or directory to a new location
putFile ( string $path, string $file, string $root = null ) : boolean Uploads a new file
putStream ( $path, $file, $root = null, boolean $overwrite = true ) : array Uploads file data from a stream
search ( string $query = '', string $root = null, string $path = '' ) : array Search
share ( string $path, string $root = null, string $short_url = true ) : array Creates and returns a shareable link to files or folders.

Protected Methods

Method Description
multipartFetch ( string $uri, $file, $filename ) : boolean This method is used to generate multipart POST requests for file upload

Method Details

__construct() public method

Constructor
public __construct ( Dropbox_OAuth $oauth, string $root = self::ROOT_DROPBOX, $useSSL = true )
$oauth Dropbox_OAuth
$root string default root path (sandbox or dropbox)

chunkedUpload() public method

Uploads large files to Dropbox in mulitple chunks
public chunkedUpload ( string $path, $handle, $root = null, boolean $overwrite = true, $offset, $uploadID = null ) : stdClass
$path string Path to upload the file to, relative to root
$overwrite boolean Should the file be overwritten? (Default: true)
return stdClass

copy() public method

This method returns the file information of the newly created file.
public copy ( string $from, string $to, string $root = null ) : stdclass
$from string source path
$to string destination path
$root string Use this to override the default root path (sandbox/dropbox)
return stdclass

copy_ref() public method

Creates and returns a copy_ref to a file. This reference string can be used to copy that file to another user's Dropbox by passing it in as the from_copy_ref parameter on /fileops/copy.
public copy_ref ( type $path, type $root = null ) : type
$path type
$root type
return type

createFolder() public method

This method returns the information from the newly created directory
public createFolder ( string $path, string $root = null ) : stdclass
$path string
$root string Use this to override the default root path (sandbox/dropbox)
return stdclass

delete() public method

This method will return the metadata information from the deleted file or folder, if successful.
public delete ( string $path, string $root = null ) : array
$path string Path to new folder
$root string Use this to override the default root path (sandbox/dropbox)
return array

delta() public method

This method returns the information from the newly created directory
public delta ( string $cursor ) : stdclass
$cursor string A string that is used to keep track of your current state. On the next call pass in this value to return delta entries that have been recorded since the cursor was returned.
return stdclass

getAccountInfo() public method

Returns information about the current dropbox account
public getAccountInfo ( ) : stdclass
return stdclass

getFile() public method

Returns a file's contents
public getFile ( string $path = '', string $root = null ) : string
$path string path
$root string Use this to override the default root path (sandbox/dropbox)
return string

getMetaData() public method

Returns file and directory information
public getMetaData ( string $path, boolean $list = true, string $hash = null, integer $fileLimit = null, string $root = null ) : array | true
$path string Path to receive information from
$list boolean When set to true, this method returns information from all files in a directory. When set to false it will only return infromation from the specified directory.
$hash string If a hash is supplied, this method simply returns true if nothing has changed since the last request. Good for caching.
$fileLimit integer Maximum number of file-information to receive
$root string Use this to override the default root path (sandbox/dropbox)
return array | true

getThumbnail() public method

Returns a thumbnail (as a string) for a file path.
public getThumbnail ( string $path, string $size = 'small', string $root = null ) : string
$path string Path to file
$size string small, medium or large
$root string Use this to override the default root path (sandbox/dropbox)
return string

media() public method

Similar to /shares. The difference is that this bypasses the Dropbox webserver, used to provide a preview of the file, so that you can effectively stream the contents of your media. Note: The /media link expires after four hours, allotting enough time to stream files, but not enough to leave a connection open indefinitely.
public media ( type $path, type $root = null ) : type
$path type
$root type
return type

move() public method

This method returns the information from the newly created directory
public move ( mixed $from, mixed $to, string $root = null ) : stdclass
$from mixed Source path
$to mixed destination path
$root string Use this to override the default root path (sandbox/dropbox)
return stdclass

multipartFetch() protected method

This method is used to generate multipart POST requests for file upload
protected multipartFetch ( string $uri, $file, $filename ) : boolean
$uri string
return boolean

putFile() public method

Uploads a new file
public putFile ( string $path, string $file, string $root = null ) : boolean
$path string Target path (including filename)
$file string Either a path to a file or a stream resource
$root string Use this to override the default root path (sandbox/dropbox)
return boolean

putStream() public method

Note: This function is experimental and requires further testing
public putStream ( $path, $file, $root = null, boolean $overwrite = true ) : array
$overwrite boolean Should the file be overwritten? (Default: true)
return array

share() public method

Note: Links created by the /shares API call expire after thirty days.
public share ( string $path, string $root = null, string $short_url = true ) : array
$path string
$root string Use this to override the default root path (sandbox/dropbox)
$short_url string When true (default), the URL returned will be shortened using the Dropbox URL shortener
return array

Property Details

$api_content_url protected_oe property

Content API URl
protected $api_content_url

$api_url protected_oe property

API URl
protected $api_url

$chunkSize public_oe property

Chunked file size limit
public unknown $chunkSize
return unknown

$oauth protected_oe property

OAuth object
protected Dropbox_OAuth $oauth
return Dropbox_OAuth

$root protected_oe property

Default root-path, this will most likely be 'sandbox' or 'dropbox'
protected string $root
return string

$useSSL protected_oe property

protected $useSSL