Welcompose
[ class tree: Welcompose ] [ index: Welcompose ] [ all elements ]

Class: flickrClient

Source Location: /media_classes/flickr.class.php

Class Overview




Variables

Methods



Class Details

[line 564]


[ Top ]


Class Variables

$cache =  null

[line 571]

Container for the PEAR Cache_Lite object



Tags:

access:  protected

Type:   object


[ Top ]

$rc4 =  null

[line 578]

Container for the PEAR Crypt_RC4 object



Tags:

access:  protected

Type:   object


[ Top ]

$_cache =  true

[line 611]

Whether to cache the flickr responses or not



Tags:

access:  protected

Type:   bool


[ Top ]

$_cache_dir =  null

[line 618]

Directory where to cache the flickr responses



Tags:

access:  protected

Type:   string


[ Top ]

$_cache_encrypt =  false

[line 632]

Whether to encrypt the cache files or not



Tags:

access:  protected

Type:   bool


[ Top ]

$_cache_encrypt_passphrase =  null

[line 639]

Passphrase to use for cache encryption



Tags:

access:  protected

Type:   string


[ Top ]

$_cache_lifetime =  1800

[line 625]

Lifetime of the flickr cache in seconds



Tags:

access:  protected

Type:   int


[ Top ]

$_endpoint =  'http://api.flickr.com/services/rest/'

[line 594]

Flickr API endpoint URL



Tags:

access:  protected

Type:   string


[ Top ]

$_http_request_options = array(
      'method' => 'GET',
      'http' => '1.1'
   )

[line 601]

Options array passed to the constructor of HTTP_Request



Tags:

access:  protected

Type:   array


[ Top ]

$_iso_input =  false

[line 587]

Whether the args and other input is encoded using ISO-8859-1 or not. Then it will be automatically converted to UTF-8.



Tags:

access:  protected

Type:   bool


[ Top ]



Class Methods


constructor __construct [line 656]

flickrClient __construct( string $cache_dir, [array $options = array()])

Creates new flickrClient instance. Takes the cache dir to use as first argument and an options array as second argument. Available options:

  • cache_encrypt, bool: Whether to encrypt the cache files or not
  • cache_encrypt_passphrase, string: Passphrase to use for encryption. Required when using encryption.




Tags:

throws:  flickrClientException
access:  public


Parameters:

string   $cache_dir   Path to cache dir
array   $options   Options array

[ Top ]

method cacheFlickrResponse [line 891]

bool cacheFlickrResponse( object HTTP_Requst $http_request_object, string $http_response_body)

Caches the Flickr response as supplied by the http_response body.

Takes the HTTP_Request object as first argument, the response body as second argument. Returns true on success.




Tags:

throws:  flickrClientException
access:  protected


Parameters:

object HTTP_Requst   $http_request_object   object
string   $http_response_body   Response body

[ Top ]

method flickrRequestIsCached [line 821]

bool flickrRequestIsCached( object HTTP_Request $http_request_object)

Tests if there's a cached result for the current request.

Takes the HTTP_Request object (where the cache id will be extracted from) as first argument. Returns bool.




Tags:

throws:  flickrClientException
access:  protected


Parameters:

object HTTP_Request   $http_request_object   object

[ Top ]

method flickrRequestWasSuccessfull [line 772]

void flickrRequestWasSuccessfull( $response)

Tests if flickr request was successfull. Takes the response body as first argument. Returns bool.



Tags:

throws:  flickrClientException
access:  protected


Parameters:

   $response  

[ Top ]

method flickrResponseCacheId [line 923]

string flickrResponseCacheId( $http_request_object)

Extracts the cache id from the HTTP_Request object.



Tags:

access:  protected


Parameters:

   $http_request_object  

[ Top ]

method getCachedFlickrRequest [line 854]

mixed getCachedFlickrRequest( object HTTP_Request $http_request_object)

Returns cached response body from cache. Taktes the HTTP_Request object (where the cache id will be extracted from) as first argument. Returns string on success or false on failure.

Test the availability of the cache file using flickrClient::flickrRequestIsCached before using this method.




Tags:

throws:  flickrClientException
access:  protected


Parameters:

object HTTP_Request   $http_request_object   object

[ Top ]

method getFlickrRequestError [line 796]

string getFlickrRequestError( string $response)

Extracts error message from flickr response. Returns string.



Tags:

throws:  flickrClientException
access:  protected


Parameters:

string   $response   Response body

[ Top ]

method sendFlickrRequest [line 697]

string sendFlickrRequest( string $method, array $args)

Sends flickr request. Takes the API method as first argument, a key=>value with args as second argument. Returns the message in REST format.



Tags:

throws:  flickrClientException
access:  public


Parameters:

string   $method   Method name
array   $args   Method args

[ Top ]


Documentation generated on Sun, 08 Jan 2012 17:51:48 +0100 by phpDocumentor 1.4.3