MDL-17091 Adding part of GoogleData API from the Zend Framework, in order to support portfolio and repository functions. Also completed basic portfolio plugin.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Exception extends Exception
|
||||
{}
|
||||
|
||||
@@ -0,0 +1,207 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App
|
||||
*/
|
||||
require_once 'Zend/Gdata/App.php';
|
||||
|
||||
/**
|
||||
* Provides functionality to interact with Google data APIs
|
||||
* Subclasses exist to implement service-specific features
|
||||
*
|
||||
* As the Google data API protocol is based upon the Atom Publishing Protocol
|
||||
* (APP), GData functionality extends the appropriate Zend_Gdata_App classes
|
||||
*
|
||||
* @link http://code.google.com/apis/gdata/overview.html
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata extends Zend_Gdata_App
|
||||
{
|
||||
|
||||
/**
|
||||
* Service name for use with Google's authentication mechanisms
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const AUTH_SERVICE_NAME = 'xapi';
|
||||
|
||||
/**
|
||||
* Default URI to which to POST.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultPostUri = null;
|
||||
|
||||
/**
|
||||
* Packages to search for classes when using magic __call method, in order.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_registeredPackages = array(
|
||||
'Zend_Gdata_Kind',
|
||||
'Zend_Gdata_Extension',
|
||||
'Zend_Gdata',
|
||||
'Zend_Gdata_App_Extension',
|
||||
'Zend_Gdata_App');
|
||||
|
||||
/**
|
||||
* Namespaces used for GData data
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $namespaces = array(
|
||||
'openSearch' => 'http://a9.com/-/spec/opensearchrss/1.0/',
|
||||
'rss' => 'http://blogs.law.harvard.edu/tech/rss',
|
||||
'gd' => 'http://schemas.google.com/g/2005');
|
||||
|
||||
/**
|
||||
* Client object used to communicate
|
||||
*
|
||||
* @var Zend_Gdata_HttpClient
|
||||
*/
|
||||
protected $_httpClient;
|
||||
|
||||
/**
|
||||
* Client object used to communicate in static context
|
||||
*
|
||||
* @var Zend_Gdata_HttpClient
|
||||
*/
|
||||
protected static $_staticHttpClient = null;
|
||||
|
||||
/**
|
||||
* Create Gdata object
|
||||
*
|
||||
* @param Zend_Http_Client $client
|
||||
* @param string $applicationId The identity of the app in the form of Company-AppName-Version
|
||||
*/
|
||||
public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
parent::__construct($client, $applicationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Imports a feed located at $uri.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param Zend_Http_Client $client The client used for communication
|
||||
* @param string $className The class which is used as the return type
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @return Zend_Gdata_App_Feed
|
||||
*/
|
||||
public static function import($uri, $client = null, $className='Zend_Gdata_Feed')
|
||||
{
|
||||
$app = new Zend_Gdata($client);
|
||||
$requestData = $app->decodeRequest('GET', $uri);
|
||||
$response = $app->performHttpRequest($requestData['method'], $requestData['url']);
|
||||
|
||||
$feedContent = $response->getBody();
|
||||
$feed = self::importString($feedContent, $className);
|
||||
if ($client != null) {
|
||||
$feed->setHttpClient($client);
|
||||
}
|
||||
return $feed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive feed object
|
||||
*
|
||||
* @param mixed $location The location as string or Zend_Gdata_Query
|
||||
* @param string $className The class type to use for returning the feed
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
* @return Zend_Gdata_Feed
|
||||
*/
|
||||
public function getFeed($location, $className='Zend_Gdata_Feed')
|
||||
{
|
||||
if (is_string($location)) {
|
||||
$uri = $location;
|
||||
} elseif ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You must specify the location as either a string URI ' .
|
||||
'or a child of Zend_Gdata_Query');
|
||||
}
|
||||
return parent::getFeed($uri, $className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object
|
||||
*
|
||||
* @param mixed $location The location as string or Zend_Gdata_Query
|
||||
* @return Zend_Gdata_Feed
|
||||
*/
|
||||
public function getEntry($location, $className='Zend_Gdata_Entry')
|
||||
{
|
||||
if (is_string($location)) {
|
||||
$uri = $location;
|
||||
} elseif ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You must specify the location as either a string URI ' .
|
||||
'or a child of Zend_Gdata_Query');
|
||||
}
|
||||
return parent::getEntry($uri, $className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a HTTP request using the specified method.
|
||||
*
|
||||
* Overrides the definition in the parent (Zend_Gdata_App)
|
||||
* and uses the Zend_Gdata_HttpClient functionality
|
||||
* to filter the HTTP requests and responses.
|
||||
*
|
||||
* @param string $method The HTTP method for the request -
|
||||
* 'GET', 'POST', 'PUT', 'DELETE'
|
||||
* @param string $url The URL to which this request is being performed,
|
||||
* or null if found in $data
|
||||
* @param array $headers An associative array of HTTP headers
|
||||
* for this request
|
||||
* @param string $body The body of the HTTP request
|
||||
* @param string $contentType The value for the content type of the
|
||||
* request body
|
||||
* @param int $remainingRedirects Number of redirects to follow
|
||||
* if requests results in one
|
||||
* @return Zend_Http_Response The response object
|
||||
*/
|
||||
public function performHttpRequest($method, $url, $headers = array(), $body = null, $contentType = null, $remainingRedirects = null)
|
||||
{
|
||||
if ($this->_httpClient instanceof Zend_Gdata_HttpClient) {
|
||||
$filterResult = $this->_httpClient->filterHttpRequest($method, $url, $headers, $body, $contentType);
|
||||
$method = $filterResult['method'];
|
||||
$url = $filterResult['url'];
|
||||
$body = $filterResult['body'];
|
||||
$headers = $filterResult['headers'];
|
||||
$contentType = $filterResult['contentType'];
|
||||
return $this->_httpClient->filterHttpResponse(parent::performHttpRequest($method, $url, $headers, $body, $contentType, $remainingRedirects));
|
||||
} else {
|
||||
return parent::performHttpRequest($method, $url, $headers, $body, $contentType, $remainingRedirects);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,804 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_Feed
|
||||
*/
|
||||
require_once 'Zend/Gdata/Feed.php';
|
||||
|
||||
/**
|
||||
* Zend_Gdata_Http_Client
|
||||
*/
|
||||
require_once 'Zend/Http/Client.php';
|
||||
|
||||
/**
|
||||
* Zend_Version
|
||||
*/
|
||||
require_once 'Zend/Version.php';
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_MediaSource
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/MediaSource.php';
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App
|
||||
{
|
||||
|
||||
/**
|
||||
* Client object used to communicate
|
||||
*
|
||||
* @var Zend_Http_Client
|
||||
*/
|
||||
protected $_httpClient;
|
||||
|
||||
/**
|
||||
* Client object used to communicate in static context
|
||||
*
|
||||
* @var Zend_Http_Client
|
||||
*/
|
||||
protected static $_staticHttpClient = null;
|
||||
|
||||
/**
|
||||
* Override HTTP PUT and DELETE request methods?
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $_httpMethodOverride = false;
|
||||
|
||||
/**
|
||||
* Enable gzipped responses?
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $_gzipEnabled = false;
|
||||
|
||||
/**
|
||||
* Use verbose exception messages. In the case of HTTP errors,
|
||||
* use the body of the HTTP response in the exception message.
|
||||
*
|
||||
* @var boolean
|
||||
*/
|
||||
protected static $_verboseExceptionMessages = true;
|
||||
|
||||
/**
|
||||
* Default URI to which to POST.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultPostUri = null;
|
||||
|
||||
/**
|
||||
* Packages to search for classes when using magic __call method, in order.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_registeredPackages = array(
|
||||
'Zend_Gdata_App_Extension',
|
||||
'Zend_Gdata_App');
|
||||
|
||||
/**
|
||||
* Maximum number of redirects to follow during HTTP operations
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected static $_maxRedirects = 5;
|
||||
|
||||
/**
|
||||
* Create Gdata object
|
||||
*
|
||||
* @param Zend_Http_Client $client
|
||||
* @param string $applicationId
|
||||
*/
|
||||
public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
$this->setHttpClient($client, $applicationId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a Zend Framework package to the $_registeredPackages array.
|
||||
* This array is searched when using the magic __call method below
|
||||
* to instantiante new objects.
|
||||
*
|
||||
* @param string $name The name of the package (eg Zend_Gdata_App)
|
||||
* @return void
|
||||
*/
|
||||
public function registerPackage($name)
|
||||
{
|
||||
array_unshift($this->_registeredPackages, $name);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive feed object
|
||||
*
|
||||
* @param string $uri The uri from which to retrieve the feed
|
||||
* @param string $className The class which is used as the return type
|
||||
* @return Zend_Gdata_App_Feed
|
||||
*/
|
||||
public function getFeed($uri, $className='Zend_Gdata_App_Feed')
|
||||
{
|
||||
return $this->importUrl($uri, $className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object
|
||||
*
|
||||
* @param string $uri
|
||||
* @param string $className The class which is used as the return type
|
||||
* @return Zend_Gdata_App_Entry
|
||||
*/
|
||||
public function getEntry($uri, $className='Zend_Gdata_App_Entry')
|
||||
{
|
||||
return $this->importUrl($uri, $className);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Zend_Http_Client object used for communication
|
||||
*
|
||||
* @return Zend_Http_Client
|
||||
*/
|
||||
public function getHttpClient()
|
||||
{
|
||||
return $this->_httpClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Zend_Http_Client object used for communication
|
||||
*
|
||||
* @param Zend_Http_Client $client The client to use for communication
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
* @return Zend_Gdata_App Provides a fluent interface
|
||||
*/
|
||||
public function setHttpClient($client, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
if ($client === null) {
|
||||
$client = new Zend_Http_Client();
|
||||
}
|
||||
if (!$client instanceof Zend_Http_Client) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException('Argument is not an instance of Zend_Http_Client.');
|
||||
}
|
||||
$userAgent = $applicationId . ' Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setHeaders('User-Agent', $userAgent);
|
||||
$client->setConfig(array(
|
||||
'strictredirects' => true
|
||||
)
|
||||
);
|
||||
$this->_httpClient = $client;
|
||||
Zend_Gdata::setStaticHttpClient($client);
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the static HTTP client instance
|
||||
*
|
||||
* Sets the static HTTP client object to use for retrieving the feed.
|
||||
*
|
||||
* @param Zend_Http_Client $httpClient
|
||||
* @return void
|
||||
*/
|
||||
public static function setStaticHttpClient(Zend_Http_Client $httpClient)
|
||||
{
|
||||
self::$_staticHttpClient = $httpClient;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used.
|
||||
*
|
||||
* @return Zend_Http_Client
|
||||
*/
|
||||
public static function getStaticHttpClient()
|
||||
{
|
||||
if (!self::$_staticHttpClient instanceof Zend_Http_Client) {
|
||||
$client = new Zend_Http_Client();
|
||||
$userAgent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setHeaders('User-Agent', $userAgent);
|
||||
$client->setConfig(array(
|
||||
'strictredirects' => true
|
||||
)
|
||||
);
|
||||
self::$_staticHttpClient = $client;
|
||||
}
|
||||
return self::$_staticHttpClient;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param boolean $override Whether to override PUT and DELETE with POST.
|
||||
* @return void
|
||||
*/
|
||||
public static function setHttpMethodOverride($override = true)
|
||||
{
|
||||
self::$_httpMethodOverride = $override;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTTP override state
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function getHttpMethodOverride()
|
||||
{
|
||||
return self::$_httpMethodOverride;
|
||||
}
|
||||
|
||||
/**
|
||||
* Toggle requesting gzip encoded responses
|
||||
*
|
||||
* @param boolean $enabled Whether or not to enable gzipped responses
|
||||
* @return void
|
||||
*/
|
||||
public static function setGzipEnabled($enabled = false)
|
||||
{
|
||||
if ($enabled && !function_exists('gzinflate')) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You cannot enable gzipped responses if the zlib module ' .
|
||||
'is not enabled in your PHP installation.');
|
||||
|
||||
}
|
||||
self::$_gzipEnabled = $enabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the HTTP override state
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function getGzipEnabled()
|
||||
{
|
||||
return self::$_gzipEnabled;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get whether to use verbose exception messages
|
||||
*
|
||||
* In the case of HTTP errors, use the body of the HTTP response
|
||||
* in the exception message.
|
||||
*
|
||||
* @return boolean
|
||||
*/
|
||||
public static function getVerboseExceptionMessages()
|
||||
{
|
||||
return self::$_verboseExceptionMessages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set whether to use verbose exception messages
|
||||
*
|
||||
* In the case of HTTP errors, use the body of the HTTP response
|
||||
* in the exception message.
|
||||
*
|
||||
* @param boolean $verbose Whether to use verbose exception messages
|
||||
*/
|
||||
public static function setVerboseExceptionMessages($verbose)
|
||||
{
|
||||
self::$_verboseExceptionMessages = $verbose;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the maximum number of redirects to follow during HTTP operations
|
||||
*
|
||||
* @param int $maxRedirects Maximum number of redirects to follow
|
||||
* @return void
|
||||
*/
|
||||
public static function setMaxRedirects($maxRedirects)
|
||||
{
|
||||
self::$_maxRedirects = $maxRedirects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the maximum number of redirects to follow during HTTP operations
|
||||
*
|
||||
* @return int Maximum number of redirects to follow
|
||||
*/
|
||||
public static function getMaxRedirects()
|
||||
{
|
||||
return self::$_maxRedirects;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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()
|
||||
*
|
||||
* @param string $method The HTTP method for the request - 'GET', 'POST',
|
||||
* 'PUT', 'DELETE'
|
||||
* @param string $url The URL to which this request is being performed,
|
||||
* or null if found in $data
|
||||
* @param array $headers An associative array of HTTP headers for this
|
||||
* request
|
||||
* @param mixed $data The Zend_Gdata_App_Entry or XML for the
|
||||
* body of the request
|
||||
* @param string $contentTypeOverride The override value for the
|
||||
* content type of the request body
|
||||
* @return array An associative array containing the determined
|
||||
* 'method', 'url', 'data', 'headers', 'contentType'
|
||||
*/
|
||||
public function prepareRequest($method, $url = null, $headers = array(), $data = null, $contentTypeOverride = null)
|
||||
{
|
||||
$rawData = null;
|
||||
$finalContentType = null;
|
||||
if ($url == null) {
|
||||
$url = $this->_defaultPostUri;
|
||||
}
|
||||
|
||||
if (is_string($data)) {
|
||||
$rawData = $data;
|
||||
if ($contentTypeOverride === null) {
|
||||
$finalContentType = 'application/atom+xml';
|
||||
}
|
||||
} elseif ($data instanceof Zend_Gdata_App_MediaEntry) {
|
||||
$rawData = $data->encode();
|
||||
if ($data->getMediaSource() !== null) {
|
||||
$finalContentType = 'multipart/related; boundary="' . $data->getBoundary() . '"';
|
||||
$headers['MIME-version'] = '1.0';
|
||||
$headers['Slug'] = $data->getMediaSource()->getSlug();
|
||||
} else {
|
||||
$finalContentType = 'application/atom+xml';
|
||||
}
|
||||
if ($method == 'PUT' || $method == 'DELETE') {
|
||||
$editLink = $data->getEditLink();
|
||||
if ($editLink != null) {
|
||||
$url = $editLink->getHref();
|
||||
}
|
||||
}
|
||||
} elseif ($data instanceof Zend_Gdata_App_Entry) {
|
||||
$rawData = $data->saveXML();
|
||||
$finalContentType = 'application/atom+xml';
|
||||
if ($method == 'PUT' || $method == 'DELETE') {
|
||||
$editLink = $data->getEditLink();
|
||||
if ($editLink != null) {
|
||||
$url = $editLink->getHref();
|
||||
}
|
||||
}
|
||||
} elseif ($data instanceof Zend_Gdata_App_MediaSource) {
|
||||
$rawData = $data->encode();
|
||||
if ($data->getSlug() !== null) {
|
||||
$headers['Slug'] = $data->getSlug();
|
||||
}
|
||||
$finalContentType = $data->getContentType();
|
||||
}
|
||||
if ($method == 'DELETE') {
|
||||
$rawData = null;
|
||||
}
|
||||
if ($method != 'POST' && $method != 'GET' && Zend_Gdata_App::getHttpMethodOverride()) {
|
||||
$headers['x-http-method-override'] = $method;
|
||||
$method = 'POST';
|
||||
} else {
|
||||
$headers['x-http-method-override'] = null;
|
||||
}
|
||||
|
||||
if ($contentTypeOverride != null) {
|
||||
$finalContentType = $contentTypeOverride;
|
||||
}
|
||||
|
||||
return array('method' => $method, 'url' => $url, 'data' => $rawData, 'headers' => $headers, 'contentType' => $finalContentType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Performs a HTTP request using the specified method
|
||||
*
|
||||
* @param string $method The HTTP method for the request - 'GET', 'POST',
|
||||
* 'PUT', 'DELETE'
|
||||
* @param string $url The URL to which this request is being performed
|
||||
* @param array $headers An associative array of HTTP headers
|
||||
* for this request
|
||||
* @param string $body The body of the HTTP request
|
||||
* @param string $contentType The value for the content type
|
||||
* of the request body
|
||||
* @param int $remainingRedirects Number of redirects to follow if request
|
||||
* s results in one
|
||||
* @return Zend_Http_Response The response object
|
||||
*/
|
||||
public function performHttpRequest($method, $url, $headers = null, $body = null, $contentType = null, $remainingRedirects = null)
|
||||
{
|
||||
require_once 'Zend/Http/Client/Exception.php';
|
||||
if ($remainingRedirects === null) {
|
||||
$remainingRedirects = self::getMaxRedirects();
|
||||
}
|
||||
if ($headers === null) {
|
||||
$headers = array();
|
||||
}
|
||||
// check the overridden method
|
||||
if (($method == 'POST' || $method == 'PUT') && $body === null && $headers['x-http-method-override'] != 'DELETE') {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You must specify the data to post as either a ' .
|
||||
'string or a child of Zend_Gdata_App_Entry');
|
||||
}
|
||||
if ($url === null) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException('You must specify an URI to which to post.');
|
||||
}
|
||||
$headers['Content-Type'] = $contentType;
|
||||
if (Zend_Gdata_App::getGzipEnabled()) {
|
||||
// some services require the word 'gzip' to be in the user-agent header
|
||||
// in addition to the accept-encoding header
|
||||
if (strpos($this->_httpClient->getHeader('User-Agent'), 'gzip') === false) {
|
||||
$headers['User-Agent'] = $this->_httpClient->getHeader('User-Agent') . ' (gzip)';
|
||||
}
|
||||
$headers['Accept-encoding'] = 'gzip, deflate';
|
||||
} else {
|
||||
$headers['Accept-encoding'] = 'identity';
|
||||
}
|
||||
|
||||
// Make sure the HTTP client object is 'clean' before making a request
|
||||
// In addition to standard headers to reset via resetParameters(),
|
||||
// also reset the Slug header
|
||||
$this->_httpClient->resetParameters();
|
||||
$this->_httpClient->setHeaders('Slug', null);
|
||||
|
||||
// Set the params for the new request to be performed
|
||||
$this->_httpClient->setHeaders($headers);
|
||||
$this->_httpClient->setUri($url);
|
||||
$this->_httpClient->setConfig(array('maxredirects' => 0));
|
||||
$this->_httpClient->setRawData($body, $contentType);
|
||||
try {
|
||||
$response = $this->_httpClient->request($method);
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
|
||||
}
|
||||
if ($response->isRedirect()) {
|
||||
if ($remainingRedirects > 0) {
|
||||
$newUrl = $response->getHeader('Location');
|
||||
$response = $this->performHttpRequest($method, $newUrl, $headers, $body, $contentType, $remainingRedirects);
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException(
|
||||
'Number of redirects exceeds maximum', null, $response);
|
||||
}
|
||||
}
|
||||
if (!$response->isSuccessful()) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
$exceptionMessage = 'Expected response code 200, got ' . $response->getStatus();
|
||||
if (self::getVerboseExceptionMessages()) {
|
||||
$exceptionMessage .= "\n" . $response->getBody();
|
||||
}
|
||||
$exception = new Zend_Gdata_App_HttpException($exceptionMessage);
|
||||
$exception->setResponse($response);
|
||||
throw $exception;
|
||||
}
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imports a feed located at $uri.
|
||||
*
|
||||
* @param string $uri
|
||||
* @param Zend_Http_Client $client The client used for communication
|
||||
* @param string $className The class which is used as the return type
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @return Zend_Gdata_App_Feed
|
||||
*/
|
||||
public static function import($uri, $client = null, $className='Zend_Gdata_App_Feed')
|
||||
{
|
||||
$app = new Zend_Gdata_App($client);
|
||||
$requestData = $app->prepareRequest('GET', $uri);
|
||||
$response = $app->performHttpRequest($requestData['method'], $requestData['url']);
|
||||
|
||||
$feedContent = $response->getBody();
|
||||
$feed = self::importString($feedContent, $className);
|
||||
if ($client != null) {
|
||||
$feed->setHttpClient($client);
|
||||
}
|
||||
return $feed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Imports the specified URL (non-statically).
|
||||
*
|
||||
* @param string $url The URL to import
|
||||
* @param string $className The class which is used as the return type
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @return Zend_Gdata_App_Feed
|
||||
*/
|
||||
public function importUrl($url, $className='Zend_Gdata_App_Feed')
|
||||
{
|
||||
$response = $this->get($url);
|
||||
|
||||
$feedContent = $response->getBody();
|
||||
$feed = self::importString($feedContent, $className);
|
||||
if ($this->getHttpClient() != null) {
|
||||
$feed->setHttpClient($this->getHttpClient());
|
||||
}
|
||||
return $feed;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Imports a feed represented by $string.
|
||||
*
|
||||
* @param string $string
|
||||
* @param string $className The class which is used as the return type
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @return Zend_Gdata_App_Feed
|
||||
*/
|
||||
public static function importString($string, $className='Zend_Gdata_App_Feed')
|
||||
{
|
||||
// Load the feed as an XML DOMDocument object
|
||||
@ini_set('track_errors', 1);
|
||||
$doc = new DOMDocument();
|
||||
$success = @$doc->loadXML($string);
|
||||
@ini_restore('track_errors');
|
||||
|
||||
if (!$success) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg");
|
||||
}
|
||||
$feed = new $className($string);
|
||||
$feed->setHttpClient(self::getstaticHttpClient());
|
||||
return $feed;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Imports a feed from a file located at $filename.
|
||||
*
|
||||
* @param string $filename
|
||||
* @param string $className The class which is used as the return type
|
||||
* @param string $useIncludePath Whether the include_path should be searched
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @return Zend_Gdata_Feed
|
||||
*/
|
||||
public static function importFile($filename,
|
||||
$className='Zend_Gdata_App_Feed', $useIncludePath = false)
|
||||
{
|
||||
@ini_set('track_errors', 1);
|
||||
$feed = @file_get_contents($filename, $useIncludePath);
|
||||
@ini_restore('track_errors');
|
||||
if ($feed === false) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception("File could not be loaded: $php_errormsg");
|
||||
}
|
||||
return self::importString($feed, $className);
|
||||
}
|
||||
|
||||
/**
|
||||
* GET a uri using client object
|
||||
*
|
||||
* @param string $uri
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
* @return Zend_Http_Response
|
||||
*/
|
||||
public function get($uri)
|
||||
{
|
||||
$requestData = $this->prepareRequest('GET', $uri);
|
||||
return $this->performHttpRequest($requestData['method'], $requestData['url']);
|
||||
}
|
||||
|
||||
/**
|
||||
* POST data with client object
|
||||
*
|
||||
* @param mixed $data The Zend_Gdata_App_Entry or XML to post
|
||||
* @param string $uri POST URI
|
||||
* @param array $headers Additional HTTP headers to insert.
|
||||
* @param string $contentType Content-type of the data
|
||||
* @param array $extraHaders Extra headers to add to the request
|
||||
* @return Zend_Http_Response
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public function post($data, $uri = null, $remainingRedirects = null,
|
||||
$contentType = null, $extraHeaders = null)
|
||||
{
|
||||
$requestData = $this->prepareRequest('POST', $uri, $extraHeaders,
|
||||
$data, $contentType);
|
||||
return $this->performHttpRequest(
|
||||
$requestData['method'], $requestData['url'],
|
||||
$requestData['headers'], $requestData['data'],
|
||||
$requestData['contentType']);
|
||||
}
|
||||
|
||||
/**
|
||||
* PUT data with client object
|
||||
*
|
||||
* @param mixed $data The Zend_Gdata_App_Entry or XML to post
|
||||
* @param string $uri PUT URI
|
||||
* @param array $headers Additional HTTP headers to insert.
|
||||
* @param string $contentType Content-type of the data
|
||||
* @param array $extraHaders Extra headers to add to the request
|
||||
* @return Zend_Http_Response
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public function put($data, $uri = null, $remainingRedirects = null,
|
||||
$contentType = null, $extraHeaders = null)
|
||||
{
|
||||
$requestData = $this->prepareRequest('PUT', $uri, $extraHeaders, $data, $contentType);
|
||||
return $this->performHttpRequest(
|
||||
$requestData['method'], $requestData['url'],
|
||||
$requestData['headers'], $requestData['data'],
|
||||
$requestData['contentType']);
|
||||
}
|
||||
|
||||
/**
|
||||
* DELETE entry with client object
|
||||
*
|
||||
* @param mixed $data The Zend_Gdata_App_Entry or URL to delete
|
||||
* @return void
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public function delete($data, $remainingRedirects = null)
|
||||
{
|
||||
if (is_string($data)) {
|
||||
$requestData = $this->prepareRequest('DELETE', $data);
|
||||
} else {
|
||||
$requestData = $this->prepareRequest('DELETE', null, null, $data);
|
||||
}
|
||||
return $this->performHttpRequest($requestData['method'], $requestData['url'],
|
||||
$requestData['headers'], '', $requestData['contentType'],
|
||||
$remainingRedirects);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an entry to a given URI and returns the response as a fully formed Entry.
|
||||
* @param mixed $data The Zend_Gdata_App_Entry or XML to post
|
||||
* @param string $uri POST URI
|
||||
* @param string $className The class of entry to be returned.
|
||||
* @return Zend_Gdata_App_Entry The entry returned by the service after insertion.
|
||||
*/
|
||||
public function insertEntry($data, $uri, $className='Zend_Gdata_App_Entry')
|
||||
{
|
||||
$response = $this->post($data, $uri);
|
||||
|
||||
$returnEntry = new $className($response->getBody());
|
||||
$returnEntry->setHttpClient(self::getstaticHttpClient());
|
||||
return $returnEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an entry
|
||||
*
|
||||
* @param mixed $data Zend_Gdata_App_Entry or XML (w/ID and link rel='edit')
|
||||
* @return Zend_Gdata_App_Entry The entry returned from the server
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
*/
|
||||
public function updateEntry($data, $uri = null, $className = null)
|
||||
{
|
||||
if ($className === null && $data instanceof Zend_Gdata_App_Entry) {
|
||||
$className = get_class($data);
|
||||
} elseif ($className === null) {
|
||||
$className = 'Zend_Gdata_App_Entry';
|
||||
}
|
||||
|
||||
$response = $this->put($data, $uri);
|
||||
$returnEntry = new $className($response->getBody());
|
||||
$returnEntry->setHttpClient(self::getstaticHttpClient());
|
||||
return $returnEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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
|
||||
*
|
||||
* @param string $method The method name being called
|
||||
* @param array $args The arguments passed to the call
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
*/
|
||||
public function __call($method, $args)
|
||||
{
|
||||
if (preg_match('/^new(\w+)/', $method, $matches)) {
|
||||
$class = $matches[1];
|
||||
$foundClassName = null;
|
||||
foreach ($this->_registeredPackages as $name) {
|
||||
try {
|
||||
@Zend_Loader::loadClass("${name}_${class}");
|
||||
$foundClassName = "${name}_${class}";
|
||||
break;
|
||||
} catch (Zend_Exception $e) {
|
||||
// package wasn't here- continue searching
|
||||
}
|
||||
}
|
||||
if ($foundClassName != null) {
|
||||
$reflectionObj = new ReflectionClass($foundClassName);
|
||||
return $reflectionObj->newInstanceArgs($args);
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
"Unable to find '${class}' in registered packages");
|
||||
}
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception("No such method ${method}");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param $feed The feed to iterate through.
|
||||
* @return mixed A new feed of the same type as the one originally
|
||||
* passed in, containing all relevent entries.
|
||||
*/
|
||||
public function retrieveAllEntriesForFeed($feed) {
|
||||
$feedClass = get_class($feed);
|
||||
$reflectionObj = new ReflectionClass($feedClass);
|
||||
$result = $reflectionObj->newInstance();
|
||||
do {
|
||||
foreach ($feed as $entry) {
|
||||
$result->addEntry($entry);
|
||||
}
|
||||
|
||||
$next = $feed->getLink('next');
|
||||
if ($next !== null) {
|
||||
$feed = $this->getFeed($next->href, $feedClass);
|
||||
} else {
|
||||
$feed = null;
|
||||
}
|
||||
}
|
||||
while ($feed != null);
|
||||
return $result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*
|
||||
* @param $logfile The logfile to use when logging the requests
|
||||
*/
|
||||
public function enableRequestDebugLogging($logfile)
|
||||
{
|
||||
$this->_httpClient->setConfig(array(
|
||||
'adapter' => 'Zend_Gdata_App_LoggingHttpClientAdapterSocket',
|
||||
'logfile' => $logfile
|
||||
));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Zend_Gdata_App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Exception
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
|
||||
/**
|
||||
* Gdata exceptions
|
||||
*
|
||||
* Class to represent exceptions that occur during Gdata operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Zend_Gdata_App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_AuthException extends Zend_Gdata_App_Exception
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_Exception
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
|
||||
/**
|
||||
* Gdata APP exceptions
|
||||
*
|
||||
* Class to represent exceptions that occur during Gdata APP operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_BadMethodCallException extends Zend_Gdata_App_Exception
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,459 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Abstract class for all XML elements
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Gdata_App_Base
|
||||
{
|
||||
|
||||
/**
|
||||
* @var string The XML element name, including prefix if desired
|
||||
*/
|
||||
protected $_rootElement = null;
|
||||
|
||||
/**
|
||||
* @var string The XML namespace prefix
|
||||
*/
|
||||
protected $_rootNamespace = 'atom';
|
||||
|
||||
/**
|
||||
* @var string The XML namespace URI - takes precedence over lookup up the
|
||||
* corresponding URI for $_rootNamespace
|
||||
*/
|
||||
protected $_rootNamespaceURI = null;
|
||||
|
||||
/**
|
||||
* @var array Leftover elements which were not handled
|
||||
*/
|
||||
protected $_extensionElements = array();
|
||||
|
||||
/**
|
||||
* @var array Leftover attributes which were not handled
|
||||
*/
|
||||
protected $_extensionAttributes = array();
|
||||
|
||||
/**
|
||||
* @var string XML child text node content
|
||||
*/
|
||||
protected $_text = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_namespaces = array(
|
||||
'atom' => 'http://www.w3.org/2005/Atom',
|
||||
'app' => 'http://purl.org/atom/app#'
|
||||
);
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the child text node of this element
|
||||
* This represents any raw text contained within the XML element
|
||||
*
|
||||
* @return string Child text node
|
||||
*/
|
||||
public function getText($trim = true)
|
||||
{
|
||||
if ($trim) {
|
||||
return trim($this->_text);
|
||||
} else {
|
||||
return $this->_text;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the child text node of this element
|
||||
* This represents any raw text contained within the XML element
|
||||
*
|
||||
* @param string $value Child text node
|
||||
* @return Zend_Gdata_App_Base Returns an object of the same type as 'this' to provide a fluent interface.
|
||||
*/
|
||||
public function setText($value)
|
||||
{
|
||||
$this->_text = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all elements not matched to data model classes
|
||||
* during the parsing of the XML
|
||||
*
|
||||
* @return array All elements not matched to data model classes during parsing
|
||||
*/
|
||||
public function getExtensionElements()
|
||||
{
|
||||
return $this->_extensionElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of all elements not matched to data model classes
|
||||
* during the parsing of the XML. This method can be used to add arbitrary
|
||||
* child XML elements to any data model class.
|
||||
*
|
||||
* @param array $value All extension elements
|
||||
* @return Zend_Gdata_App_Base Returns an object of the same type as 'this' to provide a fluent interface.
|
||||
*/
|
||||
public function setExtensionElements($value)
|
||||
{
|
||||
$this->_extensionElements = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns an array of all extension attributes not transformed into data
|
||||
* model properties during parsing of the XML. Each element of the array
|
||||
* is a hashed array of the format:
|
||||
* array('namespaceUri' => string, 'name' => string, 'value' => string);
|
||||
*
|
||||
* @return array All extension attributes
|
||||
*/
|
||||
public function getExtensionAttributes()
|
||||
{
|
||||
return $this->_extensionAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets an array of all extension attributes not transformed into data
|
||||
* model properties during parsing of the XML. Each element of the array
|
||||
* is a hashed array of the format:
|
||||
* array('namespaceUri' => string, 'name' => string, 'value' => string);
|
||||
* This can be used to add arbitrary attributes to any data model element
|
||||
*
|
||||
* @param array $value All extension attributes
|
||||
* @return Zend_Gdata_App_Base Returns an object of the same type as 'this' to provide a fluent interface.
|
||||
*/
|
||||
public function setExtensionAttributes($value)
|
||||
{
|
||||
$this->_extensionAttributes = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
if (is_null($doc)) {
|
||||
$doc = new DOMDocument('1.0', 'utf-8');
|
||||
}
|
||||
if ($this->_rootNamespaceURI != null) {
|
||||
$element = $doc->createElementNS($this->_rootNamespaceURI, $this->_rootElement);
|
||||
} elseif ($this->_rootNamespace !== null) {
|
||||
if (strpos($this->_rootElement, ':') === false) {
|
||||
$elementName = $this->_rootNamespace . ':' . $this->_rootElement;
|
||||
} else {
|
||||
$elementName = $this->_rootElement;
|
||||
}
|
||||
$element = $doc->createElementNS($this->lookupNamespace($this->_rootNamespace), $elementName);
|
||||
} else {
|
||||
$element = $doc->createElement($this->_rootElement);
|
||||
}
|
||||
if ($this->_text != null) {
|
||||
$element->appendChild($element->ownerDocument->createTextNode($this->_text));
|
||||
}
|
||||
foreach ($this->_extensionElements as $extensionElement) {
|
||||
$element->appendChild($extensionElement->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_extensionAttributes as $attribute) {
|
||||
$element->setAttribute($attribute['name'], $attribute['value']);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a child DOMNode, tries to determine how to map the data into
|
||||
* object instance members. If no mapping is defined, Extension_Element
|
||||
* objects are created and stored in an array.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode needed to be handled
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
if ($child->nodeType == XML_TEXT_NODE) {
|
||||
$this->_text = $child->nodeValue;
|
||||
} else {
|
||||
$extensionElement = new Zend_Gdata_App_Extension_Element();
|
||||
$extensionElement->transferFromDOM($child);
|
||||
$this->_extensionElements[] = $extensionElement;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
$arrayIndex = ($attribute->namespaceURI != '')?(
|
||||
$attribute->namespaceURI . ':' . $attribute->name):
|
||||
$attribute->name;
|
||||
$this->_extensionAttributes[$arrayIndex] =
|
||||
array('namespaceUri' => $attribute->namespaceURI,
|
||||
'name' => $attribute->localName,
|
||||
'value' => $attribute->nodeValue);
|
||||
}
|
||||
|
||||
/**
|
||||
* Transfers each child and attribute into member variables.
|
||||
* This is called when XML is received over the wire and the data
|
||||
* model needs to be built to represent this XML.
|
||||
*
|
||||
* @param DOMNode $node The DOMNode that represents this object's data
|
||||
*/
|
||||
public function transferFromDOM($node)
|
||||
{
|
||||
foreach ($node->childNodes as $child) {
|
||||
$this->takeChildFromDOM($child);
|
||||
}
|
||||
foreach ($node->attributes as $attribute) {
|
||||
$this->takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses the provided XML text and generates data model classes for
|
||||
* each know element by turning the XML text into a DOM tree and calling
|
||||
* transferFromDOM($element). The first data model element with the same
|
||||
* name as $this->_rootElement is used and the child elements are
|
||||
* recursively parsed.
|
||||
*
|
||||
* @param string $xml The XML text to parse
|
||||
*/
|
||||
public function transferFromXML($xml)
|
||||
{
|
||||
if ($xml) {
|
||||
// Load the feed as an XML DOMDocument object
|
||||
@ini_set('track_errors', 1);
|
||||
$doc = new DOMDocument();
|
||||
$success = @$doc->loadXML($xml);
|
||||
@ini_restore('track_errors');
|
||||
if (!$success) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg");
|
||||
}
|
||||
$element = $doc->getElementsByTagName($this->_rootElement)->item(0);
|
||||
if (!$element) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception('No root <' . $this->_rootElement . '> element');
|
||||
}
|
||||
$this->transferFromDOM($element);
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception('XML passed to transferFromXML cannot be null');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Converts this element and all children into XML text using getDOM()
|
||||
*
|
||||
* @return string XML content
|
||||
*/
|
||||
public function saveXML()
|
||||
{
|
||||
$element = $this->getDOM();
|
||||
return $element->ownerDocument->saveXML($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for saveXML() returns XML content for this element and all
|
||||
* children
|
||||
*
|
||||
* @return string XML content
|
||||
*/
|
||||
public function getXML()
|
||||
{
|
||||
return $this->saveXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for saveXML()
|
||||
*
|
||||
* Can be overridden by children to provide more complex representations
|
||||
* of entries.
|
||||
*
|
||||
* @return string Encoded string content
|
||||
*/
|
||||
public function encode()
|
||||
{
|
||||
return $this->saveXML();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the full version of a namespace prefix
|
||||
*
|
||||
* Looks up a prefix (atom:, etc.) in the list of registered
|
||||
* namespaces and returns the full namespace URI if
|
||||
* available. Returns the prefix, unmodified, if it's not
|
||||
* registered.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function lookupNamespace($prefix)
|
||||
{
|
||||
return isset($this->_namespaces[$prefix]) ?
|
||||
$this->_namespaces[$prefix] :
|
||||
$prefix;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Add a namespace and prefix to the registered list
|
||||
*
|
||||
* Takes a prefix and a full namespace URI and adds them to the
|
||||
* list of registered namespaces for use by
|
||||
* $this->lookupNamespace().
|
||||
*
|
||||
* @param string $prefix The namespace prefix
|
||||
* @param string $namespaceUri The full namespace URI
|
||||
* @return void
|
||||
*/
|
||||
public function registerNamespace($prefix, $namespaceUri)
|
||||
{
|
||||
$this->_namespaces[$prefix] = $namespaceUri;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic getter to allow acces like $entry->foo to call $entry->getFoo()
|
||||
* Alternatively, if no getFoo() is defined, but a $_foo protected variable
|
||||
* is defined, this is returned.
|
||||
*
|
||||
* TODO Remove ability to bypass getFoo() methods??
|
||||
*
|
||||
* @param string $name The variable name sought
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
$method = 'get'.ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array(&$this, $method));
|
||||
} else if (property_exists($this, "_${name}")) {
|
||||
return $this->{'_' . $name};
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic setter to allow acces like $entry->foo='bar' to call
|
||||
* $entry->setFoo('bar') automatically.
|
||||
*
|
||||
* Alternatively, if no setFoo() is defined, but a $_foo protected variable
|
||||
* is defined, this is returned.
|
||||
*
|
||||
* TODO Remove ability to bypass getFoo() methods??
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*/
|
||||
public function __set($name, $val)
|
||||
{
|
||||
$method = 'set'.ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array(&$this, $method), $val);
|
||||
} else if (isset($this->{'_' . $name}) || is_null($this->{'_' . $name})) {
|
||||
$this->{'_' . $name} = $val;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic __isset method
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function __isset($name)
|
||||
{
|
||||
$rc = new ReflectionClass(get_class($this));
|
||||
$privName = '_' . $name;
|
||||
if (!($rc->hasProperty($privName))) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
} else {
|
||||
if (isset($this->{$privName})) {
|
||||
if (is_array($this->{$privName})) {
|
||||
if (count($this->{$privName}) > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic __unset method
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function __unset($name)
|
||||
{
|
||||
if (isset($this->{'_' . $name})) {
|
||||
if (is_array($this->{'_' . $name})) {
|
||||
$this->{'_' . $name} = array();
|
||||
} else {
|
||||
$this->{'_' . $name} = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*
|
||||
* @return string The text representation of this object
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getText();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_MediaSource
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/MediaSource.php';
|
||||
|
||||
/**
|
||||
* Concrete class to use a file handle as an attachment within a MediaEntry.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Gdata_App_BaseMediaSource implements Zend_Gdata_App_MediaSource
|
||||
{
|
||||
|
||||
/**
|
||||
* The content type for the attached file (example image/png)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_contentType = null;
|
||||
|
||||
/**
|
||||
* The slug header value representing the attached file title, or null if
|
||||
* no slug should be used. The slug header is only necessary in some cases,
|
||||
* usually when a multipart upload is not being performed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_slug = null;
|
||||
|
||||
/**
|
||||
* The content type for the attached file (example image/png)
|
||||
*
|
||||
* @return string The content type
|
||||
*/
|
||||
public function getContentType()
|
||||
{
|
||||
return $this->_contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the content type for the file attached (example image/png)
|
||||
*
|
||||
* @param string $value The content type
|
||||
* @return Zend_Gdata_App_MediaFileSource Provides a fluent interface
|
||||
*/
|
||||
public function setContentType($value)
|
||||
{
|
||||
$this->_contentType = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Slug header value. Used by some services to determine the
|
||||
* title for the uploaded file. Returns null if no slug should be used.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getSlug(){
|
||||
return $this->_slug;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Slug header value. Used by some services to determine the
|
||||
* title for the uploaded file. A null value indicates no slug header.
|
||||
*
|
||||
* @var string The slug value
|
||||
* @return Zend_Gdata_App_MediaSource Provides a fluent interface
|
||||
*/
|
||||
public function setSlug($value){
|
||||
$this->_slug = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Magic getter to allow acces like $source->foo to call $source->getFoo()
|
||||
* Alternatively, if no getFoo() is defined, but a $_foo protected variable
|
||||
* is defined, this is returned.
|
||||
*
|
||||
* TODO Remove ability to bypass getFoo() methods??
|
||||
*
|
||||
* @param string $name The variable name sought
|
||||
*/
|
||||
public function __get($name)
|
||||
{
|
||||
$method = 'get'.ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array(&$this, $method));
|
||||
} else if (property_exists($this, "_${name}")) {
|
||||
return $this->{'_' . $name};
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic setter to allow acces like $source->foo='bar' to call
|
||||
* $source->setFoo('bar') automatically.
|
||||
*
|
||||
* Alternatively, if no setFoo() is defined, but a $_foo protected variable
|
||||
* is defined, this is returned.
|
||||
*
|
||||
* @param string $name
|
||||
* @param string $value
|
||||
*/
|
||||
public function __set($name, $val)
|
||||
{
|
||||
$method = 'set'.ucfirst($name);
|
||||
if (method_exists($this, $method)) {
|
||||
return call_user_func(array(&$this, $method), $val);
|
||||
} else if (isset($this->{'_' . $name}) || is_null($this->{'_' . $name})) {
|
||||
$this->{'_' . $name} = $val;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic __isset method
|
||||
*
|
||||
* @param string $name
|
||||
*/
|
||||
public function __isset($name)
|
||||
{
|
||||
$rc = new ReflectionClass(get_class($this));
|
||||
$privName = '_' . $name;
|
||||
if (!($rc->hasProperty($privName))) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Property ' . $name . ' does not exist');
|
||||
} else {
|
||||
if (isset($this->{$privName})) {
|
||||
if (is_array($this->{$privName})) {
|
||||
if (count($this->{$privName}) > 0) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return true;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_CaptchaRequiredException
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/AuthException.php';
|
||||
|
||||
/**
|
||||
* Gdata exceptions
|
||||
*
|
||||
* Class to represent an exception that occurs during the use of ClientLogin.
|
||||
* This particular exception happens when a CAPTCHA challenge is issued. This
|
||||
* challenge is a visual puzzle presented to the user to prove that they are
|
||||
* not an automated system.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_CaptchaRequiredException extends Zend_Gdata_App_AuthException
|
||||
{
|
||||
/**
|
||||
* The Google Accounts URL prefix.
|
||||
*/
|
||||
const ACCOUNTS_URL = 'https://www.google.com/accounts/';
|
||||
|
||||
/**
|
||||
* The token identifier from the server.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $captchaToken;
|
||||
|
||||
/**
|
||||
* The URL of the CAPTCHA image.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $captchaUrl;
|
||||
|
||||
/**
|
||||
* Constructs the exception to handle a CAPTCHA required response.
|
||||
*
|
||||
* @param string $captchaToken The CAPTCHA token ID provided by the server.
|
||||
* @param string $captchaUrl The URL to the CAPTCHA challenge image.
|
||||
*/
|
||||
public function __construct($captchaToken, $captchaUrl) {
|
||||
$this->captchaToken = $captchaToken;
|
||||
$this->captchaUrl = Zend_Gdata_App_CaptchaRequiredException::ACCOUNTS_URL . $captchaUrl;
|
||||
parent::__construct('CAPTCHA challenge issued by server');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the token identifier as provided by the server.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCaptchaToken() {
|
||||
return $this->captchaToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the URL CAPTCHA image as provided by the server.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCaptchaUrl() {
|
||||
return $this->captchaUrl;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,307 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_FeedEntryParent
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/FeedEntryParent.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Content
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Content.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Published
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Published.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Source
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Source.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Summary
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Summary.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Control
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Control.php';
|
||||
|
||||
/**
|
||||
* Concrete class for working with Atom entries.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
|
||||
{
|
||||
|
||||
/**
|
||||
* Root XML element for Atom entries.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_rootElement = 'entry';
|
||||
|
||||
/**
|
||||
* Class name for each entry in this feed*
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_App_Entry';
|
||||
|
||||
/**
|
||||
* atom:content element
|
||||
*
|
||||
* @var Zend_Gdata_App_Extension_Content
|
||||
*/
|
||||
protected $_content = null;
|
||||
|
||||
/**
|
||||
* atom:published element
|
||||
*
|
||||
* @var Zend_Gdata_App_Extension_Published
|
||||
*/
|
||||
protected $_published = null;
|
||||
|
||||
/**
|
||||
* atom:source element
|
||||
*
|
||||
* @var Zend_Gdata_App_Extension_Source
|
||||
*/
|
||||
protected $_source = null;
|
||||
|
||||
/**
|
||||
* atom:summary element
|
||||
*
|
||||
* @var Zend_Gdata_App_Extension_Summary
|
||||
*/
|
||||
protected $_summary = null;
|
||||
|
||||
/**
|
||||
* app:control element
|
||||
*
|
||||
* @var Zend_Gdata_App_Extension_Control
|
||||
*/
|
||||
protected $_control = null;
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_content != null) {
|
||||
$element->appendChild($this->_content->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_published != null) {
|
||||
$element->appendChild($this->_published->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_source != null) {
|
||||
$element->appendChild($this->_source->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_summary != null) {
|
||||
$element->appendChild($this->_summary->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_control != null) {
|
||||
$element->appendChild($this->_control->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('atom') . ':' . 'content':
|
||||
$content = new Zend_Gdata_App_Extension_Content();
|
||||
$content->transferFromDOM($child);
|
||||
$this->_content = $content;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'published':
|
||||
$published = new Zend_Gdata_App_Extension_Published();
|
||||
$published->transferFromDOM($child);
|
||||
$this->_published = $published;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'source':
|
||||
$source = new Zend_Gdata_App_Extension_Source();
|
||||
$source->transferFromDOM($child);
|
||||
$this->_source = $source;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'summary':
|
||||
$summary = new Zend_Gdata_App_Extension_Summary();
|
||||
$summary->transferFromDOM($child);
|
||||
$this->_summary = $summary;
|
||||
break;
|
||||
case $this->lookupNamespace('app') . ':' . 'control':
|
||||
$control = new Zend_Gdata_App_Extension_Control();
|
||||
$control->transferFromDOM($child);
|
||||
$this->_control = $control;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads changes in this entry to the server using Zend_Gdata_App
|
||||
*
|
||||
* @return Zend_Gdata_App_Entry The updated entry
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
*/
|
||||
public function save()
|
||||
{
|
||||
$service = new Zend_Gdata_App($this->getHttpClient());
|
||||
return $service->updateEntry($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes this entry to the server using the referenced
|
||||
* Zend_Http_Client to do a HTTP DELETE to the edit link stored in this
|
||||
* entry's link collection.
|
||||
*
|
||||
* @return void
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
*/
|
||||
public function delete()
|
||||
{
|
||||
$service = new Zend_Gdata_App($this->getHttpClient());
|
||||
$service->delete($this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the atom:content element
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Content
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the atom:content element
|
||||
*
|
||||
* @param Zend_Gdata_App_Extension_Content $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setContent($value)
|
||||
{
|
||||
$this->_content = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the atom:published element
|
||||
* This represents the publishing date for an entry
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Published
|
||||
*/
|
||||
public function getPublished()
|
||||
{
|
||||
return $this->_published;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the atom:published element
|
||||
* This represents the publishing date for an entry
|
||||
*
|
||||
* @param Zend_Gdata_App_Extension_Published $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setPublished($value)
|
||||
{
|
||||
$this->_published = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the atom:source element
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Source
|
||||
*/
|
||||
public function getSource()
|
||||
{
|
||||
return $this->_source;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the atom:source element
|
||||
*
|
||||
* @param Zend_Gdata_App_Extension_Source $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setSource($value)
|
||||
{
|
||||
$this->_source = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the atom:summary element
|
||||
* This represents a textual summary of this entry's content
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Summary
|
||||
*/
|
||||
public function getSummary()
|
||||
{
|
||||
return $this->_summary;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the atom:summary element
|
||||
* This represents a textual summary of this entry's content
|
||||
*
|
||||
* @param Zend_Gdata_App_Extension_Summary $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setSummary($value)
|
||||
{
|
||||
$this->_summary = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the value of the app:control element
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Control
|
||||
*/
|
||||
public function getControl()
|
||||
{
|
||||
return $this->_control;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the value of the app:control element
|
||||
*
|
||||
* @param Zend_Gdata_App_Extension_Control $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setControl($value)
|
||||
{
|
||||
$this->_control = $value;
|
||||
return $this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Zend_Exception
|
||||
*/
|
||||
require_once 'Zend/Exception.php';
|
||||
|
||||
/**
|
||||
* Gdata App exceptions
|
||||
*
|
||||
* Class to represent exceptions that occur during Gdata App operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Exception extends Zend_Exception
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Base
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Base.php';
|
||||
|
||||
/**
|
||||
* Gdata App extensions
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Gdata_App_Extension extends Zend_Gdata_App_Base
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Person.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:author element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Author extends Zend_Gdata_App_Extension_Person
|
||||
{
|
||||
|
||||
protected $_rootElement = 'author';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:category element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Category extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'category';
|
||||
protected $_term = null;
|
||||
protected $_scheme = null;
|
||||
protected $_label = null;
|
||||
|
||||
public function __construct($term = null, $scheme = null, $label=null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_term = $term;
|
||||
$this->_scheme = $scheme;
|
||||
$this->_label = $label;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_term != null) {
|
||||
$element->setAttribute('term', $this->_term);
|
||||
}
|
||||
if ($this->_scheme != null) {
|
||||
$element->setAttribute('scheme', $this->_scheme);
|
||||
}
|
||||
if ($this->_label != null) {
|
||||
$element->setAttribute('label', $this->_label);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'term':
|
||||
$this->_term = $attribute->nodeValue;
|
||||
break;
|
||||
case 'scheme':
|
||||
$this->_scheme = $attribute->nodeValue;
|
||||
break;
|
||||
case 'label':
|
||||
$this->_label = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Term
|
||||
*/
|
||||
public function getTerm()
|
||||
{
|
||||
return $this->_term;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Term $value
|
||||
* @return Zend_Gdata_App_Extension_Category Provides a fluent interface
|
||||
*/
|
||||
public function setTerm($value)
|
||||
{
|
||||
$this->_term = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Scheme
|
||||
*/
|
||||
public function getScheme()
|
||||
{
|
||||
return $this->_scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Scheme $value
|
||||
* @return Zend_Gdata_App_Extension_Category Provides a fluent interface
|
||||
*/
|
||||
public function setScheme($value)
|
||||
{
|
||||
$this->_scheme = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Label
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Label $value
|
||||
* @return Zend_Gdata_App_Extension_Category Provides a fluent interface
|
||||
*/
|
||||
public function setLabel($value)
|
||||
{
|
||||
$this->_label = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Text
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Text.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:content element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Content extends Zend_Gdata_App_Extension_Text
|
||||
{
|
||||
|
||||
protected $_rootElement = 'content';
|
||||
protected $_src = null;
|
||||
|
||||
public function __construct($text = null, $type = 'text', $src = null)
|
||||
{
|
||||
parent::__construct($text, $type);
|
||||
$this->_src = $src;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_src != null) {
|
||||
$element->setAttribute('src', $this->_src);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'src':
|
||||
$this->_src = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Src
|
||||
*/
|
||||
public function getSrc()
|
||||
{
|
||||
return $this->_src;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Src $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setSrc($value)
|
||||
{
|
||||
$this->_src = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Person.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:contributor element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Contributor extends Zend_Gdata_App_Extension_Person
|
||||
{
|
||||
|
||||
protected $_rootElement = 'contributor';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Draft
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Draft.php';
|
||||
|
||||
/**
|
||||
* Represents the app:control element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Control extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'app';
|
||||
protected $_rootElement = 'control';
|
||||
protected $_draft = null;
|
||||
|
||||
public function __construct($draft = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_draft = $draft;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_draft != null) {
|
||||
$element->appendChild($this->_draft->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('app') . ':' . 'draft':
|
||||
$draft = new Zend_Gdata_App_Extension_Draft();
|
||||
$draft->transferFromDOM($child);
|
||||
$this->_draft = $draft;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Draft
|
||||
*/
|
||||
public function getDraft()
|
||||
{
|
||||
return $this->_draft;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Draft $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setDraft($value)
|
||||
{
|
||||
$this->_draft = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the app:draft element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Draft extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'app';
|
||||
protected $_rootElement = 'draft';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Class that represents elements which were not handled by other parsing
|
||||
* code in the library.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Element extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
public function __construct($rootElement=null, $rootNamespace=null, $rootNamespaceURI=null, $text=null){
|
||||
parent::__construct();
|
||||
$this->_rootElement = $rootElement;
|
||||
$this->_rootNamespace = $rootNamespace;
|
||||
$this->_rootNamespaceURI = $rootNamespaceURI;
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
public function transferFromDOM($node)
|
||||
{
|
||||
parent::transferFromDOM($node);
|
||||
$this->_rootNamespace = null;
|
||||
$this->_rootNamespaceURI = $node->namespaceURI;
|
||||
$this->_rootElement = $node->localName;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:email element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Email extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'email';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:generator element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Generator extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'generator';
|
||||
protected $_uri = null;
|
||||
protected $_version = null;
|
||||
|
||||
public function __construct($text = null, $uri = null, $version = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
$this->_uri = $uri;
|
||||
$this->_version = $version;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_uri != null) {
|
||||
$element->setAttribute('uri', $this->_uri);
|
||||
}
|
||||
if ($this->_version != null) {
|
||||
$element->setAttribute('version', $this->_version);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'uri':
|
||||
$this->_uri = $attribute->nodeValue;
|
||||
break;
|
||||
case 'version':
|
||||
$this->_version= $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Uri
|
||||
*/
|
||||
public function getUri()
|
||||
{
|
||||
return $this->_uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Uri $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setUri($value)
|
||||
{
|
||||
$this->_uri = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Version
|
||||
*/
|
||||
public function getVersion()
|
||||
{
|
||||
return $this->_version;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Version $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setVersion($value)
|
||||
{
|
||||
$this->_version = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:icon element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Icon extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'icon';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:id element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Id extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'id';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,216 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Data model for representing an atom:link element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Link extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'link';
|
||||
protected $_href = null;
|
||||
protected $_rel = null;
|
||||
protected $_type = null;
|
||||
protected $_hrefLang = null;
|
||||
protected $_title = null;
|
||||
protected $_length = null;
|
||||
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_href = $href;
|
||||
$this->_rel = $rel;
|
||||
$this->_type = $type;
|
||||
$this->_hrefLang = $hrefLang;
|
||||
$this->_title = $title;
|
||||
$this->_length = $length;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_href != null) {
|
||||
$element->setAttribute('href', $this->_href);
|
||||
}
|
||||
if ($this->_rel != null) {
|
||||
$element->setAttribute('rel', $this->_rel);
|
||||
}
|
||||
if ($this->_type != null) {
|
||||
$element->setAttribute('type', $this->_type);
|
||||
}
|
||||
if ($this->_hrefLang != null) {
|
||||
$element->setAttribute('hreflang', $this->_hrefLang);
|
||||
}
|
||||
if ($this->_title != null) {
|
||||
$element->setAttribute('title', $this->_title);
|
||||
}
|
||||
if ($this->_length != null) {
|
||||
$element->setAttribute('length', $this->_length);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'href':
|
||||
$this->_href = $attribute->nodeValue;
|
||||
break;
|
||||
case 'rel':
|
||||
$this->_rel = $attribute->nodeValue;
|
||||
break;
|
||||
case 'type':
|
||||
$this->_type = $attribute->nodeValue;
|
||||
break;
|
||||
case 'hreflang':
|
||||
$this->_hrefLang = $attribute->nodeValue;
|
||||
break;
|
||||
case 'title':
|
||||
$this->_title = $attribute->nodeValue;
|
||||
break;
|
||||
case 'length':
|
||||
$this->_length = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Href
|
||||
*/
|
||||
public function getHref()
|
||||
{
|
||||
return $this->_href;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Href $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setHref($value)
|
||||
{
|
||||
$this->_href = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Rel
|
||||
*/
|
||||
public function getRel()
|
||||
{
|
||||
return $this->_rel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Rel $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setRel($value)
|
||||
{
|
||||
$this->_rel = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Type
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Type $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setType($value)
|
||||
{
|
||||
$this->_type = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_HrefLang
|
||||
*/
|
||||
public function getHrefLang()
|
||||
{
|
||||
return $this->_hrefLang;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_HrefLang $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setHrefLang($value)
|
||||
{
|
||||
$this->_hrefLang = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Title
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Title $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->_title = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Length
|
||||
*/
|
||||
public function getLength()
|
||||
{
|
||||
return $this->_length;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Length $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setLength($value)
|
||||
{
|
||||
$this->_length = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:logo element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Logo extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'logo';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:name element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Name extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'name';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Name
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Name.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Email
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Email.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Uri
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Uri.php';
|
||||
|
||||
/**
|
||||
* Base class for people (currently used by atom:author, atom:contributor)
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Gdata_App_Extension_Person extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = null;
|
||||
protected $_name = null;
|
||||
protected $_email = null;
|
||||
protected $_uri = null;
|
||||
|
||||
public function __construct($name = null, $email = null, $uri = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_name = $name;
|
||||
$this->_email = $email;
|
||||
$this->_uri = $uri;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_name != null) {
|
||||
$element->appendChild($this->_name->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_email != null) {
|
||||
$element->appendChild($this->_email->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_uri != null) {
|
||||
$element->appendChild($this->_uri->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('atom') . ':' . 'name':
|
||||
$name = new Zend_Gdata_App_Extension_Name();
|
||||
$name->transferFromDOM($child);
|
||||
$this->_name = $name;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'email':
|
||||
$email = new Zend_Gdata_App_Extension_Email();
|
||||
$email->transferFromDOM($child);
|
||||
$this->_email = $email;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'uri':
|
||||
$uri = new Zend_Gdata_App_Extension_Uri();
|
||||
$uri->transferFromDOM($child);
|
||||
$this->_uri = $uri;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Name
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Name $value
|
||||
* @return Zend_Gdata_App_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setName($value)
|
||||
{
|
||||
$this->_name = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Email
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->_email;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Email $value
|
||||
* @return Zend_Gdata_App_Extension_Person Provides a fluent interface
|
||||
*/
|
||||
public function setEmail($value)
|
||||
{
|
||||
$this->_email = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Uri
|
||||
*/
|
||||
public function getUri()
|
||||
{
|
||||
return $this->_uri;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Uri $value
|
||||
* @return Zend_Gdata_App_Extension_Person Provides a fluent interface
|
||||
*/
|
||||
public function setUri($value)
|
||||
{
|
||||
$this->_uri = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:published element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Published extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'published';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Text
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Text.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:rights element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Rights extends Zend_Gdata_App_Extension_Text
|
||||
{
|
||||
|
||||
protected $_rootElement = 'rights';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Entry.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_FeedSourceParent
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/FeedSourceParent.php';
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Source extends Zend_Gdata_App_FeedSourceParent
|
||||
{
|
||||
|
||||
protected $_rootElement = 'source';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Text
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Text.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:subtitle element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Subtitle extends Zend_Gdata_App_Extension_Text
|
||||
{
|
||||
|
||||
protected $_rootElement = 'subtitle';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Text
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Text.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:summary element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Summary extends Zend_Gdata_App_Extension_Text
|
||||
{
|
||||
|
||||
protected $_rootElement = 'summary';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,87 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Abstract class for data models that require only text and type-- such as:
|
||||
* title, summary, etc.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Gdata_App_Extension_Text extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = null;
|
||||
protected $_type = 'text';
|
||||
|
||||
public function __construct($text = null, $type = 'text')
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
$this->_type = $type;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_type != null) {
|
||||
$element->setAttribute('type', $this->_type);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'type':
|
||||
$this->_type = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* @return Zend_Gdata_App_Extension_Type
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
/*
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_App_Extension_Text Provides a fluent interface
|
||||
*/
|
||||
public function setType($value)
|
||||
{
|
||||
$this->_type = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Text
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Text.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:title element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Title extends Zend_Gdata_App_Extension_Text
|
||||
{
|
||||
|
||||
protected $_rootElement = 'title';
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:updated element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Updated extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'updated';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an uri
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the atom:uri element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Extension_Uri extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'uri';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,264 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Entry.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_FeedSourceParent
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/FeedSourceParent.php';
|
||||
|
||||
/**
|
||||
* Atom feed class
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Feed extends Zend_Gdata_App_FeedSourceParent
|
||||
implements Iterator, ArrayAccess
|
||||
{
|
||||
|
||||
/**
|
||||
* The root xml element of this data element
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_rootElement = 'feed';
|
||||
|
||||
/**
|
||||
* Cache of feed entries.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_entry = array();
|
||||
|
||||
/**
|
||||
* Current location in $_entry array
|
||||
*
|
||||
* @var int
|
||||
*/
|
||||
protected $_entryIndex = 0;
|
||||
|
||||
/**
|
||||
* Make accessing some individual elements of the feed easier.
|
||||
*
|
||||
* Special accessors 'entry' and 'entries' are provided so that if
|
||||
* you wish to iterate over an Atom feed's entries, you can do so
|
||||
* using foreach ($feed->entries as $entry) or foreach
|
||||
* ($feed->entry as $entry).
|
||||
*
|
||||
* @param string $var The property to get.
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($var)
|
||||
{
|
||||
switch ($var) {
|
||||
case 'entries':
|
||||
return $this;
|
||||
default:
|
||||
return parent::__get($var);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves the DOM model representing this object and all children
|
||||
*
|
||||
* @param DOMDocument $doc
|
||||
* @return DOMElement
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
foreach ($this->_entry as $entry) {
|
||||
$element->appendChild($entry->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual Entry objects of the appropriate type and
|
||||
* stores them in the $_entry array based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('atom') . ':' . 'entry':
|
||||
$newEntry = new $this->_entryClassName($child);
|
||||
$newEntry->setHttpClient($this->getHttpClient());
|
||||
$this->_entry[] = $newEntry;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the number of entries in this feed object.
|
||||
*
|
||||
* @return integer Entry count.
|
||||
*/
|
||||
public function count()
|
||||
{
|
||||
return count($this->_entry);
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by the Iterator interface.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function rewind()
|
||||
{
|
||||
$this->_entryIndex = 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by the Iterator interface.
|
||||
*
|
||||
* @return mixed The current row, or null if no rows.
|
||||
*/
|
||||
public function current()
|
||||
{
|
||||
return $this->_entry[$this->_entryIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by the Iterator interface.
|
||||
*
|
||||
* @return mixed The current row number (starts at 0), or NULL if no rows
|
||||
*/
|
||||
public function key()
|
||||
{
|
||||
return $this->_entryIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by the Iterator interface.
|
||||
*
|
||||
* @return mixed The next row, or null if no more rows.
|
||||
*/
|
||||
public function next()
|
||||
{
|
||||
++$this->_entryIndex;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by the Iterator interface.
|
||||
*
|
||||
* @return boolean Whether the iteration is valid
|
||||
*/
|
||||
public function valid()
|
||||
{
|
||||
return 0 <= $this->_entryIndex && $this->_entryIndex < $this->count();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the array of atom:entry elements contained within this
|
||||
* atom:feed representation
|
||||
*
|
||||
* @return array Zend_Gdata_App_Entry array
|
||||
*/
|
||||
public function getEntry()
|
||||
{
|
||||
return $this->_entry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the array of atom:entry elements contained within this
|
||||
* atom:feed representation
|
||||
*
|
||||
* @param array $value The array of Zend_Gdata_App_Entry elements
|
||||
* @return Zend_Gdata_App_Feed Provides a fluent interface
|
||||
*/
|
||||
public function setEntry($value)
|
||||
{
|
||||
$this->_entry = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an entry representation to the array of entries
|
||||
* contained within this feed
|
||||
*
|
||||
* @param Zend_Gdata_App_Entry An individual entry to add.
|
||||
* @return Zend_Gdata_App_Feed Provides a fluent interface
|
||||
*/
|
||||
public function addEntry($value)
|
||||
{
|
||||
$this->_entry[] = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by the ArrayAccess interface
|
||||
*
|
||||
* @param int $key The index to set
|
||||
* @param Zend_Gdata_App_Entry $value The value to set
|
||||
* @return void
|
||||
*/
|
||||
public function offsetSet($key, $value) {
|
||||
$this->_entry[$key] = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by the ArrayAccess interface
|
||||
*
|
||||
* @param int $key The index to get
|
||||
* @param Zend_Gdata_App_Entry $value The value to set
|
||||
*/
|
||||
public function offsetGet($key) {
|
||||
if (array_key_exists($key, $this->_entry)) {
|
||||
return $this->_entry[$key];
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by the ArrayAccess interface
|
||||
*
|
||||
* @param int $key The index to set
|
||||
* @param Zend_Gdata_App_Entry $value The value to set
|
||||
*/
|
||||
public function offsetUnset($key) {
|
||||
if (array_key_exists($key, $this->_entry)) {
|
||||
unset($this->_entry[$key]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Required by the ArrayAccess interface
|
||||
*
|
||||
* @param int $key The index to check for existence
|
||||
* @return boolean
|
||||
*/
|
||||
public function offsetExists($offset) {
|
||||
return (array_key_exists($key, $this->_entry));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,525 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Element
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Element.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Author
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Author.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Category
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Category.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Contributor
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Contributor.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Id
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Id.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Link
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Link.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Rights
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Rights.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Title
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Title.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Updated
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Updated.php';
|
||||
|
||||
/**
|
||||
* Zend_Version
|
||||
*/
|
||||
require_once 'Zend/Version.php';
|
||||
|
||||
/**
|
||||
* Abstract class for common functionality in entries and feeds
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base
|
||||
{
|
||||
|
||||
/**
|
||||
* HTTP client object to use for retrieving feeds
|
||||
*
|
||||
* @var Zend_Http_Client
|
||||
*/
|
||||
protected $_httpClient = null;
|
||||
|
||||
protected $_author = array();
|
||||
protected $_category = array();
|
||||
protected $_contributor = array();
|
||||
protected $_id = null;
|
||||
protected $_link = array();
|
||||
protected $_rights = null;
|
||||
protected $_title = null;
|
||||
protected $_updated = null;
|
||||
|
||||
/**
|
||||
* Constructs a Feed or Entry
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
if (!($element instanceof DOMElement)) {
|
||||
if ($element) {
|
||||
// Load the feed as an XML DOMDocument object
|
||||
@ini_set('track_errors', 1);
|
||||
$doc = new DOMDocument();
|
||||
$success = @$doc->loadXML($element);
|
||||
@ini_restore('track_errors');
|
||||
if (!$success) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg");
|
||||
}
|
||||
$element = $doc->getElementsByTagName($this->_rootElement)->item(0);
|
||||
if (!$element) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.');
|
||||
}
|
||||
$this->transferFromDOM($element);
|
||||
}
|
||||
} else {
|
||||
$this->transferFromDOM($element);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the HTTP client instance
|
||||
*
|
||||
* Sets the HTTP client object to use for retrieving the feed.
|
||||
*
|
||||
* @param Zend_Http_Client $httpClient
|
||||
* @return Zend_Gdata_App_Feed Provides a fluent interface
|
||||
*/
|
||||
public function setHttpClient(Zend_Http_Client $httpClient)
|
||||
{
|
||||
$this->_httpClient = $httpClient;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the HTTP client object. If none is set, a new Zend_Http_Client will be used.
|
||||
*
|
||||
* @return Zend_Http_Client_Abstract
|
||||
*/
|
||||
public function getHttpClient()
|
||||
{
|
||||
if (!$this->_httpClient instanceof Zend_Http_Client) {
|
||||
/**
|
||||
* @see Zend_Http_Client
|
||||
*/
|
||||
require_once 'Zend/Http/Client.php';
|
||||
$this->_httpClient = new Zend_Http_Client();
|
||||
$useragent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$this->_httpClient->setConfig(array(
|
||||
'strictredirects' => true,
|
||||
'useragent' => $useragent
|
||||
)
|
||||
);
|
||||
}
|
||||
return $this->_httpClient;
|
||||
}
|
||||
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
foreach ($this->_author as $author) {
|
||||
$element->appendChild($author->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_category as $category) {
|
||||
$element->appendChild($category->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_contributor as $contributor) {
|
||||
$element->appendChild($contributor->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_id != null) {
|
||||
$element->appendChild($this->_id->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_link as $link) {
|
||||
$element->appendChild($link->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_rights != null) {
|
||||
$element->appendChild($this->_rights->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_title != null) {
|
||||
$element->appendChild($this->_title->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_updated != null) {
|
||||
$element->appendChild($this->_updated->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('atom') . ':' . 'author':
|
||||
$author = new Zend_Gdata_App_Extension_Author();
|
||||
$author->transferFromDOM($child);
|
||||
$this->_author[] = $author;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'category':
|
||||
$category = new Zend_Gdata_App_Extension_Category();
|
||||
$category->transferFromDOM($child);
|
||||
$this->_category[] = $category;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'contributor':
|
||||
$contributor = new Zend_Gdata_App_Extension_Contributor();
|
||||
$contributor->transferFromDOM($child);
|
||||
$this->_contributor[] = $contributor;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'id':
|
||||
$id = new Zend_Gdata_App_Extension_Id();
|
||||
$id->transferFromDOM($child);
|
||||
$this->_id = $id;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'link':
|
||||
$link = new Zend_Gdata_App_Extension_Link();
|
||||
$link->transferFromDOM($child);
|
||||
$this->_link[] = $link;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'rights':
|
||||
$rights = new Zend_Gdata_App_Extension_Rights();
|
||||
$rights->transferFromDOM($child);
|
||||
$this->_rights = $rights;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'title':
|
||||
$title = new Zend_Gdata_App_Extension_Title();
|
||||
$title->transferFromDOM($child);
|
||||
$this->_title = $title;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'updated':
|
||||
$updated = new Zend_Gdata_App_Extension_Updated();
|
||||
$updated->transferFromDOM($child);
|
||||
$this->_updated = $updated;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Author
|
||||
*/
|
||||
public function getAuthor()
|
||||
{
|
||||
return $this->_author;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the list of the authors of this feed/entry. In an atom feed, each
|
||||
* author is represented by an atom:author element
|
||||
*
|
||||
* @param array $value
|
||||
* @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
|
||||
*/
|
||||
public function setAuthor($value)
|
||||
{
|
||||
$this->_author = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array of categories that classify this feed/entry. Each
|
||||
* category is represented in an atom feed by an atom:category element.
|
||||
*
|
||||
* @return array Array of Zend_Gdata_App_Extension_Category
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->_category;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the array of categories that classify this feed/entry. Each
|
||||
* category is represented in an atom feed by an atom:category element.
|
||||
*
|
||||
* @param array $value Array of Zend_Gdata_App_Extension_Category
|
||||
* @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
|
||||
*/
|
||||
public function setCategory($value)
|
||||
{
|
||||
$this->_category = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the array of contributors to this feed/entry. Each contributor
|
||||
* is represented in an atom feed by an atom:contributor XML element
|
||||
*
|
||||
* @return array An array of Zend_Gdata_App_Extension_Contributor
|
||||
*/
|
||||
public function getContributor()
|
||||
{
|
||||
return $this->_contributor;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the array of contributors to this feed/entry. Each contributor
|
||||
* is represented in an atom feed by an atom:contributor XML element
|
||||
*
|
||||
* @param array $value
|
||||
* @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
|
||||
*/
|
||||
public function setContributor($value)
|
||||
{
|
||||
$this->_contributor = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Id
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Id $value
|
||||
* @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->_id = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a particular 'rel' value, this method returns a matching
|
||||
* Zend_Gdata_App_Extension_Link element. If the 'rel' value
|
||||
* is not provided, the full array of Zend_Gdata_App_Extension_Link
|
||||
* elements is returned. In an atom feed, each link is represented
|
||||
* by an atom:link element. The 'rel' value passed to this function
|
||||
* is the atom:link/@rel attribute. Example rel values include 'self',
|
||||
* 'edit', and 'alternate'.
|
||||
*
|
||||
* @param string $rel The rel value of the link to be found. If null,
|
||||
* the array of Zend_Gdata_App_Extension_link elements is returned
|
||||
* @return mixed Either a single Zend_Gdata_App_Extension_link element,
|
||||
* an array of the same or null is returned depending on the rel value
|
||||
* supplied as the argument to this function
|
||||
*/
|
||||
public function getLink($rel = null)
|
||||
{
|
||||
if ($rel == null) {
|
||||
return $this->_link;
|
||||
} else {
|
||||
foreach ($this->_link as $link) {
|
||||
if ($link->rel == $rel) {
|
||||
return $link;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Zend_Gdata_App_Extension_Link element which represents
|
||||
* the URL used to edit this resource. This link is in the atom feed/entry
|
||||
* as an atom:link with a rel attribute value of 'edit'.
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link The link, or null if not found
|
||||
*/
|
||||
public function getEditLink()
|
||||
{
|
||||
return $this->getLink('edit');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Zend_Gdata_App_Extension_Link element which represents
|
||||
* the URL used to retrieve the next chunk of results when paging through
|
||||
* a feed. This link is in the atom feed as an atom:link with a
|
||||
* rel attribute value of 'next'.
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link The link, or null if not found
|
||||
*/
|
||||
public function getNextLink()
|
||||
{
|
||||
return $this->getLink('next');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Zend_Gdata_App_Extension_Link element which represents
|
||||
* the URL used to retrieve the previous chunk of results when paging
|
||||
* through a feed. This link is in the atom feed as an atom:link with a
|
||||
* rel attribute value of 'previous'.
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link The link, or null if not found
|
||||
*/
|
||||
public function getPreviousLink()
|
||||
{
|
||||
return $this->getLink('previous');
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Link
|
||||
*/
|
||||
public function getLicenseLink()
|
||||
{
|
||||
return $this->getLink('license');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Zend_Gdata_App_Extension_Link element which represents
|
||||
* the URL used to retrieve the entry or feed represented by this object
|
||||
* This link is in the atom feed/entry as an atom:link with a
|
||||
* rel attribute value of 'self'.
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link The link, or null if not found
|
||||
*/
|
||||
public function getSelfLink()
|
||||
{
|
||||
return $this->getLink('self');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Zend_Gdata_App_Extension_Link element which represents
|
||||
* the URL for an alternate view of the data represented by this feed or
|
||||
* entry. This alternate view is commonly a user-facing webpage, blog
|
||||
* post, etc. The MIME type for the data at the URL is available from the
|
||||
* returned Zend_Gdata_App_Extension_Link element.
|
||||
* This link is in the atom feed/entry as an atom:link with a
|
||||
* rel attribute value of 'self'.
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link The link, or null if not found
|
||||
*/
|
||||
public function getAlternateLink()
|
||||
{
|
||||
return $this->getLink('alternate');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value The array of Zend_Gdata_App_Extension_Link elements
|
||||
* @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
|
||||
*/
|
||||
public function setLink($value)
|
||||
{
|
||||
$this->_link = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_AppExtension_Rights
|
||||
*/
|
||||
public function getRights()
|
||||
{
|
||||
return $this->_rights;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Rights $value
|
||||
* @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface
|
||||
*/
|
||||
public function setRights($value)
|
||||
{
|
||||
$this->_rights = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of this feed or entry. The title is an extremely
|
||||
* short textual representation of this resource and is found as
|
||||
* an atom:title element in a feed or entry
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Title
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a string representation of the title of this feed or entry.
|
||||
* The title is an extremely short textual representation of this
|
||||
* resource and is found as an atom:title element in a feed or entry
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getTitleValue()
|
||||
{
|
||||
if (($titleObj = $this->getTitle()) != null) {
|
||||
return $titleObj->getText();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the title of this feed or entry. The title is an extremely
|
||||
* short textual representation of this resource and is found as
|
||||
* an atom:title element in a feed or entry
|
||||
*
|
||||
* @param Zend_Gdata_App_Extension_Title $value
|
||||
* @return Zend_Gdata_App_Feed_Entry_Parent Provides a fluent interface
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->_title = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_App_Extension_Updated
|
||||
*/
|
||||
public function getUpdated()
|
||||
{
|
||||
return $this->_updated;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Updated $value
|
||||
* @return Zend_Gdata_App_Feed_Entry_Parent Provides a fluent interface
|
||||
*/
|
||||
public function setUpdated($value)
|
||||
{
|
||||
$this->_updated = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Entry.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_FeedSourceParent
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/FeedEntryParent.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Generator
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Generator.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Icon
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Icon.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Logo
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Logo.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Subtitle
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Subtitle.php';
|
||||
|
||||
/**
|
||||
* Atom feed class
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
abstract class Zend_Gdata_App_FeedSourceParent extends Zend_Gdata_App_FeedEntryParent
|
||||
{
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_App_Entry';
|
||||
|
||||
/**
|
||||
* Root XML element for Atom entries.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_rootElement = null;
|
||||
|
||||
protected $_generator = null;
|
||||
protected $_icon = null;
|
||||
protected $_logo = null;
|
||||
protected $_subtitle = null;
|
||||
|
||||
/**
|
||||
* Set the HTTP client instance
|
||||
*
|
||||
* Sets the HTTP client object to use for retrieving the feed.
|
||||
*
|
||||
* @param Zend_Http_Client $httpClient
|
||||
* @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
|
||||
*/
|
||||
public function setHttpClient(Zend_Http_Client $httpClient)
|
||||
{
|
||||
$this->_httpClient = $httpClient;
|
||||
foreach ($this->_entry as $entry) {
|
||||
$entry->setHttpClient($httpClient);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Make accessing some individual elements of the feed easier.
|
||||
*
|
||||
* Special accessors 'entry' and 'entries' are provided so that if
|
||||
* you wish to iterate over an Atom feed's entries, you can do so
|
||||
* using foreach ($feed->entries as $entry) or foreach
|
||||
* ($feed->entry as $entry).
|
||||
*
|
||||
* @param string $var The property to access.
|
||||
* @return mixed
|
||||
*/
|
||||
public function __get($var)
|
||||
{
|
||||
switch ($var) {
|
||||
default:
|
||||
return parent::__get($var);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_generator != null) {
|
||||
$element->appendChild($this->_generator->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_icon != null) {
|
||||
$element->appendChild($this->_icon->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_logo != null) {
|
||||
$element->appendChild($this->_logo->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_subtitle != null) {
|
||||
$element->appendChild($this->_subtitle->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual Entry objects of the appropriate type and
|
||||
* stores them in the $_entry array based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('atom') . ':' . 'generator':
|
||||
$generator = new Zend_Gdata_App_Extension_Generator();
|
||||
$generator->transferFromDOM($child);
|
||||
$this->_generator = $generator;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'icon':
|
||||
$icon = new Zend_Gdata_App_Extension_Icon();
|
||||
$icon->transferFromDOM($child);
|
||||
$this->_icon = $icon;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'logo':
|
||||
$logo = new Zend_Gdata_App_Extension_Logo();
|
||||
$logo->transferFromDOM($child);
|
||||
$this->_logo = $logo;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'subtitle':
|
||||
$subtitle = new Zend_Gdata_App_Extension_Subtitle();
|
||||
$subtitle->transferFromDOM($child);
|
||||
$this->_subtitle = $subtitle;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_AppExtension_Generator
|
||||
*/
|
||||
public function getGenerator()
|
||||
{
|
||||
return $this->_generator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Generator $value
|
||||
* @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
|
||||
*/
|
||||
public function setGenerator($value)
|
||||
{
|
||||
$this->_generator = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_AppExtension_Icon
|
||||
*/
|
||||
public function getIcon()
|
||||
{
|
||||
return $this->_icon;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Icon $value
|
||||
* @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
|
||||
*/
|
||||
public function setIcon($value)
|
||||
{
|
||||
$this->_icon = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_AppExtension_logo
|
||||
*/
|
||||
public function getlogo()
|
||||
{
|
||||
return $this->_logo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_logo $value
|
||||
* @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
|
||||
*/
|
||||
public function setlogo($value)
|
||||
{
|
||||
$this->_logo = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_AppExtension_Subtitle
|
||||
*/
|
||||
public function getSubtitle()
|
||||
{
|
||||
return $this->_subtitle;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_App_Extension_Subtitle $value
|
||||
* @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface
|
||||
*/
|
||||
public function setSubtitle($value)
|
||||
{
|
||||
$this->_subtitle = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_Exception
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
|
||||
/**
|
||||
* Zend_Http_Client_Exception
|
||||
*/
|
||||
require_once 'Zend/Http/Client/Exception.php';
|
||||
|
||||
/**
|
||||
* Gdata exceptions
|
||||
*
|
||||
* Class to represent exceptions that occur during Gdata operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_HttpException extends Zend_Gdata_App_Exception
|
||||
{
|
||||
|
||||
protected $_httpClientException = null;
|
||||
protected $_response = null;
|
||||
|
||||
/**
|
||||
* Create a new Zend_Gdata_App_HttpException
|
||||
*
|
||||
* @param string $message Optionally set a message
|
||||
* @param Zend_Http_Client_Exception Optionally pass in a Zend_Http_Client_Exception
|
||||
* @param Zend_Http_Response Optionally pass in a Zend_Http_Response
|
||||
*/
|
||||
public function __construct($message = null, $e = null, $response = null)
|
||||
{
|
||||
$this->_httpClientException = $e;
|
||||
$this->_response = $response;
|
||||
parent::__construct($message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Zend_Http_Client_Exception.
|
||||
*
|
||||
* @return Zend_Http_Client_Exception
|
||||
*/
|
||||
public function getHttpClientException()
|
||||
{
|
||||
return $this->_httpClientException;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Zend_Http_Client_Exception.
|
||||
*
|
||||
* @param Zend_Http_Client_Exception $value
|
||||
*/
|
||||
public function setHttpClientException($value)
|
||||
{
|
||||
$this->_httpClientException = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Zend_Http_Response.
|
||||
*
|
||||
* @param Zend_Http_Response $response
|
||||
*/
|
||||
public function setResponse($response)
|
||||
{
|
||||
$this->_response = $response;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the Zend_Http_Response.
|
||||
*
|
||||
* @return Zend_Http_Response
|
||||
*/
|
||||
public function getResponse()
|
||||
{
|
||||
return $this->_response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the body of the Zend_Http_Response
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getRawResponseBody()
|
||||
{
|
||||
if ($this->getResponse()) {
|
||||
$response = $this->getResponse();
|
||||
return $response->getRawBody();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_Exception
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
|
||||
/**
|
||||
* Gdata App IO exceptions.
|
||||
*
|
||||
* Class to represent IO exceptions that occur during Gdata App operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_IOException extends Zend_Gdata_App_Exception
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_Exception
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
|
||||
/**
|
||||
* Gdata exceptions
|
||||
*
|
||||
* Class to represent exceptions that occur during Gdata operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_InvalidArgumentException extends Zend_Gdata_App_Exception
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1,116 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Http
|
||||
* @subpackage Client_Adapter
|
||||
* @version $Id$
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
require_once 'Zend/Http/Client/Adapter/Socket.php';
|
||||
|
||||
/**
|
||||
* Overrides the traditional socket-based adapter class for Zend_Http_Client to
|
||||
* enable logging of requests. All requests are logged to a location specified
|
||||
* in the config as $config['logfile']. Requests and responses are logged after
|
||||
* they are sent and received/processed, thus an error could prevent logging.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_LoggingHttpClientAdapterSocket extends Zend_Http_Client_Adapter_Socket
|
||||
{
|
||||
|
||||
/**
|
||||
* The file handle for writing logs
|
||||
*
|
||||
* @var resource|null
|
||||
*/
|
||||
protected $log_handle = null;
|
||||
|
||||
/**
|
||||
* Log the given message to the log file. The log file is configured
|
||||
* as the config param 'logfile'. This method opens the file for
|
||||
* writing if necessary.
|
||||
*
|
||||
* @param string $message The message to log
|
||||
*/
|
||||
protected function log($message)
|
||||
{
|
||||
if ($this->log_handle == null) {
|
||||
$this->log_handle = fopen($this->config['logfile'], 'a');
|
||||
}
|
||||
fwrite($this->log_handle, $message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Connect to the remote server
|
||||
*
|
||||
* @param string $host
|
||||
* @param int $port
|
||||
* @param boolean $secure
|
||||
* @param int $timeout
|
||||
*/
|
||||
public function connect($host, $port = 80, $secure = false)
|
||||
{
|
||||
$this->log("Connecting to: ${host}:${port}");
|
||||
return parent::connect($host, $port, $secure);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send request to the remote server
|
||||
*
|
||||
* @param string $method
|
||||
* @param Zend_Uri_Http $uri
|
||||
* @param string $http_ver
|
||||
* @param array $headers
|
||||
* @param string $body
|
||||
* @return string Request as string
|
||||
*/
|
||||
public function write($method, $uri, $http_ver = '1.1', $headers = array(), $body = '')
|
||||
{
|
||||
$request = parent::write($method, $uri, $http_ver, $headers, $body);
|
||||
$this->log("\n\n" . $request);
|
||||
return $request;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read response from server
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function read()
|
||||
{
|
||||
$response = parent::read();
|
||||
$this->log("${response}\n\n");
|
||||
return $response;
|
||||
}
|
||||
|
||||
/**
|
||||
* Close the connection to the server
|
||||
*
|
||||
*/
|
||||
public function close()
|
||||
{
|
||||
$this->log("Closing socket\n\n");
|
||||
parent::close();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,160 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Entry.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_MediaSource
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/MediaSource.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Mime
|
||||
*/
|
||||
require_once 'Zend/Mime.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Mime_Message
|
||||
*/
|
||||
require_once 'Zend/Mime/Message.php';
|
||||
|
||||
|
||||
/**
|
||||
* Concrete class for working with Atom entries containing multi-part data.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_MediaEntry extends Zend_Gdata_App_Entry
|
||||
{
|
||||
/**
|
||||
* The attached MediaSource/file
|
||||
*
|
||||
* @var Zend_Gdata_App_MediaSource
|
||||
*/
|
||||
protected $_mediaSource = null;
|
||||
|
||||
/**
|
||||
* The Zend_Mime object used to generate the boundary
|
||||
*
|
||||
* @var Zend_Mime
|
||||
*/
|
||||
protected $_mime = null;
|
||||
|
||||
/**
|
||||
* Constructs a new MediaEntry, representing XML data and optional
|
||||
* file to upload
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null, $mediaSource = null)
|
||||
{
|
||||
parent::__construct($element);
|
||||
$this->_mime = new Zend_Mime();
|
||||
$this->_mediaSource = $mediaSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the Zend_Mime object associated with this MediaEntry. This
|
||||
* object is used to generate the media boundaries.
|
||||
*
|
||||
* @return Zend_Mime The Zend_Mime object associated with this MediaEntry.
|
||||
*/
|
||||
public function getMime()
|
||||
{
|
||||
return $this->_mime;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the MIME multipart representation of this MediaEntry.
|
||||
*
|
||||
* @return string The MIME multipart representation of this MediaEntry
|
||||
*/
|
||||
public function encode()
|
||||
{
|
||||
$xmlData = $this->saveXML();
|
||||
if ($this->getMediaSource() === null) {
|
||||
// No attachment, just send XML for entry
|
||||
return $xmlData;
|
||||
} else {
|
||||
$mimeMessage = new Zend_Mime_Message();
|
||||
$mimeMessage->setMime($this->_mime);
|
||||
|
||||
$xmlPart = new Zend_Mime_Part($xmlData);
|
||||
$xmlPart->type = 'application/atom+xml';
|
||||
$xmlPart->encoding = null;
|
||||
$mimeMessage->addPart($xmlPart);
|
||||
|
||||
$binaryPart = new Zend_Mime_Part($this->getMediaSource()->encode());
|
||||
$binaryPart->type = $this->getMediaSource()->getContentType();
|
||||
$binaryPart->encoding = null;
|
||||
$mimeMessage->addPart($binaryPart);
|
||||
|
||||
return $mimeMessage->generateMessage();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the MediaSource object representing the file attached to this
|
||||
* MediaEntry.
|
||||
*
|
||||
* @return Zend_Gdata_App_MediaSource The attached MediaSource/file
|
||||
*/
|
||||
public function getMediaSource()
|
||||
{
|
||||
return $this->_mediaSource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the MediaSource object (file) for this MediaEntry
|
||||
*
|
||||
* @param Zend_Gdata_App_MediaSource $value The attached MediaSource/file
|
||||
* @return Zend_Gdata_App_MediaEntry Provides a fluent interface
|
||||
*/
|
||||
public function setMediaSource($value)
|
||||
{
|
||||
if ($value instanceof Zend_Gdata_App_MediaSource) {
|
||||
$this->_mediaSource = $value;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You must specify the media data as a class that conforms to Zend_Gdata_App_MediaSource.');
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the boundary used in the MIME multipart message
|
||||
*
|
||||
* @return string The boundary used in the MIME multipart message
|
||||
*/
|
||||
public function getBoundary()
|
||||
{
|
||||
return $this->_mime->boundary();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,143 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_MediaData
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/BaseMediaSource.php';
|
||||
|
||||
/**
|
||||
* Concrete class to use a file handle as an attachment within a MediaEntry.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_MediaFileSource extends Zend_Gdata_App_BaseMediaSource
|
||||
{
|
||||
/**
|
||||
* The filename which is represented
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_filename = null;
|
||||
|
||||
/**
|
||||
* The content type for the file attached (example image/png)
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_contentType = null;
|
||||
|
||||
/**
|
||||
* Create a new Zend_Gdata_App_MediaFileSource object.
|
||||
*
|
||||
* @param string $filename The name of the file to read from.
|
||||
*/
|
||||
public function __construct($filename)
|
||||
{
|
||||
$this->setFilename($filename);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the MIME multipart representation of this MediaEntry.
|
||||
*
|
||||
* @return string
|
||||
* @throws Zend_Gdata_App_IOException
|
||||
*/
|
||||
public function encode()
|
||||
{
|
||||
if ($this->getFilename() !== null &&
|
||||
is_readable($this->getFilename())) {
|
||||
|
||||
// Retrieves the file, using the include path
|
||||
$fileHandle = fopen($this->getFilename(), 'r', true);
|
||||
$result = fread($fileHandle, filesize($this->getFilename()));
|
||||
if ($result === false) {
|
||||
require_once 'Zend/Gdata/App/IOException.php';
|
||||
throw new Zend_Gdata_App_IOException("Error reading file - " .
|
||||
$this->getFilename() . '. Read failed.');
|
||||
}
|
||||
fclose($fileHandle);
|
||||
return $result;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/IOException.php';
|
||||
throw new Zend_Gdata_App_IOException("Error reading file - " .
|
||||
$this->getFilename() . '. File is not readable.');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filename associated with this reader.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getFilename()
|
||||
{
|
||||
return $this->_filename;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the filename which is to be read.
|
||||
*
|
||||
* @param string $value The desired file handle.
|
||||
* @return Zend_Gdata_App_MediaFileSource Provides a fluent interface.
|
||||
*/
|
||||
public function setFilename($value)
|
||||
{
|
||||
$this->_filename = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* The content type for the file attached (example image/png)
|
||||
*
|
||||
* @return string The content type
|
||||
*/
|
||||
public function getContentType()
|
||||
{
|
||||
return $this->_contentType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the content type for the file attached (example image/png)
|
||||
*
|
||||
* @param string $value The content type
|
||||
* @return Zend_Gdata_App_MediaFileSource Provides a fluent interface
|
||||
*/
|
||||
public function setContentType($value)
|
||||
{
|
||||
$this->_contentType = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Alias for getFilename().
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getFilename();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for defining data that can be encoded and sent over the network.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
interface Zend_Gdata_App_MediaSource
|
||||
{
|
||||
/**
|
||||
* Return a byte stream representation of this object.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function encode();
|
||||
|
||||
/**
|
||||
* Set the content type for the file attached (example image/png)
|
||||
*
|
||||
* @param string $value The content type
|
||||
* @return Zend_Gdata_App_MediaFileSource Provides a fluent interface
|
||||
*/
|
||||
public function setContentType($value);
|
||||
|
||||
/**
|
||||
* The content type for the file attached (example image/png)
|
||||
*
|
||||
* @return string The content type
|
||||
*/
|
||||
public function getContentType();
|
||||
|
||||
/**
|
||||
* Sets the Slug header value. Used by some services to determine the
|
||||
* title for the uploaded file. A null value indicates no slug header.
|
||||
*
|
||||
* @var string The slug value
|
||||
* @return Zend_Gdata_App_MediaSource Provides a fluent interface
|
||||
*/
|
||||
public function setSlug($value);
|
||||
|
||||
/**
|
||||
* Returns the Slug header value. Used by some services to determine the
|
||||
* title for the uploaded file. Returns null if no slug should be used.
|
||||
*
|
||||
* @return string The slug value
|
||||
*/
|
||||
public function getSlug();
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utility class for static functions needed by Zend_Gdata_App
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_App_Util
|
||||
{
|
||||
|
||||
/**
|
||||
* Convert timestamp into RFC 3339 date string.
|
||||
* 2005-04-19T15:30:00
|
||||
*
|
||||
* @param int $timestamp
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public static function formatTimestamp($timestamp)
|
||||
{
|
||||
$rfc3339 = '/^(\d{4})\-?(\d{2})\-?(\d{2})((T|t)(\d{2})\:?(\d{2})' .
|
||||
'\:?(\d{2})(\.\d{1,})?((Z|z)|([\+\-])(\d{2})\:?(\d{2})))?$/';
|
||||
|
||||
if (ctype_digit($timestamp)) {
|
||||
return gmdate('Y-m-d\TH:i:sP', $timestamp);
|
||||
} elseif (preg_match($rfc3339, $timestamp) > 0) {
|
||||
// timestamp is already properly formatted
|
||||
return $timestamp;
|
||||
} else {
|
||||
$ts = strtotime($timestamp);
|
||||
if ($ts === false) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Invalid timestamp: $timestamp.");
|
||||
}
|
||||
return date('Y-m-d\TH:i:s', $ts);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,222 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_HttpClient
|
||||
*/
|
||||
require_once 'Zend/Gdata/HttpClient.php';
|
||||
|
||||
/**
|
||||
* Zend_Version
|
||||
*/
|
||||
require_once 'Zend/Version.php';
|
||||
|
||||
/**
|
||||
* Wrapper around Zend_Http_Client to facilitate Google's "Account Authentication
|
||||
* Proxy for Web-Based Applications".
|
||||
*
|
||||
* @see http://code.google.com/apis/accounts/AuthForWebApps.html
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_AuthSub
|
||||
{
|
||||
|
||||
const AUTHSUB_REQUEST_URI = 'https://www.google.com/accounts/AuthSubRequest';
|
||||
|
||||
const AUTHSUB_SESSION_TOKEN_URI = 'https://www.google.com/accounts/AuthSubSessionToken';
|
||||
|
||||
const AUTHSUB_REVOKE_TOKEN_URI = 'https://www.google.com/accounts/AuthSubRevokeToken';
|
||||
|
||||
const AUTHSUB_TOKEN_INFO_URI = 'https://www.google.com/accounts/AuthSubTokenInfo';
|
||||
|
||||
/**
|
||||
* Creates a URI to request a single-use AuthSub token.
|
||||
*
|
||||
* @param string $next (required) URL identifying the service to be
|
||||
* accessed.
|
||||
* The resulting token will enable access to the specified service only.
|
||||
* Some services may limit scope further, such as read-only access.
|
||||
* @param string $scope (required) URL identifying the service to be
|
||||
* accessed. The resulting token will enable
|
||||
* access to the specified service only.
|
||||
* Some services may limit scope further, such
|
||||
* as read-only access.
|
||||
* @param int $secure (optional) Boolean flag indicating whether the
|
||||
* authentication transaction should issue a secure
|
||||
* token (1) or a non-secure token (0). Secure tokens
|
||||
* are available to registered applications only.
|
||||
* @param int $session (optional) Boolean flag indicating whether
|
||||
* the one-time-use token may be exchanged for
|
||||
* a session token (1) or not (0).
|
||||
* @param string $request_uri (optional) URI to which to direct the
|
||||
* authentication request.
|
||||
*/
|
||||
public static function getAuthSubTokenUri($next, $scope, $secure=0, $session=0,
|
||||
$request_uri = self::AUTHSUB_REQUEST_URI)
|
||||
{
|
||||
$querystring = '?next=' . urlencode($next)
|
||||
. '&scope=' . urldecode($scope)
|
||||
. '&secure=' . urlencode($secure)
|
||||
. '&session=' . urlencode($session);
|
||||
return $request_uri . $querystring;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Upgrades a single use token to a session token
|
||||
*
|
||||
* @param string $token The single use token which is to be upgraded
|
||||
* @param Zend_Http_Client $client (optional) HTTP client to use to
|
||||
* make the request
|
||||
* @param string $request_uri (optional) URI to which to direct
|
||||
* the session token upgrade
|
||||
* @return string The upgraded token value
|
||||
* @throws Zend_Gdata_App_AuthException
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
*/
|
||||
public static function getAuthSubSessionToken(
|
||||
$token, $client = null,
|
||||
$request_uri = self::AUTHSUB_SESSION_TOKEN_URI)
|
||||
{
|
||||
$client = self::getHttpClient($token, $client);
|
||||
|
||||
if ($client instanceof Zend_Gdata_HttpClient) {
|
||||
$filterResult = $client->filterHttpRequest('GET', $request_uri);
|
||||
$url = $filterResult['url'];
|
||||
$headers = $filterResult['headers'];
|
||||
$client->setHeaders($headers);
|
||||
$client->setUri($url);
|
||||
} else {
|
||||
$client->setUri($request_uri);
|
||||
}
|
||||
|
||||
try {
|
||||
$response = $client->request('GET');
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
|
||||
}
|
||||
|
||||
// Parse Google's response
|
||||
if ($response->isSuccessful()) {
|
||||
$goog_resp = array();
|
||||
foreach (explode("\n", $response->getBody()) as $l) {
|
||||
$l = chop($l);
|
||||
if ($l) {
|
||||
list($key, $val) = explode('=', chop($l), 2);
|
||||
$goog_resp[$key] = $val;
|
||||
}
|
||||
}
|
||||
return $goog_resp['Token'];
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/AuthException.php';
|
||||
throw new Zend_Gdata_App_AuthException(
|
||||
'Token upgrade failed. Reason: ' . $response->getBody());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke a token
|
||||
*
|
||||
* @param string $token The token to revoke
|
||||
* @param Zend_Http_Client $client (optional) HTTP client to use to make the request
|
||||
* @param string $request_uri (optional) URI to which to direct the revokation request
|
||||
* @return boolean Whether the revokation was successful
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
*/
|
||||
public static function AuthSubRevokeToken($token, $client = null,
|
||||
$request_uri = self::AUTHSUB_REVOKE_TOKEN_URI)
|
||||
{
|
||||
$client = self::getHttpClient($token, $client);
|
||||
$client->setUri($request_uri);
|
||||
ob_start();
|
||||
try {
|
||||
$response = $client->request('GET');
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
|
||||
}
|
||||
ob_end_clean();
|
||||
// Parse Google's response
|
||||
if ($response->isSuccessful()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get token information
|
||||
*
|
||||
* @param string $token The token to retrieve information about
|
||||
* @param Zend_Http_Client $client (optional) HTTP client to use to
|
||||
* make the request
|
||||
* @param string $request_uri (optional) URI to which to direct
|
||||
* the information request
|
||||
*/
|
||||
public static function getAuthSubTokenInfo(
|
||||
$token, $client = null, $request_uri = self::AUTHSUB_TOKEN_INFO_URI)
|
||||
{
|
||||
$client = self::getHttpClient($token, $client);
|
||||
$client->setUri($request_uri);
|
||||
ob_start();
|
||||
try {
|
||||
$response = $client->request('GET');
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
|
||||
}
|
||||
ob_end_clean();
|
||||
return $response->getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a HTTP client object with AuthSub credentials attached
|
||||
* as the Authorization header
|
||||
*
|
||||
* @param string $token The token to retrieve information about
|
||||
* @param Zend_Gdata_HttpClient $client (optional) HTTP client to use to make the request
|
||||
*/
|
||||
public static function getHttpClient($token, $client = null)
|
||||
{
|
||||
if ($client == null) {
|
||||
$client = new Zend_Gdata_HttpClient();
|
||||
}
|
||||
if (!$client instanceof Zend_Http_Client) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException('Client is not an instance of Zend_Http_Client.');
|
||||
}
|
||||
$useragent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setConfig(array(
|
||||
'strictredirects' => true,
|
||||
'useragent' => $useragent
|
||||
)
|
||||
);
|
||||
$client->setAuthSubToken($token);
|
||||
return $client;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_HttpClient
|
||||
*/
|
||||
require_once 'Zend/Gdata/HttpClient.php';
|
||||
|
||||
/**
|
||||
* Zend_Version
|
||||
*/
|
||||
require_once 'Zend/Version.php';
|
||||
|
||||
/**
|
||||
* Class to facilitate Google's "Account Authentication
|
||||
* for Installed Applications" also known as "ClientLogin".
|
||||
* @see http://code.google.com/apis/accounts/AuthForInstalledApps.html
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_ClientLogin
|
||||
{
|
||||
|
||||
/**
|
||||
* The Google client login URI
|
||||
*
|
||||
*/
|
||||
const CLIENTLOGIN_URI = 'https://www.google.com/accounts/ClientLogin';
|
||||
|
||||
/**
|
||||
* The default 'source' parameter to send to Google
|
||||
*
|
||||
*/
|
||||
const DEFAULT_SOURCE = 'Zend-ZendFramework';
|
||||
|
||||
/**
|
||||
* Set Google authentication credentials.
|
||||
* Must be done before trying to do any Google Data operations that
|
||||
* require authentication.
|
||||
* For example, viewing private data, or posting or deleting entries.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string $password
|
||||
* @param string $service
|
||||
* @param Zend_Gdata_HttpClient $client
|
||||
* @param string $source
|
||||
* @param string $loginToken The token identifier as provided by the server.
|
||||
* @param string $loginCaptcha The user's response to the CAPTCHA challenge.
|
||||
* @param string $accountType An optional string to identify whether the
|
||||
* account to be authenticated is a google or a hosted account. Defaults to
|
||||
* 'HOSTED_OR_GOOGLE'. See: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#Request
|
||||
* @throws Zend_Gdata_App_AuthException
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
* @throws Zend_Gdata_App_CaptchaRequiredException
|
||||
* @return Zend_Gdata_HttpClient
|
||||
*/
|
||||
public static function getHttpClient($email, $password, $service = 'xapi',
|
||||
$client = null,
|
||||
$source = self::DEFAULT_SOURCE,
|
||||
$loginToken = null,
|
||||
$loginCaptcha = null,
|
||||
$loginUri = self::CLIENTLOGIN_URI,
|
||||
$accountType = 'HOSTED_OR_GOOGLE')
|
||||
{
|
||||
if (! ($email && $password)) {
|
||||
require_once 'Zend/Gdata/App/AuthException.php';
|
||||
throw new Zend_Gdata_App_AuthException(
|
||||
'Please set your Google credentials before trying to ' .
|
||||
'authenticate');
|
||||
}
|
||||
|
||||
if ($client == null) {
|
||||
$client = new Zend_Gdata_HttpClient();
|
||||
}
|
||||
if (!$client instanceof Zend_Http_Client) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException(
|
||||
'Client is not an instance of Zend_Http_Client.');
|
||||
}
|
||||
|
||||
// Build the HTTP client for authentication
|
||||
$client->setUri($loginUri);
|
||||
$useragent = $source . ' Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setConfig(array(
|
||||
'maxredirects' => 0,
|
||||
'strictredirects' => true,
|
||||
'useragent' => $useragent
|
||||
)
|
||||
);
|
||||
$client->setParameterPost('accountType', $accountType);
|
||||
$client->setParameterPost('Email', (string) $email);
|
||||
$client->setParameterPost('Passwd', (string) $password);
|
||||
$client->setParameterPost('service', (string) $service);
|
||||
$client->setParameterPost('source', (string) $source);
|
||||
if ($loginToken || $loginCaptcha) {
|
||||
if($loginToken && $loginCaptcha) {
|
||||
$client->setParameterPost('logintoken', (string) $loginToken);
|
||||
$client->setParameterPost('logincaptcha',
|
||||
(string) $loginCaptcha);
|
||||
}
|
||||
else {
|
||||
require_once 'Zend/Gdata/App/AuthException.php';
|
||||
throw new Zend_Gdata_App_AuthException(
|
||||
'Please provide both a token ID and a user\'s response ' .
|
||||
'to the CAPTCHA challenge.');
|
||||
}
|
||||
}
|
||||
|
||||
// Send the authentication request
|
||||
// For some reason Google's server causes an SSL error. We use the
|
||||
// output buffer to supress an error from being shown. Ugly - but works!
|
||||
ob_start();
|
||||
try {
|
||||
$response = $client->request('POST');
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
require_once 'Zend/Gdata/App/HttpException.php';
|
||||
throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
|
||||
}
|
||||
ob_end_clean();
|
||||
|
||||
// Parse Google's response
|
||||
$goog_resp = array();
|
||||
foreach (explode("\n", $response->getBody()) as $l) {
|
||||
$l = chop($l);
|
||||
if ($l) {
|
||||
list($key, $val) = explode('=', chop($l), 2);
|
||||
$goog_resp[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if ($response->getStatus() == 200) {
|
||||
$client = new Zend_Gdata_HttpClient();
|
||||
$client->setClientLoginToken($goog_resp['Auth']);
|
||||
$useragent = $source . ' Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setConfig(array(
|
||||
'strictredirects' => true,
|
||||
'useragent' => $useragent
|
||||
)
|
||||
);
|
||||
return $client;
|
||||
|
||||
} elseif ($response->getStatus() == 403) {
|
||||
// Check if the server asked for a CAPTCHA
|
||||
if (array_key_exists('Error', $goog_resp) &&
|
||||
$goog_resp['Error'] == 'CaptchaRequired') {
|
||||
require_once 'Zend/Gdata/App/CaptchaRequiredException.php';
|
||||
throw new Zend_Gdata_App_CaptchaRequiredException(
|
||||
$goog_resp['CaptchaToken'], $goog_resp['CaptchaUrl']);
|
||||
}
|
||||
else {
|
||||
require_once 'Zend/Gdata/App/AuthException.php';
|
||||
throw new Zend_Gdata_App_AuthException('Authentication with Google failed. Reason: ' .
|
||||
(isset($goog_resp['Error']) ? $goog_resp['Error'] : 'Unspecified.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Executable
+254
@@ -0,0 +1,254 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata
|
||||
*/
|
||||
require_once 'Zend/Gdata.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Docs_DocumentListFeed
|
||||
*/
|
||||
require_once 'Zend/Gdata/Docs/DocumentListFeed.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Docs_DocumentListEntry
|
||||
*/
|
||||
require_once 'Zend/Gdata/Docs/DocumentListEntry.php';
|
||||
|
||||
/**
|
||||
* Service class for interacting with the Google Document List data API
|
||||
* @link http://code.google.com/apis/documents/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Docs extends Zend_Gdata
|
||||
{
|
||||
|
||||
const DOCUMENTS_LIST_FEED_URI = 'http://docs.google.com/feeds/documents/private/full';
|
||||
const AUTH_SERVICE_NAME = 'writely';
|
||||
|
||||
protected $_defaultPostUri = self::DOCUMENTS_LIST_FEED_URI;
|
||||
|
||||
private static $SUPPORTED_FILETYPES = array(
|
||||
'CSV'=>'text/csv',
|
||||
'DOC'=>'application/msword',
|
||||
'ODS'=>'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'ODT'=>'application/vnd.oasis.opendocument.text',
|
||||
'RTF'=>'application/rtf',
|
||||
'SXW'=>'application/vnd.sun.xml.writer',
|
||||
'TXT'=>'text/plain',
|
||||
'XLS'=>'application/vnd.ms-excel');
|
||||
|
||||
/**
|
||||
* Create Gdata_Docs object
|
||||
*
|
||||
* @param Zend_Http_Client $client (optional) The HTTP client to use when
|
||||
* when communicating with the Google servers.
|
||||
* @param string $applicationId The identity of the app in the form of Company-AppName-Version
|
||||
*/
|
||||
public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
$this->registerPackage('Zend_Gdata_Docs');
|
||||
parent::__construct($client, $applicationId);
|
||||
$this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up the mime type based on the file name extension. For example,
|
||||
* calling this method with 'csv' would return
|
||||
* 'text/comma-separated-values'. The Mime type is sent as a header in
|
||||
* the upload HTTP POST request.
|
||||
*
|
||||
* @param string $fileExtension
|
||||
* @return string The mime type to be sent to the server to tell it how the
|
||||
* multipart mime data should be interpreted.
|
||||
*/
|
||||
public static function lookupMimeType($fileExtension) {
|
||||
return self::$SUPPORTED_FILETYPES[strtoupper($fileExtension)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive feed object containing entries for the user's documents.
|
||||
*
|
||||
* @param mixed $location The location for the feed, as a URL or Query
|
||||
* @return Zend_Gdata_Docs_DocumentListFeed
|
||||
*/
|
||||
public function getDocumentListFeed($location = null)
|
||||
{
|
||||
if ($location === null) {
|
||||
$uri = self::DOCUMENTS_LIST_FEED_URI;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Docs_DocumentListFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object representing a single document.
|
||||
*
|
||||
* @param mixed $location The location for the entry, as a URL or Query
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry
|
||||
*/
|
||||
public function getDocumentListEntry($location = null)
|
||||
{
|
||||
if ($location === null) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Location must not be null');
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getEntry($uri, 'Zend_Gdata_Docs_DocumentListEntry');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object representing a single document.
|
||||
*
|
||||
* This method builds the URL where this item is stored using the type
|
||||
* and the id of the document.
|
||||
* @param string $docId The URL key for the document. Examples:
|
||||
* dcmg89gw_62hfjj8m, pKq0CzjiF3YmGd0AIlHKqeg
|
||||
* @param string $docType The type of the document as used in the Google
|
||||
* Document List URLs. Examples: document, spreadsheet, presentation
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry
|
||||
*/
|
||||
public function getDoc($docId, $docType) {
|
||||
$location = 'http://docs.google.com/feeds/documents/private/full/' .
|
||||
$docType . '%3A' . $docId;
|
||||
return $this->getDocumentListEntry($location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object for the desired word processing document.
|
||||
*
|
||||
* @param string $id The URL id for the document. Example:
|
||||
* dcmg89gw_62hfjj8m
|
||||
*/
|
||||
public function getDocument($id) {
|
||||
return $this->getDoc($id, 'document');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object for the desired spreadsheet.
|
||||
*
|
||||
* @param string $id The URL id for the document. Example:
|
||||
* pKq0CzjiF3YmGd0AIlHKqeg
|
||||
*/
|
||||
public function getSpreadsheet($id) {
|
||||
return $this->getDoc($id, 'spreadsheet');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object for the desired presentation.
|
||||
*
|
||||
* @param string $id The URL id for the document. Example:
|
||||
* dcmg89gw_21gtrjcn
|
||||
*/
|
||||
public function getPresentation($id) {
|
||||
return $this->getDoc($id, 'presentation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a local file to create a new Google Document entry.
|
||||
*
|
||||
* @param string $fileLocation The full or relative path of the file to
|
||||
* be uploaded.
|
||||
* @param string $title The name that this document should have on the
|
||||
* server. If set, the title is used as the slug header in the
|
||||
* POST request. If no title is provided, the location of the
|
||||
* file will be used as the slug header in the request. If no
|
||||
* mimeType is provided, this method attempts to determine the
|
||||
* mime type based on the slugHeader by looking for .doc,
|
||||
* .csv, .txt, etc. at the end of the file name.
|
||||
* Example value: 'test.doc'.
|
||||
* @param string $mimeType Describes the type of data which is being sent
|
||||
* to the server. This must be one of the accepted mime types
|
||||
* which are enumerated in SUPPORTED_FILETYPES.
|
||||
* @param string $uri (optional) The URL to which the upload should be
|
||||
* made.
|
||||
* Example: 'http://docs.google.com/feeds/documents/private/full'.
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry The entry for the newly
|
||||
* created Google Document.
|
||||
*/
|
||||
public function uploadFile($fileLocation, $title=null, $mimeType=null,
|
||||
$uri=null)
|
||||
{
|
||||
// Set the URI to which the file will be uploaded.
|
||||
if ($uri === null) {
|
||||
$uri = $this->_defaultPostUri;
|
||||
}
|
||||
|
||||
// Create the media source which describes the file.
|
||||
$fs = $this->newMediaFileSource($fileLocation);
|
||||
if ($title !== null) {
|
||||
$slugHeader = $title;
|
||||
} else {
|
||||
$slugHeader = $fileLocation;
|
||||
}
|
||||
|
||||
// Set the slug header to tell the Google Documents server what the
|
||||
// title of the document should be and what the file extension was
|
||||
// for the original file.
|
||||
$fs->setSlug($slugHeader);
|
||||
|
||||
// Set the mime type of the data.
|
||||
if ($mimeType === null) {
|
||||
$slugHeader = $fs->getSlug();
|
||||
$filenameParts = explode('.', $slugHeader);
|
||||
$fileExtension = end($filenameParts);
|
||||
$mimeType = self::lookupMimeType($fileExtension);
|
||||
}
|
||||
|
||||
// Set the mime type for the upload request.
|
||||
$fs->setContentType($mimeType);
|
||||
|
||||
// Send the data to the server.
|
||||
return $this->insertDocument($fs, $uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an entry to a given URI and returns the response as an Entry.
|
||||
*
|
||||
* @param mixed $data The Zend_Gdata_Docs_DocumentListEntry or media
|
||||
* source to post. If it is a DocumentListEntry, the mediaSource
|
||||
* should already have been set. If $data is a mediaSource, it
|
||||
* should have the correct slug header and mime type.
|
||||
* @param string $uri POST URI
|
||||
* @param string $className (optional) The class of entry to be returned.
|
||||
* The default is a 'Zend_Gdata_Docs_DocumentListEntry'.
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry The entry returned by the
|
||||
* service after insertion.
|
||||
*/
|
||||
public function insertDocument($data, $uri,
|
||||
$className='Zend_Gdata_Docs_DocumentListEntry')
|
||||
{
|
||||
return $this->insertEntry($data, $uri, $className);
|
||||
}
|
||||
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_EntryAtom
|
||||
*/
|
||||
require_once 'Zend/Gdata/Entry.php';
|
||||
|
||||
/**
|
||||
* Represents a Documents List entry in the Documents List data API meta feed
|
||||
* of a user's documents.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Docs_DocumentListEntry extends Zend_Gdata_Entry
|
||||
{
|
||||
|
||||
/**
|
||||
* Create a new instance of an entry representing a document.
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Docs::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
require_once 'Zend/Gdata/Feed.php';
|
||||
|
||||
|
||||
/**
|
||||
* Data model for a Google Documents List feed of documents
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Docs_DocumentListFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Docs_DocumentListEntry';
|
||||
|
||||
/**
|
||||
* The classname for the feed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_feedClassName = 'Zend_Gdata_Docs_DocumentListFeed';
|
||||
|
||||
/**
|
||||
* Create a new instance of a feed for a list of documents.
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Docs::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+219
@@ -0,0 +1,219 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_Query
|
||||
*/
|
||||
require_once('Zend/Gdata/Query.php');
|
||||
|
||||
/**
|
||||
* Assists in constructing queries for Google Document List documents
|
||||
*
|
||||
* @link http://code.google.com/apis/gdata/spreadsheets/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Docs_Query extends Zend_Gdata_Query
|
||||
{
|
||||
|
||||
/**
|
||||
* The base URL for retrieving a document list
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const DOCUMENTS_LIST_FEED_URI = 'http://docs.google.com/feeds/documents';
|
||||
|
||||
/**
|
||||
* The generic base URL used by some inherited methods
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultFeedUri = self::DOCUMENTS_LIST_FEED_URI;
|
||||
|
||||
/**
|
||||
* The visibility to be used when querying for the feed. A request for a
|
||||
* feed with private visbility requires the user to be authenricated.
|
||||
* Private is the only avilable visibility for the documents list.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_visibility = 'private';
|
||||
|
||||
/**
|
||||
* The projection determines how much detail should be given in the
|
||||
* result of the query. Full is the only valid projection for the
|
||||
* documents list.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_projection = 'full';
|
||||
|
||||
/**
|
||||
* Constructs a new instance of a Zend_Gdata_Docs_Query object.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the projection for this query. Common values for projection
|
||||
* include 'full'.
|
||||
*
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Docs_Query Provides a fluent interface
|
||||
*/
|
||||
public function setProjection($value)
|
||||
{
|
||||
$this->_projection = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visibility for this query. Common values for visibility
|
||||
* include 'private'.
|
||||
*
|
||||
* @return Zend_Gdata_Docs_Query Provides a fluent interface
|
||||
*/
|
||||
public function setVisibility($value)
|
||||
{
|
||||
$this->_visibility = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the projection for this query.
|
||||
*
|
||||
* @return string projection
|
||||
*/
|
||||
public function getProjection()
|
||||
{
|
||||
return $this->_projection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the visibility for this query.
|
||||
*
|
||||
* @return string visibility
|
||||
*/
|
||||
public function getVisibility()
|
||||
{
|
||||
return $this->_visibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title attribute for this query. The title parameter is used
|
||||
* to restrict the results to documents whose titles either contain or
|
||||
* completely match the title.
|
||||
*
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Docs_Query Provides a fluent interface
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_params['title'] = $value;
|
||||
} else {
|
||||
unset($this->_params['title']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title attribute for this query.
|
||||
*
|
||||
* @return string title
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
if (array_key_exists('title', $this->_params)) {
|
||||
return $this->_params['title'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title-exact attribute for this query.
|
||||
* If title-exact is set to true, the title query parameter will be used
|
||||
* in an exact match. Only documents with a title identical to the
|
||||
* title parameter will be returned.
|
||||
*
|
||||
* @param boolean $value Use either true or false
|
||||
* @return Zend_Gdata_Docs_Query Provides a fluent interface
|
||||
*/
|
||||
public function setTitleExact($value)
|
||||
{
|
||||
if ($value) {
|
||||
$this->_params['title-exact'] = $value;
|
||||
} else {
|
||||
unset($this->_params['title-exact']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title-exact attribute for this query.
|
||||
*
|
||||
* @return string title-exact
|
||||
*/
|
||||
public function getTitleExact()
|
||||
{
|
||||
if (array_key_exists('title-exact', $this->_params)) {
|
||||
return $this->_params['title-exact'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full query URL for this query.
|
||||
*
|
||||
* @return string url
|
||||
*/
|
||||
public function getQueryUrl()
|
||||
{
|
||||
$uri = $this->_defaultFeedUri;
|
||||
|
||||
if ($this->_visibility !== null) {
|
||||
$uri .= '/' . $this->_visibility;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'A visibility must be provided for cell queries.');
|
||||
}
|
||||
|
||||
if ($this->_projection !== null) {
|
||||
$uri .= '/' . $this->_projection;
|
||||
} else {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'A projection must be provided for cell queries.');
|
||||
}
|
||||
|
||||
$uri .= $this->getQueryString();
|
||||
return $uri;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_MediaEntry
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/MediaEntry.php';
|
||||
|
||||
/**
|
||||
* Represents the GData flavor of an Atom entry
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Entry extends Zend_Gdata_App_MediaEntry
|
||||
{
|
||||
|
||||
protected $_entryClassName = 'Zend_Gdata_Entry';
|
||||
|
||||
public function __construct($element = null)
|
||||
{
|
||||
foreach (Zend_Gdata::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents a GData extension
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gd';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
/* NOTE: namespaces must be registered before calling parent */
|
||||
$this->registerNamespace('openSearch',
|
||||
'http://a9.com/-/spec/opensearchrss/1.0/');
|
||||
$this->registerNamespace('rss',
|
||||
'http://blogs.law.harvard.edu/tech/rss');
|
||||
$this->registerNamespace('gd',
|
||||
'http://schemas.google.com/g/2005');
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Data model class to represent an attendee's status (gd:attendeeStatus)
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_AttendeeStatus extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'attendeeStatus';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Extension_AttendeeStatus object.
|
||||
* @param string $value (optional) Visibility value as URI.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_value !== null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's Value attribute.
|
||||
*
|
||||
* @return string The requested attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's Value attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_Visibility The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Data model class to represent an attendee's type (gd:attendeeType)
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_AttendeeType extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'attendeeType';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Extension_AttendeeType object.
|
||||
* @param string $value (optional) This entry's 'value' attribute.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_value != null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's Value attribute.
|
||||
*
|
||||
* @return string The requested attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's Value attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_Visibility The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_FeedLink
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension/FeedLink.php';
|
||||
|
||||
/**
|
||||
* Represents the gd:comments element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_Comments extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'comments';
|
||||
protected $_rel = null;
|
||||
protected $_feedLink = null;
|
||||
|
||||
public function __construct($rel = null, $feedLink = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_rel = $rel;
|
||||
$this->_feedLink = $feedLink;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_rel != null) {
|
||||
$element->setAttribute('rel', $this->_rel);
|
||||
}
|
||||
if ($this->_feedLink != null) {
|
||||
$element->appendChild($this->_feedLink->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gd') . ':' . 'feedLink';
|
||||
$feedLink = new Zend_Gdata_Extension_FeedLink();
|
||||
$feedLink->transferFromDOM($child);
|
||||
$this->_feedLink = $feedLink;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'rel':
|
||||
$this->_rel = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
public function getRel()
|
||||
{
|
||||
return $this->_rel;
|
||||
}
|
||||
|
||||
public function setRel($value)
|
||||
{
|
||||
$this->_rel = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFeedLink()
|
||||
{
|
||||
return $this->_feedLink;
|
||||
}
|
||||
|
||||
public function setFeedLink($value)
|
||||
{
|
||||
$this->_feedLink = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,164 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/Entry.php';
|
||||
|
||||
/**
|
||||
* Represents the gd:entryLink element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_EntryLink extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'entryLink';
|
||||
protected $_href = null;
|
||||
protected $_readOnly = null;
|
||||
protected $_rel = null;
|
||||
protected $_entry = null;
|
||||
|
||||
public function __construct($href = null, $rel = null,
|
||||
$readOnly = null, $entry = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_href = $href;
|
||||
$this->_readOnly = $readOnly;
|
||||
$this->_rel = $rel;
|
||||
$this->_entry = $entry;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_href != null) {
|
||||
$element->setAttribute('href', $this->_href);
|
||||
}
|
||||
if ($this->_readOnly != null) {
|
||||
$element->setAttribute('readOnly', ($this->_readOnly ? "true" : "false"));
|
||||
}
|
||||
if ($this->_rel != null) {
|
||||
$element->setAttribute('rel', $this->_rel);
|
||||
}
|
||||
if ($this->_entry != null) {
|
||||
$element->appendChild($this->_entry->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('atom') . ':' . 'entry';
|
||||
$entry = new Zend_Gdata_Entry();
|
||||
$entry->transferFromDOM($child);
|
||||
$this->_entry = $entry;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'href':
|
||||
$this->_href = $attribute->nodeValue;
|
||||
break;
|
||||
case 'readOnly':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_readOnly = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
$this->_readOnly = false;
|
||||
}
|
||||
else {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
break;
|
||||
case 'rel':
|
||||
$this->_rel = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHref()
|
||||
{
|
||||
return $this->_href;
|
||||
}
|
||||
|
||||
public function setHref($value)
|
||||
{
|
||||
$this->_href = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReadOnly()
|
||||
{
|
||||
return $this->_readOnly;
|
||||
}
|
||||
|
||||
public function setReadOnly($value)
|
||||
{
|
||||
$this->_readOnly = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRel()
|
||||
{
|
||||
return $this->_rel;
|
||||
}
|
||||
|
||||
public function setRel($value)
|
||||
{
|
||||
$this->_rel = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEntry()
|
||||
{
|
||||
return $this->_entry;
|
||||
}
|
||||
|
||||
public function setEntry($value)
|
||||
{
|
||||
$this->_entry = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the gd:eventStatus element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_EventStatus extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'eventStatus';
|
||||
protected $_value = null;
|
||||
|
||||
public function __construct($value = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_value != null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's Value attribute.
|
||||
*
|
||||
* @return string The requested attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's Value attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_Visibility The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Data model for gd:extendedProperty element, used by some GData
|
||||
* services to implement arbitrary name/value pair storage
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_ExtendedProperty extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'extendedProperty';
|
||||
protected $_name = null;
|
||||
protected $_value = null;
|
||||
|
||||
public function __construct($name = null, $value = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_name = $name;
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_name != null) {
|
||||
$element->setAttribute('name', $this->_name);
|
||||
}
|
||||
if ($this->_value != null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'name':
|
||||
$this->_name = $attribute->nodeValue;
|
||||
break;
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getName() . '=' . $this->getValue();
|
||||
}
|
||||
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
public function setName($value)
|
||||
{
|
||||
$this->_name = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,172 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
require_once 'Zend/Gdata/Feed.php';
|
||||
|
||||
/**
|
||||
* Represents the gd:feedLink element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_FeedLink extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'feedLink';
|
||||
protected $_countHint = null;
|
||||
protected $_href = null;
|
||||
protected $_readOnly = null;
|
||||
protected $_rel = null;
|
||||
protected $_feed = null;
|
||||
|
||||
public function __construct($href = null, $rel = null,
|
||||
$countHint = null, $readOnly = null, $feed = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_countHint = $countHint;
|
||||
$this->_href = $href;
|
||||
$this->_readOnly = $readOnly;
|
||||
$this->_rel = $rel;
|
||||
$this->_feed = $feed;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_countHint != null) {
|
||||
$element->setAttribute('countHint', $this->_countHint);
|
||||
}
|
||||
if ($this->_href != null) {
|
||||
$element->setAttribute('href', $this->_href);
|
||||
}
|
||||
if ($this->_readOnly != null) {
|
||||
$element->setAttribute('readOnly', ($this->_readOnly ? "true" : "false"));
|
||||
}
|
||||
if ($this->_rel != null) {
|
||||
$element->setAttribute('rel', $this->_rel);
|
||||
}
|
||||
if ($this->_feed != null) {
|
||||
$element->appendChild($this->_feed->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('atom') . ':' . 'feed';
|
||||
$feed = new Zend_Gdata_Feed();
|
||||
$feed->transferFromDOM($child);
|
||||
$this->_feed = $feed;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'countHint':
|
||||
$this->_countHint = $attribute->nodeValue;
|
||||
break;
|
||||
case 'href':
|
||||
$this->_href = $attribute->nodeValue;
|
||||
break;
|
||||
case 'readOnly':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_readOnly = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
$this->_readOnly = false;
|
||||
}
|
||||
else {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
break;
|
||||
case 'rel':
|
||||
$this->_rel = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getHref()
|
||||
{
|
||||
return $this->_href;
|
||||
}
|
||||
|
||||
public function setHref($value)
|
||||
{
|
||||
$this->_href = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReadOnly()
|
||||
{
|
||||
return $this->_readOnly;
|
||||
}
|
||||
|
||||
public function setReadOnly($value)
|
||||
{
|
||||
$this->_readOnly = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRel()
|
||||
{
|
||||
return $this->_rel;
|
||||
}
|
||||
|
||||
public function setRel($value)
|
||||
{
|
||||
$this->_rel = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getFeed()
|
||||
{
|
||||
return $this->_feed;
|
||||
}
|
||||
|
||||
public function setFeed($value)
|
||||
{
|
||||
$this->_feed = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the openSearch:itemsPerPage element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_OpenSearchItemsPerPage extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'itemsPerPage';
|
||||
protected $_rootNamespace = 'openSearch';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the openSeach:startIndex element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_OpenSearchStartIndex extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'startIndex';
|
||||
protected $_rootNamespace = 'openSearch';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the openSearch:totalResults element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_OpenSearchTotalResults extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'totalResults';
|
||||
protected $_rootNamespace = 'openSearch';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,139 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
require_once 'Zend/Gdata/Feed.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_When
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension/When.php';
|
||||
|
||||
/**
|
||||
* Represents the gd:originalEvent element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_OriginalEvent extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'originalEvent';
|
||||
protected $_id = null;
|
||||
protected $_href = null;
|
||||
protected $_when = null;
|
||||
|
||||
public function __construct($id = null, $href = null, $when = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_id = $id;
|
||||
$this->_href = $href;
|
||||
$this->_when = $when;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_id != null) {
|
||||
$element->setAttribute('id', $this->_id);
|
||||
}
|
||||
if ($this->_href != null) {
|
||||
$element->setAttribute('href', $this->_href);
|
||||
}
|
||||
if ($this->_when != null) {
|
||||
$element->appendChild($this->_when->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'id':
|
||||
$this->_id = $attribute->nodeValue;
|
||||
break;
|
||||
case 'href':
|
||||
$this->_href = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gd') . ':' . 'when';
|
||||
$when = new Zend_Gdata_Extension_When();
|
||||
$when->transferFromDOM($child);
|
||||
$this->_when = $when;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function getId()
|
||||
{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
public function setId($value)
|
||||
{
|
||||
$this->_id = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHref()
|
||||
{
|
||||
return $this->_href;
|
||||
}
|
||||
|
||||
public function setHref($value)
|
||||
{
|
||||
$this->_href = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWhen()
|
||||
{
|
||||
return $this->_when;
|
||||
}
|
||||
|
||||
public function setWhen($value)
|
||||
{
|
||||
$this->_when = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Implements the gd:rating element
|
||||
*
|
||||
* TODO: Add comments for these methods
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_Rating extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'rating';
|
||||
protected $_min = null;
|
||||
protected $_max = null;
|
||||
protected $_numRaters = null;
|
||||
protected $_average = null;
|
||||
|
||||
public function __construct($average = null, $min = null,
|
||||
$max = null, $numRaters = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_average = $average;
|
||||
$this->_min = $min;
|
||||
$this->_max = $max;
|
||||
$this->_numRaters = $numRaters;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_min != null) {
|
||||
$element->setAttribute('min', $this->_min);
|
||||
}
|
||||
if ($this->_max != null) {
|
||||
$element->setAttribute('max', $this->_max);
|
||||
}
|
||||
if ($this->_numRaters != null) {
|
||||
$element->setAttribute('numRaters', $this->_numRaters);
|
||||
}
|
||||
if ($this->_average != null) {
|
||||
$element->setAttribute('average', $this->_average);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'min':
|
||||
$this->_min = $attribute->nodeValue;
|
||||
break;
|
||||
case 'max':
|
||||
$this->_max = $attribute->nodeValue;
|
||||
break;
|
||||
case 'numRaters':
|
||||
$this->_numRaters = $attribute->nodeValue;
|
||||
break;
|
||||
case 'average':
|
||||
$this->_average = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
return $this->_average;
|
||||
}
|
||||
|
||||
public function getMin()
|
||||
{
|
||||
return $this->_min;
|
||||
}
|
||||
|
||||
public function setMin($value)
|
||||
{
|
||||
$this->_min = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getNumRaters()
|
||||
{
|
||||
return $this->_numRaters;
|
||||
}
|
||||
|
||||
public function setNumRaters($value)
|
||||
{
|
||||
$this->_numRaters = $value;
|
||||
return $this;
|
||||
}
|
||||
public function getAverage()
|
||||
{
|
||||
return $this->_average;
|
||||
}
|
||||
|
||||
public function setAverage($value)
|
||||
{
|
||||
$this->_average = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMax()
|
||||
{
|
||||
return $this->_max;
|
||||
}
|
||||
|
||||
public function setMax($value)
|
||||
{
|
||||
$this->_max = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the gd:recurrence element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_Recurrence extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'recurrence';
|
||||
|
||||
public function __construct($text = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,202 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Data model class to represent an entry's recurrenceException
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_RecurrenceException extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'recurrenceException';
|
||||
protected $_specialized = null;
|
||||
protected $_entryLink = null;
|
||||
protected $_originalEvent = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Extension_RecurrenceException object.
|
||||
* @param bool $specialized (optional) Whether this is a specialized exception or not.
|
||||
* @param Zend_Gdata_EntryLink (optional) An Event entry with details about the exception.
|
||||
* @param Zend_Gdata_OriginalEvent (optional) The origianl recurrent event this is an exeption to.
|
||||
*/
|
||||
public function __construct($specialized = null, $entryLink = null,
|
||||
$originalEvent = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_specialized = $specialized;
|
||||
$this->_entryLink = $entryLink;
|
||||
$this->_originalEvent = $originalEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_specialized != null) {
|
||||
$element->setAttribute('specialized', ($this->_specialized ? "true" : "false"));
|
||||
}
|
||||
if ($this->_entryLink != null) {
|
||||
$element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_originalEvent != null) {
|
||||
$element->appendChild($this->_originalEvent->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'specialized':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_specialized = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
$this->_specialized = false;
|
||||
}
|
||||
else {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual Entry objects of the appropriate type and
|
||||
* stores them as members of this entry based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gd') . ':' . 'entryLink':
|
||||
$entryLink = new Zend_Gdata_Extension_EntryLink();
|
||||
$entryLink->transferFromDOM($child);
|
||||
$this->_entryLink = $entryLink;
|
||||
break;
|
||||
case $this->lookupNamespace('gd') . ':' . 'originalEvent':
|
||||
$originalEvent = new Zend_Gdata_Extension_OriginalEvent();
|
||||
$originalEvent->transferFromDOM($child);
|
||||
$this->_originalEvent = $originalEvent;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's Specialized attribute.
|
||||
*
|
||||
* @return bool The requested attribute.
|
||||
*/
|
||||
public function getSpecialized()
|
||||
{
|
||||
return $this->_specialized;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's Specialized attribute.
|
||||
*
|
||||
* @param bool $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_RecurrenceException The element being modified.
|
||||
*/
|
||||
public function setSpecialized($value)
|
||||
{
|
||||
$this->_specialized = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's EntryLink attribute.
|
||||
*
|
||||
* @return Zend_Gdata_Extension_EntryLink The requested attribute.
|
||||
*/
|
||||
public function getEntryLink()
|
||||
{
|
||||
return $this->_entryLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's EntryLink attribute.
|
||||
*
|
||||
* @param Zend_Gdata_Extension_EntryLink $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_RecurrenceException The element being modified.
|
||||
*/
|
||||
public function setEntryLink($value)
|
||||
{
|
||||
$this->_entryLink = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's Specialized attribute.
|
||||
*
|
||||
* @return Zend_Gdata_Extension_OriginalEvent The requested attribute.
|
||||
*/
|
||||
public function getOriginalEvent()
|
||||
{
|
||||
return $this->_originalEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's Specialized attribute.
|
||||
*
|
||||
* @param Zend_Gdata_Extension_OriginalEvent $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_RecurrenceException The element being modified.
|
||||
*/
|
||||
public function setOriginalEvent($value)
|
||||
{
|
||||
$this->_originalEvent = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,168 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Implements the gd:reminder element used to set/retrieve notifications
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_Reminder extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'reminder';
|
||||
protected $_absoluteTime = null;
|
||||
protected $_method = null;
|
||||
protected $_days = null;
|
||||
protected $_hours = null;
|
||||
protected $_minutes = null;
|
||||
|
||||
public function __construct($absoluteTime = null, $method = null, $days = null,
|
||||
$hours = null, $minutes = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_absoluteTime = $absoluteTime;
|
||||
$this->_method = $method;
|
||||
$this->_days = $days;
|
||||
$this->_hours = $hours;
|
||||
$this->_minutes = $minutes;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_absoluteTime != null) {
|
||||
$element->setAttribute('absoluteTime', $this->_absoluteTime);
|
||||
}
|
||||
if ($this->_method != null) {
|
||||
$element->setAttribute('method', $this->_method);
|
||||
}
|
||||
if ($this->_days != null) {
|
||||
$element->setAttribute('days', $this->_days);
|
||||
}
|
||||
if ($this->_hours != null) {
|
||||
$element->setAttribute('hours', $this->_hours);
|
||||
}
|
||||
if ($this->_minutes != null) {
|
||||
$element->setAttribute('minutes', $this->_minutes);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'absoluteTime':
|
||||
$this->_absoluteTime = $attribute->nodeValue;
|
||||
break;
|
||||
case 'method':
|
||||
$this->_method = $attribute->nodeValue;
|
||||
break;
|
||||
case 'days':
|
||||
$this->_days = $attribute->nodeValue;
|
||||
break;
|
||||
case 'hours':
|
||||
$this->_hours = $attribute->nodeValue;
|
||||
break;
|
||||
case 'minutes':
|
||||
$this->_minutes = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
$s;
|
||||
if ($absoluteTime)
|
||||
$s = "at" . $absoluteTime;
|
||||
else if ($days)
|
||||
$s = "in" . $days . "days";
|
||||
else if ($hours)
|
||||
$s = "in" . $hours . "hours";
|
||||
else if ($minutes)
|
||||
$s = "in" . $minutes . "minutes";
|
||||
return $method . $s;
|
||||
}
|
||||
|
||||
public function getAbsoluteTime()
|
||||
{
|
||||
return $this->_absoluteTime;
|
||||
}
|
||||
|
||||
public function setAbsoluteTime($value)
|
||||
{
|
||||
$this->_absoluteTime = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getDays()
|
||||
{
|
||||
return $this->_days;
|
||||
}
|
||||
|
||||
public function setDays($value)
|
||||
{
|
||||
$this->_days = $value;
|
||||
return $this;
|
||||
}
|
||||
public function getHours()
|
||||
{
|
||||
return $this->_hours;
|
||||
}
|
||||
|
||||
public function setHours($value)
|
||||
{
|
||||
$this->_hours = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMinutes()
|
||||
{
|
||||
return $this->_minutes;
|
||||
}
|
||||
|
||||
public function setMinutes($value)
|
||||
{
|
||||
$this->_minutes = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getMethod()
|
||||
{
|
||||
return $this->_method;
|
||||
}
|
||||
|
||||
public function setMethod($value)
|
||||
{
|
||||
$this->_method = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Data model class to represent an entry's transparency
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_Transparency extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'transparency';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Extension_Transparency object.
|
||||
* @param bool $value (optional) Transparency value as URI
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_value != null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's Value attribute.
|
||||
*
|
||||
* @return bool The requested attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's Value attribute.
|
||||
*
|
||||
* @param bool $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_Transparency The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,120 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Data model class to represent an entry's visibility
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_Visibility extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'visibility';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Extension_Visibility object.
|
||||
* @param bool $value (optional) Visibility value as URI.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_value != null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's Value attribute.
|
||||
*
|
||||
* @return bool The requested attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's Value attribute.
|
||||
*
|
||||
* @param bool $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_Visibility The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,166 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_Reminder
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension/Reminder.php';
|
||||
|
||||
/**
|
||||
* Represents the gd:when element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_When extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'when';
|
||||
protected $_reminders = array();
|
||||
protected $_startTime = null;
|
||||
protected $_valueString = null;
|
||||
protected $_endTime = null;
|
||||
|
||||
public function __construct($startTime = null, $endTime = null,
|
||||
$valueString = null, $reminders = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_startTime = $startTime;
|
||||
$this->_endTime = $endTime;
|
||||
$this->_valueString = $valueString;
|
||||
$this->_reminders = $reminders;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_startTime != null) {
|
||||
$element->setAttribute('startTime', $this->_startTime);
|
||||
}
|
||||
if ($this->_endTime != null) {
|
||||
$element->setAttribute('endTime', $this->_endTime);
|
||||
}
|
||||
if ($this->_valueString != null) {
|
||||
$element->setAttribute('valueString', $this->_valueString);
|
||||
}
|
||||
if ($this->_reminders != null) {
|
||||
foreach ($this->_reminders as $reminder) {
|
||||
$element->appendChild(
|
||||
$reminder->getDOM($element->ownerDocument));
|
||||
}
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gd') . ':' . 'reminder';
|
||||
$reminder = new Zend_Gdata_Extension_Reminder();
|
||||
$reminder->transferFromDOM($child);
|
||||
$this->_reminders[] = $reminder;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'startTime':
|
||||
$this->_startTime = $attribute->nodeValue;
|
||||
break;
|
||||
case 'endTime':
|
||||
$this->_endTime = $attribute->nodeValue;
|
||||
break;
|
||||
case 'valueString':
|
||||
$this->_valueString = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
if ($valueString)
|
||||
return $valueString;
|
||||
else {
|
||||
return 'Starts: ' . $this->getStartTime() . ' ' .
|
||||
'Ends: ' . $this->getEndTime();
|
||||
}
|
||||
}
|
||||
|
||||
public function getStartTime()
|
||||
{
|
||||
return $this->_startTime;
|
||||
}
|
||||
|
||||
public function setStartTime($value)
|
||||
{
|
||||
$this->_startTime = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEndTime()
|
||||
{
|
||||
return $this->_endTime;
|
||||
}
|
||||
|
||||
public function setEndTime($value)
|
||||
{
|
||||
$this->_endTime = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValueString()
|
||||
{
|
||||
return $this->_valueString;
|
||||
}
|
||||
|
||||
public function setValueString($value)
|
||||
{
|
||||
$this->_valueString = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getReminders()
|
||||
{
|
||||
return $this->_reminders;
|
||||
}
|
||||
|
||||
public function setReminders($value)
|
||||
{
|
||||
$this->_reminders = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,163 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Data model class to represent a location (gd:where element)
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_Where extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'where';
|
||||
protected $_label = null;
|
||||
protected $_rel = null;
|
||||
protected $_valueString = null;
|
||||
protected $_entryLink = null;
|
||||
|
||||
public function __construct($valueString = null, $label = null, $rel = null, $entryLink = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_valueString = $valueString;
|
||||
$this->_label = $label;
|
||||
$this->_rel = $rel;
|
||||
$this->_entryLink = $entryLink;
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_label != null) {
|
||||
$element->setAttribute('label', $this->_label);
|
||||
}
|
||||
if ($this->_rel != null) {
|
||||
$element->setAttribute('rel', $this->_rel);
|
||||
}
|
||||
if ($this->_valueString != null) {
|
||||
$element->setAttribute('valueString', $this->_valueString);
|
||||
}
|
||||
if ($this->entryLink != null) {
|
||||
$element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'label':
|
||||
$this->_label = $attribute->nodeValue;
|
||||
break;
|
||||
case 'rel':
|
||||
$this->_rel = $attribute->nodeValue;
|
||||
break;
|
||||
case 'valueString':
|
||||
$this->_valueString = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual Entry objects of the appropriate type and
|
||||
* stores them in the $_entry array based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gd') . ':' . 'entryLink':
|
||||
$entryLink = new Zend_Gdata_Extension_EntryLink();
|
||||
$entryLink->transferFromDOM($child);
|
||||
$this->_entryLink = $entryLink;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function __toString()
|
||||
{
|
||||
if ($this->_valueString != null) {
|
||||
return $this->_valueString;
|
||||
}
|
||||
else {
|
||||
return parent::__toString();
|
||||
}
|
||||
}
|
||||
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->_label;
|
||||
}
|
||||
|
||||
public function setLabel($value)
|
||||
{
|
||||
$this->_label = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getRel()
|
||||
{
|
||||
return $this->_rel;
|
||||
}
|
||||
|
||||
public function setRel($value)
|
||||
{
|
||||
$this->_rel = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getValueString()
|
||||
{
|
||||
return $this->_valueString;
|
||||
}
|
||||
|
||||
public function setValueString($value)
|
||||
{
|
||||
$this->_valueString = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getEntryLink()
|
||||
{
|
||||
return $this->_entryLink;
|
||||
}
|
||||
|
||||
public function setEntryLink($value)
|
||||
{
|
||||
$this->_entryLink = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,291 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_AttendeeStatus
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension/AttendeeStatus.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_AttendeeType
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension/AttendeeType.php';
|
||||
|
||||
/**
|
||||
* Data model class to represent a participant
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Extension_Who extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'who';
|
||||
protected $_email = null;
|
||||
protected $_rel = null;
|
||||
protected $_valueString = null;
|
||||
protected $_attendeeStatus = null;
|
||||
protected $_attendeeType = null;
|
||||
protected $_entryLink = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Extension_Who object.
|
||||
* @param string $email (optional) Email address.
|
||||
* @param string $rel (optional) Relationship description.
|
||||
* @param string $valueString (optional) Simple string describing this person.
|
||||
* @param Zend_Gdata_Extension_AttendeeStatus $attendeeStatus (optional) The status of the attendee.
|
||||
* @param Zend_Gdata_Extension_AttendeeType $attendeeType (optional) The type of the attendee.
|
||||
* @param string $entryLink URL pointing to an associated entry (Contact kind) describing this person.
|
||||
*/
|
||||
public function __construct($email = null, $rel = null, $valueString = null,
|
||||
$attendeeStatus = null, $attendeeType = null, $entryLink = null)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->_email = $email;
|
||||
$this->_rel = $rel;
|
||||
$this->_valueString = $valueString;
|
||||
$this->_attendeeStatus = $attendeeStatus;
|
||||
$this->_attendeeType = $attendeeType;
|
||||
$this->_entryLink = $entryLink;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_email != null) {
|
||||
$element->setAttribute('email', $this->_email);
|
||||
}
|
||||
if ($this->_rel != null) {
|
||||
$element->setAttribute('rel', $this->_rel);
|
||||
}
|
||||
if ($this->_valueString != null) {
|
||||
$element->setAttribute('valueString', $this->_valueString);
|
||||
}
|
||||
if ($this->_attendeeStatus != null) {
|
||||
$element->appendChild($this->_attendeeStatus->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_attendeeType != null) {
|
||||
$element->appendChild($this->_attendeeType->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_entryLink != null) {
|
||||
$element->appendChild($this->_entryLink->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'email':
|
||||
$this->_email = $attribute->nodeValue;
|
||||
break;
|
||||
case 'rel':
|
||||
$this->_rel = $attribute->nodeValue;
|
||||
break;
|
||||
case 'valueString':
|
||||
$this->_valueString = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual Entry objects of the appropriate type and
|
||||
* stores them as members of this entry based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gd') . ':' . 'attendeeStatus':
|
||||
$attendeeStatus = new Zend_Gdata_Extension_AttendeeStatus();
|
||||
$attendeeStatus->transferFromDOM($child);
|
||||
$this->_attendeeStatus = $attendeeStatus;
|
||||
break;
|
||||
case $this->lookupNamespace('gd') . ':' . 'attendeeType':
|
||||
$attendeeType = new Zend_Gdata_Extension_AttendeeType();
|
||||
$attendeeType->transferFromDOM($child);
|
||||
$this->_attendeeType = $attendeeType;
|
||||
break;
|
||||
case $this->lookupNamespace('gd') . ':' . 'entryLink':
|
||||
$entryLink = new Zend_Gdata_Extension_EntryLink();
|
||||
$entryLink->transferFromDOM($child);
|
||||
$this->_entryLink = $entryLink;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a human readable string describing this attribute's value.
|
||||
*
|
||||
* @return string The attribute value.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
if ($this->_valueString != null) {
|
||||
return $this->_valueString;
|
||||
}
|
||||
else {
|
||||
return parent::__toString();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's ValueString attribute.
|
||||
*
|
||||
* @return string The requested attribute.
|
||||
*/
|
||||
public function getValueString()
|
||||
{
|
||||
return $this->_valueString;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's ValueString attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_Who The element being modified.
|
||||
*/
|
||||
public function setValueString($value)
|
||||
{
|
||||
$this->_valueString = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's Email attribute.
|
||||
*
|
||||
* @return string The requested attribute.
|
||||
*/
|
||||
public function getEmail()
|
||||
{
|
||||
return $this->_email;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's Email attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_Who The element being modified.
|
||||
*/
|
||||
public function setEmail($value)
|
||||
{
|
||||
$this->_email = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's Rel attribute.
|
||||
*
|
||||
* @return string The requested attribute.
|
||||
*/
|
||||
public function getRel()
|
||||
{
|
||||
return $this->_rel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's Rel attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_Who The element being modified.
|
||||
*/
|
||||
public function setRel($value)
|
||||
{
|
||||
$this->_rel = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this entry's AttendeeStatus element.
|
||||
*
|
||||
* @return Zend_Gdata_Extension_AttendeeStatus The requested entry.
|
||||
*/
|
||||
public function getAttendeeStatus()
|
||||
{
|
||||
return $this->_attendeeStatus;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the child's AttendeeStatus element.
|
||||
*
|
||||
* @param Zend_Gdata_Extension_AttendeeStatus $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_Who The element being modified.
|
||||
*/
|
||||
public function setAttendeeStatus($value)
|
||||
{
|
||||
$this->_attendeeStatus = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get this entry's AttendeeType element.
|
||||
*
|
||||
* @return Zend_Gdata_Extension_AttendeeType The requested entry.
|
||||
*/
|
||||
public function getAttendeeType()
|
||||
{
|
||||
return $this->_attendeeType;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the child's AttendeeType element.
|
||||
*
|
||||
* @param Zend_Gdata_Extension_AttendeeType $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_Who The element being modified.
|
||||
*/
|
||||
public function setAttendeeType($value)
|
||||
{
|
||||
$this->_attendeeType = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,167 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Feed
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Feed.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/Entry.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_OpenSearchTotalResults
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension/OpenSearchTotalResults.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_OpenSearchStartIndex
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension/OpenSearchStartIndex.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_OpenSearchItemsPerPage
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension/OpenSearchItemsPerPage.php';
|
||||
|
||||
/**
|
||||
* The GData flavor of an Atom Feed
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Feed extends Zend_Gdata_App_Feed
|
||||
{
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Entry';
|
||||
|
||||
/**
|
||||
* The openSearch:totalResults element
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_totalResults = null;
|
||||
|
||||
/**
|
||||
* The openSearch:startIndex element
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_startIndex = null;
|
||||
|
||||
/**
|
||||
* The openSearch:itemsPerPage element
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_itemsPerPage = null;
|
||||
|
||||
public function __construct($element = null)
|
||||
{
|
||||
foreach (Zend_Gdata::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_totalResults != null) {
|
||||
$element->appendChild($this->_totalResults->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_startIndex != null) {
|
||||
$element->appendChild($this->_startIndex->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_itemsPerPage != null) {
|
||||
$element->appendChild($this->_itemsPerPage->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual Entry objects of the appropriate type and
|
||||
* stores them in the $_entry array based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('openSearch') . ':' . 'totalResults':
|
||||
$totalResults = new Zend_Gdata_Extension_OpenSearchTotalResults();
|
||||
$totalResults->transferFromDOM($child);
|
||||
$this->_totalResults = $totalResults;
|
||||
break;
|
||||
case $this->lookupNamespace('openSearch') . ':' . 'startIndex':
|
||||
$startIndex = new Zend_Gdata_Extension_OpenSearchStartIndex();
|
||||
$startIndex->transferFromDOM($child);
|
||||
$this->_startIndex = $startIndex;
|
||||
break;
|
||||
case $this->lookupNamespace('openSearch') . ':' . 'itemsPerPage':
|
||||
$itemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage();
|
||||
$itemsPerPage->transferFromDOM($child);
|
||||
$this->_itemsPerPage = $itemsPerPage;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
function setTotalResults($value) {
|
||||
$this->_totalResults = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function getTotalResults() {
|
||||
return $this->_totalResults;
|
||||
}
|
||||
|
||||
function setStartIndex($value) {
|
||||
$this->_startIndex = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function getStartIndex() {
|
||||
return $this->_startIndex;
|
||||
}
|
||||
|
||||
function setItemsPerPage($value) {
|
||||
$this->_itemsPerPage = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
function getItemsPerPage() {
|
||||
return $this->_itemsPerPage;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata
|
||||
*/
|
||||
require_once 'Zend/Gdata.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Gbase_ItemFeed
|
||||
*/
|
||||
require_once 'Zend/Gdata/Gbase/ItemFeed.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Gbase_ItemEntry
|
||||
*/
|
||||
require_once 'Zend/Gdata/Gbase/ItemEntry.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Gbase_SnippetEntry
|
||||
*/
|
||||
require_once 'Zend/Gdata/Gbase/SnippetEntry.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Gbase_SnippetFeed
|
||||
*/
|
||||
require_once 'Zend/Gdata/Gbase/SnippetFeed.php';
|
||||
|
||||
/**
|
||||
* Service class for interacting with the Google Base data API
|
||||
*
|
||||
* @link http://code.google.com/apis/base
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase extends Zend_Gdata
|
||||
{
|
||||
|
||||
/**
|
||||
* Path to the customer items feeds on the Google Base server.
|
||||
*/
|
||||
const GBASE_ITEM_FEED_URI = 'http://www.google.com/base/feeds/items';
|
||||
|
||||
/**
|
||||
* Path to the snippets feeds on the Google Base server.
|
||||
*/
|
||||
const GBASE_SNIPPET_FEED_URI = 'http://www.google.com/base/feeds/snippets';
|
||||
|
||||
/**
|
||||
* Authentication service name for Google Base
|
||||
*/
|
||||
const AUTH_SERVICE_NAME = 'gbase';
|
||||
|
||||
/**
|
||||
* The default URI for POST methods
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultPostUri = self::GBASE_ITEM_FEED_URI;
|
||||
|
||||
public static $namespaces = array(
|
||||
'g' => 'http://base.google.com/ns/1.0',
|
||||
'batch' => 'http://schemas.google.com/gdata/batch');
|
||||
|
||||
/**
|
||||
* Create Zend_Gdata_Gbase object
|
||||
*
|
||||
* @param Zend_Http_Client $client (optional) The HTTP client to use when
|
||||
* when communicating with the Google Apps servers.
|
||||
* @param string $applicationId The identity of the app in the form of Company-AppName-Version
|
||||
*/
|
||||
public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
$this->registerPackage('Zend_Gdata_Gbase');
|
||||
$this->registerPackage('Zend_Gdata_Gbase_Extension');
|
||||
parent::__construct($client, $applicationId);
|
||||
$this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive feed object
|
||||
*
|
||||
* @param mixed $location The location for the feed, as a URL or Query
|
||||
* @return Zend_Gdata_Gbase_ItemFeed
|
||||
*/
|
||||
public function getGbaseItemFeed($location = null)
|
||||
{
|
||||
if ($location === null) {
|
||||
$uri = self::GBASE_ITEM_FEED_URI;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Gbase_ItemFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object
|
||||
*
|
||||
* @param mixed $location The location for the feed, as a URL or Query
|
||||
* @return Zend_Gdata_Gbase_ItemEntry
|
||||
*/
|
||||
public function getGbaseItemEntry($location = null)
|
||||
{
|
||||
if ($location === null) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Location must not be null');
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getEntry($uri, 'Zend_Gdata_Gbase_ItemEntry');
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert an entry
|
||||
*
|
||||
* @param Zend_Gdata_Gbase_ItemEntry $entry The Base entry to upload
|
||||
* @param boolean $dryRun Flag for the 'dry-run' parameter
|
||||
* @return Zend_Gdata_Gbase_ItemFeed
|
||||
*/
|
||||
public function insertGbaseItem($entry, $dryRun = false)
|
||||
{
|
||||
if ($dryRun == false) {
|
||||
$uri = $this->_defaultPostUri;
|
||||
} else {
|
||||
$uri = $this->_defaultPostUri . '?dry-run=true';
|
||||
}
|
||||
$newitem = $this->insertEntry($entry, $uri, 'Zend_Gdata_Gbase_ItemEntry');
|
||||
return $newitem;
|
||||
}
|
||||
|
||||
/**
|
||||
* Update an entry
|
||||
*
|
||||
* @param Zend_Gdata_Gbase_ItemEntry $entry The Base entry to be updated
|
||||
* @param boolean $dryRun Flag for the 'dry-run' parameter
|
||||
* @return Zend_Gdata_Gbase_ItemEntry
|
||||
*/
|
||||
public function updateGbaseItem($entry, $dryRun = false)
|
||||
{
|
||||
$returnedEntry = $entry->save($dryRun);
|
||||
return $returnedEntry;
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an entry
|
||||
*
|
||||
* @param Zend_Gdata_Gbase_ItemEntry $entry The Base entry to remove
|
||||
* @param boolean $dryRun Flag for the 'dry-run' parameter
|
||||
* @return Zend_Gdata_Gbase_ItemFeed
|
||||
*/
|
||||
public function deleteGbaseItem($entry, $dryRun = false)
|
||||
{
|
||||
$entry->delete($dryRun);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve feed object
|
||||
*
|
||||
* @param mixed $location The location for the feed, as a URL or Query
|
||||
* @return Zend_Gdata_Gbase_SnippetFeed
|
||||
*/
|
||||
public function getGbaseSnippetFeed($location = null)
|
||||
{
|
||||
if ($location === null) {
|
||||
$uri = self::GBASE_SNIPPET_FEED_URI;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Gbase_SnippetFeed');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,150 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/Entry.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Gbase_Extension_BaseAttribute
|
||||
*/
|
||||
require_once 'Zend/Gdata/Gbase/Extension/BaseAttribute.php';
|
||||
|
||||
/**
|
||||
* Base class for working with Google Base entries.
|
||||
*
|
||||
* @link http://code.google.com/apis/base/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase_Entry extends Zend_Gdata_Entry
|
||||
{
|
||||
|
||||
/**
|
||||
* Name of the base class for Google Base entries
|
||||
*
|
||||
* var @string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Gbase_Entry';
|
||||
|
||||
/**
|
||||
* Google Base attribute elements in the 'g' namespace
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
protected $_baseAttributes = array();
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Gbase_ItemEntry object.
|
||||
* @param DOMElement $element (optional) The DOMElement on which to base this object.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Gbase::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
foreach ($this->_baseAttributes as $baseAttribute) {
|
||||
$element->appendChild($baseAttribute->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual Entry objects of the appropriate type and
|
||||
* stores them as members of this entry based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
|
||||
if (strstr($absoluteNodeName, $this->lookupNamespace('g') . ':')) {
|
||||
$baseAttribute = new Zend_Gdata_Gbase_Extension_BaseAttribute();
|
||||
$baseAttribute->transferFromDOM($child);
|
||||
$this->_baseAttributes[] = $baseAttribute;
|
||||
} else {
|
||||
parent::takeChildFromDOM($child);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value of the itme_type
|
||||
*
|
||||
* @return Zend_Gdata_Gbase_Extension_ItemType The requested object.
|
||||
*/
|
||||
public function getItemType()
|
||||
{
|
||||
$itemType = $this->getGbaseAttribute('item_type');
|
||||
if (is_object($itemType[0])) {
|
||||
return $itemType[0];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return all the Base attributes
|
||||
* @return Zend_Gdata_Gbase_Extension_BaseAttribute
|
||||
*/
|
||||
public function getGbaseAttributes() {
|
||||
return $this->_baseAttributes;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return an array of Base attributes that match the given attribute name
|
||||
*
|
||||
* @param string $name The name of the Base attribute to look for
|
||||
* @return array $matches Array that contains the matching list of Base attributes
|
||||
*/
|
||||
public function getGbaseAttribute($name)
|
||||
{
|
||||
$matches = array();
|
||||
for ($i = 0; $i < count($this->_baseAttributes); $i++) {
|
||||
$baseAttribute = $this->_baseAttributes[$i];
|
||||
if ($baseAttribute->rootElement == $name &&
|
||||
$baseAttribute->rootNamespaceURI == $this->lookupNamespace('g')) {
|
||||
$matches[] = &$this->_baseAttributes[$i];
|
||||
}
|
||||
}
|
||||
return $matches;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Element
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension/Element.php';
|
||||
|
||||
/**
|
||||
* Concrete class for working with ItemType elements.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase_Extension_BaseAttribute extends Zend_Gdata_App_Extension_Element
|
||||
{
|
||||
|
||||
/**
|
||||
* Namespace for Google Base elements
|
||||
*
|
||||
* var @string
|
||||
*/
|
||||
protected $_rootNamespace = 'g';
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param string $name (optional) The name of the Base attribute
|
||||
* @param string $text (optional) The text value of the Base attribute
|
||||
* @param string $text (optional) The type of the Base attribute
|
||||
*/
|
||||
public function __construct($name = null, $text = null, $type = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Gbase::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
if ($type !== null) {
|
||||
$attr = array('name' => 'type', 'value' => $type);
|
||||
$typeAttr = array('type' => $attr);
|
||||
$this->setExtensionAttributes($typeAttr);
|
||||
}
|
||||
parent::__construct($name,
|
||||
$this->_rootNamespace,
|
||||
$this->lookupNamespace($this->_rootNamespace),
|
||||
$text);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the name of the attribute
|
||||
*
|
||||
* @return attribute name The requested object.
|
||||
*/
|
||||
public function getName() {
|
||||
return $this->_rootElement;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the type of the attribute
|
||||
*
|
||||
* @return attribute type The requested object.
|
||||
*/
|
||||
public function getType() {
|
||||
$typeAttr = $this->getExtensionAttributes();
|
||||
return $typeAttr['type']['value'];
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'name' of the Base attribute object:
|
||||
* <g:[$name] type='[$type]'>[$value]</g:[$name]>
|
||||
*
|
||||
* @param Zend_Gdata_App_Extension_Element $attribute The attribute object
|
||||
* @param string $name The name of the Base attribute
|
||||
* @return Zend_Gdata_Extension_ItemEntry Provides a fluent interface
|
||||
*/
|
||||
public function setName($name) {
|
||||
$this->_rootElement = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the 'type' of the Base attribute object:
|
||||
* <g:[$name] type='[$type]'>[$value]</g:[$name]>
|
||||
*
|
||||
* @param Zend_Gdata_App_Extension_Element $attribute The attribute object
|
||||
* @param string $type The type of the Base attribute
|
||||
* @return Zend_Gdata_Extension_ItemEntry Provides a fluent interface
|
||||
*/
|
||||
public function setType($type) {
|
||||
$attr = array('name' => 'type', 'value' => $type);
|
||||
$typeAttr = array('type' => $attr);
|
||||
$this->setExtensionAttributes($typeAttr);
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
require_once 'Zend/Gdata/Feed.php';
|
||||
|
||||
/**
|
||||
* Base class for the Google Base Feed
|
||||
*
|
||||
* @link http://code.google.com/apis/base/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase_Feed extends Zend_Gdata_Feed
|
||||
{
|
||||
/**
|
||||
* The classname for the feed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_feedClassName = 'Zend_Gdata_Gbase_Feed';
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Gbase::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct($element);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Gbase_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/Gbase/Entry.php';
|
||||
|
||||
/**
|
||||
* Concrete class for working with Item entries.
|
||||
*
|
||||
* @link http://code.google.com/apis/base/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase_ItemEntry extends Zend_Gdata_Gbase_Entry
|
||||
{
|
||||
/**
|
||||
* The classname for individual item entry elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Gbase_ItemEntry';
|
||||
|
||||
/**
|
||||
* Set the value of the itme_type
|
||||
*
|
||||
* @param Zend_Gdata_Gbase_Extension_ItemType $value The desired value for the item_type
|
||||
* @return Zend_Gdata_Gbase_ItemEntry Provides a fluent interface
|
||||
*/
|
||||
public function setItemType($value)
|
||||
{
|
||||
$this->addGbaseAttribute('item_type', $value, 'text');
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a custom attribute to the entry in the following format:
|
||||
* <g:[$name] type='[$type]'>[$value]</g:[$name]>
|
||||
*
|
||||
* @param string $name The name of the attribute
|
||||
* @param string $value The text value of the attribute
|
||||
* @param string $type (optional) The type of the attribute.
|
||||
* e.g.: 'text', 'number', 'floatUnit'
|
||||
* @return Zend_Gdata_Gbase_ItemEntry Provides a fluent interface
|
||||
*/
|
||||
public function addGbaseAttribute($name, $text, $type = null) {
|
||||
$newBaseAttribute = new Zend_Gdata_Gbase_Extension_BaseAttribute($name, $text, $type);
|
||||
$this->_baseAttributes[] = $newBaseAttribute;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Removes a Base attribute from the current list of Base attributes
|
||||
*
|
||||
* @param Zend_Gdata_Gbase_Extension_BaseAttribute $baseAttribute The attribute to be removed
|
||||
* @return Zend_Gdata_Gbase_ItemEntry Provides a fluent interface
|
||||
*/
|
||||
public function removeGbaseAttribute($baseAttribute) {
|
||||
$baseAttributes = $this->_baseAttributes;
|
||||
for ($i = 0; $i < count($this->_baseAttributes); $i++) {
|
||||
if ($this->_baseAttributes[$i] == $baseAttribute) {
|
||||
array_splice($baseAttributes, $i, 1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
$this->_baseAttributes = $baseAttributes;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Uploads changes in this entry to the server using Zend_Gdata_App
|
||||
*
|
||||
* @param boolean $dryRun Whether the transaction is dry run or not
|
||||
* @return Zend_Gdata_App_Entry The updated entry
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
*/
|
||||
public function save($dryRun = false)
|
||||
{
|
||||
$uri = null;
|
||||
|
||||
if ($dryRun == true) {
|
||||
$editLink = $this->getEditLink();
|
||||
if ($editLink !== null) {
|
||||
$uri = $editLink->getHref() . '?dry-run=true';
|
||||
}
|
||||
if ($uri === null) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException('You must specify an URI which needs deleted.');
|
||||
}
|
||||
$service = new Zend_Gdata_App($this->getHttpClient());
|
||||
return $service->updateEntry($this, $uri);
|
||||
} else {
|
||||
parent::save();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Deletes this entry to the server using the referenced
|
||||
* Zend_Http_Client to do a HTTP DELETE to the edit link stored in this
|
||||
* entry's link collection.
|
||||
*
|
||||
* @param boolean $dyrRun Whether the transaction is dry run or not
|
||||
* @return void
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
*/
|
||||
public function delete($dryRun = false)
|
||||
{
|
||||
$uri = null;
|
||||
|
||||
if ($dryRun == true) {
|
||||
$editLink = $this->getEditLink();
|
||||
if ($editLink !== null) {
|
||||
$uri = $editLink->getHref() . '?dry-run=true';
|
||||
}
|
||||
if ($uri === null) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException('You must specify an URI which needs deleted.');
|
||||
}
|
||||
parent::delete($uri);
|
||||
} else {
|
||||
parent::delete();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Gbase_Feed
|
||||
*/
|
||||
require_once 'Zend/Gdata/Gbase/Feed.php';
|
||||
|
||||
/**
|
||||
* Represents the Google Base Customer Items Feed
|
||||
*
|
||||
* @link http://code.google.com/apis/base/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase_ItemFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
/**
|
||||
* The classname for individual item feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Gbase_ItemEntry';
|
||||
}
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Query
|
||||
*/
|
||||
require_once('Zend/Gdata/Query.php');
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Gbase_Query
|
||||
*/
|
||||
require_once('Zend/Gdata/Gbase/Query.php');
|
||||
|
||||
|
||||
/**
|
||||
* Assists in constructing queries for Google Base Customer Items Feed
|
||||
*
|
||||
* @link http://code.google.com/apis/base/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase_ItemQuery extends Zend_Gdata_Gbase_Query
|
||||
{
|
||||
/**
|
||||
* Path to the customer items feeds on the Google Base server.
|
||||
*/
|
||||
const GBASE_ITEM_FEED_URI = 'http://www.google.com/base/feeds/items';
|
||||
|
||||
/**
|
||||
* The default URI for POST methods
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultFeedUri = self::GBASE_ITEM_FEED_URI;
|
||||
|
||||
/**
|
||||
* The id of an item
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_id = null;
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
|
||||
*/
|
||||
public function setId($value)
|
||||
{
|
||||
$this->_id = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/*
|
||||
* @return string id
|
||||
*/
|
||||
public function getId()
|
||||
{
|
||||
return $this->_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the query URL generated by this query instance.
|
||||
*
|
||||
* @return string The query URL for this instance.
|
||||
*/
|
||||
public function getQueryUrl()
|
||||
{
|
||||
$uri = $this->_defaultFeedUri;
|
||||
if ($this->getId() !== null) {
|
||||
$uri .= '/' . $this->getId();
|
||||
} else {
|
||||
$uri .= $this->getQueryString();
|
||||
}
|
||||
return $uri;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,265 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Query
|
||||
*/
|
||||
require_once('Zend/Gdata/Query.php');
|
||||
|
||||
/**
|
||||
* Assists in constructing queries for Google Base
|
||||
*
|
||||
* @link http://code.google.com/apis/base
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase_Query extends Zend_Gdata_Query
|
||||
{
|
||||
|
||||
/**
|
||||
* Path to the customer items feeds on the Google Base server.
|
||||
*/
|
||||
const GBASE_ITEM_FEED_URI = 'http://www.google.com/base/feeds/items';
|
||||
|
||||
/**
|
||||
* Path to the snippets feeds on the Google Base server.
|
||||
*/
|
||||
const GBASE_SNIPPET_FEED_URI = 'http://www.google.com/base/feeds/snippets';
|
||||
|
||||
/**
|
||||
* The default URI for POST methods
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultFeedUri = self::GBASE_ITEM_FEED_URI;
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Gbase_Query Provides a fluent interface
|
||||
*/
|
||||
public function setKey($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_params['key'] = $value;
|
||||
} else {
|
||||
unset($this->_params['key']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
|
||||
*/
|
||||
public function setBq($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_params['bq'] = $value;
|
||||
} else {
|
||||
unset($this->_params['bq']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
|
||||
*/
|
||||
public function setRefine($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_params['refine'] = $value;
|
||||
} else {
|
||||
unset($this->_params['refine']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
|
||||
*/
|
||||
public function setContent($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_params['content'] = $value;
|
||||
} else {
|
||||
unset($this->_params['content']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
|
||||
*/
|
||||
public function setOrderBy($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_params['orderby'] = $value;
|
||||
} else {
|
||||
unset($this->_params['orderby']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
|
||||
*/
|
||||
public function setSortOrder($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_params['sortorder'] = $value;
|
||||
} else {
|
||||
unset($this->_params['sortorder']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
|
||||
*/
|
||||
public function setCrowdBy($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_params['crowdby'] = $value;
|
||||
} else {
|
||||
unset($this->_params['crowdby']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Gbase_ItemQuery Provides a fluent interface
|
||||
*/
|
||||
public function setAdjust($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_params['adjust'] = $value;
|
||||
} else {
|
||||
unset($this->_params['adjust']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string key
|
||||
*/
|
||||
public function getKey()
|
||||
{
|
||||
if (array_key_exists('key', $this->_params)) {
|
||||
return $this->_params['key'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string bq
|
||||
*/
|
||||
public function getBq()
|
||||
{
|
||||
if (array_key_exists('bq', $this->_params)) {
|
||||
return $this->_params['bq'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string refine
|
||||
*/
|
||||
public function getRefine()
|
||||
{
|
||||
if (array_key_exists('refine', $this->_params)) {
|
||||
return $this->_params['refine'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string content
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
if (array_key_exists('content', $this->_params)) {
|
||||
return $this->_params['content'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string orderby
|
||||
*/
|
||||
public function getOrderBy()
|
||||
{
|
||||
if (array_key_exists('orderby', $this->_params)) {
|
||||
return $this->_params['orderby'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string sortorder
|
||||
*/
|
||||
public function getSortOrder()
|
||||
{
|
||||
if (array_key_exists('sortorder', $this->_params)) {
|
||||
return $this->_params['sortorder'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string crowdby
|
||||
*/
|
||||
public function getCrowdBy()
|
||||
{
|
||||
if (array_key_exists('crowdby', $this->_params)) {
|
||||
return $this->_params['crowdby'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string adjust
|
||||
*/
|
||||
public function getAdjust()
|
||||
{
|
||||
if (array_key_exists('adjust', $this->_params)) {
|
||||
return $this->_params['adjust'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Gbase_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/Gbase/Entry.php';
|
||||
|
||||
/**
|
||||
* Concrete class for working with Snippet entries.
|
||||
*
|
||||
* @link http://code.google.com/apis/base/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase_SnippetEntry extends Zend_Gdata_Gbase_Entry
|
||||
{
|
||||
/**
|
||||
* The classname for individual snippet entry elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Gbase_SnippetEntry';
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Gbase_Feed
|
||||
*/
|
||||
require_once 'Zend/Gdata/Gbase/Feed.php';
|
||||
|
||||
/**
|
||||
* Represents the Google Base Snippets Feed
|
||||
*
|
||||
* @link http://code.google.com/apis/base/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase_SnippetFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
/**
|
||||
* The classname for individual snippet feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Gbase_SnippetEntry';
|
||||
}
|
||||
@@ -0,0 +1,71 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_Query
|
||||
*/
|
||||
require_once('Zend/Gdata/Query.php');
|
||||
|
||||
/**
|
||||
* Zend_Gdata_Gbase_Query
|
||||
*/
|
||||
require_once('Zend/Gdata/Gbase/Query.php');
|
||||
|
||||
/**
|
||||
* Assists in constructing queries for Google Base Snippets Feed
|
||||
*
|
||||
* @link http://code.google.com/apis/base/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Gbase_SnippetQuery extends Zend_Gdata_Gbase_Query
|
||||
{
|
||||
/**
|
||||
* Path to the snippets feeds on the Google Base server.
|
||||
*/
|
||||
const BASE_SNIPPET_FEED_URI = 'http://www.google.com/base/feeds/snippets';
|
||||
|
||||
/**
|
||||
* The default URI for POST methods
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultFeedUri = self::BASE_SNIPPET_FEED_URI;
|
||||
|
||||
/**
|
||||
* Returns the query URL generated by this query instance.
|
||||
*
|
||||
* @return string The query URL for this instance.
|
||||
*/
|
||||
public function getQueryUrl()
|
||||
{
|
||||
$uri = $this->_defaultFeedUri;
|
||||
if ($this->getCategory() !== null) {
|
||||
$uri .= '/-/' . $this->getCategory();
|
||||
}
|
||||
$uri .= $this->getQueryString();
|
||||
return $uri;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,245 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Zend_Exception
|
||||
*/
|
||||
require_once 'Zend/Exception.php';
|
||||
|
||||
/**
|
||||
* Zend_Http_Client
|
||||
*/
|
||||
require_once 'Zend/Http/Client.php';
|
||||
|
||||
/**
|
||||
* Gdata Http Client object.
|
||||
*
|
||||
* Class to extend the generic Zend Http Client with the ability to perform
|
||||
* secure AuthSub requests
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_HttpClient extends Zend_Http_Client
|
||||
{
|
||||
|
||||
/**
|
||||
* OpenSSL private key resource id
|
||||
* This key is used for AuthSub authentication. If this value is set,
|
||||
* it is assuemd that secure AuthSub is desired.
|
||||
*
|
||||
* @var resource
|
||||
*/
|
||||
private $_authSubPrivateKeyId = null;
|
||||
|
||||
/**
|
||||
* Token for AuthSub authentication.
|
||||
* If this token is set, AuthSub authentication is used.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_authSubToken = null;
|
||||
|
||||
/**
|
||||
* Token for ClientLogin authentication.
|
||||
* If only this token is set, ClientLogin authentication is used.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_clientLoginToken = null;
|
||||
|
||||
/**
|
||||
* Token for ClientLogin authentication.
|
||||
* If this token is set, and the AuthSub key is not set,
|
||||
* ClientLogin authentication is used
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
private $_clientLoginKey = null;
|
||||
|
||||
/**
|
||||
* Sets the PEM formatted private key, as read from a file.
|
||||
*
|
||||
* This method reads the file and then calls setAuthSubPrivateKey()
|
||||
* with the file contents.
|
||||
*
|
||||
* @param string $file The location of the file containing the PEM key
|
||||
* @param string $passphrase The optional private key passphrase
|
||||
* @param bool $useIncludePath Whether to search the include_path
|
||||
* for the file
|
||||
* @return void
|
||||
*/
|
||||
public function setAuthSubPrivateKeyFile($file, $passphrase = null,
|
||||
$useIncludePath = false) {
|
||||
$fp = fopen($file, "r", $useIncludePath);
|
||||
$key = '';
|
||||
while (!feof($fp)) {
|
||||
$key .= fread($fp, 8192);
|
||||
}
|
||||
$this->setAuthSubPrivateKey($key, $passphrase);
|
||||
fclose($fp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the PEM formatted private key to be used for secure AuthSub auth.
|
||||
*
|
||||
* In order to call this method, openssl must be enabled in your PHP
|
||||
* installation. Otherwise, a Zend_Gdata_App_InvalidArgumentException
|
||||
* will be thrown.
|
||||
*
|
||||
* @param string $key The private key
|
||||
* @param string $passphrase The optional private key passphrase
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
* @return Zend_Gdata_HttpClient Provides a fluent interface
|
||||
*/
|
||||
public function setAuthSubPrivateKey($key, $passphrase = null) {
|
||||
if ($key != null && !function_exists('openssl_pkey_get_private')) {
|
||||
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You cannot enable secure AuthSub if the openssl module ' .
|
||||
'is not enabled in your PHP installation.');
|
||||
}
|
||||
$this->_authSubPrivateKeyId = openssl_pkey_get_private(
|
||||
$key, $passphrase);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the openssl private key id
|
||||
*
|
||||
* @return string The private key
|
||||
*/
|
||||
public function getAuthSubPrivateKeyId() {
|
||||
return $this->_authSubPrivateKeyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the AuthSub token used for authentication
|
||||
*
|
||||
* @return string The token
|
||||
*/
|
||||
public function getAuthSubToken() {
|
||||
return $this->_authSubToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the AuthSub token used for authentication
|
||||
*
|
||||
* @param string $token The token
|
||||
* @return Zend_Gdata_HttpClient Provides a fluent interface
|
||||
*/
|
||||
public function setAuthSubToken($token) {
|
||||
$this->_authSubToken = $token;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the ClientLogin token used for authentication
|
||||
*
|
||||
* @return string The token
|
||||
*/
|
||||
public function getClientLoginToken() {
|
||||
return $this->_clientLoginToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the ClientLogin token used for authentication
|
||||
*
|
||||
* @param string $token The token
|
||||
* @return Zend_Gdata_HttpClient Provides a fluent interface
|
||||
*/
|
||||
public function setClientLoginToken($token) {
|
||||
$this->_clientLoginToken = $token;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Filters the HTTP requests being sent to add the Authorization header.
|
||||
*
|
||||
* If both AuthSub and ClientLogin tokens are set,
|
||||
* AuthSub takes precedence. If an AuthSub key is set, then
|
||||
* secure AuthSub authentication is used, and the request is signed.
|
||||
* Requests must be signed only with the private key corresponding to the
|
||||
* public key registered with Google. If an AuthSub key is set, but
|
||||
* openssl support is not enabled in the PHP installation, an exception is
|
||||
* thrown.
|
||||
*
|
||||
* @param string $method The HTTP method
|
||||
* @param string $url The URL
|
||||
* @param array $headers An associate array of headers to be
|
||||
* sent with the request or null
|
||||
* @param string $body The body of the request or null
|
||||
* @param string $contentType The MIME content type of the body or null
|
||||
* @throws Zend_Gdata_App_Exception if there was a signing failure
|
||||
* @return array The processed values in an associative array,
|
||||
* using the same names as the params
|
||||
*/
|
||||
public function filterHttpRequest($method, $url, $headers = array(), $body = null, $contentType = null) {
|
||||
if ($this->getAuthSubToken() != null) {
|
||||
// AuthSub authentication
|
||||
if ($this->getAuthSubPrivateKeyId() != null) {
|
||||
// secure AuthSub
|
||||
$time = time();
|
||||
$nonce = mt_rand(0, 999999999);
|
||||
$dataToSign = $method . ' ' . $url . ' ' . $time . ' ' . $nonce;
|
||||
|
||||
// compute signature
|
||||
$pKeyId = $this->getAuthSubPrivateKeyId();
|
||||
$signSuccess = openssl_sign($dataToSign, $signature, $pKeyId,
|
||||
OPENSSL_ALGO_SHA1);
|
||||
if (!$signSuccess) {
|
||||
require_once 'Zend/Gdata/App/Exception.php';
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'openssl_signing failure - returned false');
|
||||
}
|
||||
// encode signature
|
||||
$encodedSignature = base64_encode($signature);
|
||||
|
||||
// final header
|
||||
$headers['authorization'] = 'AuthSub token="' . $this->getAuthSubToken() . '" ' .
|
||||
'data="' . $dataToSign . '" ' .
|
||||
'sig="' . $encodedSignature . '" ' .
|
||||
'sigalg="rsa-sha1"';
|
||||
} else {
|
||||
// AuthSub without secure tokens
|
||||
$headers['authorization'] = 'AuthSub token="' . $this->getAuthSubToken() . '"';
|
||||
}
|
||||
} elseif ($this->getClientLoginToken() != null) {
|
||||
$headers['authorization'] = 'GoogleLogin auth=' . $this->getClientLoginToken();
|
||||
}
|
||||
return array('method' => $method, 'url' => $url, 'body' => $body, 'headers' => $headers, 'contentType' => $contentType);
|
||||
}
|
||||
|
||||
/**
|
||||
* Method for filtering the HTTP response, though no filtering is
|
||||
* currently done.
|
||||
*
|
||||
* @param Zend_Http_Response $response The response object to filter
|
||||
* @return Zend_Http_Response The filterd response object
|
||||
*/
|
||||
public function filterHttpResponse($response) {
|
||||
return $response;
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+56
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata
|
||||
*/
|
||||
require_once 'Zend/Gdata.php';
|
||||
|
||||
/**
|
||||
* Service class for interacting with the services which use the media extensions
|
||||
* @link http://code.google.com/apis/gdata/calendar.html
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media extends Zend_Gdata
|
||||
{
|
||||
|
||||
public static $namespaces = array(
|
||||
'media' => 'http://search.yahoo.com/mrss/');
|
||||
|
||||
/**
|
||||
* Create Gdata_Media object
|
||||
*
|
||||
* @param Zend_Http_Client $client (optional) The HTTP client to use when
|
||||
* when communicating with the Google Apps servers.
|
||||
* @param string $applicationId The identity of the app in the form of Company-AppName-Version
|
||||
*/
|
||||
public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
$this->registerPackage('Zend_Gdata_Media');
|
||||
$this->registerPackage('Zend_Gdata_Media_Extension');
|
||||
parent::__construct($client, $applicationId);
|
||||
}
|
||||
|
||||
}
|
||||
Executable
+133
@@ -0,0 +1,133 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/Entry.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaGroup.php';
|
||||
|
||||
/**
|
||||
* Represents the GData flavor of an Atom entry
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Entry extends Zend_Gdata_Entry
|
||||
{
|
||||
|
||||
protected $_entryClassName = 'Zend_Gdata_Media_Entry';
|
||||
|
||||
/**
|
||||
* media:group element
|
||||
*
|
||||
* @var Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
protected $_mediaGroup = null;
|
||||
|
||||
/**
|
||||
* Create a new instance.
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_mediaGroup != null) {
|
||||
$element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual Entry objects of the appropriate type and
|
||||
* stores them as members of this entry based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('media') . ':' . 'group':
|
||||
$mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup();
|
||||
$mediaGroup->transferFromDOM($child);
|
||||
$this->_mediaGroup = $mediaGroup;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the entry's mediaGroup object.
|
||||
*
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function getMediaGroup()
|
||||
{
|
||||
return $this->_mediaGroup;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the entry's mediaGroup object.
|
||||
*
|
||||
* @param Zend_Gdata_Media_Extension_MediaGroup $mediaGroup
|
||||
* @return Zend_Gdata_Media_Entry Provides a fluent interface
|
||||
*/
|
||||
public function setMediaGroup($mediaGroup)
|
||||
{
|
||||
$this->_mediaGroup = $mediaGroup;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
+147
@@ -0,0 +1,147 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the media:category element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaCategory extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'category';
|
||||
protected $_rootNamespace = 'media';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_scheme = null;
|
||||
protected $_label = null;
|
||||
|
||||
/**
|
||||
* Creates an individual MediaCategory object.
|
||||
*
|
||||
* @param string $text Indication of the type and content of the media
|
||||
* @param string $scheme URI that identifies the categorization scheme
|
||||
* @param string $label Human-readable label to be displayed in applications
|
||||
*/
|
||||
public function __construct($text = null, $scheme = null, $label = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
$this->_scheme = $scheme;
|
||||
$this->_label = $label;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_scheme != null) {
|
||||
$element->setAttribute('scheme', $this->_scheme);
|
||||
}
|
||||
if ($this->_label != null) {
|
||||
$element->setAttribute('label', $this->_label);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'scheme':
|
||||
$this->_scheme = $attribute->nodeValue;
|
||||
break;
|
||||
case 'label':
|
||||
$this->_label = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URI that identifies the categorization scheme
|
||||
* Optional.
|
||||
*
|
||||
* @return string URI that identifies the categorization scheme
|
||||
*/
|
||||
public function getScheme()
|
||||
{
|
||||
return $this->_scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value URI that identifies the categorization scheme
|
||||
* @return Zend_Gdata_Media_Extension_MediaCategory Provides a fluent interface
|
||||
*/
|
||||
public function setScheme($value)
|
||||
{
|
||||
$this->_scheme = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string Human-readable label to be displayed in applications
|
||||
*/
|
||||
public function getLabel()
|
||||
{
|
||||
return $this->_label;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value Human-readable label to be displayed in applications
|
||||
* @return Zend_Gdata_Media_Extension_MediaCategory Provides a fluent interface
|
||||
*/
|
||||
public function setLabel($value)
|
||||
{
|
||||
$this->_label = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
+521
@@ -0,0 +1,521 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the media:content element of Media RSS.
|
||||
* Represents media objects. Multiple media objects representing
|
||||
* the same content can be represented using a
|
||||
* media:group (Zend_Gdata_Media_Extension_MediaGroup) element.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaContent extends Zend_Gdata_Extension
|
||||
{
|
||||
protected $_rootElement = 'content';
|
||||
protected $_rootNamespace = 'media';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_url = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_fileSize = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_type = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_medium = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_isDefault = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_expression = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_bitrate = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_framerate = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_samplingrate = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_channels = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_duration = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_height = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_width = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_lang = null;
|
||||
|
||||
/**
|
||||
* Creates an individual MediaContent object.
|
||||
*/
|
||||
public function __construct($url = null, $fileSize = null, $type = null,
|
||||
$medium = null, $isDefault = null, $expression = null,
|
||||
$bitrate = null, $framerate = null, $samplingrate = null,
|
||||
$channels = null, $duration = null, $height = null, $width = null,
|
||||
$lang = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
$this->_url = $url;
|
||||
$this->_fileSize = $fileSize;
|
||||
$this->_type = $type;
|
||||
$this->_medium = $medium;
|
||||
$this->_isDefault = $isDefault;
|
||||
$this->_expression = $expression;
|
||||
$this->_bitrate = $bitrate;
|
||||
$this->_framerate = $framerate;
|
||||
$this->_samplingrate = $samplingrate;
|
||||
$this->_channels = $channels;
|
||||
$this->_duration = $duration;
|
||||
$this->_height = $height;
|
||||
$this->_width = $width;
|
||||
$this->_lang = $lang;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_url != null) {
|
||||
$element->setAttribute('url', $this->_url);
|
||||
}
|
||||
if ($this->_fileSize != null) {
|
||||
$element->setAttribute('fileSize', $this->_fileSize);
|
||||
}
|
||||
if ($this->_type != null) {
|
||||
$element->setAttribute('type', $this->_type);
|
||||
}
|
||||
if ($this->_medium != null) {
|
||||
$element->setAttribute('medium', $this->_medium);
|
||||
}
|
||||
if ($this->_isDefault != null) {
|
||||
$element->setAttribute('isDefault', $this->_isDefault);
|
||||
}
|
||||
if ($this->_expression != null) {
|
||||
$element->setAttribute('expression', $this->_expression);
|
||||
}
|
||||
if ($this->_bitrate != null) {
|
||||
$element->setAttribute('bitrate', $this->_bitrate);
|
||||
}
|
||||
if ($this->_framerate != null) {
|
||||
$element->setAttribute('framerate', $this->_framerate);
|
||||
}
|
||||
if ($this->_samplingrate != null) {
|
||||
$element->setAttribute('samplingrate', $this->_samplingrate);
|
||||
}
|
||||
if ($this->_channels != null) {
|
||||
$element->setAttribute('channels', $this->_channels);
|
||||
}
|
||||
if ($this->_duration != null) {
|
||||
$element->setAttribute('duration', $this->_duration);
|
||||
}
|
||||
if ($this->_height != null) {
|
||||
$element->setAttribute('height', $this->_height);
|
||||
}
|
||||
if ($this->_width != null) {
|
||||
$element->setAttribute('width', $this->_width);
|
||||
}
|
||||
if ($this->_lang != null) {
|
||||
$element->setAttribute('lang', $this->_lang);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'url':
|
||||
$this->_url = $attribute->nodeValue;
|
||||
break;
|
||||
case 'fileSize':
|
||||
$this->_fileSize = $attribute->nodeValue;
|
||||
break;
|
||||
case 'type':
|
||||
$this->_type = $attribute->nodeValue;
|
||||
break;
|
||||
case 'medium':
|
||||
$this->_medium = $attribute->nodeValue;
|
||||
break;
|
||||
case 'isDefault':
|
||||
$this->_isDefault = $attribute->nodeValue;
|
||||
break;
|
||||
case 'expression':
|
||||
$this->_expression = $attribute->nodeValue;
|
||||
break;
|
||||
case 'bitrate':
|
||||
$this->_bitrate = $attribute->nodeValue;
|
||||
break;
|
||||
case 'framerate':
|
||||
$this->_framerate = $attribute->nodeValue;
|
||||
break;
|
||||
case 'samplingrate':
|
||||
$this->_samplingrate = $attribute->nodeValue;
|
||||
break;
|
||||
case 'channels':
|
||||
$this->_channels = $attribute->nodeValue;
|
||||
break;
|
||||
case 'duration':
|
||||
$this->_duration = $attribute->nodeValue;
|
||||
break;
|
||||
case 'height':
|
||||
$this->_height = $attribute->nodeValue;
|
||||
break;
|
||||
case 'width':
|
||||
$this->_width = $attribute->nodeValue;
|
||||
break;
|
||||
case 'lang':
|
||||
$this->_lang = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the URL representing this MediaContent object
|
||||
*
|
||||
* @return string The URL representing this MediaContent object.
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getUrl();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The direct URL to the media object
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value The direct URL to the media object
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setUrl($value)
|
||||
{
|
||||
$this->_url = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int The size of the media in bytes
|
||||
*/
|
||||
public function getFileSize()
|
||||
{
|
||||
return $this->_fileSize;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setFileSize($value)
|
||||
{
|
||||
$this->_fileSize = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setType($value)
|
||||
{
|
||||
$this->_type = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getMedium()
|
||||
{
|
||||
return $this->_medium;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setMedium($value)
|
||||
{
|
||||
$this->_medium = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getIsDefault()
|
||||
{
|
||||
return $this->_isDefault;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param bool $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setIsDefault($value)
|
||||
{
|
||||
$this->_isDefault = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExpression()
|
||||
{
|
||||
return $this->_expression;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setExpression($value)
|
||||
{
|
||||
$this->_expression = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getBitrate()
|
||||
{
|
||||
return $this->_bitrate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setBitrate($value)
|
||||
{
|
||||
$this->_bitrate = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getFramerate()
|
||||
{
|
||||
return $this->_framerate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setFramerate($value)
|
||||
{
|
||||
$this->_framerate = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getSamplingrate()
|
||||
{
|
||||
return $this->_samplingrate;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setSamplingrate($value)
|
||||
{
|
||||
$this->_samplingrate = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getChannels()
|
||||
{
|
||||
return $this->_channels;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setChannels($value)
|
||||
{
|
||||
$this->_channels = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getDuration()
|
||||
{
|
||||
return $this->_duration;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param int
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setDuration($value)
|
||||
{
|
||||
$this->_duration = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setHeight($value)
|
||||
{
|
||||
$this->_height = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setWidth($value)
|
||||
{
|
||||
$this->_width = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getLang()
|
||||
{
|
||||
return $this->_lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string
|
||||
* @return Zend_Gdata_Media_Extension_MediaContent Provides a fluent interface
|
||||
*/
|
||||
public function setLang($value)
|
||||
{
|
||||
$this->_lang = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the media:copyright element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaCopyright extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'copyright';
|
||||
protected $_rootNamespace = 'media';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_url = null;
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
* @param string $url
|
||||
*/
|
||||
public function __construct($text = null, $url = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
$this->_url = $url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_url != null) {
|
||||
$element->setAttribute('url', $this->_url);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'url':
|
||||
$this->_url = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaCopyright Provides a fluent interface
|
||||
*/
|
||||
public function setUrl($value)
|
||||
{
|
||||
$this->_url = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the media:credit element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaCredit extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'credit';
|
||||
protected $_rootNamespace = 'media';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_role = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_scheme = null;
|
||||
|
||||
/**
|
||||
* Creates an individual MediaCredit object.
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $role
|
||||
* @param string $scheme
|
||||
*/
|
||||
public function __construct($text = null, $role = null, $scheme = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
$this->_role = $role;
|
||||
$this->_scheme = $scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_role != null) {
|
||||
$element->setAttribute('role', $this->_role);
|
||||
}
|
||||
if ($this->_scheme != null) {
|
||||
$element->setAttribute('scheme', $this->_scheme);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'role':
|
||||
$this->_role = $attribute->nodeValue;
|
||||
break;
|
||||
case 'scheme':
|
||||
$this->_scheme = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRole()
|
||||
{
|
||||
return $this->_role;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent interface
|
||||
*/
|
||||
public function setRole($value)
|
||||
{
|
||||
$this->_role = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getScheme()
|
||||
{
|
||||
return $this->_scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent interface
|
||||
*/
|
||||
public function setScheme($value)
|
||||
{
|
||||
$this->_scheme = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
+115
@@ -0,0 +1,115 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the media:description element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaDescription extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'description';
|
||||
protected $_rootNamespace = 'media';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_type = null;
|
||||
|
||||
/**
|
||||
* @param string $text
|
||||
* @param string $type
|
||||
*/
|
||||
public function __construct($text = null, $type = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
$this->_type = $type;
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_type != null) {
|
||||
$element->setAttribute('type', $this->_type);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'type':
|
||||
$this->_type = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaDescription Provides a fluent interface
|
||||
*/
|
||||
public function setType($value)
|
||||
{
|
||||
$this->_type = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
+565
@@ -0,0 +1,565 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/Extension.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
require_once 'Zend/Gdata/Entry.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaContent
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaContent.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaCategory
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaCategory.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaCopyright
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaCopyright.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaCredit
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaCredit.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaDescription
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaDescription.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaHash
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaHash.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaKeywords
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaKeywords.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaPlayer
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaPlayer.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaRating
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaRating.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaRestriction
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaRestriction.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaText
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaText.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaThumbnail
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaThumbnail.php';
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Media_Extension_MediaTitle
|
||||
*/
|
||||
require_once 'Zend/Gdata/Media/Extension/MediaTitle.php';
|
||||
|
||||
|
||||
/**
|
||||
* This class represents the media:group element of Media RSS.
|
||||
* It allows the grouping of media:content elements that are
|
||||
* different representations of the same content. When it exists,
|
||||
* it is a child of an Entry (Atom) or Item (RSS).
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaGroup extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'group';
|
||||
protected $_rootNamespace = 'media';
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_content = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_category = array();
|
||||
|
||||
/**
|
||||
* @var Zend_Gdata_Media_Extension_MediaCopyright
|
||||
*/
|
||||
protected $_copyright = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_credit = array();
|
||||
|
||||
/**
|
||||
* @var Zend_Gdata_Media_Extension_MediaDescription
|
||||
*/
|
||||
protected $_description = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_hash = array();
|
||||
|
||||
/**
|
||||
* @var Zend_Gdata_Media_Extension_MediaKeywords
|
||||
*/
|
||||
protected $_keywords = null;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_player = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_rating = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_restriction = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_mediaText = array();
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_thumbnail = array();
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_title = null;
|
||||
|
||||
/**
|
||||
* Creates an individual MediaGroup object.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
foreach ($this->_content as $content) {
|
||||
$element->appendChild($content->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_category as $category) {
|
||||
$element->appendChild($category->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_credit as $credit) {
|
||||
$element->appendChild($credit->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_player as $player) {
|
||||
$element->appendChild($player->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_rating as $rating) {
|
||||
$element->appendChild($rating->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_restriction as $restriction) {
|
||||
$element->appendChild($restriction->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_mediaText as $text) {
|
||||
$element->appendChild($text->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_thumbnail as $thumbnail) {
|
||||
$element->appendChild($thumbnail->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_copyright != null) {
|
||||
$element->appendChild(
|
||||
$this->_copyright->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_description != null) {
|
||||
$element->appendChild(
|
||||
$this->_description->getDOM($element->ownerDocument));
|
||||
}
|
||||
foreach ($this->_hash as $hash) {
|
||||
$element->appendChild($hash->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_keywords != null) {
|
||||
$element->appendChild(
|
||||
$this->_keywords->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_title != null) {
|
||||
$element->appendChild(
|
||||
$this->_title->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual Entry objects of the appropriate type and
|
||||
* stores them in the $_entry array based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('media') . ':' . 'content';
|
||||
$content = new Zend_Gdata_Media_Extension_MediaContent();
|
||||
$content->transferFromDOM($child);
|
||||
$this->_content[] = $content;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'category';
|
||||
$category = new Zend_Gdata_Media_Extension_MediaCategory();
|
||||
$category->transferFromDOM($child);
|
||||
$this->_category[] = $category;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'copyright';
|
||||
$copyright = new Zend_Gdata_Media_Extension_MediaCopyright();
|
||||
$copyright->transferFromDOM($child);
|
||||
$this->_copyright = $copyright;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'credit';
|
||||
$credit = new Zend_Gdata_Media_Extension_MediaCredit();
|
||||
$credit->transferFromDOM($child);
|
||||
$this->_credit[] = $credit;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'description';
|
||||
$description = new Zend_Gdata_Media_Extension_MediaDescription();
|
||||
$description->transferFromDOM($child);
|
||||
$this->_description = $description;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'hash';
|
||||
$hash = new Zend_Gdata_Media_Extension_MediaHash();
|
||||
$hash->transferFromDOM($child);
|
||||
$this->_hash[] = $hash;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'keywords';
|
||||
$keywords = new Zend_Gdata_Media_Extension_MediaKeywords();
|
||||
$keywords->transferFromDOM($child);
|
||||
$this->_keywords = $keywords;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'player';
|
||||
$player = new Zend_Gdata_Media_Extension_MediaPlayer();
|
||||
$player->transferFromDOM($child);
|
||||
$this->_player[] = $player;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'rating';
|
||||
$rating = new Zend_Gdata_Media_Extension_MediaRating();
|
||||
$rating->transferFromDOM($child);
|
||||
$this->_rating[] = $rating;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'restriction';
|
||||
$restriction = new Zend_Gdata_Media_Extension_MediaRestriction();
|
||||
$restriction->transferFromDOM($child);
|
||||
$this->_restriction[] = $restriction;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'text';
|
||||
$text = new Zend_Gdata_Media_Extension_MediaText();
|
||||
$text->transferFromDOM($child);
|
||||
$this->_mediaText[] = $text;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'thumbnail';
|
||||
$thumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail();
|
||||
$thumbnail->transferFromDOM($child);
|
||||
$this->_thumbnail[] = $thumbnail;
|
||||
break;
|
||||
case $this->lookupNamespace('media') . ':' . 'title';
|
||||
$title = new Zend_Gdata_Media_Extension_MediaTitle();
|
||||
$title->transferFromDOM($child);
|
||||
$this->_title = $title;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getContent()
|
||||
{
|
||||
return $this->_content;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
* @return Zend_Gdata_Media_MediaGroup Provides a fluent interface
|
||||
*/
|
||||
public function setContent($value)
|
||||
{
|
||||
$this->_content = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getCategory()
|
||||
{
|
||||
return $this->_category;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setCategory($value)
|
||||
{
|
||||
$this->_category = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_Media_Extension_MediaCopyright
|
||||
*/
|
||||
public function getCopyright()
|
||||
{
|
||||
return $this->_copyright;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Media_Extension_MediaCopyright $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setCopyright($value)
|
||||
{
|
||||
$this->_copyright = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getCredit()
|
||||
{
|
||||
return $this->_credit;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setCredit($value)
|
||||
{
|
||||
$this->_credit = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_Media_Extension_MediaTitle
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
return $this->_title;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Media_Extension_MediaTitle $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
$this->_title = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_Media_Extension_MediaDescription
|
||||
*/
|
||||
public function getDescription()
|
||||
{
|
||||
return $this->_description;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Media_Extension_MediaDescription $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setDescription($value)
|
||||
{
|
||||
$this->_description = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getHash()
|
||||
{
|
||||
return $this->_hash;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setHash($value)
|
||||
{
|
||||
$this->_hash = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_Media_Extension_MediaKeywords
|
||||
*/
|
||||
public function getKeywords()
|
||||
{
|
||||
return $this->_keywords;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup Provides a fluent interface
|
||||
*/
|
||||
public function setKeywords($value)
|
||||
{
|
||||
$this->_keywords = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getPlayer()
|
||||
{
|
||||
return $this->_player;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setPlayer($value)
|
||||
{
|
||||
$this->_player = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getRating()
|
||||
{
|
||||
return $this->_rating;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setRating($value)
|
||||
{
|
||||
$this->_rating = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getRestriction()
|
||||
{
|
||||
return $this->_restriction;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setRestriction($value)
|
||||
{
|
||||
$this->_restriction = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getThumbnail()
|
||||
{
|
||||
return $this->_thumbnail;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setThumbnail($value)
|
||||
{
|
||||
$this->_thumbnail = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMediaText()
|
||||
{
|
||||
return $this->_mediaText;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param array
|
||||
* @return Zend_Gdata_Media_Extension_MediaGroup
|
||||
*/
|
||||
public function setMediaText($value)
|
||||
{
|
||||
$this->_mediaText = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
+114
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the media:hash element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaHash extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'hash';
|
||||
protected $_rootNamespace = 'media';
|
||||
protected $_algo = null;
|
||||
|
||||
/**
|
||||
* Constructs a new MediaHash element
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $algo
|
||||
*/
|
||||
public function __construct($text = null, $algo = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
$this->_algo = $algo;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_algo != null) {
|
||||
$element->setAttribute('algo', $this->_algo);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'algo':
|
||||
$this->_algo = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string The algo
|
||||
*/
|
||||
public function getAlgo()
|
||||
{
|
||||
return $this->_algo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaHash Provides a fluent interface
|
||||
*/
|
||||
public function setAlgo($value)
|
||||
{
|
||||
$this->_algo = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the media:keywords element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaKeywords extends Zend_Gdata_Extension
|
||||
{
|
||||
protected $_rootElement = 'keywords';
|
||||
protected $_rootNamespace = 'media';
|
||||
|
||||
/**
|
||||
* Constructs a new MediaKeywords element
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
}
|
||||
+177
@@ -0,0 +1,177 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the media:player element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaPlayer extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'player';
|
||||
protected $_rootNamespace = 'media';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_url = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_width = null;
|
||||
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
protected $_height = null;
|
||||
|
||||
/**
|
||||
* Constructs a new MediaPlayer element
|
||||
*
|
||||
* @param string $url
|
||||
* @param int $width
|
||||
* @param int $height
|
||||
*/
|
||||
public function __construct($url = null, $width = null, $height = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
$this->_url = $url;
|
||||
$this->_width = $width;
|
||||
$this->_height = $height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_url != null) {
|
||||
$element->setAttribute('url', $this->_url);
|
||||
}
|
||||
if ($this->_width != null) {
|
||||
$element->setAttribute('width', $this->_width);
|
||||
}
|
||||
if ($this->_height != null) {
|
||||
$element->setAttribute('height', $this->_height);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'url':
|
||||
$this->_url = $attribute->nodeValue;
|
||||
break;
|
||||
case 'width':
|
||||
$this->_width = $attribute->nodeValue;
|
||||
break;
|
||||
case 'height':
|
||||
$this->_height = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getUrl()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface
|
||||
*/
|
||||
public function setUrl($value)
|
||||
{
|
||||
$this->_url = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface
|
||||
*/
|
||||
public function setWidth($value)
|
||||
{
|
||||
$this->_width = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaPlayer Provides a fluent interface
|
||||
*/
|
||||
public function setHeight($value)
|
||||
{
|
||||
$this->_height = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the media:rating element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaRating extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'rating';
|
||||
protected $_rootNamespace = 'media';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_scheme = null;
|
||||
|
||||
/**
|
||||
* Constructs a new MediaRating element
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $scheme
|
||||
*/
|
||||
public function __construct($text = null, $scheme = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
$this->_scheme = $scheme;
|
||||
$this->_text = $text;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_scheme != null) {
|
||||
$element->setAttribute('scheme', $this->_scheme);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'scheme':
|
||||
$this->_scheme = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getScheme()
|
||||
{
|
||||
return $this->_scheme;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaRating Provides a fluent interface
|
||||
*/
|
||||
public function setScheme($value)
|
||||
{
|
||||
$this->_scheme = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
+148
@@ -0,0 +1,148 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you did not receive a copy of the license and are unable to
|
||||
* obtain it through the world-wide-web, please send an email
|
||||
* to [email protected] so we can send you a copy immediately.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
require_once 'Zend/Gdata/App/Extension.php';
|
||||
|
||||
/**
|
||||
* Represents the media:restriction element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Media_Extension_MediaRestriction extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootElement = 'restriction';
|
||||
protected $_rootNamespace = 'media';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_relationship = null;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_type = null;
|
||||
|
||||
/**
|
||||
* Constructs a new MediaRestriction element
|
||||
*
|
||||
* @param string $text
|
||||
* @param string $relationship
|
||||
* @param string $type
|
||||
*/
|
||||
public function __construct($text = null, $relationship = null, $type = null)
|
||||
{
|
||||
foreach (Zend_Gdata_Media::$namespaces as $nsPrefix => $nsUri) {
|
||||
$this->registerNamespace($nsPrefix, $nsUri);
|
||||
}
|
||||
parent::__construct();
|
||||
$this->_text = $text;
|
||||
$this->_relationship = $relationship;
|
||||
$this->_type = $type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_relationship != null) {
|
||||
$element->setAttribute('relationship', $this->_relationship);
|
||||
}
|
||||
if ($this->_type != null) {
|
||||
$element->setAttribute('type', $this->_type);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'relationship':
|
||||
$this->_relationship = $attribute->nodeValue;
|
||||
break;
|
||||
case 'type':
|
||||
$this->_type = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getRelationship()
|
||||
{
|
||||
return $this->_relationship;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaRestriction Provides a fluent interface
|
||||
*/
|
||||
public function setRelationship($value)
|
||||
{
|
||||
$this->_relationship = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Media_Extension_MediaRestriction Provides a fluent interface
|
||||
*/
|
||||
public function setType($value)
|
||||
{
|
||||
$this->_type = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user