PHP Class Horde_Service_Scribd, horde

Author: Chuck Hagenbuch ([email protected])
显示文件 Open project: horde/horde Class Usage Examples

Protected Properties

Property Type Description
$_config array
$_httpClient Horde_Http_Client HTTP client object to use for accessing the Scribd API.

Public Methods

Method Description
__construct ( $config ) Constructor
changeSettings ( mixed $docIds, array $settings ) : true Change a document's settings.
delete ( integer $docId ) : true Delete a document.
getConversionStatus ( integer $docId ) : string Get the current conversion status of a document.
getHttpClient ( ) : Horde_Http_Client Gets the HTTP client object.
getList ( ) : Traversable Return an iterator over the authorized user's documents.
getSettings ( integer $docId ) : array Get a document's settings
login ( string $username, string $password ) : array Log in as a user
newRequest ( string $method, string $args = [] ) : Horde_Service_Scribd_Request Create an API request for $method with $args
search ( string $query, integer $num_results = null, integer $num_start = null, string $scope = null ) : array Search the Scribd database
setHttpClient ( Horde_Http_Client $httpClient ) Set the HTTP client instance
signup ( string $username, string $password, string $email, string $name = null ) : array Sign up a new user
upload ( string $file, $doc_type = null, string $access = null, $revId = null ) : array Upload a local file.
uploadFromUrl ( string $url, $doc_type = null, string $access = null, integer $rev_id = null ) : array Upload a document from a publicly accessible URL.

Method Details

__construct() public method

Constructor
public __construct ( $config )

changeSettings() public method

Change a document's settings.
public changeSettings ( mixed $docIds, array $settings ) : true
$docIds mixed One or more document ids to change.
$settings array The values to set for each $docId. Possible keys: title: string description: string access: ["public", "private"] license: ["by", "by-nc", "by-nc-nd", "by-nc-sa", "by-nd", "by-sa", "c", "pd" show_ads: ["default", "true", "false"] link_back_url: string tags: comma-separated stringlist (or PHP array)
return true

delete() public method

Delete a document.
public delete ( integer $docId ) : true
$docId integer The document to delete
return true

getConversionStatus() public method

Get the current conversion status of a document.
public getConversionStatus ( integer $docId ) : string
$docId integer Document id to get status for
return string "DISPLAYABLE", "DONE", "ERROR", or "PROCESSING"

getHttpClient() public static method

Gets the HTTP client object.
public static getHttpClient ( ) : Horde_Http_Client
return Horde_Http_Client

getList() public method

Return an iterator over the authorized user's documents.
public getList ( ) : Traversable
return Traversable

getSettings() public method

Get a document's settings
public getSettings ( integer $docId ) : array
$docId integer Document id to get status for
return array [doc_id, title, description, access, license, tags[], show_ads, access_key, thumbnail_url, secret_password]

login() public method

Log in as a user
public login ( string $username, string $password ) : array
$username string : username of user to log in
$password string : password of user to log in
return array containing session_key, name, username, and user_id of the user

newRequest() public method

Create an API request for $method with $args
public newRequest ( string $method, string $args = [] ) : Horde_Service_Scribd_Request
$method string The API method to call.
$args string Method arguments
return Horde_Service_Scribd_Request

setHttpClient() public static method

Sets the HTTP client object to use for Scribd requests. If none is set, the default Horde_Http_Client will be used.
public static setHttpClient ( Horde_Http_Client $httpClient )
$httpClient Horde_Http_Client

signup() public method

Sign up a new user
public signup ( string $username, string $password, string $email, string $name = null ) : array
$username string : username of user to create
$password string : password of user to create
$email string : email address of user
$name string : name of user
return array containing session_key, name, username, and user_id of the user

upload() public method

Upload a local file.
public upload ( string $file, $doc_type = null, string $access = null, $revId = null ) : array
$file string Local file
$access string Document visibility. 'public' or 'private', default 'public'
return array [doc_id, access_key, [secret_password]]

uploadFromUrl() public method

Upload a document from a publicly accessible URL.
public uploadFromUrl ( string $url, $doc_type = null, string $access = null, integer $rev_id = null ) : array
$url string Document location
$access string Document visibility. 'public' or 'private', default 'public'
$rev_id integer The doc_id to save uploaded file as a revision to
return array [doc_id, access_key, [secret_password]]

Property Details

$_config protected_oe property

protected array $_config
return array

$_httpClient protected_oe static_oe property

HTTP client object to use for accessing the Scribd API.
protected static Horde_Http_Client $_httpClient
return Horde_Http_Client