Class Zend_Gdata_App

Description

Provides Atom Publishing Protocol (APP) functionality. This class and all other components of Zend_Gdata_App are designed to work independently from other Zend_Gdata components in order to interact with generic APP services.

  • copyright: Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
  • license: New BSD License

Located in /Gdata/App.php (line 54)


	
			
Direct descendents
Class Description
 class Zend_Gdata Provides functionality to interact with Google data APIs Subclasses exist to implement service-specific features
Class Constant Summary
Variable Summary
Method Summary
 static boolean getGzipEnabled ()
 static boolean getHttpMethodOverride ()
 static int getMaxRedirects ()
 static boolean getVerboseExceptionMessages ()
 static Zend_Gdata_App_Feed import (string $uri, [Zend_Http_Client $client = null], [string $className = 'Zend_Gdata_App_Feed'])
 static Zend_Gdata_Feed importFile (string $filename, [string $className = 'Zend_Gdata_App_Feed'], [string $useIncludePath = false])
 static Zend_Gdata_App_Feed importString (string $string, [string $className = 'Zend_Gdata_App_Feed'])
 static void setGzipEnabled ([boolean $enabled = false])
 static void setHttpMethodOverride ([boolean $override = true])
 static void setMaxRedirects (int $maxRedirects)
 static void setStaticHttpClient ( $httpClient)
 static void setVerboseExceptionMessages (boolean $verbose)
 Zend_Gdata_App __construct ([Zend_Http_Client $client = null], [string $applicationId = 'MyCompany-MyApp-1.0'])
 void delete (mixed $data, [ $remainingRedirects = null])
 void enableRequestDebugLogging ($logfile $logfile)
 string|null generateIfMatchHeaderData ( $data,  $allowWeek, boolean $allowWeak)
 Zend_Http_Response get (string $uri, [array $extraHeaders = array()])
 Zend_Gdata_App_Entry getEntry (string $uri, [string $className = 'Zend_Gdata_App_Entry'])
 Zend_Gdata_App_Feed getFeed (string $uri, [string $className = 'Zend_Gdata_App_Feed'])
 (int|NULL) getMinorProtocolVersion ()
 Zend_Gdata_App_Feed|null getNextFeed (Zend_Gdata_App_Feed $feed, [string $className = null])
 Zend_Gdata_App_Feed|null getPreviousFeed (Zend_Gdata_App_Feed $feed, [string $className = null])
 Zend_Gdata_App_Feed importUrl (string $url, [string $className = 'Zend_Gdata_App_Feed'], [array $extraHeaders = array()])
 Zend_Gdata_App_Entry insertEntry (mixed $data, string $uri, [string $className = 'Zend_Gdata_App_Entry'], [array $extraHeaders = array()])
 Zend_Http_Response performHttpRequest (string $method, string $url, [array $headers = null], [string $body = null], [string $contentType = null], [int $remainingRedirects = null])
 Zend_Http_Response post (mixed $data, [string $uri = null], [ $remainingRedirects = null], [string $contentType = null], [array $extraHeaders = null], array $headers)
 array prepareRequest (string $method, [string $url = null], [array $headers = array()], [mixed $data = null], [string $contentTypeOverride = null])
 Zend_Http_Response put (mixed $data, [string $uri = null], [ $remainingRedirects = null], [string $contentType = null], [array $extraHeaders = null], array $headers)
 void registerPackage (string $name)
 mixed retrieveAllEntriesForFeed ($feed $feed)
 Zend_Gdata_App setHttpClient (Zend_Http_Client $client, [ $applicationId = 'MyCompany-MyApp-1.0'])
 void setMajorProtocolVersion (int $value)
 void setMinorProtocolVersion ((int|NULL) $value)
 Zend_Gdata_App_Entry updateEntry (mixed $data, [string|null $uri = null], [string|null $className = null], [array $extraHeaders = array()])
 void __call (string $method, array $args)
Variables
static boolean $_gzipEnabled = false (line 95)

Enable gzipped responses?

  • access: protected
static boolean $_httpMethodOverride = false (line 88)

Override HTTP PUT and DELETE request methods?

  • access: protected
static int $_maxRedirects = 5 (line 126)

Maximum number of redirects to follow during HTTP operations

  • access: protected
static Zend_Http_Client $_staticHttpClient = null (line 81)

Client object used to communicate in static context

  • access: protected

Redefined in descendants as:
static boolean $_verboseExceptionMessages = true (line 103)

Use verbose exception messages. In the case of HTTP errors, use the body of the HTTP response in the exception message.

  • access: protected
string $_defaultPostUri = null (line 110)

Default URI to which to POST.

  • access: protected

Redefined in descendants as:
Zend_Http_Client $_httpClient (line 74)

Client object used to communicate

  • access: protected

Redefined in descendants as:
mixed $_majorProtocolVersion (line 139)

Indicates the major protocol version that should be used.

At present, recognized values are either 1 or 2. However, any integer value >= 1 is considered valid.

Under most circumtances, this will be automatically set by Zend_Gdata_App subclasses.

mixed $_minorProtocolVersion (line 155)

Indicates the minor protocol version that should be used. Can be set to either an integer >= 0, or NULL if no minor version should be sent to the server.

At present, this field is not used by any Google services, but may be used in the future.

Under most circumtances, this will be automatically set by Zend_Gdata_App subclasses.

array $_registeredPackages = array(
'Zend_Gdata_App_Extension',
'Zend_Gdata_App')
(line 117)

Packages to search for classes when using magic __call method, in order.

  • access: protected

Redefined in descendants as:
Methods
static getGzipEnabled (line 331)

Get the HTTP override state

  • access: public
static boolean getGzipEnabled ()
static getHttpMethodOverride (line 303)

Get the HTTP override state

  • access: public
static boolean getHttpMethodOverride ()
static getMaxRedirects (line 378)

Get the maximum number of redirects to follow during HTTP operations

  • return: Maximum number of redirects to follow
  • access: public
static int getMaxRedirects ()
static getStaticHttpClient (line 265)

Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used.

  • access: public
static Zend_Http_Client getStaticHttpClient ()
static getVerboseExceptionMessages (line 344)

Get whether to use verbose exception messages

In the case of HTTP errors, use the body of the HTTP response in the exception message.

  • access: public
static boolean getVerboseExceptionMessages ()
static import (line 660)

Imports a feed located at $uri.

  • throws: Zend_Gdata_App_Exception
  • access: public
static Zend_Gdata_App_Feed import (string $uri, [Zend_Http_Client $client = null], [string $className = 'Zend_Gdata_App_Feed'])
  • string $uri
  • Zend_Http_Client $client: The client used for communication
  • string $className: The class which is used as the return type

Redefined in descendants as:
static importFile (line 757)

Imports a feed from a file located at $filename.

  • throws: Zend_Gdata_App_Exception
  • access: public
static Zend_Gdata_Feed importFile (string $filename, [string $className = 'Zend_Gdata_App_Feed'], [string $useIncludePath = false])
  • string $filename
  • string $className: The class which is used as the return type
  • string $useIncludePath: Whether the include_path should be searched
static importString (line 730)

Imports a feed represented by $string.

  • throws: Zend_Gdata_App_Exception
  • access: public
static Zend_Gdata_App_Feed importString (string $string, [string $className = 'Zend_Gdata_App_Feed'])
  • string $string
  • string $className: The class which is used as the return type
static setGzipEnabled (line 314)

Toggle requesting gzip encoded responses

  • access: public
static void setGzipEnabled ([boolean $enabled = false])
  • boolean $enabled: Whether or not to enable gzipped responses
static setHttpMethodOverride (line 293)

Toggle using POST instead of PUT and DELETE HTTP methods

Some feed implementations do not accept PUT and DELETE HTTP methods, or they can't be used because of proxies or other measures. This allows turning on using POST where PUT and DELETE would normally be used; in addition, an X-Method-Override header will be sent with a value of PUT or DELETE as appropriate.

  • access: public
static void setHttpMethodOverride ([boolean $override = true])
  • boolean $override: Whether to override PUT and DELETE with POST.
static setMaxRedirects (line 368)

Set the maximum number of redirects to follow during HTTP operations

  • access: public
static void setMaxRedirects (int $maxRedirects)
  • int $maxRedirects: Maximum number of redirects to follow
static setStaticHttpClient (line 254)

Set the static HTTP client instance

Sets the static HTTP client object to use for retrieving the feed.

  • access: public
static void setStaticHttpClient ( $httpClient)
static setVerboseExceptionMessages (line 357)

Set whether to use verbose exception messages

In the case of HTTP errors, use the body of the HTTP response in the exception message.

  • access: public
static void setVerboseExceptionMessages (boolean $verbose)
  • boolean $verbose: Whether to use verbose exception messages
Constructor __construct (line 163)

Create Gdata object

  • access: public
Zend_Gdata_App __construct ([Zend_Http_Client $client = null], [string $applicationId = 'MyCompany-MyApp-1.0'])

Redefined in descendants as:
delete (line 843)

DELETE entry with client object

  • throws: Zend_Gdata_App_Exception
  • throws: Zend_Gdata_App_HttpException
  • throws: Zend_Gdata_App_InvalidArgumentException
  • access: public
void delete (mixed $data, [ $remainingRedirects = null])
  • mixed $data: The Zend_Gdata_App_Entry or URL to delete
  • $remainingRedirects

Redefined in descendants as:
  • Zend_Gdata_Gapps::delete() : DELETE entry with client object This method overrides the default behavior of Zend_Gdata_App, providing support for Zend_Gdata_Gapps_ServiceException.
enableRequestDebugLogging (line 1001)

This method enables logging of requests by changing the Zend_Http_Client_Adapter used for performing the requests.

NOTE: This will not work if you have customized the adapter already to use a proxy server or other interface.

  • access: public
void enableRequestDebugLogging ($logfile $logfile)
  • $logfile $logfile: The logfile to use when logging the requests
generateIfMatchHeaderData (line 1072)

Returns the data for an If-Match header based on the current Etag property. If Etags are not supported by the server or cannot be extracted from the data, then null will be returned.

  • access: public
string|null generateIfMatchHeaderData ( $data,  $allowWeek, boolean $allowWeak)
  • boolean $allowWeak: If false, then if a weak Etag is detected, then return null rather than the Etag.
  • $data
  • $allowWeek
get (line 779)

GET a URI using client object.

  • throws: Zend_Gdata_App_HttpException
  • access: public
Zend_Http_Response get (string $uri, [array $extraHeaders = array()])
  • string $uri: GET URI
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.

Redefined in descendants as:
getEntry (line 204)

Retreive entry object

  • access: public
Zend_Gdata_App_Entry getEntry (string $uri, [string $className = 'Zend_Gdata_App_Entry'])
  • string $uri
  • string $className: The class which is used as the return type

Redefined in descendants as:
getFeed (line 192)

Retreive feed object

  • access: public
Zend_Gdata_App_Feed getFeed (string $uri, [string $className = 'Zend_Gdata_App_Feed'])
  • string $uri: The uri from which to retrieve the feed
  • string $className: The class which is used as the return type

Redefined in descendants as:
getHttpClient (line 214)

Get the Zend_Http_Client object used for communication

  • access: public
Zend_Http_Client getHttpClient ()
getMajorProtocolVersion (line 407)

Get the major protocol version that is in use.

int getMajorProtocolVersion ()
getMinorProtocolVersion (line 438)

Get the minor protocol version that is in use.

(int|NULL) getMinorProtocolVersion ()
getNextFeed (line 1021)

Retrieve next set of results based on a given feed.

  • return: Returns a Zend_Gdata_App_Feed or null if no next set of results exists.
  • access: public
Zend_Gdata_App_Feed|null getNextFeed (Zend_Gdata_App_Feed $feed, [string $className = null])
  • Zend_Gdata_App_Feed $feed: The feed from which to retreive the next set of results.
  • string $className: (optional) The class of feed to be returned. If null, the next feed (if found) will be the same class as the feed that was given as the first argument.
getPreviousFeed (line 1048)

Retrieve previous set of results based on a given feed.

  • return: Returns a Zend_Gdata_App_Feed or null if no previous set of results exists.
  • access: public
Zend_Gdata_App_Feed|null getPreviousFeed (Zend_Gdata_App_Feed $feed, [string $className = null])
  • Zend_Gdata_App_Feed $feed: The feed from which to retreive the previous set of results.
  • string $className: (optional) The class of feed to be returned. If null, the previous feed (if found) will be the same class as the feed that was given as the first argument.
importUrl (line 684)

Imports the specified URL (non-statically).

  • throws: Zend_Gdata_App_Exception
  • access: public
Zend_Gdata_App_Feed importUrl (string $url, [string $className = 'Zend_Gdata_App_Feed'], [array $extraHeaders = array()])
  • string $url: The URL to import
  • string $className: The class which is used as the return type
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.
insertEntry (line 869)

Inserts an entry to a given URI and returns the response as a fully formed Entry.

  • return: The entry returned by the service after insertion.
  • access: public
Zend_Gdata_App_Entry insertEntry (mixed $data, string $uri, [string $className = 'Zend_Gdata_App_Entry'], [array $extraHeaders = array()])
  • mixed $data: The Zend_Gdata_App_Entry or XML to post
  • string $uri: POST URI
  • string $className: The class of entry to be returned.
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.
performHttpRequest (line 570)

Performs a HTTP request using the specified method

  • return: The response object
  • access: public
Zend_Http_Response performHttpRequest (string $method, string $url, [array $headers = null], [string $body = null], [string $contentType = null], [int $remainingRedirects = null])
  • string $method: The HTTP method for the request - 'GET', 'POST', 'PUT', 'DELETE'
  • string $url: The URL to which this request is being performed
  • array $headers: An associative array of HTTP headers for this request
  • string $body: The body of the HTTP request
  • string $contentType: The value for the content type of the request body
  • int $remainingRedirects: Number of redirects to follow if request s results in one

Redefined in descendants as:
post (line 799)

POST data with client object

  • throws: Zend_Gdata_App_Exception
  • throws: Zend_Gdata_App_HttpException
  • throws: Zend_Gdata_App_InvalidArgumentException
  • access: public
Zend_Http_Response post (mixed $data, [string $uri = null], [ $remainingRedirects = null], [string $contentType = null], [array $extraHeaders = null], array $headers)
  • mixed $data: The Zend_Gdata_App_Entry or XML to post
  • string $uri: POST URI
  • array $headers: Additional HTTP headers to insert.
  • string $contentType: Content-type of the data
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.
  • $remainingRedirects

Redefined in descendants as:
prepareRequest (line 466)

Provides pre-processing for HTTP requests to APP services.

  1. Checks the $data element and, if it's an entry, extracts the XML, multipart data, edit link (PUT,DELETE), etc.
  2. If $data is a string, sets the default content-type header as 'application/atom+xml' if it's not already been set.
  3. Adds a x-http-method override header and changes the HTTP method to 'POST' if necessary as per getHttpMethodOverride()

  • return: An associative array containing the determined 'method', 'url', 'data', 'headers', 'contentType'
  • access: public
array prepareRequest (string $method, [string $url = null], [array $headers = array()], [mixed $data = null], [string $contentTypeOverride = null])
  • string $method: The HTTP method for the request - 'GET', 'POST', 'PUT', 'DELETE'
  • string $url: The URL to which this request is being performed, or null if found in $data
  • array $headers: An associative array of HTTP headers for this request
  • mixed $data: The Zend_Gdata_App_Entry or XML for the body of the request
  • string $contentTypeOverride: The override value for the content type of the request body
put (line 824)

PUT data with client object

  • throws: Zend_Gdata_App_Exception
  • throws: Zend_Gdata_App_HttpException
  • throws: Zend_Gdata_App_InvalidArgumentException
  • access: public
Zend_Http_Response put (mixed $data, [string $uri = null], [ $remainingRedirects = null], [string $contentType = null], [array $extraHeaders = null], array $headers)
  • mixed $data: The Zend_Gdata_App_Entry or XML to post
  • string $uri: PUT URI
  • array $headers: Additional HTTP headers to insert.
  • string $contentType: Content-type of the data
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.
  • $remainingRedirects

Redefined in descendants as:
  • Zend_Gdata_Gapps::put() : PUT data with client object This method overrides the default behavior of Zend_Gdata_App, providing support for Zend_Gdata_Gapps_ServiceException.
registerPackage (line 180)

Adds a Zend Framework package to the $_registeredPackages array.

This array is searched when using the magic __call method below to instantiante new objects.

  • access: public
void registerPackage (string $name)
  • string $name: The name of the package (eg Zend_Gdata_App)
retrieveAllEntriesForFeed (line 973)

Retrieve all entries for a feed, iterating through pages as necessary.

Be aware that calling this function on a large dataset will take a significant amount of time to complete. In some cases this may cause execution to timeout without proper precautions in place.

  • return: A new feed of the same type as the one originally passed in, containing all relevent entries.
  • access: public
mixed retrieveAllEntriesForFeed ($feed $feed)
  • $feed $feed: The feed to iterate through.
setHttpClient (line 226)

Set the Zend_Http_Client object used for communication

  • return: Provides a fluent interface
  • throws: Zend_Gdata_App_HttpException
  • access: public
Zend_Gdata_App setHttpClient (Zend_Http_Client $client, [ $applicationId = 'MyCompany-MyApp-1.0'])

Redefined in descendants as:
setMajorProtocolVersion (line 391)

Set the major protocol version that should be used. Values < 1 will cause a Zend_Gdata_App_InvalidArgumentException to be thrown.

void setMajorProtocolVersion (int $value)
  • int $value: The major protocol version to use.
setMinorProtocolVersion (line 421)

Set the minor protocol version that should be used. If set to NULL, no minor protocol version will be sent to the server. Values < 0 will cause a Zend_Gdata_App_InvalidArgumentException to be thrown.

void setMinorProtocolVersion ((int|NULL) $value)
  • (int|NULL) $value: The minor protocol version to use.
updateEntry (line 898)

Update an entry

  • return: The entry returned from the server
  • throws: Zend_Gdata_App_Exception
  • access: public
Zend_Gdata_App_Entry updateEntry (mixed $data, [string|null $uri = null], [string|null $className = null], [array $extraHeaders = array()])
  • mixed $data: Zend_Gdata_App_Entry or XML (w/ID and link rel='edit')
  • array $extraHeaders: Extra headers to add to the request, as an array of string-based key/value pairs.
  • string|null $uri: The URI to send requests to, or null if $data contains the URI.
  • string|null $className: The name of the class that should be deserialized from the server response. If null, then 'Zend_Gdata_App_Entry' will be used.
__call (line 931)

Provides a magic factory method to instantiate new objects with

shorter syntax than would otherwise be required by the Zend Framework naming conventions. For instance, to construct a new Zend_Gdata_Calendar_Extension_Color, a developer simply needs to do $gCal->newColor(). For this magic constructor, packages are searched in the same order as which they appear in the $_registeredPackages array

  • throws: Zend_Gdata_App_Exception
  • access: public
void __call (string $method, array $args)
  • string $method: The method name being called
  • array $args: The arguments passed to the call

Redefined in descendants as:
  • Zend_Gdata_Gapps::__call() : Provides a magic factory method to instantiate new objects with shorter syntax than would otherwise be required by the Zend Framework naming conventions. For more information, see Zend_Gdata_App::__call().
Class Constants
DEFAULT_MAJOR_PROTOCOL_VERSION = 1 (line 61)

Default major protocol version.

DEFAULT_MINOR_PROTOCOL_VERSION = null (line 67)

Default minor protocol version.

Documentation generated on Mon, 19 Jan 2009 19:01:42 +0300 by phpDocumentor 1.4.2