diff options
Diffstat (limited to 'applications/core/lib/Zend/Gdata')
313 files changed, 47443 insertions, 0 deletions
diff --git a/applications/core/lib/Zend/Gdata/App.php b/applications/core/lib/Zend/Gdata/App.php new file mode 100644 index 0000000..07c5603 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App.php @@ -0,0 +1,1205 @@ +<?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 App + * @copyright Copyright (c) 2005-2009 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 + * @subpackage App + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_App +{ + + /** Default major protocol version. + * + * @see _majorProtocolVersion + */ + const DEFAULT_MAJOR_PROTOCOL_VERSION = 1; + + /** Default minor protocol version. + * + * @see _minorProtocolVersion + */ + const DEFAULT_MINOR_PROTOCOL_VERSION = null; + + /** + * 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; + + /** + * Indicates the major protocol version that should be used. + * At present, recognized values are either 1 or 2. However, any integer + * value >= 1 is considered valid. + * + * Under most circumtances, this will be automatically set by + * Zend_Gdata_App subclasses. + * + * @see setMajorProtocolVersion() + * @see getMajorProtocolVersion() + */ + protected $_majorProtocolVersion; + + /** + * Indicates the minor protocol version that should be used. Can be set + * to either an integer >= 0, or NULL if no minor version should be sent + * to the server. + * + * At present, this field is not used by any Google services, but may be + * used in the future. + * + * Under most circumtances, this will be automatically set by + * Zend_Gdata_App subclasses. + * + * @see setMinorProtocolVersion() + * @see getMinorProtocolVersion() + */ + protected $_minorProtocolVersion; + + /** + * Whether we want to use XML to object mapping when fetching data. + * + * @var boolean + */ + protected $_useObjectMapping = true; + + /** + * 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); + // Set default protocol version. Subclasses should override this as + // needed once a given service supports a new version. + $this->setMajorProtocolVersion(self::DEFAULT_MAJOR_PROTOCOL_VERSION); + $this->setMinorProtocolVersion(self::DEFAULT_MINOR_PROTOCOL_VERSION); + } + + /** + * 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); + } + + /** + * Retrieve feed as string or 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 string|Zend_Gdata_App_Feed Returns string only if the object + * mapping has been disabled explicitly + * by passing false to the + * useObjectMapping() function. + */ + public function getFeed($uri, $className='Zend_Gdata_App_Feed') + { + return $this->importUrl($uri, $className, null); + } + + /** + * Retrieve entry as string or object + * + * @param string $uri + * @param string $className The class which is used as the return type + * @return string|Zend_Gdata_App_Entry Returns string only if the object + * mapping has been disabled explicitly + * by passing false to the + * useObjectMapping() function. + */ + public function getEntry($uri, $className='Zend_Gdata_App_Entry') + { + return $this->importUrl($uri, $className, null); + } + + /** + * 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; + } + + /** + * Set the major protocol version that should be used. Values < 1 will + * cause a Zend_Gdata_App_InvalidArgumentException to be thrown. + * + * @see _majorProtocolVersion + * @param int $value The major protocol version to use. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function setMajorProtocolVersion($value) + { + if (!($value >= 1)) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException( + 'Major protocol version must be >= 1'); + } + $this->_majorProtocolVersion = $value; + } + + /** + * Get the major protocol version that is in use. + * + * @see _majorProtocolVersion + * @return int The major protocol version in use. + */ + public function getMajorProtocolVersion() + { + return $this->_majorProtocolVersion; + } + + /** + * Set the minor protocol version that should be used. If set to NULL, no + * minor protocol version will be sent to the server. Values < 0 will + * cause a Zend_Gdata_App_InvalidArgumentException to be thrown. + * + * @see _minorProtocolVersion + * @param (int|NULL) $value The minor protocol version to use. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function setMinorProtocolVersion($value) + { + if (!($value >= 0)) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException( + 'Minor protocol version must be >= 0'); + } + $this->_minorProtocolVersion = $value; + } + + /** + * Get the minor protocol version that is in use. + * + * @see _minorProtocolVersion + * @return (int|NULL) The major protocol version in use, or NULL if no + * minor version is specified. + */ + public function getMinorProtocolVersion() + { + return $this->_minorProtocolVersion; + } + + /** + * 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) + { + // As a convenience, if $headers is null, we'll convert it back to + // an empty array. + if ($headers === null) { + $headers = array(); + } + + $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 = $rawData->getContentType(); + $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; + } + + // Set an If-Match header if: + // - This isn't a DELETE + // - If this isn't a GET, the Etag isn't weak + // - A similar header (If-Match/If-None-Match) hasn't already been + // set. + if ($method != 'DELETE' && ( + !array_key_exists('If-Match', $headers) && + !array_key_exists('If-None-Match', $headers) + ) ) { + $allowWeak = $method == 'GET'; + if ($ifMatchHeader = $this->generateIfMatchHeaderData( + $data, $allowWeak)) { + $headers['If-Match'] = $ifMatchHeader; + } + } + + 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(); + } + // Append a Gdata version header if protocol v2 or higher is in use. + // (Protocol v1 does not use this header.) + $major = $this->getMajorProtocolVersion(); + $minor = $this->getMinorProtocolVersion(); + if ($major >= 2) { + $headers['GData-Version'] = $major + + (($minor === null) ? '.' + $minor : ''); + } + + // 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)); + + // Set the proper adapter if we are handling a streaming upload + $usingMimeStream = false; + $oldHttpAdapter = null; + + if ($body instanceof Zend_Gdata_MediaMimeStream) { + $usingMimeStream = true; + $this->_httpClient->setRawDataStream($body, $contentType); + $oldHttpAdapter = $this->_httpClient->getAdapter(); + + if ($oldHttpAdapter instanceof Zend_Http_Client_Adapter_Proxy) { + require_once 'Zend/Gdata/HttpAdapterStreamingProxy.php'; + $newAdapter = new Zend_Gdata_HttpAdapterStreamingProxy(); + } else { + require_once 'Zend/Gdata/HttpAdapterStreamingSocket.php'; + $newAdapter = new Zend_Gdata_HttpAdapterStreamingSocket(); + } + $this->_httpClient->setAdapter($newAdapter); + } else { + $this->_httpClient->setRawData($body, $contentType); + } + + try { + $response = $this->_httpClient->request($method); + // reset adapter + if ($usingMimeStream) { + $this->_httpClient->setAdapter($oldHttpAdapter); + } + } catch (Zend_Http_Client_Exception $e) { + // reset adapter + if ($usingMimeStream) { + $this->_httpClient->setAdapter($oldHttpAdapter); + } + require_once 'Zend/Gdata/App/HttpException.php'; + throw new Zend_Gdata_App_HttpException($e->getMessage(), $e); + } + if ($response->isRedirect() && $response->getStatus() != '304') { + 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 string|Zend_Gdata_App_Feed Returns string only if the object + * mapping has been disabled explicitly + * by passing false to the + * useObjectMapping() function. + */ + 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(); + if (!$this->_useObjectMapping) { + return $feedContent; + } + $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 + * @param array $extraHeaders Extra headers to add to the request, as an + * array of string-based key/value pairs. + * @throws Zend_Gdata_App_Exception + * @return string|Zend_Gdata_App_Feed Returns string only if the object + * mapping has been disabled explicitly + * by passing false to the + * useObjectMapping() function. + */ + public function importUrl($url, $className='Zend_Gdata_App_Feed', + $extraHeaders = array()) + { + $response = $this->get($url, $extraHeaders); + + $feedContent = $response->getBody(); + if (!$this->_useObjectMapping) { + return $feedContent; + } + + $protocolVersionStr = $response->getHeader('GData-Version'); + $majorProtocolVersion = null; + $minorProtocolVersion = null; + if ($protocolVersionStr !== null) { + // Extract protocol major and minor version from header + $delimiterPos = strpos($protocolVersionStr, '.'); + $length = strlen($protocolVersionStr); + $major = substr($protocolVersionStr, 0, $delimiterPos); + $minor = substr($protocolVersionStr, $delimiterPos + 1, $length); + $majorProtocolVersion = $major; + $minorProtocolVersion = $minor; + } + + $feed = self::importString($feedContent, $className, + $majorProtocolVersion, $minorProtocolVersion); + if ($this->getHttpClient() != null) { + $feed->setHttpClient($this->getHttpClient()); + } + $etag = $response->getHeader('ETag'); + if ($etag !== null) { + $feed->setEtag($etag); + } + return $feed; + } + + + /** + * Imports a feed represented by $string. + * + * @param string $string + * @param string $className The class which is used as the return type + * @param integer $majorProcolVersion (optional) The major protocol version + * of the data model object that is to be created. + * @param integer $minorProcolVersion (optional) The minor protocol version + * of the data model object that is to be created. + * @throws Zend_Gdata_App_Exception + * @return Zend_Gdata_App_Feed + */ + public static function importString($string, + $className='Zend_Gdata_App_Feed', $majorProtocolVersion = null, + $minorProtocolVersion = null) + { + // 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(); + $feed->setMajorProtocolVersion($majorProtocolVersion); + $feed->setMinorProtocolVersion($minorProtocolVersion); + $feed->transferFromXML($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 GET URI + * @param array $extraHeaders Extra headers to add to the request, as an + * array of string-based key/value pairs. + * @throws Zend_Gdata_App_HttpException + * @return Zend_Http_Response + */ + public function get($uri, $extraHeaders = array()) + { + $requestData = $this->prepareRequest('GET', $uri, $extraHeaders); + return $this->performHttpRequest( + $requestData['method'], $requestData['url'], + $requestData['headers']); + } + + /** + * 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 $extraHeaders Extra headers to add to the request, as an + * array of string-based key/value pairs. + * @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 $extraHeaders Extra headers to add to the request, as an + * array of string-based key/value pairs. + * @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 { + $headers = array(); + + $requestData = $this->prepareRequest( + 'DELETE', null, $headers, $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. + * @param array $extraHeaders Extra headers to add to the request, as an + * array of string-based key/value pairs. + * @return Zend_Gdata_App_Entry The entry returned by the service after + * insertion. + */ + public function insertEntry($data, $uri, $className='Zend_Gdata_App_Entry', + $extraHeaders = array()) + { + $response = $this->post($data, $uri, null, null, $extraHeaders); + + $returnEntry = new $className($response->getBody()); + $returnEntry->setHttpClient(self::getstaticHttpClient()); + + $etag = $response->getHeader('ETag'); + if ($etag !== null) { + $returnEntry->setEtag($etag); + } + + return $returnEntry; + } + + /** + * Update an entry + * + * @param mixed $data Zend_Gdata_App_Entry or XML (w/ID and link rel='edit') + * @param string|null The URI to send requests to, or null if $data + * contains the URI. + * @param string|null The name of the class that should be deserialized + * from the server response. If null, then 'Zend_Gdata_App_Entry' + * will be used. + * @param array $extraHeaders Extra headers to add to the request, as an + * array of string-based key/value pairs. + * @return Zend_Gdata_App_Entry The entry returned from the server + * @throws Zend_Gdata_App_Exception + */ + public function updateEntry($data, $uri = null, $className = null, + $extraHeaders = array()) + { + 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, null, null, $extraHeaders); + $returnEntry = new $className($response->getBody()); + $returnEntry->setHttpClient(self::getstaticHttpClient()); + + $etag = $response->getHeader('ETag'); + if ($etag !== null) { + $returnEntry->setEtag($etag); + } + + 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); + $instance = $reflectionObj->newInstanceArgs($args); + if ($instance instanceof Zend_Gdata_App_FeedEntryParent) { + $instance->setHttpClient($this->_httpClient); + + // Propogate version data + $instance->setMajorProtocolVersion( + $this->_majorProtocolVersion); + $instance->setMinorProtocolVersion( + $this->_minorProtocolVersion); + } + return $instance; + } 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 + )); + } + + /** + * Retrieve next set of results based on a given feed. + * + * @param Zend_Gdata_App_Feed $feed The feed from which to + * retreive the next set of results. + * @param string $className (optional) The class of feed to be returned. + * If null, the next feed (if found) will be the same class as + * the feed that was given as the first argument. + * @return Zend_Gdata_App_Feed|null Returns a + * Zend_Gdata_App_Feed or null if no next set of results + * exists. + */ + public function getNextFeed($feed, $className = null) + { + $nextLink = $feed->getNextLink(); + if (!$nextLink) { + return null; + } + $nextLinkHref = $nextLink->getHref(); + + if ($className === null) { + $className = get_class($feed); + } + + return $this->getFeed($nextLinkHref, $className); + } + + /** + * Retrieve previous set of results based on a given feed. + * + * @param Zend_Gdata_App_Feed $feed The feed from which to + * retreive the previous set of results. + * @param string $className (optional) The class of feed to be returned. + * If null, the previous feed (if found) will be the same class as + * the feed that was given as the first argument. + * @return Zend_Gdata_App_Feed|null Returns a + * Zend_Gdata_App_Feed or null if no previous set of results + * exists. + */ + public function getPreviousFeed($feed, $className = null) + { + $previousLink = $feed->getPreviousLink(); + if (!$previousLink) { + return null; + } + $previousLinkHref = $previousLink->getHref(); + + if ($className === null) { + $className = get_class($feed); + } + + return $this->getFeed($previousLinkHref, $className); + } + + /** + * Returns the data for an If-Match header based on the current Etag + * property. If Etags are not supported by the server or cannot be + * extracted from the data, then null will be returned. + * + * @param boolean $allowWeak If false, then if a weak Etag is detected, + * then return null rather than the Etag. + * @return string|null $data + */ + public function generateIfMatchHeaderData($data, $allowWeek) + { + $result = ''; + // Set an If-Match header if an ETag has been set (version >= 2 only) + if ($this->_majorProtocolVersion >= 2 && + $data instanceof Zend_Gdata_App_Entry) { + $etag = $data->getEtag(); + if (($etag !== null) && + ($allowWeek || substr($etag, 0, 2) != 'W/')) { + $result = $data->getEtag(); + } + } + return $result; + } + + /** + * Determine whether service object is using XML to object mapping. + * + * @return boolean True if service object is using XML to object mapping, + * false otherwise. + */ + public function usingObjectMapping() + { + return $this->_useObjectMapping; + } + + /** + * Enable/disable the use of XML to object mapping. + * + * @param boolean $value Pass in true to use the XML to object mapping. + * Pass in false or null to disable it. + * @return void + */ + public function useObjectMapping($value) + { + if ($value === True) { + $this->_useObjectMapping = true; + } else { + $this->_useObjectMapping = false; + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/AuthException.php b/applications/core/lib/Zend/Gdata/App/AuthException.php new file mode 100644 index 0000000..db9359e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/AuthException.php @@ -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 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 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 +{ +} diff --git a/applications/core/lib/Zend/Gdata/App/BadMethodCallException.php b/applications/core/lib/Zend/Gdata/App/BadMethodCallException.php new file mode 100644 index 0000000..e88b463 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/BadMethodCallException.php @@ -0,0 +1,41 @@ +<?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 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 + */ + +/** + * 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 + * @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_BadMethodCallException extends Zend_Gdata_App_Exception +{ +} diff --git a/applications/core/lib/Zend/Gdata/App/Base.php b/applications/core/lib/Zend/Gdata/App/Base.php new file mode 100644 index 0000000..c2ebc6a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Base.php @@ -0,0 +1,571 @@ +<?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 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_Util + */ +require_once 'Zend/Gdata/App/Util.php'; + +/** + * Abstract class for all XML elements + * + * @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 + */ +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 Memoized results from calls to lookupNamespace() to avoid + * expensive calls to getGreatestBoundedValue(). The key is in the + * form 'prefix-majorVersion-minorVersion', and the value is the + * output from getGreatestBoundedValue(). + */ + protected static $_namespaceLookupCache = array(); + + /** + * List of namespaces, as a three-dimensional array. The first dimension + * represents the namespace prefix, the second dimension represents the + * minimum major protocol version, and the third dimension is the minimum + * minor protocol version. Null keys are NOT allowed. + * + * When looking up a namespace for a given prefix, the greatest version + * number (both major and minor) which is less than the effective version + * should be used. + * + * @see lookupNamespace() + * @see registerNamespace() + * @see registerAllNamespaces() + * @var array + */ + protected $_namespaces = array( + 'atom' => array( + 1 => array( + 0 => 'http://www.w3.org/2005/Atom' + ) + ), + 'app' => array( + 1 => array( + 0 => 'http://purl.org/atom/app#' + ), + 2 => array( + 0 => 'http://www.w3.org/2007/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, $majorVersion = 1, $minorVersion = null) + { + if ($doc === null) { + $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. + * + * @param string $prefix The namespace prefix to lookup. + * @param integer $majorVersion The major protocol version in effect. + * Defaults to '1'. + * @param integer $minorVersion The minor protocol version in effect. + * Defaults to null (use latest). + * @return string + */ + public function lookupNamespace($prefix, + $majorVersion = 1, + $minorVersion = null) + { + // Check for a memoized result + $key = $prefix . ' ' . + (is_null($majorVersion) ? 'NULL' : $majorVersion) . + ' '. (is_null($minorVersion) ? 'NULL' : $minorVersion); + if (array_key_exists($key, self::$_namespaceLookupCache)) + return self::$_namespaceLookupCache[$key]; + // If no match, return the prefix by default + $result = $prefix; + + // Find tuple of keys that correspond to the namespace we should use + if (isset($this->_namespaces[$prefix])) { + // Major version search + $nsData = $this->_namespaces[$prefix]; + $foundMajorV = Zend_Gdata_App_Util::findGreatestBoundedValue( + $majorVersion, $nsData); + // Minor version search + $nsData = $nsData[$foundMajorV]; + $foundMinorV = Zend_Gdata_App_Util::findGreatestBoundedValue( + $minorVersion, $nsData); + // Extract NS + $result = $nsData[$foundMinorV]; + } + + // Memoize result + self::$_namespaceLookupCache[$key] = $result; + + return $result; + } + + /** + * 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(). + * + * WARNING: Currently, registering a namespace will NOT invalidate any + * memoized data stored in $_namespaceLookupCache. Under normal + * use, this behavior is acceptable. If you are adding + * contradictory data to the namespace lookup table, you must + * call flushNamespaceLookupCache(). + * + * @param string $prefix The namespace prefix + * @param string $namespaceUri The full namespace URI + * @param integer $majorVersion The major protocol version in effect. + * Defaults to '1'. + * @param integer $minorVersion The minor protocol version in effect. + * Defaults to null (use latest). + * @return void + */ + public function registerNamespace($prefix, + $namespaceUri, + $majorVersion = 1, + $minorVersion = 0) + { + $this->_namespaces[$prefix][$majorVersion][$minorVersion] = + $namespaceUri; + } + + /** + * Flush namespace lookup cache. + * + * Empties the namespace lookup cache. Call this function if you have + * added data to the namespace lookup table that contradicts values that + * may have been cached during a previous call to lookupNamespace(). + */ + public static function flushNamespaceLookupCache() + { + self::$_namespaceLookupCache = array(); + } + + /** + * Add an array of namespaces to the registered list. + * + * Takes an array in the format of: + * namespace prefix, namespace URI, major protocol version, + * minor protocol version and adds them with calls to ->registerNamespace() + * + * @param array $namespaceArray An array of namespaces. + * @return void + */ + public function registerAllNamespaces($namespaceArray) + { + foreach($namespaceArray as $namespace) { + $this->registerNamespace( + $namespace[0], $namespace[1], $namespace[2], $namespace[3]); + } + } + + + /** + * Magic getter to allow access 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}) || ($this->{'_' . $name} === null)) { + $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(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/BaseMediaSource.php b/applications/core/lib/Zend/Gdata/App/BaseMediaSource.php new file mode 100644 index 0000000..ea5239a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/BaseMediaSource.php @@ -0,0 +1,178 @@ +<?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 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_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 + * @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 + */ +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}) || ($this->{'_' . $name} === null)) { + $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; + } + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/CaptchaRequiredException.php b/applications/core/lib/Zend/Gdata/App/CaptchaRequiredException.php new file mode 100644 index 0000000..812cac4 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/CaptchaRequiredException.php @@ -0,0 +1,93 @@ +<?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 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_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 + * @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_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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Entry.php b/applications/core/lib/Zend/Gdata/App/Entry.php new file mode 100644 index 0000000..c4eba53 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Entry.php @@ -0,0 +1,388 @@ +<?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 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_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_Edited + */ +require_once 'Zend/Gdata/App/Extension/Edited.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 + * @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_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; + + /** + * app:edited element + * + * @var Zend_Gdata_App_Extension_Edited + */ + protected $_edited = null; + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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)); + } + if ($this->_edited != null) { + $element->appendChild($this->_edited->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; + case $this->lookupNamespace('app') . ':' . 'edited': + $edited = new Zend_Gdata_App_Extension_Edited(); + $edited->transferFromDOM($child); + $this->_edited = $edited; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Uploads changes in this entry to the server using Zend_Gdata_App + * + * @param string|null $uri The URI to send requests to, or null if $data + * contains the URI. + * @param string|null $className The name of the class that should we + * deserializing the server response. If null, then + * 'Zend_Gdata_App_Entry' will be used. + * @param array $extraHeaders Extra headers to add to the request, as an + * array of string-based key/value pairs. + * @return Zend_Gdata_App_Entry The updated entry. + * @throws Zend_Gdata_App_Exception + */ + public function save($uri = null, $className = null, $extraHeaders = array()) + { + return $this->getService()->updateEntry($this, + $uri, + $className, + $extraHeaders); + } + + /** + * 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() + { + $this->getService()->delete($this); + } + + /** + * Reload the current entry. Returns a new copy of the entry as returned + * by the server, or null if no changes exist. This does not + * modify the current entry instance. + * + * @param string|null The URI to send requests to, or null if $data + * contains the URI. + * @param string|null The name of the class that should we deserializing + * the server response. If null, then 'Zend_Gdata_App_Entry' will + * be used. + * @param array $extraHeaders Extra headers to add to the request, as an + * array of string-based key/value pairs. + * @return mixed A new instance of the current entry with updated data, or + * null if the server reports that no changes have been made. + * @throws Zend_Gdata_App_Exception + */ + public function reload($uri = null, $className = null, $extraHeaders = array()) + { + // Get URI + $editLink = $this->getEditLink(); + if (($uri === null) && $editLink != null) { + $uri = $editLink->getHref(); + } + + // Set classname to current class, if not otherwise set + if ($className === null) { + $className = get_class($this); + } + + // Append ETag, if present (Gdata v2 and above, only) and doesn't + // conflict with existing headers + if ($this->_etag != null + && !array_key_exists('If-Match', $extraHeaders) + && !array_key_exists('If-None-Match', $extraHeaders)) { + $extraHeaders['If-None-Match'] = $this->_etag; + } + + // If an HTTP 304 status (Not Modified)is returned, then we return + // null. + $result = null; + try { + $result = $this->service->importUrl($uri, $className, $extraHeaders); + } catch (Zend_Gdata_App_HttpException $e) { + if ($e->getResponse()->getStatus() != '304') + throw $e; + } + + return $result; + } + + /** + * 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Exception.php b/applications/core/lib/Zend/Gdata/App/Exception.php new file mode 100644 index 0000000..3bd75af --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Exception.php @@ -0,0 +1,42 @@ +<?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 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 + */ + + +/** + * 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 + * @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_Exception extends Zend_Exception +{ +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension.php b/applications/core/lib/Zend/Gdata/App/Extension.php new file mode 100644 index 0000000..e08cd32 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Base + */ +require_once 'Zend/Gdata/App/Base.php'; + +/** + * Gdata App extensions + * + * @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 + */ +abstract class Zend_Gdata_App_Extension extends Zend_Gdata_App_Base +{ +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Author.php b/applications/core/lib/Zend/Gdata/App/Extension/Author.php new file mode 100644 index 0000000..1b4cf92 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Author.php @@ -0,0 +1,42 @@ +<?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 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_Extension + */ +require_once 'Zend/Gdata/App/Extension/Person.php'; + +/** + * Represents the atom:author element + * + * @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_Extension_Author extends Zend_Gdata_App_Extension_Person +{ + + protected $_rootElement = 'author'; + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Category.php b/applications/core/lib/Zend/Gdata/App/Extension/Category.php new file mode 100644 index 0000000..d064ee8 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Category.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the atom:category element + * + * @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_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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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 string|null + */ + public function getTerm() + { + return $this->_term; + } + + /** + * @param string|null $value + * @return Zend_Gdata_App_Extension_Category Provides a fluent interface + */ + public function setTerm($value) + { + $this->_term = $value; + return $this; + } + + /** + * @return string|null + */ + public function getScheme() + { + return $this->_scheme; + } + + /** + * @param string|null $value + * @return Zend_Gdata_App_Extension_Category Provides a fluent interface + */ + public function setScheme($value) + { + $this->_scheme = $value; + return $this; + } + + /** + * @return string|null + */ + public function getLabel() + { + return $this->_label; + } + + /** + * @param string|null $value + * @return Zend_Gdata_App_Extension_Category Provides a fluent interface + */ + public function setLabel($value) + { + $this->_label = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Content.php b/applications/core/lib/Zend/Gdata/App/Extension/Content.php new file mode 100644 index 0000000..b11d005 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Content.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension_Text + */ +require_once 'Zend/Gdata/App/Extension/Text.php'; + +/** + * Represents the atom:content element + * + * @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_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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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 string + */ + public function getSrc() + { + return $this->_src; + } + + /** + * @param string $value + * @return Zend_Gdata_App_Entry Provides a fluent interface + */ + public function setSrc($value) + { + $this->_src = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Contributor.php b/applications/core/lib/Zend/Gdata/App/Extension/Contributor.php new file mode 100644 index 0000000..e25176f --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Contributor.php @@ -0,0 +1,42 @@ +<?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 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_Extension + */ +require_once 'Zend/Gdata/App/Extension/Person.php'; + +/** + * Represents the atom:contributor element + * + * @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_Extension_Contributor extends Zend_Gdata_App_Extension_Person +{ + + protected $_rootElement = 'contributor'; + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Control.php b/applications/core/lib/Zend/Gdata/App/Extension/Control.php new file mode 100644 index 0000000..e0cac25 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Control.php @@ -0,0 +1,97 @@ +<?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 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_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 + * @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_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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Draft.php b/applications/core/lib/Zend/Gdata/App/Extension/Draft.php new file mode 100644 index 0000000..16743fc --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Draft.php @@ -0,0 +1,49 @@ +<?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 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_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the app:draft element + * + * @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_Extension_Draft extends Zend_Gdata_App_Extension +{ + + protected $_rootNamespace = 'app'; + protected $_rootElement = 'draft'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Edited.php b/applications/core/lib/Zend/Gdata/App/Extension/Edited.php new file mode 100644 index 0000000..a67258d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Edited.php @@ -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 + * @subpackage App + * @copyright Copyright (c) 2005-2009 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:edited element + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_App_Extension_Edited extends Zend_Gdata_App_Extension +{ + + protected $_rootElement = 'edited'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Element.php b/applications/core/lib/Zend/Gdata/App/Extension/Element.php new file mode 100644 index 0000000..499ed78 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Element.php @@ -0,0 +1,57 @@ +<?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 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_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 + * @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_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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Email.php b/applications/core/lib/Zend/Gdata/App/Extension/Email.php new file mode 100644 index 0000000..5eedb2d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Email.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the atom:email element + * + * @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_Extension_Email extends Zend_Gdata_App_Extension +{ + + protected $_rootElement = 'email'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Generator.php b/applications/core/lib/Zend/Gdata/App/Extension/Generator.php new file mode 100644 index 0000000..bbc8b38 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Generator.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the atom:generator element + * + * @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_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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Icon.php b/applications/core/lib/Zend/Gdata/App/Extension/Icon.php new file mode 100644 index 0000000..08fafcc --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Icon.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the atom:icon element + * + * @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_Extension_Icon extends Zend_Gdata_App_Extension +{ + + protected $_rootElement = 'icon'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Id.php b/applications/core/lib/Zend/Gdata/App/Extension/Id.php new file mode 100644 index 0000000..5dddce0 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Id.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the atom:id element + * + * @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_Extension_Id extends Zend_Gdata_App_Extension +{ + + protected $_rootElement = 'id'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Link.php b/applications/core/lib/Zend/Gdata/App/Extension/Link.php new file mode 100644 index 0000000..f34af69 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Link.php @@ -0,0 +1,218 @@ +<?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 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_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + +/** + * Data model for representing an atom:link element + * + * @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_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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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 string|null + */ + public function getHref() + { + return $this->_href; + } + + /** + * @param string|null $value + * @return Zend_Gdata_App_Entry Provides a fluent interface + */ + public function setHref($value) + { + $this->_href = $value; + return $this; + } + + /** + * @return string|null + */ + public function getRel() + { + return $this->_rel; + } + + /** + * @param string|null $value + * @return Zend_Gdata_App_Entry Provides a fluent interface + */ + public function setRel($value) + { + $this->_rel = $value; + return $this; + } + + /** + * @return string|null + */ + public function getType() + { + return $this->_type; + } + + /** + * @param string|null $value + * @return Zend_Gdata_App_Entry Provides a fluent interface + */ + public function setType($value) + { + $this->_type = $value; + return $this; + } + + /** + * @return string|null + */ + public function getHrefLang() + { + return $this->_hrefLang; + } + + /** + * @param string|null $value + * @return Zend_Gdata_App_Entry Provides a fluent interface + */ + public function setHrefLang($value) + { + $this->_hrefLang = $value; + return $this; + } + + /** + * @return string|null + */ + public function getTitle() + { + return $this->_title; + } + + /** + * @param string|null $value + * @return Zend_Gdata_App_Entry Provides a fluent interface + */ + public function setTitle($value) + { + $this->_title = $value; + return $this; + } + + /** + * @return string|null + */ + public function getLength() + { + return $this->_length; + } + + /** + * @param string|null $value + * @return Zend_Gdata_App_Entry Provides a fluent interface + */ + public function setLength($value) + { + $this->_length = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Logo.php b/applications/core/lib/Zend/Gdata/App/Extension/Logo.php new file mode 100644 index 0000000..ca96b57 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Logo.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the atom:logo element + * + * @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_Extension_Logo extends Zend_Gdata_App_Extension +{ + + protected $_rootElement = 'logo'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Name.php b/applications/core/lib/Zend/Gdata/App/Extension/Name.php new file mode 100644 index 0000000..452ead6 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Name.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the atom:name element + * + * @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_Extension_Name extends Zend_Gdata_App_Extension +{ + + protected $_rootElement = 'name'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Person.php b/applications/core/lib/Zend/Gdata/App/Extension/Person.php new file mode 100644 index 0000000..35f90ec --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Person.php @@ -0,0 +1,162 @@ +<?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 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_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 + * @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 + */ +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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Published.php b/applications/core/lib/Zend/Gdata/App/Extension/Published.php new file mode 100644 index 0000000..1ba13ce --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Published.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the atom:published element + * + * @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_Extension_Published extends Zend_Gdata_App_Extension +{ + + protected $_rootElement = 'published'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Rights.php b/applications/core/lib/Zend/Gdata/App/Extension/Rights.php new file mode 100644 index 0000000..e7c817b --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Rights.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension_Text + */ +require_once 'Zend/Gdata/App/Extension/Text.php'; + +/** + * Represents the atom:rights element + * + * @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_Extension_Rights extends Zend_Gdata_App_Extension_Text +{ + + protected $_rootElement = 'rights'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Source.php b/applications/core/lib/Zend/Gdata/App/Extension/Source.php new file mode 100644 index 0000000..e03cb67 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Source.php @@ -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 + * @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 + */ + +/** + * @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 + * @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_Extension_Source extends Zend_Gdata_App_FeedSourceParent +{ + + protected $_rootElement = 'source'; + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Subtitle.php b/applications/core/lib/Zend/Gdata/App/Extension/Subtitle.php new file mode 100644 index 0000000..2a44e42 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Subtitle.php @@ -0,0 +1,42 @@ +<?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 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_Extension_Text + */ +require_once 'Zend/Gdata/App/Extension/Text.php'; + +/** + * Represents the atom:subtitle element + * + * @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_Extension_Subtitle extends Zend_Gdata_App_Extension_Text +{ + + protected $_rootElement = 'subtitle'; + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Summary.php b/applications/core/lib/Zend/Gdata/App/Extension/Summary.php new file mode 100644 index 0000000..790c7b8 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Summary.php @@ -0,0 +1,42 @@ +<?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 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_Extension_Text + */ +require_once 'Zend/Gdata/App/Extension/Text.php'; + +/** + * Represents the atom:summary element + * + * @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_Extension_Summary extends Zend_Gdata_App_Extension_Text +{ + + protected $_rootElement = 'summary'; + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Text.php b/applications/core/lib/Zend/Gdata/App/Extension/Text.php new file mode 100644 index 0000000..c64cc98 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Text.php @@ -0,0 +1,89 @@ +<?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 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_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 + * @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 + */ +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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Title.php b/applications/core/lib/Zend/Gdata/App/Extension/Title.php new file mode 100644 index 0000000..3a5fdd5 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Title.php @@ -0,0 +1,42 @@ +<?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 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_Extension_Text + */ +require_once 'Zend/Gdata/App/Extension/Text.php'; + +/** + * Represents the atom:title element + * + * @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_Extension_Title extends Zend_Gdata_App_Extension_Text +{ + + protected $_rootElement = 'title'; + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Updated.php b/applications/core/lib/Zend/Gdata/App/Extension/Updated.php new file mode 100644 index 0000000..a06539f --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Updated.php @@ -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 + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the atom:updated element + * + * @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_Extension_Updated extends Zend_Gdata_App_Extension +{ + + protected $_rootElement = 'updated'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Extension/Uri.php b/applications/core/lib/Zend/Gdata/App/Extension/Uri.php new file mode 100644 index 0000000..e0f5456 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Extension/Uri.php @@ -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 uri + * to [email protected] so we can send you a copy immediately. + * + * @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 + */ + +/** + * @see Zend_Gdata_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * Represents the atom:uri element + * + * @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_Extension_Uri extends Zend_Gdata_App_Extension +{ + + protected $_rootElement = 'uri'; + + public function __construct($text = null) + { + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/Feed.php b/applications/core/lib/Zend/Gdata/App/Feed.php new file mode 100755 index 0000000..33f62b6 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Feed.php @@ -0,0 +1,351 @@ +<?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 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_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 + * @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_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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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()); + $newEntry->setMajorProtocolVersion($this->getMajorProtocolVersion()); + $newEntry->setMinorProtocolVersion($this->getMinorProtocolVersion()); + $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($key) + { + return (array_key_exists($key, $this->_entry)); + } + + /** + * Retrieve the next set of results from this feed. + * + * @throws Zend_Gdata_App_Exception + * @return mixed|null Returns the next set of results as a feed of the same + * class as this feed, or null if no results exist. + */ + public function getNextFeed() + { + $nextLink = $this->getNextLink(); + if (!$nextLink) { + require_once 'Zend/Gdata/App/HttpException.php'; + throw new Zend_Gdata_App_Exception('No link to next set ' . + 'of results found.'); + } + $nextLinkHref = $nextLink->getHref(); + $service = new Zend_Gdata_App($this->getHttpClient()); + + return $service->getFeed($nextLinkHref, get_class($this)); + } + + /** + * Retrieve the previous set of results from this feed. + * + * @throws Zend_Gdata_App_Exception + * @return mixed|null Returns the previous set of results as a feed of + * the same class as this feed, or null if no results exist. + */ + public function getPreviousFeed() + { + $previousLink = $this->getPreviousLink(); + if (!$previousLink) { + require_once 'Zend/Gdata/App/HttpException.php'; + throw new Zend_Gdata_App_Exception('No link to previous set ' . + 'of results found.'); + } + $previousLinkHref = $previousLink->getHref(); + $service = new Zend_Gdata_App($this->getHttpClient()); + + return $service->getFeed($previousLinkHref, get_class($this)); + } + + /** + * Set the major protocol version that should be used. Values < 1 will + * cause a Zend_Gdata_App_InvalidArgumentException to be thrown. + * + * This value will be propogated to all child entries. + * + * @see _majorProtocolVersion + * @param (int|NULL) $value The major protocol version to use. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function setMajorProtocolVersion($value) + { + parent::setMajorProtocolVersion($value); + foreach ($this->entries as $entry) { + $entry->setMajorProtocolVersion($value); + } + } + + /** + * Set the minor protocol version that should be used. If set to NULL, no + * minor protocol version will be sent to the server. Values < 0 will + * cause a Zend_Gdata_App_InvalidArgumentException to be thrown. + * + * This value will be propogated to all child entries. + * + * @see _minorProtocolVersion + * @param (int|NULL) $value The minor protocol version to use. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function setMinorProtocolVersion($value) + { + parent::setMinorProtocolVersion($value); + foreach ($this->entries as $entry) { + $entry->setMinorProtocolVersion($value); + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/FeedEntryParent.php b/applications/core/lib/Zend/Gdata/App/FeedEntryParent.php new file mode 100755 index 0000000..9679b7d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/FeedEntryParent.php @@ -0,0 +1,680 @@ +<?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 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_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 + * @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 + */ +abstract class Zend_Gdata_App_FeedEntryParent extends Zend_Gdata_App_Base +{ + /** + * Service instance used to make network requests. + * + * @see setService(), getService() + */ + protected $_service = null; + + /** + * The HTTP ETag associated with this entry. Used for optimistic + * concurrency in protoco v2 or greater. + * + * @var string|null + */ + protected $_etag = 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; + + /** + * Indicates the major protocol version that should be used. + * At present, recognized values are either 1 or 2. However, any integer + * value >= 1 is considered valid. + * + * @see setMajorProtocolVersion() + * @see getMajorProtocolVersion() + */ + protected $_majorProtocolVersion = 1; + + /** + * Indicates the minor protocol version that should be used. Can be set + * to either an integer >= 0, or NULL if no minor version should be sent + * to the server. + * + * @see setMinorProtocolVersion() + * @see getMinorProtocolVersion() + */ + protected $_minorProtocolVersion = null; + + /** + * Constructs a Feed or Entry + */ + public function __construct($element = null) + { + if (!($element instanceof DOMElement)) { + if ($element) { + $this->transferFromXML($element); + } + } else { + $this->transferFromDOM($element); + } + } + + /** + * Set the HTTP client instance + * + * Sets the HTTP client object to use for retrieving the feed. + * + * @deprecated Deprecated as of Zend Framework 1.7. Use + * setService() instead. + * @param Zend_Http_Client $httpClient + * @return Zend_Gdata_App_Feed Provides a fluent interface + */ + public function setHttpClient(Zend_Http_Client $httpClient) + { + if (!$this->_service) { + $this->_service = new Zend_Gdata_App(); + } + $this->_service->setHttpClient($httpClient); + return $this; + } + + /** + * Gets the HTTP client object. If none is set, a new Zend_Http_Client + * will be used. + * + * @deprecated Deprecated as of Zend Framework 1.7. Use + * getService() instead. + * @return Zend_Http_Client_Abstract + */ + public function getHttpClient() + { + if (!$this->_service) { + $this->_service = new Zend_Gdata_App(); + } + $client = $this->_service->getHttpClient(); + return $client; + } + + /** + * Set the active service instance for this object. This will be used to + * perform network requests, such as when calling save() and delete(). + * + * @param Zend_Gdata_App $instance The new service instance. + * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface. + */ + public function setService($instance) + { + $this->_service = $instance; + return $this; + } + + /** + * Get the active service instance for this object. This will be used to + * perform network requests, such as when calling save() and delete(). + * + * @return Zend_Gdata_App|null The current service instance, or null if + * not set. + */ + public function getService() + { + return $this->_service; + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + + /** + * Set the Etag for the current entry to $value. Setting $value to null + * unsets the Etag. + * + * @param string|null $value + * @return Zend_Gdata_App_Entry Provides a fluent interface + */ + public function setEtag($value) { + $this->_etag = $value; + return $this; + } + + /** + * Return the Etag for the current entry, or null if not set. + * + * @return string|null + */ + public function getEtag() { + return $this->_etag; + } + + /** + * Set the major protocol version that should be used. Values < 1 + * (excluding NULL) will cause a Zend_Gdata_App_InvalidArgumentException + * to be thrown. + * + * @see _majorProtocolVersion + * @param (int|NULL) $value The major protocol version to use. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function setMajorProtocolVersion($value) + { + if (!($value >= 1) && ($value !== null)) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException( + 'Major protocol version must be >= 1'); + } + $this->_majorProtocolVersion = $value; + } + + /** + * Get the major protocol version that is in use. + * + * @see _majorProtocolVersion + * @return (int|NULL) The major protocol version in use. + */ + public function getMajorProtocolVersion() + { + return $this->_majorProtocolVersion; + } + + /** + * Set the minor protocol version that should be used. If set to NULL, no + * minor protocol version will be sent to the server. Values < 0 will + * cause a Zend_Gdata_App_InvalidArgumentException to be thrown. + * + * @see _minorProtocolVersion + * @param (int|NULL) $value The minor protocol version to use. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function setMinorProtocolVersion($value) + { + if (!($value >= 0)) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException( + 'Minor protocol version must be >= 0 or null'); + } + $this->_minorProtocolVersion = $value; + } + + /** + * Get the minor protocol version that is in use. + * + * @see _minorProtocolVersion + * @return (int|NULL) The major protocol version in use, or NULL if no + * minor version is specified. + */ + public function getMinorProtocolVersion() + { + return $this->_minorProtocolVersion; + } + + /** + * 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. + * + * The current entry or feed's version will be used when performing the + * namespace lookup unless overridden using $majorVersion and + * $minorVersion. If the entry/fee has a null version, then the latest + * protocol version will be used by default. + * + * @param string $prefix The namespace prefix to lookup. + * @param integer $majorVersion The major protocol version in effect. + * Defaults to null (auto-select). + * @param integer $minorVersion The minor protocol version in effect. + * Defaults to null (auto-select). + * @return string + */ + public function lookupNamespace($prefix, + $majorVersion = null, + $minorVersion = null) + { + // Auto-select current version + if ($majorVersion === null) { + $majorVersion = $this->getMajorProtocolVersion(); + } + if ($minorVersion === null) { + $minorVersion = $this->getMinorProtocolVersion(); + } + + // Perform lookup + return parent::lookupNamespace($prefix, $majorVersion, $minorVersion); + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/FeedSourceParent.php b/applications/core/lib/Zend/Gdata/App/FeedSourceParent.php new file mode 100644 index 0000000..3f12b42 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/FeedSourceParent.php @@ -0,0 +1,266 @@ +<?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 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_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 + * @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 + */ +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. + * + * @deprecated Deprecated as of Zend Framework 1.7. Use + * setService() instead. + * @param Zend_Http_Client $httpClient + * @return Zend_Gdata_App_FeedSourceParent Provides a fluent interface + */ + public function setHttpClient(Zend_Http_Client $httpClient) + { + parent::setHttpClient($httpClient); + foreach ($this->_entry as $entry) { + $entry->setHttpClient($httpClient); + } + return $this; + } + + /** + * Set the active service instance for this feed and all enclosed entries. + * This will be used to perform network requests, such as when calling + * save() and delete(). + * + * @param Zend_Gdata_App $instance The new service instance. + * @return Zend_Gdata_App_FeedEntryParent Provides a fluent interface. + */ + public function setService($instance) + { + parent::setService($instance); + foreach ($this->_entry as $entry) { + $entry->setService($instance); + } + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/HttpException.php b/applications/core/lib/Zend/Gdata/App/HttpException.php new file mode 100644 index 0000000..99f8003 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/HttpException.php @@ -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 + * @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 + */ + +/** + * 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 + * @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_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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/IOException.php b/applications/core/lib/Zend/Gdata/App/IOException.php new file mode 100644 index 0000000..41bca89 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/IOException.php @@ -0,0 +1,42 @@ +<?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 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 + */ + + +/** + * 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 + * @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_IOException extends Zend_Gdata_App_Exception +{ +} diff --git a/applications/core/lib/Zend/Gdata/App/InvalidArgumentException.php b/applications/core/lib/Zend/Gdata/App/InvalidArgumentException.php new file mode 100644 index 0000000..10c9a61 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/InvalidArgumentException.php @@ -0,0 +1,41 @@ +<?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 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 + */ + +/** + * 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 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_InvalidArgumentException extends Zend_Gdata_App_Exception +{ +} diff --git a/applications/core/lib/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php b/applications/core/lib/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php new file mode 100644 index 0000000..5c5da25 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php @@ -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_Gdata + * @subpackage App + * @version $Id: Socket.php 8064 2008-02-16 10:58:39Z thomas $ + * @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(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/MediaEntry.php b/applications/core/lib/Zend/Gdata/App/MediaEntry.php new file mode 100644 index 0000000..6b7bd9a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/MediaEntry.php @@ -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 + * @subpackage App + * @copyright Copyright (c) 2005-2009 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_Gdata_MediaMimeStream + */ +require_once 'Zend/Gdata/MediaMimeStream.php'; + +/** + * Concrete class for working with Atom entries containing multi-part data. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2009 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; + + /** + * 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->_mediaSource = $mediaSource; + } + + /** + * Return the MIME multipart representation of this MediaEntry. + * + * @return string|Zend_Gdata_MediaMimeStream The MIME multipart + * representation of this MediaEntry. If the entry consisted only + * of XML, a string is returned. + */ + public function encode() + { + $xmlData = $this->saveXML(); + $mediaSource = $this->getMediaSource(); + if ($mediaSource === null) { + // No attachment, just send XML for entry + return $xmlData; + } else { + return new Zend_Gdata_MediaMimeStream($xmlData, + $mediaSource->getFilename(), $mediaSource->getContentType()); + } + } + + /** + * 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/MediaFileSource.php b/applications/core/lib/Zend/Gdata/App/MediaFileSource.php new file mode 100644 index 0000000..f749b1d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/MediaFileSource.php @@ -0,0 +1,145 @@ +<?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 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_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 + * @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_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(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/MediaSource.php b/applications/core/lib/Zend/Gdata/App/MediaSource.php new file mode 100644 index 0000000..6288569 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/MediaSource.php @@ -0,0 +1,72 @@ +<?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 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 + */ + +/** + * Interface for defining data that can be encoded and sent over the network. + * + * @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 + */ +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(); +} diff --git a/applications/core/lib/Zend/Gdata/App/Util.php b/applications/core/lib/Zend/Gdata/App/Util.php new file mode 100644 index 0000000..a31ed8e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/Util.php @@ -0,0 +1,111 @@ +<?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 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 + */ + +/** + * Utility class for static functions needed by Zend_Gdata_App + * + * @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_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); + } + } + + /** Find the greatest key that is less than or equal to a given upper + * bound, and return the value associated with that key. + * + * @param integer|null $maximumKey The upper bound for keys. If null, the + * maxiumum valued key will be found. + * @param array $collection An two-dimensional array of key/value pairs + * to search through. + * @returns mixed The value corresponding to the located key. + * @throws Zend_Gdata_App_Exception Thrown if $collection is empty. + */ + public static function findGreatestBoundedValue($maximumKey, $collection) + { + $found = false; + $foundKey = $maximumKey; + + // Sanity check: Make sure that the collection isn't empty + if (sizeof($collection) == 0) { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception("Empty namespace collection encountered."); + } + + if ($maximumKey === null) { + // If the key is null, then we return the maximum available + $keys = array_keys($collection); + sort($keys); + $found = true; + $foundKey = end($keys); + } else { + // Otherwise, we optimistically guess that the current version + // will have a matching namespce. If that fails, we decrement the + // version until we find a match. + while (!$found && $foundKey >= 0) { + if (array_key_exists($foundKey, $collection)) + $found = true; + else + $foundKey--; + } + } + + // Guard: A namespace wasn't found. Either none were registered, or + // the current protcol version is lower than the maximum namespace. + if (!$found) { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception("Namespace compatible with current protocol not found."); + } + + return $foundKey; + } + +} diff --git a/applications/core/lib/Zend/Gdata/App/VersionException.php b/applications/core/lib/Zend/Gdata/App/VersionException.php new file mode 100644 index 0000000..c3f3892 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/App/VersionException.php @@ -0,0 +1,41 @@ +<?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 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 + */ + +/** + * Zend_Gdata_App_Exception + */ +require_once 'Zend/Gdata/App/Exception.php'; + +/** + * Gdata APP exceptions + * + * Class to represent version exceptions that occur during Gdata APP operations. + * + * @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_VersionException extends Zend_Gdata_App_Exception +{ +} diff --git a/applications/core/lib/Zend/Gdata/AuthSub.php b/applications/core/lib/Zend/Gdata/AuthSub.php new file mode 100644 index 0000000..869df98 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/AuthSub.php @@ -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 + * @subpackage 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 + * @subpackage 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); + + if ($client instanceof Zend_Gdata_HttpClient) { + $filterResult = $client->filterHttpRequest('GET', $request_uri); + $url = $filterResult['url']; + $headers = $filterResult['headers']; + $client->setHeaders($headers); + $client->setUri($url); + $client->resetParameters(); + } else { + $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); + + 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); + } + + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Books.php b/applications/core/lib/Zend/Gdata/Books.php new file mode 100755 index 0000000..58ad43b --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books.php @@ -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 + * @subpackage Books + * @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/Gdata.php'; + +/** + * @see Zend_Gdata_DublinCore + */ +require_once 'Zend/Gdata/DublinCore.php'; + +/** + * @see Zend_Gdata_Books_CollectionEntry + */ +require_once 'Zend/Gdata/Books/CollectionEntry.php'; + +/** + * @see Zend_Gdata_Books_CollectionFeed + */ +require_once 'Zend/Gdata/Books/CollectionFeed.php'; + +/** + * @see Zend_Gdata_Books_VolumeEntry + */ +require_once 'Zend/Gdata/Books/VolumeEntry.php'; + +/** + * @see Zend_Gdata_Books_VolumeFeed + */ +require_once 'Zend/Gdata/Books/VolumeFeed.php'; + +/** + * Service class for interacting with the Books service + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books extends Zend_Gdata +{ + const VOLUME_FEED_URI = 'http://books.google.com/books/feeds/volumes'; + const MY_LIBRARY_FEED_URI = 'http://books.google.com/books/feeds/users/me/collections/library/volumes'; + const MY_ANNOTATION_FEED_URI = 'http://books.google.com/books/feeds/users/me/volumes'; + const AUTH_SERVICE_NAME = 'print'; + + /** + * Namespaces used for Zend_Gdata_Books + * + * @var array + */ + public static $namespaces = array( + array('gbs', 'http://schemas.google.com/books/2008', 1, 0), + array('dc', 'http://purl.org/dc/terms', 1, 0) + ); + + /** + * Create Zend_Gdata_Books 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_Books'); + $this->registerPackage('Zend_Gdata_Books_Extension'); + parent::__construct($client, $applicationId); + $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); + } + + /** + * Retrieves a feed of volumes. + * + * @param Zend_Gdata_Query|string|null $location (optional) The URL to + * query or a Zend_Gdata_Query object from which a URL can be + * determined. + * @return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the + * specified URL. + */ + public function getVolumeFeed($location = null) + { + if ($location == null) { + $uri = self::VOLUME_FEED_URI; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed'); + } + + /** + * Retrieves a specific volume entry. + * + * @param string|null $volumeId The volumeId of interest. + * @param Zend_Gdata_Query|string|null $location (optional) The URL to + * query or a Zend_Gdata_Query object from which a URL can be + * determined. + * @return Zend_Gdata_Books_VolumeEntry The feed of volumes found at the + * specified URL. + */ + public function getVolumeEntry($volumeId = null, $location = null) + { + if ($volumeId !== null) { + $uri = self::VOLUME_FEED_URI . "/" . $volumeId; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getEntry($uri, 'Zend_Gdata_Books_VolumeEntry'); + } + + /** + * Retrieves a feed of volumes, by default the User library feed. + * + * @param Zend_Gdata_Query|string|null $location (optional) The URL to + * query. + * @return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the + * specified URL. + */ + public function getUserLibraryFeed($location = null) + { + if ($location == null) { + $uri = self::MY_LIBRARY_FEED_URI; + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed'); + } + + /** + * Retrieves a feed of volumes, by default the User annotation feed + * + * @param Zend_Gdata_Query|string|null $location (optional) The URL to + * query. + * @return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the + * specified URL. + */ + public function getUserAnnotationFeed($location = null) + { + if ($location == null) { + $uri = self::MY_ANNOTATION_FEED_URI; + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed'); + } + + /** + * Insert a Volume / Annotation + * + * @param Zend_Gdata_Books_VolumeEntry $entry + * @param Zend_Gdata_Query|string|null $location (optional) The URL to + * query + * @return Zend_Gdata_Books_VolumeEntry The inserted volume entry. + */ + public function insertVolume($entry, $location = null) + { + if ($location == null) { + $uri = self::MY_LIBRARY_FEED_URI; + } else { + $uri = $location; + } + return parent::insertEntry( + $entry, $uri, 'Zend_Gdata_Books_VolumeEntry'); + } + + /** + * Delete a Volume + * + * @param Zend_Gdata_Books_VolumeEntry $entry + * @return void + */ + public function deleteVolume($entry) + { + $entry->delete(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Books/CollectionEntry.php b/applications/core/lib/Zend/Gdata/Books/CollectionEntry.php new file mode 100644 index 0000000..11b6166 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/CollectionEntry.php @@ -0,0 +1,57 @@ +<?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 Books + * @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'; + +/** + * Describes an entry in a feed of collections + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_CollectionEntry extends Zend_Gdata_Entry +{ + + /** + * Constructor for Zend_Gdata_Books_CollectionEntry which + * Describes an entry in a feed of collections + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct($element); + } + + +} + diff --git a/applications/core/lib/Zend/Gdata/Books/CollectionFeed.php b/applications/core/lib/Zend/Gdata/Books/CollectionFeed.php new file mode 100644 index 0000000..6462819 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/CollectionFeed.php @@ -0,0 +1,63 @@ +<?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 Books + * @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'; + +/** + * Describes a Book Search collection feed + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_CollectionFeed extends Zend_Gdata_Feed +{ + + /** + * Constructor for Zend_Gdata_Books_CollectionFeed which + * Describes a Book Search collection feed + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct($element); + } + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Books_CollectionEntry'; + +} + diff --git a/applications/core/lib/Zend/Gdata/Books/Extension/AnnotationLink.php b/applications/core/lib/Zend/Gdata/Books/Extension/AnnotationLink.php new file mode 100644 index 0000000..eed67ba --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/Extension/AnnotationLink.php @@ -0,0 +1,64 @@ +<?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 Books + * @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_Books_Extension_BooksLink + */ +require_once 'Zend/Gdata/Books/Extension/BooksLink.php'; + +/** + * Describes an annotation link + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_Extension_AnnotationLink extends + Zend_Gdata_Books_Extension_BooksLink +{ + + /** + * Constructor for Zend_Gdata_Books_Extension_AnnotationLink which + * Describes an annotation link + * + * @param string|null $href Linked resource URI + * @param string|null $rel Forward relationship + * @param string|null $type Resource MIME type + * @param string|null $hrefLang Resource language + * @param string|null $title Human-readable resource title + * @param string|null $length Resource length in octets + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($href = null, $rel = null, $type = null, + $hrefLang = null, $title = null, $length = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct($href, $rel, $type, $hrefLang, $title, $length); + } + +} + diff --git a/applications/core/lib/Zend/Gdata/Books/Extension/BooksCategory.php b/applications/core/lib/Zend/Gdata/Books/Extension/BooksCategory.php new file mode 100644 index 0000000..4568bdb --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/Extension/BooksCategory.php @@ -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 + * @subpackage Books + * @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_Category + */ +require_once 'Zend/Gdata/App/Extension/Category.php'; + +/** + * Describes a books category + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_Extension_BooksCategory extends + Zend_Gdata_App_Extension_Category +{ + + /** + * Constructor for Zend_Gdata_Books_Extension_BooksCategory which + * Describes a books category + * + * @param string|null $term An identifier representing the category within + * the categorization scheme. + * @param string|null $scheme A string containing a URI identifying the + * categorization scheme. + * @param string|null $label A human-readable label for display in + * end-user applications. + */ + public function __construct($term = null, $scheme = null, $label = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct($term, $scheme, $label); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Books/Extension/BooksLink.php b/applications/core/lib/Zend/Gdata/Books/Extension/BooksLink.php new file mode 100644 index 0000000..bd2a825 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/Extension/BooksLink.php @@ -0,0 +1,62 @@ +<?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 Books + * @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_Link + */ +require_once 'Zend/Gdata/App/Extension/Link.php'; + +/** + * Extends the base Link class with Books extensions + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_Extension_BooksLink extends Zend_Gdata_App_Extension_Link +{ + + /** + * Constructor for Zend_Gdata_Books_Extension_BooksLink which + * Extends the base Link class with Books extensions + * + * @param string|null $href Linked resource URI + * @param string|null $rel Forward relationship + * @param string|null $type Resource MIME type + * @param string|null $hrefLang Resource language + * @param string|null $title Human-readable resource title + * @param string|null $length Resource length in octets + */ + public function __construct($href = null, $rel = null, $type = null, + $hrefLang = null, $title = null, $length = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct($href, $rel, $type, $hrefLang, $title, $length); + } + + +} + diff --git a/applications/core/lib/Zend/Gdata/Books/Extension/Embeddability.php b/applications/core/lib/Zend/Gdata/Books/Extension/Embeddability.php new file mode 100644 index 0000000..1ac8300 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/Extension/Embeddability.php @@ -0,0 +1,123 @@ +<?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 Books + * @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'; + +/** + * Describes an embeddability + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_Extension_Embeddability extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gbs'; + protected $_rootElement = 'embeddability'; + protected $_value = null; + + /** + * Constructor for Zend_Gdata_Books_Extension_Embeddability which + * Describes an embeddability. + * + * @param string|null $value A programmatic value representing the book's + * embeddability. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct(); + $this->_value = $value; + } + + /** + * Retrieves DOMElement which corresponds to this element and all + * child properties. This is used to build this object back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistance. + * + * @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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc); + if ($this->_value !== null) { + $element->setAttribute('value', $this->_value); + } + return $element; + } + + /** + * Extracts XML attributes from the DOM and converts them to the + * appropriate object members. + * + * @param DOMNode $attribute The DOMNode attribute to be handled. + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'value': + $this->_value = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Returns the programmatic value that describes the embeddability of a + * volume in Google Book Search + * + * @return string|null The value + */ + public function getValue() + { + return $this->_value; + } + + /** + * Sets the programmatic value that describes the embeddability of a + * volume in Google Book Search + * + * @param string|null $value Programmatic value that describes the + * embeddability of a volume in Google Book Search + * @return Zend_Gdata_Books_Extension_Embeddability Provides a fluent + * interface + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + +} + diff --git a/applications/core/lib/Zend/Gdata/Books/Extension/InfoLink.php b/applications/core/lib/Zend/Gdata/Books/Extension/InfoLink.php new file mode 100644 index 0000000..53fa3a7 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/Extension/InfoLink.php @@ -0,0 +1,61 @@ +<?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 Books + * @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_Books_Extension_BooksLink + */ +require_once 'Zend/Gdata/Books/Extension/BooksLink.php'; + +/** + * Describes an info link + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_Extension_InfoLink extends + Zend_Gdata_Books_Extension_BooksLink +{ + + /** + * Constructor for Zend_Gdata_Books_Extension_InfoLink which + * Describes an info link + * + * @param string|null $href Linked resource URI + * @param string|null $rel Forward relationship + * @param string|null $type Resource MIME type + * @param string|null $hrefLang Resource language + * @param string|null $title Human-readable resource title + * @param string|null $length Resource length in octets + */ + public function __construct($href = null, $rel = null, $type = null, + $hrefLang = null, $title = null, $length = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct($href, $rel, $type, $hrefLang, $title, $length); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Books/Extension/PreviewLink.php b/applications/core/lib/Zend/Gdata/Books/Extension/PreviewLink.php new file mode 100644 index 0000000..d88dc93 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/Extension/PreviewLink.php @@ -0,0 +1,61 @@ +<?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 Books + * @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_Books_Extension_BooksLink + */ +require_once 'Zend/Gdata/Books/Extension/BooksLink.php'; + +/** + * Describes a preview link + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_Extension_PreviewLink extends + Zend_Gdata_Books_Extension_BooksLink +{ + + /** + * Constructor for Zend_Gdata_Books_Extension_PreviewLink which + * Describes a preview link + * + * @param string|null $href Linked resource URI + * @param string|null $rel Forward relationship + * @param string|null $type Resource MIME type + * @param string|null $hrefLang Resource language + * @param string|null $title Human-readable resource title + * @param string|null $length Resource length in octets + */ + public function __construct($href = null, $rel = null, $type = null, + $hrefLang = null, $title = null, $length = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct($href, $rel, $type, $hrefLang, $title, $length); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Books/Extension/Review.php b/applications/core/lib/Zend/Gdata/Books/Extension/Review.php new file mode 100644 index 0000000..289db02 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/Extension/Review.php @@ -0,0 +1,153 @@ +<?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 Books + * @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'; + +/** + * User-provided review + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_Extension_Review extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gbs'; + protected $_rootElement = 'review'; + protected $_lang = null; + protected $_type = null; + + /** + * Constructor for Zend_Gdata_Books_Extension_Review which + * User-provided review + * + * @param string|null $lang Review language. + * @param string|null $type Type of text construct (typically text, html, + * or xhtml). + * @param string|null $value Text content of the review. + */ + public function __construct($lang = null, $type = null, $value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct(); + $this->_lang = $lang; + $this->_type = $type; + $this->_text = $value; + } + + /** + * Retrieves DOMElement which corresponds to this element and all + * child properties. This is used to build this object back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistance. + * + * @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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc); + if ($this->_lang !== null) { + $element->setAttribute('lang', $this->_lang); + } + if ($this->_type !== null) { + $element->setAttribute('type', $this->_type); + } + return $element; + } + + /** + * Extracts XML attributes from the DOM and converts them to the + * appropriate object members. + * + * @param DOMNode $attribute The DOMNode attribute to be handled. + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'lang': + $this->_lang = $attribute->nodeValue; + break; + case 'type': + $this->_type = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Returns the language of link title + * + * @return string The lang + */ + public function getLang() + { + return $this->_lang; + } + + /** + * Returns the type of text construct (typically 'text', 'html' or 'xhtml') + * + * @return string The type + */ + public function getType() + { + return $this->_type; + } + + /** + * Sets the language of link title + * + * @param string $lang language of link title + * @return Zend_Gdata_Books_Extension_Review Provides a fluent interface + */ + public function setLang($lang) + { + $this->_lang = $lang; + return $this; + } + + /** + * Sets the type of text construct (typically 'text', 'html' or 'xhtml') + * + * @param string $type type of text construct (typically 'text', 'html' or 'xhtml') + * @return Zend_Gdata_Books_Extension_Review Provides a fluent interface + */ + public function setType($type) + { + $this->_type = $type; + return $this; + } + + +} + diff --git a/applications/core/lib/Zend/Gdata/Books/Extension/ThumbnailLink.php b/applications/core/lib/Zend/Gdata/Books/Extension/ThumbnailLink.php new file mode 100644 index 0000000..956290c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/Extension/ThumbnailLink.php @@ -0,0 +1,61 @@ +<?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 Books + * @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_Books_Extension_BooksLink + */ +require_once 'Zend/Gdata/Books/Extension/BooksLink.php'; + +/** + * Describes a thumbnail link + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_Extension_ThumbnailLink extends + Zend_Gdata_Books_Extension_BooksLink +{ + + /** + * Constructor for Zend_Gdata_Books_Extension_ThumbnailLink which + * Describes a thumbnail link + * + * @param string|null $href Linked resource URI + * @param string|null $rel Forward relationship + * @param string|null $type Resource MIME type + * @param string|null $hrefLang Resource language + * @param string|null $title Human-readable resource title + * @param string|null $length Resource length in octets + */ + public function __construct($href = null, $rel = null, $type = null, + $hrefLang = null, $title = null, $length = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct($href, $rel, $type, $hrefLang, $title, $length); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Books/Extension/Viewability.php b/applications/core/lib/Zend/Gdata/Books/Extension/Viewability.php new file mode 100644 index 0000000..56cc20a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/Extension/Viewability.php @@ -0,0 +1,124 @@ +<?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 Books + * @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'; + +/** + * Describes a viewability + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_Extension_Viewability extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gbs'; + protected $_rootElement = 'viewability'; + protected $_value = null; + + /** + * Constructor for Zend_Gdata_Books_Extension_Viewability which + * Describes a viewability + * + * @param string|null $value A programmatic value representing the book's + * viewability mode. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct(); + $this->_value = $value; + } + + /** + * Retrieves DOMElement which corresponds to this element and all + * child properties. This is used to build this object back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistance. + * + * @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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc); + if ($this->_value !== null) { + $element->setAttribute('value', $this->_value); + } + return $element; + } + + /** + * Extracts XML attributes from the DOM and converts them to the + * appropriate object members. + * + * @param DOMNode $attribute The DOMNode attribute to be handled. + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'value': + $this->_value = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Returns the programmatic value that describes the viewability of a volume + * in Google Book Search + * + * @return string The value + */ + public function getValue() + { + return $this->_value; + } + + /** + * Sets the programmatic value that describes the viewability of a volume in + * Google Book Search + * + * @param string $value programmatic value that describes the viewability + * of a volume in Googl eBook Search + * @return Zend_Gdata_Books_Extension_Viewability Provides a fluent + * interface + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + + +} + diff --git a/applications/core/lib/Zend/Gdata/Books/VolumeEntry.php b/applications/core/lib/Zend/Gdata/Books/VolumeEntry.php new file mode 100644 index 0000000..29a39b6 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/VolumeEntry.php @@ -0,0 +1,688 @@ +<?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 Books + * @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_Extension_Comments + */ +require_once 'Zend/Gdata/Extension/Comments.php'; + +/** + * @see Zend_Gdata_DublinCore_Extension_Creator + */ +require_once 'Zend/Gdata/DublinCore/Extension/Creator.php'; + +/** + * @see Zend_Gdata_DublinCore_Extension_Date + */ +require_once 'Zend/Gdata/DublinCore/Extension/Date.php'; + +/** + * @see Zend_Gdata_DublinCore_Extension_Description + */ +require_once 'Zend/Gdata/DublinCore/Extension/Description.php'; + +/** + * @see Zend_Gdata_Books_Extension_Embeddability + */ +require_once 'Zend/Gdata/Books/Extension/Embeddability.php'; + +/** + * @see Zend_Gdata_DublinCore_Extension_Format + */ +require_once 'Zend/Gdata/DublinCore/Extension/Format.php'; + +/** + * @see Zend_Gdata_DublinCore_Extension_Identifier + */ +require_once 'Zend/Gdata/DublinCore/Extension/Identifier.php'; + +/** + * @see Zend_Gdata_DublinCore_Extension_Language + */ +require_once 'Zend/Gdata/DublinCore/Extension/Language.php'; + +/** + * @see Zend_Gdata_DublinCore_Extension_Publisher + */ +require_once 'Zend/Gdata/DublinCore/Extension/Publisher.php'; + +/** + * @see Zend_Gdata_Extension_Rating + */ +require_once 'Zend/Gdata/Extension/Rating.php'; + +/** + * @see Zend_Gdata_Books_Extension_Review + */ +require_once 'Zend/Gdata/Books/Extension/Review.php'; + +/** + * @see Zend_Gdata_DublinCore_Extension_Subject + */ +require_once 'Zend/Gdata/DublinCore/Extension/Subject.php'; + +/** + * @see Zend_Gdata_DublinCore_Extension_Title + */ +require_once 'Zend/Gdata/DublinCore/Extension/Title.php'; + +/** + * @see Zend_Gdata_Books_Extension_Viewability + */ +require_once 'Zend/Gdata/Books/Extension/Viewability.php'; + +/** + * Describes an entry in a feed of Book Search volumes + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_VolumeEntry extends Zend_Gdata_Entry +{ + + const THUMBNAIL_LINK_REL = 'http://schemas.google.com/books/2008/thumbnail'; + const PREVIEW_LINK_REL = 'http://schemas.google.com/books/2008/preview'; + const INFO_LINK_REL = 'http://schemas.google.com/books/2008/info'; + const ANNOTATION_LINK_REL = 'http://schemas.google.com/books/2008/annotation'; + + protected $_comments = null; + protected $_creators = array(); + protected $_dates = array(); + protected $_descriptions = array(); + protected $_embeddability = null; + protected $_formats = array(); + protected $_identifiers = array(); + protected $_languages = array(); + protected $_publishers = array(); + protected $_rating = null; + protected $_review = null; + protected $_subjects = array(); + protected $_titles = array(); + protected $_viewability = null; + + /** + * Constructor for Zend_Gdata_Books_VolumeEntry which + * Describes an entry in a feed of Book Search volumes + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct($element); + } + + /** + * Retrieves DOMElement which corresponds to this element and all + * child properties. This is used to build this object back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistance. + * + * @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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc); + if ($this->_creators !== null) { + foreach ($this->_creators as $creators) { + $element->appendChild($creators->getDOM( + $element->ownerDocument)); + } + } + if ($this->_dates !== null) { + foreach ($this->_dates as $dates) { + $element->appendChild($dates->getDOM($element->ownerDocument)); + } + } + if ($this->_descriptions !== null) { + foreach ($this->_descriptions as $descriptions) { + $element->appendChild($descriptions->getDOM( + $element->ownerDocument)); + } + } + if ($this->_formats !== null) { + foreach ($this->_formats as $formats) { + $element->appendChild($formats->getDOM( + $element->ownerDocument)); + } + } + if ($this->_identifiers !== null) { + foreach ($this->_identifiers as $identifiers) { + $element->appendChild($identifiers->getDOM( + $element->ownerDocument)); + } + } + if ($this->_languages !== null) { + foreach ($this->_languages as $languages) { + $element->appendChild($languages->getDOM( + $element->ownerDocument)); + } + } + if ($this->_publishers !== null) { + foreach ($this->_publishers as $publishers) { + $element->appendChild($publishers->getDOM( + $element->ownerDocument)); + } + } + if ($this->_subjects !== null) { + foreach ($this->_subjects as $subjects) { + $element->appendChild($subjects->getDOM( + $element->ownerDocument)); + } + } + if ($this->_titles !== null) { + foreach ($this->_titles as $titles) { + $element->appendChild($titles->getDOM($element->ownerDocument)); + } + } + if ($this->_comments !== null) { + $element->appendChild($this->_comments->getDOM( + $element->ownerDocument)); + } + if ($this->_embeddability !== null) { + $element->appendChild($this->_embeddability->getDOM( + $element->ownerDocument)); + } + if ($this->_rating !== null) { + $element->appendChild($this->_rating->getDOM( + $element->ownerDocument)); + } + if ($this->_review !== null) { + $element->appendChild($this->_review->getDOM( + $element->ownerDocument)); + } + if ($this->_viewability !== null) { + $element->appendChild($this->_viewability->getDOM( + $element->ownerDocument)); + } + return $element; + } + + /** + * Creates individual objects of the appropriate type and stores + * them in this object 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('dc') . ':' . 'creator': + $creators = new Zend_Gdata_DublinCore_Extension_Creator(); + $creators->transferFromDOM($child); + $this->_creators[] = $creators; + break; + case $this->lookupNamespace('dc') . ':' . 'date': + $dates = new Zend_Gdata_DublinCore_Extension_Date(); + $dates->transferFromDOM($child); + $this->_dates[] = $dates; + break; + case $this->lookupNamespace('dc') . ':' . 'description': + $descriptions = new Zend_Gdata_DublinCore_Extension_Description(); + $descriptions->transferFromDOM($child); + $this->_descriptions[] = $descriptions; + break; + case $this->lookupNamespace('dc') . ':' . 'format': + $formats = new Zend_Gdata_DublinCore_Extension_Format(); + $formats->transferFromDOM($child); + $this->_formats[] = $formats; + break; + case $this->lookupNamespace('dc') . ':' . 'identifier': + $identifiers = new Zend_Gdata_DublinCore_Extension_Identifier(); + $identifiers->transferFromDOM($child); + $this->_identifiers[] = $identifiers; + break; + case $this->lookupNamespace('dc') . ':' . 'language': + $languages = new Zend_Gdata_DublinCore_Extension_Language(); + $languages->transferFromDOM($child); + $this->_languages[] = $languages; + break; + case $this->lookupNamespace('dc') . ':' . 'publisher': + $publishers = new Zend_Gdata_DublinCore_Extension_Publisher(); + $publishers->transferFromDOM($child); + $this->_publishers[] = $publishers; + break; + case $this->lookupNamespace('dc') . ':' . 'subject': + $subjects = new Zend_Gdata_DublinCore_Extension_Subject(); + $subjects->transferFromDOM($child); + $this->_subjects[] = $subjects; + break; + case $this->lookupNamespace('dc') . ':' . 'title': + $titles = new Zend_Gdata_DublinCore_Extension_Title(); + $titles->transferFromDOM($child); + $this->_titles[] = $titles; + break; + case $this->lookupNamespace('gd') . ':' . 'comments': + $comments = new Zend_Gdata_Extension_Comments(); + $comments->transferFromDOM($child); + $this->_comments = $comments; + break; + case $this->lookupNamespace('gbs') . ':' . 'embeddability': + $embeddability = new Zend_Gdata_Books_Extension_Embeddability(); + $embeddability->transferFromDOM($child); + $this->_embeddability = $embeddability; + break; + case $this->lookupNamespace('gd') . ':' . 'rating': + $rating = new Zend_Gdata_Extension_Rating(); + $rating->transferFromDOM($child); + $this->_rating = $rating; + break; + case $this->lookupNamespace('gbs') . ':' . 'review': + $review = new Zend_Gdata_Books_Extension_Review(); + $review->transferFromDOM($child); + $this->_review = $review; + break; + case $this->lookupNamespace('gbs') . ':' . 'viewability': + $viewability = new Zend_Gdata_Books_Extension_Viewability(); + $viewability->transferFromDOM($child); + $this->_viewability = $viewability; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Returns the Comments class + * + * @return Zend_Gdata_Extension_Comments|null The comments + */ + public function getComments() + { + return $this->_comments; + } + + /** + * Returns the creators + * + * @return array The creators + */ + public function getCreators() + { + return $this->_creators; + } + + /** + * Returns the dates + * + * @return array The dates + */ + public function getDates() + { + return $this->_dates; + } + + /** + * Returns the descriptions + * + * @return array The descriptions + */ + public function getDescriptions() + { + return $this->_descriptions; + } + + /** + * Returns the embeddability + * + * @return Zend_Gdata_Books_Extension_Embeddability|null The embeddability + */ + public function getEmbeddability() + { + return $this->_embeddability; + } + + /** + * Returns the formats + * + * @return array The formats + */ + public function getFormats() + { + return $this->_formats; + } + + /** + * Returns the identifiers + * + * @return array The identifiers + */ + public function getIdentifiers() + { + return $this->_identifiers; + } + + /** + * Returns the languages + * + * @return array The languages + */ + public function getLanguages() + { + return $this->_languages; + } + + /** + * Returns the publishers + * + * @return array The publishers + */ + public function getPublishers() + { + return $this->_publishers; + } + + /** + * Returns the rating + * + * @return Zend_Gdata_Extension_Rating|null The rating + */ + public function getRating() + { + return $this->_rating; + } + + /** + * Returns the review + * + * @return Zend_Gdata_Books_Extension_Review|null The review + */ + public function getReview() + { + return $this->_review; + } + + /** + * Returns the subjects + * + * @return array The subjects + */ + public function getSubjects() + { + return $this->_subjects; + } + + /** + * Returns the titles + * + * @return array The titles + */ + public function getTitles() + { + return $this->_titles; + } + + /** + * Returns the viewability + * + * @return Zend_Gdata_Books_Extension_Viewability|null The viewability + */ + public function getViewability() + { + return $this->_viewability; + } + + /** + * Sets the Comments class + * + * @param Zend_Gdata_Extension_Comments|null $comments Comments class + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setComments($comments) + { + $this->_comments = $comments; + return $this; + } + + /** + * Sets the creators + * + * @param array $creators Creators|null + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setCreators($creators) + { + $this->_creators = $creators; + return $this; + } + + /** + * Sets the dates + * + * @param array $dates dates + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setDates($dates) + { + $this->_dates = $dates; + return $this; + } + + /** + * Sets the descriptions + * + * @param array $descriptions descriptions + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setDescriptions($descriptions) + { + $this->_descriptions = $descriptions; + return $this; + } + + /** + * Sets the embeddability + * + * @param Zend_Gdata_Books_Extension_Embeddability|null $embeddability + * embeddability + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setEmbeddability($embeddability) + { + $this->_embeddability = $embeddability; + return $this; + } + + /** + * Sets the formats + * + * @param array $formats formats + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setFormats($formats) + { + $this->_formats = $formats; + return $this; + } + + /** + * Sets the identifiers + * + * @param array $identifiers identifiers + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setIdentifiers($identifiers) + { + $this->_identifiers = $identifiers; + return $this; + } + + /** + * Sets the languages + * + * @param array $languages languages + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setLanguages($languages) + { + $this->_languages = $languages; + return $this; + } + + /** + * Sets the publishers + * + * @param array $publishers publishers + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setPublishers($publishers) + { + $this->_publishers = $publishers; + return $this; + } + + /** + * Sets the rating + * + * @param Zend_Gdata_Extension_Rating|null $rating rating + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setRating($rating) + { + $this->_rating = $rating; + return $this; + } + + /** + * Sets the review + * + * @param Zend_Gdata_Books_Extension_Review|null $review review + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setReview($review) + { + $this->_review = $review; + return $this; + } + + /** + * Sets the subjects + * + * @param array $subjects subjects + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setSubjects($subjects) + { + $this->_subjects = $subjects; + return $this; + } + + /** + * Sets the titles + * + * @param array $titles titles + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setTitles($titles) + { + $this->_titles = $titles; + return $this; + } + + /** + * Sets the viewability + * + * @param Zend_Gdata_Books_Extension_Viewability|null $viewability + * viewability + * @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface + */ + public function setViewability($viewability) + { + $this->_viewability = $viewability; + return $this; + } + + + /** + * Gets the volume ID based upon the atom:id value + * + * @return string The volume ID + * @throws Zend_Gdata_App_Exception + */ + public function getVolumeId() + { + $fullId = $this->getId()->getText(); + $position = strrpos($fullId, '/'); + if ($position === false) { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('Slash not found in atom:id'); + } else { + return substr($fullId, strrpos($fullId,'/') + 1); + } + } + + /** + * Gets the thumbnail link + * + * @return Zend_Gdata_App_Extension_link|null The thumbnail link + */ + public function getThumbnailLink() + { + return $this->getLink(self::THUMBNAIL_LINK_REL); + } + + /** + * Gets the preview link + * + * @return Zend_Gdata_App_Extension_Link|null The preview link + */ + public function getPreviewLink() + { + return $this->getLink(self::PREVIEW_LINK_REL); + } + + /** + * Gets the info link + * + * @return Zend_Gdata_App_Extension_Link|null The info link + */ + public function getInfoLink() + { + return $this->getLink(self::INFO_LINK_REL); + } + + /** + * Gets the annotations link + * + * @return Zend_Gdata_App_Extension_Link|null The annotations link + */ + public function getAnnotationLink() + { + return $this->getLink(self::ANNOTATION_LINK_REL); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Books/VolumeFeed.php b/applications/core/lib/Zend/Gdata/Books/VolumeFeed.php new file mode 100644 index 0000000..24eb952 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/VolumeFeed.php @@ -0,0 +1,63 @@ +<?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 Books + * @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'; + +/** + * Describes a Book Search volume feed + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_VolumeFeed extends Zend_Gdata_Feed +{ + + /** + * Constructor for Zend_Gdata_Books_VolumeFeed which + * Describes a Book Search volume feed + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); + parent::__construct($element); + } + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Books_VolumeEntry'; + +} + diff --git a/applications/core/lib/Zend/Gdata/Books/VolumeQuery.php b/applications/core/lib/Zend/Gdata/Books/VolumeQuery.php new file mode 100755 index 0000000..08c6b24 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Books/VolumeQuery.php @@ -0,0 +1,111 @@ +<?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 Books + * @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_Books + */ +require_once('Zend/Gdata/Books.php'); + +/** + * Zend_Gdata_Query + */ +require_once('Zend/Gdata/Query.php'); + +/** + * Assists in constructing queries for Books volumes + * + * @category Zend + * @package Zend_Gdata + * @subpackage Books + * @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_Books_VolumeQuery extends Zend_Gdata_Query +{ + + /** + * Create Gdata_Books_VolumeQuery object + * + * @param string|null $url If non-null, pre-initializes the instance to + * use a given URL. + */ + public function __construct($url = null) + { + parent::__construct($url); + } + + /** + * Sets the minimum level of viewability of volumes to return in the search results + * + * @param string|null $value The minimum viewability - 'full' or 'partial' + * @return Zend_Gdata_Books_VolumeQuery Provides a fluent interface + */ + public function setMinViewability($value = null) + { + switch ($value) { + case 'full_view': + $this->_params['min-viewability'] = 'full'; + break; + case 'partial_view': + $this->_params['min-viewability'] = 'partial'; + break; + case null: + unset($this->_params['min-viewability']); + break; + } + return $this; + } + + /** + * Minimum viewability of volumes to include in search results + * + * @return string|null min-viewability + */ + public function getMinViewability() + { + if (array_key_exists('min-viewability', $this->_params)) { + return $this->_params['min-viewability']; + } else { + return null; + } + } + + /** + * Returns the generated full query URL + * + * @return string The URL + */ + public function getQueryUrl() + { + if (isset($this->_url)) { + $url = $this->_url; + } else { + $url = Zend_Gdata_Books::VOLUME_FEED_URI; + } + if ($this->getCategory() !== null) { + $url .= '/-/' . $this->getCategory(); + } + $url = $url . $this->getQueryString(); + return $url; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar.php b/applications/core/lib/Zend/Gdata/Calendar.php new file mode 100644 index 0000000..34d6909 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar.php @@ -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 + * @subpackage Calendar + * @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_Calendar_EventFeed + */ +require_once 'Zend/Gdata/Calendar/EventFeed.php'; + +/** + * @see Zend_Gdata_Calendar_EventEntry + */ +require_once 'Zend/Gdata/Calendar/EventEntry.php'; + +/** + * @see Zend_Gdata_Calendar_ListFeed + */ +require_once 'Zend/Gdata/Calendar/ListFeed.php'; + +/** + * @see Zend_Gdata_Calendar_ListEntry + */ +require_once 'Zend/Gdata/Calendar/ListEntry.php'; + +/** + * Service class for interacting with the Google Calendar data API + * @link http://code.google.com/apis/gdata/calendar.html + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar extends Zend_Gdata +{ + + const CALENDAR_FEED_URI = 'http://www.google.com/calendar/feeds'; + const CALENDAR_EVENT_FEED_URI = 'http://www.google.com/calendar/feeds/default/private/full'; + const AUTH_SERVICE_NAME = 'cl'; + + protected $_defaultPostUri = self::CALENDAR_EVENT_FEED_URI; + + /** + * Namespaces used for Zend_Gdata_Calendar + * + * @var array + */ + public static $namespaces = array( + array('gCal', 'http://schemas.google.com/gCal/2005', 1, 0) + ); + + /** + * Create Gdata_Calendar 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_Calendar'); + $this->registerPackage('Zend_Gdata_Calendar_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_Calendar_EventFeed + */ + public function getCalendarEventFeed($location = null) + { + if ($location == null) { + $uri = self::CALENDAR_EVENT_FEED_URI; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Calendar_EventFeed'); + } + + /** + * Retreive entry object + * + * @return Zend_Gdata_Calendar_EventEntry + */ + public function getCalendarEventEntry($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_Calendar_EventEntry'); + } + + + /** + * Retrieve feed object + * + * @return Zend_Gdata_Calendar_ListFeed + */ + public function getCalendarListFeed() + { + $uri = self::CALENDAR_FEED_URI . '/default'; + return parent::getFeed($uri,'Zend_Gdata_Calendar_ListFeed'); + } + + /** + * Retreive entryobject + * + * @return Zend_Gdata_Calendar_ListEntry + */ + public function getCalendarListEntry($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_Calendar_ListEntry'); + } + + public function insertEvent($event, $uri=null) + { + if ($uri == null) { + $uri = $this->_defaultPostUri; + } + $newEvent = $this->insertEntry($event, $uri, 'Zend_Gdata_Calendar_EventEntry'); + return $newEvent; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/EventEntry.php b/applications/core/lib/Zend/Gdata/Calendar/EventEntry.php new file mode 100644 index 0000000..f2fc6be --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/EventEntry.php @@ -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 + * @subpackage Calendar + * @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_Kind_EventEntry + */ +require_once 'Zend/Gdata/Kind/EventEntry.php'; + +/** + * @see Zend_Gdata_Calendar_Extension_SendEventNotifications + */ +require_once 'Zend/Gdata/Calendar/Extension/SendEventNotifications.php'; + +/** + * @see Zend_Gdata_Calendar_Extension_Timezone + */ +require_once 'Zend/Gdata/Calendar/Extension/Timezone.php'; + +/** + * @see Zend_Gdata_Calendar_Extension_Link + */ +require_once 'Zend/Gdata/Calendar/Extension/Link.php'; + +/** + * @see Zend_Gdata_Calendar_Extension_QuickAdd + */ +require_once 'Zend/Gdata/Calendar/Extension/QuickAdd.php'; + +/** + * Data model class for a Google Calendar Event Entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_EventEntry extends Zend_Gdata_Kind_EventEntry +{ + + protected $_entryClassName = 'Zend_Gdata_Calendar_EventEntry'; + protected $_sendEventNotifications = null; + protected $_timezone = null; + protected $_quickadd = null; + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_sendEventNotifications != null) { + $element->appendChild($this->_sendEventNotifications->getDOM($element->ownerDocument)); + } + if ($this->_timezone != null) { + $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); + } + if ($this->_quickadd != null) { + $element->appendChild($this->_quickadd->getDOM($element->ownerDocument)); + } + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + + switch ($absoluteNodeName) { + case $this->lookupNamespace('gCal') . ':' . 'sendEventNotifications'; + $sendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications(); + $sendEventNotifications->transferFromDOM($child); + $this->_sendEventNotifications = $sendEventNotifications; + break; + case $this->lookupNamespace('gCal') . ':' . 'timezone'; + $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); + $timezone->transferFromDOM($child); + $this->_timezone = $timezone; + break; + case $this->lookupNamespace('atom') . ':' . 'link'; + $link = new Zend_Gdata_Calendar_Extension_Link(); + $link->transferFromDOM($child); + $this->_link[] = $link; + break; + case $this->lookupNamespace('gCal') . ':' . 'quickadd'; + $quickadd = new Zend_Gdata_Calendar_Extension_QuickAdd(); + $quickadd->transferFromDOM($child); + $this->_quickadd = $quickadd; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getSendEventNotifications() + { + return $this->_sendEventNotifications; + } + + public function setSendEventNotifications($value) + { + $this->_sendEventNotifications = $value; + return $this; + } + + public function getTimezone() + { + return $this->_timezone; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Timezone $value + * @return Zend_Gdata_Extension_EventEntry Provides a fluent interface + */ + public function setTimezone($value) + { + $this->_timezone = $value; + return $this; + } + + public function getQuickAdd() + { + return $this->_quickadd; + } + + /** + * @param Zend_Gdata_Calendar_Extension_QuickAdd $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setQuickAdd($value) + { + $this->_quickadd = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/EventFeed.php b/applications/core/lib/Zend/Gdata/Calendar/EventFeed.php new file mode 100644 index 0000000..ac0d566 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/EventFeed.php @@ -0,0 +1,105 @@ +<?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 Calendar + * @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'; + +/** + * @see Zend_Gdata_Extension_Timezone + */ +require_once 'Zend/Gdata/Calendar/Extension/Timezone.php'; + +/** + * Data model for a Google Calendar feed of events + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_EventFeed extends Zend_Gdata_Feed +{ + + protected $_timezone = null; + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Calendar_EventEntry'; + + /** + * The classname for the feed. + * + * @var string + */ + protected $_feedClassName = 'Zend_Gdata_Calendar_EventFeed'; + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_timezone != null) { + $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); + } + + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + + switch ($absoluteNodeName) { + case $this->lookupNamespace('gCal') . ':' . 'timezone'; + $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); + $timezone->transferFromDOM($child); + $this->_timezone = $timezone; + break; + + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getTimezone() + { + return $this->_timezone; + } + + public function setTimezone($value) + { + $this->_timezone = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/EventQuery.php b/applications/core/lib/Zend/Gdata/Calendar/EventQuery.php new file mode 100644 index 0000000..237c379 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/EventQuery.php @@ -0,0 +1,446 @@ +<?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 Calendar + * @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_util + */ +require_once('Zend/Gdata/App/Util.php'); + +/** + * Zend_Gdata_Query + */ +require_once('Zend/Gdata/Query.php'); + +/** + * Assists in constructing queries for Google Calendar events + * + * @link http://code.google.com/apis/gdata/calendar/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_EventQuery extends Zend_Gdata_Query +{ + + const CALENDAR_FEED_URI = 'http://www.google.com/calendar/feeds'; + + protected $_defaultFeedUri = self::CALENDAR_FEED_URI; + protected $_comments = null; + protected $_user = null; + protected $_visibility = null; + protected $_projection = null; + protected $_event = null; + + /** + * Create Gdata_Calendar_EventQuery object. If a URL is provided, + * it becomes the base URL, and additional URL components may be + * appended. For instance, if $url is 'http://www.foo.com', the + * default URL constructed will be 'http://www.foo.com/default/public/full' + * + * @param string $url The URL to use as the base path for requests + */ + public function __construct($url = null) + { + parent::__construct($url); + } + + /** + * @param string $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setComments($value) + { + $this->_comments = $value; + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setEvent($value) + { + $this->_event = $value; + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setProjection($value) + { + $this->_projection = $value; + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setUser($value) + { + $this->_user = $value; + return $this; + } + + /** + * @param bool $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setVisibility($value) + { + $this->_visibility = $value; + return $this; + } + + /** + * @return string comments + */ + public function getComments() + { + return $this->_comments; + } + + /** + * @return string event + */ + public function getEvent() + { + return $this->_event; + } + + /** + * @return string projection + */ + public function getProjection() + { + return $this->_projection; + } + + /** + * @return string user + */ + public function getUser() + { + return $this->_user; + } + + /** + * @return string visibility + */ + public function getVisibility() + { + return $this->_visibility; + } + + /** + * @param int $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setStartMax($value) + { + if ($value != null) { + $this->_params['start-max'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['start-max']); + } + return $this; + } + + /** + * @param int $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setStartMin($value) + { + if ($value != null) { + $this->_params['start-min'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['start-min']); + } + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setOrderBy($value) + { + if ($value != null) { + $this->_params['orderby'] = $value; + } else { + unset($this->_params['orderby']); + } + return $this; + } + + /** + * @return int start-max + */ + public function getStartMax() + { + if (array_key_exists('start-max', $this->_params)) { + return $this->_params['start-max']; + } else { + return null; + } + } + + /** + * @return int start-min + */ + public function getStartMin() + { + if (array_key_exists('start-min', $this->_params)) { + return $this->_params['start-min']; + } 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 sortorder + */ + public function setSortOrder($value) + { + if ($value != null) { + $this->_params['sortorder'] = $value; + } else { + unset($this->_params['sortorder']); + } + return $this; + } + + /** + * @return string recurrence-expansion-start + */ + public function getRecurrenceExpansionStart() + { + if (array_key_exists('recurrence-expansion-start', $this->_params)) { + return $this->_params['recurrence-expansion-start']; + } else { + return null; + } + } + + /** + * @return string recurrence-expansion-start + */ + public function setRecurrenceExpansionStart($value) + { + if ($value != null) { + $this->_params['recurrence-expansion-start'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['recurrence-expansion-start']); + } + return $this; + } + + + /** + * @return string recurrence-expansion-end + */ + public function getRecurrenceExpansionEnd() + { + if (array_key_exists('recurrence-expansion-end', $this->_params)) { + return $this->_params['recurrence-expansion-end']; + } else { + return null; + } + } + + /** + * @return string recurrence-expansion-end + */ + public function setRecurrenceExpansionEnd($value) + { + if ($value != null) { + $this->_params['recurrence-expansion-end'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['recurrence-expansion-end']); + } + return $this; + } + + /** + * @param string $value Also accepts bools. + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function getSingleEvents() + { + if (array_key_exists('singleevents', $this->_params)) { + $value = $this->_params['singleevents']; + switch ($value) { + case 'true': + return true; + break; + case 'false': + return false; + break; + default: + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Invalid query param value for futureevents: ' . + $value . ' It must be a boolean.'); + } + } else { + return null; + } + } + + /** + * @param string $value Also accepts bools. If using a string, must be either "true" or "false". + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setSingleEvents($value) + { + if ($value !== null) { + if (is_bool($value)) { + $this->_params['singleevents'] = ($value?'true':'false'); + } elseif ($value == 'true' | $value == 'false') { + $this->_params['singleevents'] = $value; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Invalid query param value for futureevents: ' . + $value . ' It must be a boolean.'); + } + } else { + unset($this->_params['singleevents']); + } + return $this; + } + + /** + * @return string futureevents + */ + public function getFutureEvents() + { + if (array_key_exists('futureevents', $this->_params)) { + $value = $this->_params['futureevents']; + switch ($value) { + case 'true': + return true; + break; + case 'false': + return false; + break; + default: + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Invalid query param value for futureevents: ' . + $value . ' It must be a boolean.'); + } + } else { + return null; + } + } + + /** + * @param string $value Also accepts bools. If using a string, must be either "true" or "false" or + * an exception will be thrown on retrieval. + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setFutureEvents($value) + { + if ($value !== null) { + if (is_bool($value)) { + $this->_params['futureevents'] = ($value?'true':'false'); + } elseif ($value == 'true' | $value == 'false') { + $this->_params['futureevents'] = $value; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Invalid query param value for futureevents: ' . + $value . ' It must be a boolean.'); + } + } else { + unset($this->_params['futureevents']); + } + return $this; + } + + /** + * @return string url + */ + public function getQueryUrl() + { + if (isset($this->_url)) { + $uri = $this->_url; + } else { + $uri = $this->_defaultFeedUri; + } + if ($this->getUser() != null) { + $uri .= '/' . $this->getUser(); + } else { + $uri .= '/default'; + } + if ($this->getVisibility() != null) { + $uri .= '/' . $this->getVisibility(); + } else { + $uri .= '/public'; + } + if ($this->getProjection() != null) { + $uri .= '/' . $this->getProjection(); + } else { + $uri .= '/full'; + } + if ($this->getEvent() != null) { + $uri .= '/' . $this->getEvent(); + if ($this->getComments() != null) { + $uri .= '/comments/' . $this->getComments(); + } + } + $uri .= $this->getQueryString(); + return $uri; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/Extension/AccessLevel.php b/applications/core/lib/Zend/Gdata/Calendar/Extension/AccessLevel.php new file mode 100644 index 0000000..440b9cb --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/Extension/AccessLevel.php @@ -0,0 +1,129 @@ +<?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 Calendar + * @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 + */ +require_once 'Zend/Gdata/Calendar.php'; + +/** + * Represents the gCal:accessLevel element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_Extension_AccessLevel extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'accesslevel'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_AccessLevel object. + * @param string $value (optional) The text content of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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 attribute being modified. + */ + 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_Calendar_Extension_Selected 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(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/Extension/Color.php b/applications/core/lib/Zend/Gdata/Calendar/Extension/Color.php new file mode 100644 index 0000000..12c12fd --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/Extension/Color.php @@ -0,0 +1,124 @@ +<?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 Calendar + * @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 gCal:color element used by the Calendar data API + * to define the color of a calendar in the UI. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_Extension_Color extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'color'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Color object. + * @param string $value (optional) The text content of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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 value associated with this 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_Calendar_Extension_Color 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->_value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/Extension/Hidden.php b/applications/core/lib/Zend/Gdata/Calendar/Extension/Hidden.php new file mode 100644 index 0000000..4738d2a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/Extension/Hidden.php @@ -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 + * @subpackage Calendar + * @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 gCal:hidden element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_Extension_Hidden extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'hidden'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Hidden object. + * @param bool $value (optional) The value of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value !== null) { + $element->setAttribute('value', ($this->_value ? "true" : "false")); + } + 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': + if ($attribute->nodeValue == "true") { + $this->_value = true; + } + else if ($attribute->nodeValue == "false") { + $this->_value = false; + } + else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); + } + 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 bool $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_Hidden 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->_value; + } + +} + diff --git a/applications/core/lib/Zend/Gdata/Calendar/Extension/Link.php b/applications/core/lib/Zend/Gdata/Calendar/Extension/Link.php new file mode 100644 index 0000000..2b3f93a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/Extension/Link.php @@ -0,0 +1,125 @@ +<?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 Calendar + * @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: Entry.php 3941 2007-03-14 21:36:13Z darby $ + */ + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/App/Extension/Link.php'; + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/Calendar/Extension/WebContent.php'; + + +/** + * Specialized Link class for use with Calendar. Enables use of gCal extension elements. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_Extension_Link extends Zend_Gdata_App_Extension_Link +{ + + protected $_webContent = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Link object. + * @see Zend_Gdata_App_Extension_Link#__construct + * @param Zend_Gdata_Calendar_Extension_Webcontent $webContent + */ + public function __construct($href = null, $rel = null, $type = null, + $hrefLang = null, $title = null, $length = null, $webContent = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct($href, $rel, $type, $hrefLang, $title, $length); + $this->_webContent = $webContent; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_webContent != null) { + $element->appendChild($this->_webContent->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('gCal') . ':' . 'webContent': + $webContent = new Zend_Gdata_Calendar_Extension_WebContent(); + $webContent->transferFromDOM($child); + $this->_webContent = $webContent; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value for this element's WebContent attribute. + * + * @return Zend_Gdata_Calendar_Extension_Webcontent The WebContent value + */ + public function getWebContent() + { + return $this->_webContent; + } + + /** + * Set the value for this element's WebContent attribute. + * + * @param Zend_Gdata_Calendar_Extension_WebContent $value The desired value for this attribute. + * @return Zend_Calendar_Extension_Link The element being modified. Provides a fluent interface. + */ + public function setWebContent($value) + { + $this->_webContent = $value; + return $this; + } + + +} + diff --git a/applications/core/lib/Zend/Gdata/Calendar/Extension/QuickAdd.php b/applications/core/lib/Zend/Gdata/Calendar/Extension/QuickAdd.php new file mode 100644 index 0000000..11d8a18 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/Extension/QuickAdd.php @@ -0,0 +1,131 @@ +<?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 Calendar + * @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 gCal:quickAdd element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_Extension_QuickAdd extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'quickadd'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_QuickAdd object. + * @param string $value (optional) The text content of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value !== null) { + $element->setAttribute('value', ($this->_value ? "true" : "false")); + } + 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': + if ($attribute->nodeValue == "true") { + $this->_value = true; + } + else if ($attribute->nodeValue == "false") { + $this->_value = false; + } + else { + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); + } + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's value attribute. + * + * @return string The value associated with this 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_Calendar_Extension_QuickAdd 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(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/Extension/Selected.php b/applications/core/lib/Zend/Gdata/Calendar/Extension/Selected.php new file mode 100644 index 0000000..310709c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/Extension/Selected.php @@ -0,0 +1,132 @@ +<?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 Calendar + * @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 gCal:selected element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_Extension_Selected extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'selected'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Selected object. + * @param bool $value (optional) The value of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value !== null) { + $element->setAttribute('value', ($this->_value ? "true" : "false")); + } + 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': + if ($attribute->nodeValue == "true") { + $this->_value = true; + } + else if ($attribute->nodeValue == "false") { + $this->_value = false; + } + else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); + } + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's value attribute. + * + * @return bool The value associated with this 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_Calendar_Extension_Selected 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->_value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/Extension/SendEventNotifications.php b/applications/core/lib/Zend/Gdata/Calendar/Extension/SendEventNotifications.php new file mode 100644 index 0000000..ae4dc76 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/Extension/SendEventNotifications.php @@ -0,0 +1,131 @@ +<?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 Calendar + * @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 sendEventNotifications + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_Extension_SendEventNotifications extends Zend_Gdata_Extension +{ + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'sendEventNotifications'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Extension_SendEventNotifications object. + * @param bool $value (optional) SendEventNotifications value as URI. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value !== null) { + $element->setAttribute('value', ($this->_value ? "true" : "false")); + } + 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': + if ($attribute->nodeValue == "true") { + $this->_value = true; + } + else if ($attribute->nodeValue == "false") { + $this->_value = false; + } + else { + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); + } + 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_SendEventNotifications 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(); + } + +} + diff --git a/applications/core/lib/Zend/Gdata/Calendar/Extension/Timezone.php b/applications/core/lib/Zend/Gdata/Calendar/Extension/Timezone.php new file mode 100644 index 0000000..014ceb1 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/Extension/Timezone.php @@ -0,0 +1,123 @@ +<?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 Calendar + * @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 gCal:timezone element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_Extension_Timezone extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'timezone'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Timezone object. + * @param string $value (optional) The text content of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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 value associated with this 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_Calendar_Extension_Timezone 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(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/Extension/WebContent.php b/applications/core/lib/Zend/Gdata/Calendar/Extension/WebContent.php new file mode 100644 index 0000000..1d9ece3 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/Extension/WebContent.php @@ -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 + * @subpackage Calendar + * @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 gCal:webContent element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_Extension_WebContent extends Zend_Gdata_App_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'webContent'; + protected $_url = null; + protected $_height = null; + protected $_width = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_WebContent object. + * @param string $url (optional) The value for this element's URL attribute. + * @param string $height (optional) The value for this element's height attribute. + * @param string $width (optional) The value for this element's width attribute. + */ + public function __construct($url = null, $height = null, $width = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct(); + $this->_url = $url; + $this->_height = $height; + $this->_width = $width; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->url != null) { + $element->setAttribute('url', $this->_url); + } + if ($this->height != null) { + $element->setAttribute('height', $this->_height); + } + if ($this->width != null) { + $element->setAttribute('width', $this->_width); + } + 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 'height': + $this->_height = $attribute->nodeValue; + break; + case 'width': + $this->_width = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's URL attribute. + * + * @return string The desired value for this attribute. + */ + public function getURL() + { + return $this->_url; + } + + /** + * Set the value for this element's URL attribute. + * + * @param bool $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified. + */ + public function setURL($value) + { + $this->_url = $value; + return $this; + } + + /** + * Get the value for this element's height attribute. + * + * @return int The desired value for this attribute. + */ + public function getHeight() + { + return $this->_height; + } + + /** + * Set the value for this element's height attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified. + */ + public function setHeight($value) + { + $this->_height = $value; + return $this; + } + + /** + * Get the value for this element's height attribute. + * + * @return int The desired value for this attribute. + */ + public function getWidth() + { + return $this->_width; + } + + /** + * Set the value for this element's height attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified. + */ + public function setWidth($value) + { + $this->_width = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/ListEntry.php b/applications/core/lib/Zend/Gdata/Calendar/ListEntry.php new file mode 100644 index 0000000..58c6f41 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/ListEntry.php @@ -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 + * @subpackage Calendar + * @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_Calendar_Extension_AccessLevel + */ +require_once 'Zend/Gdata/Calendar/Extension/AccessLevel.php'; + +/** + * @see Zend_Calendar_Extension_Color + */ +require_once 'Zend/Gdata/Calendar/Extension/Color.php'; + +/** + * @see Zend_Calendar_Extension_Hidden + */ +require_once 'Zend/Gdata/Calendar/Extension/Hidden.php'; + +/** + * @see Zend_Calendar_Extension_Selected + */ +require_once 'Zend/Gdata/Calendar/Extension/Selected.php'; + +/** + * @see Zend_Gdata_Extension_EventStatus + */ +require_once 'Zend/Gdata/Extension/EventStatus.php'; + +/** + * @see Zend_Gdata_Extension_Visibility + */ +require_once 'Zend/Gdata/Extension/Visibility.php'; + + +/** + * @see Zend_Extension_Where + */ +require_once 'Zend/Gdata/Extension/Where.php'; + +/** + * Represents a Calendar entry in the Calendar data API meta feed of a user's + * calendars. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_ListEntry extends Zend_Gdata_Entry +{ + + protected $_color = null; + protected $_accessLevel = null; + protected $_hidden = null; + protected $_selected = null; + protected $_timezone = null; + protected $_where = array(); + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_accessLevel != null) { + $element->appendChild($this->_accessLevel->getDOM($element->ownerDocument)); + } + if ($this->_color != null) { + $element->appendChild($this->_color->getDOM($element->ownerDocument)); + } + if ($this->_hidden != null) { + $element->appendChild($this->_hidden->getDOM($element->ownerDocument)); + } + if ($this->_selected != null) { + $element->appendChild($this->_selected->getDOM($element->ownerDocument)); + } + if ($this->_timezone != null) { + $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); + } + if ($this->_where != null) { + foreach ($this->_where as $where) { + $element->appendChild($where->getDOM($element->ownerDocument)); + } + } + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + switch ($absoluteNodeName) { + case $this->lookupNamespace('gCal') . ':' . 'accesslevel'; + $accessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel(); + $accessLevel->transferFromDOM($child); + $this->_accessLevel = $accessLevel; + break; + case $this->lookupNamespace('gCal') . ':' . 'color'; + $color = new Zend_Gdata_Calendar_Extension_Color(); + $color->transferFromDOM($child); + $this->_color = $color; + break; + case $this->lookupNamespace('gCal') . ':' . 'hidden'; + $hidden = new Zend_Gdata_Calendar_Extension_Hidden(); + $hidden->transferFromDOM($child); + $this->_hidden = $hidden; + break; + case $this->lookupNamespace('gCal') . ':' . 'selected'; + $selected = new Zend_Gdata_Calendar_Extension_Selected(); + $selected->transferFromDOM($child); + $this->_selected = $selected; + break; + case $this->lookupNamespace('gCal') . ':' . 'timezone'; + $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); + $timezone->transferFromDOM($child); + $this->_timezone = $timezone; + break; + case $this->lookupNamespace('gd') . ':' . 'where'; + $where = new Zend_Gdata_Extension_Where(); + $where->transferFromDOM($child); + $this->_where[] = $where; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getAccessLevel() + { + return $this->_accessLevel; + } + + /** + * @param Zend_Gdata_Calendar_Extension_AccessLevel $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setAccessLevel($value) + { + $this->_accessLevel = $value; + return $this; + } + public function getColor() + { + return $this->_color; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Color $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setColor($value) + { + $this->_color = $value; + return $this; + } + + public function getHidden() + { + return $this->_hidden; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Hidden $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setHidden($value) + { + $this->_hidden = $value; + return $this; + } + + public function getSelected() + { + return $this->_selected; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Selected $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setSelected($value) + { + $this->_selected = $value; + return $this; + } + + public function getTimezone() + { + return $this->_timezone; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Timezone $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setTimezone($value) + { + $this->_timezone = $value; + return $this; + } + + public function getWhere() + { + return $this->_where; + } + + /** + * @param Zend_Gdata_Extension_Where $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setWhere($value) + { + $this->_where = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Calendar/ListFeed.php b/applications/core/lib/Zend/Gdata/Calendar/ListFeed.php new file mode 100644 index 0000000..2071b91 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Calendar/ListFeed.php @@ -0,0 +1,105 @@ +<?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 Calendar + * @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'; + +/** + * @see Zend_Gdata_Extension_Timezone + */ +require_once 'Zend/Gdata/Calendar/Extension/Timezone.php'; + +/** + * Represents the meta-feed list of calendars + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @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_Calendar_ListFeed extends Zend_Gdata_Feed +{ + protected $_timezone = null; + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Calendar_ListEntry'; + + /** + * The classname for the feed. + * + * @var string + */ + protected $_feedClassName = 'Zend_Gdata_Calendar_ListFeed'; + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_timezone != null) { + $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); + } + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + switch ($absoluteNodeName) { + case $this->lookupNamespace('gCal') . ':' . 'timezone'; + $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); + $timezone->transferFromDOM($child); + $this->_timezone = $timezone; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getTimezone() + { + return $this->_timezone; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Timezone $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setTimezone($value) + { + $this->_timezone = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/ClientLogin.php b/applications/core/lib/Zend/Gdata/ClientLogin.php new file mode 100644 index 0000000..7e50911 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/ClientLogin.php @@ -0,0 +1,181 @@ +<?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 Gdata + * @copyright Copyright (c) 2005-2009 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 + * @subpackage Gdata + * @copyright Copyright (c) 2005-2009 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->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.')); + } + } + } + +} + diff --git a/applications/core/lib/Zend/Gdata/Docs.php b/applications/core/lib/Zend/Gdata/Docs.php new file mode 100755 index 0000000..f20768e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Docs.php @@ -0,0 +1,256 @@ +<?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 Docs + * @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 + * @subpackage Docs + * @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); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Docs/DocumentListEntry.php b/applications/core/lib/Zend/Gdata/Docs/DocumentListEntry.php new file mode 100755 index 0000000..36e5622 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Docs/DocumentListEntry.php @@ -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 + * @subpackage Docs + * @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 + * @subpackage Docs + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Docs::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Docs/DocumentListFeed.php b/applications/core/lib/Zend/Gdata/Docs/DocumentListFeed.php new file mode 100755 index 0000000..692bd9b --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Docs/DocumentListFeed.php @@ -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 + * @subpackage Docs + * @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 + * @subpackage Docs + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Docs::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Docs/Query.php b/applications/core/lib/Zend/Gdata/Docs/Query.php new file mode 100755 index 0000000..574d1ab --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Docs/Query.php @@ -0,0 +1,221 @@ +<?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 Docs + * @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 + * @subpackage Docs + * @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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore.php b/applications/core/lib/Zend/Gdata/DublinCore.php new file mode 100755 index 0000000..8218eca --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore.php @@ -0,0 +1,64 @@ +<?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 DublinCore + * @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 + * DublinCore extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore extends Zend_Gdata +{ + + /** + * Namespaces used for Zend_Gdata_DublinCore + * + * @var array + */ + public static $namespaces = array( + array('dc', 'http://purl.org/dc/terms', 1, 0) + ); + + /** + * Create Zend_Gdata_DublinCore 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_DublinCore'); + $this->registerPackage('Zend_Gdata_DublinCore_Extension'); + parent::__construct($client, $applicationId); + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore/Extension/Creator.php b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Creator.php new file mode 100644 index 0000000..56029c4 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Creator.php @@ -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 + * @subpackage DublinCore + * @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'; + +/** + * Entity primarily responsible for making the resource + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore_Extension_Creator extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'dc'; + protected $_rootElement = 'creator'; + + /** + * Constructor for Zend_Gdata_DublinCore_Extension_Creator which + * Entity primarily responsible for making the resource + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); + parent::__construct(); + $this->_text = $value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore/Extension/Date.php b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Date.php new file mode 100644 index 0000000..0e5e716 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Date.php @@ -0,0 +1,61 @@ +<?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 DublinCore + * @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'; + +/** + * Point or period of time associated with an event in the lifecycle of the + * resource + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore_Extension_Date extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'dc'; + protected $_rootElement = 'date'; + + /** + * Constructor for Zend_Gdata_DublinCore_Extension_Date which + * Point or period of time associated with an event in the lifecycle of the + * resource + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); + parent::__construct(); + $this->_text = $value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore/Extension/Description.php b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Description.php new file mode 100644 index 0000000..04177d2 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Description.php @@ -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 + * @subpackage DublinCore + * @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'; + +/** + * Account of the resource + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore_Extension_Description extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'dc'; + protected $_rootElement = 'description'; + + /** + * Constructor for Zend_Gdata_DublinCore_Extension_Description which + * Account of the resource + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); + parent::__construct(); + $this->_text = $value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore/Extension/Format.php b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Format.php new file mode 100644 index 0000000..7d1c7fc --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Format.php @@ -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 + * @subpackage DublinCore + * @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'; + +/** + * File format, physical medium, or dimensions of the resource + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore_Extension_Format extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'dc'; + protected $_rootElement = 'format'; + + /** + * Constructor for Zend_Gdata_DublinCore_Extension_Format which + * File format, physical medium, or dimensions of the resource + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); + parent::__construct(); + $this->_text = $value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore/Extension/Identifier.php b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Identifier.php new file mode 100644 index 0000000..ac4ba07 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Identifier.php @@ -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 + * @subpackage DublinCore + * @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'; + +/** + * An unambiguous reference to the resource within a given context + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore_Extension_Identifier extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'dc'; + protected $_rootElement = 'identifier'; + + /** + * Constructor for Zend_Gdata_DublinCore_Extension_Identifier which + * An unambiguous reference to the resource within a given context + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); + parent::__construct(); + $this->_text = $value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore/Extension/Language.php b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Language.php new file mode 100644 index 0000000..a3e5e71 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Language.php @@ -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 + * @subpackage DublinCore + * @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'; + +/** + * Language of the resource + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore_Extension_Language extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'dc'; + protected $_rootElement = 'language'; + + /** + * Constructor for Zend_Gdata_DublinCore_Extension_Language which + * Language of the resource + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); + parent::__construct(); + $this->_text = $value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore/Extension/Publisher.php b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Publisher.php new file mode 100644 index 0000000..147a3c1 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Publisher.php @@ -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 + * @subpackage DublinCore + * @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'; + +/** + * Entity responsible for making the resource available + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore_Extension_Publisher extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'dc'; + protected $_rootElement = 'publisher'; + + /** + * Constructor for Zend_Gdata_DublinCore_Extension_Publisher which + * Entity responsible for making the resource available + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); + parent::__construct(); + $this->_text = $value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore/Extension/Rights.php b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Rights.php new file mode 100644 index 0000000..433796b --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Rights.php @@ -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 + * @subpackage DublinCore + * @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'; + +/** + * Information about rights held in and over the resource + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore_Extension_Rights extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'dc'; + protected $_rootElement = 'rights'; + + /** + * Constructor for Zend_Gdata_DublinCore_Extension_Rights which + * Information about rights held in and over the resource + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); + parent::__construct(); + $this->_text = $value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore/Extension/Subject.php b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Subject.php new file mode 100644 index 0000000..ebb3359 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Subject.php @@ -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 + * @subpackage DublinCore + * @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'; + +/** + * Topic of the resource + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore_Extension_Subject extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'dc'; + protected $_rootElement = 'subject'; + + /** + * Constructor for Zend_Gdata_DublinCore_Extension_Subject which + * Topic of the resource + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); + parent::__construct(); + $this->_text = $value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/DublinCore/Extension/Title.php b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Title.php new file mode 100644 index 0000000..3c6be2a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/DublinCore/Extension/Title.php @@ -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 + * @subpackage DublinCore + * @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'; + +/** + * Name given to the resource + * + * @category Zend + * @package Zend_Gdata + * @subpackage DublinCore + * @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_DublinCore_Extension_Title extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'dc'; + protected $_rootElement = 'title'; + + /** + * Constructor for Zend_Gdata_DublinCore_Extension_Title which + * Name given to the resource + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces); + parent::__construct(); + $this->_text = $value; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Entry.php b/applications/core/lib/Zend/Gdata/Entry.php new file mode 100644 index 0000000..373c4c9 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Entry.php @@ -0,0 +1,131 @@ +<?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 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_App_MediaEntry + */ +require_once 'Zend/Gdata/App/MediaEntry.php'; + +/** + * Represents the Gdata flavor of an Atom entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage 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) + { + $this->registerAllNamespaces(Zend_Gdata::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + // ETags are special. We only support them in protocol >= 2.X. + // This will be duplicated by the HTTP ETag header. + if ($majorVersion >= 2) { + if ($this->_etag != null) { + $element->setAttributeNS($this->lookupNamespace('gd'), + 'gd:etag', + $this->_etag); + } + } + 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; + } + } + + /** + * 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 'etag': + // ETags are special, since they can be conveyed by either the + // HTTP ETag header or as an XML attribute. + $etag = $attribute->nodeValue; + if ($this->_etag === null) { + $this->_etag = $etag; + } + elseif ($this->_etag != $etag) { + require_once('Zend/Gdata/App/IOException.php'); + throw new Zend_Gdata_App_IOException("ETag mismatch"); + } + break; + default: + parent::takeAttributeFromDOM($attribute); + break; + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif.php b/applications/core/lib/Zend/Gdata/Exif.php new file mode 100755 index 0000000..50cbb7c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif.php @@ -0,0 +1,64 @@ +<?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 Exif + * @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 EXIF extensions + * @link http://code.google.com/apis/picasaweb/reference.html#exif_reference + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif extends Zend_Gdata +{ + + /** + * Namespaces used for Zend_Gdata_Exif + * + * @var array + */ + public static $namespaces = array( + array('exif', 'http://schemas.google.com/photos/exif/2007', 1, 0) + ); + + /** + * Create Zend_Gdata_Exif 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_Exif'); + $this->registerPackage('Zend_Gdata_Exif_Extension'); + parent::__construct($client, $applicationId); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Entry.php b/applications/core/lib/Zend/Gdata/Exif/Entry.php new file mode 100755 index 0000000..e5fa512 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Entry.php @@ -0,0 +1,144 @@ +<?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 Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * @see Zend_Gdata_Exif_Extension_Tags + */ +require_once 'Zend/Gdata/Exif/Extension/Tags.php'; + +/** + * An Atom entry containing EXIF metadata. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Entry extends Zend_Gdata_Entry +{ + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Exif_Entry'; + + /** + * The tags that belong to the Exif group. + * + * @var string + */ + protected $_tags = null; + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_tags != null) { + $element->appendChild($this->_tags->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('exif') . ':' . 'tags': + $tags = new Zend_Gdata_Exif_Extension_Tags(); + $tags->transferFromDOM($child); + $this->_tags = $tags; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Retrieve the tags for this entry. + * + * @see setTags + * @return Zend_Gdata_Exif_Extension_Tags The requested object + * or null if not set. + */ + public function getTags() + { + return $this->_tags; + } + + /** + * Set the tags property for this entry. This property contains + * various Exif data. + * + * This corresponds to the <exif:tags> property in the Google Data + * protocol. + * + * @param Zend_Gdata_Exif_Extension_Tags $value The desired value + * this element, or null to unset. + * @return Zend_Gdata_Exif_Entry Provides a fluent interface + */ + public function setTags($value) + { + $this->_tags = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/Distance.php b/applications/core/lib/Zend/Gdata/Exif/Extension/Distance.php new file mode 100755 index 0000000..8a5ffee --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/Distance.php @@ -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 + * @subpackage Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * Represents the exif:distance element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_Distance extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'distance'; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_Distance object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/Exposure.php b/applications/core/lib/Zend/Gdata/Exif/Extension/Exposure.php new file mode 100755 index 0000000..240cac3 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/Exposure.php @@ -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 + * @subpackage Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * Represents the exif:exposure element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_Exposure extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'exposure'; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_Exposure object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/FStop.php b/applications/core/lib/Zend/Gdata/Exif/Extension/FStop.php new file mode 100755 index 0000000..8f4bedc --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/FStop.php @@ -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 + * @subpackage Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * Represents the exif:fStop element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_FStop extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'fstop'; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_FStop object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/Flash.php b/applications/core/lib/Zend/Gdata/Exif/Extension/Flash.php new file mode 100755 index 0000000..fdd3671 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/Flash.php @@ -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 + * @subpackage Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * Represents the exif:flash element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_Flash extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'flash'; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_Flash object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/FocalLength.php b/applications/core/lib/Zend/Gdata/Exif/Extension/FocalLength.php new file mode 100755 index 0000000..c7ebe9d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/FocalLength.php @@ -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 + * @subpackage Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * Represents the exif:focalLength element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_FocalLength extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'focallength'; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_FocalLength object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/ImageUniqueId.php b/applications/core/lib/Zend/Gdata/Exif/Extension/ImageUniqueId.php new file mode 100755 index 0000000..a5959b4 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/ImageUniqueId.php @@ -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 + * @subpackage Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * Represents the exif:imageUniqueId element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_ImageUniqueId extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'imageUniqueID'; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_ImageUniqueId object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/Iso.php b/applications/core/lib/Zend/Gdata/Exif/Extension/Iso.php new file mode 100755 index 0000000..2fb5a9d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/Iso.php @@ -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 + * @subpackage Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * Represents the exif:iso element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_Iso extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'iso'; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_Iso object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/Make.php b/applications/core/lib/Zend/Gdata/Exif/Extension/Make.php new file mode 100755 index 0000000..cc5e0fc --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/Make.php @@ -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 + * @subpackage Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * Represents the exif:make element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_Make extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'make'; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_Make object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/Model.php b/applications/core/lib/Zend/Gdata/Exif/Extension/Model.php new file mode 100755 index 0000000..4c25f16 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/Model.php @@ -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 + * @subpackage Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * Represents the exif:model element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_Model extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'model'; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_Model object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/Tags.php b/applications/core/lib/Zend/Gdata/Exif/Extension/Tags.php new file mode 100755 index 0000000..dc6e39c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/Tags.php @@ -0,0 +1,548 @@ +<?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 Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * @see Zend_Gdata_Exif_Extension_Distance + */ +require_once 'Zend/Gdata/Exif/Extension/Distance.php'; + +/** + * @see Zend_Gdata_Exif_Extension_Exposure + */ +require_once 'Zend/Gdata/Exif/Extension/Exposure.php'; + +/** + * @see Zend_Gdata_Exif_Extension_Flash + */ +require_once 'Zend/Gdata/Exif/Extension/Flash.php'; + +/** + * @see Zend_Gdata_Exif_Extension_FocalLength + */ +require_once 'Zend/Gdata/Exif/Extension/FocalLength.php'; + +/** + * @see Zend_Gdata_Exif_Extension_FStop + */ +require_once 'Zend/Gdata/Exif/Extension/FStop.php'; + +/** + * @see Zend_Gdata_Exif_Extension_ImageUniqueId + */ +require_once 'Zend/Gdata/Exif/Extension/ImageUniqueId.php'; + +/** + * @see Zend_Gdata_Exif_Extension_Iso + */ +require_once 'Zend/Gdata/Exif/Extension/Iso.php'; + +/** + * @see Zend_Gdata_Exif_Extension_Make + */ +require_once 'Zend/Gdata/Exif/Extension/Make.php'; + +/** + * @see Zend_Gdata_Exif_Extension_Model + */ +require_once 'Zend/Gdata/Exif/Extension/Model.php'; + +/** + * @see Zend_Gdata_Exif_Extension_Time + */ +require_once 'Zend/Gdata/Exif/Extension/Time.php'; + +/** + * Represents the exif:tags element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_Tags extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'tags'; + + /** + * exif:distance value + * + * @var Zend_Gdata_Exif_Extension_Distance + */ + protected $_distance = null; + + /** + * exif:exposure value + * + * @var Zend_Gdata_Exif_Extension_Exposure + */ + protected $_exposure = null; + + /** + * exif:flash value + * + * @var Zend_Gdata_Exif_Extension_Flash + */ + protected $_flash = null; + + /** + * exif:focalLength value + * + * @var Zend_Gdata_Exif_Extension_FocalLength + */ + protected $_focalLength = null; + + /** + * exif:fStop value + * + * @var Zend_Gdata_Exif_Extension_FStop + */ + protected $_fStop = null; + + /** + * exif:imageUniqueID value + * + * @var Zend_Gdata_Exif_Extension_ImageUniqueId + */ + protected $_imageUniqueId = null; + + /** + * exif:iso value + * + * @var Zend_Gdata_Exif_Extension_Iso + */ + protected $_iso = null; + + /** + * exif:make value + * + * @var Zend_Gdata_Exif_Extension_Make + */ + protected $_make = null; + + /** + * exif:model value + * + * @var Zend_Gdata_Exif_Extension_Model + */ + protected $_model = null; + + /** + * exif:time value + * + * @var Zend_Gdata_Exif_Extension_Time + */ + protected $_time = null; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_Tags object. + * + * @param Zend_Gdata_Exif_Extension_Distance $distance (optional) The exif:distance + * value to be set in the constructed object. + * @param Zend_Gdata_Exif_Extension_Exposure $exposure (optional) The exif:exposure + * value to be set in the constructed object. + * @param Zend_Gdata_Exif_Extension_Flash $flash (optional) The exif:flash + * value to be set in the constructed object. + * @param Zend_Gdata_Exif_Extension_FocalLength$focalLength (optional) The exif:focallength + * value to be set in the constructed object. + * @param Zend_Gdata_Exif_Extension_FStop $fStop (optional) The exif:fstop + * value to be set in the constructed object. + * @param Zend_Gdata_Exif_Extension_ImageUniqueId $imageUniqueId (optional) The exif:imageUniqueID + * value to be set in the constructed object. + * @param Zend_Gdata_Exif_Extension_Iso $iso (optional) The exif:iso + * value to be set in the constructed object. + * @param Zend_Gdata_Exif_Extension_Make $make (optional) The exif:make + * value to be set in the constructed object. + * @param Zend_Gdata_Exif_Extension_Model $model (optional) The exif:model + * value to be set in the constructed object. + * @param Zend_Gdata_Exif_Extension_Time $time (optional) The exif:time + * value to be set in the constructed object. + */ + public function __construct($distance = null, $exposure = null, + $flash = null, $focalLength = null, $fStop = null, + $imageUniqueId = null, $iso = null, $make = null, + $model = null, $time = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setDistance($distance); + $this->setExposure($exposure); + $this->setFlash($flash); + $this->setFocalLength($focalLength); + $this->setFStop($fStop); + $this->setImageUniqueId($imageUniqueId); + $this->setIso($iso); + $this->setMake($make); + $this->setModel($model); + $this->setTime($time); + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_distance !== null) { + $element->appendChild($this->_distance->getDOM($element->ownerDocument)); + } + if ($this->_exposure !== null) { + $element->appendChild($this->_exposure->getDOM($element->ownerDocument)); + } + if ($this->_flash !== null) { + $element->appendChild($this->_flash->getDOM($element->ownerDocument)); + } + if ($this->_focalLength !== null) { + $element->appendChild($this->_focalLength->getDOM($element->ownerDocument)); + } + if ($this->_fStop !== null) { + $element->appendChild($this->_fStop->getDOM($element->ownerDocument)); + } + if ($this->_imageUniqueId !== null) { + $element->appendChild($this->_imageUniqueId->getDOM($element->ownerDocument)); + } + if ($this->_iso !== null) { + $element->appendChild($this->_iso->getDOM($element->ownerDocument)); + } + if ($this->_make !== null) { + $element->appendChild($this->_make->getDOM($element->ownerDocument)); + } + if ($this->_model !== null) { + $element->appendChild($this->_model->getDOM($element->ownerDocument)); + } + if ($this->_time !== null) { + $element->appendChild($this->_time->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('exif') . ':' . 'distance'; + $distance = new Zend_Gdata_Exif_Extension_Distance(); + $distance->transferFromDOM($child); + $this->_distance = $distance; + break; + case $this->lookupNamespace('exif') . ':' . 'exposure'; + $exposure = new Zend_Gdata_Exif_Extension_Exposure(); + $exposure->transferFromDOM($child); + $this->_exposure = $exposure; + break; + case $this->lookupNamespace('exif') . ':' . 'flash'; + $flash = new Zend_Gdata_Exif_Extension_Flash(); + $flash->transferFromDOM($child); + $this->_flash = $flash; + break; + case $this->lookupNamespace('exif') . ':' . 'focallength'; + $focalLength = new Zend_Gdata_Exif_Extension_FocalLength(); + $focalLength->transferFromDOM($child); + $this->_focalLength = $focalLength; + break; + case $this->lookupNamespace('exif') . ':' . 'fstop'; + $fStop = new Zend_Gdata_Exif_Extension_FStop(); + $fStop->transferFromDOM($child); + $this->_fStop = $fStop; + break; + case $this->lookupNamespace('exif') . ':' . 'imageUniqueID'; + $imageUniqueId = new Zend_Gdata_Exif_Extension_ImageUniqueId(); + $imageUniqueId->transferFromDOM($child); + $this->_imageUniqueId = $imageUniqueId; + break; + case $this->lookupNamespace('exif') . ':' . 'iso'; + $iso = new Zend_Gdata_Exif_Extension_Iso(); + $iso->transferFromDOM($child); + $this->_iso = $iso; + break; + case $this->lookupNamespace('exif') . ':' . 'make'; + $make = new Zend_Gdata_Exif_Extension_Make(); + $make->transferFromDOM($child); + $this->_make = $make; + break; + case $this->lookupNamespace('exif') . ':' . 'model'; + $model = new Zend_Gdata_Exif_Extension_Model(); + $model->transferFromDOM($child); + $this->_model = $model; + break; + case $this->lookupNamespace('exif') . ':' . 'time'; + $time = new Zend_Gdata_Exif_Extension_Time(); + $time->transferFromDOM($child); + $this->_time = $time; + break; + } + } + + /** + * Get the value for this element's distance attribute. + * + * @see setDistance + * @return Zend_Gdata_Exif_Extension_Distance The requested attribute. + */ + public function getDistance() + { + return $this->_distance; + } + + /** + * Set the value for this element's distance attribute. + * + * @param Zend_Gdata_Exif_Extension_Distance $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface + */ + public function setDistance($value) + { + $this->_distance = $value; + return $this; + } + + /** + * Get the value for this element's exposure attribute. + * + * @see setExposure + * @return Zend_Gdata_Exif_Extension_Exposure The requested attribute. + */ + public function getExposure() + { + return $this->_exposure; + } + + /** + * Set the value for this element's exposure attribute. + * + * @param Zend_Gdata_Exif_Extension_Exposure $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface + */ + public function setExposure($value) + { + $this->_exposure = $value; + return $this; + } + + /** + * Get the value for this element's flash attribute. + * + * @see setFlash + * @return Zend_Gdata_Exif_Extension_Flash The requested attribute. + */ + public function getFlash() + { + return $this->_flash; + } + + /** + * Set the value for this element's flash attribute. + * + * @param Zend_Gdata_Exif_Extension_Flash $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface + */ + public function setFlash($value) + { + $this->_flash = $value; + return $this; + } + + /** + * Get the value for this element's name attribute. + * + * @see setFocalLength + * @return Zend_Gdata_Exif_Extension_FocalLength The requested attribute. + */ + public function getFocalLength() + { + return $this->_focalLength; + } + + /** + * Set the value for this element's focalLength attribute. + * + * @param Zend_Gdata_Exif_Extension_FocalLength $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface + */ + public function setFocalLength($value) + { + $this->_focalLength = $value; + return $this; + } + + /** + * Get the value for this element's fStop attribute. + * + * @see setFStop + * @return Zend_Gdata_Exif_Extension_FStop The requested attribute. + */ + public function getFStop() + { + return $this->_fStop; + } + + /** + * Set the value for this element's fStop attribute. + * + * @param Zend_Gdata_Exif_Extension_FStop $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface + */ + public function setFStop($value) + { + $this->_fStop = $value; + return $this; + } + + /** + * Get the value for this element's imageUniqueId attribute. + * + * @see setImageUniqueId + * @return Zend_Gdata_Exif_Extension_ImageUniqueId The requested attribute. + */ + public function getImageUniqueId() + { + return $this->_imageUniqueId; + } + + /** + * Set the value for this element's imageUniqueId attribute. + * + * @param Zend_Gdata_Exif_Extension_ImageUniqueId $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface + */ + public function setImageUniqueId($value) + { + $this->_imageUniqueId = $value; + return $this; + } + + /** + * Get the value for this element's iso attribute. + * + * @see setIso + * @return Zend_Gdata_Exif_Extension_Iso The requested attribute. + */ + public function getIso() + { + return $this->_iso; + } + + /** + * Set the value for this element's iso attribute. + * + * @param Zend_Gdata_Exif_Extension_Iso $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface + */ + public function setIso($value) + { + $this->_iso = $value; + return $this; + } + /** + * Get the value for this element's make attribute. + * + * @see setMake + * @return Zend_Gdata_Exif_Extension_Make The requested attribute. + */ + public function getMake() + { + return $this->_make; + } + + /** + * Set the value for this element's make attribute. + * + * @param Zend_Gdata_Exif_Extension_Make $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface + */ + public function setMake($value) + { + $this->_make = $value; + return $this; + } + + /** + * Get the value for this element's model attribute. + * + * @see setModel + * @return Zend_Gdata_Exif_Extension_Model The requested attribute. + */ + public function getModel() + { + return $this->_model; + } + + /** + * Set the value for this element's model attribute. + * + * @param Zend_Gdata_Exif_Extension_Model $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface + */ + public function setModel($value) + { + $this->_model = $value; + return $this; + } + + /** + * Get the value for this element's time attribute. + * + * @see setTime + * @return Zend_Gdata_Exif_Extension_Time The requested attribute. + */ + public function getTime() + { + return $this->_time; + } + + /** + * Set the value for this element's time attribute. + * + * @param Zend_Gdata_Exif_Extension_Time $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags Provides a fluent interface + */ + public function setTime($value) + { + $this->_time = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Extension/Time.php b/applications/core/lib/Zend/Gdata/Exif/Extension/Time.php new file mode 100755 index 0000000..9233109 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Extension/Time.php @@ -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 + * @subpackage Exif + * @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_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * Represents the exif:time element used by the Gdata Exif extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Extension_Time extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'exif'; + protected $_rootElement = 'time'; + + /** + * Constructs a new Zend_Gdata_Exif_Extension_Time object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Exif/Feed.php b/applications/core/lib/Zend/Gdata/Exif/Feed.php new file mode 100755 index 0000000..2e5b479 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Exif/Feed.php @@ -0,0 +1,69 @@ +<?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 Exif + * @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_eed + */ +require_once 'Zend/Gdata/Feed.php'; + +/** + * @see Zend_Gdata_Exif + */ +require_once 'Zend/Gdata/Exif.php'; + +/** + * @see Zend_Gdata_Exif_Entry + */ +require_once 'Zend/Gdata/Exif/Entry.php'; + +/** + * Feed for Gdata EXIF data entries. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Exif + * @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_Exif_Feed extends Zend_Gdata_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Exif_Entry'; + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Exif::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension.php b/applications/core/lib/Zend/Gdata/Extension.php new file mode 100644 index 0000000..ce62ffa --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension.php @@ -0,0 +1,57 @@ +<?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 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 + * @subpackage 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('gd', + 'http://schemas.google.com/g/2005'); + $this->registerNamespace('openSearch', + 'http://a9.com/-/spec/opensearchrss/1.0/', 1, 0); + $this->registerNamespace('openSearch', + 'http://a9.com/-/spec/opensearch/1.1/', 2, 0); + $this->registerNamespace('rss', + 'http://blogs.law.harvard.edu/tech/rss'); + + parent::__construct(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/AttendeeStatus.php b/applications/core/lib/Zend/Gdata/Extension/AttendeeStatus.php new file mode 100644 index 0000000..eeb0f26 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/AttendeeStatus.php @@ -0,0 +1,122 @@ +<?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 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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(); + } + +} + diff --git a/applications/core/lib/Zend/Gdata/Extension/AttendeeType.php b/applications/core/lib/Zend/Gdata/Extension/AttendeeType.php new file mode 100644 index 0000000..d9a0c78 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/AttendeeType.php @@ -0,0 +1,122 @@ +<?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 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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(); + } + +} + diff --git a/applications/core/lib/Zend/Gdata/Extension/Comments.php b/applications/core/lib/Zend/Gdata/Extension/Comments.php new file mode 100644 index 0000000..241b0c9 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/Comments.php @@ -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_Gdata + * @subpackage 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/EntryLink.php b/applications/core/lib/Zend/Gdata/Extension/EntryLink.php new file mode 100644 index 0000000..2f12f9c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/EntryLink.php @@ -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 + * @subpackage 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/EventStatus.php b/applications/core/lib/Zend/Gdata/Extension/EventStatus.php new file mode 100644 index 0000000..96443f4 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/EventStatus.php @@ -0,0 +1,100 @@ +<?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 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/ExtendedProperty.php b/applications/core/lib/Zend/Gdata/Extension/ExtendedProperty.php new file mode 100644 index 0000000..f79a29e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/ExtendedProperty.php @@ -0,0 +1,105 @@ +<?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 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/FeedLink.php b/applications/core/lib/Zend/Gdata/Extension/FeedLink.php new file mode 100644 index 0000000..284ef19 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/FeedLink.php @@ -0,0 +1,174 @@ +<?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 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/OpenSearchItemsPerPage.php b/applications/core/lib/Zend/Gdata/Extension/OpenSearchItemsPerPage.php new file mode 100644 index 0000000..2d79792 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/OpenSearchItemsPerPage.php @@ -0,0 +1,49 @@ +<?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 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 + * @subpackage 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/OpenSearchStartIndex.php b/applications/core/lib/Zend/Gdata/Extension/OpenSearchStartIndex.php new file mode 100644 index 0000000..6791f2c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/OpenSearchStartIndex.php @@ -0,0 +1,49 @@ +<?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 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 + * @subpackage 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/OpenSearchTotalResults.php b/applications/core/lib/Zend/Gdata/Extension/OpenSearchTotalResults.php new file mode 100644 index 0000000..4c12e27 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/OpenSearchTotalResults.php @@ -0,0 +1,49 @@ +<?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 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 + * @subpackage 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/OriginalEvent.php b/applications/core/lib/Zend/Gdata/Extension/OriginalEvent.php new file mode 100644 index 0000000..e6108db --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/OriginalEvent.php @@ -0,0 +1,141 @@ +<?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 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/Rating.php b/applications/core/lib/Zend/Gdata/Extension/Rating.php new file mode 100644 index 0000000..63fbfca --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/Rating.php @@ -0,0 +1,239 @@ +<?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 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 + * + * + * @category Zend + * @package Zend_Gdata + * @subpackage 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; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Extension_Rating object. + * + * @param integer $average (optional) Average rating. + * @param integer $min (optional) Minimum rating. + * @param integer $max (optional) Maximum rating. + * @param integer $numRaters (optional) Number of raters. + * @param integer $value (optional) The value of the rating. + */ + public function __construct($average = null, $min = null, + $max = null, $numRaters = null, $value = null) + { + parent::__construct(); + $this->_average = $average; + $this->_min = $min; + $this->_max = $max; + $this->_numRaters = $numRaters; + $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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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); + } + 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 '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; + case 'value': + $this->_value = $attribute->nodeValue; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's min attribute. + * + * @return integer The requested attribute. + */ + public function getMin() + { + return $this->_min; + } + + /** + * Set the value for this element's min attribute. + * + * @param bool $value The desired value for this attribute. + * @return Zend_Gdata_Extension_Rating The element being modified. + */ + public function setMin($value) + { + $this->_min = $value; + return $this; + } + + /** + * Get the value for this element's numRaters attribute. + * + * @return integer The requested attribute. + */ + public function getNumRaters() + { + return $this->_numRaters; + } + + /** + * Set the value for this element's numRaters attribute. + * + * @param bool $value The desired value for this attribute. + * @return Zend_Gdata_Extension_Rating The element being modified. + */ + public function setNumRaters($value) + { + $this->_numRaters = $value; + return $this; + } + + /** + * Get the value for this element's average attribute. + * + * @return integer The requested attribute. + */ + public function getAverage() + { + return $this->_average; + } + + /** + * Set the value for this element's average attribute. + * + * @param bool $value The desired value for this attribute. + * @return Zend_Gdata_Extension_Rating The element being modified. + */ + public function setAverage($value) + { + $this->_average = $value; + return $this; + } + + /** + * Get the value for this element's max attribute. + * + * @return integer The requested attribute. + */ + public function getMax() + { + return $this->_max; + } + + /** + * Set the value for this element's max attribute. + * + * @param bool $value The desired value for this attribute. + * @return Zend_Gdata_Extension_Rating The element being modified. + */ + public function setMax($value) + { + $this->_max = $value; + return $this; + } + + /** + * Get the value for this element's value attribute. + * + * @return integer 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_Rating The element being modified. + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/Recurrence.php b/applications/core/lib/Zend/Gdata/Extension/Recurrence.php new file mode 100644 index 0000000..91a6b5a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/Recurrence.php @@ -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 + * @subpackage 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 + * @subpackage 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/RecurrenceException.php b/applications/core/lib/Zend/Gdata/Extension/RecurrenceException.php new file mode 100644 index 0000000..bbdc1ec --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/RecurrenceException.php @@ -0,0 +1,214 @@ +<?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 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_EntryLink + */ +require_once 'Zend/Gdata/Extension/EntryLink.php'; + +/** + * @see Zend_Gdata_Extension_OriginalEvent + */ +require_once 'Zend/Gdata/Extension/OriginalEvent.php'; + +/** + * Data model class to represent an entry's recurrenceException + * + * @category Zend + * @package Zend_Gdata + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} + diff --git a/applications/core/lib/Zend/Gdata/Extension/Reminder.php b/applications/core/lib/Zend/Gdata/Extension/Reminder.php new file mode 100644 index 0000000..aa59ee1 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/Reminder.php @@ -0,0 +1,170 @@ +<?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 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/Transparency.php b/applications/core/lib/Zend/Gdata/Extension/Transparency.php new file mode 100644 index 0000000..385c5ab --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/Transparency.php @@ -0,0 +1,122 @@ +<?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 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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(); + } + +} + diff --git a/applications/core/lib/Zend/Gdata/Extension/Visibility.php b/applications/core/lib/Zend/Gdata/Extension/Visibility.php new file mode 100644 index 0000000..aee4399 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/Visibility.php @@ -0,0 +1,122 @@ +<?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 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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(); + } + +} + diff --git a/applications/core/lib/Zend/Gdata/Extension/When.php b/applications/core/lib/Zend/Gdata/Extension/When.php new file mode 100644 index 0000000..19091d6 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/When.php @@ -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 + * @subpackage 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 + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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 ($this->_valueString) + return $this->_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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/Where.php b/applications/core/lib/Zend/Gdata/Extension/Where.php new file mode 100644 index 0000000..93ba322 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/Where.php @@ -0,0 +1,170 @@ +<?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 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_EntryLink + */ +require_once 'Zend/Gdata/Extension/EntryLink.php'; + +/** + * Data model class to represent a location (gd:where element) + * + * @category Zend + * @package Zend_Gdata + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Extension/Who.php b/applications/core/lib/Zend/Gdata/Extension/Who.php new file mode 100644 index 0000000..79dfce9 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Extension/Who.php @@ -0,0 +1,298 @@ +<?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 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'; + +/** + * @see Zend_Gdata_Extension_EntryLink + */ +require_once 'Zend/Gdata/Extension/EntryLink.php'; + +/** + * Data model class to represent a participant + * + * @category Zend + * @package Zend_Gdata + * @subpackage 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Feed.php b/applications/core/lib/Zend/Gdata/Feed.php new file mode 100644 index 0000000..df10b7e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Feed.php @@ -0,0 +1,250 @@ +<?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 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_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 + * @subpackage 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 Zend_Gdata_Extension_OpenSearchTotalResults|null + */ + protected $_totalResults = null; + + /** + * The openSearch:startIndex element + * + * @var Zend_Gdata_Extension_OpenSearchStartIndex|null + */ + protected $_startIndex = null; + + /** + * The openSearch:itemsPerPage element + * + * @var Zend_Gdata_Extension_OpenSearchItemsPerPage|null + */ + protected $_itemsPerPage = null; + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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)); + } + + // ETags are special. We only support them in protocol >= 2.X. + // This will be duplicated by the HTTP ETag header. + if ($majorVersion >= 2) { + if ($this->_etag != null) { + $element->setAttributeNS($this->lookupNamespace('gd'), + 'gd:etag', + $this->_etag); + } + } + + 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; + } + } + + /** + * 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 'etag': + // ETags are special, since they can be conveyed by either the + // HTTP ETag header or as an XML attribute. + $etag = $attribute->nodeValue; + if ($this->_etag === null) { + $this->_etag = $etag; + } + elseif ($this->_etag != $etag) { + require_once('Zend/Gdata/App/IOException.php'); + throw new Zend_Gdata_App_IOException("ETag mismatch"); + } + break; + default: + parent::takeAttributeFromDOM($attribute); + break; + } + } + + /** + * Set the value of the totalResults property. + * + * @param Zend_Gdata_Extension_OpenSearchTotalResults|null $value The + * value of the totalResults property. Use null to unset. + * @return Zend_Gdata_Feed Provides a fluent interface. + */ + function setTotalResults($value) { + $this->_totalResults = $value; + return $this; + } + + /** + * Get the value of the totalResults property. + * + * @return Zend_Gdata_Extension_OpenSearchTotalResults|null The value of + * the totalResults property, or null if unset. + */ + function getTotalResults() { + return $this->_totalResults; + } + + /** + * Set the start index property for feed paging. + * + * @param Zend_Gdata_Extension_OpenSearchStartIndex|null $value The value + * for the startIndex property. Use null to unset. + * @return Zend_Gdata_Feed Provides a fluent interface. + */ + function setStartIndex($value) { + $this->_startIndex = $value; + return $this; + } + + /** + * Get the value of the startIndex property. + * + * @return Zend_Gdata_Extension_OpenSearchStartIndex|null The value of the + * startIndex property, or null if unset. + */ + function getStartIndex() { + return $this->_startIndex; + } + + /** + * Set the itemsPerPage property. + * + * @param Zend_Gdata_Extension_OpenSearchItemsPerPage|null $value The + * value for the itemsPerPage property. Use nul to unset. + * @return Zend_Gdata_Feed Provides a fluent interface. + */ + function setItemsPerPage($value) { + $this->_itemsPerPage = $value; + return $this; + } + + /** + * Get the value of the itemsPerPage property. + * + * @return Zend_Gdata_Extension_OpenSearchItemsPerPage|null The value of + * the itemsPerPage property, or null if unset. + */ + function getItemsPerPage() { + return $this->_itemsPerPage; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps.php b/applications/core/lib/Zend/Gdata/Gapps.php new file mode 100644 index 0000000..a556d1d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps.php @@ -0,0 +1,1092 @@ +<?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 Gapps + * @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_Gapps_UserFeed + */ +require_once 'Zend/Gdata/Gapps/UserFeed.php'; + +/** + * @see Zend_Gdata_Gapps_NicknameFeed + */ +require_once 'Zend/Gdata/Gapps/NicknameFeed.php'; + +/** + * @see Zend_Gdata_Gapps_EmailListFeed + */ +require_once 'Zend/Gdata/Gapps/EmailListFeed.php'; + +/** + * @see Zend_Gdata_Gapps_EmailListRecipientFeed + */ +require_once 'Zend/Gdata/Gapps/EmailListRecipientFeed.php'; + + +/** + * Service class for interacting with the Google Apps Provisioning API. + * + * Like other service classes in this module, this class provides access via + * an HTTP client to Google servers for working with entries and feeds. + * + * Because of the nature of this API, all access must occur over an + * authenticated connection. + * + * @link http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps extends Zend_Gdata +{ + + const APPS_BASE_FEED_URI = 'https://apps-apis.google.com/a/feeds'; + const AUTH_SERVICE_NAME = 'apps'; + + /** + * Path to user feeds on the Google Apps server. + */ + const APPS_USER_PATH = '/user/2.0'; + + /** + * Path to nickname feeds on the Google Apps server. + */ + const APPS_NICKNAME_PATH = '/nickname/2.0'; + + /** + * Path to email list feeds on the Google Apps server. + */ + const APPS_EMAIL_LIST_PATH = '/emailList/2.0'; + + /** + * Path to email list recipient feeds on the Google Apps server. + */ + const APPS_EMAIL_LIST_RECIPIENT_POSTFIX = '/recipient'; + + /** + * The domain which is being administered via the Provisioning API. + * + * @var string + */ + protected $_domain = null; + + /** + * Namespaces used for Zend_Gdata_Gapps + * + * @var array + */ + public static $namespaces = array( + array('apps', 'http://schemas.google.com/apps/2006', 1, 0) + ); + + /** + * Create Gdata_Gapps object + * + * @param Zend_Http_Client $client (optional) The HTTP client to use when + * when communicating with the Google Apps servers. + * @param string $domain (optional) The Google Apps domain which is to be + * accessed. + * @param string $applicationId The identity of the app in the form of Company-AppName-Version + */ + public function __construct($client = null, $domain = null, $applicationId = 'MyCompany-MyApp-1.0') + { + $this->registerPackage('Zend_Gdata_Gapps'); + $this->registerPackage('Zend_Gdata_Gapps_Extension'); + parent::__construct($client, $applicationId); + $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); + $this->_domain = $domain; + } + + /** + * Convert an exception to an ServiceException if an AppsForYourDomain + * XML document is contained within the original exception's HTTP + * response. If conversion fails, throw the original error. + * + * @param Zend_Gdata_Exception $e The exception to convert. + * @throws Zend_Gdata_Gapps_ServiceException + * @throws mixed + */ + public static function throwServiceExceptionIfDetected($e) { + // Check to make sure that there actually response! + // This can happen if the connection dies before the request + // completes. (See ZF-5949) + $response = $e->getResponse(); + if (!$response) { + require_once('Zend/Gdata/App/IOException.php'); + throw new Zend_Gdata_App_IOException('No HTTP response received (possible connection failure)'); + } + + try { + // Check to see if there is an AppsForYourDomainErrors + // datastructure in the response. If so, convert it to + // an exception and throw it. + require_once 'Zend/Gdata/Gapps/ServiceException.php'; + $error = new Zend_Gdata_Gapps_ServiceException(); + $error->importFromString($response->getBody()); + throw $error; + } catch (Zend_Gdata_App_Exception $e2) { + // Unable to convert the response to a ServiceException, + // most likely because the server didn't return an + // AppsForYourDomainErrors document. Throw the original + // exception. + throw $e; + } + } + + /** + * Imports a feed located at $uri. + * This method overrides the default behavior of Zend_Gdata_App, + * providing support for Zend_Gdata_Gapps_ServiceException. + * + * @param string $uri + * @param Zend_Http_Client $client (optional) The client used for + * communication + * @param string $className (optional) The class which is used as the + * return type + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + * @return Zend_Gdata_App_Feed + */ + public static function import($uri, $client = null, $className='Zend_Gdata_App_Feed') + { + try { + return parent::import($uri, $client, $className); + } catch (Zend_Gdata_App_HttpException $e) { + self::throwServiceExceptionIfDetected($e); + } + } + + /** + * GET a URI using client object. + * This method overrides the default behavior of Zend_Gdata_App, + * providing support for Zend_Gdata_Gapps_ServiceException. + * + * @param string $uri GET URI + * @param array $extraHeaders Extra headers to add to the request, as an + * array of string-based key/value pairs. + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + * @return Zend_Http_Response + */ + public function get($uri, $extraHeaders = array()) + { + try { + return parent::get($uri, $extraHeaders); + } catch (Zend_Gdata_App_HttpException $e) { + self::throwServiceExceptionIfDetected($e); + } + } + + /** + * POST data with client object. + * This method overrides the default behavior of Zend_Gdata_App, + * providing support for Zend_Gdata_Gapps_ServiceException. + * + * @param mixed $data The Zend_Gdata_App_Entry or XML to post + * @param string $uri (optional) POST URI + * @param integer $remainingRedirects (optional) + * @param string $contentType Content-type of the data + * @param array $extraHaders Extra headers to add tot he request + * @return Zend_Http_Response + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_App_InvalidArgumentException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function post($data, $uri = null, $remainingRedirects = null, + $contentType = null, $extraHeaders = null) + { + try { + return parent::post($data, $uri, $remainingRedirects, $contentType, $extraHeaders); + } catch (Zend_Gdata_App_HttpException $e) { + self::throwServiceExceptionIfDetected($e); + } + } + + /** + * PUT data with client object + * This method overrides the default behavior of Zend_Gdata_App, + * providing support for Zend_Gdata_Gapps_ServiceException. + * + * @param mixed $data The Zend_Gdata_App_Entry or XML to post + * @param string $uri (optional) PUT URI + * @param integer $remainingRedirects (optional) + * @param string $contentType Content-type of the data + * @param array $extraHaders Extra headers to add tot he request + * @return Zend_Http_Response + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_App_InvalidArgumentException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function put($data, $uri = null, $remainingRedirects = null, + $contentType = null, $extraHeaders = null) + { + try { + return parent::put($data, $uri, $remainingRedirects, $contentType, $extraHeaders); + } catch (Zend_Gdata_App_HttpException $e) { + self::throwServiceExceptionIfDetected($e); + } + } + + /** + * DELETE entry with client object + * This method overrides the default behavior of Zend_Gdata_App, + * providing support for Zend_Gdata_Gapps_ServiceException. + * + * @param mixed $data The Zend_Gdata_App_Entry or URL to delete + * @param integer $remainingRedirects (optional) + * @return void + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_App_InvalidArgumentException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function delete($data, $remainingRedirects = null) + { + try { + return parent::delete($data, $remainingRedirects); + } catch (Zend_Gdata_App_HttpException $e) { + self::throwServiceExceptionIfDetected($e); + } + } + + /** + * Set domain for this service instance. This should be a fully qualified + * domain, such as 'foo.example.com'. + * + * This value is used when calculating URLs for retrieving and posting + * entries. If no value is specified, a URL will have to be manually + * constructed prior to using any methods which interact with the Google + * Apps provisioning service. + * + * @param string $value The domain to be used for this session. + */ + public function setDomain($value) + { + $this->_domain = $value; + } + + /** + * Get domain for this service instance. This should be a fully qualified + * domain, such as 'foo.example.com'. If no domain is set, null will be + * returned. + * + * @return string The domain to be used for this session, or null if not + * set. + */ + public function getDomain() + { + return $this->_domain; + } + + /** + * Returns the base URL used to access the Google Apps service, based + * on the current domain. The current domain can be temporarily + * overridden by providing a fully qualified domain as $domain. + * + * @param string $domain (optional) A fully-qualified domain to use + * instead of the default domain for this service instance. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function getBaseUrl($domain = null) + { + if ($domain !== null) { + return self::APPS_BASE_FEED_URI . '/' . $domain; + } else if ($this->_domain !== null) { + return self::APPS_BASE_FEED_URI . '/' . $this->_domain; + } else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Domain must be specified.'); + } + } + + /** + * Retrieve a UserFeed containing multiple UserEntry objects. + * + * @param mixed $location (optional) The location for the feed, as a URL + * or Query. + * @return Zend_Gdata_Gapps_UserFeed + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function getUserFeed($location = null) + { + if ($location === null) { + $uri = $this->getBaseUrl() . self::APPS_USER_PATH; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Gapps_UserFeed'); + } + + /** + * Retreive NicknameFeed object containing multiple NicknameEntry objects. + * + * @param mixed $location (optional) The location for the feed, as a URL + * or Query. + * @return Zend_Gdata_Gapps_NicknameFeed + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function getNicknameFeed($location = null) + { + if ($location === null) { + $uri = $this->getBaseUrl() . self::APPS_NICKNAME_PATH; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Gapps_NicknameFeed'); + } + + /** + * Retreive EmailListFeed object containing multiple EmailListEntry + * objects. + * + * @param mixed $location (optional) The location for the feed, as a URL + * or Query. + * @return Zend_Gdata_Gapps_EmailListFeed + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function getEmailListFeed($location = null) + { + if ($location === null) { + $uri = $this->getBaseUrl() . self::APPS_NICKNAME_PATH; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Gapps_EmailListFeed'); + } + + /** + * Retreive EmailListRecipientFeed object containing multiple + * EmailListRecipientEntry objects. + * + * @param mixed $location The location for the feed, as a URL or Query. + * @return Zend_Gdata_Gapps_EmailListRecipientFeed + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function getEmailListRecipientFeed($location) + { + 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::getFeed($uri, 'Zend_Gdata_Gapps_EmailListRecipientFeed'); + } + + /** + * Retreive a single UserEntry object. + * + * @param mixed $location The location for the feed, as a URL or Query. + * @return Zend_Gdata_Gapps_UserEntry + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function getUserEntry($location) + { + 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_Gapps_UserEntry'); + } + + /** + * Retreive a single NicknameEntry object. + * + * @param mixed $location The location for the feed, as a URL or Query. + * @return Zend_Gdata_Gapps_NicknameEntry + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function getNicknameEntry($location) + { + 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_Gapps_NicknameEntry'); + } + + /** + * Retreive a single EmailListEntry object. + * + * @param mixed $location The location for the feed, as a URL or Query. + * @return Zend_Gdata_Gapps_EmailListEntry + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function getEmailListEntry($location) + { + 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_Gapps_EmailListEntry'); + } + + /** + * Retreive a single EmailListRecipientEntry object. + * + * @param mixed $location The location for the feed, as a URL or Query. + * @return Zend_Gdata_Gapps_EmailListRecipientEntry + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function getEmailListRecipientEntry($location) + { + 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_Gapps_EmailListRecipientEntry'); + } + + /** + * Create a new user from a UserEntry. + * + * @param Zend_Gdata_Gapps_UserEntry $user The user entry to insert. + * @param string $uri (optional) The URI where the user should be + * uploaded to. If null, the default user creation URI for + * this domain will be used. + * @return Zend_Gdata_Gapps_UserEntry The inserted user entry as + * returned by the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function insertUser($user, $uri = null) + { + if ($uri === null) { + $uri = $this->getBaseUrl() . self::APPS_USER_PATH; + } + $newEntry = $this->insertEntry($user, $uri, 'Zend_Gdata_Gapps_UserEntry'); + return $newEntry; + } + + /** + * Create a new nickname from a NicknameEntry. + * + * @param Zend_Gdata_Gapps_NicknameEntry $nickname The nickname entry to + * insert. + * @param string $uri (optional) The URI where the nickname should be + * uploaded to. If null, the default nickname creation URI for + * this domain will be used. + * @return Zend_Gdata_Gapps_NicknameEntry The inserted nickname entry as + * returned by the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function insertNickname($nickname, $uri = null) + { + if ($uri === null) { + $uri = $this->getBaseUrl() . self::APPS_NICKNAME_PATH; + } + $newEntry = $this->insertEntry($nickname, $uri, 'Zend_Gdata_Gapps_NicknameEntry'); + return $newEntry; + } + + /** + * Create a new email list from an EmailListEntry. + * + * @param Zend_Gdata_Gapps_EmailListEntry $emailList The email list entry + * to insert. + * @param string $uri (optional) The URI where the email list should be + * uploaded to. If null, the default email list creation URI for + * this domain will be used. + * @return Zend_Gdata_Gapps_EmailListEntry The inserted email list entry + * as returned by the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function insertEmailList($emailList, $uri = null) + { + if ($uri === null) { + $uri = $this->getBaseUrl() . self::APPS_EMAIL_LIST_PATH; + } + $newEntry = $this->insertEntry($emailList, $uri, 'Zend_Gdata_Gapps_EmailListEntry'); + return $newEntry; + } + + /** + * Create a new email list recipient from an EmailListRecipientEntry. + * + * @param Zend_Gdata_Gapps_EmailListRecipientEntry $recipient The recipient + * entry to insert. + * @param string $uri (optional) The URI where the recipient should be + * uploaded to. If null, the default recipient creation URI for + * this domain will be used. + * @return Zend_Gdata_Gapps_EmailListRecipientEntry The inserted + * recipient entry as returned by the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function insertEmailListRecipient($recipient, $uri = null) + { + if ($uri === null) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'URI must not be null'); + } elseif ($uri instanceof Zend_Gdata_Gapps_EmailListEntry) { + $uri = $uri->getLink('edit')->href; + } + $newEntry = $this->insertEntry($recipient, $uri, 'Zend_Gdata_Gapps_EmailListRecipientEntry'); + return $newEntry; + } + + /** + * Provides a magic factory method to instantiate new objects with + * shorter syntax than would otherwise be required by the Zend Framework + * naming conventions. For more information, see Zend_Gdata_App::__call(). + * + * This overrides the default behavior of __call() so that query classes + * do not need to have their domain manually set when created with + * a magic factory method. + * + * @see Zend_Gdata_App::__call() + * @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+Query)/', $method, $matches)) { + $class = $matches[1]; + $foundClassName = null; + foreach ($this->_registeredPackages as $name) { + try { + require_once 'Zend/Loader.php'; + @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); + // Prepend the domain to the query + $args = array_merge(array($this->getDomain()), $args); + 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 { + return parent::__call($method, $args); + } + + } + + // Convenience methods + // Specified at http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html#appendix_e + + /** + * Create a new user entry and send it to the Google Apps servers. + * + * @param string $username The username for the new user. + * @param string $givenName The given name for the new user. + * @param string $familyName The family name for the new user. + * @param string $password The password for the new user as a plaintext string + * (if $passwordHashFunction is null) or a SHA-1 hashed + * value (if $passwordHashFunction = 'SHA-1'). + * @param string $quotaLimitInMB (optional) The quota limit for the new user in MB. + * @return Zend_Gdata_Gapps_UserEntry (optional) The new user entry as returned by + * server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function createUser ($username, $givenName, $familyName, $password, + $passwordHashFunction = null, $quotaLimitInMB = null) { + $user = $this->newUserEntry(); + $user->login = $this->newLogin(); + $user->login->username = $username; + $user->login->password = $password; + $user->login->hashFunctionName = $passwordHashFunction; + $user->name = $this->newName(); + $user->name->givenName = $givenName; + $user->name->familyName = $familyName; + if ($quotaLimitInMB !== null) { + $user->quota = $this->newQuota(); + $user->quota->limit = $quotaLimitInMB; + } + return $this->insertUser($user); + } + + /** + * Retrieve a user based on their username. + * + * @param string $username The username to search for. + * @return Zend_Gdata_Gapps_UserEntry The username to search for, or null + * if no match found. + * @throws Zend_Gdata_App_InvalidArgumentException + * @throws Zend_Gdata_App_HttpException + */ + public function retrieveUser ($username) { + $query = $this->newUserQuery($username); + try { + $user = $this->getUserEntry($query); + } catch (Zend_Gdata_Gapps_ServiceException $e) { + // Set the user to null if not found + if ($e->hasError(Zend_Gdata_Gapps_Error::ENTITY_DOES_NOT_EXIST)) { + $user = null; + } else { + throw $e; + } + } + return $user; + } + + /** + * Retrieve a page of users in alphabetical order, starting with the + * provided username. + * + * @param string $startUsername (optional) The first username to retrieve. + * If null or not declared, the page will begin with the first + * user in the domain. + * @return Zend_Gdata_Gapps_UserFeed Collection of Zend_Gdata_UserEntry + * objects representing all users in the domain. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrievePageOfUsers ($startUsername = null) { + $query = $this->newUserQuery(); + $query->setStartUsername($startUsername); + return $this->getUserFeed($query); + } + + /** + * Retrieve all users in the current domain. Be aware that + * calling this function on a domain with many users will take a + * signifigant amount of time to complete. On larger domains this may + * may cause execution to timeout without proper precautions in place. + * + * @return Zend_Gdata_Gapps_UserFeed Collection of Zend_Gdata_UserEntry + * objects representing all users in the domain. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrieveAllUsers () { + return $this->retrieveAllEntriesForFeed($this->retrievePageOfUsers()); + } + + /** + * Overwrite a specified username with the provided UserEntry. The + * UserEntry does not need to contain an edit link. + * + * This method is provided for compliance with the Google Apps + * Provisioning API specification. Normally users will instead want to + * call UserEntry::save() instead. + * + * @see Zend_Gdata_App_Entry::save + * @param string $username The username whose data will be overwritten. + * @param Zend_Gdata_Gapps_UserEntry $userEntry The user entry which + * will be overwritten. + * @return Zend_Gdata_Gapps_UserEntry The UserEntry returned by the + * server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function updateUser($username, $userEntry) { + return $this->updateEntry($userEntry, $this->getBaseUrl() . + self::APPS_USER_PATH . '/' . $username); + } + + /** + * Mark a given user as suspended. + * + * @param string $username The username associated with the user who + * should be suspended. + * @return Zend_Gdata_Gapps_UserEntry The UserEntry for the modified + * user. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function suspendUser($username) { + $user = $this->retrieveUser($username); + $user->login->suspended = true; + return $user->save(); + } + + /** + * Mark a given user as not suspended. + * + * @param string $username The username associated with the user who + * should be restored. + * @return Zend_Gdata_Gapps_UserEntry The UserEntry for the modified + * user. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function restoreUser($username) { + $user = $this->retrieveUser($username); + $user->login->suspended = false; + return $user->save(); + } + + /** + * Delete a user by username. + * + * @param string $username The username associated with the user who + * should be deleted. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function deleteUser($username) { + $this->delete($this->getBaseUrl() . self::APPS_USER_PATH . '/' . + $username); + } + + /** + * Create a nickname for a given user. + * + * @param string $username The username to which the new nickname should + * be associated. + * @param string $nickname The new nickname to be created. + * @return Zend_Gdata_Gapps_NicknameEntry The nickname entry which was + * created by the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function createNickname($username, $nickname) { + $entry = $this->newNicknameEntry(); + $nickname = $this->newNickname($nickname); + $login = $this->newLogin($username); + $entry->nickname = $nickname; + $entry->login = $login; + return $this->insertNickname($entry); + } + + /** + * Retrieve the entry for a specified nickname. + * + * @param string $nickname The nickname to be retrieved. + * @return Zend_Gdata_Gapps_NicknameEntry The requested nickname entry. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrieveNickname($nickname) { + $query = $this->newNicknameQuery(); + $query->setNickname($nickname); + try { + $nickname = $this->getNicknameEntry($query); + } catch (Zend_Gdata_Gapps_ServiceException $e) { + // Set the nickname to null if not found + if ($e->hasError(Zend_Gdata_Gapps_Error::ENTITY_DOES_NOT_EXIST)) { + $nickname = null; + } else { + throw $e; + } + } + return $nickname; + } + + /** + * Retrieve all nicknames associated with a specific username. + * + * @param string $username The username whose nicknames should be + * returned. + * @return Zend_Gdata_Gapps_NicknameFeed A feed containing all nicknames + * for the given user, or null if + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrieveNicknames($username) { + $query = $this->newNicknameQuery(); + $query->setUsername($username); + $nicknameFeed = $this->retrieveAllEntriesForFeed( + $this->getNicknameFeed($query)); + return $nicknameFeed; + } + + /** + * Retrieve a page of nicknames in alphabetical order, starting with the + * provided nickname. + * + * @param string $startNickname (optional) The first nickname to + * retrieve. If null or not declared, the page will begin with + * the first nickname in the domain. + * @return Zend_Gdata_Gapps_NicknameFeed Collection of Zend_Gdata_NicknameEntry + * objects representing all nicknames in the domain. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrievePageOfNicknames ($startNickname = null) { + $query = $this->newNicknameQuery(); + $query->setStartNickname($startNickname); + return $this->getNicknameFeed($query); + } + + /** + * Retrieve all nicknames in the current domain. Be aware that + * calling this function on a domain with many nicknames will take a + * signifigant amount of time to complete. On larger domains this may + * may cause execution to timeout without proper precautions in place. + * + * @return Zend_Gdata_Gapps_NicknameFeed Collection of Zend_Gdata_NicknameEntry + * objects representing all nicknames in the domain. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrieveAllNicknames () { + return $this->retrieveAllEntriesForFeed($this->retrievePageOfNicknames()); + } + + /** + * Delete a specified nickname. + * + * @param string $nickname The name of the nickname to be deleted. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function deleteNickname($nickname) { + $this->delete($this->getBaseUrl() . self::APPS_NICKNAME_PATH . '/' . $nickname); + } + + /** + * Create a new email list. + * + * @param string $emailList The name of the email list to be created. + * @return Zend_Gdata_Gapps_EmailListEntry The email list entry + * as created on the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function createEmailList($emailList) { + $entry = $this->newEmailListEntry(); + $list = $this->newEmailList(); + $list->name = $emailList; + $entry->emailList = $list; + return $this->insertEmailList($entry); + } + + /** + * Retrieve all email lists associated with a recipient. + * + * @param string $username The recipient whose associated email lists + * should be returned. + * @return Zend_Gdata_Gapps_EmailListFeed The list of email lists found as + * Zend_Gdata_EmailListEntry objects. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrieveEmailLists($recipient) { + $query = $this->newEmailListQuery(); + $query->recipient = $recipient; + return $this->getEmailListFeed($query); + } + + /** + * Retrieve a page of email lists in alphabetical order, starting with the + * provided email list. + * + * @param string $startEmailListName (optional) The first list to + * retrieve. If null or not defined, the page will begin + * with the first email list in the domain. + * @return Zend_Gdata_Gapps_EmailListFeed Collection of Zend_Gdata_EmailListEntry + * objects representing all nicknames in the domain. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrievePageOfEmailLists ($startNickname = null) { + $query = $this->newEmailListQuery(); + $query->setStartEmailListName($startNickname); + return $this->getEmailListFeed($query); + } + + /** + * Retrieve all email lists associated with the curent domain. Be aware that + * calling this function on a domain with many email lists will take a + * signifigant amount of time to complete. On larger domains this may + * may cause execution to timeout without proper precautions in place. + * + * @return Zend_Gdata_Gapps_EmailListFeed The list of email lists found + * as Zend_Gdata_Gapps_EmailListEntry objects. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrieveAllEmailLists() { + return $this->retrieveAllEntriesForFeed($this->retrievePageOfEmailLists()); + } + + /** + * Delete a specified email list. + * + * @param string $emailList The name of the emailList to be deleted. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function deleteEmailList($emailList) { + $this->delete($this->getBaseUrl() . self::APPS_EMAIL_LIST_PATH . '/' + . $emailList); + } + + /** + * Add a specified recipient to an existing emailList. + * + * @param string $recipientAddress The address of the recipient to be + * added to the email list. + * @param string $emailList The name of the email address to which the + * recipient should be added. + * @return Zend_Gdata_Gapps_EmailListRecipientEntry The recipient entry + * created by the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function addRecipientToEmailList($recipientAddress, $emailList) { + $entry = $this->newEmailListRecipientEntry(); + $who = $this->newWho(); + $who->email = $recipientAddress; + $entry->who = $who; + $address = $this->getBaseUrl() . self::APPS_EMAIL_LIST_PATH . '/' . + $emailList . self::APPS_EMAIL_LIST_RECIPIENT_POSTFIX . '/'; + return $this->insertEmailListRecipient($entry, $address); + } + + /** + * Retrieve a page of email list recipients in alphabetical order, + * starting with the provided email list recipient. + * + * @param string $emaiList The email list which should be searched. + * @param string $startRecipient (optinal) The address of the first + * recipient, or null to start with the first recipient in + * the list. + * @return Zend_Gdata_Gapps_EmailListRecipientFeed Collection of + * Zend_Gdata_EmailListRecipientEntry objects representing all + * recpients in the specified list. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrievePageOfRecipients ($emailList, + $startRecipient = null) { + $query = $this->newEmailListRecipientQuery(); + $query->setEmailListName($emailList); + $query->setStartRecipient($startRecipient); + return $this->getEmailListRecipientFeed($query); + } + + /** + * Retrieve all recipients associated with an email list. Be aware that + * calling this function on a domain with many email lists will take a + * signifigant amount of time to complete. On larger domains this may + * may cause execution to timeout without proper precautions in place. + * + * @param string $emaiList The email list which should be searched. + * @return Zend_Gdata_Gapps_EmailListRecipientFeed The list of email lists + * found as Zend_Gdata_Gapps_EmailListRecipientEntry objects. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function retrieveAllRecipients($emailList) { + return $this->retrieveAllEntriesForFeed( + $this->retrievePageOfRecipients($emailList)); + } + + /** + * Remove a specified recipient from an email list. + * + * @param string $recipientAddress The recipient to be removed. + * @param string $emailList The list from which the recipient should + * be removed. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + * @throws Zend_Gdata_Gapps_ServiceException + */ + public function removeRecipientFromEmailList($recipientAddress, $emailList) { + $this->delete($this->getBaseUrl() . self::APPS_EMAIL_LIST_PATH . '/' + . $emailList . self::APPS_EMAIL_LIST_RECIPIENT_POSTFIX . '/' + . $recipientAddress); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/EmailListEntry.php b/applications/core/lib/Zend/Gdata/Gapps/EmailListEntry.php new file mode 100644 index 0000000..f5b06fa --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/EmailListEntry.php @@ -0,0 +1,213 @@ +<?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 Gapps + * @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_Extension_FeedLink + */ +require_once 'Zend/Gdata/Extension/FeedLink.php'; + +/** + * @see Zend_Gdata_Gapps_Extension_EmailList + */ +require_once 'Zend/Gdata/Gapps/Extension/EmailList.php'; + +/** + * Data model class for a Google Apps Email List Entry. + * + * Each email list entry describes a single email list within a Google Apps + * hosted domain. Email lists may contain multiple recipients, as + * described by instances of Zend_Gdata_Gapps_EmailListRecipient. Multiple + * entries are contained within instances of Zend_Gdata_Gapps_EmailListFeed. + * + * To transfer email list entries to and from the Google Apps servers, + * including creating new entries, refer to the Google Apps service class, + * Zend_Gdata_Gapps. + * + * This class represents <atom:entry> in the Google Data protocol. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_EmailListEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListEntry'; + + /** + * <apps:emailList> child element containing general information about + * this email list. + * + * @var Zend_Gdata_Gapps_Extension_EmailList + */ + protected $_emailList = null; + + /** + * <gd:feedLink> element containing information about other feeds + * relevant to this entry. + * + * @var Zend_Gdata_Extension_FeedLink + */ + protected $_feedLink = array(); + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_emailList !== null) { + $element->appendChild($this->_emailList->getDOM($element->ownerDocument)); + } + foreach ($this->_feedLink as $feedLink) { + $element->appendChild($feedLink->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('apps') . ':' . 'emailList'; + $emailList = new Zend_Gdata_Gapps_Extension_EmailList(); + $emailList->transferFromDOM($child); + $this->_emailList = $emailList; + break; + case $this->lookupNamespace('gd') . ':' . 'feedLink'; + $feedLink = new Zend_Gdata_Extension_FeedLink(); + $feedLink->transferFromDOM($child); + $this->_feedLink[] = $feedLink; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Retrieve the email list property for this entry. + * + * @see setEmailList + * @return Zend_Gdata_Gapps_Extension_EmailList The requested object + * or null if not set. + */ + public function getEmailList() + { + return $this->_emailList; + } + + /** + * Set the email list property for this entry. This property contains + * information such as the name of this email list. + * + * This corresponds to the <apps:emailList> property in the Google Data + * protocol. + * + * @param Zend_Gdata_Gapps_Extension_EmailList $value The desired value + * this element, or null to unset. + * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface + */ + public function setEmailList($value) + { + $this->_emailList = $value; + return $this; + } + + /** + * Get the feed link property for this entry. + * + * @see setFeedLink + * @param string $rel (optional) The rel value of the link to be found. + * If null, the array of links is returned. + * @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink + * object corresponding to the requested rel value is returned + * if found, or null if the requested value is not found. If + * $rel is null or not specified, an array of all available + * feed links for this entry is returned, or null if no feed + * links are set. + */ + public function getFeedLink($rel = null) + { + if ($rel == null) { + return $this->_feedLink; + } else { + foreach ($this->_feedLink as $feedLink) { + if ($feedLink->rel == $rel) { + return $feedLink; + } + } + return null; + } + } + + /** + * Set the feed link property for this entry. Feed links provide + * information about other feeds associated with this entry. + * + * This corresponds to the <gd:feedLink> property in the Google Data + * protocol. + * + * @param array $value A collection of Zend_Gdata_Gapps_Extension_FeedLink + * instances representing all feed links for this entry, or + * null to unset. + * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface + */ + public function setFeedLink($value) + { + $this->_feedLink = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/EmailListFeed.php b/applications/core/lib/Zend/Gdata/Gapps/EmailListFeed.php new file mode 100644 index 0000000..a2a0069 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/EmailListFeed.php @@ -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 + * @subpackage Gapps + * @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'; + +/** + * @see Zend_Gdata_Gapps_EmailListEntry + */ +require_once 'Zend/Gdata/Gapps/EmailListEntry.php'; + +/** + * Data model for a collection of Google Apps email list entries, usually + * provided by the Google Apps servers. + * + * For information on requesting this feed from a server, see the Google + * Apps service class, Zend_Gdata_Gapps. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_EmailListFeed extends Zend_Gdata_Feed +{ + + protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListEntry'; + protected $_feedClassName = 'Zend_Gdata_Gapps_EmailListFeed'; + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/EmailListQuery.php b/applications/core/lib/Zend/Gdata/Gapps/EmailListQuery.php new file mode 100644 index 0000000..5bdd1a1 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/EmailListQuery.php @@ -0,0 +1,186 @@ +<?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 Gapps + * @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_Gapps_Query + */ +require_once('Zend/Gdata/Gapps/Query.php'); + +/** + * Assists in constructing queries for Google Apps email list entries. + * Instances of this class can be provided in many places where a URL is + * required. + * + * For information on submitting queries to a server, see the Google Apps + * service class, Zend_Gdata_Gapps. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_EmailListQuery extends Zend_Gdata_Gapps_Query +{ + + /** + * A string which, if not null, indicates which email list should + * be retrieved by this query. + * + * @var string + */ + protected $_emailListName = null; + + /** + * Create a new instance. + * + * @param string $domain (optional) The Google Apps-hosted domain to use + * when constructing query URIs. + * @param string $emailListName (optional) Value for the emailListName + * property. + * @param string $recipient (optional) Value for the recipient + * property. + * @param string $startEmailListName (optional) Value for the + * startEmailListName property. + */ + public function __construct($domain = null, $emailListName = null, + $recipient = null, $startEmailListName = null) + { + parent::__construct($domain); + $this->setEmailListName($emailListName); + $this->setRecipient($recipient); + $this->setStartEmailListName($startEmailListName); + } + + /** + * Set the email list name to query for. When set, only lists with a name + * matching this value will be returned in search results. Set to + * null to disable filtering by list name. + * + * @param string $value The email list name to filter search results by, + * or null to disable. + */ + public function setEmailListName($value) + { + $this->_emailListName = $value; + } + + /** + * Get the email list name to query for. If no name is set, null will be + * returned. + * + * @see setEmailListName + * @return string The email list name to filter search results by, or null + * if disabled. + */ + public function getEmailListName() + { + return $this->_emailListName; + } + + /** + * Set the recipient to query for. When set, only subscribers with an + * email address matching this value will be returned in search results. + * Set to null to disable filtering by username. + * + * @param string $value The recipient email address to filter search + * results by, or null to disable. + */ + public function setRecipient($value) + { + if ($value !== null) { + $this->_params['recipient'] = $value; + } + else { + unset($this->_params['recipient']); + } + } + + /** + * Get the recipient email address to query for. If no recipient is set, + * null will be returned. + * + * @see setRecipient + * @return string The recipient email address to filter search results by, + * or null if disabled. + */ + public function getRecipient() + { + if (array_key_exists('recipient', $this->_params)) { + return $this->_params['recipient']; + } else { + return null; + } + } + + /** + * Set the first email list which should be displayed when retrieving + * a list of email lists. + * + * @param string $value The first email list to be returned, or null to + * disable. + */ + public function setStartEmailListName($value) + { + if ($value !== null) { + $this->_params['startEmailListName'] = $value; + } else { + unset($this->_params['startEmailListName']); + } + } + + /** + * Get the first email list which should be displayed when retrieving + * a list of email lists. + * + * @return string The first email list to be returned, or null to + * disable. + */ + public function getStartEmailListName() + { + if (array_key_exists('startEmailListName', $this->_params)) { + return $this->_params['startEmailListName']; + } else { + return null; + } + } + + /** + * Returns the URL generated for this query, based on it's current + * parameters. + * + * @return string A URL generated based on the state of this query. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function getQueryUrl() + { + + $uri = $this->getBaseUrl(); + $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_PATH; + if ($this->_emailListName !== null) { + $uri .= '/' . $this->_emailListName; + } + $uri .= $this->getQueryString(); + return $uri; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/EmailListRecipientEntry.php b/applications/core/lib/Zend/Gdata/Gapps/EmailListRecipientEntry.php new file mode 100644 index 0000000..7db02fd --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/EmailListRecipientEntry.php @@ -0,0 +1,145 @@ +<?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 Gapps + * @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_Extension_Who + */ +require_once 'Zend/Gdata/Extension/Who.php'; + +/** + * Data model class for a Google Apps Email List Recipient Entry. + * + * Each instance of this class represents a recipient of an email list + * hosted on a Google Apps domain. Each email list may contain multiple + * recipients. Email lists themselves are described by + * Zend_Gdata_EmailListEntry. Multiple recipient entries are contained within + * instances of Zend_Gdata_Gapps_EmailListRecipientFeed. + * + * To transfer email list recipients to and from the Google Apps servers, + * including creating new recipients, refer to the Google Apps service class, + * Zend_Gdata_Gapps. + * + * This class represents <atom:entry> in the Google Data protocol. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_EmailListRecipientEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListRecipientEntry'; + + /** + * <gd:who> element used to store the email address of the current + * recipient. Only the email property of this element should be + * populated. + * + * @var Zend_Gdata_Extension_Who + */ + protected $_who = null; + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_who !== null) { + $element->appendChild($this->_who->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('gd') . ':' . 'who'; + $who = new Zend_Gdata_Extension_Who(); + $who->transferFromDOM($child); + $this->_who = $who; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value of the who property for this object. + * + * @see setWho + * @return Zend_Gdata_Extension_Who The requested object. + */ + public function getWho() + { + return $this->_who; + } + + /** + * Set the value of the who property for this object. This property + * is used to store the email address of the current recipient. + * + * @param Zend_Gdata_Extension_Who $value The desired value for this + * instance's who property. + * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface. + */ + public function setWho($value) + { + $this->_who = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/EmailListRecipientFeed.php b/applications/core/lib/Zend/Gdata/Gapps/EmailListRecipientFeed.php new file mode 100644 index 0000000..763896a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/EmailListRecipientFeed.php @@ -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 + * @subpackage Gapps + * @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'; + +/** + * @see Zend_Gdata_Gapps_EmailListRecipientEntry + */ +require_once 'Zend/Gdata/Gapps/EmailListRecipientEntry.php'; + +/** + * Data model for a collection of Google Apps email list recipient entries, + * usually provided by the Google Apps servers. + * + * For information on requesting this feed from a server, see the Google + * Apps service class, Zend_Gdata_Gapps. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_EmailListRecipientFeed extends Zend_Gdata_Feed +{ + + protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListRecipientEntry'; + protected $_feedClassName = 'Zend_Gdata_Gapps_EmailListRecipientFeed'; + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/EmailListRecipientQuery.php b/applications/core/lib/Zend/Gdata/Gapps/EmailListRecipientQuery.php new file mode 100644 index 0000000..0f130f9 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/EmailListRecipientQuery.php @@ -0,0 +1,152 @@ +<?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 Gapps + * @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_Gapps_Query + */ +require_once('Zend/Gdata/Gapps/Query.php'); + +/** + * Assists in constructing queries for Google Apps email list recipient + * entries. Instances of this class can be provided in many places where a + * URL is required. + * + * For information on submitting queries to a server, see the Google Apps + * service class, Zend_Gdata_Gapps. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_EmailListRecipientQuery extends Zend_Gdata_Gapps_Query +{ + + /** + * If not null, specifies the name of the email list which + * should be requested by this query. + * + * @var string + */ + protected $_emailListName = null; + + /** + * Create a new instance. + * + * @param string $domain (optional) The Google Apps-hosted domain to use + * when constructing query URIs. + * @param string $emailListName (optional) Value for the emailListName + * property. + * @param string $startRecipient (optional) Value for the + * startRecipient property. + */ + public function __construct($domain = null, $emailListName = null, + $startRecipient = null) + { + parent::__construct($domain); + $this->setEmailListName($emailListName); + $this->setStartRecipient($startRecipient); + } + + /** + * Set the email list name to query for. When set, only lists with a name + * matching this value will be returned in search results. Set to + * null to disable filtering by list name. + * + * @param string $value The email list name to filter search results by, + * or null to disable. + */ + public function setEmailListName($value) + { + $this->_emailListName = $value; + } + + /** + * Get the email list name to query for. If no name is set, null will be + * returned. + * + * @param string $value The email list name to filter search results by, + * or null if disabled. + */ + public function getEmailListName() + { + return $this->_emailListName; + } + + /** + * Set the first recipient which should be displayed when retrieving + * a list of email list recipients. + * + * @param string $value The first recipient to be returned, or null to + * disable. + */ + public function setStartRecipient($value) + { + if ($value !== null) { + $this->_params['startRecipient'] = $value; + } else { + unset($this->_params['startRecipient']); + } + } + + /** + * Get the first recipient which should be displayed when retrieving + * a list of email list recipients. + * + * @return string The first recipient to be returned, or null if + * disabled. + */ + public function getStartRecipient() + { + if (array_key_exists('startRecipient', $this->_params)) { + return $this->_params['startRecipient']; + } else { + return null; + } + } + + /** + * Returns the URL generated for this query, based on it's current + * parameters. + * + * @return string A URL generated based on the state of this query. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function getQueryUrl() + { + + $uri = $this->getBaseUrl(); + $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_PATH; + if ($this->_emailListName !== null) { + $uri .= '/' . $this->_emailListName; + } else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'EmailListName must not be null'); + } + $uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_RECIPIENT_POSTFIX . '/'; + $uri .= $this->getQueryString(); + return $uri; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/Error.php b/applications/core/lib/Zend/Gdata/Gapps/Error.php new file mode 100644 index 0000000..2a76e67 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/Error.php @@ -0,0 +1,232 @@ +<?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 Gapps + * @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_Base + */ +require_once 'Zend/Gdata/App/Base.php'; + +/** + * Gdata Gapps Error class. This class is used to represent errors returned + * within an AppsForYourDomainErrors message received from the Google Apps + * servers. + * + * Several different errors may be represented by this class, determined by + * the error code returned by the server. For a list of error codes + * available at the time of this writing, see getErrorCode. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_Error extends Zend_Gdata_App_Base +{ + + // Error codes as defined at + // http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html#appendix_d + + const UNKNOWN_ERROR = 1000; + const USER_DELETED_RECENTLY = 1100; + const USER_SUSPENDED = 1101; + const DOMAIN_USER_LIMIT_EXCEEDED = 1200; + const DOMAIN_ALIAS_LIMIT_EXCEEDED = 1201; + const DOMAIN_SUSPENDED = 1202; + const DOMAIN_FEATURE_UNAVAILABLE = 1203; + const ENTITY_EXISTS = 1300; + const ENTITY_DOES_NOT_EXIST = 1301; + const ENTITY_NAME_IS_RESERVED = 1302; + const ENTITY_NAME_NOT_VALID = 1303; + const INVALID_GIVEN_NAME = 1400; + const INVALID_FAMILY_NAME = 1401; + const INVALID_PASSWORD = 1402; + const INVALID_USERNAME = 1403; + const INVALID_HASH_FUNCTION_NAME = 1404; + const INVALID_HASH_DIGEST_LENGTH = 1405; + const INVALID_EMAIL_ADDRESS = 1406; + const INVALID_QUERY_PARAMETER_VALUE = 1407; + const TOO_MANY_RECIPIENTS_ON_EMAIL_LIST = 1500; + + protected $_errorCode = null; + protected $_reason = null; + protected $_invalidInput = null; + + public function __construct($errorCode = null, $reason = null, + $invalidInput = null) { + parent::__construct("Google Apps error received: $errorCode ($reason)"); + $this->_errorCode = $errorCode; + $this->_reason = $reason; + $this->_invalidInput = $invalidInput; + } + + /** + * Set the error code for this exception. For more information about + * error codes, see getErrorCode. + * + * @see getErrorCode + * @param integer $value The new value for the error code. + */ + public function setErrorCode($value) { + $this->_errorCode = $value; + } + + /** + * Get the error code for this exception. Currently valid values are + * available as constants within this class. These values are: + * + * UNKNOWN_ERROR (1000) + * USER_DELETED_RECENTLY (1100) + * USER_SUSPENDED (1101) + * DOMAIN_USER_LIMIT_EXCEEDED (1200) + * DOMAIN_ALIAS_LIMIT_EXCEEDED (1201) + * DOMAIN_SUSPENDED (1202) + * DOMAIN_FEATURE_UNAVAILABLE (1203) + * ENTITY_EXISTS (1300) + * ENTITY_DOES_NOT_EXIST (1301) + * ENTITY_NAME_IS_RESERVED (1302) + * ENTITY_NAME_NOT_VALID (1303) + * INVALID_GIVEN_NAME (1400) + * INVALID_FAMILY_NAME (1401) + * INVALID_PASSWORD (1402) + * INVALID_USERNAME (1403) + * INVALID_HASH_FUNCTION_NAME (1404) + * INVALID_HASH_DIGEST_LENGTH (1405) + * INVALID_EMAIL_ADDRESS (1406) + * INVALID_QUERY_PARAMETER_VALUE (1407) + * TOO_MANY_RECIPIENTS_ON_EMAIL_LIST (1500) + * + * Numbers in parenthesis indicate the actual integer value of the + * constant. This list should not be treated as exhaustive, as additional + * error codes may be added at any time. + * + * For more information about these codes and their meaning, please + * see Appendix D of the Google Apps Provisioning API Reference. + * + * @link http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html#appendix_d Google Apps Provisioning API Reference: Appendix D - Gdata Error Codes + * @see setErrorCode + * @return integer The error code returned by the Google Apps server. + */ + public function getErrorCode() { + return $this->_errorCode; + } + + /** + * Set human-readable text describing the reason this exception occurred. + * + * @see getReason + * @param string $value The reason this exception occurred. + */ + public function setReason($value) { + $this->_reason = $value; + } + + /** + * Get human-readable text describing the reason this exception occurred. + * + * @see setReason + * @return string The reason this exception occurred. + */ + public function getReason() { + return $this->_reason; + } + + /** + * Set the invalid input which caused this exception. + * + * @see getInvalidInput + * @param string $value The invalid input that triggered this exception. + */ + public function setInvalidInput($value) { + $this->_invalidInput = $value; + } + + /** + * Set the invalid input which caused this exception. + * + * @see setInvalidInput + * @return string The reason this exception occurred. + */ + public function getInvalidInput() { + return $this->_invalidInput; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_errorCode !== null) { + $element->setAttribute('errorCode', $this->_errorCode); + } + if ($this->_reason !== null) { + $element->setAttribute('reason', $this->_reason); + } + if ($this->_invalidInput !== null) { + $element->setAttribute('invalidInput', $this->_invalidInput); + } + 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 'errorCode': + $this->_errorCode = $attribute->nodeValue; + break; + case 'reason': + $this->_reason = $attribute->nodeValue; + break; + case 'invalidInput': + $this->_invalidInput = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get a human readable version of this exception. + * + * @return string + */ + public function __toString() { + return "Error " . $this->getErrorCode() . ": " . $this->getReason() . + "\n\tInvalid Input: \"" . $this->getInvalidInput() . "\""; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/Extension/EmailList.php b/applications/core/lib/Zend/Gdata/Gapps/Extension/EmailList.php new file mode 100644 index 0000000..e5e82ca --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/Extension/EmailList.php @@ -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 + * @subpackage Gapps + * @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_Gapps + */ +require_once 'Zend/Gdata/Gapps.php'; + +/** + * Represents the apps:emailList element used by the Apps data API. This + * class represents properties of an email list and is usually contained + * within an instance of Zend_Gdata_Gapps_EmailListEntry. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_Extension_EmailList extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'apps'; + protected $_rootElement = 'emailList'; + + /** + * The name of the email list. This name is used as the email address + * for this list. + * + * @var string + */ + protected $_name = null; + + /** + * Constructs a new Zend_Gdata_Gapps_Extension_EmailList object. + * + * @param string $name (optional) The name to be used for this email list. + */ + public function __construct($name = null) + { + $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); + parent::__construct(); + $this->_name = $name; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_name !== null) { + $element->setAttribute('name', $this->_name); + } + 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 'name': + $this->_name = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's name attribute. + * + * @see setName + * @return string The requested attribute. + */ + public function getName() + { + return $this->_name; + } + + /** + * Set the value for this element's name attribute. This is the unique + * name which will be used to identify this email list within this + * domain, and will be used to form this email list's email address. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_EmailList The element being modified. + */ + public function setName($value) + { + $this->_name = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + * + * @return string + */ + public function __toString() + { + return $this->getName(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/Extension/Login.php b/applications/core/lib/Zend/Gdata/Gapps/Extension/Login.php new file mode 100644 index 0000000..556748f --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/Extension/Login.php @@ -0,0 +1,484 @@ +<?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 Gapps + * @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_Gapps + */ +require_once 'Zend/Gdata/Gapps.php'; + +/** + * Represents the apps:login element used by the Apps data API. This + * class is used to describe properties of a user, and is usually contained + * within instances of Zene_Gdata_Gapps_UserEntry or any other class + * which is linked to a particular username. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_Extension_Login extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'apps'; + protected $_rootElement = 'login'; + + /** + * The username for this user. This is used as the user's email address + * and when logging in to Google Apps-hosted services. + * + * @var string + */ + protected $_username = null; + + /** + * The password for the user. May be in cleartext or as an SHA-1 + * digest, depending on the value of _hashFunctionName. + * + * @var string + */ + protected $_password = null; + + /** + * Specifies whether the password stored in _password is in cleartext + * or is an SHA-1 digest of a password. If the password is cleartext, + * then this should be null. If the password is an SHA-1 digest, then + * this should be set to 'SHA-1'. + * + * At the time of writing, no other hash functions are supported + * + * @var string + */ + protected $_hashFunctionName = null; + + /** + * True if the user has administrative rights for this domain, false + * otherwise. + * + * @var boolean + */ + protected $_admin = null; + + /** + * True if the user has agreed to the terms of service for Google Apps, + * false otherwise. + * + * @var boolean. + */ + protected $_agreedToTerms = null; + + /** + * True if this user has been suspended, false otherwise. + * + * @var boolean + */ + protected $_suspended = null; + + /** + * True if the user will be required to change their password at + * their next login, false otherwise. + * + * @var boolean + */ + protected $_changePasswordAtNextLogin = null; + + /** + * Constructs a new Zend_Gdata_Gapps_Extension_Login object. + * + * @param string $username (optional) The username to be used for this + * login. + * @param string $password (optional) The password to be used for this + * login. + * @param string $hashFunctionName (optional) The name of the hash + * function used to protect the password, or null if no + * has function has been applied. As of this writing, + * the only valid values are 'SHA-1' or null. + * @param boolean $admin (optional) Whether the user is an administrator + * or not. + * @param boolean $suspended (optional) Whether this login is suspended or not. + * @param boolean $changePasswordAtNextLogin (optional) Whether + * the user is required to change their password at their + * next login. + * @param boolean $agreedToTerms (optional) Whether the user has + * agreed to the terms of service. + */ + public function __construct($username = null, $password = null, + $hashFunctionName = null, $admin = null, $suspended = null, + $changePasswordAtNextLogin = null, $agreedToTerms = null) + { + $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); + parent::__construct(); + $this->_username = $username; + $this->_password = $password; + $this->_hashFunctionName = $hashFunctionName; + $this->_admin = $admin; + $this->_agreedToTerms = $agreedToTerms; + $this->_suspended = $suspended; + $this->_changePasswordAtNextLogin = $changePasswordAtNextLogin; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_username !== null) { + $element->setAttribute('userName', $this->_username); + } + if ($this->_password !== null) { + $element->setAttribute('password', $this->_password); + } + if ($this->_hashFunctionName !== null) { + $element->setAttribute('hashFunctionName', $this->_hashFunctionName); + } + if ($this->_admin !== null) { + $element->setAttribute('admin', ($this->_admin ? "true" : "false")); + } + if ($this->_agreedToTerms !== null) { + $element->setAttribute('agreedToTerms', ($this->_agreedToTerms ? "true" : "false")); + } + if ($this->_suspended !== null) { + $element->setAttribute('suspended', ($this->_suspended ? "true" : "false")); + } + if ($this->_changePasswordAtNextLogin !== null) { + $element->setAttribute('changePasswordAtNextLogin', ($this->_changePasswordAtNextLogin ? "true" : "false")); + } + + 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 'userName': + $this->_username = $attribute->nodeValue; + break; + case 'password': + $this->_password = $attribute->nodeValue; + break; + case 'hashFunctionName': + $this->_hashFunctionName = $attribute->nodeValue; + break; + case 'admin': + if ($attribute->nodeValue == "true") { + $this->_admin = true; + } + else if ($attribute->nodeValue == "false") { + $this->_admin = false; + } + else { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#admin."); + } + break; + case 'agreedToTerms': + if ($attribute->nodeValue == "true") { + $this->_agreedToTerms = true; + } + else if ($attribute->nodeValue == "false") { + $this->_agreedToTerms = false; + } + else { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#agreedToTerms."); + } + break; + case 'suspended': + if ($attribute->nodeValue == "true") { + $this->_suspended = true; + } + else if ($attribute->nodeValue == "false") { + $this->_suspended = false; + } + else { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#suspended."); + } + break; + case 'changePasswordAtNextLogin': + if ($attribute->nodeValue == "true") { + $this->_changePasswordAtNextLogin = true; + } + else if ($attribute->nodeValue == "false") { + $this->_changePasswordAtNextLogin = false; + } + else { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#changePasswordAtNextLogin."); + } + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's username attribute. + * + * @see setUsername + * @return string The attribute being modified. + */ + public function getUsername() + { + return $this->_username; + } + + /** + * Set the value for this element's username attribute. This string + * is used to uniquely identify the user in this domian and is used + * to form this user's email address. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface. + */ + public function setUsername($value) + { + $this->_username = $value; + return $this; + } + + /** + * Get the value for this element's password attribute. + * + * @see setPassword + * @return string The requested attribute. + */ + public function getPassword() + { + return $this->_password; + } + + /** + * Set the value for this element's password attribute. As of this + * writing, this can be either be provided as plaintext or hashed using + * the SHA-1 algorithm for protection. If using a hash function, + * this must be indicated by calling setHashFunctionName(). + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface. + */ + public function setPassword($value) + { + $this->_password = $value; + return $this; + } + + /** + * Get the value for this element's hashFunctionName attribute. + * + * @see setHashFunctionName + * @return string The requested attribute. + */ + public function getHashFunctionName() + { + return $this->_hashFunctionName; + } + + /** + * Set the value for this element's hashFunctionName attribute. This + * indicates whether the password supplied with setPassword() is in + * plaintext or has had a hash function applied to it. If null, + * plaintext is assumed. As of this writing, the only valid hash + * function is 'SHA-1'. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface. + */ + public function setHashFunctionName($value) + { + $this->_hashFunctionName = $value; + return $this; + } + + /** + * Get the value for this element's admin attribute. + * + * @see setAdmin + * @return boolean The requested attribute. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function getAdmin() + { + if (!(is_bool($this->_admin))) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for admin.'); + } + return $this->_admin; + } + + /** + * Set the value for this element's admin attribute. This indicates + * whether this user is an administrator for this domain. + * + * @param boolean $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function setAdmin($value) + { + if (!(is_bool($value))) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.'); + } + $this->_admin = $value; + return $this; + } + + /** + * Get the value for this element's agreedToTerms attribute. + * + * @see setAgreedToTerms + * @return boolean The requested attribute. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function getAgreedToTerms() + { + if (!(is_bool($this->_agreedToTerms))) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for agreedToTerms.'); + } + return $this->_agreedToTerms; + } + + /** + * Set the value for this element's agreedToTerms attribute. This + * indicates whether this user has agreed to the terms of service. + * + * @param boolean $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function setAgreedToTerms($value) + { + if (!(is_bool($value))) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.'); + } + $this->_agreedToTerms = $value; + return $this; + } + + /** + * Get the value for this element's suspended attribute. + * + * @see setSuspended + * @return boolean The requested attribute. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function getSuspended() + { + if (!(is_bool($this->_suspended))) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for suspended.'); + } + return $this->_suspended; + } + + /** + * Set the value for this element's suspended attribute. If true, the + * user will not be able to login to this domain until unsuspended. + * + * @param boolean $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function setSuspended($value) + { + if (!(is_bool($value))) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.'); + } + $this->_suspended = $value; + return $this; + } + + /** + * Get the value for this element's changePasswordAtNextLogin attribute. + * + * @see setChangePasswordAtNextLogin + * @return boolean The requested attribute. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function getChangePasswordAtNextLogin() + { + if (!(is_bool($this->_changePasswordAtNextLogin))) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for changePasswordAtNextLogin.'); + } + return $this->_changePasswordAtNextLogin; + } + + /** + * Set the value for this element's changePasswordAtNextLogin attribute. + * If true, the user will be forced to set a new password the next + * time they login. + * + * @param boolean $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function setChangePasswordAtNextLogin($value) + { + if (!(is_bool($value))) { + require_once('Zend/Gdata/App/InvalidArgumentException.php'); + throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.'); + } + $this->_changePasswordAtNextLogin = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return "Username: " . $this->getUsername() . + "\nPassword: " . (($this->getPassword() === null) ? "NOT SET" : "SET") . + "\nPassword Hash Function: " . $this->getHashFunctionName() . + "\nAdministrator: " . ($this->getAdmin() ? "Yes" : "No") . + "\nAgreed To Terms: " . ($this->getAgreedToTerms() ? "Yes" : "No") . + "\nSuspended: " . ($this->getSuspended() ? "Yes" : "No"); + } +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/Extension/Name.php b/applications/core/lib/Zend/Gdata/Gapps/Extension/Name.php new file mode 100644 index 0000000..ae8cb97 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/Extension/Name.php @@ -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 + * @subpackage Gapps + * @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_Gapps + */ +require_once 'Zend/Gdata/Gapps.php'; + +/** + * Represents the apps:name element used by the Apps data API. This is used + * to represent a user's full name. This class is usually contained within + * instances of Zend_Gdata_Gapps_UserEntry. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_Extension_Name extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'apps'; + protected $_rootElement = 'name'; + + /** + * The associated user's family name. + * + * @var string + */ + protected $_familyName = null; + + /** + * The associated user's given name. + * + * @var string + */ + protected $_givenName = null; + + /** + * Constructs a new Zend_Gdata_Gapps_Extension_Name object. + * + * @param string $familyName (optional) The familyName to be set for this + * object. + * @param string $givenName (optional) The givenName to be set for this + * object. + */ + public function __construct($familyName = null, $givenName = null) + { + $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); + parent::__construct(); + $this->_familyName = $familyName; + $this->_givenName = $givenName; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_familyName !== null) { + $element->setAttribute('familyName', $this->_familyName); + } + if ($this->_givenName !== null) { + $element->setAttribute('givenName', $this->_givenName); + } + 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 'familyName': + $this->_familyName = $attribute->nodeValue; + break; + case 'givenName': + $this->_givenName = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's familyName attribute. + * + * @see setFamilyName + * @return string The requested attribute. + */ + public function getFamilyName() + { + return $this->_familyName; + } + + /** + * Set the value for this element's familyName attribute. This + * represents a user's family name. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Name Provides a fluent interface.. + */ + public function setFamilyName($value) + { + $this->_familyName = $value; + return $this; + } + + /** + * Get the value for this element's givenName attribute. + * + * @see setGivenName + * @return string The requested attribute. + */ + public function getGivenName() + { + return $this->_givenName; + } + + /** + * Set the value for this element's givenName attribute. This + * represents a user's given name. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Name Provides a fluent interface. + */ + public function setGivenName($value) + { + $this->_givenName = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->getGivenName() . ' ' . $this->getFamilyName(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/Extension/Nickname.php b/applications/core/lib/Zend/Gdata/Gapps/Extension/Nickname.php new file mode 100644 index 0000000..d0e86cd --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/Extension/Nickname.php @@ -0,0 +1,141 @@ +<?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 Gapps + * @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_Gapps + */ +require_once 'Zend/Gdata/Gapps.php'; + +/** + * Represents the apps:nickname element used by the Apps data API. This + * is used to describe a nickname's properties, and is usually contained + * within instances of Zend_Gdata_Gapps_NicknameEntry. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_Extension_Nickname extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'apps'; + protected $_rootElement = 'nickname'; + + /** + * The name of the nickname. This name is used as the email address + * for this nickname. + * + * @var string + */ + protected $_name = null; + + /** + * Constructs a new Zend_Gdata_Gapps_Extension_Nickname object. + * @param string $name (optional) The nickname being represented. + */ + public function __construct($name = null) + { + $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); + parent::__construct(); + $this->_name = $name; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_name !== null) { + $element->setAttribute('name', $this->_name); + } + 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 'name': + $this->_name = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's name attribute. + * + * @see setName + * @return string The requested attribute. + */ + public function getName() + { + return $this->_name; + } + + /** + * Set the value for this element's name attribute. This name uniquely + * describes this nickname within the domain. Emails addressed to this + * name will be delivered to the user who owns this nickname. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Nickname Provides a fluent + * interface. + */ + public function setName($value) + { + $this->_name = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->getName(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/Extension/Quota.php b/applications/core/lib/Zend/Gdata/Gapps/Extension/Quota.php new file mode 100644 index 0000000..ce5c4da --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/Extension/Quota.php @@ -0,0 +1,141 @@ +<?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 Gapps + * @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_Gapps + */ +require_once 'Zend/Gdata/Gapps.php'; + +/** + * Represents the apps:quota element used by the Apps data API. This is + * used to indicate the amount of storage space available to a user. Quotas + * may not be able to be set, depending on the domain used. This class + * is usually contained within an instance of Zend_Gdata_Gapps_UserEntry. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_Extension_Quota extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'apps'; + protected $_rootElement = 'quota'; + + /** + * The amount of storage space available to the user in megabytes. + * + * @var integer + */ + protected $_limit = null; + + /** + * Constructs a new Zend_Gdata_Gapps_Extension_Quota object. + * + * @param string $limit (optional) The limit, in bytes, for this quota. + */ + public function __construct($limit = null) + { + $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); + parent::__construct(); + $this->_limit = $limit; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_limit !== null) { + $element->setAttribute('limit', $this->_limit); + } + 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 'limit': + $this->_limit = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's limit attribute. + * + * @see setLimit + * @return string The requested attribute. + */ + public function getLimit() + { + return $this->_limit; + } + + /** + * Set the value for this element's limit attribute. This is the amount + * of storage space, in bytes, that should be made available to + * the associated user. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Gapps_Extension_Quota Provides a fluent interface. + */ + public function setLimit($value) + { + $this->_limit = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->getLimit(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/NicknameEntry.php b/applications/core/lib/Zend/Gdata/Gapps/NicknameEntry.php new file mode 100644 index 0000000..bc9fc1c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/NicknameEntry.php @@ -0,0 +1,188 @@ +<?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 Gapps + * @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_Gapps_Extension_Login + */ +require_once 'Zend/Gdata/Gapps/Extension/Login.php'; + +/** + * @see Zend_Gdata_Gapps_Extension_Nickname + */ +require_once 'Zend/Gdata/Gapps/Extension/Nickname.php'; + +/** + * Data model class for a Google Apps Nickname Entry. + * + * Each nickname entry describes a single nickname within a Google Apps + * hosted domain. Each user may own several nicknames, but each nickname may + * only belong to one user. Multiple entries are contained within instances + * of Zend_Gdata_Gapps_NicknameFeed. + * + * To transfer nickname entries to and from the Google Apps servers, + * including creating new entries, refer to the Google Apps service class, + * Zend_Gdata_Gapps. + * + * This class represents <atom:entry> in the Google Data protocol. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_NicknameEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Gapps_NicknameEntry'; + + /** + * <apps:login> element used to hold information about the owner + * of this nickname, including their username. + * + * @var Zend_Gdata_Gapps_Extension_Login + */ + protected $_login = null; + + /** + * <apps:nickname> element used to hold the name of this nickname. + * + * @var Zend_Gdata_Gapps_Extension_Nickname + */ + protected $_nickname = null; + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_login !== null) { + $element->appendChild($this->_login->getDOM($element->ownerDocument)); + } + if ($this->_nickname !== null) { + $element->appendChild($this->_nickname->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('apps') . ':' . 'login'; + $login = new Zend_Gdata_Gapps_Extension_Login(); + $login->transferFromDOM($child); + $this->_login = $login; + break; + case $this->lookupNamespace('apps') . ':' . 'nickname'; + $nickname = new Zend_Gdata_Gapps_Extension_Nickname(); + $nickname->transferFromDOM($child); + $this->_nickname = $nickname; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value of the login property for this object. + * + * @see setLogin + * @return Zend_Gdata_Gapps_Extension_Login The requested object. + */ + public function getLogin() + { + return $this->_login; + } + + /** + * Set the value of the login property for this object. This property + * is used to store the username address of the current user. + * + * @param Zend_Gdata_Gapps_Extension_Login $value The desired value for + * this instance's login property. + * @return Zend_Gdata_Gapps_NicknameEntry Provides a fluent interface. + */ + public function setLogin($value) + { + $this->_login = $value; + return $this; + } + + /** + * Get the value of the nickname property for this object. + * + * @see setNickname + * @return Zend_Gdata_Gapps_Extension_Nickname The requested object. + */ + public function getNickname() + { + return $this->_nickname; + } + + /** + * Set the value of the nickname property for this object. This property + * is used to store the the name of the current nickname. + * + * @param Zend_Gdata_Gapps_Extension_Nickname $value The desired value for + * this instance's nickname property. + * @return Zend_Gdata_Gapps_NicknameEntry Provides a fluent interface. + */ + public function setNickname($value) + { + $this->_nickname = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/NicknameFeed.php b/applications/core/lib/Zend/Gdata/Gapps/NicknameFeed.php new file mode 100644 index 0000000..726d8e8 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/NicknameFeed.php @@ -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 + * @subpackage Gapps + * @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'; + +/** + * @see Zend_Gdata_Gapps_NicknameEntry + */ +require_once 'Zend/Gdata/Gapps/NicknameEntry.php'; + +/** + * Data model for a collection of Google Apps nickname entries, usually + * provided by the Google Apps servers. + * + * For information on requesting this feed from a server, see the Google + * Apps service class, Zend_Gdata_Gapps. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_NicknameFeed extends Zend_Gdata_Feed +{ + + protected $_entryClassName = 'Zend_Gdata_Gapps_NicknameEntry'; + protected $_feedClassName = 'Zend_Gdata_Gapps_NicknameFeed'; + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/NicknameQuery.php b/applications/core/lib/Zend/Gdata/Gapps/NicknameQuery.php new file mode 100644 index 0000000..a88bda7 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/NicknameQuery.php @@ -0,0 +1,185 @@ +<?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 Gapps + * @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_Gapps_Query + */ +require_once('Zend/Gdata/Gapps/Query.php'); + +/** + * Assists in constructing queries for Google Apps nickname entries. + * Instances of this class can be provided in many places where a URL is + * required. + * + * For information on submitting queries to a server, see the Google Apps + * service class, Zend_Gdata_Gapps. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_NicknameQuery extends Zend_Gdata_Gapps_Query +{ + + /** + * If not null, indicates the name of the nickname entry which + * should be returned by this query. + * + * @var string + */ + protected $_nickname = null; + + /** + * Create a new instance. + * + * @param string $domain (optional) The Google Apps-hosted domain to use + * when constructing query URIs. + * @param string $nickname (optional) Value for the nickname + * property. + * @param string $username (optional) Value for the username + * property. + * @param string $startNickname (optional) Value for the + * startNickname property. + */ + public function __construct($domain = null, $nickname = null, + $username = null, $startNickname = null) + { + parent::__construct($domain); + $this->setNickname($nickname); + $this->setUsername($username); + $this->setStartNickname($startNickname); + } + + /** + * Set the nickname to query for. When set, only users with a nickname + * matching this value will be returned in search results. Set to + * null to disable filtering by username. + * + * @param string $value The nickname to filter search results by, or null + * to disable. + */ + public function setNickname($value) + { + $this->_nickname = $value; + } + + /** + * Get the nickname to query for. If no nickname is set, null will be + * returned. + * + * @see setNickname + * @return string The nickname to filter search results by, or null if + * disabled. + */ + public function getNickname() + { + return $this->_nickname; + } + + /** + * Set the username to query for. When set, only users with a username + * matching this value will be returned in search results. Set to + * null to disable filtering by username. + * + * @param string $value The username to filter search results by, or null + * to disable. + */ + public function setUsername($value) + { + if ($value !== null) { + $this->_params['username'] = $value; + } + else { + unset($this->_params['username']); + } + } + + /** + * Get the username to query for. If no username is set, null will be + * returned. + * + * @see setUsername + * @return string The username to filter search results by, or null if + * disabled. + */ + public function getUsername() + { + if (array_key_exists('username', $this->_params)) { + return $this->_params['username']; + } else { + return null; + } + } + + /** + * Set the first nickname which should be displayed when retrieving + * a list of nicknames. + * + * @param string $value The first nickname to be returned, or null to + * disable. + */ + public function setStartNickname($value) + { + if ($value !== null) { + $this->_params['startNickname'] = $value; + } else { + unset($this->_params['startNickname']); + } + } + + /** + * Get the first nickname which should be displayed when retrieving + * a list of nicknames. + * + * @return string The first nickname to be returned, or null to + * disable. + */ + public function getStartNickname() + { + if (array_key_exists('startNickname', $this->_params)) { + return $this->_params['startNickname']; + } else { + return null; + } + } + + /** + * Returns the URL generated for this query, based on it's current + * parameters. + * + * @return string A URL generated based on the state of this query. + */ + public function getQueryUrl() + { + + $uri = $this->getBaseUrl(); + $uri .= Zend_Gdata_Gapps::APPS_NICKNAME_PATH; + if ($this->_nickname !== null) { + $uri .= '/' . $this->_nickname; + } + $uri .= $this->getQueryString(); + return $uri; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/Query.php b/applications/core/lib/Zend/Gdata/Gapps/Query.php new file mode 100644 index 0000000..7c70603 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/Query.php @@ -0,0 +1,122 @@ +<?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 Gapps + * @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_Gapps + */ +require_once('Zend/Gdata/Gapps.php'); + +/** + * Assists in constructing queries for Google Apps entries. This class + * provides common methods used by all other Google Apps query classes. + * + * This class should never be instantiated directly. Instead, instantiate a + * class which inherits from this class. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_Query extends Zend_Gdata_Query +{ + + /** + * The domain which is being administered via the Provisioning API. + * + * @var string + */ + protected $_domain = null; + + /** + * Create a new instance. + * + * @param string $domain (optional) The Google Apps-hosted domain to use + * when constructing query URIs. + */ + public function __construct($domain = null) + { + parent::__construct(); + $this->_domain = $domain; + } + + /** + * Set domain for this service instance. This should be a fully qualified + * domain, such as 'foo.example.com'. + * + * This value is used when calculating URLs for retrieving and posting + * entries. If no value is specified, a URL will have to be manually + * constructed prior to using any methods which interact with the Google + * Apps provisioning service. + * + * @param string $value The domain to be used for this session. + */ + public function setDomain($value) + { + $this->_domain = $value; + } + + /** + * Get domain for this service instance. This should be a fully qualified + * domain, such as 'foo.example.com'. If no domain is set, null will be + * returned. + * + * @see setDomain + * @return string The domain to be used for this session, or null if not + * set. + */ + public function getDomain() + { + return $this->_domain; + } + + /** + * Returns the base URL used to access the Google Apps service, based + * on the current domain. The current domain can be temporarily + * overridden by providing a fully qualified domain as $domain. + * + * @see setDomain + * @param string $domain (optional) A fully-qualified domain to use + * instead of the default domain for this service instance. + */ + public function getBaseUrl($domain = null) + { + if ($domain !== null) { + return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $domain; + } + else if ($this->_domain !== null) { + return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $this->_domain; + } + else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Domain must be specified.'); + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/ServiceException.php b/applications/core/lib/Zend/Gdata/Gapps/ServiceException.php new file mode 100644 index 0000000..41cee69 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/ServiceException.php @@ -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 + * @subpackage Gapps + * @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_Gdata_Gapps_Error + */ +require_once 'Zend/Gdata/Gapps/Error.php'; + +/** + * Gdata Gapps Exception class. This is thrown when an + * AppsForYourDomainErrors message is received from the Google Apps + * servers. + * + * Several different errors may be represented by this exception. For a list + * of error codes available, see getErrorCode. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_ServiceException extends Zend_Exception +{ + + protected $_rootElement = "AppsForYourDomainErrors"; + + /** + * Array of Zend_Gdata_Error objects indexed by error code. + * + * @var array + */ + protected $_errors = array(); + + /** + * Create a new ServiceException. + * + * @return array An array containing a collection of + * Zend_Gdata_Gapps_Error objects. + */ + public function __construct($errors = null) { + parent::__construct("Server errors encountered"); + if ($errors !== null) { + $this->setErrors($errors); + } + } + + /** + * Add a single Error object to the list of errors received by the + * server. + * + * @param Zend_Gdata_Gapps_Error $error An instance of an error returned + * by the server. The error's errorCode must be set. + * @throws Zend_Gdata_App_Exception + */ + public function addError($error) { + // Make sure that we don't try to index an error that doesn't + // contain an index value. + if ($error->getErrorCode() == null) { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception("Error encountered without corresponding error code."); + } + + $this->_errors[$error->getErrorCode()] = $error; + } + + /** + * Set the list of errors as sent by the server inside of an + * AppsForYourDomainErrors tag. + * + * @param array $array An associative array containing a collection of + * Zend_Gdata_Gapps_Error objects. All errors must have their + * errorCode value set. + * @throws Zend_Gdata_App_Exception + */ + public function setErrors($array) { + $this->_errors = array(); + foreach ($array as $error) { + $this->addError($error); + } + } + + /** + * Get the list of errors as sent by the server inside of an + * AppsForYourDomainErrors tag. + * + * @return array An associative array containing a collection of + * Zend_Gdata_Gapps_Error objects, indexed by error code. + */ + public function getErrors() { + return $this->_errors; + } + + /** + * Return the Error object associated with a specific error code. + * + * @return Zend_Gdata_Gapps_Error The Error object requested, or null + * if not found. + */ + public function getError($errorCode) { + if (array_key_exists($errorCode, $this->_errors)) { + $result = $this->_errors[$errorCode]; + return $result; + } else { + return null; + } + } + + /** + * Check whether or not a particular error code was returned by the + * server. + * + * @param integer $errorCode The error code to check against. + * @return boolean Whether or not the supplied error code was returned + * by the server. + */ + public function hasError($errorCode) { + return array_key_exists($errorCode, $this->_errors); + } + + /** + * Import an AppsForYourDomain error from XML. + * + * @param string $string The XML data to be imported + * @return Zend_Gdata_Gapps_ServiceException Provides a fluent interface. + * @throws Zend_Gdata_App_Exception + */ + public function importFromString($string) { + if ($string) { + // Check to see if an AppsForYourDomainError exists + // + // track_errors is temporarily enabled so that if an error + // occurs while parsing the XML we can append it to an + // exception by referencing $php_errormsg + @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'; + // $php_errormsg is automatically generated by PHP if + // an error occurs while calling loadXML(), above. + throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg"); + } + + // Ensure that the outermost node is an AppsForYourDomain error. + // If it isn't, something has gone horribly wrong. + $rootElement = $doc->getElementsByTagName($this->_rootElement)->item(0); + if (!$rootElement) { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.'); + } + + foreach ($rootElement->childNodes as $errorNode) { + if (!($errorNode instanceof DOMText)) { + $error = new Zend_Gdata_Gapps_Error(); + $error->transferFromDom($errorNode); + $this->addError($error); + } + } + return $this; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('XML passed to transferFromXML cannot be null'); + } + + } + + /** + * Get a human readable version of this exception. + * + * @return string + */ + public function __toString() { + $result = "The server encountered the following errors processing the request:"; + foreach ($this->_errors as $error) { + $result .= "\n" . $error->__toString(); + } + return $result; + } +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/UserEntry.php b/applications/core/lib/Zend/Gdata/Gapps/UserEntry.php new file mode 100644 index 0000000..d0ed067 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/UserEntry.php @@ -0,0 +1,294 @@ +<?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 Gapps + * @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_Extension_FeedLink + */ +require_once 'Zend/Gdata/Extension/FeedLink.php'; + +/** + * @see Zend_Gdata_Gapps_Extension_Login + */ +require_once 'Zend/Gdata/Gapps/Extension/Login.php'; + +/** + * @see Zend_Gdata_Gapps_Extension_Name + */ +require_once 'Zend/Gdata/Gapps/Extension/Name.php'; + +/** + * @see Zend_Gdata_Gapps_Extension_Quota + */ +require_once 'Zend/Gdata/Gapps/Extension/Quota.php'; + +/** + * Data model class for a Google Apps User Entry. + * + * Each user entry describes a single user within a Google Apps hosted + * domain. + * + * To transfer user entries to and from the Google Apps servers, including + * creating new entries, refer to the Google Apps service class, + * Zend_Gdata_Gapps. + * + * This class represents <atom:entry> in the Google Data protocol. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_UserEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Gapps_UserEntry'; + + /** + * <apps:login> element containing information about this user's + * account, including their username and permissions. + * + * @var Zend_Gdata_Gapps_Extension_Login + */ + protected $_login = null; + + /** + * <apps:name> element containing the user's actual name. + * + * @var Zend_Gdata_Gapps_Extension_Name + */ + protected $_name = null; + + /** + * <apps:quotq> element describing any storage quotas in place for + * this user. + * + * @var Zend_Gdata_Gapps_Extension_Quota + */ + protected $_quota = null; + + /** + * <gd:feedLink> element containing information about other feeds + * relevant to this entry. + * + * @var Zend_Gdata_Extension_FeedLink + */ + protected $_feedLink = array(); + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_login !== null) { + $element->appendChild($this->_login->getDOM($element->ownerDocument)); + } + if ($this->_name !== null) { + $element->appendChild($this->_name->getDOM($element->ownerDocument)); + } + if ($this->_quota !== null) { + $element->appendChild($this->_quota->getDOM($element->ownerDocument)); + } + foreach ($this->_feedLink as $feedLink) { + $element->appendChild($feedLink->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('apps') . ':' . 'login'; + $login = new Zend_Gdata_Gapps_Extension_Login(); + $login->transferFromDOM($child); + $this->_login = $login; + break; + case $this->lookupNamespace('apps') . ':' . 'name'; + $name = new Zend_Gdata_Gapps_Extension_Name(); + $name->transferFromDOM($child); + $this->_name = $name; + break; + case $this->lookupNamespace('apps') . ':' . 'quota'; + $quota = new Zend_Gdata_Gapps_Extension_Quota(); + $quota->transferFromDOM($child); + $this->_quota = $quota; + break; + case $this->lookupNamespace('gd') . ':' . 'feedLink'; + $feedLink = new Zend_Gdata_Extension_FeedLink(); + $feedLink->transferFromDOM($child); + $this->_feedLink[] = $feedLink; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value of the login property for this object. + * + * @see setLogin + * @return Zend_Gdata_Gapps_Extension_Login The requested object. + */ + public function getLogin() + { + return $this->_login; + } + + /** + * Set the value of the login property for this object. This property + * is used to store the username address of the current user. + * + * @param Zend_Gdata_Gapps_Extension_Login $value The desired value for + * this instance's login property. + * @return Zend_Gdata_Gapps_UserEntry Provides a fluent interface. + */ + public function setLogin($value) + { + $this->_login = $value; + return $this; + } + + /** + * Get the value of the name property for this object. + * + * @see setName + * @return Zend_Gdata_Gapps_Extension_Name The requested object. + */ + public function getName() + { + return $this->_name; + } + + /** + * Set the value of the name property for this object. This property + * is used to store the full name of the current user. + * + * @param Zend_Gdata_Gapps_Extension_Name $value The desired value for + * this instance's name property. + * @return Zend_Gdata_Gapps_UserEntry Provides a fluent interface. + */ + public function setName($value) + { + $this->_name = $value; + return $this; + } + + /** + * Get the value of the quota property for this object. + * + * @see setQuota + * @return Zend_Gdata_Gapps_Extension_Quota The requested object. + */ + public function getQuota() + { + return $this->_quota; + } + + /** + * Set the value of the quota property for this object. This property + * is used to store the amount of storage available for the current + * user. Quotas may not be modifiable depending on the domain used. + * + * @param Zend_Gdata_Gapps_Extension_Quota $value The desired value for + * this instance's quota property. + * @return Zend_Gdata_Gapps_UserEntry Provides a fluent interface. + */ + public function setQuota($value) + { + $this->_quota = $value; + return $this; + } + + /** + * Returns all feed links for this entry, or if a rel value is + * specified, the feed link associated with that value is returned. + * + * @param string $rel The rel value of the link to be found. If null, + * the array of links is returned instead. + * @return mixed Either an array of Zend_Gdata_Extension_FeedLink + * objects if $rel is null, a single + * Zend_Gdata_Extension_FeedLink object if $rel is specified + * and a matching feed link is found, or null if $rel is + * specified and no matching feed link is found. + */ + public function getFeedLink($rel = null) + { + if ($rel == null) { + return $this->_feedLink; + } else { + foreach ($this->_feedLink as $feedLink) { + if ($feedLink->rel == $rel) { + return $feedLink; + } + } + return null; + } + } + + /** + * Set the value of the feed link property for this object. This property + * is used to provide links to alternative feeds relevant to this entry. + * + * @param array $value A collection of + * Zend_Gdata_Gapps_Extension_FeedLink objects. + * @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface. + */ + public function setFeedLink($value) + { + $this->_feedLink = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/UserFeed.php b/applications/core/lib/Zend/Gdata/Gapps/UserFeed.php new file mode 100644 index 0000000..a86d801 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/UserFeed.php @@ -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 + * @subpackage Gapps + * @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'; + +/** + * @see Zend_Gdata_Gapps_UserEntry + */ +require_once 'Zend/Gdata/Gapps/UserEntry.php'; + +/** + * Data model for a collection of Google Apps user entries, usually + * provided by the Google Apps servers. + * + * For information on requesting this feed from a server, see the Google + * Apps service class, Zend_Gdata_Gapps. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_UserFeed extends Zend_Gdata_Feed +{ + + protected $_entryClassName = 'Zend_Gdata_Gapps_UserEntry'; + protected $_feedClassName = 'Zend_Gdata_Gapps_UserFeed'; + +} diff --git a/applications/core/lib/Zend/Gdata/Gapps/UserQuery.php b/applications/core/lib/Zend/Gdata/Gapps/UserQuery.php new file mode 100644 index 0000000..fa8c19a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gapps/UserQuery.php @@ -0,0 +1,146 @@ +<?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 Gapps + * @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_Gapps_Query + */ +require_once('Zend/Gdata/Gapps/Query.php'); + +/** + * Assists in constructing queries for Google Apps user entries. + * Instances of this class can be provided in many places where a URL is + * required. + * + * For information on submitting queries to a server, see the Google Apps + * service class, Zend_Gdata_Gapps. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gapps + * @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_Gapps_UserQuery extends Zend_Gdata_Gapps_Query +{ + + /** + * If not null, specifies the username of the user who should be + * retrieved by this query. + * + * @var string + */ + protected $_username = null; + + /** + * Create a new instance. + * + * @param string $domain (optional) The Google Apps-hosted domain to use + * when constructing query URIs. + * @param string $username (optional) Value for the username + * property. + * @param string $startUsername (optional) Value for the + * startUsername property. + */ + public function __construct($domain = null, $username = null, + $startUsername = null) + { + parent::__construct($domain); + $this->setUsername($username); + $this->setStartUsername($startUsername); + } + + /** + * Set the username to query for. When set, only users with a username + * matching this value will be returned in search results. Set to + * null to disable filtering by username. + * + * @see getUsername + * @param string $value The username to filter search results by, or null to + * disable. + */ + public function setUsername($value) + { + $this->_username = $value; + } + + /** + * Get the username to query for. If no username is set, null will be + * returned. + * + * @param string $value The username to filter search results by, or + * null if disabled. + */ + public function getUsername() + { + return $this->_username; + } + + /** + * Set the first username which should be displayed when retrieving + * a list of users. + * + * @param string $value The first username to be returned, or null to + * disable. + */ + public function setStartUsername($value) + { + if ($value !== null) { + $this->_params['startUsername'] = $value; + } else { + unset($this->_params['startUsername']); + } + } + + /** + * Get the first username which should be displayed when retrieving + * a list of users. + * + * @see setStartUsername + * @return string The first username to be returned, or null if + * disabled. + */ + public function getStartUsername() + { + if (array_key_exists('startUsername', $this->_params)) { + return $this->_params['startUsername']; + } else { + return null; + } + } + + /** + * Returns the query URL generated by this query instance. + * + * @return string The query URL for this instance. + */ + public function getQueryUrl() + { + $uri = $this->getBaseUrl(); + $uri .= Zend_Gdata_Gapps::APPS_USER_PATH; + if ($this->_username !== null) { + $uri .= '/' . $this->_username; + } + $uri .= $this->getQueryString(); + return $uri; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gbase.php b/applications/core/lib/Zend/Gdata/Gbase.php new file mode 100644 index 0000000..f4d1584 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase.php @@ -0,0 +1,208 @@ +<?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 Gbase + * @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 + * @subpackage Gbase + * @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; + + /** + * Namespaces used for Zend_Gdata_Gbase + * + * @var array + */ + public static $namespaces = array( + array('g', 'http://base.google.com/ns/1.0', 1, 0), + array('batch', 'http://schemas.google.com/gdata/batch', 1, 0) + ); + + /** + * 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'); + } +} diff --git a/applications/core/lib/Zend/Gdata/Gbase/Entry.php b/applications/core/lib/Zend/Gdata/Gbase/Entry.php new file mode 100644 index 0000000..2888e6e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase/Entry.php @@ -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 + * @subpackage Gbase + * @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 + * @subpackage Gbase + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Gbase::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gbase/Extension/BaseAttribute.php b/applications/core/lib/Zend/Gdata/Gbase/Extension/BaseAttribute.php new file mode 100644 index 0000000..62a6fe6 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase/Extension/BaseAttribute.php @@ -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 + * @subpackage Gbase + * @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: Entry.php 3941 2007-03-14 21:36:13Z darby $ + */ + +/** + * @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 + * @subpackage Gbase + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Gbase::$namespaces); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gbase/Feed.php b/applications/core/lib/Zend/Gdata/Gbase/Feed.php new file mode 100644 index 0000000..cb290a1 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase/Feed.php @@ -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 + * @subpackage Gbase + * @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 + * @subpackage Gbase + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Gbase::$namespaces); + parent::__construct($element); + } +} diff --git a/applications/core/lib/Zend/Gdata/Gbase/ItemEntry.php b/applications/core/lib/Zend/Gdata/Gbase/ItemEntry.php new file mode 100644 index 0000000..ca9d514 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase/ItemEntry.php @@ -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 + * @subpackage Gbase + * @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 + * @subpackage Gbase + * @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. + * @param string|null $uri The URI to send requests to, or null if $data + * contains the URI. + * @param string|null $className The name of the class that should we + * deserializing the server response. If null, then + * 'Zend_Gdata_App_Entry' will be used. + * @param array $extraHeaders Extra headers to add to the request, as an + * array of string-based key/value pairs. + * @return Zend_Gdata_App_Entry The updated entry + * @throws Zend_Gdata_App_Exception + */ + public function save($dryRun = false, + $uri = null, + $className = null, + $extraHeaders = array()) + { + if ($dryRun == true) { + $editLink = $this->getEditLink(); + if ($uri == null && $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, + $className, + $extraHeaders); + } else { + parent::save($uri, $className, $extraHeaders); + } + } + + /** + * 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(); + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gbase/ItemFeed.php b/applications/core/lib/Zend/Gdata/Gbase/ItemFeed.php new file mode 100644 index 0000000..e5aeb24 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase/ItemFeed.php @@ -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 + * @subpackage Gbase + * @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 + * @subpackage Gbase + * @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'; +} diff --git a/applications/core/lib/Zend/Gdata/Gbase/ItemQuery.php b/applications/core/lib/Zend/Gdata/Gbase/ItemQuery.php new file mode 100644 index 0000000..70c75b1 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase/ItemQuery.php @@ -0,0 +1,100 @@ +<?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 Gbase + * @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 + * @subpackage Gbase + * @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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gbase/Query.php b/applications/core/lib/Zend/Gdata/Gbase/Query.php new file mode 100644 index 0000000..02f7b49 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase/Query.php @@ -0,0 +1,267 @@ +<?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 Gbase + * @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 + * @subpackage Gbase + * @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; + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/Gbase/SnippetEntry.php b/applications/core/lib/Zend/Gdata/Gbase/SnippetEntry.php new file mode 100644 index 0000000..8485826 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase/SnippetEntry.php @@ -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 + * @subpackage Gbase + * @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 + * @subpackage Gbase + * @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'; +} diff --git a/applications/core/lib/Zend/Gdata/Gbase/SnippetFeed.php b/applications/core/lib/Zend/Gdata/Gbase/SnippetFeed.php new file mode 100644 index 0000000..185549e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase/SnippetFeed.php @@ -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 + * @subpackage Gbase + * @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 + * @subpackage Gbase + * @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'; +} diff --git a/applications/core/lib/Zend/Gdata/Gbase/SnippetQuery.php b/applications/core/lib/Zend/Gdata/Gbase/SnippetQuery.php new file mode 100644 index 0000000..85e5081 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Gbase/SnippetQuery.php @@ -0,0 +1,73 @@ +<?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 Gbase + * @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 + * @subpackage Gbase + * @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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Geo.php b/applications/core/lib/Zend/Gdata/Geo.php new file mode 100755 index 0000000..6d91e67 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Geo.php @@ -0,0 +1,69 @@ +<?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 Geo + * @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 + * GeoRSS + GML extensions. + * @link http://georss.org/ + * @link http://www.opengis.net/gml/ + * @link http://code.google.com/apis/picasaweb/reference.html#georss_reference + * + * @category Zend + * @package Zend_Gdata + * @subpackage Geo + * @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_Geo extends Zend_Gdata +{ + + /** + * Namespaces used for Zend_Gdata_Geo + * + * @var array + */ + public static $namespaces = array( + array('georss', 'http://www.georss.org/georss', 1, 0), + array('gml', 'http://www.opengis.net/gml', 1, 0) + ); + + + /** + * Create Zend_Gdata_Geo 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_Geo'); + $this->registerPackage('Zend_Gdata_Geo_Extension'); + parent::__construct($client, $applicationId); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Geo/Entry.php b/applications/core/lib/Zend/Gdata/Geo/Entry.php new file mode 100755 index 0000000..0a8156a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Geo/Entry.php @@ -0,0 +1,96 @@ +<?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 Geo + * @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_Geo + */ +require_once 'Zend/Gdata/Geo.php'; + +/** + * @see Zend_Gdata_Geo_Extension_GeoRssWhere + */ +require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php'; + +/** + * An Atom entry containing Geograpic data. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Geo + * @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_Geo_Entry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Geo_Entry'; + + protected $_where = null; + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Geo::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_where != null) { + $element->appendChild($this->_where->getDOM($element->ownerDocument)); + } + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + switch ($absoluteNodeName) { + case $this->lookupNamespace('georss') . ':' . 'where': + $where = new Zend_Gdata_Geo_Extension_GeoRssWhere(); + $where->transferFromDOM($child); + $this->_where = $where; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getWhere() + { + return $this->_where; + } + + public function setWhere($value) + { + $this->_where = $value; + return $this; + } + + +} diff --git a/applications/core/lib/Zend/Gdata/Geo/Extension/GeoRssWhere.php b/applications/core/lib/Zend/Gdata/Geo/Extension/GeoRssWhere.php new file mode 100755 index 0000000..f8e80df --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Geo/Extension/GeoRssWhere.php @@ -0,0 +1,134 @@ +<?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 Geo + * @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_Geo + */ +require_once 'Zend/Gdata/Geo.php'; + +/** + * @see Zend_Gdata_Geo_Extension_GmlPoint + */ +require_once 'Zend/Gdata/Geo/Extension/GmlPoint.php'; + + +/** + * Represents the georss:where element used by the Gdata Geo extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Geo + * @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_Geo_Extension_GeoRssWhere extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'georss'; + protected $_rootElement = 'where'; + + /** + * The point location for this geo element + * + * @var Zend_Gdata_Geo_Extension_GmlPoint + */ + protected $_point = null; + + /** + * Create a new instance. + * + * @param Zend_Gdata_Geo_Extension_GmlPoint $point (optional) Point to which + * object should be initialized. + */ + public function __construct($point = null) + { + $this->registerAllNamespaces(Zend_Gdata_Geo::$namespaces); + parent::__construct(); + $this->setPoint($point); + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_point !== null) { + $element->appendChild($this->_point->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('gml') . ':' . 'Point'; + $point = new Zend_Gdata_Geo_Extension_GmlPoint(); + $point->transferFromDOM($child); + $this->_point = $point; + break; + } + } + + /** + * Get the value for this element's point attribute. + * + * @see setPoint + * @return Zend_Gdata_Geo_Extension_GmlPoint The requested attribute. + */ + public function getPoint() + { + return $this->_point; + } + + /** + * Set the value for this element's point attribute. + * + * @param Zend_Gdata_Geo_Extension_GmlPoint $value The desired value for this attribute. + * @return Zend_Gdata_Geo_Extension_GeoRssWhere Provides a fluent interface + */ + public function setPoint($value) + { + $this->_point = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Geo/Extension/GmlPoint.php b/applications/core/lib/Zend/Gdata/Geo/Extension/GmlPoint.php new file mode 100755 index 0000000..7625a0f --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Geo/Extension/GmlPoint.php @@ -0,0 +1,135 @@ +<?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 Geo + * @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_Geo + */ +require_once 'Zend/Gdata/Geo.php'; + +/** + * @see Zend_Gdata_Geo_Extension_GmlPos + */ +require_once 'Zend/Gdata/Geo/Extension/GmlPos.php'; + + +/** + * Represents the gml:point element used by the Gdata Geo extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Geo + * @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_Geo_Extension_GmlPoint extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gml'; + protected $_rootElement = 'Point'; + + /** + * The position represented by this GmlPoint + * + * @var Zend_Gdata_Geo_Extension_GmlPos + */ + protected $_pos = null; + + /** + * Create a new instance. + * + * @param Zend_Gdata_Geo_Extension_GmlPos $pos (optional) Pos to which this + * object should be initialized. + */ + public function __construct($pos = null) + { + $this->registerAllNamespaces(Zend_Gdata_Geo::$namespaces); + parent::__construct(); + $this->setPos($pos); + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_pos !== null) { + $element->appendChild($this->_pos->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('gml') . ':' . 'pos'; + $pos = new Zend_Gdata_Geo_Extension_GmlPos(); + $pos->transferFromDOM($child); + $this->_pos = $pos; + break; + } + } + + /** + * Get the value for this element's pos attribute. + * + * @see setPos + * @return Zend_Gdata_Geo_Extension_GmlPos The requested attribute. + */ + public function getPos() + { + return $this->_pos; + } + + /** + * Set the value for this element's distance attribute. + * + * @param Zend_Gdata_Geo_Extension_GmlPos $value The desired value for this attribute + * @return Zend_Gdata_Geo_Extension_GmlPoint Provides a fluent interface + */ + public function setPos($value) + { + $this->_pos = $value; + return $this; + } + + +} diff --git a/applications/core/lib/Zend/Gdata/Geo/Extension/GmlPos.php b/applications/core/lib/Zend/Gdata/Geo/Extension/GmlPos.php new file mode 100755 index 0000000..3dbb299 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Geo/Extension/GmlPos.php @@ -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 + * @subpackage Geo + * @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_Geo + */ +require_once 'Zend/Gdata/Geo.php'; + +/** + * Represents the gml:pos element used by the Gdata Geo extensions. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Geo + * @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_Geo_Extension_GmlPos extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gml'; + protected $_rootElement = 'pos'; + + /** + * Constructs a new Zend_Gdata_Geo_Extension_GmlPos object. + * + * @param string $text (optional) The value to use for this element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Geo::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Geo/Feed.php b/applications/core/lib/Zend/Gdata/Geo/Feed.php new file mode 100755 index 0000000..a5589b1 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Geo/Feed.php @@ -0,0 +1,63 @@ +<?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 Geo + * @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_eed + */ +require_once 'Zend/Gdata/Feed.php'; + +/** + * @see Zend_Gdata_Geo + */ +require_once 'Zend/Gdata/Geo.php'; + +/** + * @see Zend_Gdata_Geo_Entry + */ +require_once 'Zend/Gdata/Geo/Entry.php'; + +/** + * Feed for Gdata Geographic data entries. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Geo + * @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_Geo_Feed extends Zend_Gdata_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Geo_Entry'; + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Geo::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Health.php b/applications/core/lib/Zend/Gdata/Health.php new file mode 100755 index 0000000..78e4462 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Health.php @@ -0,0 +1,273 @@ +<?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 Health + * @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_Health_ProfileFeed + */ +require_once 'Zend/Gdata/Health/ProfileFeed.php'; + +/** + * @see Zend_Gdata_Health_ProfileListFeed + */ +require_once 'Zend/Gdata/Health/ProfileListFeed.php'; + +/** + * @see Zend_Gdata_Health_ProfileListEntry + */ +require_once 'Zend/Gdata/Health/ProfileListEntry.php'; + +/** + * @see Zend_Gdata_Health_ProfileEntry + */ +require_once 'Zend/Gdata/Health/ProfileEntry.php'; + +/** + * Service class for interacting with the Google Health Data API + * + * @link http://code.google.com/apis/health + * + * @category Zend + * @package Zend_Gdata + * @subpackage Health + * @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_Health extends Zend_Gdata +{ + /** + * URIs of the AuthSub/OAuth feeds. + */ + const AUTHSUB_PROFILE_FEED_URI = + 'https://www.google.com/health/feeds/profile/default'; + const AUTHSUB_REGISTER_FEED_URI = + 'https://www.google.com/health/feeds/register/default'; + + /** + * URIs of the ClientLogin feeds. + */ + const CLIENTLOGIN_PROFILELIST_FEED_URI = + 'https://www.google.com/health/feeds/profile/list'; + const CLIENTLOGIN_PROFILE_FEED_URI = + 'https://www.google.com/health/feeds/profile/ui'; + const CLIENTLOGIN_REGISTER_FEED_URI = + 'https://www.google.com/health/feeds/register/ui'; + + /** + * Authentication service names for Google Health and the H9 Sandbox. + */ + const HEALTH_SERVICE_NAME = 'health'; + const H9_SANDBOX_SERVICE_NAME = 'weaver'; + + /** + * Profile ID used for all API interactions. This can only be set when + * using ClientLogin for authentication. + * + * @var string + */ + private $_profileID = null; + + /** + * True if API calls should be made to the H9 developer sandbox at /h9 + * rather than /health + * + * @var bool + */ + private $_useH9Sandbox = false; + + public static $namespaces = + array('ccr' => 'urn:astm-org:CCR', + 'batch' => 'http://schemas.google.com/gdata/batch', + 'h9m' => 'http://schemas.google.com/health/metadata', + 'gAcl' => 'http://schemas.google.com/acl/2007', + 'gd' => 'http://schemas.google.com/g/2005'); + + /** + * Create Zend_Gdata_Health object + * + * @param Zend_Http_Client $client (optional) The HTTP client to use when + * when communicating with the Google Health servers. + * @param string $applicationId The identity of the application in the form + * of Company-AppName-Version + * @param bool $useH9Sandbox True if the H9 Developer's Sandbox should be + * used instead of production Google Health. + */ + public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0', $useH9Sandbox = false) + { + $this->registerPackage('Zend_Gdata_Health'); + $this->registerPackage('Zend_Gdata_Health_Extension_Ccr'); + parent::__construct($client, $applicationId); + $this->_useH9Sandbox = $useH9Sandbox; + } + + /** + * Gets the id of the user's profile + * + * @return string The profile id + */ + public function getProfileID() + { + return $this->_profileID; + } + + /** + * Sets which of the user's profiles will be used + * + * @param string $id The profile ID + * @return Zend_Gdata_Health Provides a fluent interface + */ + public function setProfileID($id) { + $this->_profileID = $id; + return $this; + } + + /** + * Retrieves the list of profiles associated with the user's ClientLogin + * credentials. + * + * @param string $query The query of the feed as a URL or Query object + * @return Zend_Gdata_Feed + */ + public function getHealthProfileListFeed($query = null) + { + if ($this->_httpClient->getClientLoginToken() === null) { + require_once 'Zend/Gdata/App/AuthException.php'; + throw new Zend_Gdata_App_AuthException( + 'Profiles list feed is only available when using ClientLogin'); + } + + if($query === null) { + $uri = self::CLIENTLOGIN_PROFILELIST_FEED_URI; + } else if ($query instanceof Zend_Gdata_Query) { + $uri = $query->getQueryUrl(); + } else { + $uri = $query; + } + + // use correct feed for /h9 or /health + if ($this->_useH9Sandbox) { + $uri = preg_replace('/\/health\//', '/h9/', $uri); + } + + return parent::getFeed($uri, 'Zend_Gdata_Health_ProfileListFeed'); + } + + /** + * Retrieve a user's profile as a feed object. If ClientLogin is used, the + * profile associated with $this->_profileID is returned, otherwise + * the profile associated with the AuthSub token is read. + * + * @param mixed $query The query for the feed, as a URL or Query + * @return Zend_Gdata_Health_ProfileFeed + */ + public function getHealthProfileFeed($query = null) + { + if ($this->_httpClient->getClientLoginToken() !== null && + $this->getProfileID() == null) { + require_once 'Zend/Gdata/App/AuthException.php'; + throw new Zend_Gdata_App_AuthException( + 'Profile ID must not be null. Did you call setProfileID()?'); + } + + if ($query instanceof Zend_Gdata_Query) { + $uri = $query->getQueryUrl(); + } else if ($this->_httpClient->getClientLoginToken() !== null && + $query == null) { + $uri = self::CLIENTLOGIN_PROFILE_FEED_URI . '/' . $this->getProfileID(); + } else if ($query === null) { + $uri = self::AUTHSUB_PROFILE_FEED_URI; + } else { + $uri = $query; + } + + // use correct feed for /h9 or /health + if ($this->_useH9Sandbox) { + $uri = preg_replace('/\/health\//', '/h9/', $uri); + } + + return parent::getFeed($uri, 'Zend_Gdata_Health_ProfileFeed'); + } + + /** + * Retrieve a profile entry object + * + * @param mixed $query The query for the feed, as a URL or Query + * @return Zend_Gdata_Health_ProfileEntry + */ + public function getHealthProfileEntry($query = null) + { + if ($query === null) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Query must not be null'); + } else if ($query instanceof Zend_Gdata_Query) { + $uri = $query->getQueryUrl(); + } else { + $uri = $query; + } + return parent::getEntry($uri, 'Zend_Gdata_Health_ProfileEntry'); + } + + /** + * Posts a new notice using the register feed. This function constructs + * the atom profile entry. + * + * @param string $subject The subject line of the notice + * @param string $body The message body of the notice + * @param string $bodyType The (optional) type of message body + * (text, xhtml, html, etc.) + * @param string $ccrXML The (optional) CCR to add to the user's profile + * @return Zend_Gdata_Health_ProfileEntry + */ + public function sendHealthNotice($subject, $body, $bodyType = null, $ccrXML = null) + { + if ($this->_httpClient->getClientLoginToken()) { + $profileID = $this->getProfileID(); + if ($profileID !== null) { + $uri = self::CLIENTLOGIN_REGISTER_FEED_URI . '/' . $profileID; + } else { + require_once 'Zend/Gdata/App/AuthException.php'; + throw new Zend_Gdata_App_AuthException( + 'Profile ID must not be null. Did you call setProfileID()?'); + } + } else { + $uri = self::AUTHSUB_REGISTER_FEED_URI; + } + + $entry = new Zend_Gdata_Health_ProfileEntry(); + $entry->title = $this->newTitle($subject); + $entry->content = $this->newContent($body); + $entry->content->type = $bodyType ? $bodyType : 'text'; + $entry->setCcr($ccrXML); + + // use correct feed for /h9 or /health + if ($this->_useH9Sandbox) { + $uri = preg_replace('/\/health\//', '/h9/', $uri); + } + + return $this->insertEntry($entry, $uri, 'Zend_Gdata_Health_ProfileEntry'); + } +} diff --git a/applications/core/lib/Zend/Gdata/Health/Extension/Ccr.php b/applications/core/lib/Zend/Gdata/Health/Extension/Ccr.php new file mode 100755 index 0000000..67eaf7e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Health/Extension/Ccr.php @@ -0,0 +1,125 @@ +<?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 Health + * @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: Ccr.php 13522 2009-01-06 16:35:55Z thomas $ + */ + +/** + * @see Zend_Gdata_App_Extension_Element + */ +require_once 'Zend/Gdata/App/Extension/Element.php'; + +/** + * Concrete class for working with CCR elements. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Health + * @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_Health_Extension_Ccr extends Zend_Gdata_App_Extension_Element +{ + protected $_rootNamespace = 'ccr'; + protected $_rootElement = 'ContinuityOfCareRecord'; + protected $_ccrDom = null; + + /** + * Creates a Zend_Gdata_Health_Extension_Ccr entry, representing CCR data + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + foreach (Zend_Gdata_Health::$namespaces as $nsPrefix => $nsUri) { + $this->registerNamespace($nsPrefix, $nsUri); + } + } + + /** + * 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) + { + $this->_ccrDom = $node; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + if ($doc === null) { + $doc = new DOMDocument('1.0', 'utf-8'); + } + $domElement = $doc->importNode($this->_ccrDom, true); + return $domElement; + } + + /** + * Magic helper that allows drilling down and returning specific elements + * in the CCR. For example, to retrieve the users medications + * (/ContinuityOfCareRecord/Body/Medications) from the entry's CCR, call + * $entry->getCcr()->getMedications(). Similarly, getConditions() would + * return extract the user's conditions. + * + * @param string $name Name of the function to call + * @return array.<DOMElement> A list of the appropriate CCR data + */ + public function __call($name, $args) + { + $matches = array(); + + if (substr($name, 0, 3) === 'get') { + $category = substr($name, 3); + + switch ($category) { + case 'Conditions': + $category = 'Problems'; + break; + case 'Allergies': + $category = 'Alerts'; + break; + case 'TestResults': + // TestResults is an alias for LabResults + case 'LabResults': + $category = 'Results'; + break; + default: + // $category is already well formatted + } + + return $this->_ccrDom->getElementsByTagNameNS($this->lookupNamespace('ccr'), $category); + } else { + return null; + } + } +} diff --git a/applications/core/lib/Zend/Gdata/Health/ProfileEntry.php b/applications/core/lib/Zend/Gdata/Health/ProfileEntry.php new file mode 100755 index 0000000..bf9a8c4 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Health/ProfileEntry.php @@ -0,0 +1,134 @@ +<?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 Health + * @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_Health_Extension_Ccr + */ +require_once 'Zend/Gdata/Health/Extension/Ccr.php'; + +/** + * Concrete class for working with Health profile entries. + * + * @link http://code.google.com/apis/health/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage Health + * @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_Health_ProfileEntry extends Zend_Gdata_Entry +{ + /** + * The classname for individual profile entry elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Health_ProfileEntry'; + + /** + * Google Health CCR data + * + * @var Zend_Gdata_Health_Extension_Ccr + */ + protected $_ccrData = null; + + /** + * Constructs a new Zend_Gdata_Health_ProfileEntry object. + * @param DOMElement $element (optional) The DOMElement on which to base this object. + */ + public function __construct($element = null) + { + foreach (Zend_Gdata_Health::$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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_ccrData !== null) { + $element->appendChild($this->_ccrData->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('ccr') . ':')) { + $ccrElement = new Zend_Gdata_Health_Extension_Ccr(); + $ccrElement->transferFromDOM($child); + $this->_ccrData = $ccrElement; + } else { + parent::takeChildFromDOM($child); + + } + } + + /** + * Sets the profile entry's CCR data + * @param string $ccrXMLStr The CCR as an xml string + * @return Zend_Gdata_Health_Extension_Ccr + */ + public function setCcr($ccrXMLStr) { + $ccrElement = null; + if ($ccrXMLStr != null) { + $ccrElement = new Zend_Gdata_Health_Extension_Ccr(); + $ccrElement->transferFromXML($ccrXMLStr); + $this->_ccrData = $ccrElement; + } + return $ccrElement; + } + + + /** + * Returns all the CCR data in a profile entry + * @return Zend_Gdata_Health_Extension_Ccr + */ + public function getCcr() { + return $this->_ccrData; + } +} diff --git a/applications/core/lib/Zend/Gdata/Health/ProfileFeed.php b/applications/core/lib/Zend/Gdata/Health/ProfileFeed.php new file mode 100755 index 0000000..8abf856 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Health/ProfileFeed.php @@ -0,0 +1,66 @@ +<?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 Health + * @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'; + +/** + * Represents a Google Health user's Profile Feed + * + * @link http://code.google.com/apis/health/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage Health + * @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_Health_ProfileFeed extends Zend_Gdata_Feed +{ + /** + * The class name for individual profile feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Health_ProfileEntry'; + + /** + * Creates a Health Profile feed, representing a user's Health profile + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + foreach (Zend_Gdata_Health::$namespaces as $nsPrefix => $nsUri) { + $this->registerNamespace($nsPrefix, $nsUri); + } + parent::__construct($element); + } + + public function getEntries() + { + return $this->entry; + } +} diff --git a/applications/core/lib/Zend/Gdata/Health/ProfileListEntry.php b/applications/core/lib/Zend/Gdata/Health/ProfileListEntry.php new file mode 100755 index 0000000..f80fe97 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Health/ProfileListEntry.php @@ -0,0 +1,99 @@ +<?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 Health + * @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'; + +/** + * Concrete class for working with Health profile list entries. + * + * @link http://code.google.com/apis/health/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage Health + * @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_Health_ProfileListEntry extends Zend_Gdata_Entry +{ + /** + * The classname for individual profile list entry elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Health_ProfileListEntry'; + + /** + * Constructs a new Zend_Gdata_Health_ProfileListEntry object. + * @param DOMElement $element (optional) The DOMElement on which to base this object. + */ + public function __construct($element = null) + { + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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) + { + parent::takeChildFromDOM($child); + } + + /** + * Retrieves the profile ID for the entry, which is contained in <atom:content> + * @return string The profile id + */ + public function getProfileID() { + return $this->getContent()->text; + } + + /** + * Retrieves the profile's title, which is contained in <atom:title> + * @return string The profile name + */ + public function getProfileName() { + return $this->getTitle()->text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Health/ProfileListFeed.php b/applications/core/lib/Zend/Gdata/Health/ProfileListFeed.php new file mode 100755 index 0000000..8f11c26 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Health/ProfileListFeed.php @@ -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 + * @subpackage Health + * @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'; + +/** + * Represents a Google Health user's Profile List Feed + * + * @link http://code.google.com/apis/health/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage Health + * @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_Health_ProfileListFeed extends Zend_Gdata_Feed +{ + /** + * The class name for individual profile feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Health_ProfileListEntry'; + + public function getEntries() + { + return $this->entry; + } +} diff --git a/applications/core/lib/Zend/Gdata/Health/Query.php b/applications/core/lib/Zend/Gdata/Health/Query.php new file mode 100755 index 0000000..8d5ff66 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Health/Query.php @@ -0,0 +1,284 @@ +<?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 Health + * @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 Health + * + * @link http://code.google.com/apis/health + * + * @category Zend + * @package Zend_Gdata + * @subpackage Health + * @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_Health_Query extends Zend_Gdata_Query +{ + /** + * URI of a user's profile feed. + */ + const HEALTH_PROFILE_FEED_URI = + 'https://www.google.com/health/feeds/profile/default'; + + /** + * URI of register (notices) feed. + */ + const HEALTH_REGISTER_FEED_URI = + 'https://www.google.com/health/feeds/register/default'; + + /** + * Namespace for an item category + */ + const ITEM_CATEGORY_NS = 'http://schemas.google.com/health/item'; + + /** + * The default URI for POST methods + * + * @var string + */ + protected $_defaultFeedUri = self::HEALTH_PROFILE_FEED_URI; + + /** + * Sets the digest parameter's value. + * + * @param string $value + * @return Zend_Gdata_Health_Query Provides a fluent interface + */ + public function setDigest($value) + { + if ($value !== null) { + $this->_params['digest'] = $value; + } + return $this; + } + + /** + * Returns the digest parameter's value. + * + * @return string The value set for the digest parameter. + */ + public function getDigest() + { + if (array_key_exists('digest', $this->_params)) { + return $this->_params['digest']; + } else { + return null; + } + } + + /** + * Setter for category queries. + * + * @param string $item A category to query. + * @param string $name (optional) A specific item to search a category for. + * An example would be 'Lipitor' if $item is set to 'medication'. + * @return Zend_Gdata_Health_Query Provides a fluent interface + */ + public function setCategory($item, $name = null) + { + $this->_category = $item . + ($name ? '/' . urlencode('{' . self::ITEM_CATEGORY_NS . '}' . $name) : null); + return $this; + } + + /** + * Returns the query object's category. + * + * @return string id + */ + public function getCategory() + { + return $this->_category; + } + + /** + * Setter for the grouped parameter. + * + * @param string $value setting a count of results per group. + * @return Zend_Gdata_Health_Query Provides a fluent interface + */ + public function setGrouped($value) + { + if ($value !== null) { + $this->_params['grouped'] = $value; + } + return $this; + } + + /** + * Returns the value set for the grouped parameter. + * + * @return string grouped parameter. + */ + public function getGrouped() + { + if (array_key_exists('grouped', $this->_params)) { + return $this->_params['grouped']; + } else { + return null; + } + } + + /** + * Setter for the max-results-group parameter. + * + * @param int $value Specifies the maximum number of groups to be + * retrieved. Must be an integer value greater than zero. This parameter + * is only valid if grouped=true. + * @return Zend_Gdata_Health_Query Provides a fluent interface + */ + public function setMaxResultsGroup($value) + { + if ($value !== null) { + if ($value <= 0 || $this->getGrouped() !== 'true') { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'The max-results-group parameter must be set to a value + greater than 0 and can only be used if grouped=true'); + } else { + $this->_params['max-results-group'] = $value; + } + } + return $this; + } + + /** + * Returns the value set for max-results-group. + * + * @return int Returns max-results-group parameter. + */ + public function getMaxResultsGroup() + { + if (array_key_exists('max-results-group', $this->_params)) { + return $this->_params['max-results-group']; + } else { + return null; + } + } + + /** + * Setter for the max-results-group parameter. + * + * @param int $value Specifies the maximum number of records to be + * retrieved from each group. The limits that you specify with this + * parameter apply to all groups. Must be an integer value greater than + * zero. This parameter is only valid if grouped=true. + * @return Zend_Gdata_Health_Query Provides a fluent interface + */ + public function setMaxResultsInGroup($value) + { + if ($value !== null) { + if ($value <= 0 || $this->getGrouped() !== 'true') { + throw new Zend_Gdata_App_InvalidArgumentException( + 'The max-results-in-group parameter must be set to a value + greater than 0 and can only be used if grouped=true'); + } else { + $this->_params['max-results-in-group'] = $value; + } + } + return $this; + } + + /** + * Returns the value set for max-results-in-group. + * + * @return int Returns max-results-in-group parameter. + */ + public function getMaxResultsInGroup() + { + if (array_key_exists('max-results-in-group', $this->_params)) { + return $this->_params['max-results-in-group']; + } else { + return null; + } + } + + /** + * Setter for the start-index-group parameter. + * + * @param int $value Retrieves only items whose group ranking is at + * least start-index-group. This should be set to a 1-based index of the + * first group to be retrieved. The range is applied per category. + * This parameter is only valid if grouped=true. + * @return Zend_Gdata_Health_Query Provides a fluent interface + */ + public function setStartIndexGroup($value) + { + if ($value !== null && $this->getGrouped() !== 'true') { + throw new Zend_Gdata_App_InvalidArgumentException( + 'The start-index-group can only be used if grouped=true'); + } else { + $this->_params['start-index-group'] = $value; + } + return $this; + } + + /** + * Returns the value set for start-index-group. + * + * @return int Returns start-index-group parameter. + */ + public function getStartIndexGroup() + { + if (array_key_exists('start-index-group', $this->_params)) { + return $this->_params['start-index-group']; + } else { + return null; + } + } + + /** + * Setter for the start-index-in-group parameter. + * + * @param int $value A 1-based index of the records to be retrieved from + * each group. This parameter is only valid if grouped=true. + * @return Zend_Gdata_Health_Query Provides a fluent interface + */ + public function setStartIndexInGroup($value) + { + if ($value !== null && $this->getGrouped() !== 'true') { + throw new Zend_Gdata_App_InvalidArgumentException('start-index-in-group'); + } else { + $this->_params['start-index-in-group'] = $value; + } + return $this; + } + + /** + * Returns the value set for start-index-in-group. + * + * @return int Returns start-index-in-group parameter. + */ + public function getStartIndexInGroup() + { + if (array_key_exists('start-index-in-group', $this->_params)) { + return $this->_params['start-index-in-group']; + } else { + return null; + } + } +} diff --git a/applications/core/lib/Zend/Gdata/HttpAdapterStreamingProxy.php b/applications/core/lib/Zend/Gdata/HttpAdapterStreamingProxy.php new file mode 100644 index 0000000..3803fc3 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/HttpAdapterStreamingProxy.php @@ -0,0 +1,126 @@ +<?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 Gdata + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * @see Zend_Http_Client_Adapter_Proxy + */ +require_once 'Zend/Http/Client/Adapter/Proxy.php'; + +/** + * Extends the proxy HTTP adapter to handle streams instead of discrete body + * strings. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gdata + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_HttpAdapterStreamingProxy extends Zend_Http_Client_Adapter_Proxy +{ + /** + * The amount read from a stream source at a time. + * + * @var integer + */ + const CHUNK_SIZE = 1024; + + /** + * Send request to the proxy server with streaming support + * + * @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 = '') + { + // If no proxy is set, throw an error + if (! $this->config['proxy_host']) { + require_once 'Zend/Http/Client/Adapter/Exception.php'; + throw new Zend_Http_Client_Adapter_Exception('No proxy host set!'); + } + + // Make sure we're properly connected + if (! $this->socket) { + require_once 'Zend/Http/Client/Adapter/Exception.php'; + throw new Zend_Http_Client_Adapter_Exception( + 'Trying to write but we are not connected'); + } + + $host = $this->config['proxy_host']; + $port = $this->config['proxy_port']; + + if ($this->connected_to[0] != $host || $this->connected_to[1] != $port) { + require_once 'Zend/Http/Client/Adapter/Exception.php'; + throw new Zend_Http_Client_Adapter_Exception( + 'Trying to write but we are connected to the wrong proxy ' . + 'server'); + } + + // Add Proxy-Authorization header + if ($this->config['proxy_user'] && ! isset($headers['proxy-authorization'])) { + $headers['proxy-authorization'] = Zend_Http_Client::encodeAuthHeader( + $this->config['proxy_user'], $this->config['proxy_pass'], $this->config['proxy_auth'] + ); + } + + // if we are proxying HTTPS, preform CONNECT handshake with the proxy + if ($uri->getScheme() == 'https' && (! $this->negotiated)) { + $this->connectHandshake($uri->getHost(), $uri->getPort(), $http_ver, $headers); + $this->negotiated = true; + } + + // Save request method for later + $this->method = $method; + + // Build request headers + $request = "{$method} {$uri->__toString()} HTTP/{$http_ver}\r\n"; + + // Add all headers to the request string + foreach ($headers as $k => $v) { + if (is_string($k)) $v = "$k: $v"; + $request .= "$v\r\n"; + } + + $request .= "\r\n"; + + // Send the request headers + if (! @fwrite($this->socket, $request)) { + require_once 'Zend/Http/Client/Adapter/Exception.php'; + throw new Zend_Http_Client_Adapter_Exception( + 'Error writing request to proxy server'); + } + + //read from $body, write to socket + while ($body->hasData()) { + if (! @fwrite($this->socket, $body->read(self::CHUNK_SIZE))) { + require_once 'Zend/Http/Client/Adapter/Exception.php'; + throw new Zend_Http_Client_Adapter_Exception( + 'Error writing request to server'); + } + } + return 'Large upload, request is not cached.'; + } +} diff --git a/applications/core/lib/Zend/Gdata/HttpAdapterStreamingSocket.php b/applications/core/lib/Zend/Gdata/HttpAdapterStreamingSocket.php new file mode 100644 index 0000000..25fd826 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/HttpAdapterStreamingSocket.php @@ -0,0 +1,107 @@ +<?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 Gdata + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * @see Zend_Http_Client_Adapter_Socket + */ +require_once 'Zend/Http/Client/Adapter/Socket.php'; + +/** + * Extends the default HTTP adapter to handle streams instead of discrete body + * strings. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gdata + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_HttpAdapterStreamingSocket extends Zend_Http_Client_Adapter_Socket +{ + + /** + * The amount read from a stream source at a time. + * + * @var integer + */ + const CHUNK_SIZE = 1024; + + /** + * Send request to the remote server with streaming support. + * + * @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 = '') + { + // Make sure we're properly connected + if (! $this->socket) { + require_once 'Zend/Http/Client/Adapter/Exception.php'; + throw new Zend_Http_Client_Adapter_Exception( + 'Trying to write but we are not connected'); + } + + $host = $uri->getHost(); + $host = (strtolower($uri->getScheme()) == 'https' ? $this->config['ssltransport'] : 'tcp') . '://' . $host; + if ($this->connected_to[0] != $host || $this->connected_to[1] != $uri->getPort()) { + require_once 'Zend/Http/Client/Adapter/Exception.php'; + throw new Zend_Http_Client_Adapter_Exception( + 'Trying to write but we are connected to the wrong host'); + } + + // Save request method for later + $this->method = $method; + + // Build request headers + $path = $uri->getPath(); + if ($uri->getQuery()) $path .= '?' . $uri->getQuery(); + $request = "{$method} {$path} HTTP/{$http_ver}\r\n"; + foreach ($headers as $k => $v) { + if (is_string($k)) $v = ucfirst($k) . ": $v"; + $request .= "$v\r\n"; + } + + // Send the headers over + $request .= "\r\n"; + if (! @fwrite($this->socket, $request)) { + require_once 'Zend/Http/Client/Adapter/Exception.php'; + throw new Zend_Http_Client_Adapter_Exception( + 'Error writing request to server'); + } + + + //read from $body, write to socket + while ($body->hasData()) { + if (! @fwrite($this->socket, $body->read(self::CHUNK_SIZE))) { + require_once 'Zend/Http/Client/Adapter/Exception.php'; + throw new Zend_Http_Client_Adapter_Exception( + 'Error writing request to server'); + } + } + return 'Large upload, request is not cached.'; + } +} diff --git a/applications/core/lib/Zend/Gdata/HttpClient.php b/applications/core/lib/Zend/Gdata/HttpClient.php new file mode 100644 index 0000000..7ae62db --- /dev/null +++ b/applications/core/lib/Zend/Gdata/HttpClient.php @@ -0,0 +1,346 @@ +<?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 Gdata + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * 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 + * @subpackage Gdata + * @copyright Copyright (c) 2005-2009 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; + + /** + * True if this request is being made with data supplied by + * a stream object instead of a raw encoded string. + * + * @var bool + */ + protected $_streamingRequest = 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; + } + + /** + * Return the current connection adapter + * + * @return Zend_Http_Client_Adapter_Interface|string $adapter + */ + public function getAdapter() + { + return $this->adapter; + } + + /** + * Load the connection adapter + * + * @param Zend_Http_Client_Adapter_Interface $adapter + * @return void + */ + public function setAdapter($adapter) + { + if ($adapter == null) { + $this->adapter = $adapter; + } else { + parent::setAdapter($adapter); + } + } + + /** + * Set the streamingRequest variable which controls whether we are + * sending the raw (already encoded) POST data from a stream source. + * + * @param boolean $value The value to set. + * @return void + */ + public function setStreamingRequest($value) + { + $this->_streamingRequest = $value; + } + + /** + * Check whether the client is set to perform streaming requests. + * + * @return boolean True if yes, false otherwise. + */ + public function getStreamingRequest() + { + if ($this->_streamingRequest()) { + return true; + } else { + return false; + } + } + + /** + * Prepare the request body (for POST and PUT requests) + * + * @return string + * @throws Zend_Http_Client_Exception + */ + protected function _prepareBody() + { + if($this->_streamingRequest) { + $this->setHeaders(self::CONTENT_LENGTH, + $this->raw_post_data->getTotalSize()); + return $this->raw_post_data; + } + else { + return parent::_prepareBody(); + } + } + + /** + * Clear all custom parameters we set. + * + * @return Zend_Http_Client + */ + public function resetParameters() + { + $this->_streamingRequest = false; + + return parent::resetParameters(); + } + + /** + * Set the raw (already encoded) POST data from a stream source. + * + * This is used to support POSTing from open file handles without + * caching the entire body into memory. It is a wrapper around + * Zend_Http_Client::setRawData(). + * + * @param string $data The request data + * @param string $enctype The encoding type + * @return Zend_Http_Client + */ + public function setRawDataStream($data, $enctype = null) + { + $this->_streamingRequest = true; + return $this->setRawData($data, $enctype); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Kind/EventEntry.php b/applications/core/lib/Zend/Gdata/Kind/EventEntry.php new file mode 100644 index 0000000..876cccc --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Kind/EventEntry.php @@ -0,0 +1,427 @@ +<?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 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_App_Extension + */ +require_once 'Zend/Gdata/App/Extension.php'; + +/** + * @see Zend_Gdata_Extension_Where + */ +require_once 'Zend/Gdata/Extension/Where.php'; + +/** + * @see Zend_Gdata_Extension_When + */ +require_once 'Zend/Gdata/Extension/When.php'; + +/** + * @see Zend_Gdata_Extension_Who + */ +require_once 'Zend/Gdata/Extension/Who.php'; + +/** + * @see Zend_Gdata_Extension_Recurrence + */ +require_once 'Zend/Gdata/Extension/Recurrence.php'; + +/** + * @see Zend_Gdata_Extension_EventStatus + */ +require_once 'Zend/Gdata/Extension/EventStatus.php'; + +/** + * @see Zend_Gdata_Extension_Comments + */ +require_once 'Zend/Gdata/Extension/Comments.php'; + +/** + * @see Zend_Gdata_Extension_Transparency + */ +require_once 'Zend/Gdata/Extension/Transparency.php'; + +/** + * @see Zend_Gdata_Extension_Visibility + */ +require_once 'Zend/Gdata/Extension/Visibility.php'; + +/** + * @see Zend_Gdata_Extension_ExtendedProperty + */ +require_once 'Zend/Gdata/Extension/ExtendedProperty.php'; + +/** + * @see Zend_Gdata_Extension_OriginalEvent + */ +require_once 'Zend/Gdata/Extension/OriginalEvent.php'; + +/** + * @see Zend_Gdata_Extension_EntryLink + */ +require_once 'Zend/Gdata/Extension/EntryLink.php'; + +/** + * Data model for the Gdata Event "Kind". Google Calendar has a separate + * EventEntry class which extends this. + * + * @category Zend + * @package Zend_Gdata + * @subpackage 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_Kind_EventEntry extends Zend_Gdata_Entry +{ + protected $_who = array(); + protected $_when = array(); + protected $_where = array(); + protected $_recurrence = null; + protected $_eventStatus = null; + protected $_comments = null; + protected $_transparency = null; + protected $_visibility = null; + protected $_recurrenceException = array(); + protected $_extendedProperty = array(); + protected $_originalEvent = null; + protected $_entryLink = null; + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_who != null) { + foreach ($this->_who as $who) { + $element->appendChild($who->getDOM($element->ownerDocument)); + } + } + if ($this->_when != null) { + foreach ($this->_when as $when) { + $element->appendChild($when->getDOM($element->ownerDocument)); + } + } + if ($this->_where != null) { + foreach ($this->_where as $where) { + $element->appendChild($where->getDOM($element->ownerDocument)); + } + } + if ($this->_recurrenceException != null) { + foreach ($this->_recurrenceException as $recurrenceException) { + $element->appendChild($recurrenceException->getDOM($element->ownerDocument)); + } + } + if ($this->_extendedProperty != null) { + foreach ($this->_extendedProperty as $extProp) { + $element->appendChild($extProp->getDOM($element->ownerDocument)); + } + } + + if ($this->_recurrence != null) { + $element->appendChild($this->_recurrence->getDOM($element->ownerDocument)); + } + if ($this->_eventStatus != null) { + $element->appendChild($this->_eventStatus->getDOM($element->ownerDocument)); + } + if ($this->_comments != null) { + $element->appendChild($this->_comments->getDOM($element->ownerDocument)); + } + if ($this->_transparency != null) { + $element->appendChild($this->_transparency->getDOM($element->ownerDocument)); + } + if ($this->_visibility != null) { + $element->appendChild($this->_visibility->getDOM($element->ownerDocument)); + } + if ($this->_originalEvent != null) { + $element->appendChild($this->_originalEvent->getDOM($element->ownerDocument)); + } + if ($this->_entryLink != null) { + $element->appendChild($this->_entryLink->getDOM($element->ownerDocument)); + } + + + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + switch ($absoluteNodeName) { + case $this->lookupNamespace('gd') . ':' . 'where'; + $where = new Zend_Gdata_Extension_Where(); + $where->transferFromDOM($child); + $this->_where[] = $where; + break; + case $this->lookupNamespace('gd') . ':' . 'when'; + $when = new Zend_Gdata_Extension_When(); + $when->transferFromDOM($child); + $this->_when[] = $when; + break; + case $this->lookupNamespace('gd') . ':' . 'who'; + $who = new Zend_Gdata_Extension_Who(); + $who ->transferFromDOM($child); + $this->_who[] = $who; + break; + case $this->lookupNamespace('gd') . ':' . 'recurrence'; + $recurrence = new Zend_Gdata_Extension_Recurrence(); + $recurrence->transferFromDOM($child); + $this->_recurrence = $recurrence; + break; + case $this->lookupNamespace('gd') . ':' . 'eventStatus'; + $eventStatus = new Zend_Gdata_Extension_EventStatus(); + $eventStatus->transferFromDOM($child); + $this->_eventStatus = $eventStatus; + break; + case $this->lookupNamespace('gd') . ':' . 'comments'; + $comments = new Zend_Gdata_Extension_Comments(); + $comments->transferFromDOM($child); + $this->_comments = $comments; + break; + case $this->lookupNamespace('gd') . ':' . 'transparency'; + $transparency = new Zend_Gdata_Extension_Transparency(); + $transparency ->transferFromDOM($child); + $this->_transparency = $transparency; + break; + case $this->lookupNamespace('gd') . ':' . 'visibility'; + $visiblity = new Zend_Gdata_Extension_Visibility(); + $visiblity ->transferFromDOM($child); + $this->_visibility = $visiblity; + break; + case $this->lookupNamespace('gd') . ':' . 'recurrenceException'; + require_once 'Zend/Gdata/Extension/RecurrenceException.php'; + $recurrenceException = new Zend_Gdata_Extension_RecurrenceException(); + $recurrenceException ->transferFromDOM($child); + $this->_recurrenceException[] = $recurrenceException; + break; + case $this->lookupNamespace('gd') . ':' . 'originalEvent'; + $originalEvent = new Zend_Gdata_Extension_OriginalEvent(); + $originalEvent ->transferFromDOM($child); + $this->_originalEvent = $originalEvent; + break; + case $this->lookupNamespace('gd') . ':' . 'extendedProperty'; + $extProp = new Zend_Gdata_Extension_ExtendedProperty(); + $extProp->transferFromDOM($child); + $this->_extendedProperty[] = $extProp; + break; + 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 getWhen() + { + return $this->_when; + } + + /** + * @param array $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setWhen($value) + { + $this->_when = $value; + return $this; + } + + public function getWhere() + { + return $this->_where; + } + + /** + * @param array $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setWhere($value) + { + $this->_where = $value; + return $this; + } + + public function getWho() + { + return $this->_who; + } + + /** + * @param array $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setWho($value) + { + $this->_who = $value; + return $this; + } + + public function getRecurrence() + { + return $this->_recurrence; + } + + /** + * @param array $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setRecurrence($value) + { + $this->_recurrence = $value; + return $this; + } + + public function getEventStatus() + { + return $this->_eventStatus; + } + + /** + * @param array $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setEventStatus($value) + { + $this->_eventStatus = $value; + return $this; + } + + public function getComments() + { + return $this->_comments; + } + + /** + * @param array $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setComments($value) + { + $this->_comments = $value; + return $this; + } + + public function getTransparency() + { + return $this->_transparency; + } + + /** + * @param Zend_Gdata_Transparency $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setTransparency($value) + { + $this->_transparency = $value; + return $this; + } + + public function getVisibility() + { + return $this->_visibility; + } + + /** + * @param Zend_Gdata_Visibility $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setVisibility($value) + { + $this->_visibility = $value; + return $this; + } + + public function getRecurrenceExcption() + { + return $this->_recurrenceException; + } + + /** + * @param array $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setRecurrenceException($value) + { + $this->_recurrenceException = $value; + return $this; + } + + public function getExtendedProperty() + { + return $this->_extendedProperty; + } + + /** + * @param array $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setExtendedProperty($value) + { + $this->_extendedProperty = $value; + return $this; + } + + public function getOriginalEvent() + { + return $this->_originalEvent; + } + + /** + * @param Zend_Gdata_Extension_OriginalEvent $value + * @return Zend_Gdata_Kind_EventEntry Provides a fluent interface + */ + public function setOriginalEvent($value) + { + $this->_originalEvent = $value; + return $this; + } + + /** + * Get this entry's EntryLink element. + * + * @return Zend_Gdata_Extension_EntryLink The requested entry. + */ + public function getEntryLink() + { + return $this->_entryLink; + } + + /** + * Set the child's EntryLink element. + * + * @param Zend_Gdata_Extension_EntryLink $value The desired value for this attribute. + * @return Zend_Gdata_Extension_Who The element being modified. + */ + public function setEntryLink($value) + { + $this->_entryLink = $value; + return $this; + } + + +} diff --git a/applications/core/lib/Zend/Gdata/Media.php b/applications/core/lib/Zend/Gdata/Media.php new file mode 100755 index 0000000..c728f83 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media.php @@ -0,0 +1,64 @@ +<?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 Media + * @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 + * @subpackage Media + * @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 +{ + + /** + * Namespaces used for Zend_Gdata_Photos + * + * @var array + */ + public static $namespaces = array( + array('media', 'http://search.yahoo.com/mrss/', 1, 0) + ); + + /** + * 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); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Entry.php b/applications/core/lib/Zend/Gdata/Media/Entry.php new file mode 100755 index 0000000..4583f6d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Entry.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaCategory.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaCategory.php new file mode 100755 index 0000000..946cd8c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaCategory.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaContent.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaContent.php new file mode 100755 index 0000000..f4af8ac --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaContent.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaCopyright.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaCopyright.php new file mode 100755 index 0000000..546ad9e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaCopyright.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaCredit.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaCredit.php new file mode 100755 index 0000000..4794b0d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaCredit.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaDescription.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaDescription.php new file mode 100755 index 0000000..eccf01f --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaDescription.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaGroup.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaGroup.php new file mode 100755 index 0000000..c75f24e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaGroup.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaHash.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaHash.php new file mode 100755 index 0000000..18b5292 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaHash.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaKeywords.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaKeywords.php new file mode 100755 index 0000000..73a5cf6 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaKeywords.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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() + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + parent::__construct(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaPlayer.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaPlayer.php new file mode 100755 index 0000000..cdb3d2d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaPlayer.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaRating.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaRating.php new file mode 100755 index 0000000..405ece3 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaRating.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaRestriction.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaRestriction.php new file mode 100755 index 0000000..1fa9073 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaRestriction.php @@ -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 + * @subpackage Media + * @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 + * @subpackage Media + * @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) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaText.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaText.php new file mode 100755 index 0000000..6f9431f --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaText.php @@ -0,0 +1,210 @@ +<?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 Media + * @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:text element + * + * @category Zend + * @package Zend_Gdata + * @subpackage Media + * @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_MediaText extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'text'; + protected $_rootNamespace = 'media'; + + /** + * @var string + */ + protected $_type = null; + + /** + * @var string + */ + protected $_lang = null; + + /** + * @var string + */ + protected $_start = null; + + /** + * @var string + */ + protected $_end = null; + + /** + * Constructs a new MediaText element + * + * @param $text string + * @param $type string + * @param $lang string + * @param $start string + * @param $end string + */ + public function __construct($text = null, $type = null, $lang = null, + $start = null, $end = null) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + parent::__construct(); + $this->_text = $text; + $this->_type = $type; + $this->_lang = $lang; + $this->_start = $start; + $this->_end = $end; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_type !== null) { + $element->setAttribute('type', $this->_type); + } + if ($this->_lang !== null) { + $element->setAttribute('lang', $this->_lang); + } + if ($this->_start !== null) { + $element->setAttribute('start', $this->_start); + } + if ($this->_end !== null) { + $element->setAttribute('end', $this->_end); + } + 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; + case 'lang': + $this->_lang = $attribute->nodeValue; + break; + case 'start': + $this->_start = $attribute->nodeValue; + break; + case 'end': + $this->_end = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * @return string + */ + public function getType() + { + return $this->_type; + } + + /** + * @param string $value + * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface + */ + public function setType($value) + { + $this->_type = $value; + return $this; + } + + /** + * @return string + */ + public function getLang() + { + return $this->_lang; + } + + /** + * @param string $value + * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface + */ + public function setLang($value) + { + $this->_lang = $value; + return $this; + } + + /** + * @return string + */ + public function getStart() + { + return $this->_start; + } + + /** + * @param string $value + * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface + */ + public function setStart($value) + { + $this->_start = $value; + return $this; + } + + /** + * @return string + */ + public function getEnd() + { + return $this->_end; + } + + /** + * @param string $value + * @return Zend_Gdata_Media_Extension_MediaText Provides a fluent interface + */ + public function setEnd($value) + { + $this->_end = $value; + return $this; + } +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaThumbnail.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaThumbnail.php new file mode 100755 index 0000000..267626e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaThumbnail.php @@ -0,0 +1,209 @@ +<?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 Media + * @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:thumbnail element + * + * @category Zend + * @package Zend_Gdata + * @subpackage Media + * @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_MediaThumbnail extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'thumbnail'; + protected $_rootNamespace = 'media'; + + /** + * @var string + */ + protected $_url = null; + + /** + * @var int + */ + protected $_width = null; + + /** + * @var int + */ + protected $_height = null; + + /** + * @var string + */ + protected $_time = null; + + /** + * Constructs a new MediaThumbnail element + * + * @param string $url + * @param int $width + * @param int $height + * @param string $time + */ + public function __construct($url = null, $width = null, $height = null, + $time = null) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + parent::__construct(); + $this->_url = $url; + $this->_width = $width; + $this->_height = $height; + $this->_time = $time ; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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); + } + if ($this->_time !== null) { + $element->setAttribute('time', $this->_time); + } + 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; + case 'time': + $this->_time = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * @return string + */ + public function getUrl() + { + return $this->_url; + } + + /** + * @param string $value + * @return Zend_Gdata_Media_Extension_MediaThumbnail 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_MediaThumbnail 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_MediaThumbnail Provides a fluent interface + */ + public function setHeight($value) + { + $this->_height = $value; + return $this; + } + + /** + * @return string + */ + public function getTime() + { + return $this->_time; + } + + /** + * @param string $value + * @return Zend_Gdata_Media_Extension_MediaThumbnail Provides a fluent interface + */ + public function setTime($value) + { + $this->_time = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Extension/MediaTitle.php b/applications/core/lib/Zend/Gdata/Media/Extension/MediaTitle.php new file mode 100755 index 0000000..9516782 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Extension/MediaTitle.php @@ -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 + * @subpackage Media + * @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:title element in MediaRSS + * + * @category Zend + * @package Zend_Gdata + * @subpackage Media + * @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_MediaTitle extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'title'; + protected $_rootNamespace = 'media'; + + /** + * @var string + */ + protected $_type = null; + + /** + * Constructs a MediaTitle element + * + * @param string $text + * @param string $type + */ + public function __construct($text = null, $type = null) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + 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_MediaTitle Provides a fluent interface + */ + public function setType($value) + { + $this->_type = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Media/Feed.php b/applications/core/lib/Zend/Gdata/Media/Feed.php new file mode 100755 index 0000000..e6ef976 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Media/Feed.php @@ -0,0 +1,69 @@ +<?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 Media + * @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_eed + */ +require_once 'Zend/Gdata/Feed.php'; + +/** + * @see Zend_Gdata_Media + */ +require_once 'Zend/Gdata/Media.php'; + +/** + * @see Zend_Gdata_Media_Entry + */ +require_once 'Zend/Gdata/Media/Entry.php'; + +/** + * The Gdata flavor of an Atom Feed with media support + * + * @category Zend + * @package Zend_Gdata + * @subpackage Media + * @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_Feed extends Zend_Gdata_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Media_Entry'; + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/MediaMimeStream.php b/applications/core/lib/Zend/Gdata/MediaMimeStream.php new file mode 100644 index 0000000..dccd653 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/MediaMimeStream.php @@ -0,0 +1,513 @@ +<?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 Gdata + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * A streaming Media MIME class that allows for buffered read operations. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Gdata + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_MediaMimeStream +{ + + /** + * The Content-Type section that precedes the XML data in the message. + * + * @var string + */ + // TODO (jhartmann) Add support for charset [ZF-5768] + const XML_HEADER = "Content-Type: application/atom+xml\r\n\r\n"; + + /** + * A constant indicating the xml string part of the message + * + * @var integer + */ + const PART_XML_STRING = 0; + + /** + * A constant indicating the file binary part of the message + * + * @var integer + */ + const PART_FILE_BINARY = 1; + + /** + * A constant indicating the closing boundary string of the message + * + * @var integer + */ + const PART_CLOSING_XML_STRING = 2; + + /** + * The maximum buffer size that can be used. + * + * @var integer + */ + const MAX_BUFFER_SIZE = 8192; + + /** + * A valid MIME boundary including a linefeed. + * + * @var string + */ + protected $_boundaryLine = null; + + /** + * A valid MIME boundary without a linefeed for use in the header. + * + * @var string + */ + protected $_boundaryString = null; + + /** + * A valid MIME closing boundary including a linefeed. + * + * @var string + */ + protected $_closingBoundaryLine = null; + + /** + * A handle to the file that is part of the message. + * + * @var resource + */ + protected $_fileHandle = null; + + /** + * The headers that preceed the file binary including linefeeds. + * + * @var string + */ + protected $_fileHeaders = null; + + /** + * The internet media type of the enclosed file. + * + * @var string + */ + protected $_fileContentType = null; + + /** + * The file size. + * + * @var integer + */ + protected $_fileSize = null; + + /** + * The total size of the message. + * + * @var integer + */ + protected $_totalSize = null; + + /** + * The XML string that typically represents the entry to be sent. + * + * @var string + */ + protected $_xmlString = null; + + /** + * The number of bytes that have been read so far. + * + * @var integer + */ + protected $_bytesRead = 0; + + /** + * Enumeration indicating the part of the message that is currently being + * read. Allowed values are: 0, 1 and 2, corresponding to the constants: + * PART_XML_STRING, PART_FILE_BINARY, PART_CLOSING_XML_STRING + * + * @var integer + */ + protected $_currentPart = 0; + + /** + * A nested array containing the message to be sent. Each element contains + * an array in the format: + * + * [integer (size of message)][string (message)] + * + * Note that the part corresponding to the file only contains a size. + * + * @var array + */ + protected $_parts = null; + + /** + * A boolean to be set immediately once we have finished reading. + * + * @var boolean + */ + protected $_doneReading = false; + + /** + * Create a new MimeMediaStream object. + * + * @param string $xmlString The string corresponding to the XML section + * of the message, typically an atom entry or feed. + * @param string $filePath The path to the file that constitutes the binary + * part of the message. + * @param string $fileContentType The valid internet media type of the file. + * @throws Zend_Gdata_App_IOException If the file cannot be read or does + * not exist. Also if mbstring.func_overload has been set > 1. + */ + public function __construct($xmlString = null, $filePath = null, + $fileContentType = null) + { + $this->_xmlString = $xmlString; + $this->_filePath = $filePath; + $this->_fileContentType = $fileContentType; + + if (!file_exists($filePath) || !is_readable($filePath)) { + require_once 'Zend/Gdata/App/IOException.php'; + throw new Zend_Gdata_App_IOException('File to be uploaded at ' . + $filePath . ' does not exist or is not readable.'); + } + + $this->_fileHandle = fopen($filePath, 'rb', true); + $this->generateBoundaries(); + $this->calculatePartSizes(); + } + + /** + * Generate the MIME message boundary strings. + * + * @return void + */ + private function generateBoundaries() + { + $this->_boundaryString = '=_' . md5(microtime(1) . rand(1,20)); + $this->_boundaryLine = "\r\n" . '--' . $this->_boundaryString . "\r\n"; + $this->_closingBoundaryLine = "\r\n" . '--' . $this->_boundaryString . + '--'; + } + + /** + * Calculate the sizes of the MIME message sections. + * + * @return void + */ + private function calculatePartSizes() + { + $this->_fileHeaders = 'Content-Type: ' . $this->_fileContentType . + "\r\n" . 'Content-Transfer-Encoding: binary' . "\r\n\r\n"; + $this->_fileSize = filesize($this->_filePath); + + $stringSection = $this->_boundaryLine . self::XML_HEADER . + $this->_xmlString . "\r\n" . $this->_boundaryLine . + $this->_fileHeaders; + $stringLen = strlen($stringSection); + $closingBoundaryLen = strlen($this->_closingBoundaryLine); + + $this->_parts = array(); + $this->_parts[] = array($stringLen, $stringSection); + $this->_parts[] = array($this->_fileSize); + $this->_parts[] = array($closingBoundaryLen, + $this->_closingBoundaryLine); + + $this->_totalSize = $stringLen + $this->_fileSize + $closingBoundaryLen; + } + + /** + * A wrapper around fread() that doesn't error when $length is 0. + * + * @param integer $length Number of bytes to read. + * @return string Results of byte operation. + */ + private function smartfread($length) + { + if ($length < 1) { + return ''; + } else { + return fread($this->_fileHandle, $length); + } + } + + /** + * A non mbstring overloadable strlen-like function. + * + * @param string $string The string whose length we want to get. + * @return integer The length of the string. + */ + private function strlen2($string) + { + return array_sum(char_count($string)); + } + + /** + * Read a specific chunk of the the MIME multipart message. + * + * This function works by examining the internal 'parts' array. It + * expects that array to consist of basically a string, a file handle + * and a closing string. + * + * An abbreviated version of what this function does is as follows: + * + * - throw exception if trying to read bigger than the allocated max buffer + * - If bufferSize bigger than the entire message: return it and exit. + * + * - Check how far to read by looking at how much has been read. + * - Figure out whether we are crossing sections in this read: + * i.e. -> reading past the xml_string and into the file ? + * - Determine whether we are crossing two sections in this read: + * i.e. xml_string, file and half of the closing string or + * possibly file, closing string and next (non-existant) section + * and handle each case. + * - If we are NOT crossing any sections: read either string and + * increment counter, or read file (no counter needed since fread() + * stores it's own counter. + * - If we are crossing 1 section, figure out how much remains in that + * section that we are currently reading and how far to read into + * the next section. If the section just read is xml_string, then + * immediately unset it from our 'parts' array. If it is the file, + * then close the handle. + * + * @param integer $bufferSize The size of the chunk that is to be read, + * must be lower than MAX_BUFFER_SIZE. + * @throws Zend_Gdata_App_InvalidArgumentException if buffer size too big. + * @return string A corresponding piece of the message. This could be + * binary or regular text. + */ + public function read($bufferSize) + { + if ($bufferSize > self::MAX_BUFFER_SIZE) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException('Buffer size ' . + 'is larger than the supported max of ' . self::MAX_BUFFER_SIZE); + } + + // handle edge cases where bytesRead is negative + if ($this->_bytesRead < 0) { + $this->_bytesRead = 0; + } + + $returnString = null; + // If entire message is smaller than the buffer, just return everything + if ($bufferSize > $this->_totalSize) { + $returnString = $this->_parts[self::PART_XML_STRING][1]; + $returnString .= fread($this->_fileHandle, $bufferSize); + $returnString .= $this->_closingBoundaryLine; + $this->closeFileHandle(); + $this->_doneReading = true; + return $returnString; + } + + // increment internal counters + $readTo = $this->_bytesRead + $bufferSize; + $sizeOfCurrentPart = $this->_parts[$this->_currentPart][0]; + $sizeOfNextPart = 0; + + // if we are in a part past the current part, exit + if ($this->_currentPart > self::PART_CLOSING_XML_STRING) { + $this->_doneReading = true; + return; + } + + // if bytes read is bigger than the current part and we are + // at the end, return + if (($this->_bytesRead > $sizeOfCurrentPart) && + ($this->_currentPart == self::PART_CLOSING_XML_STRING)) { + $this->_doneReading = true; + return; + } + + // check if we have a next part + if ($this->_currentPart != self::PART_CLOSING_XML_STRING) { + $nextPart = $this->_currentPart + 1; + $sizeOfNextPart = $this->_parts[$nextPart][0]; + } + + $readIntoNextPart = false; + $readFromRemainingPart = null; + $readFromNextPart = null; + + // are we crossing into multiple sections of the message in + // this read? + if ($readTo > ($sizeOfCurrentPart + $sizeOfNextPart)) { + if ($this->_currentPart == self::PART_XML_STRING) { + // If we are in XML string and have crossed over the file + // return that and whatever we can from the closing boundary + // string. + $returnString = $this->_parts[self::PART_XML_STRING][1]; + unset($this->_parts[self::PART_XML_STRING]); + $returnString .= fread($this->_fileHandle, + self::MAX_BUFFER_SIZE); + $this->closeFileHandle(); + + $readFromClosingString = $readTo - + ($sizeOfCurrentPart + $sizeOfNextPart); + $returnString .= substr( + $this->_parts[self::PART_CLOSING_XML_STRING][1], 0, + $readFromClosingString); + $this->_bytesRead = $readFromClosingString; + $this->_currentPart = self::PART_CLOSING_XML_STRING; + return $returnString; + + } elseif ($this->_currentPart == self::PART_FILE_BINARY) { + // We have read past the entire message, so return it. + $returnString .= fread($this->_fileHandle, + self::MAX_BUFFER_SIZE); + $returnString .= $this->_closingBoundaryLine; + $this->closeFileHandle(); + $this->_doneReading = true; + return $returnString; + } + // are we just crossing from one section into another? + } elseif ($readTo >= $sizeOfCurrentPart) { + $readIntoNextPart = true; + $readFromRemainingPart = $sizeOfCurrentPart - $this->_bytesRead; + $readFromNextPart = $readTo - $sizeOfCurrentPart; + } + + if (!$readIntoNextPart) { + // we are not crossing any section so just return something + // from the current part + switch ($this->_currentPart) { + case self::PART_XML_STRING: + $returnString = $this->readFromStringPart( + $this->_currentPart, $this->_bytesRead, $bufferSize); + break; + case self::PART_FILE_BINARY: + $returnString = fread($this->_fileHandle, $bufferSize); + break; + case self::PART_CLOSING_XML_STRING: + $returnString = $this->readFromStringPart( + $this->_currentPart, $this->_bytesRead, $bufferSize); + break; + } + } else { + // we are crossing from one section to another, so figure out + // where we are coming from and going to + switch ($this->_currentPart) { + case self::PART_XML_STRING: + // crossing from string to file + $returnString = $this->readFromStringPart( + $this->_currentPart, $this->_bytesRead, + $readFromRemainingPart); + // free up string + unset($this->_parts[self::PART_XML_STRING]); + $returnString .= $this->smartfread($this->_fileHandle, + $readFromNextPart); + $this->_bytesRead = $readFromNextPart - 1; + break; + case self::PART_FILE_BINARY: + // skipping past file section + $returnString = $this->smartfread($this->_fileHandle, + $readFromRemainingPart); + $this->closeFileHandle(); + // read closing boundary string + $returnString = $this->readFromStringPart( + self::PART_CLOSING_XML_STRING, 0, $readFromNextPart); + // have we read past the entire closing boundary string? + if ($readFromNextPart >= + $this->_parts[self::PART_CLOSING_XML_STRING][0]) { + $this->_doneReading = true; + return $returnString; + } + + // Reset counter appropriately since we are now just + // counting how much of the final string is being read. + $this->_bytesRead = $readFromNextPart - 1; + break; + case self::PART_CLOSING_XML_STRING: + // reading past the end of the closing boundary + if ($readFromRemainingPart > 0) { + $returnString = $this->readFromStringPart( + $this->_currentPart, $this->_bytesRead, + $readFromRemainingPart); + $this->_doneReading = true; + } + return $returnString; + } + $this->_currentPart++; + } + $this->_bytesRead += $bufferSize; + return $returnString; + } + + /** + * Convenience method to shorthand the reading of non-file parts of the + * message. + * + * @param integer $part The part from which to read (supports only 0 or 2). + * @param integer $start The point at which to read from. + * @param integer $length How many characters to read. + * @return string A string of characters corresponding to the requested + * section. + */ + private function readFromStringPart($part, $start, $length) + { + return substr($this->_parts[$part][1], $start, $length); + } + + /** + * Return the total size of the mime message. + * + * @return integer Total size of the message to be sent. + */ + public function getTotalSize() + { + return $this->_totalSize; + } + + /** + * Check whether we have data left to read. + * + * @return boolean True if there is data remaining in the mime message, + * false, otherwise. + */ + public function hasData() + { + return !($this->_doneReading); + } + + /** + * Close the internal file that we are streaming to the socket. + * + * @return void + */ + protected function closeFileHandle() + { + if ($this->_fileHandle !== null) { + fclose($this->_fileHandle); + } + } + + /** + * Return a Content-type header that includes the current boundary string. + * + * @return string A valid HTTP Content-Type header. + */ + public function getContentType() + { + return 'multipart/related; boundary="' . + $this->_boundaryString . '"' . "\r\n"; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos.php b/applications/core/lib/Zend/Gdata/Photos.php new file mode 100755 index 0000000..fe090f6 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos.php @@ -0,0 +1,575 @@ +<?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 Photos + * @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_Photos_UserFeed + */ +require_once 'Zend/Gdata/Photos/UserFeed.php'; + +/** + * @see Zend_Gdata_Photos_AlbumFeed + */ +require_once 'Zend/Gdata/Photos/AlbumFeed.php'; + +/** + * @see Zend_Gdata_Photos_PhotoFeed + */ +require_once 'Zend/Gdata/Photos/PhotoFeed.php'; + +/** + * Service class for interacting with the Google Photos Data API. + * + * Like other service classes in this module, this class provides access via + * an HTTP client to Google servers for working with entries and feeds. + * + * @link http://code.google.com/apis/picasaweb/gdata.html + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos extends Zend_Gdata +{ + + const PICASA_BASE_URI = 'http://picasaweb.google.com/data'; + const PICASA_BASE_FEED_URI = 'http://picasaweb.google.com/data/feed'; + const AUTH_SERVICE_NAME = 'lh2'; + + /** + * Default projection when interacting with the Picasa server. + */ + const DEFAULT_PROJECTION = 'api'; + + /** + * The default visibility to filter events by. + */ + const DEFAULT_VISIBILITY = 'all'; + + /** + * The default user to retrieve feeds for. + */ + const DEFAULT_USER = 'default'; + + /** + * Path to the user feed on the Picasa server. + */ + const USER_PATH = 'user'; + + /** + * Path to album feeds on the Picasa server. + */ + const ALBUM_PATH = 'albumid'; + + /** + * Path to photo feeds on the Picasa server. + */ + const PHOTO_PATH = 'photoid'; + + /** + * The path to the community search feed on the Picasa server. + */ + const COMMUNITY_SEARCH_PATH = 'all'; + + /** + * The path to use for finding links to feeds within entries + */ + const FEED_LINK_PATH = 'http://schemas.google.com/g/2005#feed'; + + /** + * The path to use for the determining type of an entry + */ + const KIND_PATH = 'http://schemas.google.com/g/2005#kind'; + + /** + * Namespaces used for Zend_Gdata_Photos + * + * @var array + */ + public static $namespaces = array( + array('gphoto', 'http://schemas.google.com/photos/2007', 1, 0), + array('photo', 'http://www.pheed.com/pheed/', 1, 0), + array('exif', 'http://schemas.google.com/photos/exif/2007', 1, 0), + array('georss', 'http://www.georss.org/georss', 1, 0), + array('gml', 'http://www.opengis.net/gml', 1, 0), + array('media', 'http://search.yahoo.com/mrss/', 1, 0) + ); + + /** + * Create Zend_Gdata_Photos object + * + * @param Zend_Http_Client $client (optional) The HTTP client to use when + * when communicating with the 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_Photos'); + $this->registerPackage('Zend_Gdata_Photos_Extension'); + parent::__construct($client, $applicationId); + $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); + } + + /** + * Retrieve a UserFeed containing AlbumEntries, PhotoEntries and + * TagEntries associated with a given user. + * + * @param string $userName The userName of interest + * @param mixed $location (optional) The location for the feed, as a URL + * or Query. If not provided, a default URL will be used instead. + * @return Zend_Gdata_Photos_UserFeed + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function getUserFeed($userName = null, $location = null) + { + if ($location instanceof Zend_Gdata_Photos_UserQuery) { + $location->setType('feed'); + if ($userName !== null) { + $location->setUser($userName); + } + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Query) { + if ($userName !== null) { + $location->setUser($userName); + } + $uri = $location->getQueryUrl(); + } else if ($location !== null) { + $uri = $location; + } else if ($userName !== null) { + $uri = self::PICASA_BASE_FEED_URI . '/' . + self::DEFAULT_PROJECTION . '/' . self::USER_PATH . '/' . + $userName; + } else { + $uri = self::PICASA_BASE_FEED_URI . '/' . + self::DEFAULT_PROJECTION . '/' . self::USER_PATH . '/' . + self::DEFAULT_USER; + } + + return parent::getFeed($uri, 'Zend_Gdata_Photos_UserFeed'); + } + + /** + * Retreive AlbumFeed object containing multiple PhotoEntry or TagEntry + * objects. + * + * @param mixed $location (optional) The location for the feed, as a URL or Query. + * @return Zend_Gdata_Photos_AlbumFeed + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function getAlbumFeed($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_Photos_UserQuery) { + $location->setType('feed'); + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Photos_AlbumFeed'); + } + + /** + * Retreive PhotoFeed object containing comments and tags associated + * with a given photo. + * + * @param mixed $location (optional) The location for the feed, as a URL + * or Query. If not specified, the community search feed will + * be returned instead. + * @return Zend_Gdata_Photos_PhotoFeed + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function getPhotoFeed($location = null) + { + if ($location === null) { + $uri = self::PICASA_BASE_FEED_URI . '/' . + self::DEFAULT_PROJECTION . '/' . + self::COMMUNITY_SEARCH_PATH; + } else if ($location instanceof Zend_Gdata_Photos_UserQuery) { + $location->setType('feed'); + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Photos_PhotoFeed'); + } + + /** + * Retreive a single UserEntry object. + * + * @param mixed $location The location for the feed, as a URL or Query. + * @return Zend_Gdata_Photos_UserEntry + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function getUserEntry($location) + { + 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_Photos_UserQuery) { + $location->setType('entry'); + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getEntry($uri, 'Zend_Gdata_Photos_UserEntry'); + } + + /** + * Retreive a single AlbumEntry object. + * + * @param mixed $location The location for the feed, as a URL or Query. + * @return Zend_Gdata_Photos_AlbumEntry + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function getAlbumEntry($location) + { + 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_Photos_UserQuery) { + $location->setType('entry'); + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getEntry($uri, 'Zend_Gdata_Photos_AlbumEntry'); + } + + /** + * Retreive a single PhotoEntry object. + * + * @param mixed $location The location for the feed, as a URL or Query. + * @return Zend_Gdata_Photos_PhotoEntry + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function getPhotoEntry($location) + { + 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_Photos_UserQuery) { + $location->setType('entry'); + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getEntry($uri, 'Zend_Gdata_Photos_PhotoEntry'); + } + + /** + * Retreive a single TagEntry object. + * + * @param mixed $location The location for the feed, as a URL or Query. + * @return Zend_Gdata_Photos_TagEntry + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function getTagEntry($location) + { + 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_Photos_UserQuery) { + $location->setType('entry'); + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getEntry($uri, 'Zend_Gdata_Photos_TagEntry'); + } + + /** + * Retreive a single CommentEntry object. + * + * @param mixed $location The location for the feed, as a URL or Query. + * @return Zend_Gdata_Photos_CommentEntry + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function getCommentEntry($location) + { + 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_Photos_UserQuery) { + $location->setType('entry'); + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getEntry($uri, 'Zend_Gdata_Photos_CommentEntry'); + } + + /** + * Create a new album from a AlbumEntry. + * + * @param Zend_Gdata_Photos_AlbumEntry $album The album entry to + * insert. + * @param string $url (optional) The URI that the album should be + * uploaded to. If null, the default album creation URI for + * this domain will be used. + * @return Zend_Gdata_Photos_AlbumEntry The inserted album entry as + * returned by the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function insertAlbumEntry($album, $uri = null) + { + if ($uri === null) { + $uri = self::PICASA_BASE_FEED_URI . '/' . + self::DEFAULT_PROJECTION . '/' . self::USER_PATH . '/' . + self::DEFAULT_USER; + } + $newEntry = $this->insertEntry($album, $uri, 'Zend_Gdata_Photos_AlbumEntry'); + return $newEntry; + } + + /** + * Create a new photo from a PhotoEntry. + * + * @param Zend_Gdata_Photos_PhotoEntry $photo The photo to insert. + * @param string $url The URI that the photo should be uploaded + * to. Alternatively, an AlbumEntry can be provided and the + * photo will be added to that album. + * @return Zend_Gdata_Photos_PhotoEntry The inserted photo entry + * as returned by the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function insertPhotoEntry($photo, $uri = null) + { + if ($uri instanceof Zend_Gdata_Photos_AlbumEntry) { + $uri = $uri->getLink(self::FEED_LINK_PATH)->href; + } + if ($uri === null) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'URI must not be null'); + } + $newEntry = $this->insertEntry($photo, $uri, 'Zend_Gdata_Photos_PhotoEntry'); + return $newEntry; + } + + /** + * Create a new tag from a TagEntry. + * + * @param Zend_Gdata_Photos_TagEntry $tag The tag entry to insert. + * @param string $url The URI where the tag should be + * uploaded to. Alternatively, a PhotoEntry can be provided and + * the tag will be added to that photo. + * @return Zend_Gdata_Photos_TagEntry The inserted tag entry as returned + * by the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function insertTagEntry($tag, $uri = null) + { + if ($uri instanceof Zend_Gdata_Photos_PhotoEntry) { + $uri = $uri->getLink(self::FEED_LINK_PATH)->href; + } + if ($uri === null) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'URI must not be null'); + } + $newEntry = $this->insertEntry($tag, $uri, 'Zend_Gdata_Photos_TagEntry'); + return $newEntry; + } + + /** + * Create a new comment from a CommentEntry. + * + * @param Zend_Gdata_Photos_CommentEntry $comment The comment entry to + * insert. + * @param string $url The URI where the comment should be uploaded to. + * Alternatively, a PhotoEntry can be provided and + * the comment will be added to that photo. + * @return Zend_Gdata_Photos_CommentEntry The inserted comment entry + * as returned by the server. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function insertCommentEntry($comment, $uri = null) + { + if ($uri instanceof Zend_Gdata_Photos_PhotoEntry) { + $uri = $uri->getLink(self::FEED_LINK_PATH)->href; + } + if ($uri === null) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'URI must not be null'); + } + $newEntry = $this->insertEntry($comment, $uri, 'Zend_Gdata_Photos_CommentEntry'); + return $newEntry; + } + + /** + * Delete an AlbumEntry. + * + * @param Zend_Gdata_Photos_AlbumEntry $album The album entry to + * delete. + * @param boolean $catch Whether to catch an exception when + * modified and re-delete or throw + * @return void. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function deleteAlbumEntry($album, $catch) + { + if ($catch) { + try { + $this->delete($album); + } catch (Zend_Gdata_App_HttpException $e) { + if ($e->getResponse()->getStatus() === 409) { + $entry = new Zend_Gdata_Photos_AlbumEntry($e->getResponse()->getBody()); + $this->delete($entry->getLink('edit')->href); + } else { + throw $e; + } + } + } else { + $this->delete($album); + } + } + + /** + * Delete a PhotoEntry. + * + * @param Zend_Gdata_Photos_PhotoEntry $photo The photo entry to + * delete. + * @param boolean $catch Whether to catch an exception when + * modified and re-delete or throw + * @return void. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function deletePhotoEntry($photo, $catch) + { + if ($catch) { + try { + $this->delete($photo); + } catch (Zend_Gdata_App_HttpException $e) { + if ($e->getResponse()->getStatus() === 409) { + $entry = new Zend_Gdata_Photos_PhotoEntry($e->getResponse()->getBody()); + $this->delete($entry->getLink('edit')->href); + } else { + throw $e; + } + } + } else { + $this->delete($photo); + } + } + + /** + * Delete a CommentEntry. + * + * @param Zend_Gdata_Photos_CommentEntry $comment The comment entry to + * delete. + * @param boolean $catch Whether to catch an exception when + * modified and re-delete or throw + * @return void. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function deleteCommentEntry($comment, $catch) + { + if ($catch) { + try { + $this->delete($comment); + } catch (Zend_Gdata_App_HttpException $e) { + if ($e->getResponse()->getStatus() === 409) { + $entry = new Zend_Gdata_Photos_CommentEntry($e->getResponse()->getBody()); + $this->delete($entry->getLink('edit')->href); + } else { + throw $e; + } + } + } else { + $this->delete($comment); + } + } + + /** + * Delete a TagEntry. + * + * @param Zend_Gdata_Photos_TagEntry $tag The tag entry to + * delete. + * @param boolean $catch Whether to catch an exception when + * modified and re-delete or throw + * @return void. + * @throws Zend_Gdata_App_Exception + * @throws Zend_Gdata_App_HttpException + */ + public function deleteTagEntry($tag, $catch) + { + if ($catch) { + try { + $this->delete($tag); + } catch (Zend_Gdata_App_HttpException $e) { + if ($e->getResponse()->getStatus() === 409) { + $entry = new Zend_Gdata_Photos_TagEntry($e->getResponse()->getBody()); + $this->delete($entry->getLink('edit')->href); + } else { + throw $e; + } + } + } else { + $this->delete($tag); + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/AlbumEntry.php b/applications/core/lib/Zend/Gdata/Photos/AlbumEntry.php new file mode 100755 index 0000000..ab11a90 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/AlbumEntry.php @@ -0,0 +1,609 @@ +<?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 Photos + * @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_Photos_Extension_Access + */ +require_once 'Zend/Gdata/Photos/Extension/Access.php'; + +/** + * @see Zend_Gdata_Photos_Extension_BytesUsed + */ +require_once 'Zend/Gdata/Photos/Extension/BytesUsed.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Location + */ +require_once 'Zend/Gdata/Photos/Extension/Location.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Name + */ +require_once 'Zend/Gdata/Photos/Extension/Name.php'; + +/** + * @see Zend_Gdata_Photos_Extension_NumPhotos + */ +require_once 'Zend/Gdata/Photos/Extension/NumPhotos.php'; + +/** + * @see Zend_Gdata_Photos_Extension_NumPhotosRemaining + */ +require_once 'Zend/Gdata/Photos/Extension/NumPhotosRemaining.php'; + +/** + * @see Zend_Gdata_Photos_Extension_CommentCount + */ +require_once 'Zend/Gdata/Photos/Extension/CommentCount.php'; + +/** + * @see Zend_Gdata_Photos_Extension_CommentingEnabled + */ +require_once 'Zend/Gdata/Photos/Extension/CommentingEnabled.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Id + */ +require_once 'Zend/Gdata/Photos/Extension/Id.php'; + +/** + * @see Zend_Gdata_Geo_Extension_GeoRssWhere + */ +require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php'; + +/** + * @see Zend_Gdata_Media_Extension_MediaGroup + */ +require_once 'Zend/Gdata/Media/Extension/MediaGroup.php'; + +/** + * @see Zend_Gdata_App_Extension_Category + */ +require_once 'Zend/Gdata/App/Extension/Category.php'; + +/** + * Data model class for a Photo Album Entry. + * + * To transfer user entries to and from the servers, including + * creating new entries, refer to the service class, + * Zend_Gdata_Photos. + * + * This class represents <atom:entry> in the Google Data protocol. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_AlbumEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Photos_AlbumEntry'; + + /** + * gphoto:id element + * + * @var Zend_Gdata_Photos_Extension_Id + */ + protected $_gphotoId = null; + + /** + * gphoto:access element + * + * @var Zend_Gdata_Photos_Extension_Access + */ + protected $_gphotoAccess = null; + + /** + * gphoto:location element + * + * @var Zend_Gdata_Photos_Extension_Location + */ + protected $_gphotoLocation = null; + + /** + * gphoto:user element + * + * @var Zend_Gdata_Photos_Extension_User + */ + protected $_gphotoUser = null; + + /** + * gphoto:nickname element + * + * @var Zend_Gdata_Photos_Extension_Nickname + */ + protected $_gphotoNickname = null; + + /** + * gphoto:timestamp element + * + * @var Zend_Gdata_Photos_Extension_Timestamp + */ + protected $_gphotoTimestamp = null; + + /** + * gphoto:name element + * + * @var Zend_Gdata_Photos_Extension_Name + */ + protected $_gphotoName = null; + + /** + * gphoto:numphotos element + * + * @var Zend_Gdata_Photos_Extension_NumPhotos + */ + protected $_gphotoNumPhotos = null; + + /** + * gphoto:commentCount element + * + * @var Zend_Gdata_Photos_Extension_CommentCount + */ + protected $_gphotoCommentCount = null; + + /** + * gphoto:commentingEnabled element + * + * @var Zend_Gdata_Photos_Extension_CommentingEnabled + */ + protected $_gphotoCommentingEnabled = null; + + /** + * media:group element + * + * @var Zend_Gdata_Media_MediaGroup + */ + protected $_mediaGroup = null; + + /** + * georss:where element + * + * @var Zend_Gdata_Geo_Extension_GeoRssWhere + */ + protected $_geoRssWhere = null; + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct($element); + + $category = new Zend_Gdata_App_Extension_Category( + 'http://schemas.google.com/photos/2007#album', + 'http://schemas.google.com/g/2005#kind'); + $this->setCategory(array($category)); + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_gphotoTimestamp !== null) { + $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument)); + } + if ($this->_gphotoUser !== null) { + $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); + } + if ($this->_gphotoNickname !== null) { + $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); + } + if ($this->_gphotoAccess !== null) { + $element->appendChild($this->_gphotoAccess->getDOM($element->ownerDocument)); + } + if ($this->_gphotoLocation !== null) { + $element->appendChild($this->_gphotoLocation->getDOM($element->ownerDocument)); + } + if ($this->_gphotoName !== null) { + $element->appendChild($this->_gphotoName->getDOM($element->ownerDocument)); + } + if ($this->_gphotoNumPhotos !== null) { + $element->appendChild($this->_gphotoNumPhotos->getDOM($element->ownerDocument)); + } + if ($this->_gphotoCommentCount !== null) { + $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument)); + } + if ($this->_gphotoCommentingEnabled !== null) { + $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument)); + } + if ($this->_gphotoId !== null) { + $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); + } + 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('gphoto') . ':' . 'access'; + $access = new Zend_Gdata_Photos_Extension_Access(); + $access->transferFromDOM($child); + $this->_gphotoAccess = $access; + break; + case $this->lookupNamespace('gphoto') . ':' . 'location'; + $location = new Zend_Gdata_Photos_Extension_Location(); + $location->transferFromDOM($child); + $this->_gphotoLocation = $location; + break; + case $this->lookupNamespace('gphoto') . ':' . 'name'; + $name = new Zend_Gdata_Photos_Extension_Name(); + $name->transferFromDOM($child); + $this->_gphotoName = $name; + break; + case $this->lookupNamespace('gphoto') . ':' . 'numphotos'; + $numPhotos = new Zend_Gdata_Photos_Extension_NumPhotos(); + $numPhotos->transferFromDOM($child); + $this->_gphotoNumPhotos = $numPhotos; + break; + case $this->lookupNamespace('gphoto') . ':' . 'commentCount'; + $commentCount = new Zend_Gdata_Photos_Extension_CommentCount(); + $commentCount->transferFromDOM($child); + $this->_gphotoCommentCount = $commentCount; + break; + case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled'; + $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled(); + $commentingEnabled->transferFromDOM($child); + $this->_gphotoCommentingEnabled = $commentingEnabled; + break; + case $this->lookupNamespace('gphoto') . ':' . 'id'; + $id = new Zend_Gdata_Photos_Extension_Id(); + $id->transferFromDOM($child); + $this->_gphotoId = $id; + break; + case $this->lookupNamespace('gphoto') . ':' . 'user'; + $user = new Zend_Gdata_Photos_Extension_User(); + $user->transferFromDOM($child); + $this->_gphotoUser = $user; + break; + case $this->lookupNamespace('gphoto') . ':' . 'timestamp'; + $timestamp = new Zend_Gdata_Photos_Extension_Timestamp(); + $timestamp->transferFromDOM($child); + $this->_gphotoTimestamp = $timestamp; + break; + case $this->lookupNamespace('gphoto') . ':' . 'nickname'; + $nickname = new Zend_Gdata_Photos_Extension_Nickname(); + $nickname->transferFromDOM($child); + $this->_gphotoNickname = $nickname; + break; + case $this->lookupNamespace('georss') . ':' . 'where'; + $geoRssWhere = new Zend_Gdata_Geo_Extension_GeoRssWhere(); + $geoRssWhere->transferFromDOM($child); + $this->_geoRssWhere = $geoRssWhere; + break; + case $this->lookupNamespace('media') . ':' . 'group'; + $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); + $mediaGroup->transferFromDOM($child); + $this->_mediaGroup = $mediaGroup; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value for this element's gphoto:access attribute. + * + * @see setGphotoAccess + * @return string The requested attribute. + */ + public function getGphotoAccess() + { + return $this->_gphotoAccess; + } + + /** + * Set the value for this element's gphoto:access attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Access The element being modified. + */ + public function setGphotoAccess($value) + { + $this->_gphotoAccess = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:location attribute. + * + * @see setGphotoLocation + * @return string The requested attribute. + */ + public function getGphotoLocation() + { + return $this->_gphotoLocation; + } + + /** + * Set the value for this element's gphoto:location attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Location The element being modified. + */ + public function setGphotoLocation($value) + { + $this->_location = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:name attribute. + * + * @see setGphotoName + * @return string The requested attribute. + */ + public function getGphotoName() + { + return $this->_gphotoName; + } + + /** + * Set the value for this element's gphoto:name attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Name The element being modified. + */ + public function setGphotoName($value) + { + $this->_gphotoName = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:numphotos attribute. + * + * @see setGphotoNumPhotos + * @return string The requested attribute. + */ + public function getGphotoNumPhotos() + { + return $this->_gphotoNumPhotos; + } + + /** + * Set the value for this element's gphoto:numphotos attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_NumPhotos The element being modified. + */ + public function setGphotoNumPhotos($value) + { + $this->_gphotoNumPhotos = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:commentCount attribute. + * + * @see setGphotoCommentCount + * @return string The requested attribute. + */ + public function getGphotoCommentCount() + { + return $this->_gphotoCommentCount; + } + + /** + * Set the value for this element's gphoto:commentCount attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified. + */ + public function setGphotoCommentCount($value) + { + $this->_gphotoCommentCount = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:commentingEnabled attribute. + * + * @see setGphotoCommentingEnabled + * @return string The requested attribute. + */ + public function getGphotoCommentingEnabled() + { + return $this->_gphotoCommentingEnabled; + } + + /** + * Set the value for this element's gphoto:commentingEnabled attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified. + */ + public function setGphotoCommentingEnabled($value) + { + $this->_gphotoCommentingEnabled = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:id attribute. + * + * @see setGphotoId + * @return string The requested attribute. + */ + public function getGphotoId() + { + return $this->_gphotoId; + } + + /** + * Set the value for this element's gphoto:id attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Id The element being modified. + */ + public function setGphotoId($value) + { + $this->_gphotoId = $value; + return $this; + } + + /** + * Get the value for this element's georss:where attribute. + * + * @see setGeoRssWhere + * @return string The requested attribute. + */ + public function getGeoRssWhere() + { + return $this->_geoRssWhere; + } + + /** + * Set the value for this element's georss:where attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified. + */ + public function setGeoRssWhere($value) + { + $this->_geoRssWhere = $value; + return $this; + } + + /** + * Get the value for this element's media:group attribute. + * + * @see setMediaGroup + * @return string The requested attribute. + */ + public function getMediaGroup() + { + return $this->_mediaGroup; + } + + /** + * Set the value for this element's media:group attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified. + */ + public function setMediaGroup($value) + { + $this->_mediaGroup = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:user attribute. + * + * @see setGphotoUser + * @return string The requested attribute. + */ + public function getGphotoUser() + { + return $this->_gphotoUser; + } + + /** + * Set the value for this element's gphoto:user attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_User The element being modified. + */ + public function setGphotoUser($value) + { + $this->_gphotoUser = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:nickname attribute. + * + * @see setGphotoNickname + * @return string The requested attribute. + */ + public function getGphotoNickname() + { + return $this->_gphotoNickname; + } + + /** + * Set the value for this element's gphoto:nickname attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Nickname The element being modified. + */ + public function setGphotoNickname($value) + { + $this->_gphotoNickname = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:timestamp attribute. + * + * @see setGphotoTimestamp + * @return string The requested attribute. + */ + public function getGphotoTimestamp() + { + return $this->_gphotoTimestamp; + } + + /** + * Set the value for this element's gphoto:timestamp attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified. + */ + public function setGphotoTimestamp($value) + { + $this->_gphotoTimestamp = $value; + return $this; + } +} diff --git a/applications/core/lib/Zend/Gdata/Photos/AlbumFeed.php b/applications/core/lib/Zend/Gdata/Photos/AlbumFeed.php new file mode 100755 index 0000000..944d4d6 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/AlbumFeed.php @@ -0,0 +1,508 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * @see Zend_Gdata_Feed + */ +require_once 'Zend/Gdata/Feed.php'; + +/** + * @see Zend_Gdata_Photos_AlbumEntry + */ +require_once 'Zend/Gdata/Photos/AlbumEntry.php'; + +/** + * Data model for a collection of album entries, usually + * provided by the servers. + * + * For information on requesting this feed from a server, see the + * service class, Zend_Gdata_Photos. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_AlbumFeed extends Zend_Gdata_Feed +{ + protected $_entryClassName = 'Zend_Gdata_Photos_AlbumEntry'; + protected $_feedClassName = 'Zend_Gdata_Photos_AlbumFeed'; + + /** + * gphoto:id element + * + * @var Zend_Gdata_Photos_Extension_Id + */ + protected $_gphotoId = null; + + /** + * gphoto:user element + * + * @var Zend_Gdata_Photos_Extension_User + */ + protected $_gphotoUser = null; + + /** + * gphoto:access element + * + * @var Zend_Gdata_Photos_Extension_Access + */ + protected $_gphotoAccess = null; + + /** + * gphoto:location element + * + * @var Zend_Gdata_Photos_Extension_Location + */ + protected $_gphotoLocation = null; + + /** + * gphoto:nickname element + * + * @var Zend_Gdata_Photos_Extension_Nickname + */ + protected $_gphotoNickname = null; + + /** + * gphoto:timestamp element + * + * @var Zend_Gdata_Photos_Extension_Timestamp + */ + protected $_gphotoTimestamp = null; + + /** + * gphoto:name element + * + * @var Zend_Gdata_Photos_Extension_Name + */ + protected $_gphotoName = null; + + /** + * gphoto:numphotos element + * + * @var Zend_Gdata_Photos_Extension_NumPhotos + */ + protected $_gphotoNumPhotos = null; + + /** + * gphoto:commentCount element + * + * @var Zend_Gdata_Photos_Extension_CommentCount + */ + protected $_gphotoCommentCount = null; + + /** + * gphoto:commentingEnabled element + * + * @var Zend_Gdata_Photos_Extension_CommentingEnabled + */ + protected $_gphotoCommentingEnabled = null; + + protected $_entryKindClassMapping = array( + 'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry', + 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', + 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry' + ); + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_gphotoId != null) { + $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); + } + if ($this->_gphotoUser != null) { + $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); + } + if ($this->_gphotoNickname != null) { + $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); + } + if ($this->_gphotoName != null) { + $element->appendChild($this->_gphotoName->getDOM($element->ownerDocument)); + } + if ($this->_gphotoLocation != null) { + $element->appendChild($this->_gphotoLocation->getDOM($element->ownerDocument)); + } + if ($this->_gphotoAccess != null) { + $element->appendChild($this->_gphotoAccess->getDOM($element->ownerDocument)); + } + if ($this->_gphotoTimestamp != null) { + $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument)); + } + if ($this->_gphotoNumPhotos != null) { + $element->appendChild($this->_gphotoNumPhotos->getDOM($element->ownerDocument)); + } + if ($this->_gphotoCommentingEnabled != null) { + $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument)); + } + if ($this->_gphotoCommentCount != null) { + $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument)); + } + + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + + switch ($absoluteNodeName) { + case $this->lookupNamespace('gphoto') . ':' . 'id'; + $id = new Zend_Gdata_Photos_Extension_Id(); + $id->transferFromDOM($child); + $this->_gphotoId = $id; + break; + case $this->lookupNamespace('gphoto') . ':' . 'user'; + $user = new Zend_Gdata_Photos_Extension_User(); + $user->transferFromDOM($child); + $this->_gphotoUser = $user; + break; + case $this->lookupNamespace('gphoto') . ':' . 'nickname'; + $nickname = new Zend_Gdata_Photos_Extension_Nickname(); + $nickname->transferFromDOM($child); + $this->_gphotoNickname = $nickname; + break; + case $this->lookupNamespace('gphoto') . ':' . 'name'; + $name = new Zend_Gdata_Photos_Extension_Name(); + $name->transferFromDOM($child); + $this->_gphotoName = $name; + break; + case $this->lookupNamespace('gphoto') . ':' . 'location'; + $location = new Zend_Gdata_Photos_Extension_Location(); + $location->transferFromDOM($child); + $this->_gphotoLocation = $location; + break; + case $this->lookupNamespace('gphoto') . ':' . 'access'; + $access = new Zend_Gdata_Photos_Extension_Access(); + $access->transferFromDOM($child); + $this->_gphotoAccess = $access; + break; + case $this->lookupNamespace('gphoto') . ':' . 'timestamp'; + $timestamp = new Zend_Gdata_Photos_Extension_Timestamp(); + $timestamp->transferFromDOM($child); + $this->_gphotoTimestamp = $timestamp; + break; + case $this->lookupNamespace('gphoto') . ':' . 'numphotos'; + $numphotos = new Zend_Gdata_Photos_Extension_NumPhotos(); + $numphotos->transferFromDOM($child); + $this->_gphotoNumPhotos = $numphotos; + break; + case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled'; + $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled(); + $commentingEnabled->transferFromDOM($child); + $this->_gphotoCommentingEnabled = $commentingEnabled; + break; + case $this->lookupNamespace('gphoto') . ':' . 'commentCount'; + $commentCount = new Zend_Gdata_Photos_Extension_CommentCount(); + $commentCount->transferFromDOM($child); + $this->_gphotoCommentCount = $commentCount; + break; + case $this->lookupNamespace('atom') . ':' . 'entry': + $entryClassName = $this->_entryClassName; + $tmpEntry = new Zend_Gdata_App_Entry($child); + $categories = $tmpEntry->getCategory(); + foreach ($categories as $category) { + if ($category->scheme == Zend_Gdata_Photos::KIND_PATH && + $this->_entryKindClassMapping[$category->term] != "") { + $entryClassName = $this->_entryKindClassMapping[$category->term]; + break; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.'); + } + } + + $newEntry = new $entryClassName($child); + $newEntry->setHttpClient($this->getHttpClient()); + $this->_entry[] = $newEntry; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value for this element's gphoto:user attribute. + * + * @see setGphotoUser + * @return string The requested attribute. + */ + public function getGphotoUser() + { + return $this->_gphotoUser; + } + + /** + * Set the value for this element's gphoto:user attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_User The element being modified. + */ + public function setGphotoUser($value) + { + $this->_gphotoUser = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:access attribute. + * + * @see setGphotoAccess + * @return string The requested attribute. + */ + public function getGphotoAccess() + { + return $this->_gphotoAccess; + } + + /** + * Set the value for this element's gphoto:access attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Access The element being modified. + */ + public function setGphotoAccess($value) + { + $this->_gphotoAccess = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:location attribute. + * + * @see setGphotoLocation + * @return string The requested attribute. + */ + public function getGphotoLocation() + { + return $this->_gphotoLocation; + } + + /** + * Set the value for this element's gphoto:location attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Location The element being modified. + */ + public function setGphotoLocation($value) + { + $this->_gphotoLocation = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:name attribute. + * + * @see setGphotoName + * @return string The requested attribute. + */ + public function getGphotoName() + { + return $this->_gphotoName; + } + + /** + * Set the value for this element's gphoto:name attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Name The element being modified. + */ + public function setGphotoName($value) + { + $this->_gphotoName = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:numphotos attribute. + * + * @see setGphotoNumPhotos + * @return string The requested attribute. + */ + public function getGphotoNumPhotos() + { + return $this->_gphotoNumPhotos; + } + + /** + * Set the value for this element's gphoto:numphotos attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_NumPhotos The element being modified. + */ + public function setGphotoNumPhotos($value) + { + $this->_gphotoNumPhotos = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:commentCount attribute. + * + * @see setGphotoCommentCount + * @return string The requested attribute. + */ + public function getGphotoCommentCount() + { + return $this->_gphotoCommentCount; + } + + /** + * Set the value for this element's gphoto:commentCount attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified. + */ + public function setGphotoCommentCount($value) + { + $this->_gphotoCommentCount = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:commentingEnabled attribute. + * + * @see setGphotoCommentingEnabled + * @return string The requested attribute. + */ + public function getGphotoCommentingEnabled() + { + return $this->_gphotoCommentingEnabled; + } + + /** + * Set the value for this element's gphoto:commentingEnabled attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified. + */ + public function setGphotoCommentingEnabled($value) + { + $this->_gphotoCommentingEnabled = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:id attribute. + * + * @see setGphotoId + * @return string The requested attribute. + */ + public function getGphotoId() + { + return $this->_gphotoId; + } + + /** + * Set the value for this element's gphoto:id attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Id The element being modified. + */ + public function setGphotoId($value) + { + $this->_gphotoId = $value; + return $this; + } + + /** + * Get the value for this element's georss:where attribute. + * + * @see setGeoRssWhere + * @return string The requested attribute. + */ + public function getGeoRssWhere() + { + return $this->_geoRssWhere; + } + + /** + * Set the value for this element's georss:where attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified. + */ + public function setGeoRssWhere($value) + { + $this->_geoRssWhere = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:nickname attribute. + * + * @see setGphotoNickname + * @return string The requested attribute. + */ + public function getGphotoNickname() + { + return $this->_gphotoNickname; + } + + /** + * Set the value for this element's gphoto:nickname attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Nickname The element being modified. + */ + public function setGphotoNickname($value) + { + $this->_gphotoNickname = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:timestamp attribute. + * + * @see setGphotoTimestamp + * @return string The requested attribute. + */ + public function getGphotoTimestamp() + { + return $this->_gphotoTimestamp; + } + + /** + * Set the value for this element's gphoto:timestamp attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified. + */ + public function setGphotoTimestamp($value) + { + $this->_gphotoTimestamp = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/AlbumQuery.php b/applications/core/lib/Zend/Gdata/Photos/AlbumQuery.php new file mode 100755 index 0000000..58eb430 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/AlbumQuery.php @@ -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 + * @subpackage Photos + * @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_Photos_UserQuery + */ +require_once('Zend/Gdata/Photos/UserQuery.php'); + +/** + * Assists in constructing album queries for various entries. + * Instances of this class can be provided in many places where a URL is + * required. + * + * For information on submitting queries to a server, see the service + * class, Zend_Gdata_Photos. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_AlbumQuery extends Zend_Gdata_Photos_UserQuery +{ + + /** + * The name of the album to query for. Mutually exclusive with AlbumId. + * + * @var string + */ + protected $_albumName = null; + + /** + * The ID of the album to query for. Mutually exclusive with AlbumName. + * + * @var string + */ + protected $_albumId = null; + + /** + * Set the album name to query for. When set, this album's photographs + * be returned. If not set or null, the default user's feed will be + * returned instead. + * + * NOTE: AlbumName and AlbumId are mutually exclusive. Setting one will + * automatically set the other to null. + * + * @param string $value The name of the album to retrieve, or null to + * clear. + * @return Zend_Gdata_Photos_AlbumQuery The query object. + */ + public function setAlbumName($value) + { + $this->_albumId = null; + $this->_albumName = $value; + + return $this; + } + + /** + * Get the album name which is to be returned. + * + * @see setAlbumName + * @return string The name of the album to retrieve. + */ + public function getAlbumName() + { + return $this->_albumName; + } + + /** + * Set the album ID to query for. When set, this album's photographs + * be returned. If not set or null, the default user's feed will be + * returned instead. + * + * NOTE: Album and AlbumId are mutually exclusive. Setting one will + * automatically set the other to null. + * + * @param string $value The ID of the album to retrieve, or null to + * clear. + * @return Zend_Gdata_Photos_AlbumQuery The query object. + */ + public function setAlbumId($value) + { + $this->_albumName = null; + $this->_albumId = $value; + + return $this; + } + + /** + * Get the album ID which is to be returned. + * + * @see setAlbum + * @return string The ID of the album to retrieve. + */ + public function getAlbumId() + { + return $this->_albumId; + } + + /** + * Returns the URL generated for this query, based on it's current + * parameters. + * + * @return string A URL generated based on the state of this query. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function getQueryUrl($incomingUri = '') + { + $uri = ''; + if ($this->getAlbumName() !== null && $this->getAlbumId() === null) { + $uri .= '/album/' . $this->getAlbumName(); + } elseif ($this->getAlbumName() === null && $this->getAlbumId() !== null) { + $uri .= '/albumid/' . $this->getAlbumId(); + } elseif ($this->getAlbumName() !== null && $this->getAlbumId() !== null) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'AlbumName and AlbumId cannot both be non-null'); + } else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'AlbumName and AlbumId cannot both be null'); + } + $uri .= $incomingUri; + return parent::getQueryUrl($uri); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/CommentEntry.php b/applications/core/lib/Zend/Gdata/Photos/CommentEntry.php new file mode 100755 index 0000000..805645d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/CommentEntry.php @@ -0,0 +1,194 @@ +<?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 Photos + * @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_Photos_Extension_Id + */ +require_once 'Zend/Gdata/Photos/Extension/Id.php'; + +/** + * @see Zend_Gdata_Photos_Extension_PhotoId + */ +require_once 'Zend/Gdata/Photos/Extension/PhotoId.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Weight + */ +require_once 'Zend/Gdata/Photos/Extension/Weight.php'; + +/** + * @see Zend_Gdata_App_Extension_Category + */ +require_once 'Zend/Gdata/App/Extension/Category.php'; + +/** + * Data model class for a Comment Entry. + * + * To transfer user entries to and from the servers, including + * creating new entries, refer to the service class, + * Zend_Gdata_Photos. + * + * This class represents <atom:entry> in the Google Data protocol. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_CommentEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Photos_CommentEntry'; + + /** + * gphoto:id element + * + * @var Zend_Gdata_Photos_Extension_Id + */ + protected $_gphotoId = null; + + /** + * gphoto:photoid element, differs from gphoto:id as this is an + * actual identification number unique exclusively to photo entries, + * whereas gphoto:id can refer to all gphoto objects + * + * @var Zend_Gdata_Photos_Extension_PhotoId + */ + protected $_gphotoPhotoId = null; + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct($element); + + $category = new Zend_Gdata_App_Extension_Category( + 'http://schemas.google.com/photos/2007#comment', + 'http://schemas.google.com/g/2005#kind'); + $this->setCategory(array($category)); + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_gphotoId !== null) { + $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); + } + if ($this->_gphotoPhotoId !== null) { + $element->appendChild($this->_gphotoPhotoId->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('gphoto') . ':' . 'id'; + $id = new Zend_Gdata_Photos_Extension_Id(); + $id->transferFromDOM($child); + $this->_gphotoId = $id; + break; + case $this->lookupNamespace('gphoto') . ':' . 'photoid'; + $photoid = new Zend_Gdata_Photos_Extension_PhotoId(); + $photoid->transferFromDOM($child); + $this->_gphotoPhotoId = $photoid; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value for this element's gphoto:photoid attribute. + * + * @see setGphotoPhotoId + * @return string The requested attribute. + */ + public function getGphotoPhotoId() + { + return $this->_gphotoPhotoId; + } + + /** + * Set the value for this element's gphoto:photoid attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_PhotoId The element being modified. + */ + public function setGphotoPhotoId($value) + { + $this->_gphotoPhotoId = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:id attribute. + * + * @see setGphotoId + * @return string The requested attribute. + */ + public function getGphotoId() + { + return $this->_gphotoId; + } + + /** + * Set the value for this element's gphoto:id attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Id The element being modified. + */ + public function setGphotoId($value) + { + $this->_gphotoId = $value; + return $this; + } +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Access.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Access.php new file mode 100755 index 0000000..65f3fd4 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Access.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:access element used by the API. + * This determines the visibility for an album, and can be either + * the strings 'private' or 'public'. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Access extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'access'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Access object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/AlbumId.php b/applications/core/lib/Zend/Gdata/Photos/Extension/AlbumId.php new file mode 100755 index 0000000..bd6030c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/AlbumId.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:albumid element used by the API. This + * class represents the ID of an album and is usually contained + * within an instance of Zend_Gdata_Photos_AlbumEntry or CommentEntry. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_AlbumId extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'albumid'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_AlbumId object. + * + * @param string $text (optional) The value to use for the Album ID. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/BytesUsed.php b/applications/core/lib/Zend/Gdata/Photos/Extension/BytesUsed.php new file mode 100755 index 0000000..60e20ab --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/BytesUsed.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:bytesUsed element used by the API. + * This indicates the number of bytes of storage used by an album. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_BytesUsed extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'bytesUsed'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_BytesUsed object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Checksum.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Checksum.php new file mode 100755 index 0000000..92eba1b --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Checksum.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:checksum element used by the API. + * This is an optional field that can be used to store a photo's + * checksum to ease duplicate checking. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Checksum extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'checksum'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Checksum object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Client.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Client.php new file mode 100755 index 0000000..365ec8f --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Client.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:client element used by the API. + * This is an optional field that can be used to indicate the + * client which created a photo. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Client extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'client'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Client object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/CommentCount.php b/applications/core/lib/Zend/Gdata/Photos/Extension/CommentCount.php new file mode 100755 index 0000000..52dd976 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/CommentCount.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:commentCount element used by the API. This + * class represents the number of comments attached to an entry and is usually contained + * within an instance of Zend_Gdata_Photos_PhotoEntry or AlbumEntry. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_CommentCount extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'commentCount'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_CommentCount object. + * + * @param string $text (optional) The value to use for the count. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/CommentingEnabled.php b/applications/core/lib/Zend/Gdata/Photos/Extension/CommentingEnabled.php new file mode 100755 index 0000000..7f525c3 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/CommentingEnabled.php @@ -0,0 +1,63 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:commentingEnabled element used by the API. + * This class represents whether commenting is enabled for a given + * entry. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_CommentingEnabled extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'commentingEnabled'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_CommentingEnabled object. + * + * @param string $text (optional) Whether commenting should be enabled + * or not. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Height.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Height.php new file mode 100755 index 0000000..d204c14 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Height.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:height element used by the API. + * The height of a photo in pixels. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Height extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'height'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Height object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Id.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Id.php new file mode 100755 index 0000000..39d371c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Id.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:id element used by the API. This class + * represents the unique ID assigned to an element by the servers. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Id extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'id'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Id object. + * + * @param string $text (optional) The ID being represented. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Location.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Location.php new file mode 100755 index 0000000..baf7d50 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Location.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:location element used by the API. + * This indicates the number of bytes of storage used by an album. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Location extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'location'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Location object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php b/applications/core/lib/Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php new file mode 100755 index 0000000..7c57297 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:maxPhotosPerAlbum element used by the API. + * This class represents the maximum number of photos allowed in an + * album. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_MaxPhotosPerAlbum extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'maxPhotosPerAlbum'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum object. + * + * @param string $text (optional) The value being represented. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Name.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Name.php new file mode 100755 index 0000000..f5230f5 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Name.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:name element used by the API. + * This indicates the URL-usable name for an album. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Name extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'name'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Name object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Nickname.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Nickname.php new file mode 100755 index 0000000..14938a7 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Nickname.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:nickname element used by the API. + * This class represents the nickname for a user. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Nickname extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'nickname'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Nickname object. + * + * @param string $text (optional) The value being represented. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/NumPhotos.php b/applications/core/lib/Zend/Gdata/Photos/Extension/NumPhotos.php new file mode 100755 index 0000000..dcd72bc --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/NumPhotos.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:numphotos element used by the API. + * This indicates the number of photos in an album. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_NumPhotos extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'numphotos'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_NumPhotos object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/NumPhotosRemaining.php b/applications/core/lib/Zend/Gdata/Photos/Extension/NumPhotosRemaining.php new file mode 100755 index 0000000..1fb5574 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/NumPhotosRemaining.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:numphotosremaining element used by the API. + * This indicates the number of photos remaining in an album. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_NumPhotosRemaining extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'numphotosremaining'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_NumPhotosRemaining object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/PhotoId.php b/applications/core/lib/Zend/Gdata/Photos/Extension/PhotoId.php new file mode 100755 index 0000000..cbd6b3d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/PhotoId.php @@ -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 + * @subpackage Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:id element used by the Picasa API. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_PhotoId extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'id'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_PhotoId object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Position.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Position.php new file mode 100755 index 0000000..e5e6801 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Position.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:position element used by the API. + * The ordinal position of a photo within an album. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Position extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'position'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Position object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/QuotaCurrent.php b/applications/core/lib/Zend/Gdata/Photos/Extension/QuotaCurrent.php new file mode 100755 index 0000000..79fa467 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/QuotaCurrent.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:quotaCurrent element used by the API. + * This class represents the number of bytes of storage used by a user. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_QuotaCurrent extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'quotaCurrent'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_QuotaCurrent object. + * + * @param string $text (optional) The value being represented. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/QuotaLimit.php b/applications/core/lib/Zend/Gdata/Photos/Extension/QuotaLimit.php new file mode 100755 index 0000000..685a8fa --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/QuotaLimit.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:quotaLimit element used by the API. + * This class represents the number of bytes of storage available for + * a user. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_QuotaLimit extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'quotaLimit'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_QuotaLimit object. + * + * @param string $text (optional) The value being represented. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Rotation.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Rotation.php new file mode 100755 index 0000000..228ab1e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Rotation.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:rotation element used by the API. + * The rotation of a photo in degrees. Will only be shown if the + * rotation has not already been applied to the image. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Rotation extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'rotation'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Rotation object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Size.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Size.php new file mode 100755 index 0000000..321e6a1 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Size.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:size element used by the API. + * The size of a photo in bytes. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Size extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'size'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Size object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Thumbnail.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Thumbnail.php new file mode 100755 index 0000000..47aae50 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Thumbnail.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:thumbnail element used by the API. + * This class represents the URI for a thumbnail image. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Thumbnail extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'thumbnail'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Thumbnail object. + * + * @param string $text (optional) The thumbnail URI to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Timestamp.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Timestamp.php new file mode 100755 index 0000000..e1c43ba --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Timestamp.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:timestamp element used by the API. + * The timestamp of a photo in milliseconds since January 1, 1970. + * This date is either set externally or based on EXIF data. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Timestamp extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'timestamp'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Timestamp object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/User.php b/applications/core/lib/Zend/Gdata/Photos/Extension/User.php new file mode 100755 index 0000000..5967671 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/User.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:user element used by the API. + * This class represents the username for a user. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_User extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'user'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_User object. + * + * @param string $text (optional) The username to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Version.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Version.php new file mode 100755 index 0000000..cfb6013 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Version.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:version element used by the API. + * This number is used for optimistic concurrency, and does not + * increase linearly. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Version extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'version'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Version object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Weight.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Weight.php new file mode 100755 index 0000000..fbdb72e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Weight.php @@ -0,0 +1,62 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:weight element used by the API. + * This indicates the weight of a tag, based on the number of times + * it appears in photos under the current element. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Weight extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'weight'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Weight object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/Extension/Width.php b/applications/core/lib/Zend/Gdata/Photos/Extension/Width.php new file mode 100755 index 0000000..80bc235 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/Extension/Width.php @@ -0,0 +1,61 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * Represents the gphoto:width element used by the API. + * This indicates the width of a photo in pixels. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_Extension_Width extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gphoto'; + protected $_rootElement = 'width'; + + /** + * Constructs a new Zend_Gdata_Photos_Extension_Width object. + * + * @param string $text (optional) The value to represent. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct(); + $this->setText($text); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/PhotoEntry.php b/applications/core/lib/Zend/Gdata/Photos/PhotoEntry.php new file mode 100755 index 0000000..c990a7f --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/PhotoEntry.php @@ -0,0 +1,690 @@ +<?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 Photos + * @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_MediaEntry + */ +require_once 'Zend/Gdata/Media/Entry.php'; + +/** + * @see Zend_Gdata_Photos_Extension_PhotoId + */ +require_once 'Zend/Gdata/Photos/Extension/PhotoId.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Version + */ +require_once 'Zend/Gdata/Photos/Extension/Version.php'; + +/** + * @see Zend_Gdata_Photos_Extension_AlbumId + */ +require_once 'Zend/Gdata/Photos/Extension/AlbumId.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Id + */ +require_once 'Zend/Gdata/Photos/Extension/Id.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Width + */ +require_once 'Zend/Gdata/Photos/Extension/Width.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Height + */ +require_once 'Zend/Gdata/Photos/Extension/Height.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Size + */ +require_once 'Zend/Gdata/Photos/Extension/Size.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Client + */ +require_once 'Zend/Gdata/Photos/Extension/Client.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Checksum + */ +require_once 'Zend/Gdata/Photos/Extension/Checksum.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Timestamp + */ +require_once 'Zend/Gdata/Photos/Extension/Timestamp.php'; + +/** + * @see Zend_Gdata_Photos_Extension_CommentingEnabled + */ +require_once 'Zend/Gdata/Photos/Extension/CommentingEnabled.php'; + +/** + * @see Zend_Gdata_Photos_Extension_CommentCount + */ +require_once 'Zend/Gdata/Photos/Extension/CommentCount.php'; + +/** + * @see Zend_Gdata_Exif_Extension_Tags + */ +require_once 'Zend/Gdata/Exif/Extension/Tags.php'; + +/** + * @see Zend_Gdata_Geo_Extension_GeoRssWhere + */ +require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php'; + +/** + * @see Zend_Gdata_App_Extension_Category + */ +require_once 'Zend/Gdata/App/Extension/Category.php'; + +/** + * Data model class for a Comment Entry. + * + * To transfer user entries to and from the servers, including + * creating new entries, refer to the service class, + * Zend_Gdata_Photos. + * + * This class represents <atom:entry> in the Google Data protocol. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_PhotoEntry extends Zend_Gdata_Media_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Photos_PhotoEntry'; + + /** + * gphoto:id element + * + * @var Zend_Gdata_Photos_Extension_Id + */ + protected $_gphotoId = null; + + /** + * gphoto:albumid element + * + * @var Zend_Gdata_Photos_Extension_AlbumId + */ + protected $_gphotoAlbumId = null; + + /** + * gphoto:version element + * + * @var Zend_Gdata_Photos_Extension_Version + */ + protected $_gphotoVersion = null; + + /** + * gphoto:width element + * + * @var Zend_Gdata_Photos_Extension_Width + */ + protected $_gphotoWidth = null; + + /** + * gphoto:height element + * + * @var Zend_Gdata_Photos_Extension_Height + */ + protected $_gphotoHeight = null; + + /** + * gphoto:size element + * + * @var Zend_Gdata_Photos_Extension_Size + */ + protected $_gphotoSize = null; + + /** + * gphoto:client element + * + * @var Zend_Gdata_Photos_Extension_Client + */ + protected $_gphotoClient = null; + + /** + * gphoto:checksum element + * + * @var Zend_Gdata_Photos_Extension_Checksum + */ + protected $_gphotoChecksum = null; + + /** + * gphoto:timestamp element + * + * @var Zend_Gdata_Photos_Extension_Timestamp + */ + protected $_gphotoTimestamp = null; + + /** + * gphoto:commentCount element + * + * @var Zend_Gdata_Photos_Extension_CommentCount + */ + protected $_gphotoCommentCount = null; + + /** + * gphoto:commentingEnabled element + * + * @var Zend_Gdata_Photos_Extension_CommentingEnabled + */ + protected $_gphotoCommentingEnabled = null; + + /** + * exif:tags element + * + * @var Zend_Gdata_Exif_Extension_Tags + */ + protected $_exifTags = null; + + /** + * georss:where element + * + * @var Zend_Gdata_Geo_Extension_GeoRssWhere + */ + protected $_geoRssWhere = null; + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct($element); + + $category = new Zend_Gdata_App_Extension_Category( + 'http://schemas.google.com/photos/2007#photo', + 'http://schemas.google.com/g/2005#kind'); + $this->setCategory(array($category)); + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_gphotoAlbumId !== null) { + $element->appendChild($this->_gphotoAlbumId->getDOM($element->ownerDocument)); + } + if ($this->_gphotoId !== null) { + $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); + } + if ($this->_gphotoVersion !== null) { + $element->appendChild($this->_gphotoVersion->getDOM($element->ownerDocument)); + } + if ($this->_gphotoWidth !== null) { + $element->appendChild($this->_gphotoWidth->getDOM($element->ownerDocument)); + } + if ($this->_gphotoHeight !== null) { + $element->appendChild($this->_gphotoHeight->getDOM($element->ownerDocument)); + } + if ($this->_gphotoSize !== null) { + $element->appendChild($this->_gphotoSize->getDOM($element->ownerDocument)); + } + if ($this->_gphotoClient !== null) { + $element->appendChild($this->_gphotoClient->getDOM($element->ownerDocument)); + } + if ($this->_gphotoChecksum !== null) { + $element->appendChild($this->_gphotoChecksum->getDOM($element->ownerDocument)); + } + if ($this->_gphotoTimestamp !== null) { + $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument)); + } + if ($this->_gphotoCommentingEnabled !== null) { + $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument)); + } + if ($this->_gphotoCommentCount !== null) { + $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument)); + } + if ($this->_exifTags !== null) { + $element->appendChild($this->_exifTags->getDOM($element->ownerDocument)); + } + if ($this->_geoRssWhere !== null) { + $element->appendChild($this->_geoRssWhere->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('gphoto') . ':' . 'albumid'; + $albumId = new Zend_Gdata_Photos_Extension_AlbumId(); + $albumId->transferFromDOM($child); + $this->_gphotoAlbumId = $albumId; + break; + case $this->lookupNamespace('gphoto') . ':' . 'id'; + $id = new Zend_Gdata_Photos_Extension_Id(); + $id->transferFromDOM($child); + $this->_gphotoId = $id; + break; + case $this->lookupNamespace('gphoto') . ':' . 'version'; + $version = new Zend_Gdata_Photos_Extension_Version(); + $version->transferFromDOM($child); + $this->_gphotoVersion = $version; + break; + case $this->lookupNamespace('gphoto') . ':' . 'width'; + $width = new Zend_Gdata_Photos_Extension_Width(); + $width->transferFromDOM($child); + $this->_gphotoWidth = $width; + break; + case $this->lookupNamespace('gphoto') . ':' . 'height'; + $height = new Zend_Gdata_Photos_Extension_Height(); + $height->transferFromDOM($child); + $this->_gphotoHeight = $height; + break; + case $this->lookupNamespace('gphoto') . ':' . 'size'; + $size = new Zend_Gdata_Photos_Extension_Size(); + $size->transferFromDOM($child); + $this->_gphotoSize = $size; + break; + case $this->lookupNamespace('gphoto') . ':' . 'client'; + $client = new Zend_Gdata_Photos_Extension_Client(); + $client->transferFromDOM($child); + $this->_gphotoClient = $client; + break; + case $this->lookupNamespace('gphoto') . ':' . 'checksum'; + $checksum = new Zend_Gdata_Photos_Extension_Checksum(); + $checksum->transferFromDOM($child); + $this->_gphotoChecksum = $checksum; + break; + case $this->lookupNamespace('gphoto') . ':' . 'timestamp'; + $timestamp = new Zend_Gdata_Photos_Extension_Timestamp(); + $timestamp->transferFromDOM($child); + $this->_gphotoTimestamp = $timestamp; + break; + case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled'; + $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled(); + $commentingEnabled->transferFromDOM($child); + $this->_gphotoCommentingEnabled = $commentingEnabled; + break; + case $this->lookupNamespace('gphoto') . ':' . 'commentCount'; + $commentCount = new Zend_Gdata_Photos_Extension_CommentCount(); + $commentCount->transferFromDOM($child); + $this->_gphotoCommentCount = $commentCount; + break; + case $this->lookupNamespace('exif') . ':' . 'tags'; + $exifTags = new Zend_Gdata_Exif_Extension_Tags(); + $exifTags->transferFromDOM($child); + $this->_exifTags = $exifTags; + break; + case $this->lookupNamespace('georss') . ':' . 'where'; + $geoRssWhere = new Zend_Gdata_Geo_Extension_GeoRssWhere(); + $geoRssWhere->transferFromDOM($child); + $this->_geoRssWhere = $geoRssWhere; + break; + default: + parent::takeChildFromDOM($child); + break; + + } + } + + /** + * Get the value for this element's gphoto:albumid attribute. + * + * @see setGphotoAlbumId + * @return string The requested attribute. + */ + public function getGphotoAlbumId() + { + return $this->_gphotoAlbumId; + } + + /** + * Set the value for this element's gphoto:albumid attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_AlbumId The element being modified. + */ + public function setGphotoAlbumId($value) + { + $this->_gphotoAlbumId = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:id attribute. + * + * @see setGphotoId + * @return string The requested attribute. + */ + public function getGphotoId() + { + return $this->_gphotoId; + } + + /** + * Set the value for this element's gphoto:id attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Id The element being modified. + */ + public function setGphotoId($value) + { + $this->_gphotoId = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:version attribute. + * + * @see setGphotoVersion + * @return string The requested attribute. + */ + public function getGphotoVersion() + { + return $this->_gphotoVersion; + } + + /** + * Set the value for this element's gphoto:version attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Version The element being modified. + */ + public function setGphotoVersion($value) + { + $this->_gphotoVersion = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:width attribute. + * + * @see setGphotoWidth + * @return string The requested attribute. + */ + public function getGphotoWidth() + { + return $this->_gphotoWidth; + } + + /** + * Set the value for this element's gphoto:width attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Width The element being modified. + */ + public function setGphotoWidth($value) + { + $this->_gphotoWidth = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:height attribute. + * + * @see setGphotoHeight + * @return string The requested attribute. + */ + public function getGphotoHeight() + { + return $this->_gphotoHeight; + } + + /** + * Set the value for this element's gphoto:height attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Height The element being modified. + */ + public function setGphotoHeight($value) + { + $this->_gphotoHeight = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:size attribute. + * + * @see setGphotoSize + * @return string The requested attribute. + */ + public function getGphotoSize() + { + return $this->_gphotoSize; + } + + /** + * Set the value for this element's gphoto:size attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Size The element being modified. + */ + public function setGphotoSize($value) + { + $this->_gphotoSize = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:client attribute. + * + * @see setGphotoClient + * @return string The requested attribute. + */ + public function getGphotoClient() + { + return $this->_gphotoClient; + } + + /** + * Set the value for this element's gphoto:client attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Client The element being modified. + */ + public function setGphotoClient($value) + { + $this->_gphotoClient = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:checksum attribute. + * + * @see setGphotoChecksum + * @return string The requested attribute. + */ + public function getGphotoChecksum() + { + return $this->_gphotoChecksum; + } + + /** + * Set the value for this element's gphoto:checksum attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Checksum The element being modified. + */ + public function setGphotoChecksum($value) + { + $this->_gphotoChecksum = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:timestamp attribute. + * + * @see setGphotoTimestamp + * @return string The requested attribute. + */ + public function getGphotoTimestamp() + { + return $this->_gphotoTimestamp; + } + + /** + * Set the value for this element's gphoto:timestamp attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified. + */ + public function setGphotoTimestamp($value) + { + $this->_gphotoTimestamp = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:commentCount attribute. + * + * @see setGphotoCommentCount + * @return string The requested attribute. + */ + public function getGphotoCommentCount() + { + return $this->_gphotoCommentCount; + } + + /** + * Set the value for this element's gphoto:commentCount attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified. + */ + public function setGphotoCommentCount($value) + { + $this->_gphotoCommentCount = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:commentingEnabled attribute. + * + * @see setGphotoCommentingEnabled + * @return string The requested attribute. + */ + public function getGphotoCommentingEnabled() + { + return $this->_gphotoCommentingEnabled; + } + + /** + * Set the value for this element's gphoto:commentingEnabled attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified. + */ + public function setGphotoCommentingEnabled($value) + { + $this->_gphotoCommentingEnabled = $value; + return $this; + } + + /** + * Get the value for this element's exif:tags attribute. + * + * @see setExifTags + * @return string The requested attribute. + */ + public function getExifTags() + { + return $this->_exifTags; + } + + /** + * Set the value for this element's exif:tags attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Exif_Extension_Tags The element being modified. + */ + public function setExifTags($value) + { + $this->_exifTags = $value; + return $this; + } + + /** + * Get the value for this element's georss:where attribute. + * + * @see setGeoRssWhere + * @return string The requested attribute. + */ + public function getGeoRssWhere() + { + return $this->_geoRssWhere; + } + + /** + * Set the value for this element's georss:where attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Geo_Extension_GeoRssWhere The element being modified. + */ + public function setGeoRssWhere($value) + { + $this->_geoRssWhere = $value; + return $this; + } + + /** + * Get the value for this element's media:group attribute. + * + * @see setMediaGroup + * @return string The requested attribute. + */ + public function getMediaGroup() + { + return $this->_mediaGroup; + } + + /** + * Set the value for this element's media:group attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified. + */ + public function setMediaGroup($value) + { + $this->_mediaGroup = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/PhotoFeed.php b/applications/core/lib/Zend/Gdata/Photos/PhotoFeed.php new file mode 100755 index 0000000..440ef81 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/PhotoFeed.php @@ -0,0 +1,558 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * @see Zend_Gdata_Feed + */ +require_once 'Zend/Gdata/Feed.php'; + +/** + * @see Zend_Gdata_Photos_PhotoEntry + */ +require_once 'Zend/Gdata/Photos/PhotoEntry.php'; + +/** + * Data model for a collection of photo entries, usually + * provided by the Picasa servers. + * + * For information on requesting this feed from a server, see the + * service class, Zend_Gdata_Photos. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_PhotoFeed extends Zend_Gdata_Feed +{ + + /** + * gphoto:id element + * + * @var Zend_Gdata_Photos_Extension_Id + */ + protected $_gphotoId = null; + + /** + * gphoto:albumid element + * + * @var Zend_Gdata_Photos_Extension_AlbumId + */ + protected $_gphotoAlbumId = null; + + /** + * gphoto:version element + * + * @var Zend_Gdata_Photos_Extension_Version + */ + protected $_gphotoVersion = null; + + /** + * gphoto:width element + * + * @var Zend_Gdata_Photos_Extension_Width + */ + protected $_gphotoWidth = null; + + /** + * gphoto:height element + * + * @var Zend_Gdata_Photos_Extension_Height + */ + protected $_gphotoHeight = null; + + /** + * gphoto:size element + * + * @var Zend_Gdata_Photos_Extension_Size + */ + protected $_gphotoSize = null; + + /** + * gphoto:client element + * + * @var Zend_Gdata_Photos_Extension_Client + */ + protected $_gphotoClient = null; + + /** + * gphoto:checksum element + * + * @var Zend_Gdata_Photos_Extension_Checksum + */ + protected $_gphotoChecksum = null; + + /** + * gphoto:timestamp element + * + * @var Zend_Gdata_Photos_Extension_Timestamp + */ + protected $_gphotoTimestamp = null; + + /** + * gphoto:commentCount element + * + * @var Zend_Gdata_Photos_Extension_CommentCount + */ + protected $_gphotoCommentCount = null; + + /** + * gphoto:commentingEnabled element + * + * @var Zend_Gdata_Photos_Extension_CommentingEnabled + */ + protected $_gphotoCommentingEnabled = null; + + /** + * media:group element + * + * @var Zend_Gdata_Media_Extension_MediaGroup + */ + protected $_mediaGroup = null; + + protected $_entryClassName = 'Zend_Gdata_Photos_PhotoEntry'; + protected $_feedClassName = 'Zend_Gdata_Photos_PhotoFeed'; + + protected $_entryKindClassMapping = array( + 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', + 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry' + ); + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_gphotoId != null) { + $element->appendChild($this->_gphotoId->getDOM($element->ownerDocument)); + } + if ($this->_gphotoVersion != null) { + $element->appendChild($this->_gphotoVersion->getDOM($element->ownerDocument)); + } + if ($this->_gphotoWidth != null) { + $element->appendChild($this->_gphotoWidth->getDOM($element->ownerDocument)); + } + if ($this->_gphotoHeight != null) { + $element->appendChild($this->_gphotoHeight->getDOM($element->ownerDocument)); + } + if ($this->_gphotoSize != null) { + $element->appendChild($this->_gphotoSize->getDOM($element->ownerDocument)); + } + if ($this->_gphotoClient != null) { + $element->appendChild($this->_gphotoClient->getDOM($element->ownerDocument)); + } + if ($this->_gphotoChecksum != null) { + $element->appendChild($this->_gphotoChecksum->getDOM($element->ownerDocument)); + } + if ($this->_gphotoTimestamp != null) { + $element->appendChild($this->_gphotoTimestamp->getDOM($element->ownerDocument)); + } + if ($this->_gphotoCommentingEnabled != null) { + $element->appendChild($this->_gphotoCommentingEnabled->getDOM($element->ownerDocument)); + } + if ($this->_gphotoCommentCount != null) { + $element->appendChild($this->_gphotoCommentCount->getDOM($element->ownerDocument)); + } + if ($this->_mediaGroup != null) { + $element->appendChild($this->_mediaGroup->getDOM($element->ownerDocument)); + } + + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + + switch ($absoluteNodeName) { + case $this->lookupNamespace('gphoto') . ':' . 'id'; + $id = new Zend_Gdata_Photos_Extension_Id(); + $id->transferFromDOM($child); + $this->_gphotoId = $id; + break; + case $this->lookupNamespace('gphoto') . ':' . 'version'; + $version = new Zend_Gdata_Photos_Extension_Version(); + $version->transferFromDOM($child); + $this->_gphotoVersion = $version; + break; + case $this->lookupNamespace('gphoto') . ':' . 'albumid'; + $albumid = new Zend_Gdata_Photos_Extension_AlbumId(); + $albumid->transferFromDOM($child); + $this->_gphotoAlbumId = $albumid; + break; + case $this->lookupNamespace('gphoto') . ':' . 'width'; + $width = new Zend_Gdata_Photos_Extension_Width(); + $width->transferFromDOM($child); + $this->_gphotoWidth = $width; + break; + case $this->lookupNamespace('gphoto') . ':' . 'height'; + $height = new Zend_Gdata_Photos_Extension_Height(); + $height->transferFromDOM($child); + $this->_gphotoHeight = $height; + break; + case $this->lookupNamespace('gphoto') . ':' . 'size'; + $size = new Zend_Gdata_Photos_Extension_Size(); + $size->transferFromDOM($child); + $this->_gphotoSize = $size; + break; + case $this->lookupNamespace('gphoto') . ':' . 'client'; + $client = new Zend_Gdata_Photos_Extension_Client(); + $client->transferFromDOM($child); + $this->_gphotoClient = $client; + break; + case $this->lookupNamespace('gphoto') . ':' . 'checksum'; + $checksum = new Zend_Gdata_Photos_Extension_Checksum(); + $checksum->transferFromDOM($child); + $this->_gphotoChecksum = $checksum; + break; + case $this->lookupNamespace('gphoto') . ':' . 'timestamp'; + $timestamp = new Zend_Gdata_Photos_Extension_Timestamp(); + $timestamp->transferFromDOM($child); + $this->_gphotoTimestamp = $timestamp; + break; + case $this->lookupNamespace('gphoto') . ':' . 'commentingEnabled'; + $commentingEnabled = new Zend_Gdata_Photos_Extension_CommentingEnabled(); + $commentingEnabled->transferFromDOM($child); + $this->_gphotoCommentingEnabled = $commentingEnabled; + break; + case $this->lookupNamespace('gphoto') . ':' . 'commentCount'; + $commentCount = new Zend_Gdata_Photos_Extension_CommentCount(); + $commentCount->transferFromDOM($child); + $this->_gphotoCommentCount = $commentCount; + break; + case $this->lookupNamespace('media') . ':' . 'group'; + $mediaGroup = new Zend_Gdata_Media_Extension_MediaGroup(); + $mediaGroup->transferFromDOM($child); + $this->_mediaGroup = $mediaGroup; + break; + case $this->lookupNamespace('atom') . ':' . 'entry': + $entryClassName = $this->_entryClassName; + $tmpEntry = new Zend_Gdata_App_Entry($child); + $categories = $tmpEntry->getCategory(); + foreach ($categories as $category) { + if ($category->scheme == Zend_Gdata_Photos::KIND_PATH && + $this->_entryKindClassMapping[$category->term] != "") { + $entryClassName = $this->_entryKindClassMapping[$category->term]; + break; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.'); + } + } + + $newEntry = new $entryClassName($child); + $newEntry->setHttpClient($this->getHttpClient()); + $this->_entry[] = $newEntry; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value for this element's gphoto:id attribute. + * + * @see setGphotoId + * @return string The requested attribute. + */ + public function getGphotoId() + { + return $this->_gphotoId; + } + + /** + * Set the value for this element's gphoto:id attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Id The element being modified. + */ + public function setGphotoId($value) + { + $this->_gphotoId = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:version attribute. + * + * @see setGphotoVersion + * @return string The requested attribute. + */ + public function getGphotoVersion() + { + return $this->_gphotoVersion; + } + + /** + * Set the value for this element's gphoto:version attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Version The element being modified. + */ + public function setGphotoVersion($value) + { + $this->_gphotoVersion = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:albumid attribute. + * + * @see setGphotoAlbumId + * @return string The requested attribute. + */ + public function getGphotoAlbumId() + { + return $this->_gphotoAlbumId; + } + + /** + * Set the value for this element's gphoto:albumid attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_AlbumId The element being modified. + */ + public function setGphotoAlbumId($value) + { + $this->_gphotoAlbumId = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:width attribute. + * + * @see setGphotoWidth + * @return string The requested attribute. + */ + public function getGphotoWidth() + { + return $this->_gphotoWidth; + } + + /** + * Set the value for this element's gphoto:width attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Width The element being modified. + */ + public function setGphotoWidth($value) + { + $this->_gphotoWidth = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:height attribute. + * + * @see setGphotoHeight + * @return string The requested attribute. + */ + public function getGphotoHeight() + { + return $this->_gphotoHeight; + } + + /** + * Set the value for this element's gphoto:height attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Height The element being modified. + */ + public function setGphotoHeight($value) + { + $this->_gphotoHeight = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:size attribute. + * + * @see setGphotoSize + * @return string The requested attribute. + */ + public function getGphotoSize() + { + return $this->_gphotoSize; + } + + /** + * Set the value for this element's gphoto:size attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Size The element being modified. + */ + public function setGphotoSize($value) + { + $this->_gphotoSize = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:client attribute. + * + * @see setGphotoClient + * @return string The requested attribute. + */ + public function getGphotoClient() + { + return $this->_gphotoClient; + } + + /** + * Set the value for this element's gphoto:client attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Client The element being modified. + */ + public function setGphotoClient($value) + { + $this->_gphotoClient = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:checksum attribute. + * + * @see setGphotoChecksum + * @return string The requested attribute. + */ + public function getGphotoChecksum() + { + return $this->_gphotoChecksum; + } + + /** + * Set the value for this element's gphoto:checksum attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Checksum The element being modified. + */ + public function setGphotoChecksum($value) + { + $this->_gphotoChecksum = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:timestamp attribute. + * + * @see setGphotoTimestamp + * @return string The requested attribute. + */ + public function getGphotoTimestamp() + { + return $this->_gphotoTimestamp; + } + + /** + * Set the value for this element's gphoto:timestamp attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Timestamp The element being modified. + */ + public function setGphotoTimestamp($value) + { + $this->_gphotoTimestamp = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:commentCount attribute. + * + * @see setGphotoCommentCount + * @return string The requested attribute. + */ + public function getGphotoCommentCount() + { + return $this->_gphotoCommentCount; + } + + /** + * Set the value for this element's gphoto:commentCount attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_CommentCount The element being modified. + */ + public function setGphotoCommentCount($value) + { + $this->_gphotoCommentCount = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:commentingEnabled attribute. + * + * @see setGphotoCommentingEnabled + * @return string The requested attribute. + */ + public function getGphotoCommentingEnabled() + { + return $this->_gphotoCommentingEnabled; + } + + /** + * Set the value for this element's gphoto:commentingEnabled attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_CommentingEnabled The element being modified. + */ + public function setGphotoCommentingEnabled($value) + { + $this->_gphotoCommentingEnabled = $value; + return $this; + } + + /** + * Get the value for this element's media:group attribute. + * + * @see setMediaGroup + * @return string The requested attribute. + */ + public function getMediaGroup() + { + return $this->_mediaGroup; + } + + /** + * Set the value for this element's media:group attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Media_Extension_MediaGroup The element being modified. + */ + public function setMediaGroup($value) + { + $this->_mediaGroup = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/PhotoQuery.php b/applications/core/lib/Zend/Gdata/Photos/PhotoQuery.php new file mode 100755 index 0000000..dbb2682 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/PhotoQuery.php @@ -0,0 +1,97 @@ +<?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 Photos + * @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_Gapps_Picasa_AlbumQuery + */ +require_once('Zend/Gdata/Photos/AlbumQuery.php'); + +/** + * Assists in constructing queries for comment/tag entries. + * Instances of this class can be provided in many places where a URL is + * required. + * + * For information on submitting queries to a server, see the + * service class, Zend_Gdata_Photos. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_PhotoQuery extends Zend_Gdata_Photos_AlbumQuery +{ + + /** + * The ID of the photo to query for. + * + * @var string + */ + protected $_photoId = null; + + /** + * Set the photo ID to query for. When set, this photo's comments/tags + * will be returned. If not set or null, the default user's feed will be + * returned instead. + * + * @param string $value The ID of the photo to retrieve, or null to + * clear. + */ + public function setPhotoId($value) + { + $this->_photoId = $value; + } + + /** + * Get the photo ID which is to be returned. + * + * @see setPhoto + * @return string The ID of the photo to retrieve. + */ + public function getPhotoId() + { + return $this->_photoId; + } + + /** + * Returns the URL generated for this query, based on it's current + * parameters. + * + * @return string A URL generated based on the state of this query. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function getQueryUrl($incomingUri = '') + { + $uri = ''; + if ($this->getPhotoId() !== null) { + $uri .= '/photoid/' . $this->getPhotoId(); + } else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'PhotoId cannot be null'); + } + $uri .= $incomingUri; + return parent::getQueryUrl($uri); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/TagEntry.php b/applications/core/lib/Zend/Gdata/Photos/TagEntry.php new file mode 100755 index 0000000..f703d47 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/TagEntry.php @@ -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 + * @subpackage Photos + * @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_Photos_Extension_Weight + */ +require_once 'Zend/Gdata/Photos/Extension/Weight.php'; + +/** + * @see Zend_Gdata_App_Extension_Category + */ +require_once 'Zend/Gdata/App/Extension/Category.php'; + +/** + * Data model class for a Tag Entry. + * + * To transfer user entries to and from the servers, including + * creating new entries, refer to the service class, + * Zend_Gdata_Photos. + * + * This class represents <atom:entry> in the Google Data protocol. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_TagEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Photos_TagEntry'; + + protected $_gphotoWeight = null; + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct($element); + + $category = new Zend_Gdata_App_Extension_Category( + 'http://schemas.google.com/photos/2007#tag', + 'http://schemas.google.com/g/2005#kind'); + $this->setCategory(array($category)); + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_gphotoWeight !== null) { + $element->appendChild($this->_gphotoWeight->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('gphoto') . ':' . 'weight'; + $weight = new Zend_Gdata_Photos_Extension_Weight(); + $weight->transferFromDOM($child); + $this->_gphotoWeight = $weight; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value for this element's gphoto:weight attribute. + * + * @see setGphotoWeight + * @return string The requested attribute. + */ + public function getGphotoWeight() + { + return $this->_gphotoWeight; + } + + /** + * Set the value for this element's gphoto:weight attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Weight The element being modified. + */ + public function setGphotoWeight($value) + { + $this->_gphotoWeight = $value; + return $this; + } +} diff --git a/applications/core/lib/Zend/Gdata/Photos/UserEntry.php b/applications/core/lib/Zend/Gdata/Photos/UserEntry.php new file mode 100755 index 0000000..855bd4c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/UserEntry.php @@ -0,0 +1,365 @@ +<?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 Photos + * @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_Gapps + */ +require_once 'Zend/Gdata/Gapps.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Nickname + */ +require_once 'Zend/Gdata/Photos/Extension/Nickname.php'; + +/** + * @see Zend_Gdata_Photos_Extension_Thumbnail + */ +require_once 'Zend/Gdata/Photos/Extension/Thumbnail.php'; + +/** + * @see Zend_Gdata_Photos_Extension_QuotaCurrent + */ +require_once 'Zend/Gdata/Photos/Extension/QuotaCurrent.php'; + +/** + * @see Zend_Gdata_Photos_Extension_QuotaLimit + */ +require_once 'Zend/Gdata/Photos/Extension/QuotaLimit.php'; + +/** + * @see Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum + */ +require_once 'Zend/Gdata/Photos/Extension/MaxPhotosPerAlbum.php'; + +/** + * @see Zend_Gdata_Photos_Extension_User + */ +require_once 'Zend/Gdata/Photos/Extension/User.php'; + +/** + * @see Zend_Gdata_App_Extension_Category + */ +require_once 'Zend/Gdata/App/Extension/Category.php'; + +/** + * Data model class for a User Entry. + * + * To transfer user entries to and from the servers, including + * creating new entries, refer to the service class, + * Zend_Gdata_Photos. + * + * This class represents <atom:entry> in the Google Data protocol. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_UserEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Photos_UserEntry'; + + /** + * gphoto:nickname element + * + * @var Zend_Gdata_Photos_Extension_Nickname + */ + protected $_gphotoNickname = null; + + /** + * gphoto:user element + * + * @var Zend_Gdata_Photos_Extension_User + */ + protected $_gphotoUser = null; + + /** + * gphoto:thumbnail element + * + * @var Zend_Gdata_Photos_Extension_Thumbnail + */ + protected $_gphotoThumbnail = null; + + /** + * gphoto:quotalimit element + * + * @var Zend_Gdata_Photos_Extension_QuotaLimit + */ + protected $_gphotoQuotaLimit = null; + + /** + * gphoto:quotacurrent element + * + * @var Zend_Gdata_Photos_Extension_QuotaCurrent + */ + protected $_gphotoQuotaCurrent = null; + + /** + * gphoto:maxPhotosPerAlbum element + * + * @var Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum + */ + protected $_gphotoMaxPhotosPerAlbum = null; + + /** + * Create a new instance. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct($element); + + $category = new Zend_Gdata_App_Extension_Category( + 'http://schemas.google.com/photos/2007#user', + 'http://schemas.google.com/g/2005#kind'); + $this->setCategory(array($category)); + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_gphotoNickname !== null) { + $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); + } + if ($this->_gphotoThumbnail !== null) { + $element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument)); + } + if ($this->_gphotoUser !== null) { + $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); + } + if ($this->_gphotoQuotaCurrent !== null) { + $element->appendChild($this->_gphotoQuotaCurrent->getDOM($element->ownerDocument)); + } + if ($this->_gphotoQuotaLimit !== null) { + $element->appendChild($this->_gphotoQuotaLimit->getDOM($element->ownerDocument)); + } + if ($this->_gphotoMaxPhotosPerAlbum !== null) { + $element->appendChild($this->_gphotoMaxPhotosPerAlbum->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('gphoto') . ':' . 'nickname'; + $nickname = new Zend_Gdata_Photos_Extension_Nickname(); + $nickname->transferFromDOM($child); + $this->_gphotoNickname = $nickname; + break; + case $this->lookupNamespace('gphoto') . ':' . 'thumbnail'; + $thumbnail = new Zend_Gdata_Photos_Extension_Thumbnail(); + $thumbnail->transferFromDOM($child); + $this->_gphotoThumbnail = $thumbnail; + break; + case $this->lookupNamespace('gphoto') . ':' . 'user'; + $user = new Zend_Gdata_Photos_Extension_User(); + $user->transferFromDOM($child); + $this->_gphotoUser = $user; + break; + case $this->lookupNamespace('gphoto') . ':' . 'quotacurrent'; + $quotaCurrent = new Zend_Gdata_Photos_Extension_QuotaCurrent(); + $quotaCurrent->transferFromDOM($child); + $this->_gphotoQuotaCurrent = $quotaCurrent; + break; + case $this->lookupNamespace('gphoto') . ':' . 'quotalimit'; + $quotaLimit = new Zend_Gdata_Photos_Extension_QuotaLimit(); + $quotaLimit->transferFromDOM($child); + $this->_gphotoQuotaLimit = $quotaLimit; + break; + case $this->lookupNamespace('gphoto') . ':' . 'maxPhotosPerAlbum'; + $maxPhotosPerAlbum = new Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum(); + $maxPhotosPerAlbum->transferFromDOM($child); + $this->_gphotoMaxPhotosPerAlbum = $maxPhotosPerAlbum; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value for this element's gphoto:nickname attribute. + * + * @see setGphotoNickname + * @return string The requested attribute. + */ + public function getGphotoNickname() + { + return $this->_gphotoNickname; + } + + /** + * Set the value for this element's gphoto:nickname attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Nickname The element being modified. + */ + public function setGphotoNickname($value) + { + $this->_gphotoNickname = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:thumbnail attribute. + * + * @see setGphotoThumbnail + * @return string The requested attribute. + */ + public function getGphotoThumbnail() + { + return $this->_gphotoThumbnail; + } + + /** + * Set the value for this element's gphoto:thumbnail attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Thumbnail The element being modified. + */ + public function setGphotoThumbnail($value) + { + $this->_gphotoThumbnail = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:quotacurrent attribute. + * + * @see setGphotoQuotaCurrent + * @return string The requested attribute. + */ + public function getGphotoQuotaCurrent() + { + return $this->_gphotoQuotaCurrent; + } + + /** + * Set the value for this element's gphoto:quotacurrent attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_QuotaCurrent The element being modified. + */ + public function setGphotoQuotaCurrent($value) + { + $this->_gphotoQuotaCurrent = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:quotalimit attribute. + * + * @see setGphotoQuotaLimit + * @return string The requested attribute. + */ + public function getGphotoQuotaLimit() + { + return $this->_gphotoQuotaLimit; + } + + /** + * Set the value for this element's gphoto:quotalimit attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_QuotaLimit The element being modified. + */ + public function setGphotoQuotaLimit($value) + { + $this->_gphotoQuotaLimit = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:maxPhotosPerAlbum attribute. + * + * @see setGphotoMaxPhotosPerAlbum + * @return string The requested attribute. + */ + public function getGphotoMaxPhotosPerAlbum() + { + return $this->_gphotoMaxPhotosPerAlbum; + } + + /** + * Set the value for this element's gphoto:maxPhotosPerAlbum attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_MaxPhotosPerAlbum The element being modified. + */ + public function setGphotoMaxPhotosPerAlbum($value) + { + $this->_gphotoMaxPhotosPerAlbum = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:user attribute. + * + * @see setGphotoUser + * @return string The requested attribute. + */ + public function getGphotoUser() + { + return $this->_gphotoUser; + } + + /** + * Set the value for this element's gphoto:user attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_User The element being modified. + */ + public function setGphotoUser($value) + { + $this->_gphotoUser = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/UserFeed.php b/applications/core/lib/Zend/Gdata/Photos/UserFeed.php new file mode 100755 index 0000000..3d74235 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/UserFeed.php @@ -0,0 +1,246 @@ +<?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 Photos + * @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_Photos + */ +require_once 'Zend/Gdata/Photos.php'; + +/** + * @see Zend_Gdata_Feed + */ +require_once 'Zend/Gdata/Feed.php'; + +/** + * @see Zend_Gdata_Photos_UserEntry + */ +require_once 'Zend/Gdata/Photos/UserEntry.php'; + +/** + * @see Zend_Gdata_Photos_AlbumEntry + */ +require_once 'Zend/Gdata/Photos/AlbumEntry.php'; + +/** + * @see Zend_Gdata_Photos_PhotoEntry + */ +require_once 'Zend/Gdata/Photos/PhotoEntry.php'; + +/** + * @see Zend_Gdata_Photos_TagEntry + */ +require_once 'Zend/Gdata/Photos/TagEntry.php'; + +/** + * @see Zend_Gdata_Photos_CommentEntry + */ +require_once 'Zend/Gdata/Photos/CommentEntry.php'; + +/** + * Data model for a collection of entries for a specific user, usually + * provided by the servers. + * + * For information on requesting this feed from a server, see the + * service class, Zend_Gdata_Photos. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_UserFeed extends Zend_Gdata_Feed +{ + + /** + * gphoto:user element + * + * @var Zend_Gdata_Photos_Extension_User + */ + protected $_gphotoUser = null; + + /** + * gphoto:thumbnail element + * + * @var Zend_Gdata_Photos_Extension_Thumbnail + */ + protected $_gphotoThumbnail = null; + + /** + * gphoto:nickname element + * + * @var Zend_Gdata_Photos_Extension_Nickname + */ + protected $_gphotoNickname = null; + + protected $_entryClassName = 'Zend_Gdata_Photos_UserEntry'; + protected $_feedClassName = 'Zend_Gdata_Photos_UserFeed'; + + protected $_entryKindClassMapping = array( + 'http://schemas.google.com/photos/2007#album' => 'Zend_Gdata_Photos_AlbumEntry', + 'http://schemas.google.com/photos/2007#photo' => 'Zend_Gdata_Photos_PhotoEntry', + 'http://schemas.google.com/photos/2007#comment' => 'Zend_Gdata_Photos_CommentEntry', + 'http://schemas.google.com/photos/2007#tag' => 'Zend_Gdata_Photos_TagEntry' + ); + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces); + parent::__construct($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('gphoto') . ':' . 'user'; + $user = new Zend_Gdata_Photos_Extension_User(); + $user->transferFromDOM($child); + $this->_gphotoUser = $user; + break; + case $this->lookupNamespace('gphoto') . ':' . 'nickname'; + $nickname = new Zend_Gdata_Photos_Extension_Nickname(); + $nickname->transferFromDOM($child); + $this->_gphotoNickname = $nickname; + break; + case $this->lookupNamespace('gphoto') . ':' . 'thumbnail'; + $thumbnail = new Zend_Gdata_Photos_Extension_Thumbnail(); + $thumbnail->transferFromDOM($child); + $this->_gphotoThumbnail = $thumbnail; + break; + case $this->lookupNamespace('atom') . ':' . 'entry': + $entryClassName = $this->_entryClassName; + $tmpEntry = new Zend_Gdata_App_Entry($child); + $categories = $tmpEntry->getCategory(); + foreach ($categories as $category) { + if ($category->scheme == Zend_Gdata_Photos::KIND_PATH && + $this->_entryKindClassMapping[$category->term] != "") { + $entryClassName = $this->_entryKindClassMapping[$category->term]; + break; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('Entry is missing kind declaration.'); + } + } + + $newEntry = new $entryClassName($child); + $newEntry->setHttpClient($this->getHttpClient()); + $this->_entry[] = $newEntry; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_gphotoUser != null) { + $element->appendChild($this->_gphotoUser->getDOM($element->ownerDocument)); + } + if ($this->_gphotoNickname != null) { + $element->appendChild($this->_gphotoNickname->getDOM($element->ownerDocument)); + } + if ($this->_gphotoThumbnail != null) { + $element->appendChild($this->_gphotoThumbnail->getDOM($element->ownerDocument)); + } + + return $element; + } + + /** + * Get the value for this element's gphoto:user attribute. + * + * @see setGphotoUser + * @return string The requested attribute. + */ + public function getGphotoUser() + { + return $this->_gphotoUser; + } + + /** + * Set the value for this element's gphoto:user attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_User The element being modified. + */ + public function setGphotoUser($value) + { + $this->_gphotoUser = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:nickname attribute. + * + * @see setGphotoNickname + * @return string The requested attribute. + */ + public function getGphotoNickname() + { + return $this->_gphotoNickname; + } + + /** + * Set the value for this element's gphoto:nickname attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Nickname The element being modified. + */ + public function setGphotoNickname($value) + { + $this->_gphotoNickname = $value; + return $this; + } + + /** + * Get the value for this element's gphoto:thumbnail attribute. + * + * @see setGphotoThumbnail + * @return string The requested attribute. + */ + public function getGphotoThumbnail() + { + return $this->_gphotoThumbnail; + } + + /** + * Set the value for this element's gphoto:thumbnail attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Photos_Extension_Thumbnail The element being modified. + */ + public function setGphotoThumbnail($value) + { + $this->_gphotoThumbnail = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Photos/UserQuery.php b/applications/core/lib/Zend/Gdata/Photos/UserQuery.php new file mode 100755 index 0000000..020b632 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Photos/UserQuery.php @@ -0,0 +1,354 @@ +<?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 Photos + * @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_Gapps_Query + */ +require_once('Zend/Gdata/Gapps/Query.php'); + +/** + * Assists in constructing queries for user entries. + * Instances of this class can be provided in many places where a URL is + * required. + * + * For information on submitting queries to a server, see the + * service class, Zend_Gdata_Photos. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Photos + * @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_Photos_UserQuery extends Zend_Gdata_Query +{ + + /** + * Indicates the format of data returned in Atom feeds. Can be either + * 'api' or 'base'. Default value is 'api'. + * + * @var string + */ + protected $_projection = 'api'; + + /** + * Indicates whether to request a feed or entry in queries. Default + * value is 'feed'; + * + * @var string + */ + protected $_type = 'feed'; + + /** + * A string which, if not null, indicates which user should + * be retrieved by this query. If null, the default user will be used + * instead. + * + * @var string + */ + protected $_user = Zend_Gdata_Photos::DEFAULT_USER; + + /** + * Create a new Query object with default values. + */ + public function __construct() + { + parent::__construct(); + } + + /** + * Set's the format of data returned in Atom feeds. Can be either + * 'api' or 'base'. Normally, 'api' will be desired. Default is 'api'. + * + * @param string $value + * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface + */ + public function setProjection($value) + { + $this->_projection = $value; + return $this; + } + + /** + * Gets the format of data in returned in Atom feeds. + * + * @see setProjection + * @return string projection + */ + public function getProjection() + { + return $this->_projection; + } + + /** + * Set's the type of data returned in queries. Can be either + * 'feed' or 'entry'. Normally, 'feed' will be desired. Default is 'feed'. + * + * @param string $value + * @return Zend_Gdata_Photos_UserQuery Provides a fluent interface + */ + public function setType($value) + { + $this->_type = $value; + return $this; + } + + /** + * Gets the type of data in returned in queries. + * + * @see setType + * @return string type + */ + public function getType() + { + return $this->_type; + } + + /** + * Set the user to query for. When set, this user's feed will be + * returned. If not set or null, the default user's feed will be returned + * instead. + * + * @param string $value The user to retrieve, or null for the default + * user. + */ + public function setUser($value) + { + if ($value !== null) { + $this->_user = $value; + } else { + $this->_user = Zend_Gdata_Photos::DEFAULT_USER; + } + } + + /** + * Get the user which is to be returned. + * + * @see setUser + * @return string The visibility to retrieve. + */ + public function getUser() + { + return $this->_user; + } + + /** + * Set the visibility filter for entries returned. Only entries which + * match this value will be returned. If null or unset, the default + * value will be used instead. + * + * Valid values are 'all' (default), 'public', and 'private'. + * + * @param string $value The visibility to filter by, or null to use the + * default value. + */ + public function setAccess($value) + { + if ($value !== null) { + $this->_params['access'] = $value; + } else { + unset($this->_params['access']); + } + } + + /** + * Get the visibility filter for entries returned. + * + * @see setAccess + * @return string The visibility to filter by, or null for the default + * user. + */ + public function getAccess() + { + return $this->_params['access']; + } + + /** + * Set the tag for entries that are returned. Only entries which + * match this value will be returned. If null or unset, this filter will + * not be applied. + * + * See http://code.google.com/apis/picasaweb/reference.html#Parameters + * for a list of valid values. + * + * @param string $value The tag to filter by, or null if no + * filter is to be applied. + */ + public function setTag($value) + { + if ($value !== null) { + $this->_params['tag'] = $value; + } else { + unset($this->_params['tag']); + } + } + + /** + * Get the tag filter for entries returned. + * + * @see setTag + * @return string The tag to filter by, or null if no filter + * is to be applied. + */ + public function getTag() + { + return $this->_params['tag']; + } + + /** + * Set the kind of entries that are returned. Only entries which + * match this value will be returned. If null or unset, this filter will + * not be applied. + * + * See http://code.google.com/apis/picasaweb/reference.html#Parameters + * for a list of valid values. + * + * @param string $value The kind to filter by, or null if no + * filter is to be applied. + */ + public function setKind($value) + { + if ($value !== null) { + $this->_params['kind'] = $value; + } else { + unset($this->_params['kind']); + } + } + + /** + * Get the kind of entries to be returned. + * + * @see setKind + * @return string The kind to filter by, or null if no filter + * is to be applied. + */ + public function getKind() + { + return $this->_params['kind']; + } + + /** + * Set the maximum image size for entries returned. Only entries which + * match this value will be returned. If null or unset, this filter will + * not be applied. + * + * See http://code.google.com/apis/picasaweb/reference.html#Parameters + * for a list of valid values. + * + * @param string $value The image size to filter by, or null if no + * filter is to be applied. + */ + public function setImgMax($value) + { + if ($value !== null) { + $this->_params['imgmax'] = $value; + } else { + unset($this->_params['imgmax']); + } + } + + /** + * Get the maximum image size filter for entries returned. + * + * @see setImgMax + * @return string The image size size to filter by, or null if no filter + * is to be applied. + */ + public function getImgMax() + { + return $this->_params['imgmax']; + } + + /** + * Set the thumbnail size filter for entries returned. Only entries which + * match this value will be returned. If null or unset, this filter will + * not be applied. + * + * See http://code.google.com/apis/picasaweb/reference.html#Parameters + * for a list of valid values. + * + * @param string $value The thumbnail size to filter by, or null if no + * filter is to be applied. + */ + public function setThumbsize($value) + { + if ($value !== null) { + $this->_params['thumbsize'] = $value; + } else { + unset($this->_params['thumbsize']); + } + } + + /** + * Get the thumbnail size filter for entries returned. + * + * @see setThumbsize + * @return string The thumbnail size to filter by, or null if no filter + * is to be applied. + */ + public function getThumbsize() + { + return $this->_params['thumbsize']; + } + + /** + * Returns the URL generated for this query, based on it's current + * parameters. + * + * @return string A URL generated based on the state of this query. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function getQueryUrl($incomingUri = null) + { + $uri = Zend_Gdata_Photos::PICASA_BASE_URI; + + if ($this->getType() !== null) { + $uri .= '/' . $this->getType(); + } else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Type must be feed or entry, not null'); + } + + if ($this->getProjection() !== null) { + $uri .= '/' . $this->getProjection(); + } else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Projection must not be null'); + } + + if ($this->getUser() !== null) { + $uri .= '/user/' . $this->getUser(); + } else { + // Should never occur due to setter behavior + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'User must not be null'); + } + + $uri .= $incomingUri; + $uri .= $this->getQueryString(); + return $uri; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Query.php b/applications/core/lib/Zend/Gdata/Query.php new file mode 100644 index 0000000..690528b --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Query.php @@ -0,0 +1,417 @@ +<?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 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_Util + */ +require_once 'Zend/Gdata/App/Util.php'; + +/** + * Provides a mechanism to build a query URL for Gdata services. + * Queries are not defined for APP, but are provided by Gdata services + * as an extension. + * + * @category Zend + * @package Zend_Gdata + * @subpackage 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_Query +{ + + /** + * Query parameters. + * + * @var array + */ + protected $_params = array(); + + /** + * Default URL + * + * @var string + */ + protected $_defaultFeedUri = null; + + /** + * Base URL + * TODO: Add setters and getters + * + * @var string + */ + protected $_url = null; + + /** + * Category for the query + * + * @var string + */ + protected $_category = null; + + /** + * Create Gdata_Query object + */ + public function __construct($url = null) + { + $this->_url = $url; + } + + /** + * @return string querystring + */ + public function getQueryString() + { + $queryArray = array(); + foreach ($this->_params as $name => $value) { + if (substr($name, 0, 1) == '_') { + continue; + } + $queryArray[] = urlencode($name) . '=' . urlencode($value); + } + if (count($queryArray) > 0) { + return '?' . implode('&', $queryArray); + } else { + return ''; + } + } + + /** + * + */ + public function resetParameters() + { + $this->_params = array(); + } + + /** + * @return string url + */ + public function getQueryUrl() + { + if ($this->_url == null) { + $url = $this->_defaultFeedUri; + } else { + $url = $this->_url; + } + if ($this->getCategory() !== null) { + $url .= '/-/' . $this->getCategory(); + } + $url .= $this->getQueryString(); + return $url; + } + + /** + * @param string $name + * @param string $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setParam($name, $value) + { + $this->_params[$name] = $value; + return $this; + } + + /** + * @param string $name + */ + public function getParam($name) + { + return $this->_params[$name]; + } + + /** + * @param string $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setAlt($value) + { + if ($value != null) { + $this->_params['alt'] = $value; + } else { + unset($this->_params['alt']); + } + return $this; + } + + /** + * @param int $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setMaxResults($value) + { + if ($value != null) { + $this->_params['max-results'] = $value; + } else { + unset($this->_params['max-results']); + } + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setQuery($value) + { + if ($value != null) { + $this->_params['q'] = $value; + } else { + unset($this->_params['q']); + } + return $this; + } + + /** + * @param int $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setStartIndex($value) + { + if ($value != null) { + $this->_params['start-index'] = $value; + } else { + unset($this->_params['start-index']); + } + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setUpdatedMax($value) + { + if ($value != null) { + $this->_params['updated-max'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['updated-max']); + } + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setUpdatedMin($value) + { + if ($value != null) { + $this->_params['updated-min'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['updated-min']); + } + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setPublishedMax($value) + { + if ($value !== null) { + $this->_params['published-max'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['published-max']); + } + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setPublishedMin($value) + { + if ($value != null) { + $this->_params['published-min'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['published-min']); + } + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setAuthor($value) + { + if ($value != null) { + $this->_params['author'] = $value; + } else { + unset($this->_params['author']); + } + return $this; + } + + /** + * @return string rss or atom + */ + public function getAlt() + { + if (array_key_exists('alt', $this->_params)) { + return $this->_params['alt']; + } else { + return null; + } + } + + /** + * @return int maxResults + */ + public function getMaxResults() + { + if (array_key_exists('max-results', $this->_params)) { + return intval($this->_params['max-results']); + } else { + return null; + } + } + + /** + * @return string query + */ + public function getQuery() + { + if (array_key_exists('q', $this->_params)) { + return $this->_params['q']; + } else { + return null; + } + } + + /** + * @return int startIndex + */ + public function getStartIndex() + { + if (array_key_exists('start-index', $this->_params)) { + return intval($this->_params['start-index']); + } else { + return null; + } + } + + /** + * @return string updatedMax + */ + public function getUpdatedMax() + { + if (array_key_exists('updated-max', $this->_params)) { + return $this->_params['updated-max']; + } else { + return null; + } + } + + /** + * @return string updatedMin + */ + public function getUpdatedMin() + { + if (array_key_exists('updated-min', $this->_params)) { + return $this->_params['updated-min']; + } else { + return null; + } + } + + /** + * @return string publishedMax + */ + public function getPublishedMax() + { + if (array_key_exists('published-max', $this->_params)) { + return $this->_params['published-max']; + } else { + return null; + } + } + + /** + * @return string publishedMin + */ + public function getPublishedMin() + { + if (array_key_exists('published-min', $this->_params)) { + return $this->_params['published-min']; + } else { + return null; + } + } + + /** + * @return string author + */ + public function getAuthor() + { + if (array_key_exists('author', $this->_params)) { + return $this->_params['author']; + } else { + return null; + } + } + + /** + * @param string $value + * @return Zend_Gdata_Query Provides a fluent interface + */ + public function setCategory($value) + { + $this->_category = $value; + return $this; + } + + /* + * @return string id + */ + public function getCategory() + { + return $this->_category; + } + + + public function __get($name) + { + $method = 'get'.ucfirst($name); + if (method_exists($this, $method)) { + return call_user_func(array(&$this, $method)); + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('Property ' . $name . ' does not exist'); + } + } + + public function __set($name, $val) + { + $method = 'set'.ucfirst($name); + if (method_exists($this, $method)) { + return call_user_func(array(&$this, $method), $val); + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('Property ' . $name . ' does not exist'); + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets.php b/applications/core/lib/Zend/Gdata/Spreadsheets.php new file mode 100644 index 0000000..08524b9 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets.php @@ -0,0 +1,444 @@ +<?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 Spreadsheets + * @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 + */ +require_once('Zend/Gdata.php'); + +/** + * Zend_Gdata_Spreadsheets_SpreadsheetFeed + */ +require_once('Zend/Gdata/Spreadsheets/SpreadsheetFeed.php'); + +/** + * Zend_Gdata_Spreadsheets_WorksheetFeed + */ +require_once('Zend/Gdata/Spreadsheets/WorksheetFeed.php'); + +/** + * Zend_Gdata_Spreadsheets_CellFeed + */ +require_once('Zend/Gdata/Spreadsheets/CellFeed.php'); + +/** + * Zend_Gdata_Spreadsheets_ListFeed + */ +require_once('Zend/Gdata/Spreadsheets/ListFeed.php'); + +/** + * Zend_Gdata_Spreadsheets_SpreadsheetEntry + */ +require_once('Zend/Gdata/Spreadsheets/SpreadsheetEntry.php'); + +/** + * Zend_Gdata_Spreadsheets_WorksheetEntry + */ +require_once('Zend/Gdata/Spreadsheets/WorksheetEntry.php'); + +/** + * Zend_Gdata_Spreadsheets_CellEntry + */ +require_once('Zend/Gdata/Spreadsheets/CellEntry.php'); + +/** + * Zend_Gdata_Spreadsheets_ListEntry + */ +require_once('Zend/Gdata/Spreadsheets/ListEntry.php'); + +/** + * Zend_Gdata_Spreadsheets_DocumentQuery + */ +require_once('Zend/Gdata/Spreadsheets/DocumentQuery.php'); + +/** + * Zend_Gdata_Spreadsheets_ListQuery + */ +require_once('Zend/Gdata/Spreadsheets/ListQuery.php'); + +/** + * Zend_Gdata_Spreadsheets_CellQuery + */ +require_once('Zend/Gdata/Spreadsheets/CellQuery.php'); + +/** + * Gdata Spreadsheets + * + * @link http://code.google.com/apis/gdata/spreadsheets.html + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets extends Zend_Gdata +{ + const SPREADSHEETS_FEED_URI = 'http://spreadsheets.google.com/feeds/spreadsheets'; + const SPREADSHEETS_POST_URI = 'http://spreadsheets.google.com/feeds/spreadsheets/private/full'; + const WORKSHEETS_FEED_LINK_URI = 'http://schemas.google.com/spreadsheets/2006#worksheetsfeed'; + const LIST_FEED_LINK_URI = 'http://schemas.google.com/spreadsheets/2006#listfeed'; + const CELL_FEED_LINK_URI = 'http://schemas.google.com/spreadsheets/2006#cellsfeed'; + const AUTH_SERVICE_NAME = 'wise'; + + /** + * Namespaces used for Zend_Gdata_Photos + * + * @var array + */ + public static $namespaces = array( + array('gs', 'http://schemas.google.com/spreadsheets/2006', 1, 0), + array( + 'gsx', 'http://schemas.google.com/spreadsheets/2006/extended', 1, 0) + ); + + /** + * Create Gdata_Spreadsheets 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_Spreadsheets'); + $this->registerPackage('Zend_Gdata_Spreadsheets_Extension'); + parent::__construct($client, $applicationId); + $this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME); + $this->_server = 'spreadsheets.google.com'; + } + + /** + * Gets a spreadsheet feed. + * + * @param mixed $location A DocumentQuery or a string URI specifying the feed location. + * @return Zend_Gdata_Spreadsheets_SpreadsheetFeed + */ + public function getSpreadsheetFeed($location = null) + { + if ($location == null) { + $uri = self::SPREADSHEETS_FEED_URI; + } else if ($location instanceof Zend_Gdata_Spreadsheets_DocumentQuery) { + if ($location->getDocumentType() == null) { + $location->setDocumentType('spreadsheets'); + } + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + + return parent::getFeed($uri, 'Zend_Gdata_Spreadsheets_SpreadsheetFeed'); + } + + /** + * Gets a spreadsheet entry. + * + * @param string $location A DocumentQuery or a URI specifying the entry location. + * @return SpreadsheetEntry + */ + public function getSpreadsheetEntry($location) + { + if ($location instanceof Zend_Gdata_Spreadsheets_DocumentQuery) { + if ($location->getDocumentType() == null) { + $location->setDocumentType('spreadsheets'); + } + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + + return parent::getEntry($uri, 'Zend_Gdata_Spreadsheets_SpreadsheetEntry'); + } + + /** + * Gets a worksheet feed. + * + * @param mixed $location A DocumentQuery, SpreadsheetEntry, or a string URI + * @return Zend_Gdata_Spreadsheets_WorksheetFeed The feed of worksheets + */ + public function getWorksheetFeed($location) + { + if ($location instanceof Zend_Gdata_Spreadsheets_DocumentQuery) { + if ($location->getDocumentType() == null) { + $location->setDocumentType('worksheets'); + } + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Spreadsheets_SpreadsheetEntry) { + $uri = $location->getLink(self::WORKSHEETS_FEED_LINK_URI)->href; + } else { + $uri = $location; + } + + return parent::getFeed($uri, 'Zend_Gdata_Spreadsheets_WorksheetFeed'); + } + + /** + * Gets a worksheet entry. + * + * @param string $location A DocumentQuery or a URI specifying the entry location. + * @return WorksheetEntry + */ + public function GetWorksheetEntry($location) + { + if ($location instanceof Zend_Gdata_Spreadsheets_DocumentQuery) { + if ($location->getDocumentType() == null) { + $location->setDocumentType('worksheets'); + } + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + + return parent::getEntry($uri, 'Zend_Gdata_Spreadsheets_WorksheetEntry'); + } + + /** + * Gets a cell feed. + * + * @param string $location A CellQuery, WorksheetEntry or a URI specifying the feed location. + * @return CellFeed + */ + public function getCellFeed($location) + { + if ($location instanceof Zend_Gdata_Spreadsheets_CellQuery) { + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Spreadsheets_WorksheetEntry) { + $uri = $location->getLink(self::CELL_FEED_LINK_URI)->href; + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_Spreadsheets_CellFeed'); + } + + /** + * Gets a cell entry. + * + * @param string $location A CellQuery or a URI specifying the entry location. + * @return CellEntry + */ + public function getCellEntry($location) + { + if ($location instanceof Zend_Gdata_Spreadsheets_CellQuery) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + + return parent::getEntry($uri, 'Zend_Gdata_Spreadsheets_CellEntry'); + } + + /** + * Gets a list feed. + * + * @param mixed $location A ListQuery, WorksheetEntry or string URI specifying the feed location. + * @return ListFeed + */ + public function getListFeed($location) + { + if ($location instanceof Zend_Gdata_Spreadsheets_ListQuery) { + $uri = $location->getQueryUrl(); + } else if ($location instanceof Zend_Gdata_Spreadsheets_WorksheetEntry) { + $uri = $location->getLink(self::LIST_FEED_LINK_URI)->href; + } else { + $uri = $location; + } + + return parent::getFeed($uri, 'Zend_Gdata_Spreadsheets_ListFeed'); + } + + /** + * Gets a list entry. + * + * @param string $location A ListQuery or a URI specifying the entry location. + * @return ListEntry + */ + public function getListEntry($location) + { + if ($location instanceof Zend_Gdata_Spreadsheets_ListQuery) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + + return parent::getEntry($uri, 'Zend_Gdata_Spreadsheets_ListEntry'); + } + + /** + * Updates an existing cell. + * + * @param int $row The row containing the cell to update + * @param int $col The column containing the cell to update + * @param int $inputValue The new value for the cell + * @param string $key The key for the spreadsheet to be updated + * @param string $wkshtId (optional) The worksheet to be updated + * @return CellEntry The updated cell entry. + */ + public function updateCell($row, $col, $inputValue, $key, $wkshtId = 'default') + { + $cell = 'R'.$row.'C'.$col; + + $query = new Zend_Gdata_Spreadsheets_CellQuery(); + $query->setSpreadsheetKey($key); + $query->setWorksheetId($wkshtId); + $query->setCellId($cell); + + $entry = $this->getCellEntry($query); + $entry->setCell(new Zend_Gdata_Spreadsheets_Extension_Cell(null, $row, $col, $inputValue)); + $response = $entry->save(); + return $response; + } + + /** + * Inserts a new row with provided data. + * + * @param array $rowData An array of column header to row data + * @param string $key The key of the spreadsheet to modify + * @param string $wkshtId (optional) The worksheet to modify + * @return ListEntry The inserted row + */ + public function insertRow($rowData, $key, $wkshtId = 'default') + { + $newEntry = new Zend_Gdata_Spreadsheets_ListEntry(); + $newCustomArr = array(); + foreach ($rowData as $k => $v) { + $newCustom = new Zend_Gdata_Spreadsheets_Extension_Custom(); + $newCustom->setText($v)->setColumnName($k); + $newEntry->addCustom($newCustom); + } + + $query = new Zend_Gdata_Spreadsheets_ListQuery(); + $query->setSpreadsheetKey($key); + $query->setWorksheetId($wkshtId); + + $feed = $this->getListFeed($query); + $editLink = $feed->getLink('http://schemas.google.com/g/2005#post'); + + return $this->insertEntry($newEntry->saveXML(), $editLink->href, 'Zend_Gdata_Spreadsheets_ListEntry'); + } + + /** + * Updates an existing row with provided data. + * + * @param ListEntry $entry The row entry to update + * @param array $newRowData An array of column header to row data + */ + public function updateRow($entry, $newRowData) + { + $newCustomArr = array(); + foreach ($newRowData as $k => $v) { + $newCustom = new Zend_Gdata_Spreadsheets_Extension_Custom(); + $newCustom->setText($v)->setColumnName($k); + $newCustomArr[] = $newCustom; + } + $entry->setCustom($newCustomArr); + + return $entry->save(); + } + + /** + * Deletes an existing row . + * + * @param ListEntry $entry The row to delete + */ + public function deleteRow($entry) + { + $entry->delete(); + } + + /** + * Returns the content of all rows as an associative array + * + * @param mixed $location A ListQuery or string URI specifying the feed location. + * @return array An array of rows. Each element of the array is an associative array of data + */ + public function getSpreadsheetListFeedContents($location) + { + $listFeed = $this->getListFeed($location); + $listFeed = $this->retrieveAllEntriesForFeed($listFeed); + $spreadsheetContents = array(); + foreach ($listFeed as $listEntry) { + $rowContents = array(); + $customArray = $listEntry->getCustom(); + foreach ($customArray as $custom) { + $rowContents[$custom->getColumnName()] = $custom->getText(); + } + $spreadsheetContents[] = $rowContents; + } + return $spreadsheetContents; + } + + /** + * Returns the content of all cells as an associative array, indexed + * off the cell location (ie 'A1', 'D4', etc). Each element of + * the array is an associative array with a 'value' and a 'function'. + * Only non-empty cells are returned by default. 'range' is the + * value of the 'range' query parameter specified at: + * http://code.google.com/apis/spreadsheets/reference.html#cells_Parameters + * + * @param mixed $location A CellQuery, WorksheetEntry or a URL (w/o query string) specifying the feed location. + * @param string $range The range of cells to retrieve + * @param boolean $empty Whether to retrieve empty cells + * @return array An associative array of cells + */ + public function getSpreadsheetCellFeedContents($location, $range = null, $empty = false) + { + $cellQuery = null; + if ($location instanceof Zend_Gdata_Spreadsheets_CellQuery) { + $cellQuery = $location; + } else if ($location instanceof Zend_Gdata_Spreadsheets_WorksheetEntry) { + $url = $location->getLink(self::CELL_FEED_LINK_URI)->href; + $cellQuery = new Zend_Gdata_Spreadsheets_CellQuery($url); + } else { + $url = $location; + $cellQuery = new Zend_Gdata_Spreadsheets_CellQuery($url); + } + + if ($range != null) { + $cellQuery->setRange($range); + } + $cellQuery->setReturnEmpty($empty); + + $cellFeed = $this->getCellFeed($cellQuery); + $cellFeed = $this->retrieveAllEntriesForFeed($cellFeed); + $spreadsheetContents = array(); + foreach ($cellFeed as $cellEntry) { + $cellContents = array(); + $cell = $cellEntry->getCell(); + $cellContents['formula'] = $cell->getInputValue(); + $cellContents['value'] = $cell->getText(); + $spreadsheetContents[$cellEntry->getTitle()->getText()] = $cellContents; + } + return $spreadsheetContents; + } + + /** + * Alias for getSpreadsheetFeed + * + * @param mixed $location A DocumentQuery or a string URI specifying the feed location. + * @return Zend_Gdata_Spreadsheets_SpreadsheetFeed + */ + public function getSpreadsheets($location = null) + { + return $this->getSpreadsheetFeed($location = null); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/CellEntry.php b/applications/core/lib/Zend/Gdata/Spreadsheets/CellEntry.php new file mode 100644 index 0000000..9b7335c --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/CellEntry.php @@ -0,0 +1,102 @@ +<?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 Spreadsheets + * @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_Spreadsheets_Extension_Cell + */ +require_once 'Zend/Gdata/Spreadsheets/Extension/Cell.php'; + +/** + * Concrete class for working with Cell entries. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_CellEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Spreadsheets_CellEntry'; + protected $_cell; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_CellEntry object. + * @param string $uri (optional) + * @param DOMElement $element (optional) The DOMElement on which to base this object. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_cell != null) { + $element->appendChild($this->_cell->getDOM($element->ownerDocument)); + } + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + switch ($absoluteNodeName) { + case $this->lookupNamespace('gs') . ':' . 'cell'; + $cell = new Zend_Gdata_Spreadsheets_Extension_Cell(); + $cell->transferFromDOM($child); + $this->_cell = $cell; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Gets the Cell element of this Cell Entry. + * @return Zend_Gdata_Spreadsheets_Extension_Cell + */ + public function getCell() + { + return $this->_cell; + } + + /** + * Sets the Cell element of this Cell Entry. + * @param $cell Zend_Gdata_Spreadsheets_Extension_Cell $cell + */ + public function setCell($cell) + { + $this->_cell = $cell; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/CellFeed.php b/applications/core/lib/Zend/Gdata/Spreadsheets/CellFeed.php new file mode 100644 index 0000000..9eb5be5 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/CellFeed.php @@ -0,0 +1,157 @@ +<?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 Spreadsheets + * @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'; + +/** + * @see Zend_Gdata_Spreadsheets_Extension_RowCount + */ +require_once 'Zend/Gdata/Spreadsheets/Extension/RowCount.php'; + +/** + * @see Zend_Gdata_Spreadsheets_Extension_ColCount + */ +require_once 'Zend/Gdata/Spreadsheets/Extension/ColCount.php'; + +/** + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_CellFeed extends Zend_Gdata_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Spreadsheets_CellEntry'; + + /** + * The classname for the feed. + * + * @var string + */ + protected $_feedClassName = 'Zend_Gdata_Spreadsheets_CellFeed'; + + /** + * The row count for the feed. + * + * @var Zend_Gdata_Spreadsheets_Extension_RowCount + */ + protected $_rowCount = null; + + /** + * The column count for the feed. + * + * @var Zend_Gdata_Spreadsheets_Extension_ColCount + */ + protected $_colCount = null; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_CellFeed object. + * @param DOMElement $element (optional) The XML Element on which to base this object. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->rowCount != null) { + $element->appendChild($this->_rowCount->getDOM($element->ownerDocument)); + } + if ($this->colCount != null) { + $element->appendChild($this->_colCount->getDOM($element->ownerDocument)); + } + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + switch ($absoluteNodeName) { + case $this->lookupNamespace('gs') . ':' . 'rowCount'; + $rowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount(); + $rowCount->transferFromDOM($child); + $this->_rowCount = $rowCount; + break; + case $this->lookupNamespace('gs') . ':' . 'colCount'; + $colCount = new Zend_Gdata_Spreadsheets_Extension_ColCount(); + $colCount->transferFromDOM($child); + $this->_colCount = $colCount; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Gets the row count for this feed. + * @return string The row count for the feed. + */ + public function getRowCount() + { + return $this->_rowCount; + } + + /** + * Gets the column count for this feed. + * @return string The column count for the feed. + */ + public function getColumnCount() + { + return $this->_colCount; + } + + /** + * Sets the row count for this feed. + * @param string $rowCount The new row count for the feed. + */ + public function setRowCount($rowCount) + { + $this->_rowCount = $rowCount; + return $this; + } + + /** + * Sets the column count for this feed. + * @param string $colCount The new column count for the feed. + */ + public function setColumnCount($colCount) + { + $this->_colCount = $colCount; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/CellQuery.php b/applications/core/lib/Zend/Gdata/Spreadsheets/CellQuery.php new file mode 100644 index 0000000..7904ee8 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/CellQuery.php @@ -0,0 +1,416 @@ +<?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 Spreadsheets + * @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_util + */ +require_once('Zend/Gdata/App/Util.php'); + +/** + * Zend_Gdata_Query + */ +require_once('Zend/Gdata/Query.php'); + +/** + * Assists in constructing queries for Google Spreadsheets cells + * + * @link http://code.google.com/apis/gdata/spreadsheets/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_CellQuery extends Zend_Gdata_Query +{ + + const SPREADSHEETS_CELL_FEED_URI = 'http://spreadsheets.google.com/feeds/cells'; + + protected $_defaultFeedUri = self::SPREADSHEETS_CELL_FEED_URI; + protected $_visibility = 'private'; + protected $_projection = 'full'; + protected $_spreadsheetKey = null; + protected $_worksheetId = 'default'; + protected $_cellId = null; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_CellQuery object. + * + * @param string $url Base URL to use for queries + */ + public function __construct($url = null) + { + parent::__construct($url); + } + + /** + * Sets the spreadsheet key for this query. + * + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setSpreadsheetKey($value) + { + $this->_spreadsheetKey = $value; + return $this; + } + + /** + * Gets the spreadsheet key for this query. + * + * @return string spreadsheet key + */ + public function getSpreadsheetKey() + { + return $this->_spreadsheetKey; + } + + /** + * Sets the worksheet id for this query. + * + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setWorksheetId($value) + { + $this->_worksheetId = $value; + return $this; + } + + /** + * Gets the worksheet id for this query. + * + * @return string worksheet id + */ + public function getWorksheetId() + { + return $this->_worksheetId; + } + + /** + * Sets the cell id for this query. + * + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setCellId($value) + { + $this->_cellId = $value; + return $this; + } + + /** + * Gets the cell id for this query. + * + * @return string cell id + */ + public function getCellId() + { + return $this->_cellId; + } + + /** + * Sets the projection for this query. + * + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setProjection($value) + { + $this->_projection = $value; + return $this; + } + + /** + * Sets the visibility for this query. + * + * @return Zend_Gdata_Spreadsheets_CellQuery 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 min-row attribute for this query. + * + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setMinRow($value) + { + if ($value != null) { + $this->_params['min-row'] = $value; + } else { + unset($this->_params['min-row']); + } + return $this; + } + + /** + * Gets the min-row attribute for this query. + * + * @return string min-row + */ + public function getMinRow() + { + if (array_key_exists('min-row', $this->_params)) { + return $this->_params['min-row']; + } else { + return null; + } + } + + /** + * Sets the max-row attribute for this query. + * + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setMaxRow($value) + { + if ($value != null) { + $this->_params['max-row'] = $value; + } else { + unset($this->_params['max-row']); + } + return $this; + } + + /** + * Gets the max-row attribute for this query. + * + * @return string max-row + */ + public function getMaxRow() + { + if (array_key_exists('max-row', $this->_params)) { + return $this->_params['max-row']; + } else { + return null; + } + } + + /** + * Sets the min-col attribute for this query. + * + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setMinCol($value) + { + if ($value != null) { + $this->_params['min-col'] = $value; + } else { + unset($this->_params['min-col']); + } + return $this; + } + + /** + * Gets the min-col attribute for this query. + * + * @return string min-col + */ + public function getMinCol() + { + if (array_key_exists('min-col', $this->_params)) { + return $this->_params['min-col']; + } else { + return null; + } + } + + /** + * Sets the max-col attribute for this query. + * + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setMaxCol($value) + { + if ($value != null) { + $this->_params['max-col'] = $value; + } else { + unset($this->_params['max-col']); + } + return $this; + } + + /** + * Gets the max-col attribute for this query. + * + * @return string max-col + */ + public function getMaxCol() + { + if (array_key_exists('max-col', $this->_params)) { + return $this->_params['max-col']; + } else { + return null; + } + } + + /** + * Sets the range attribute for this query. + * + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setRange($value) + { + if ($value != null) { + $this->_params['range'] = $value; + } else { + unset($this->_params['range']); + } + return $this; + } + + /** + * Gets the range attribute for this query. + * + * @return string range + */ + public function getRange() + { + if (array_key_exists('range', $this->_params)) { + return $this->_params['range']; + } else { + return null; + } + } + + /** + * Sets the return-empty attribute for this query. + * + * @param mixed $value String or bool value for whether to return empty cells + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setReturnEmpty($value) + { + if (is_bool($value)) { + $this->_params['return-empty'] = ($value?'true':'false'); + } else if ($value != null) { + $this->_params['return-empty'] = $value; + } else { + unset($this->_params['return-empty']); + } + return $this; + } + + /** + * Gets the return-empty attribute for this query. + * + * @return string return-empty + */ + public function getReturnEmpty() + { + if (array_key_exists('return-empty', $this->_params)) { + return $this->_params['return-empty']; + } else { + return null; + } + } + + /** + * Gets the full query URL for this query. + * + * @return string url + */ + public function getQueryUrl() + { + if ($this->_url == null) { + $uri = $this->_defaultFeedUri; + + if ($this->_spreadsheetKey != null) { + $uri .= '/'.$this->_spreadsheetKey; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for cell queries.'); + } + + if ($this->_worksheetId != null) { + $uri .= '/'.$this->_worksheetId; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('A worksheet id must be provided for cell queries.'); + } + + 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.'); + } + + if ($this->_cellId != null) { + $uri .= '/'.$this->_cellId; + } + } else { + $uri = $this->_url; + } + + $uri .= $this->getQueryString(); + return $uri; + } + + /** + * Gets the attribute query string for this query. + * + * @return string query string + */ + public function getQueryString() + { + return parent::getQueryString(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/DocumentQuery.php b/applications/core/lib/Zend/Gdata/Spreadsheets/DocumentQuery.php new file mode 100644 index 0000000..c024b16 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/DocumentQuery.php @@ -0,0 +1,287 @@ +<?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 Spreadsheets + * @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_util + */ +require_once('Zend/Gdata/App/Util.php'); + +/** + * Zend_Gdata_Query + */ +require_once('Zend/Gdata/Query.php'); + +/** + * Assists in constructing queries for Google Spreadsheets documents + * + * @link http://code.google.com/apis/gdata/spreadsheets/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_DocumentQuery extends Zend_Gdata_Query +{ + + const SPREADSHEETS_FEED_URI = 'http://spreadsheets.google.com/feeds'; + + protected $_defaultFeedUri = self::SPREADSHEETS_FEED_URI; + protected $_documentType; + protected $_visibility = 'private'; + protected $_projection = 'full'; + protected $_spreadsheetKey = null; + protected $_worksheetId = null; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_DocumentQuery object. + */ + public function __construct() + { + parent::__construct(); + } + + /** + * Sets the spreadsheet key for this query. + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setSpreadsheetKey($value) + { + $this->_spreadsheetKey = $value; + return $this; + } + + /** + * Gets the spreadsheet key for this query. + * @return string spreadsheet key + */ + public function getSpreadsheetKey() + { + return $this->_spreadsheetKey; + } + + /** + * Sets the worksheet id for this query. + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setWorksheetId($value) + { + $this->_worksheetId = $value; + return $this; + } + + /** + * Gets the worksheet id for this query. + * @return string worksheet id + */ + public function getWorksheetId() + { + return $this->_worksheetId; + } + + /** + * Sets the document type for this query. + * @param string $value spreadsheets or worksheets + * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface + */ + public function setDocumentType($value) + { + $this->_documentType = $value; + return $this; + } + + /** + * Gets the document type for this query. + * @return string document type + */ + public function getDocumentType() + { + return $this->_documentType; + } + + /** + * Sets the projection for this query. + * @param string $value + * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface + */ + public function setProjection($value) + { + $this->_projection = $value; + return $this; + } + + /** + * Sets the visibility for this query. + * @return Zend_Gdata_Spreadsheets_DocumentQuery 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. + * @param string $value + * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface + */ + public function setTitle($value) + { + if ($value != null) { + $this->_params['title'] = $value; + } else { + unset($this->_params['title']); + } + return $this; + } + + /** + * Sets the title-exact attribute for this query. + * @param string $value + * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface + */ + public function setTitleExact($value) + { + if ($value != null) { + $this->_params['title-exact'] = $value; + } else { + unset($this->_params['title-exact']); + } + 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; + } + } + + /** + * 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 null; + } + } + + private function appendVisibilityProjection() + { + $uri = ''; + + 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 document 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 document queries.'); + } + + return $uri; + } + + + /** + * Gets the full query URL for this query. + * @return string url + */ + public function getQueryUrl() + { + $uri = $this->_defaultFeedUri; + + if ($this->_documentType != null) { + $uri .= '/'.$this->_documentType; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('A document type must be provided for document queries.'); + } + + if ($this->_documentType == 'spreadsheets') { + $uri .= $this->appendVisibilityProjection(); + if ($this->_spreadsheetKey != null) { + $uri .= '/'.$this->_spreadsheetKey; + } + } else if ($this->_documentType == 'worksheets') { + if ($this->_spreadsheetKey != null) { + $uri .= '/'.$this->_spreadsheetKey; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for worksheet document queries.'); + } + $uri .= $this->appendVisibilityProjection(); + if ($this->_worksheetId != null) { + $uri .= '/'.$this->_worksheetId; + } + } + + $uri .= $this->getQueryString(); + return $uri; + } + + /** + * Gets the attribute query string for this query. + * @return string query string + */ + public function getQueryString() + { + return parent::getQueryString(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/Cell.php b/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/Cell.php new file mode 100644 index 0000000..6774984 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/Cell.php @@ -0,0 +1,201 @@ +<?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 Spreadsheets + * @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: Entry.php 3941 2007-03-14 21:36:13Z darby $ + */ + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/Entry.php'; + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + + +/** + * Concrete class for working with cell elements. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_Extension_Cell extends Zend_Gdata_Extension +{ + protected $_rootElement = 'cell'; + protected $_rootNamespace = 'gs'; + + /** + * The row attribute of this cell + * + * @var string + */ + protected $_row = null; + + /** + * The column attribute of this cell + * + * @var string + */ + protected $_col = null; + + /** + * The inputValue attribute of this cell + * + * @var string + */ + protected $_inputValue = null; + + /** + * The numericValue attribute of this cell + * + * @var string + */ + protected $_numericValue = null; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_Extension_Cell element. + * + * @param string $text (optional) Text contents of the element. + * @param string $row (optional) Row attribute of the element. + * @param string $col (optional) Column attribute of the element. + * @param string $inputValue (optional) Input value attribute of the element. + * @param string $numericValue (optional) Numeric value attribute of the element. + */ + public function __construct($text = null, $row = null, $col = null, $inputValue = null, $numericValue = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct(); + $this->_text = $text; + $this->_row = $row; + $this->_col = $col; + $this->_inputValue = $inputValue; + $this->_numericValue = $numericValue; + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + $element->setAttribute('row', $this->_row); + $element->setAttribute('col', $this->_col); + if ($this->_inputValue) $element->setAttribute('inputValue', $this->_inputValue); + if ($this->_numericValue) $element->setAttribute('numericValue', $this->_numericValue); + return $element; + } + + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'row': + $this->_row = $attribute->nodeValue; + break; + case 'col': + $this->_col = $attribute->nodeValue; + break; + case 'inputValue': + $this->_inputValue = $attribute->nodeValue; + break; + case 'numericValue': + $this->_numericValue = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Gets the row attribute of the Cell element. + * @return string Row of the Cell. + */ + public function getRow() + { + return $this->_row; + } + + /** + * Gets the column attribute of the Cell element. + * @return string Column of the Cell. + */ + public function getColumn() + { + return $this->_col; + } + + /** + * Gets the input value attribute of the Cell element. + * @return string Input value of the Cell. + */ + public function getInputValue() + { + return $this->_inputValue; + } + + /** + * Gets the numeric value attribute of the Cell element. + * @return string Numeric value of the Cell. + */ + public function getNumericValue() + { + return $this->_numericValue; + } + + /** + * Sets the row attribute of the Cell element. + * @param string $row New row of the Cell. + */ + public function setRow($row) + { + $this->_row = $row; + return $this; + } + + /** + * Sets the column attribute of the Cell element. + * @param string $col New column of the Cell. + */ + public function setColumn($col) + { + $this->_col = $col; + return $this; + } + + /** + * Sets the input value attribute of the Cell element. + * @param string $inputValue New input value of the Cell. + */ + public function setInputValue($inputValue) + { + $this->_inputValue = $inputValue; + return $this; + } + + /** + * Sets the numeric value attribute of the Cell element. + * @param string $numericValue New numeric value of the Cell. + */ + public function setNumericValue($numericValue) + { + $this->_numericValue = $numericValue; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/ColCount.php b/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/ColCount.php new file mode 100644 index 0000000..bf7c865 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/ColCount.php @@ -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 + * @subpackage Spreadsheets + * @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: Entry.php 3941 2007-03-14 21:36:13Z darby $ + */ + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/Entry.php'; + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + + +/** + * Concrete class for working with colCount elements. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_Extension_ColCount extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'colCount'; + protected $_rootNamespace = 'gs'; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_Extension_ColCount element. + * @param string $text (optional) Text contents of the element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct(); + $this->_text = $text; + } +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/Custom.php b/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/Custom.php new file mode 100644 index 0000000..958a7e7 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/Custom.php @@ -0,0 +1,100 @@ +<?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 Spreadsheets + * @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: Entry.php 3941 2007-03-14 21:36:13Z darby $ + */ + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/Entry.php'; + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + + +/** + * Concrete class for working with custom gsx elements. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_Extension_Custom extends Zend_Gdata_Extension +{ + // custom elements have custom names. + protected $_rootElement = null; // The name of the column + protected $_rootNamespace = 'gsx'; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_Extension_Custom object. + * @param string $column (optional) The column/tag name of the element. + * @param string $value (optional) The text content of the element. + */ + public function __construct($column = null, $value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct(); + $this->_text = $value; + $this->_rootElement = $column; + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + return $element; + } + + /** + * 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) + { + parent::transferFromDOM($node); + $this->_rootElement = $node->localName; + } + + /** + * Sets the column/tag name of the element. + * @param string $column The new column name. + */ + public function setColumnName($column) + { + $this->_rootElement = $column; + return $this; + } + + /** + * Gets the column name of the element + * @return string The column name. + */ + public function getColumnName() + { + return $this->_rootElement; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/RowCount.php b/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/RowCount.php new file mode 100644 index 0000000..fc806db --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/Extension/RowCount.php @@ -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 + * @subpackage Spreadsheets + * @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: Entry.php 3941 2007-03-14 21:36:13Z darby $ + */ + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/Entry.php'; + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + + +/** + * Concrete class for working with RowCount elements. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_Extension_RowCount extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'rowCount'; + protected $_rootNamespace = 'gs'; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_Extension_RowCount object. + * @param string $text (optional) The text content of the element. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/ListEntry.php b/applications/core/lib/Zend/Gdata/Spreadsheets/ListEntry.php new file mode 100644 index 0000000..dbb64d5 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/ListEntry.php @@ -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 + * @subpackage Spreadsheets + * @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_Spreadsheets_Extension_Custom + */ +require_once 'Zend/Gdata/Spreadsheets/Extension/Custom.php'; + +/** + * Concrete class for working with List entries. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_ListEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Spreadsheets_ListEntry'; + + /** + * List of custom row elements (Zend_Gdata_Spreadsheets_Extension_Custom), + * indexed by order added to this entry. + * @var array + */ + protected $_custom = array(); + + /** + * List of custom row elements (Zend_Gdata_Spreadsheets_Extension_Custom), + * indexed by element name. + * @var array + */ + protected $_customByName = array(); + + /** + * Constructs a new Zend_Gdata_Spreadsheets_ListEntry object. + * @param DOMElement $element An existing XML element on which to base this new object. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if (!empty($this->_custom)) { + foreach ($this->_custom as $custom) { + $element->appendChild($custom->getDOM($element->ownerDocument)); + } + } + return $element; + } + + protected function takeChildFromDOM($child) + { + switch ($child->namespaceURI) { + case $this->lookupNamespace('gsx'); + $custom = new Zend_Gdata_Spreadsheets_Extension_Custom($child->localName); + $custom->transferFromDOM($child); + $this->addCustom($custom); + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Gets the row elements contained by this list entry. + * @return array The custom row elements in this list entry + */ + public function getCustom() + { + return $this->_custom; + } + + /** + * Gets a single row element contained by this list entry using its name. + * @param string $name The name of a custom element to return. If null + * or not defined, an array containing all custom elements + * indexed by name will be returned. + * @return mixed If a name is specified, the + * Zend_Gdata_Spreadsheets_Extension_Custom element requested, + * is returned or null if not found. Otherwise, an array of all + * Zend_Gdata_Spreadsheets_Extension_Custom elements is returned + * indexed by name. + */ + public function getCustomByName($name = null) + { + if ($name === null) { + return $this->_customByName; + } else { + if (array_key_exists($name, $this->customByName)) { + return $this->_customByName[$name]; + } else { + return null; + } + } + } + + /** + * Sets the row elements contained by this list entry. If any + * custom row elements were previously stored, they will be overwritten. + * @param array $custom The custom row elements to be contained in this + * list entry. + * @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface. + */ + public function setCustom($custom) + { + $this->_custom = array(); + foreach ($custom as $c) { + $this->addCustom($c); + } + return $this; + } + + /** + * Add an individual custom row element to this list entry. + * @param Zend_Gdata_Spreadsheets_Extension_Custom $custom The custom + * element to be added. + * @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface. + */ + public function addCustom($custom) + { + $this->_custom[] = $custom; + $this->_customByName[$custom->getColumnName()] = $custom; + return $this; + } + + /** + * Remove an individual row element from this list entry by index. This + * will cause the array to be re-indexed. + * @param int $index The index of the custom element to be deleted. + * @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function removeCustom($index) + { + if (array_key_exists($index, $this->_custom)) { + $element = $this->_custom[$index]; + // Remove element + unset($this->_custom[$index]); + // Re-index the array + $this->_custom = array_values($this->_custom); + // Be sure to delete form both arrays! + $key = array_search($element, $this->_customByName); + unset($this->_customByName[$key]); + } else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Element does not exist.'); + } + return $this; + } + + /** + * Remove an individual row element from this list entry by name. + * @param string $name The name of the custom element to be deleted. + * @return Zend_Gdata_Spreadsheets_ListEntry Provides a fluent interface. + * @throws Zend_Gdata_App_InvalidArgumentException + */ + public function removeCustomByName($name) + { + if (array_key_exists($name, $this->_customByName)) { + $element = $this->_customByName[$name]; + // Remove element + unset($this->_customByName[$name]); + // Be sure to delete from both arrays! + $key = array_search($element, $this->_custom); + unset($this->_custom[$key]); + } else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Element does not exist.'); + } + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/ListFeed.php b/applications/core/lib/Zend/Gdata/Spreadsheets/ListFeed.php new file mode 100644 index 0000000..0439504 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/ListFeed.php @@ -0,0 +1,63 @@ +<?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 Spreadsheets + * @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'; + +/** + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_ListFeed extends Zend_Gdata_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Spreadsheets_ListEntry'; + + /** + * The classname for the feed. + * + * @var string + */ + protected $_feedClassName = 'Zend_Gdata_Spreadsheets_ListFeed'; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_ListFeed object. + * @param DOMElement $element An existing XML element on which to base this new object. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/ListQuery.php b/applications/core/lib/Zend/Gdata/Spreadsheets/ListQuery.php new file mode 100644 index 0000000..ac0c05d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/ListQuery.php @@ -0,0 +1,304 @@ +<?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 Spreadsheets + * @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_util + */ +require_once('Zend/Gdata/App/Util.php'); + +/** + * Zend_Gdata_Query + */ +require_once('Zend/Gdata/Query.php'); + +/** + * Assists in constructing queries for Google Spreadsheets lists + * + * @link http://code.google.com/apis/gdata/calendar/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_ListQuery extends Zend_Gdata_Query +{ + + const SPREADSHEETS_LIST_FEED_URI = 'http://spreadsheets.google.com/feeds/list'; + + protected $_defaultFeedUri = self::SPREADSHEETS_LIST_FEED_URI; + protected $_visibility = 'private'; + protected $_projection = 'full'; + protected $_spreadsheetKey = null; + protected $_worksheetId = 'default'; + protected $_rowId = null; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_ListQuery object. + */ + public function __construct() + { + parent::__construct(); + } + + /** + * Sets the spreadsheet key for the query. + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setSpreadsheetKey($value) + { + $this->_spreadsheetKey = $value; + return $this; + } + + /** + * Gets the spreadsheet key for the query. + * @return string spreadsheet key + */ + public function getSpreadsheetKey() + { + return $this->_spreadsheetKey; + } + + /** + * Sets the worksheet id for the query. + * @param string $value + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setWorksheetId($value) + { + $this->_worksheetId = $value; + return $this; + } + + /** + * Gets the worksheet id for the query. + * @return string worksheet id + */ + public function getWorksheetId() + { + return $this->_worksheetId; + } + + /** + * Sets the row id for the query. + * @param string $value row id + * @return Zend_Gdata_Spreadsheets_CellQuery Provides a fluent interface + */ + public function setRowId($value) + { + $this->_rowId = $value; + return $this; + } + + /** + * Gets the row id for the query. + * @return string row id + */ + public function getRowId() + { + return $this->_rowId; + } + + /** + * Sets the projection for the query. + * @param string $value Projection + * @return Zend_Gdata_Spreadsheets_ListQuery Provides a fluent interface + */ + public function setProjection($value) + { + $this->_projection = $value; + return $this; + } + + /** + * Sets the visibility for this query. + * @param string $value visibility + * @return Zend_Gdata_Spreadsheets_ListQuery 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 spreadsheet key for this query. + * @param string $value + * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface + */ + public function setSpreadsheetQuery($value) + { + if ($value != null) { + $this->_params['sq'] = $value; + } else { + unset($this->_params['sq']); + } + return $this; + } + + /** + * Gets the spreadsheet key for this query. + * @return string spreadsheet query + */ + public function getSpreadsheetQuery() + { + if (array_key_exists('sq', $this->_params)) { + return $this->_params['sq']; + } else { + return null; + } + } + + /** + * Sets the orderby attribute for this query. + * @param string $value + * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface + */ + public function setOrderBy($value) + { + if ($value != null) { + $this->_params['orderby'] = $value; + } else { + unset($this->_params['orderby']); + } + return $this; + } + + /** + * Gets the orderby attribute for this query. + * @return string orderby + */ + public function getOrderBy() + { + if (array_key_exists('orderby', $this->_params)) { + return $this->_params['orderby']; + } else { + return null; + } + } + + /** + * Sets the reverse attribute for this query. + * @param string $value + * @return Zend_Gdata_Spreadsheets_DocumentQuery Provides a fluent interface + */ + public function setReverse($value) + { + if ($value != null) { + $this->_params['reverse'] = $value; + } else { + unset($this->_params['reverse']); + } + return $this; + } + + /** + * Gets the reverse attribute for this query. + * @return string reverse + */ + public function getReverse() + { + + + if (array_key_exists('reverse', $this->_params)) { + return $this->_params['reverse']; + } else { + return null; + } + } + + /** + * Gets the full query URL for this query. + * @return string url + */ + public function getQueryUrl() + { + + $uri = $this->_defaultFeedUri; + + if ($this->_spreadsheetKey != null) { + $uri .= '/'.$this->_spreadsheetKey; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('A spreadsheet key must be provided for list queries.'); + } + + if ($this->_worksheetId != null) { + $uri .= '/'.$this->_worksheetId; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('A worksheet id must be provided for list queries.'); + } + + 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 list 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 list queries.'); + } + + if ($this->_rowId != null) { + $uri .= '/'.$this->_rowId; + } + + $uri .= $this->getQueryString(); + return $uri; + } + + /** + * Gets the attribute query string for this query. + * @return string query string + */ + public function getQueryString() + { + return parent::getQueryString(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/SpreadsheetEntry.php b/applications/core/lib/Zend/Gdata/Spreadsheets/SpreadsheetEntry.php new file mode 100644 index 0000000..1f34a0d --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/SpreadsheetEntry.php @@ -0,0 +1,63 @@ +<?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 Spreadsheets + * @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'; + +/** + * Concrete class for working with Atom entries. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_SpreadsheetEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Spreadsheets_SpreadsheetEntry'; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_SpreadsheetEntry object. + * @param DOMElement $element (optional) The DOMElement on which to base this object. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct($element); + } + + /** + * Returns the worksheets in this spreadsheet + * + * @return Zend_Gdata_Spreadsheets_WorksheetFeed The worksheets + */ + public function getWorksheets() + { + $service = new Zend_Gdata_Spreadsheets($this->getHttpClient()); + return $service->getWorksheetFeed($this); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/SpreadsheetFeed.php b/applications/core/lib/Zend/Gdata/Spreadsheets/SpreadsheetFeed.php new file mode 100644 index 0000000..2de7ad3 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/SpreadsheetFeed.php @@ -0,0 +1,63 @@ +<?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 Spreadsheets + * @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'; + +/** + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_SpreadsheetFeed extends Zend_Gdata_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Spreadsheets_SpreadsheetEntry'; + + /** + * The classname for the feed. + * + * @var string + */ + protected $_feedClassName = 'Zend_Gdata_Spreadsheets_SpreadsheetFeed'; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_SpreadsheetFeed object. + * @param DOMElement $element (optional) The DOMElement on which to base this object. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/WorksheetEntry.php b/applications/core/lib/Zend/Gdata/Spreadsheets/WorksheetEntry.php new file mode 100644 index 0000000..6693003 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/WorksheetEntry.php @@ -0,0 +1,186 @@ +<?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 Spreadsheets + * @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_Spreadsheets_Extension_RowCount + */ +require_once 'Zend/Gdata/Spreadsheets/Extension/RowCount.php'; + +/** + * @see Zend_Gdata_Spreadsheets_Extension_ColCount + */ +require_once 'Zend/Gdata/Spreadsheets/Extension/ColCount.php'; + +/** + * Concrete class for working with Worksheet entries. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_WorksheetEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_Spreadsheets_WorksheetEntry'; + + protected $_rowCount = null; + protected $_colCount = null; + + /** + * Constructs a new Zend_Gdata_Spreadsheets_WorksheetEntry object. + * + * @param DOMElement $element (optional) The DOMElement on which to base this object. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_rowCount != null) { + $element->appendChild($this->_rowCount->getDOM($element->ownerDocument)); + } + if ($this->_colCount != null) { + $element->appendChild($this->_colCount->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('gs') . ':' . 'rowCount'; + $rowCount = new Zend_Gdata_Spreadsheets_Extension_RowCount(); + $rowCount->transferFromDOM($child); + $this->_rowCount = $rowCount; + break; + case $this->lookupNamespace('gs') . ':' . 'colCount'; + $colCount = new Zend_Gdata_Spreadsheets_Extension_ColCount(); + $colCount->transferFromDOM($child); + $this->_colCount = $colCount; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + + /** + * Gets the row count for this entry. + * + * @return string The row count for the entry. + */ + public function getRowCount() + { + return $this->_rowCount; + } + + /** + * Gets the column count for this entry. + * + * @return string The column count for the entry. + */ + public function getColumnCount() + { + return $this->_colCount; + } + + /** + * Sets the row count for this entry. + * + * @param string $rowCount The new row count for the entry. + */ + public function setRowCount($rowCount) + { + $this->_rowCount = $rowCount; + return $this; + } + + /** + * Sets the column count for this entry. + * + * @param string $colCount The new column count for the entry. + */ + public function setColumnCount($colCount) + { + $this->_colCount = $colCount; + return $this; + } + + /** + * Returns the content of all rows as an associative array + * + * @return array An array of rows. Each element of the array is an associative array of data + */ + public function getContentsAsRows() + { + $service = new Zend_Gdata_Spreadsheets($this->getHttpClient()); + return $service->getSpreadsheetListFeedContents($this); + } + + /** + * Returns the content of all cells as an associative array, indexed + * off the cell location (ie 'A1', 'D4', etc). Each element of + * the array is an associative array with a 'value' and a 'function'. + * Only non-empty cells are returned by default. 'range' is the + * value of the 'range' query parameter specified at: + * http://code.google.com/apis/spreadsheets/reference.html#cells_Parameters + * + * @param string $range The range of cells to retrieve + * @param boolean $empty Whether to retrieve empty cells + * @return array An associative array of cells + */ + public function getContentsAsCells($range = null, $empty = false) + { + $service = new Zend_Gdata_Spreadsheets($this->getHttpClient()); + return $service->getSpreadsheetCellFeedContents($this, $range, $empty); + } + +} diff --git a/applications/core/lib/Zend/Gdata/Spreadsheets/WorksheetFeed.php b/applications/core/lib/Zend/Gdata/Spreadsheets/WorksheetFeed.php new file mode 100644 index 0000000..c2501e4 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/Spreadsheets/WorksheetFeed.php @@ -0,0 +1,63 @@ +<?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 Spreadsheets + * @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'; + +/** + * + * @category Zend + * @package Zend_Gdata + * @subpackage Spreadsheets + * @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_Spreadsheets_WorksheetFeed extends Zend_Gdata_Feed +{ + + /** + * Constructs a new Zend_Gdata_Spreadsheets_WorksheetFeed object. + * @param DOMElement $element (optional) The DOMElement on whick to base this element. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces); + parent::__construct($element); + } + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Spreadsheets_WorksheetEntry'; + + /** + * The classname for the feed. + * + * @var string + */ + protected $_feedClassName = 'Zend_Gdata_Spreadsheets_WorksheetFeed'; + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube.php b/applications/core/lib/Zend/Gdata/YouTube.php new file mode 100644 index 0000000..6abdafd --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube.php @@ -0,0 +1,873 @@ +<?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 YouTube + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * @see Zend_Gdata_Media + */ +require_once 'Zend/Gdata/Media.php'; + +/** + * @see Zend_Gdata_YouTube_VideoEntry + */ +require_once 'Zend/Gdata/YouTube/VideoEntry.php'; + +/** + * @see Zend_Gdata_YouTube_VideoFeed + */ +require_once 'Zend/Gdata/YouTube/VideoFeed.php'; + +/** + * @see Zend_Gdata_YouTube_CommentFeed + */ +require_once 'Zend/Gdata/YouTube/CommentFeed.php'; + +/** + * @see Zend_Gdata_YouTube_PlaylistListFeed + */ +require_once 'Zend/Gdata/YouTube/PlaylistListFeed.php'; + +/** + * @see Zend_Gdata_YouTube_SubscriptionFeed + */ +require_once 'Zend/Gdata/YouTube/SubscriptionFeed.php'; + +/** + * @see Zend_Gdata_YouTube_ContactFeed + */ +require_once 'Zend/Gdata/YouTube/ContactFeed.php'; + +/** + * @see Zend_Gdata_YouTube_PlaylistVideoFeed + */ +require_once 'Zend/Gdata/YouTube/PlaylistVideoFeed.php'; + +/** + * @see Zend_Gdata_YouTube_ActivityFeed + */ +require_once 'Zend/Gdata/YouTube/ActivityFeed.php'; + +/** + * @see Zend_Gdata_YouTube_InboxFeed + */ +require_once 'Zend/Gdata/YouTube/InboxFeed.php'; + + +/** + * Service class for interacting with the YouTube Data API. + * @link http://code.google.com/apis/youtube/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_YouTube extends Zend_Gdata_Media +{ + + const AUTH_SERVICE_NAME = 'youtube'; + const CLIENTLOGIN_URL = 'https://www.google.com/youtube/accounts/ClientLogin'; + + const STANDARD_TOP_RATED_URI = 'http://gdata.youtube.com/feeds/standardfeeds/top_rated'; + const STANDARD_MOST_VIEWED_URI = 'http://gdata.youtube.com/feeds/standardfeeds/most_viewed'; + const STANDARD_RECENTLY_FEATURED_URI = 'http://gdata.youtube.com/feeds/standardfeeds/recently_featured'; + const STANDARD_WATCH_ON_MOBILE_URI = 'http://gdata.youtube.com/feeds/standardfeeds/watch_on_mobile'; + + const STANDARD_TOP_RATED_URI_V2 = + 'http://gdata.youtube.com/feeds/api/standardfeeds/top_rated'; + const STANDARD_MOST_VIEWED_URI_V2 = + 'http://gdata.youtube.com/feeds/api/standardfeeds/most_viewed'; + const STANDARD_RECENTLY_FEATURED_URI_V2 = + 'http://gdata.youtube.com/feeds/api/standardfeeds/recently_featured'; + const STANDARD_WATCH_ON_MOBILE_URI_V2 = + 'http://gdata.youtube.com/feeds/api/standardfeeds/watch_on_mobile'; + + const USER_URI = 'http://gdata.youtube.com/feeds/api/users'; + const VIDEO_URI = 'http://gdata.youtube.com/feeds/api/videos'; + const PLAYLIST_REL = 'http://gdata.youtube.com/schemas/2007#playlist'; + const USER_UPLOADS_REL = 'http://gdata.youtube.com/schemas/2007#user.uploads'; + const USER_PLAYLISTS_REL = 'http://gdata.youtube.com/schemas/2007#user.playlists'; + const USER_SUBSCRIPTIONS_REL = 'http://gdata.youtube.com/schemas/2007#user.subscriptions'; + const USER_CONTACTS_REL = 'http://gdata.youtube.com/schemas/2007#user.contacts'; + const USER_FAVORITES_REL = 'http://gdata.youtube.com/schemas/2007#user.favorites'; + const VIDEO_RESPONSES_REL = 'http://gdata.youtube.com/schemas/2007#video.responses'; + const VIDEO_RATINGS_REL = 'http://gdata.youtube.com/schemas/2007#video.ratings'; + const VIDEO_COMPLAINTS_REL = 'http://gdata.youtube.com/schemas/2007#video.complaints'; + const ACTIVITY_FEED_URI = 'http://gdata.youtube.com/feeds/api/events'; + const FRIEND_ACTIVITY_FEED_URI = + 'http://gdata.youtube.com/feeds/api/users/default/friendsactivity'; + + /** + * The URI of the in-reply-to schema for comments in reply to + * other comments. + * + * @var string + */ + const IN_REPLY_TO_SCHEME = + 'http://gdata.youtube.com/schemas/2007#in-reply-to'; + + /** + * The URI of the inbox feed for the currently authenticated user. + * + * @var string + */ + const INBOX_FEED_URI = + 'http://gdata.youtube.com/feeds/api/users/default/inbox'; + + /** + * The maximum number of users for which activity can be requested for, + * as enforced by the API. + * + * @var integer + */ + const ACTIVITY_FEED_MAX_USERS = 20; + + /** + * The suffix for a feed of favorites. + * + * @var string + */ + const FAVORITES_URI_SUFFIX = 'favorites'; + + /** + * The suffix for the user's upload feed. + * + * @var string + */ + const UPLOADS_URI_SUFFIX = 'uploads'; + + /** + * The suffix for a feed of video responses. + * + * @var string + */ + const RESPONSES_URI_SUFFIX = 'responses'; + + /** + * The suffix for a feed of related videos. + * + * @var string + */ + const RELATED_URI_SUFFIX = 'related'; + + /** + * The suffix for a feed of messages (inbox entries). + * + * @var string + */ + const INBOX_URI_SUFFIX = 'inbox'; + + /** + * Namespaces used for Zend_Gdata_YouTube + * + * @var array + */ + public static $namespaces = array( + array('yt', 'http://gdata.youtube.com/schemas/2007', 1, 0), + array('georss', 'http://www.georss.org/georss', 1, 0), + array('gml', 'http://www.opengis.net/gml', 1, 0), + array('media', 'http://search.yahoo.com/mrss/', 1, 0) + ); + + /** + * Create Zend_Gdata_YouTube 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 + * @param string $clientId The clientId issued by the YouTube dashboard + * @param string $developerKey The developerKey issued by the YouTube dashboard + */ + public function __construct($client = null, + $applicationId = 'MyCompany-MyApp-1.0', $clientId = null, + $developerKey = null) + { + $this->registerPackage('Zend_Gdata_YouTube'); + $this->registerPackage('Zend_Gdata_YouTube_Extension'); + $this->registerPackage('Zend_Gdata_Media'); + $this->registerPackage('Zend_Gdata_Media_Extension'); + + // NOTE This constructor no longer calls the parent constructor + $this->setHttpClient($client, $applicationId, $clientId, $developerKey); + } + + /** + * 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', $clientId = null, + $developerKey = null) + { + 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.'); + } + + if ($clientId != null) { + $client->setHeaders('X-GData-Client', $clientId); + } + + if ($developerKey != null) { + $client->setHeaders('X-GData-Key', 'key='. $developerKey); + } + + return parent::setHttpClient($client, $applicationId); + } + + /** + * Retrieves a feed of videos. + * + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_VideoFeed The feed of videos found at the + * specified URL. + */ + public function getVideoFeed($location = null) + { + if ($location == null) { + $uri = self::VIDEO_URI; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); + } + + /** + * Retrieves a specific video entry. + * + * @param mixed $videoId The ID of the video to retrieve. + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined. + * @param boolean $fullEntry (optional) Retrieve the full metadata for the + * entry. Only possible if entry belongs to currently authenticated + * user. An exception will be thrown otherwise. + * @throws Zend_Gdata_App_HttpException + * @return Zend_Gdata_YouTube_VideoEntry The video entry found at the + * specified URL. + */ + public function getVideoEntry($videoId = null, $location = null, + $fullEntry = false) + { + if ($videoId !== null) { + if ($fullEntry) { + return $this->getFullVideoEntry($videoId); + } else { + $uri = self::VIDEO_URI . "/" . $videoId; + } + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getEntry($uri, 'Zend_Gdata_YouTube_VideoEntry'); + } + + /** + * Retrieves a video entry from the user's upload feed. + * + * @param mixed $videoID The ID of the video to retrieve. + * @throws Zend_Gdata_App_HttpException + * @return Zend_Gdata_YouTube_VideoEntry|null The video entry to be + * retrieved, or null if it was not found or the user requesting it + * did not have the appropriate permissions. + */ + public function getFullVideoEntry($videoId) + { + $uri = self::USER_URI . "/default/" . + self::UPLOADS_URI_SUFFIX . "/$videoId"; + return parent::getEntry($uri, 'Zend_Gdata_YouTube_VideoEntry'); + } + + /** + * Retrieves a feed of videos related to the specified video ID. + * + * @param string $videoId The videoId of interest + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_VideoFeed The feed of videos found at the + * specified URL. + */ + public function getRelatedVideoFeed($videoId = null, $location = null) + { + if ($videoId !== null) { + $uri = self::VIDEO_URI . "/" . $videoId . "/" . + self::RELATED_URI_SUFFIX; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); + } + + /** + * Retrieves a feed of video responses related to the specified video ID. + * + * @param string $videoId The videoId of interest + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_VideoFeed The feed of videos found at the + * specified URL. + */ + public function getVideoResponseFeed($videoId = null, $location = null) + { + if ($videoId !== null) { + $uri = self::VIDEO_URI . "/" . $videoId . "/" . + self::RESPONSES_URI_SUFFIX; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); + } + + /** + * Retrieves a feed of comments related to the specified video ID. + * + * @param string $videoId The videoId of interest + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_CommentFeed The feed of videos found at the + * specified URL. + */ + public function getVideoCommentFeed($videoId = null, $location = null) + { + if ($videoId !== null) { + $uri = self::VIDEO_URI . "/" . $videoId . "/comments"; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_CommentFeed'); + } + + /** + * Retrieves a feed of comments related to the specified video ID. + * + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_CommentFeed The feed of videos found at the + * specified URL. + */ + public function getTopRatedVideoFeed($location = null) + { + $standardFeedUri = self::STANDARD_TOP_RATED_URI; + + if ($this->getMajorProtocolVersion() == 2) { + $standardFeedUri = self::STANDARD_TOP_RATED_URI_V2; + } + + if ($location == null) { + $uri = $standardFeedUri; + } else if ($location instanceof Zend_Gdata_Query) { + if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { + if (!isset($location->url)) { + $location->setFeedType('top rated'); + } + } + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); + } + + + /** + * Retrieves a feed of the most viewed videos. + * + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_VideoFeed The feed of videos found at the + * specified URL. + */ + public function getMostViewedVideoFeed($location = null) + { + $standardFeedUri = self::STANDARD_MOST_VIEWED_URI; + + if ($this->getMajorProtocolVersion() == 2) { + $standardFeedUri = self::STANDARD_MOST_VIEWED_URI_V2; + } + + if ($location == null) { + $uri = $standardFeedUri; + } else if ($location instanceof Zend_Gdata_Query) { + if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { + if (!isset($location->url)) { + $location->setFeedType('most viewed'); + } + } + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); + } + + /** + * Retrieves a feed of recently featured videos. + * + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_VideoFeed The feed of videos found at the + * specified URL. + */ + public function getRecentlyFeaturedVideoFeed($location = null) + { + $standardFeedUri = self::STANDARD_RECENTLY_FEATURED_URI; + + if ($this->getMajorProtocolVersion() == 2) { + $standardFeedUri = self::STANDARD_RECENTLY_FEATURED_URI_V2; + } + + if ($location == null) { + $uri = $standardFeedUri; + } else if ($location instanceof Zend_Gdata_Query) { + if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { + if (!isset($location->url)) { + $location->setFeedType('recently featured'); + } + } + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); + } + + /** + * Retrieves a feed of videos recently featured for mobile devices. + * These videos will have RTSP links in the $entry->mediaGroup->content + * + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_VideoFeed The feed of videos found at the + * specified URL. + */ + public function getWatchOnMobileVideoFeed($location = null) + { + $standardFeedUri = self::STANDARD_WATCH_ON_MOBILE_URI; + + if ($this->getMajorProtocolVersion() == 2) { + $standardFeedUri = self::STANDARD_WATCH_ON_MOBILE_URI_V2; + } + + if ($location == null) { + $uri = $standardFeedUri; + } else if ($location instanceof Zend_Gdata_Query) { + if ($location instanceof Zend_Gdata_YouTube_VideoQuery) { + if (!isset($location->url)) { + $location->setFeedType('watch on mobile'); + } + } + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); + } + + /** + * Retrieves a feed which lists a user's playlist + * + * @param string $user (optional) The username of interest + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_PlaylistListFeed The feed of playlists + */ + public function getPlaylistListFeed($user = null, $location = null) + { + if ($user !== null) { + $uri = self::USER_URI . '/' . $user . '/playlists'; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_PlaylistListFeed'); + } + + /** + * Retrieves a feed of videos in a particular playlist + * + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_PlaylistVideoFeed The feed of videos found at + * the specified URL. + */ + public function getPlaylistVideoFeed($location) + { + if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_PlaylistVideoFeed'); + } + + /** + * Retrieves a feed of a user's subscriptions + * + * @param string $user (optional) The username of interest + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_SubscriptionListFeed The feed of subscriptions + */ + public function getSubscriptionFeed($user = null, $location = null) + { + if ($user !== null) { + $uri = self::USER_URI . '/' . $user . '/subscriptions'; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_SubscriptionFeed'); + } + + /** + * Retrieves a feed of a user's contacts + * + * @param string $user (optional) The username of interest + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_ContactFeed The feed of contacts + */ + public function getContactFeed($user = null, $location = null) + { + if ($user !== null) { + $uri = self::USER_URI . '/' . $user . '/contacts'; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_ContactFeed'); + } + + /** + * Retrieves a user's uploads + * + * @param string $user (optional) The username of interest + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_VideoFeed The videos uploaded by the user + */ + public function getUserUploads($user = null, $location = null) + { + if ($user !== null) { + $uri = self::USER_URI . '/' . $user . '/' . + self::UPLOADS_URI_SUFFIX; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); + } + + /** + * Retrieves a user's favorites + * + * @param string $user (optional) The username of interest + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_VideoFeed The videos favorited by the user + */ + public function getUserFavorites($user = null, $location = null) + { + if ($user !== null) { + $uri = self::USER_URI . '/' . $user . '/' . + self::FAVORITES_URI_SUFFIX; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getFeed($uri, 'Zend_Gdata_YouTube_VideoFeed'); + } + + /** + * Retrieves a user's profile as an entry + * + * @param string $user (optional) The username of interest + * @param mixed $location (optional) The URL to query or a + * Zend_Gdata_Query object from which a URL can be determined + * @return Zend_Gdata_YouTube_UserProfileEntry The user profile entry + */ + public function getUserProfile($user = null, $location = null) + { + if ($user !== null) { + $uri = self::USER_URI . '/' . $user; + } else if ($location instanceof Zend_Gdata_Query) { + $uri = $location->getQueryUrl(); + } else { + $uri = $location; + } + return parent::getEntry($uri, 'Zend_Gdata_YouTube_UserProfileEntry'); + } + + /** + * Helper function for parsing a YouTube token response + * + * @param string $response The service response + * @throws Zend_Gdata_App_Exception + * @return array An array containing the token and URL + */ + public static function parseFormUploadTokenResponse($response) + { + // Load the feed as an XML DOMDocument object + @ini_set('track_errors', 1); + $doc = new DOMDocument(); + $success = @$doc->loadXML($response); + @ini_restore('track_errors'); + + if (!$success) { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + "Zend_Gdata_YouTube::parseFormUploadTokenResponse - " . + "DOMDocument cannot parse XML: $php_errormsg"); + } + $responseElement = $doc->getElementsByTagName('response')->item(0); + + $urlText = null; + $tokenText = null; + if ($responseElement != null) { + $urlElement = + $responseElement->getElementsByTagName('url')->item(0); + $tokenElement = + $responseElement->getElementsByTagName('token')->item(0); + + if ($urlElement && $urlElement->hasChildNodes() && + $tokenElement && $tokenElement->hasChildNodes()) { + + $urlText = $urlElement->firstChild->nodeValue; + $tokenText = $tokenElement->firstChild->nodeValue; + } + } + + if ($tokenText != null && $urlText != null) { + return array('token' => $tokenText, 'url' => $urlText); + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Form upload token not found in response'); + } + } + + /** + * Retrieves a YouTube token + * + * @param Zend_Gdata_YouTube_VideoEntry $videoEntry The video entry + * @param string $url The location as a string URL + * @throws Zend_Gdata_App_Exception + * @return array An array containing a token and URL + */ + public function getFormUploadToken($videoEntry, + $url='http://gdata.youtube.com/action/GetUploadToken') + { + if ($url != null && is_string($url)) { + // $response is a Zend_Http_response object + $response = $this->post($videoEntry, $url); + return self::parseFormUploadTokenResponse($response->getBody()); + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Url must be provided as a string URL'); + } + } + + /** + * Retrieves the activity feed for users + * + * @param mixed $usernames A string identifying the usernames for which to + * retrieve activity for. This can also be a Zend_Gdata_Query + * object from which a URL can be determined. + * @throws Zend_Gdata_App_VersionException if using version less than 2. + * @return Zend_Gdata_YouTube_ActivityFeed + */ + public function getActivityForUser($username) + { + if ($this->getMajorProtocolVersion() == 1) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('User activity feeds ' . + 'are not available in API version 1.'); + } + + $uri = null; + if ($username instanceof Zend_Gdata_Query) { + $uri = $username->getQueryUrl(); + } else { + if (count(explode(',', $username)) > + self::ACTIVITY_FEED_MAX_USERS) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Activity feed can only retrieve for activity for up to ' . + self::ACTIVITY_FEED_MAX_USERS . ' users per request'); + } + $uri = self::ACTIVITY_FEED_URI . '?author=' . $username; + } + + return parent::getFeed($uri, 'Zend_Gdata_YouTube_ActivityFeed'); + } + + /** + * Retrieve the activity of the currently authenticated users friend. + * + * @throws Zend_Gdata_App_Exception if not logged in. + * @return Zend_Gdata_YouTube_ActivityFeed + */ + public function getFriendActivityForCurrentUser() + { + if (!$this->isAuthenticated()) { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('You must be authenticated to ' . + 'use the getFriendActivityForCurrentUser function in Zend_' . + 'Gdata_YouTube.'); + } + return parent::getFeed(self::FRIEND_ACTIVITY_FEED_URI, + 'Zend_Gdata_YouTube_ActivityFeed'); + } + + /** + * Retrieve a feed of messages in the currently authenticated user's inbox. + * + * @throws Zend_Gdata_App_Exception if not logged in. + * @return Zend_Gdata_YouTube_InboxFeed|null + */ + public function getInboxFeedForCurrentUser() + { + if (!$this->isAuthenticated()) { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('You must be authenticated to ' . + 'use the getInboxFeedForCurrentUser function in Zend_' . + 'Gdata_YouTube.'); + } + + return parent::getFeed(self::INBOX_FEED_URI, + 'Zend_Gdata_YouTube_InboxFeed'); + } + + /** + * Send a video message. + * + * Note: Either a Zend_Gdata_YouTube_VideoEntry or a valid video ID must + * be provided. + * + * @param string $body The body of the message + * @param Zend_Gdata_YouTube_VideoEntry (optional) The video entry to send + * @param string $videoId The id of the video to send + * @param string $recipientUserName The username of the recipient + * @throws Zend_Gdata_App_InvalidArgumentException if no valid + * Zend_Gdata_YouTube_VideoEntry or videoId were provided + * @return Zend_Gdata_YouTube_InboxEntry|null The + * Zend_Gdata_YouTube_Inbox_Entry representing the sent message. + * + */ + public function sendVideoMessage($body, $videoEntry = null, + $videoId = null, $recipientUserName) + { + if (!$videoId && !$videoEntry) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Expecting either a valid videoID or a videoEntry object in ' . + 'Zend_Gdata_YouTube->sendVideoMessage().'); + } + + $messageEntry = new Zend_Gdata_YouTube_InboxEntry(); + + if ($this->getMajorProtocolVersion() == null || + $this->getMajorProtocolVersion() == 1) { + + if (!$videoId) { + $videoId = $videoEntry->getVideoId(); + } elseif (strlen($videoId) < 12) { + //Append the full URI + $videoId = self::VIDEO_URI . '/' . $videoId; + } + + $messageEntry->setId($this->newId($videoId)); + // TODO there seems to be a bug where v1 inbox entries dont + // retain their description... + $messageEntry->setDescription( + new Zend_Gdata_YouTube_Extension_Description($body)); + + } else { + if (!$videoId) { + $videoId = $videoEntry->getVideoId(); + $videoId = substr($videoId, strrpos($videoId, ':')); + } + $messageEntry->setId($this->newId($videoId)); + $messageEntry->setSummary($this->newSummary($body)); + } + + $insertUrl = 'http://gdata.youtube.com/feeds/api/users/' . + $recipientUserName . '/inbox'; + $response = $this->insertEntry($messageEntry, $insertUrl, + 'Zend_Gdata_YouTube_InboxEntry'); + return $response; + } + + /** + * Post a comment in reply to an existing comment + * + * @param $commentEntry Zend_Gdata_YouTube_CommentEntry The comment entry + * to reply to + * @param $commentText string The text of the comment to post + * @return A Zend_Gdata_YouTube_CommentEntry representing the posted + * comment + */ + public function replyToCommentEntry($commentEntry, $commentText) + { + $newComment = $this->newCommentEntry(); + $newComment->content = $this->newContent()->setText($commentText); + $commentId = $commentEntry->getId(); + $commentIdArray = explode(':', $commentId); + + // create a new link element + $inReplyToLinkHref = self::VIDEO_URI . '/' . $commentIdArray[3] . + '/comments/' . $commentIdArray[5]; + $inReplyToLink = $this->newLink($inReplyToLinkHref, + self::IN_REPLY_TO_SCHEME, $type="application/atom+xml"); + $links = $newComment->getLink(); + $links[] = $inReplyToLink; + $newComment->setLink($links); + $commentFeedPostUrl = self::VIDEO_URI . '/' . $commentIdArray[3] . + '/comments'; + return $this->insertEntry($newComment, + $commentFeedPostUrl, 'Zend_Gdata_YouTube_CommentEntry'); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/ActivityEntry.php b/applications/core/lib/Zend/Gdata/YouTube/ActivityEntry.php new file mode 100644 index 0000000..a5a550b --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/ActivityEntry.php @@ -0,0 +1,231 @@ +<?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 Health + * @copyright Copyright (c) 2005-2009 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_YouTube_Extension_VideoId + */ +require_once 'Zend/Gdata/YouTube/Extension/VideoId.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Username + */ +require_once 'Zend/Gdata/YouTube/Extension/Username.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Rating + */ +require_once 'Zend/Gdata/Extension/Rating.php'; + +/** + * A concrete class for working with YouTube user activity entries. + * + * @link http://code.google.com/apis/youtube/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_YouTube_ActivityEntry extends Zend_Gdata_Entry +{ + const ACTIVITY_CATEGORY_SCHEME = + 'http://gdata.youtube.com/schemas/2007/userevents.cat'; + + /** + * The classname for individual user activity entry elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_ActivityEntry'; + + /** + * The ID of the video that was part of the activity + * + * @var Zend_Gdata_YouTube_VideoId + */ + protected $_videoId = null; + + /** + * The username for the user that was part of the activity + * + * @var Zend_Gdata_YouTube_Username + */ + protected $_username = null; + + /** + * The rating element that was part of the activity + * + * @var Zend_Gdata_Extension_Rating + */ + protected $_rating = null; + + /** + * Constructs a new Zend_Gdata_YouTube_ActivityEntry object. + * @param DOMElement $element (optional) The DOMElement on which to + * base this object. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_videoId !== null) { + $element->appendChild($this->_videoId->getDOM( + $element->ownerDocument)); + } + if ($this->_username !== null) { + $element->appendChild($this->_username->getDOM( + $element->ownerDocument)); + } + if ($this->_rating !== null) { + $element->appendChild($this->_rating->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('yt') . ':' . 'videoid': + $videoId = new Zend_Gdata_YouTube_Extension_VideoId(); + $videoId->transferFromDOM($child); + $this->_videoId = $videoId; + break; + case $this->lookupNamespace('yt') . ':' . 'username': + $username = new Zend_Gdata_YouTube_Extension_Username(); + $username->transferFromDOM($child); + $this->_username = $username; + break; + case $this->lookupNamespace('gd') . ':' . 'rating': + $rating = new Zend_Gdata_Extension_Rating(); + $rating->transferFromDOM($child); + $this->_rating = $rating; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Returns the video ID for this activity entry. + * + * @return null|Zend_Gdata_YouTube_Extension_VideoId + */ + public function getVideoId() + { + return $this->_videoId; + } + + /** + * Returns the username for this activity entry. + * + * @return null|Zend_Gdata_YouTube_Extension_Username + */ + public function getUsername() + { + return $this->_username; + } + + /** + * Returns the rating for this activity entry. + * + * @return null|Zend_Gdata_YouTube_Extension_Rating + */ + public function getRating() + { + return $this->_rating; + } + + /** + * Return the value of the rating for this video entry. + * + * Convenience method to save needless typing. + * + * @return integer|null The value of the rating that was created, if found. + */ + public function getRatingValue() + { + $rating = $this->_rating; + if ($rating) { + return $rating->getValue(); + } + return null; + } + + /** + * Return the activity type that was performed. + * + * Convenience method that inspects category where scheme is + * http://gdata.youtube.com/schemas/2007/userevents.cat. + * + * @return string|null The activity category if found. + */ + public function getActivityType() + { + $categories = $this->getCategory(); + foreach($categories as $category) { + if ($category->getScheme() == self::ACTIVITY_CATEGORY_SCHEME) { + return $category->getTerm(); + } + } + return null; + } + + /** + * Convenience method to quickly get access to the author of the activity + * + * @return string The author of the activity + */ + public function getAuthorName() + { + $authors = $this->getAuthor(); + return $authors[0]->getName()->getText(); + } +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/ActivityFeed.php b/applications/core/lib/Zend/Gdata/YouTube/ActivityFeed.php new file mode 100644 index 0000000..329cc77 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/ActivityFeed.php @@ -0,0 +1,65 @@ +<?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 YouTube + * @copyright Copyright (c) 2005-2009 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'; + +/** + * @see Zend_Gdata_YouTube_ActivityEntry + */ +require_once 'Zend/Gdata/YouTube/ActivityEntry.php'; + +/** + * A feed of user activity entries for YouTube + * + * @link http://code.google.com/apis/youtube/ + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_YouTube_ActivityFeed extends Zend_Gdata_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_ActivityEntry'; + + /** + * Creates an Activity feed, representing a list of activity entries + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/CommentEntry.php b/applications/core/lib/Zend/Gdata/YouTube/CommentEntry.php new file mode 100644 index 0000000..dab76ab --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/CommentEntry.php @@ -0,0 +1,58 @@ +<?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 YouTube + * @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_Media_Feed + */ +require_once 'Zend/Gdata/Media/Feed.php'; + +/** + * The YouTube comments flavor of an Atom Entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_CommentEntry extends Zend_Gdata_Entry +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_CommentEntry'; + + /** + * Constructs a new Zend_Gdata_YouTube_CommentEntry object. + * @param DOMElement $element (optional) The DOMElement on which to + * base this object. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/CommentFeed.php b/applications/core/lib/Zend/Gdata/YouTube/CommentFeed.php new file mode 100644 index 0000000..02be6fe --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/CommentFeed.php @@ -0,0 +1,65 @@ +<?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 YouTube + * @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'; + +/** + * @see Zend_Gdata_YouTube_CommentEntry + */ +require_once 'Zend/Gdata/YouTube/CommentEntry.php'; + +/** + * The YouTube comments flavor of an Atom Feed + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_CommentFeed extends Zend_Gdata_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_CommentEntry'; + + /** + * Constructs a new YouTube Comment Feed object, to represent + * a feed of comments for an individual video + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/ContactEntry.php b/applications/core/lib/Zend/Gdata/YouTube/ContactEntry.php new file mode 100644 index 0000000..0b10ffb --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/ContactEntry.php @@ -0,0 +1,135 @@ +<?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 YouTube + * @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_YouTube_UserProfileEntry + */ +require_once 'Zend/Gdata/YouTube/UserProfileEntry.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Status + */ +require_once 'Zend/Gdata/YouTube/Extension/Status.php'; + +/** + * The YouTube contacts flavor of an Atom Entry with media support + * Represents a an individual contact + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_ContactEntry extends Zend_Gdata_YouTube_UserProfileEntry +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_ContactEntry'; + + /** + * Status of the user as a contact + * + * @var string + */ + protected $_status = null; + + /** + * Constructs a new Contact Entry object, to represent + * an individual contact for a user + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_status != null) { + $element->appendChild($this->_status->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('yt') . ':' . 'status': + $status = new Zend_Gdata_YouTube_Extension_Status(); + $status->transferFromDOM($child); + $this->_status = $status; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Sets the status + * + * @param Zend_Gdata_YouTube_Extension_Status $status The status + * @return Zend_Gdata_YouTube_ContactEntry Provides a fluent interface + */ + public function setStatus($status = null) + { + $this->_status = $status; + return $this; + } + + /** + * Returns the status + * + * @return Zend_Gdata_YouTube_Extension_Status The status + */ + public function getStatus() + { + return $this->_status; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/ContactFeed.php b/applications/core/lib/Zend/Gdata/YouTube/ContactFeed.php new file mode 100644 index 0000000..5d868fd --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/ContactFeed.php @@ -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 + * @subpackage YouTube + * @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_Media_Feed + */ +require_once 'Zend/Gdata/Media/Feed.php'; + +/** + * @see Zend_Gdata_YouTube_ContactEntry + */ +require_once 'Zend/Gdata/YouTube/ContactEntry.php'; + +/** + * The YouTube contacts flavor of an Atom Feed with media support + * Represents a list of individual contacts, where each contained entry is + * a contact. + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_ContactFeed extends Zend_Gdata_Media_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_ContactEntry'; + + /** + * Constructs a new YouTube Contact Feed object, to represent + * a feed of contacts for a user + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/AboutMe.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/AboutMe.php new file mode 100644 index 0000000..04ef854 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/AboutMe.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:aboutMe element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_AboutMe extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'aboutMe'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Age.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Age.php new file mode 100644 index 0000000..e0925c9 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Age.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:age element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Age extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'age'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Books.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Books.php new file mode 100644 index 0000000..99b1dda --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Books.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:books element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Books extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'books'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Company.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Company.php new file mode 100644 index 0000000..71dcc93 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Company.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:company element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Company extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'company'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Control.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Control.php new file mode 100755 index 0000000..a5ce6aa --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Control.php @@ -0,0 +1,132 @@ +<?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 YouTube + * @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_Control + */ +require_once 'Zend/Gdata/App/Extension/Control.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_State + */ +require_once 'Zend/Gdata/YouTube/Extension/State.php'; + + +/** + * Specialized Control class for use with YouTube. Enables use of yt extension elements. + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Control extends Zend_Gdata_App_Extension_Control +{ + + protected $_state = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Control object. + * @see Zend_Gdata_App_Extension_Control#__construct + * @param Zend_Gdata_App_Extension_Draft $draft + * @param Zend_Gdata_YouTube_Extension_State $state + */ + public function __construct($draft = null, $state = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($draft); + $this->_state = $state; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_state != null) { + $element->appendChild($this->_state->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('yt') . ':' . 'state': + $state = new Zend_Gdata_YouTube_Extension_State(); + $state->transferFromDOM($child); + $this->_state = $state; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value for this element's state attribute. + * + * @return Zend_Gdata_YouTube_Extension_State The state element. + */ + public function getState() + { + return $this->_state; + } + + /** + * Set the value for this element's state attribute. + * + * @param Zend_Gdata_YouTube_Extension_State $value The desired value for this attribute. + * @return Zend_YouTube_Extension_Control The element being modified. + */ + public function setState($value) + { + $this->_state = $value; + return $this; + } + + /** + * Get the value of this element's state attribute. + * + * @return string The state's text value + */ + public function getStateValue() + { + return $this->getState()->getText(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/CountHint.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/CountHint.php new file mode 100755 index 0000000..33ed8b9 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/CountHint.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:countHint element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_CountHint extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'countHint'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Description.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Description.php new file mode 100644 index 0000000..f325fe9 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Description.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:description element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Description extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'description'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Duration.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Duration.php new file mode 100644 index 0000000..bb03fe5 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Duration.php @@ -0,0 +1,125 @@ +<?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 YouTube + * @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 yt:duration element used by the YouTube data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Duration extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'yt'; + protected $_rootElement = 'duration'; + protected $_seconds = null; + + /** + * Constructs a new Zend_Gdata_YouTube_Extension_Duration object. + * @param bool $seconds(optional) The seconds value of the element. + */ + public function __construct($seconds = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_seconds = $seconds; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_seconds !== null) { + $element->setAttribute('seconds', $this->_seconds); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and valueare + * stored in an array. + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'seconds': + $this->_seconds = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's seconds attribute. + * + * @return int The value associated with this attribute. + */ + public function getSeconds() + { + return $this->_seconds; + } + + /** + * Set the value for this element's seconds attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_Duration The element being modified. + */ + public function setSeconds($value) + { + $this->_seconds = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + * + * @return string The duration in seconds + */ + public function __toString() + { + return $this->_seconds; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/FirstName.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/FirstName.php new file mode 100644 index 0000000..b73c695 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/FirstName.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:firstName element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_FirstName extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'firstName'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Gender.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Gender.php new file mode 100644 index 0000000..06c4275 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Gender.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:gender element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Gender extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'gender'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Hobbies.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Hobbies.php new file mode 100644 index 0000000..fc64197 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Hobbies.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:hobbies element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Hobbies extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'hobbies'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Hometown.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Hometown.php new file mode 100644 index 0000000..39fe813 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Hometown.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:hometown element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Hometown extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'hometown'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/LastName.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/LastName.php new file mode 100644 index 0000000..47a19b8 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/LastName.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:lastName element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_LastName extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'lastName'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Link.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Link.php new file mode 100755 index 0000000..b88e8f6 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Link.php @@ -0,0 +1,132 @@ +<?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 YouTube + * @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_Link + */ +require_once 'Zend/Gdata/App/Extension/Link.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Token + */ +require_once 'Zend/Gdata/YouTube/Extension/Token.php'; + + +/** + * Specialized Link class for use with YouTube. Enables use of yt extension elements. + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Link extends Zend_Gdata_App_Extension_Link +{ + + protected $_token = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Link object. + * @see Zend_Gdata_App_Extension_Link#__construct + * @param Zend_Gdata_YouTube_Extension_Token $token + */ + public function __construct($href = null, $rel = null, $type = null, + $hrefLang = null, $title = null, $length = null, $token = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($href, $rel, $type, $hrefLang, $title, $length); + $this->_token = $token; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_token != null) { + $element->appendChild($this->_token->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('yt') . ':' . 'token': + $token = new Zend_Gdata_YouTube_Extension_Token(); + $token->transferFromDOM($child); + $this->_token = $token; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value for this element's token attribute. + * + * @return Zend_Gdata_YouTube_Extension_Token The token element. + */ + public function getToken() + { + return $this->_token; + } + + /** + * Set the value for this element's token attribute. + * + * @param Zend_Gdata_YouTube_Extension_Token $value The desired value for this attribute. + * @return Zend_YouTube_Extension_Link The element being modified. + */ + public function setToken($value) + { + $this->_token = $value; + return $this; + } + + /** + * Get the value of this element's token attribute. + * + * @return string The token's text value + */ + public function getTokenValue() + { + return $this->getToken()->getText(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Location.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Location.php new file mode 100644 index 0000000..3eb4d3a --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Location.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:location element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Location extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'location'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaContent.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaContent.php new file mode 100755 index 0000000..f334728 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaContent.php @@ -0,0 +1,119 @@ +<?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 YouTube + * @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_Media_Extension_MediaContent + */ +require_once 'Zend/Gdata/Media/Extension/MediaContent.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 + * @subpackage YouTube + * @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_YouTube_Extension_MediaContent extends Zend_Gdata_Media_Extension_MediaContent +{ + protected $_rootElement = 'content'; + protected $_rootNamespace = 'media'; + + /* + * Format of the video + * Optional. + * + * @var int + */ + protected $_format = null; + + + function __construct() { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_format!= null) { + $element->setAttributeNS($this->lookupNamespace('yt'), 'yt:format', $this->_format); + } + 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) + { + $absoluteAttrName = $attribute->namespaceURI . ':' . $attribute->localName; + if ($absoluteAttrName == $this->lookupNamespace('yt') . ':' . 'format') { + $this->_format = $attribute->nodeValue; + } else { + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Returns the format of the media + * Optional. + * + * @return int The format of the media + */ + public function getFormat() + { + return $this->_format; + } + + /** + * Sets the format of the media + * + * @param int $value Format of the media + * @return Zend_Gdata_YouTube_Extension_MediaContent Provides a fluent interface + * + */ + public function setFormat($value) + { + $this->_format = $value; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaCredit.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaCredit.php new file mode 100644 index 0000000..cf554a9 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaCredit.php @@ -0,0 +1,188 @@ +<?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 Media + * @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 YouTube specific media:credit element + * + * @category Zend + * @package Zend_Gdata + * @subpackage Media + * @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_YouTube_Extension_MediaCredit extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'credit'; + protected $_rootNamespace = 'media'; + + /** + * @var string + */ + protected $_role = null; + + /** + * @var string + */ + protected $_scheme = null; + + /** + * Represents the value of the yt:type attribute. + * + * Set to 'partner' if the uploader of this video is a YouTube + * partner. + * + * @var string + */ + protected $_yttype = null; + + /** + * Creates an individual MediaCredit object. + * + * @param string $text + * @param string $role + * @param string $scheme + */ + public function __construct($text = null, $role = null, $scheme = null, + $yttype = null) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + parent::__construct(); + $this->_text = $text; + $this->_role = $role; + $this->_scheme = $scheme; + $this->_yttype = $yttype; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_role !== null) { + $element->setAttribute('role', $this->_role); + } + if ($this->_scheme !== null) { + $element->setAttribute('scheme', $this->_scheme); + } + if ($this->_yttype !== null) { + $element->setAttributeNS('http://gdata.youtube.com/schemas/2007', + 'yt:type', $this->_yttype); + } + 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; + case 'type': + $this->_yttype = $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; + } + + /** + * @return string + */ + public function getYTtype() + { + return $this->_yttype; + } + + /** + * @param string $value + * @return Zend_Gdata_Media_Extension_MediaCredit Provides a fluent + * interface + */ + public function setYTtype($value) + { + $this->_yttype = $value; + return $this; + } + +}
\ No newline at end of file diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaGroup.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaGroup.php new file mode 100755 index 0000000..135be16 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaGroup.php @@ -0,0 +1,335 @@ +<?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 YouTube + * @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_Media_Extension_MediaGroup + */ +require_once 'Zend/Gdata/Media/Extension/MediaGroup.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_MediaContent + */ +require_once 'Zend/Gdata/YouTube/Extension/MediaContent.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Duration + */ +require_once 'Zend/Gdata/YouTube/Extension/Duration.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_MediaRating + */ +require_once 'Zend/Gdata/YouTube/Extension/MediaRating.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_MediaCredit + */ +require_once 'Zend/Gdata/YouTube/Extension/MediaCredit.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Private + */ +require_once 'Zend/Gdata/YouTube/Extension/Private.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_VideoId + */ +require_once 'Zend/Gdata/YouTube/Extension/VideoId.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Uploaded + */ +require_once 'Zend/Gdata/YouTube/Extension/Uploaded.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 + * @subpackage YouTube + * @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_YouTube_Extension_MediaGroup extends Zend_Gdata_Media_Extension_MediaGroup +{ + + protected $_rootElement = 'group'; + protected $_rootNamespace = 'media'; + + /** + * @var Zend_Gdata_YouTube_Extension_Duration + */ + protected $_duration = null; + + /** + * @var Zend_Gdata_YouTube_Extension_Private + */ + protected $_private = null; + + /** + * @var Zend_Gdata_YouTube_Extension_VideoId + */ + protected $_videoid = null; + + /** + * @var Zend_Gdata_YouTube_Extension_MediaRating + */ + protected $_mediarating = null; + + /** + * @var Zend_Gdata_YouTube_Extension_MediaCredit + */ + protected $_mediacredit = null; + + /** + * @var Zend_Gdata_YouTube_Extension_Uploaded + */ + protected $_uploaded = null; + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_duration !== null) { + $element->appendChild( + $this->_duration->getDOM($element->ownerDocument)); + } + if ($this->_private !== null) { + $element->appendChild( + $this->_private->getDOM($element->ownerDocument)); + } + if ($this->_videoid != null) { + $element->appendChild( + $this->_videoid->getDOM($element->ownerDocument)); + } + if ($this->_uploaded != null) { + $element->appendChild( + $this->_uploaded->getDOM($element->ownerDocument)); + } + if ($this->_mediacredit != null) { + $element->appendChild( + $this->_mediacredit->getDOM($element->ownerDocument)); + } + if ($this->_mediarating != null) { + $element->appendChild( + $this->_mediarating->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_YouTube_Extension_MediaContent(); + $content->transferFromDOM($child); + $this->_content[] = $content; + break; + case $this->lookupNamespace('media') . ':' . 'rating': + $mediarating = new Zend_Gdata_YouTube_Extension_MediaRating(); + $mediarating->transferFromDOM($child); + $this->_mediarating = $mediarating; + break; + case $this->lookupNamespace('media') . ':' . 'credit': + $mediacredit = new Zend_Gdata_YouTube_Extension_MediaCredit(); + $mediacredit->transferFromDOM($child); + $this->_mediacredit = $mediacredit; + break; + case $this->lookupNamespace('yt') . ':' . 'duration': + $duration = new Zend_Gdata_YouTube_Extension_Duration(); + $duration->transferFromDOM($child); + $this->_duration = $duration; + break; + case $this->lookupNamespace('yt') . ':' . 'private': + $private = new Zend_Gdata_YouTube_Extension_Private(); + $private->transferFromDOM($child); + $this->_private = $private; + break; + case $this->lookupNamespace('yt') . ':' . 'videoid': + $videoid = new Zend_Gdata_YouTube_Extension_VideoId(); + $videoid ->transferFromDOM($child); + $this->_videoid = $videoid; + break; + case $this->lookupNamespace('yt') . ':' . 'uploaded': + $uploaded = new Zend_Gdata_YouTube_Extension_Uploaded(); + $uploaded ->transferFromDOM($child); + $this->_uploaded = $uploaded; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Returns the duration value of this element + * + * @return Zend_Gdata_YouTube_Extension_Duration + */ + public function getDuration() + { + return $this->_duration; + } + + /** + * Sets the duration value of this element + * + * @param Zend_Gdata_YouTube_Extension_Duration $value The duration value + * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent + * interface + */ + public function setDuration($value) + { + $this->_duration = $value; + return $this; + } + + /** + * Returns the videoid value of this element + * + * @return Zend_Gdata_YouTube_Extension_VideoId + */ + public function getVideoId() + { + return $this->_videoid; + } + + /** + * Sets the videoid value of this element + * + * @param Zend_Gdata_YouTube_Extension_VideoId $value The video id value + * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent + * interface + */ + public function setVideoId($value) + { + $this->_videoid = $value; + return $this; + } + + /** + * Returns the yt:uploaded element + * + * @return Zend_Gdata_YouTube_Extension_Uploaded + */ + public function getUploaded() + { + return $this->_uploaded; + } + + /** + * Sets the yt:uploaded element + * + * @param Zend_Gdata_YouTube_Extension_Uploaded $value The uploaded value + * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent + * interface + */ + public function setUploaded($value) + { + $this->_uploaded = $value; + return $this; + } + + /** + * Returns the private value of this element + * + * @return Zend_Gdata_YouTube_Extension_Private + */ + public function getPrivate() + { + return $this->_private; + } + + /** + * Sets the private value of this element + * + * @param Zend_Gdata_YouTube_Extension_Private $value The private value + * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent + * interface + */ + public function setPrivate($value) + { + $this->_private = $value; + return $this; + } + + /** + * Returns the rating value of this element + * + * @return Zend_Gdata_YouTube_Extension_MediaRating + */ + public function getMediaRating() + { + return $this->_mediarating; + } + + /** + * Sets the media:rating value of this element + * + * @param Zend_Gdata_YouTube_Extension_MediaRating $value The rating element + * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent + * interface + */ + public function setMediaRating($value) + { + $this->_mediarating = $value; + return $this; + } + + /** + * Returns the media:credit value of this element + * + * @return Zend_Gdata_YouTube_Extension_MediaCredit + */ + public function getMediaCredit() + { + return $this->_mediacredit; + } + + /** + * Sets the media:credit value of this element + * + * @param Zend_Gdata_YouTube_Extension_MediaCredit $value The credit element + * @return Zend_Gdata_YouTube_Extension_MediaGroup Provides a fluent + * interface + */ + public function setMediaCredit($value) + { + $this->_mediacredit = $value; + return $this; + } +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaRating.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaRating.php new file mode 100755 index 0000000..17d924e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/MediaRating.php @@ -0,0 +1,149 @@ +<?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 Media + * @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:rating element specific to YouTube. + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_MediaRating extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'rating'; + protected $_rootNamespace = 'media'; + + /** + * @var string + */ + protected $_scheme = null; + + /** + * @var string + */ + protected $_country = null; + + /** + * Constructs a new MediaRating element + * + * @param string $text + * @param string $scheme + * @param string $country + */ + public function __construct($text = null, $scheme = null, $country = null) + { + $this->registerAllNamespaces(Zend_Gdata_Media::$namespaces); + parent::__construct(); + $this->_scheme = $scheme; + $this->_country = $country; + $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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_scheme !== null) { + $element->setAttribute('scheme', $this->_scheme); + } + if ($this->_country != null) { + $element->setAttribute('country', $this->_country); + } + 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 'country': + $this->_country = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * @return string + */ + public function getScheme() + { + return $this->_scheme; + } + + /** + * @param string $value + * @return Zend_Gdata_YouTube_Extension_MediaRating Provides a fluent interface + */ + public function setScheme($value) + { + $this->_scheme = $value; + return $this; + } + + /** + * @return string + */ + public function getCountry() + { + return $this->_country; + } + + /** + * @param string $value + * @return Zend_Gdata_YouTube_Extension_MediaRating Provides a fluent interface + */ + public function setCountry($value) + { + $this->_country = $value; + return $this; + } + + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Movies.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Movies.php new file mode 100644 index 0000000..3f73cd1 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Movies.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:movies element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Movies extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'movies'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Music.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Music.php new file mode 100644 index 0000000..72fb5db --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Music.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:music element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Music extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'music'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/NoEmbed.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/NoEmbed.php new file mode 100644 index 0000000..b5432c3 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/NoEmbed.php @@ -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 + * @subpackage YouTube + * @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 yt:noembed element used by the YouTube data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_NoEmbed extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'yt'; + protected $_rootElement = 'noembed'; + + /** + * Constructs a new Zend_Gdata_YouTube_Extension_VideoShare object. + * @param bool $enabled(optional) The enabled value of the element. + */ + public function __construct($enabled = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Occupation.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Occupation.php new file mode 100644 index 0000000..b2beda1 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Occupation.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:occupation element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Occupation extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'occupation'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/PlaylistId.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/PlaylistId.php new file mode 100644 index 0000000..609acfe --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/PlaylistId.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:playlistId element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_PlaylistId extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'playlistId'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/PlaylistTitle.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/PlaylistTitle.php new file mode 100644 index 0000000..e193c6b --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/PlaylistTitle.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:playlistTitle element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_PlaylistTitle extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'playlistTitle'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Position.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Position.php new file mode 100644 index 0000000..936cc22 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Position.php @@ -0,0 +1,89 @@ +<?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 YouTube + * @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 playlist item's position in the list (yt:position) + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Position extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'position'; + protected $_rootNamespace = 'yt'; + + /** + * Constructs a new Zend_Gdata_YouTube_Extension_Position object. + * + * @param string $value (optional) The 1-based position in the playlist + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $value; + } + + /** + * Get the value for the position in the playlist + * + * @return int The 1-based position in the playlist + */ + public function getValue() + { + return $this->_text; + } + + /** + * Set the value for the position in the playlist + * + * @param int $value The 1-based position in the playlist + * @return Zend_Gdata_Extension_Visibility The element being modified + */ + public function setValue($value) + { + $this->_text = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + * + * @return string + */ + public function __toString() + { + return $this->getValue(); + } + +} + diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Private.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Private.php new file mode 100755 index 0000000..d108a1b --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Private.php @@ -0,0 +1,80 @@ +<?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 YouTube + * @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 yt:private element used by the YouTube data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Private extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'yt'; + protected $_rootElement = 'private'; + + /** + * Constructs a new Zend_Gdata_YouTube_Extension_Private object. + */ + public function __construct() + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and valueare + * stored in an array. + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + parent::takeAttributeFromDOM($attribute); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/QueryString.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/QueryString.php new file mode 100644 index 0000000..76a1ed2 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/QueryString.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:queryString element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_QueryString extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'queryString'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Racy.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Racy.php new file mode 100644 index 0000000..c13c59e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Racy.php @@ -0,0 +1,123 @@ +<?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 YouTube + * @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 yt:racy element used by the YouTube data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Racy extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'yt'; + protected $_rootElement = 'racy'; + protected $_state = null; + + /** + * Constructs a new Zend_Gdata_YouTube_Extension_Racy object. + * @param bool $state(optional) The state value of the element. + */ + public function __construct($state = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_state = $state; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_state !== null) { + $element->setAttribute('state', $this->_state); + } + 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 'state': + $this->_state = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's state attribute. + * + * @return bool The value associated with this attribute. + */ + public function getState() + { + return $this->_state; + } + + /** + * Set the value for this element's state attribute. + * + * @param bool $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_Racy The element being modified. + */ + public function setState($value) + { + $this->_state = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->_state; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Recorded.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Recorded.php new file mode 100644 index 0000000..8405074 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Recorded.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:recorded element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Recorded extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'recorded'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Relationship.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Relationship.php new file mode 100644 index 0000000..322c179 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Relationship.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:relationship element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Relationship extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'relationship'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/ReleaseDate.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/ReleaseDate.php new file mode 100644 index 0000000..965c346 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/ReleaseDate.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:releaseDate element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_ReleaseDate extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'releaseDate'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/School.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/School.php new file mode 100644 index 0000000..a1c55ac --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/School.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:school element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_School extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'school'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/State.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/State.php new file mode 100644 index 0000000..720e8ad --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/State.php @@ -0,0 +1,192 @@ +<?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 YouTube + * @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 yt:state element used by the YouTube data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_State extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'yt'; + protected $_rootElement = 'state'; + protected $_name = null; + protected $_reasonCode = null; + protected $_helpUrl = null; + + /** + * Constructs a new Zend_Gdata_YouTube_Extension_State object. + * + * @param string $explanation(optional) The explanation of this state + * @param string $name(optional) The name value + * @param string $reasonCode(optional) The reasonCode value + * @param string $helpUrl(optional) The helpUrl value + */ + public function __construct($explanation = null, $name = null, + $reasonCode = null, $helpUrl = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $explanation; + $this->_name = $name; + $this->_reasonCode = $reasonCode; + $this->_helpUrl = $reasonCode; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_name !== null) { + $element->setAttribute('name', $this->_name); + } + if ($this->_reasonCode !== null) { + $element->setAttribute('reasonCode', $this->_reasonCode); + } + if ($this->_helpUrl !== null) { + $element->setAttribute('helpUrl', $this->_helpUrl); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and valueare + * stored in an array. + * TODO: Convert attributes to proper types + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'name': + $this->_name = $attribute->nodeValue; + break; + case 'reasonCode': + $this->_reasonCode = $attribute->nodeValue; + break; + case 'helpUrl': + $this->_helpUrl = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's name attribute. + * + * @return int The value associated with this attribute. + */ + public function getName() + { + return $this->_name; + } + + /** + * Set the value for this element's name attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_State The element being modified. + */ + public function setName($value) + { + $this->_name = $value; + return $this; + } + + /** + * Get the value for this element's reasonCode attribute. + * + * @return int The value associated with this attribute. + */ + public function getReasonCode() + { + return $this->_reasonCode; + } + + /** + * Set the value for this element's reasonCode attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_State The element being modified. + */ + public function setReasonCode($value) + { + $this->_reasonCode = $value; + return $this; + } + + /** + * Get the value for this element's helpUrl attribute. + * + * @return int The value associated with this attribute. + */ + public function getHelpUrl() + { + return $this->_helpUrl; + } + + /** + * Set the value for this element's helpUrl attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_State The element being modified. + */ + public function setHelpUrl($value) + { + $this->_helpUrl = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + * + * @return string + */ + public function __toString() + { + return $this->_text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Statistics.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Statistics.php new file mode 100644 index 0000000..ec450ff --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Statistics.php @@ -0,0 +1,308 @@ +<?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 YouTube + * @copyright Copyright (c) 2005-2009 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 yt:statistics element used by the YouTube data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_YouTube_Extension_Statistics extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'yt'; + protected $_rootElement = 'statistics'; + + /** + * The videoWatchCount attribute specifies the number of videos + * that a user has watched on YouTube. The videoWatchCount attribute + * is only specified when the <yt:statistics> tag appears within a + * user profile entry. + * + * @var integer + */ + protected $_videoWatchCount = null; + + /** + * When the viewCount attribute refers to a video entry, the attribute + * specifies the number of times that the video has been viewed. + * When the viewCount attribute refers to a user profile, the attribute + * specifies the number of times that the user's profile has been + * viewed. + * + * @var integer + */ + protected $_viewCount = null; + + /** + * The subscriberCount attribute specifies the number of YouTube users + * who have subscribed to a particular user's YouTube channel. + * The subscriberCount attribute is only specified when the + * <yt:statistics> tag appears within a user profile entry. + * + * @var integer + */ + protected $_subscriberCount = null; + + /** + * The lastWebAccess attribute indicates the most recent time that + * a particular user used YouTube. + * + * @var string + */ + protected $_lastWebAccess = null; + + /** + * The favoriteCount attribute specifies the number of YouTube users + * who have added a video to their list of favorite videos. The + * favoriteCount attribute is only specified when the + * <yt:statistics> tag appears within a video entry. + * + * @var integer + */ + protected $_favoriteCount = null; + + /** + * Constructs a new Zend_Gdata_YouTube_Extension_Statistics object. + * @param string $viewCount(optional) The viewCount value + * @param string $videoWatchCount(optional) The videoWatchCount value + * @param string $subscriberCount(optional) The subscriberCount value + * @param string $lastWebAccess(optional) The lastWebAccess value + * @param string $favoriteCount(optional) The favoriteCount value + */ + public function __construct($viewCount = null, $videoWatchCount = null, + $subscriberCount = null, $lastWebAccess = null, + $favoriteCount = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_viewCount = $viewCount; + $this->_videoWatchCount = $videoWatchCount; + $this->_subscriberCount = $subscriberCount; + $this->_lastWebAccess = $lastWebAccess; + $this->_favoriteCount = $favoriteCount; + } + + /** + * 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_videoWatchCount !== null) { + $element->setAttribute('watchCount', $this->_videoWatchCount); + } + if ($this->_viewCount !== null) { + $element->setAttribute('viewCount', $this->_viewCount); + } + if ($this->_subscriberCount !== null) { + $element->setAttribute('subscriberCount', + $this->_subscriberCount); + } + if ($this->_lastWebAccess !== null) { + $element->setAttribute('lastWebAccess', + $this->_lastWebAccess); + } + if ($this->_favoriteCount !== null) { + $element->setAttribute('favoriteCount', + $this->_favoriteCount); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and valueare + * stored in an array. + * TODO: Convert attributes to proper types + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'videoWatchCount': + $this->_videoWatchCount = $attribute->nodeValue; + break; + case 'viewCount': + $this->_viewCount = $attribute->nodeValue; + break; + case 'subscriberCount': + $this->_subscriberCount = $attribute->nodeValue; + break; + case 'lastWebAccess': + $this->_lastWebAccess = $attribute->nodeValue; + break; + case 'favoriteCount': + $this->_favoriteCount = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's viewCount attribute. + * + * @return int The value associated with this attribute. + */ + public function getViewCount() + { + return $this->_viewCount; + } + + /** + * Set the value for this element's viewCount attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_Statistics The element being + * modified. + */ + public function setViewCount($value) + { + $this->_viewCount = $value; + return $this; + } + + /** + * Get the value for this element's videoWatchCount attribute. + * + * @return int The value associated with this attribute. + */ + public function getVideoWatchCount() + { + return $this->_videoWatchCount; + } + + /** + * Set the value for this element's videoWatchCount attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_Statistics The element being + * modified. + */ + public function setVideoWatchCount($value) + { + $this->_videoWatchCount = $value; + return $this; + } + + /** + * Get the value for this element's subscriberCount attribute. + * + * @return int The value associated with this attribute. + */ + public function getSubscriberCount() + { + return $this->_subscriberCount; + } + + /** + * Set the value for this element's subscriberCount attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_Statistics The element being + * modified. + */ + public function setSubscriberCount($value) + { + $this->_subscriberCount = $value; + return $this; + } + + /** + * Get the value for this element's lastWebAccess attribute. + * + * @return int The value associated with this attribute. + */ + public function getLastWebAccess() + { + return $this->_lastWebAccess; + } + + /** + * Set the value for this element's lastWebAccess attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_Statistics The element being + * modified. + */ + public function setLastWebAccess($value) + { + $this->_lastWebAccess = $value; + return $this; + } + + /** + * Get the value for this element's favoriteCount attribute. + * + * @return int The value associated with this attribute. + */ + public function getFavoriteCount() + { + return $this->_favoriteCount; + } + + /** + * Set the value for this element's favoriteCount attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_YouTube_Extension_Statistics The element being + * modified. + */ + public function setFavoriteCount($value) + { + $this->_favoriteCount = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + * + * @return string + */ + public function __toString() + { + return 'View Count=' . $this->_viewCount . + ' VideoWatchCount=' . $this->_videoWatchCount . + ' SubscriberCount=' . $this->_subscriberCount . + ' LastWebAccess=' . $this->_lastWebAccess . + ' FavoriteCount=' . $this->_favoriteCount; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Status.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Status.php new file mode 100644 index 0000000..7d0d638 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Status.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:status element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Status extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'status'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Token.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Token.php new file mode 100755 index 0000000..2459dff --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Token.php @@ -0,0 +1,69 @@ +<?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 YouTube + * @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 yt:token element used by the YouTube data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Token extends Zend_Gdata_App_Extension +{ + + protected $_rootNamespace = 'yt'; + protected $_rootElement = 'token'; + + /** + * Constructs a new Zend_Gdata_YouTube_Extension_Token object. + */ + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + return $element; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Uploaded.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Uploaded.php new file mode 100644 index 0000000..db92b18 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Uploaded.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:uploaded element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Uploaded extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'uploaded'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/Username.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/Username.php new file mode 100644 index 0000000..72da8a7 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/Username.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:username element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_Username extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'username'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/Extension/VideoId.php b/applications/core/lib/Zend/Gdata/YouTube/Extension/VideoId.php new file mode 100644 index 0000000..522a975 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/Extension/VideoId.php @@ -0,0 +1,50 @@ +<?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 YouTube + * @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 yt:videoid element + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_Extension_VideoId extends Zend_Gdata_Extension +{ + + protected $_rootElement = 'videoid'; + protected $_rootNamespace = 'yt'; + + public function __construct($text = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct(); + $this->_text = $text; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/InboxEntry.php b/applications/core/lib/Zend/Gdata/YouTube/InboxEntry.php new file mode 100644 index 0000000..8efc8d7 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/InboxEntry.php @@ -0,0 +1,280 @@ +<?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 YouTube + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ + +/** + * @see Zend_Gdata_Media_Entry + */ +require_once 'Zend/Gdata/Media/Entry.php'; + +/** + * @see Zend_Gdata_Extension_Rating + */ +require_once 'Zend/Gdata/Extension/Rating.php'; + +/** + * @see Zend_Gdata_Extension_Comments + */ +require_once 'Zend/Gdata/Extension/Comments.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Statistics + */ +require_once 'Zend/Gdata/YouTube/Extension/Statistics.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Description + */ +require_once 'Zend/Gdata/YouTube/Extension/Description.php'; + + +/** + * Represents the YouTube message flavor of an Atom entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_YouTube_InboxEntry extends Zend_Gdata_Media_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_YouTube_InboxEntry'; + + /** + * The gd:comments element of this entry. + * + * @var Zend_Gdata_Extension_Comments + */ + protected $_comments = null; + + /** + * The gd:rating element of this entry. + * + * @var Zend_Gdata_Extension_Rating + */ + protected $_rating = null; + + /** + * The yt:statistics element of this entry. + * + * @var Zend_Gdata_YouTube_Extension_Statistics + */ + protected $_statistics = null; + + /** + * The yt:description element of this entry. + * + * @var Zend_Gdata_YouTube_Extension_Description + */ + protected $_description = null; + + /** + * Creates a subscription entry, representing an individual subscription + * in a list of subscriptions, usually associated with an individual user. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_description != null) { + $element->appendChild( + $this->_description->getDOM($element->ownerDocument)); + } + if ($this->_rating != null) { + $element->appendChild( + $this->_rating->getDOM($element->ownerDocument)); + } + if ($this->_statistics != null) { + $element->appendChild( + $this->_statistics->getDOM($element->ownerDocument)); + } + if ($this->_comments != null) { + $element->appendChild( + $this->_comments->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('gd') . ':' . 'comments': + $comments = new Zend_Gdata_Extension_Comments(); + $comments->transferFromDOM($child); + $this->_comments = $comments; + break; + case $this->lookupNamespace('gd') . ':' . 'rating': + $rating = new Zend_Gdata_Extension_Rating(); + $rating->transferFromDOM($child); + $this->_rating = $rating; + break; + case $this->lookupNamespace('yt') . ':' . 'description': + $description = new Zend_Gdata_YouTube_Extension_Description(); + $description->transferFromDOM($child); + $this->_description = $description; + break; + case $this->lookupNamespace('yt') . ':' . 'statistics': + $statistics = new Zend_Gdata_YouTube_Extension_Statistics(); + $statistics->transferFromDOM($child); + $this->_statistics = $statistics; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the yt:description + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_Description|null + */ + public function getDescription() + { + if ($this->getMajorProtocolVersion() == 2) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The getDescription ' . + ' method is only supported in version 1 of the YouTube ' . + 'API.'); + } else { + return $this->_description; + } + } + + /** + * Sets the yt:description element for a new inbox entry. + * + * @param Zend_Gdata_YouTube_Extension_Description $description The + * description. + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_InboxEntry Provides a fluent interface + */ + public function setDescription($description = null) + { + if ($this->getMajorProtocolVersion() == 2) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The setDescription ' . + ' method is only supported in version 1 of the YouTube ' . + 'API.'); + } else { + $this->_description = $description; + return $this; + } + } + + /** + * Get the gd:rating element for the inbox entry + * + * @return Zend_Gdata_Extension_Rating|null + */ + public function getRating() + { + return $this->_rating; + } + + /** + * Sets the gd:rating element for the inbox entry + * + * @param Zend_Gdata_Extension_Rating $rating The rating for the video in + * the message + * @return Zend_Gdata_YouTube_InboxEntry Provides a fluent interface + */ + public function setRating($rating = null) + { + $this->_rating = $rating; + return $this; + } + + /** + * Get the gd:comments element of the inbox entry. + * + * @return Zend_Gdata_Extension_Comments|null + */ + public function getComments() + { + return $this->_comments; + } + + /** + * Sets the gd:comments element for the inbox entry + * + * @param Zend_Gdata_Extension_Comments $comments The comments feed link + * @return Zend_Gdata_YouTube_InboxEntry Provides a fluent interface + */ + public function setComments($comments = null) + { + $this->_comments = $comments; + return $this; + } + + /** + * Get the yt:statistics element for the inbox entry + * + * @return Zend_Gdata_YouTube_Extension_Statistics|null + */ + public function getStatistics() + { + return $this->_statistics; + } + + /** + * Sets the yt:statistics element for the inbox entry + * + * @param Zend_Gdata_YouTube_Extension_Statistics $statistics The + * statistics element for the video in the message + * @return Zend_Gdata_YouTube_InboxEntry Provides a fluent interface + */ + public function setStatistics($statistics = null) + { + $this->_statistics = $statistics; + return $this; + } + + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/InboxFeed.php b/applications/core/lib/Zend/Gdata/YouTube/InboxFeed.php new file mode 100644 index 0000000..2b5a593 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/InboxFeed.php @@ -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 + * @subpackage YouTube + * @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_Media_Feed + */ +require_once 'Zend/Gdata/Media/Feed.php'; + +/** + * @see Zend_Gdata_YouTube_InboxEntry + */ +require_once 'Zend/Gdata/YouTube/InboxEntry.php'; + +/** + * The YouTube inbox feed list flavor of an Atom Feed with media support + * Represents a list of individual inbox entries, where each contained entry is + * a message. + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_InboxFeed extends Zend_Gdata_Media_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_InboxEntry'; + + /** + * Creates an Inbox feed, representing a list of messages, + * associated with an individual user. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/MediaEntry.php b/applications/core/lib/Zend/Gdata/YouTube/MediaEntry.php new file mode 100755 index 0000000..09540b9 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/MediaEntry.php @@ -0,0 +1,80 @@ +<?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 YouTube + * @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_Media + */ +require_once 'Zend/Gdata/Media.php'; + +/** + * @see Zend_Gdata_Media_Entry + */ +require_once 'Zend/Gdata/Media/Entry.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_MediaGroup + */ +require_once 'Zend/Gdata/YouTube/Extension/MediaGroup.php'; + +/** + * Represents the YouTube flavor of a Gdata Media Entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_MediaEntry extends Zend_Gdata_Media_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_YouTube_MediaEntry'; + + /** + * media:group element + * + * @var Zend_Gdata_YouTube_Extension_MediaGroup + */ + protected $_mediaGroup = null; + + /** + * 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_YouTube_Extension_MediaGroup(); + $mediaGroup->transferFromDOM($child); + $this->_mediaGroup = $mediaGroup; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/PlaylistListEntry.php b/applications/core/lib/Zend/Gdata/YouTube/PlaylistListEntry.php new file mode 100644 index 0000000..4b15a38 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/PlaylistListEntry.php @@ -0,0 +1,299 @@ +<?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 YouTube + * @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_YouTube + */ +require_once 'Zend/Gdata/YouTube.php'; + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/Entry.php'; + +/** + * @see Zend_Gdata_Extension_FeedLink + */ +require_once 'Zend/Gdata/Extension/FeedLink.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Description + */ +require_once 'Zend/Gdata/YouTube/Extension/Description.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_PlaylistId + */ +require_once 'Zend/Gdata/YouTube/Extension/PlaylistId.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_CountHint + */ +require_once 'Zend/Gdata/YouTube/Extension/CountHint.php'; + +/** + * Represents the YouTube video playlist flavor of an Atom entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_PlaylistListEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_YouTube_PlaylistListEntry'; + + /** + * Nested feed links + * + * @var array + */ + protected $_feedLink = array(); + + /** + * Description of this playlist + * + * @deprecated Deprecated as of version 2 of the YouTube API. + * @var Zend_Gdata_YouTube_Extension_Description + */ + protected $_description = null; + + /** + * Id of this playlist + * + * @var Zend_Gdata_YouTube_Extension_PlaylistId + */ + protected $_playlistId = null; + + /** + * CountHint for this playlist. + * + * @var Zend_Gdata_YouTube_Extension_CountHint + */ + protected $_countHint = null; + + /** + * Creates a Playlist list entry, representing an individual playlist + * in a list of playlists, usually associated with an individual user. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_description != null) { + $element->appendChild($this->_description->getDOM($element->ownerDocument)); + } + if ($this->_countHint != null) { + $element->appendChild($this->_countHint->getDOM($element->ownerDocument)); + } + if ($this->_playlistId != null) { + $element->appendChild($this->_playlistId->getDOM($element->ownerDocument)); + } + if ($this->_feedLink != null) { + foreach ($this->_feedLink as $feedLink) { + $element->appendChild($feedLink->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('yt') . ':' . 'description': + $description = new Zend_Gdata_YouTube_Extension_Description(); + $description->transferFromDOM($child); + $this->_description = $description; + break; + case $this->lookupNamespace('yt') . ':' . 'countHint': + $countHint = new Zend_Gdata_YouTube_Extension_CountHint(); + $countHint->transferFromDOM($child); + $this->_countHint = $countHint; + break; + case $this->lookupNamespace('yt') . ':' . 'playlistId': + $playlistId = new Zend_Gdata_YouTube_Extension_PlaylistId(); + $playlistId->transferFromDOM($child); + $this->_playlistId = $playlistId; + break; + case $this->lookupNamespace('gd') . ':' . 'feedLink': + $feedLink = new Zend_Gdata_Extension_FeedLink(); + $feedLink->transferFromDOM($child); + $this->_feedLink[] = $feedLink; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Sets the description relating to the playlist. + * + * @deprecated Deprecated as of version 2 of the YouTube API. + * @param Zend_Gdata_YouTube_Extension_Description $description The description relating to the video + * @return Zend_Gdata_YouTube_PlaylistListEntry Provides a fluent interface + */ + public function setDescription($description = null) + { + if ($this->getMajorProtocolVersion() >= 2) { + $this->setSummary($description); + } else { + $this->_description = $description; + } + return $this; + } + + /** + * Returns the description relating to the video. + * + * @return Zend_Gdata_YouTube_Extension_Description The description + * relating to the video + */ + public function getDescription() + { + if ($this->getMajorProtocolVersion() >= 2) { + return $this->getSummary(); + } else { + return $this->_description; + } + } + + /** + * Returns the countHint relating to the playlist. + * + * The countHint is the number of videos on a playlist. + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_CountHint The count of videos on + * a playlist. + */ + public function getCountHint() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The yt:countHint ' . + 'element is not supported in versions earlier than 2.'); + } else { + return $this->_countHint; + } + } + + /** + * Returns the Id relating to the playlist. + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_PlaylistId The id of this playlist. + */ + public function getPlaylistId() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The yt:playlistId ' . + 'element is not supported in versions earlier than 2.'); + } else { + return $this->_playlistId; + } + } + + /** + * Sets the array of embedded feeds related to the playlist + * + * @param array $feedLink The array of embedded feeds relating to the video + * @return Zend_Gdata_YouTube_PlaylistListEntry Provides a fluent interface + */ + public function setFeedLink($feedLink = null) + { + $this->_feedLink = $feedLink; + return $this; + } + + /** + * Get the feed link property for this entry. + * + * @see setFeedLink + * @param string $rel (optional) The rel value of the link to be found. + * If null, the array of links is returned. + * @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink + * object corresponding to the requested rel value is returned + * if found, or null if the requested value is not found. If + * $rel is null or not specified, an array of all available + * feed links for this entry is returned, or null if no feed + * links are set. + */ + public function getFeedLink($rel = null) + { + if ($rel == null) { + return $this->_feedLink; + } else { + foreach ($this->_feedLink as $feedLink) { + if ($feedLink->rel == $rel) { + return $feedLink; + } + } + return null; + } + } + + /** + * Returns the URL of the playlist video feed + * + * @return string The URL of the playlist video feed + */ + public function getPlaylistVideoFeedUrl() + { + if ($this->getMajorProtocolVersion() >= 2) { + return $this->getContent()->getSrc(); + } else { + return $this->getFeedLink(Zend_Gdata_YouTube::PLAYLIST_REL)->href; + } + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/PlaylistListFeed.php b/applications/core/lib/Zend/Gdata/YouTube/PlaylistListFeed.php new file mode 100644 index 0000000..69e3c84 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/PlaylistListFeed.php @@ -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 + * @subpackage YouTube + * @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_Media_Feed + */ +require_once 'Zend/Gdata/Media/Feed.php'; + +/** + * @see Zend_Gdata_YouTube_PlaylistListEntry + */ +require_once 'Zend/Gdata/YouTube/PlaylistListEntry.php'; + +/** + * The YouTube video playlist flavor of an Atom Feed with media support + * Represents a list of individual playlists, where each contained entry is + * a playlist. + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_PlaylistListFeed extends Zend_Gdata_Media_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_PlaylistListEntry'; + + /** + * Creates a Playlist list feed, representing a list of playlists, + * usually associated with an individual user. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/PlaylistVideoEntry.php b/applications/core/lib/Zend/Gdata/YouTube/PlaylistVideoEntry.php new file mode 100644 index 0000000..5f2e5b4 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/PlaylistVideoEntry.php @@ -0,0 +1,131 @@ +<?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 YouTube + * @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_YouTube_VideoEntry + */ +require_once 'Zend/Gdata/YouTube/VideoEntry.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Position + */ +require_once 'Zend/Gdata/YouTube/Extension/Position.php'; + +/** + * Represents the YouTube video playlist flavor of an Atom entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_PlaylistVideoEntry extends Zend_Gdata_YouTube_VideoEntry +{ + + protected $_entryClassName = 'Zend_Gdata_YouTube_PlaylistVideoEntry'; + + /** + * Position of the entry in the feed, as specified by the user + * + * @var Zend_Gdata_YouTube_Extension_Position + */ + protected $_position = null; + + /** + * Creates a Playlist video entry, representing an individual video + * in a list of videos contained within a specific playlist + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_position !== null) { + $element->appendChild($this->_position->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('yt') . ':' . 'position': + $position = new Zend_Gdata_YouTube_Extension_Position(); + $position->transferFromDOM($child); + $this->_position = $position; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + + /** + * Sets the array of embedded feeds related to the video + * + * @param Zend_Gdata_YouTube_Extension_Position $position + * The position of the entry in the feed, as specified by the user. + * @return Zend_Gdata_YouTube_PlaylistVideoEntry Provides a fluent interface + */ + public function setPosition($position = null) + { + $this->_position = $position; + return $this; + } + + /** + * Returns the position of the entry in the feed, as specified by the user + * + * @return Zend_Gdata_YouTube_Extension_Position The position + */ + public function getPosition() + { + return $this->_position; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/PlaylistVideoFeed.php b/applications/core/lib/Zend/Gdata/YouTube/PlaylistVideoFeed.php new file mode 100644 index 0000000..bfde7f0 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/PlaylistVideoFeed.php @@ -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 + * @subpackage YouTube + * @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_Media_Feed + */ +require_once 'Zend/Gdata/Media/Feed.php'; + +/** + * @see Zend_Gdata_YouTube_PlaylistVideoEntry + */ +require_once 'Zend/Gdata/YouTube/PlaylistVideoEntry.php'; + +/** + * The YouTube video playlist flavor of an Atom Feed with media support + * Represents a list of videos contained in a playlist. Each entry in this + * feed represents an individual video. + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_PlaylistVideoFeed extends Zend_Gdata_Media_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_PlaylistVideoEntry'; + + /** + * Creates a Play Video feed, representing a list of videos contained + * within a single playlist. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/SubscriptionEntry.php b/applications/core/lib/Zend/Gdata/YouTube/SubscriptionEntry.php new file mode 100644 index 0000000..c1f3800 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/SubscriptionEntry.php @@ -0,0 +1,445 @@ +<?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 YouTube + * @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_Extension_FeedLink + */ +require_once 'Zend/Gdata/Extension/FeedLink.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Description + */ +require_once 'Zend/Gdata/YouTube/Extension/Description.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_PlaylistTitle + */ +require_once 'Zend/Gdata/YouTube/Extension/PlaylistTitle.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_PlaylistId + */ +require_once 'Zend/Gdata/YouTube/Extension/PlaylistId.php'; + +/** + * @see Zend_Gdata_Media_Extension_MediaThumbnail + */ +require_once 'Zend/Gdata/Media/Extension/MediaThumbnail.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Username + */ +require_once 'Zend/Gdata/YouTube/Extension/Username.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_CountHint + */ +require_once 'Zend/Gdata/YouTube/Extension/CountHint.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_QueryString + */ +require_once 'Zend/Gdata/YouTube/Extension/QueryString.php'; + +/** + * Represents the YouTube video subscription flavor of an Atom entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_SubscriptionEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_YouTube_SubscriptionEntry'; + + /** + * Nested feed links + * + * @var array + */ + protected $_feedLink = array(); + + /** + * The username of this entry. + * + * @var Zend_Gdata_YouTube_Extension_Username + */ + protected $_username = null; + + /** + * The playlist title for this entry. + * + * This element is only used on subscriptions to playlists. + * + * @var Zend_Gdata_YouTube_Extension_PlaylistTitle + */ + protected $_playlistTitle = null; + + /** + * The playlist id for this entry. + * + * This element is only used on subscriptions to playlists. + * + * @var Zend_Gdata_YouTube_Extension_PlaylistId + */ + protected $_playlistId = null; + + /** + * The media:thumbnail element for this entry. + * + * This element is only used on subscriptions to playlists. + * + * @var Zend_Gdata_Media_Extension_MediaThumbnail + */ + protected $_mediaThumbnail = null; + + /** + * The countHint for this entry. + * + * @var Zend_Gdata_YouTube_Extension_CountHint + */ + protected $_countHint = null; + + /** + * The queryString for this entry. + * + * @var Zend_Gdata_YouTube_Extension_QueryString + */ + protected $_queryString = null; + + /** + * Creates a subscription entry, representing an individual subscription + * in a list of subscriptions, usually associated with an individual user. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_countHint != null) { + $element->appendChild($this->_countHint->getDOM($element->ownerDocument)); + } + if ($this->_playlistTitle != null) { + $element->appendChild($this->_playlistTitle->getDOM($element->ownerDocument)); + } + if ($this->_playlistId != null) { + $element->appendChild($this->_playlistId->getDOM($element->ownerDocument)); + } + if ($this->_mediaThumbnail != null) { + $element->appendChild($this->_mediaThumbnail->getDOM($element->ownerDocument)); + } + if ($this->_username != null) { + $element->appendChild($this->_username->getDOM($element->ownerDocument)); + } + if ($this->_queryString != null) { + $element->appendChild($this->_queryString->getDOM($element->ownerDocument)); + } + if ($this->_feedLink != null) { + foreach ($this->_feedLink as $feedLink) { + $element->appendChild($feedLink->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('gd') . ':' . 'feedLink': + $feedLink = new Zend_Gdata_Extension_FeedLink(); + $feedLink->transferFromDOM($child); + $this->_feedLink[] = $feedLink; + break; + case $this->lookupNamespace('media') . ':' . 'thumbnail': + $mediaThumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail(); + $mediaThumbnail->transferFromDOM($child); + $this->_mediaThumbnail = $mediaThumbnail; + break; + case $this->lookupNamespace('yt') . ':' . 'countHint': + $countHint = new Zend_Gdata_YouTube_Extension_CountHint(); + $countHint->transferFromDOM($child); + $this->_countHint = $countHint; + break; + case $this->lookupNamespace('yt') . ':' . 'playlistTitle': + $playlistTitle = new Zend_Gdata_YouTube_Extension_PlaylistTitle(); + $playlistTitle->transferFromDOM($child); + $this->_playlistTitle = $playlistTitle; + break; + case $this->lookupNamespace('yt') . ':' . 'playlistId': + $playlistId = new Zend_Gdata_YouTube_Extension_PlaylistId(); + $playlistId->transferFromDOM($child); + $this->_playlistId = $playlistId; + break; + case $this->lookupNamespace('yt') . ':' . 'queryString': + $queryString = new Zend_Gdata_YouTube_Extension_QueryString(); + $queryString->transferFromDOM($child); + $this->_queryString = $queryString; + break; + case $this->lookupNamespace('yt') . ':' . 'username': + $username = new Zend_Gdata_YouTube_Extension_Username(); + $username->transferFromDOM($child); + $this->_username = $username; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Sets the array of embedded feeds related to the video + * + * @param array $feedLink The array of embedded feeds relating to the video + * @return Zend_Gdata_YouTube_SubscriptionEntry Provides a fluent interface + */ + public function setFeedLink($feedLink = null) + { + $this->_feedLink = $feedLink; + return $this; + } + + /** + * Get the feed link property for this entry. + * + * @see setFeedLink + * @param string $rel (optional) The rel value of the link to be found. + * If null, the array of links is returned. + * @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink + * object corresponding to the requested rel value is returned + * if found, or null if the requested value is not found. If + * $rel is null or not specified, an array of all available + * feed links for this entry is returned, or null if no feed + * links are set. + */ + public function getFeedLink($rel = null) + { + if ($rel == null) { + return $this->_feedLink; + } else { + foreach ($this->_feedLink as $feedLink) { + if ($feedLink->rel == $rel) { + return $feedLink; + } + } + return null; + } + } + + /** + * Get the playlist title for a 'playlist' subscription. + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_PlaylistId + */ + public function getPlaylistId() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The getPlaylistId ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + return $this->_playlistId; + } + } + + /** + * Sets the yt:playlistId element for a new playlist subscription. + * + * @param Zend_Gdata_YouTube_Extension_PlaylistId $id The id of + * the playlist to which to subscribe to. + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_SubscriptionEntry Provides a fluent interface + */ + public function setPlaylistId($id = null) + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The setPlaylistTitle ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + $this->_playlistId = $id; + return $this; + } + } + + /** + * Get the queryString of the subscription + * + * @return Zend_Gdata_YouTube_Extension_QueryString + */ + public function getQueryString() + { + return $this->_queryString; + } + + /** + * Sets the yt:queryString element for a new keyword subscription. + * + * @param Zend_Gdata_YouTube_Extension_QueryString $queryString The query + * string to subscribe to + * @return Zend_Gdata_YouTube_SubscriptionEntry Provides a fluent interface + */ + public function setQueryString($queryString = null) + { + $this->_queryString = $queryString; + return $this; + } + + /** + * Get the playlist title for a 'playlist' subscription. + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_PlaylistTitle + */ + public function getPlaylistTitle() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The getPlaylistTitle ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + return $this->_playlistTitle; + } + } + + /** + * Sets the yt:playlistTitle element for a new playlist subscription. + * + * @param Zend_Gdata_YouTube_Extension_PlaylistTitle $title The title of + * the playlist to which to subscribe to. + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_SubscriptionEntry Provides a fluent interface + */ + public function setPlaylistTitle($title = null) + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The setPlaylistTitle ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + $this->_playlistTitle = $title; + return $this; + } + } + + /** + * Get the counthint for a subscription. + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_CountHint + */ + public function getCountHint() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The getCountHint ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + return $this->_countHint; + } + } + + /** + * Get the thumbnail for a subscription. + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_Media_Extension_MediaThumbnail + */ + public function getMediaThumbnail() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The getMediaThumbnail ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + return $this->_mediaThumbnail; + } + } + + /** + * Get the username for a channel subscription. + * + * @return Zend_Gdata_YouTube_Extension_Username + */ + public function getUsername() + { + return $this->_username; + } + + /** + * Sets the username for a new channel subscription. + * + * @param Zend_Gdata_YouTube_Extension_Username $username The username of + * the channel to which to subscribe to. + * @return Zend_Gdata_YouTube_SubscriptionEntry Provides a fluent interface + */ + public function setUsername($username = null) + { + $this->_username = $username; + return $this; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/SubscriptionFeed.php b/applications/core/lib/Zend/Gdata/YouTube/SubscriptionFeed.php new file mode 100644 index 0000000..429ae7e --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/SubscriptionFeed.php @@ -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 + * @subpackage YouTube + * @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_Media_Feed + */ +require_once 'Zend/Gdata/Media/Feed.php'; + +/** + * @see Zend_Gdata_YouTube_SubscriptionEntry + */ +require_once 'Zend/Gdata/YouTube/SubscriptionEntry.php'; + +/** + * The YouTube video subscription list flavor of an Atom Feed with media support + * Represents a list of individual subscriptions, where each contained entry is + * a subscription. + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_SubscriptionFeed extends Zend_Gdata_Media_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_SubscriptionEntry'; + + /** + * Creates a Subscription feed, representing a list of subscriptions, + * usually associated with an individual user. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/UserProfileEntry.php b/applications/core/lib/Zend/Gdata/YouTube/UserProfileEntry.php new file mode 100644 index 0000000..041345b --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/UserProfileEntry.php @@ -0,0 +1,1040 @@ +<?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 YouTube + * @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_Extension_FeedLink + */ +require_once 'Zend/Gdata/Extension/FeedLink.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Description + */ +require_once 'Zend/Gdata/YouTube/Extension/Description.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_AboutMe + */ +require_once 'Zend/Gdata/YouTube/Extension/AboutMe.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Age + */ +require_once 'Zend/Gdata/YouTube/Extension/Age.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Username + */ +require_once 'Zend/Gdata/YouTube/Extension/Username.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Books + */ +require_once 'Zend/Gdata/YouTube/Extension/Books.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Company + */ +require_once 'Zend/Gdata/YouTube/Extension/Company.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Hobbies + */ +require_once 'Zend/Gdata/YouTube/Extension/Hobbies.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Hometown + */ +require_once 'Zend/Gdata/YouTube/Extension/Hometown.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Location + */ +require_once 'Zend/Gdata/YouTube/Extension/Location.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Movies + */ +require_once 'Zend/Gdata/YouTube/Extension/Movies.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Music + */ +require_once 'Zend/Gdata/YouTube/Extension/Music.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Occupation + */ +require_once 'Zend/Gdata/YouTube/Extension/Occupation.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_School + */ +require_once 'Zend/Gdata/YouTube/Extension/School.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Gender + */ +require_once 'Zend/Gdata/YouTube/Extension/Gender.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Relationship + */ +require_once 'Zend/Gdata/YouTube/Extension/Relationship.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_FirstName + */ +require_once 'Zend/Gdata/YouTube/Extension/FirstName.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_LastName + */ +require_once 'Zend/Gdata/YouTube/Extension/LastName.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Statistics + */ +require_once 'Zend/Gdata/YouTube/Extension/Statistics.php'; + +/** + * @see Zend_Gdata_Media_Extension_MediaThumbnail + */ +require_once 'Zend/Gdata/Media/Extension/MediaThumbnail.php'; + +/** + * Represents the YouTube video playlist flavor of an Atom entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_UserProfileEntry extends Zend_Gdata_Entry +{ + + protected $_entryClassName = 'Zend_Gdata_YouTube_UserProfileEntry'; + + /** + * Nested feed links + * + * @var array + */ + protected $_feedLink = array(); + + /** + * The username for this profile entry + * + * @var string + */ + protected $_username = null; + + /** + * The description of the user + * + * @var string + */ + protected $_description = null; + + /** + * The contents of the 'About Me' field. + * + * @var string + */ + protected $_aboutMe = null; + + /** + * The age of the user + * + * @var int + */ + protected $_age = null; + + /** + * Books of interest to the user + * + * @var string + */ + protected $_books = null; + + /** + * Company + * + * @var string + */ + protected $_company = null; + + /** + * Hobbies + * + * @var string + */ + protected $_hobbies = null; + + /** + * Hometown + * + * @var string + */ + protected $_hometown = null; + + /** + * Location + * + * @var string + */ + protected $_location = null; + + /** + * Movies + * + * @var string + */ + protected $_movies = null; + + /** + * Music + * + * @var string + */ + protected $_music = null; + + /** + * Occupation + * + * @var string + */ + protected $_occupation = null; + + /** + * School + * + * @var string + */ + protected $_school = null; + + /** + * Gender + * + * @var string + */ + protected $_gender = null; + + /** + * Relationship + * + * @var string + */ + protected $_relationship = null; + + /** + * First name + * + * @var string + */ + protected $_firstName = null; + + /** + * Last name + * + * @var string + */ + protected $_lastName = null; + + /** + * Statistics + * + * @var Zend_Gdata_YouTube_Extension_Statistics + */ + protected $_statistics = null; + + /** + * Thumbnail + * + * @var Zend_Gdata_Media_Extension_MediaThumbnail + */ + protected $_thumbnail = null; + + /** + * Creates a User Profile entry, representing an individual user + * and their attributes. + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_description != null) { + $element->appendChild($this->_description->getDOM($element->ownerDocument)); + } + if ($this->_aboutMe != null) { + $element->appendChild($this->_aboutMe->getDOM($element->ownerDocument)); + } + if ($this->_age != null) { + $element->appendChild($this->_age->getDOM($element->ownerDocument)); + } + if ($this->_username != null) { + $element->appendChild($this->_username->getDOM($element->ownerDocument)); + } + if ($this->_books != null) { + $element->appendChild($this->_books->getDOM($element->ownerDocument)); + } + if ($this->_company != null) { + $element->appendChild($this->_company->getDOM($element->ownerDocument)); + } + if ($this->_hobbies != null) { + $element->appendChild($this->_hobbies->getDOM($element->ownerDocument)); + } + if ($this->_hometown != null) { + $element->appendChild($this->_hometown->getDOM($element->ownerDocument)); + } + if ($this->_location != null) { + $element->appendChild($this->_location->getDOM($element->ownerDocument)); + } + if ($this->_movies != null) { + $element->appendChild($this->_movies->getDOM($element->ownerDocument)); + } + if ($this->_music != null) { + $element->appendChild($this->_music->getDOM($element->ownerDocument)); + } + if ($this->_occupation != null) { + $element->appendChild($this->_occupation->getDOM($element->ownerDocument)); + } + if ($this->_school != null) { + $element->appendChild($this->_school->getDOM($element->ownerDocument)); + } + if ($this->_gender != null) { + $element->appendChild($this->_gender->getDOM($element->ownerDocument)); + } + if ($this->_relationship != null) { + $element->appendChild($this->_relationship->getDOM($element->ownerDocument)); + } + if ($this->_firstName != null) { + $element->appendChild($this->_firstName->getDOM($element->ownerDocument)); + } + if ($this->_lastName != null) { + $element->appendChild($this->_lastName->getDOM($element->ownerDocument)); + } + if ($this->_statistics != null) { + $element->appendChild($this->_statistics->getDOM($element->ownerDocument)); + } + if ($this->_thumbnail != null) { + $element->appendChild($this->_thumbnail->getDOM($element->ownerDocument)); + } + if ($this->_feedLink != null) { + foreach ($this->_feedLink as $feedLink) { + $element->appendChild($feedLink->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('yt') . ':' . 'description': + $description = new Zend_Gdata_YouTube_Extension_Description(); + $description->transferFromDOM($child); + $this->_description = $description; + break; + case $this->lookupNamespace('yt') . ':' . 'aboutMe': + $aboutMe = new Zend_Gdata_YouTube_Extension_AboutMe(); + $aboutMe->transferFromDOM($child); + $this->_aboutMe = $aboutMe; + break; + case $this->lookupNamespace('yt') . ':' . 'age': + $age = new Zend_Gdata_YouTube_Extension_Age(); + $age->transferFromDOM($child); + $this->_age = $age; + break; + case $this->lookupNamespace('yt') . ':' . 'username': + $username = new Zend_Gdata_YouTube_Extension_Username(); + $username->transferFromDOM($child); + $this->_username = $username; + break; + case $this->lookupNamespace('yt') . ':' . 'books': + $books = new Zend_Gdata_YouTube_Extension_Books(); + $books->transferFromDOM($child); + $this->_books = $books; + break; + case $this->lookupNamespace('yt') . ':' . 'company': + $company = new Zend_Gdata_YouTube_Extension_Company(); + $company->transferFromDOM($child); + $this->_company = $company; + break; + case $this->lookupNamespace('yt') . ':' . 'hobbies': + $hobbies = new Zend_Gdata_YouTube_Extension_Hobbies(); + $hobbies->transferFromDOM($child); + $this->_hobbies = $hobbies; + break; + case $this->lookupNamespace('yt') . ':' . 'hometown': + $hometown = new Zend_Gdata_YouTube_Extension_Hometown(); + $hometown->transferFromDOM($child); + $this->_hometown = $hometown; + break; + case $this->lookupNamespace('yt') . ':' . 'location': + $location = new Zend_Gdata_YouTube_Extension_Location(); + $location->transferFromDOM($child); + $this->_location = $location; + break; + case $this->lookupNamespace('yt') . ':' . 'movies': + $movies = new Zend_Gdata_YouTube_Extension_Movies(); + $movies->transferFromDOM($child); + $this->_movies = $movies; + break; + case $this->lookupNamespace('yt') . ':' . 'music': + $music = new Zend_Gdata_YouTube_Extension_Music(); + $music->transferFromDOM($child); + $this->_music = $music; + break; + case $this->lookupNamespace('yt') . ':' . 'occupation': + $occupation = new Zend_Gdata_YouTube_Extension_Occupation(); + $occupation->transferFromDOM($child); + $this->_occupation = $occupation; + break; + case $this->lookupNamespace('yt') . ':' . 'school': + $school = new Zend_Gdata_YouTube_Extension_School(); + $school->transferFromDOM($child); + $this->_school = $school; + break; + case $this->lookupNamespace('yt') . ':' . 'gender': + $gender = new Zend_Gdata_YouTube_Extension_Gender(); + $gender->transferFromDOM($child); + $this->_gender = $gender; + break; + case $this->lookupNamespace('yt') . ':' . 'relationship': + $relationship = new Zend_Gdata_YouTube_Extension_Relationship(); + $relationship->transferFromDOM($child); + $this->_relationship = $relationship; + break; + case $this->lookupNamespace('yt') . ':' . 'firstName': + $firstName = new Zend_Gdata_YouTube_Extension_FirstName(); + $firstName->transferFromDOM($child); + $this->_firstName = $firstName; + break; + case $this->lookupNamespace('yt') . ':' . 'lastName': + $lastName = new Zend_Gdata_YouTube_Extension_LastName(); + $lastName->transferFromDOM($child); + $this->_lastName = $lastName; + break; + case $this->lookupNamespace('yt') . ':' . 'statistics': + $statistics = new Zend_Gdata_YouTube_Extension_Statistics(); + $statistics->transferFromDOM($child); + $this->_statistics = $statistics; + break; + case $this->lookupNamespace('media') . ':' . 'thumbnail': + $thumbnail = new Zend_Gdata_Media_Extension_MediaThumbnail(); + $thumbnail->transferFromDOM($child); + $this->_thumbnail = $thumbnail; + break; + case $this->lookupNamespace('gd') . ':' . 'feedLink': + $feedLink = new Zend_Gdata_Extension_FeedLink(); + $feedLink->transferFromDOM($child); + $this->_feedLink[] = $feedLink; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Sets the content of the 'about me' field. + * + * @param Zend_Gdata_YouTube_Extension_AboutMe $aboutMe The 'about me' + * information. + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setAboutMe($aboutMe = null) + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The setAboutMe ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + $this->_aboutMe = $aboutMe; + return $this; + } + } + + /** + * Returns the contents of the 'about me' field. + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_AboutMe The 'about me' information + */ + public function getAboutMe() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The getAboutMe ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + return $this->_aboutMe; + } + } + + /** + * Sets the content of the 'first name' field. + * + * @param Zend_Gdata_YouTube_Extension_FirstName $firstName The first name + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setFirstName($firstName = null) + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The setFirstName ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + $this->_firstName = $firstName; + return $this; + } + } + + /** + * Returns the first name + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_FirstName The first name + */ + public function getFirstName() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The getFirstName ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + return $this->_firstName; + } + } + + /** + * Sets the content of the 'last name' field. + * + * @param Zend_Gdata_YouTube_Extension_LastName $lastName The last name + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setLastName($lastName = null) + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The setLastName ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + $this->_lastName = $lastName; + return $this; + } + } + + /** + * Returns the last name + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_LastName The last name + */ + public function getLastName() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The getLastName ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + return $this->_lastName; + } + } + + /** + * Returns the statistics + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_Statistics The profile statistics + */ + public function getStatistics() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The getStatistics ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + return $this->_statistics; + } + } + + /** + * Returns the thumbnail + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_Media_Extension_MediaThumbnail The profile thumbnail + */ + public function getThumbnail() + { + if (($this->getMajorProtocolVersion() == null) || + ($this->getMajorProtocolVersion() == 1)) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException('The getThumbnail ' . + ' method is only supported as of version 2 of the YouTube ' . + 'API.'); + } else { + return $this->_thumbnail; + } + } + + /** + * Sets the age + * + * @param Zend_Gdata_YouTube_Extension_Age $age The age + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setAge($age = null) + { + $this->_age = $age; + return $this; + } + + /** + * Returns the age + * + * @return Zend_Gdata_YouTube_Extension_Age The age + */ + public function getAge() + { + return $this->_age; + } + + /** + * Sets the username + * + * @param Zend_Gdata_YouTube_Extension_Username $username The username + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setUsername($username = null) + { + $this->_username = $username; + return $this; + } + + /** + * Returns the username + * + * @return Zend_Gdata_YouTube_Extension_Username The username + */ + public function getUsername() + { + return $this->_username; + } + + /** + * Sets the books + * + * @param Zend_Gdata_YouTube_Extension_Books $books The books + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setBooks($books = null) + { + $this->_books = $books; + return $this; + } + + /** + * Returns the books + * + * @return Zend_Gdata_YouTube_Extension_Books The books + */ + public function getBooks() + { + return $this->_books; + } + + /** + * Sets the company + * + * @param Zend_Gdata_YouTube_Extension_Company $company The company + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setCompany($company = null) + { + $this->_company = $company; + return $this; + } + + /** + * Returns the company + * + * @return Zend_Gdata_YouTube_Extension_Company The company + */ + public function getCompany() + { + return $this->_company; + } + + /** + * Sets the hobbies + * + * @param Zend_Gdata_YouTube_Extension_Hobbies $hobbies The hobbies + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setHobbies($hobbies = null) + { + $this->_hobbies = $hobbies; + return $this; + } + + /** + * Returns the hobbies + * + * @return Zend_Gdata_YouTube_Extension_Hobbies The hobbies + */ + public function getHobbies() + { + return $this->_hobbies; + } + + /** + * Sets the hometown + * + * @param Zend_Gdata_YouTube_Extension_Hometown $hometown The hometown + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setHometown($hometown = null) + { + $this->_hometown = $hometown; + return $this; + } + + /** + * Returns the hometown + * + * @return Zend_Gdata_YouTube_Extension_Hometown The hometown + */ + public function getHometown() + { + return $this->_hometown; + } + + /** + * Sets the location + * + * @param Zend_Gdata_YouTube_Extension_Location $location The location + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setLocation($location = null) + { + $this->_location = $location; + return $this; + } + + /** + * Returns the location + * + * @return Zend_Gdata_YouTube_Extension_Location The location + */ + public function getLocation() + { + return $this->_location; + } + + /** + * Sets the movies + * + * @param Zend_Gdata_YouTube_Extension_Movies $movies The movies + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setMovies($movies = null) + { + $this->_movies = $movies; + return $this; + } + + /** + * Returns the movies + * + * @return Zend_Gdata_YouTube_Extension_Movies The movies + */ + public function getMovies() + { + return $this->_movies; + } + + /** + * Sets the music + * + * @param Zend_Gdata_YouTube_Extension_Music $music The music + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setMusic($music = null) + { + $this->_music = $music; + return $this; + } + + /** + * Returns the music + * + * @return Zend_Gdata_YouTube_Extension_Music The music + */ + public function getMusic() + { + return $this->_music; + } + + /** + * Sets the occupation + * + * @param Zend_Gdata_YouTube_Extension_Occupation $occupation The occupation + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setOccupation($occupation = null) + { + $this->_occupation = $occupation; + return $this; + } + + /** + * Returns the occupation + * + * @return Zend_Gdata_YouTube_Extension_Occupation The occupation + */ + public function getOccupation() + { + return $this->_occupation; + } + + /** + * Sets the school + * + * @param Zend_Gdata_YouTube_Extension_School $school The school + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setSchool($school = null) + { + $this->_school = $school; + return $this; + } + + /** + * Returns the school + * + * @return Zend_Gdata_YouTube_Extension_School The school + */ + public function getSchool() + { + return $this->_school; + } + + /** + * Sets the gender + * + * @param Zend_Gdata_YouTube_Extension_Gender $gender The gender + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setGender($gender = null) + { + $this->_gender = $gender; + return $this; + } + + /** + * Returns the gender + * + * @return Zend_Gdata_YouTube_Extension_Gender The gender + */ + public function getGender() + { + return $this->_gender; + } + + /** + * Sets the relationship + * + * @param Zend_Gdata_YouTube_Extension_Relationship $relationship The relationship + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setRelationship($relationship = null) + { + $this->_relationship = $relationship; + return $this; + } + + /** + * Returns the relationship + * + * @return Zend_Gdata_YouTube_Extension_Relationship The relationship + */ + public function getRelationship() + { + return $this->_relationship; + } + + /** + * Sets the array of embedded feeds related to the video + * + * @param array $feedLink The array of embedded feeds relating to the video + * @return Zend_Gdata_YouTube_UserProfileEntry Provides a fluent interface + */ + public function setFeedLink($feedLink = null) + { + $this->_feedLink = $feedLink; + return $this; + } + + /** + * Get the feed link property for this entry. + * + * @see setFeedLink + * @param string $rel (optional) The rel value of the link to be found. + * If null, the array of links is returned. + * @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink + * object corresponding to the requested rel value is returned + * if found, or null if the requested value is not found. If + * $rel is null or not specified, an array of all available + * feed links for this entry is returned, or null if no feed + * links are set. + */ + public function getFeedLink($rel = null) + { + if ($rel == null) { + return $this->_feedLink; + } else { + foreach ($this->_feedLink as $feedLink) { + if ($feedLink->rel == $rel) { + return $feedLink; + } + } + return null; + } + } + + /** + * Returns the URL in the gd:feedLink with the provided rel value + * + * @param string $rel The rel value to find + * @return mixed Either the URL as a string or null if a feedLink wasn't + * found with the provided rel value + */ + public function getFeedLinkHref($rel) + { + $feedLink = $this->getFeedLink($rel); + if ($feedLink !== null) { + return $feedLink->href; + } else { + return null; + } + } + + /** + * Returns the URL of the playlist list feed + * + * @return string The URL of the playlist video feed + */ + public function getPlaylistListFeedUrl() + { + return getFeedLinkHref(Zend_Gdata_YouTube::USER_PLAYLISTS_REL); + } + + /** + * Returns the URL of the uploads feed + * + * @return string The URL of the uploads video feed + */ + public function getUploadsFeedUrl() + { + return getFeedLinkHref(Zend_Gdata_YouTube::USER_UPLOADS_REL); + } + + /** + * Returns the URL of the subscriptions feed + * + * @return string The URL of the subscriptions feed + */ + public function getSubscriptionsFeedUrl() + { + return getFeedLinkHref(Zend_Gdata_YouTube::USER_SUBSCRIPTIONS_REL); + } + + /** + * Returns the URL of the contacts feed + * + * @return string The URL of the contacts feed + */ + public function getContactsFeedUrl() + { + return getFeedLinkHref(Zend_Gdata_YouTube::USER_CONTACTS_REL); + } + + /** + * Returns the URL of the favorites feed + * + * @return string The URL of the favorites feed + */ + public function getFavoritesFeedUrl() + { + return getFeedLinkHref(Zend_Gdata_YouTube::USER_FAVORITES_REL); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/VideoEntry.php b/applications/core/lib/Zend/Gdata/YouTube/VideoEntry.php new file mode 100644 index 0000000..d954042 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/VideoEntry.php @@ -0,0 +1,1095 @@ +<?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 YouTube + * @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: VideoEntry.php 13359 2008-12-18 22:49:31Z jhartmann $ + */ + +/** + * @see Zend_Gdata_Extension_Comments + */ +require_once 'Zend/Gdata/Extension/Comments.php'; + +/** + * @see Zend_Gdata_Extension_FeedLink + */ +require_once 'Zend/Gdata/Extension/FeedLink.php'; + +/** + * @see Zend_Gdata_YouTube_MediaEntry + */ +require_once 'Zend/Gdata/YouTube/MediaEntry.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_MediaGroup + */ +require_once 'Zend/Gdata/YouTube/Extension/MediaGroup.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_NoEmbed + */ +require_once 'Zend/Gdata/YouTube/Extension/NoEmbed.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Statistics + */ +require_once 'Zend/Gdata/YouTube/Extension/Statistics.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Link + */ +require_once 'Zend/Gdata/YouTube/Extension/Link.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Racy + */ +require_once 'Zend/Gdata/YouTube/Extension/Racy.php'; + +/** + * @see Zend_Gdata_Extension_Rating + */ +require_once 'Zend/Gdata/Extension/Rating.php'; + +/** + * @see Zend_Gdata_Geo_Extension_GeoRssWhere + */ +require_once 'Zend/Gdata/Geo/Extension/GeoRssWhere.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Control + */ +require_once 'Zend/Gdata/YouTube/Extension/Control.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Recorded + */ +require_once 'Zend/Gdata/YouTube/Extension/Recorded.php'; + +/** + * @see Zend_Gdata_YouTube_Extension_Location + */ +require_once 'Zend/Gdata/YouTube/Extension/Location.php'; + +/** + * Represents the YouTube video flavor of an Atom entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_VideoEntry extends Zend_Gdata_YouTube_MediaEntry +{ + + const YOUTUBE_DEVELOPER_TAGS_SCHEMA = 'http://gdata.youtube.com/schemas/2007/developertags.cat'; + const YOUTUBE_CATEGORY_SCHEMA = 'http://gdata.youtube.com/schemas/2007/categories.cat'; + protected $_entryClassName = 'Zend_Gdata_YouTube_VideoEntry'; + + /** + * If null, the video can be embedded + * + * @var Zend_Gdata_YouTube_Extension_NoEmbed|null + */ + protected $_noEmbed = null; + + /** + * Specifies the statistics relating to the video. + * + * @var Zend_Gdata_YouTube_Extension_Statistics + */ + protected $_statistics = null; + + /** + * If not null, specifies that the video has racy content. + * + * @var Zend_Gdata_YouTube_Extension_Racy|null + */ + protected $_racy = null; + + /** + * If not null, specifies that the video is private. + * + * @var Zend_Gdata_YouTube_Extension_Private|null + */ + protected $_private = null; + + /** + * Specifies the video's rating. + * + * @var Zend_Gdata_Extension_Rating + */ + protected $_rating = null; + + /** + * Specifies the comments associated with a video. + * + * @var Zend_Gdata_Extensions_Comments + */ + protected $_comments = null; + + /** + * Nested feed links + * + * @var array + */ + protected $_feedLink = array(); + + /** + * Geo location for the video + * + * @var Zend_Gdata_Geo_Extension_GeoRssWhere + */ + protected $_where = null; + + /** + * Recording date for the video + * + * @var Zend_Gdata_YouTube_Extension_Recorded|null + */ + protected $_recorded = null; + + /** + * Location informtion for the video + * + * @var Zend_Gdata_YouTube_Extension_Location|null + */ + protected $_location = null; + + /** + * Creates a Video entry, representing an individual video + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + 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, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_noEmbed != null) { + $element->appendChild($this->_noEmbed->getDOM( + $element->ownerDocument)); + } + if ($this->_statistics != null) { + $element->appendChild($this->_statistics->getDOM( + $element->ownerDocument)); + } + if ($this->_racy != null) { + $element->appendChild($this->_racy->getDOM( + $element->ownerDocument)); + } + if ($this->_recorded != null) { + $element->appendChild($this->_recorded->getDOM( + $element->ownerDocument)); + } + if ($this->_location != null) { + $element->appendChild($this->_location->getDOM( + $element->ownerDocument)); + } + if ($this->_rating != null) { + $element->appendChild($this->_rating->getDOM( + $element->ownerDocument)); + } + if ($this->_comments != null) { + $element->appendChild($this->_comments->getDOM( + $element->ownerDocument)); + } + if ($this->_feedLink != null) { + foreach ($this->_feedLink as $feedLink) { + $element->appendChild($feedLink->getDOM( + $element->ownerDocument)); + } + } + if ($this->_where != null) { + $element->appendChild($this->_where->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('yt') . ':' . 'statistics': + $statistics = new Zend_Gdata_YouTube_Extension_Statistics(); + $statistics->transferFromDOM($child); + $this->_statistics = $statistics; + break; + case $this->lookupNamespace('yt') . ':' . 'racy': + $racy = new Zend_Gdata_YouTube_Extension_Racy(); + $racy->transferFromDOM($child); + $this->_racy = $racy; + break; + case $this->lookupNamespace('yt') . ':' . 'recorded': + $recorded = new Zend_Gdata_YouTube_Extension_Recorded(); + $recorded->transferFromDOM($child); + $this->_recorded = $recorded; + break; + case $this->lookupNamespace('yt') . ':' . 'location': + $location = new Zend_Gdata_YouTube_Extension_Location(); + $location->transferFromDOM($child); + $this->_location = $location; + break; + case $this->lookupNamespace('gd') . ':' . 'rating': + $rating = new Zend_Gdata_Extension_Rating(); + $rating->transferFromDOM($child); + $this->_rating = $rating; + break; + case $this->lookupNamespace('gd') . ':' . 'comments': + $comments = new Zend_Gdata_Extension_Comments(); + $comments->transferFromDOM($child); + $this->_comments = $comments; + break; + case $this->lookupNamespace('yt') . ':' . 'noembed': + $noEmbed = new Zend_Gdata_YouTube_Extension_NoEmbed(); + $noEmbed->transferFromDOM($child); + $this->_noEmbed = $noEmbed; + break; + case $this->lookupNamespace('gd') . ':' . 'feedLink': + $feedLink = new Zend_Gdata_Extension_FeedLink(); + $feedLink->transferFromDOM($child); + $this->_feedLink[] = $feedLink; + break; + case $this->lookupNamespace('georss') . ':' . 'where': + $where = new Zend_Gdata_Geo_Extension_GeoRssWhere(); + $where->transferFromDOM($child); + $this->_where = $where; + break; + case $this->lookupNamespace('atom') . ':' . 'link'; + $link = new Zend_Gdata_YouTube_Extension_Link(); + $link->transferFromDOM($child); + $this->_link[] = $link; + break; + case $this->lookupNamespace('app') . ':' . 'control': + $control = new Zend_Gdata_YouTube_Extension_Control(); + $control->transferFromDOM($child); + $this->_control = $control; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Sets when the video was recorded. + * + * @param Zend_Gdata_YouTube_Extension_Recorded $recorded When the video was recorded + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setRecorded($recorded = null) + { + $this->_recorded = $recorded; + return $this; + } + + /** + * Gets the date that the video was recorded. + * + * @return Zend_Gdata_YouTube_Extension_Recorded|null + */ + public function getRecorded() + { + return $this->_recorded; + } + + /** + * Sets the location information. + * + * @param Zend_Gdata_YouTube_Extension_Location $location Where the video + * was recorded + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setLocation($location = null) + { + $this->_location = $location; + return $this; + } + + /** + * Gets the location where the video was recorded. + * + * @return Zend_Gdata_YouTube_Extension_Location|null + */ + public function getLocation() + { + return $this->_location; + } + + /** + * If an instance of Zend_Gdata_YouTube_Extension_NoEmbed is passed in, + * the video cannot be embedded. Otherwise, if null is passsed in, the + * video is able to be embedded. + * + * @param Zend_Gdata_YouTube_Extension_NoEmbed $noEmbed Whether or not the + * video can be embedded. + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setNoEmbed($noEmbed = null) + { + $this->_noEmbed = $noEmbed; + return $this; + } + + /** + * If the return value is an instance of + * Zend_Gdata_YouTube_Extension_NoEmbed, this video cannot be embedded. + * + * @return Zend_Gdata_YouTube_Extension_NoEmbed|null Whether or not the video can be embedded + */ + public function getNoEmbed() + { + return $this->_noEmbed; + } + + /** + * Checks whether the video is embeddable. + * + * @return bool Returns true if the video is embeddable. + */ + public function isVideoEmbeddable() + { + if ($this->getNoEmbed() == null) { + return true; + } else { + return false; + } + } + + /** + * Sets the statistics relating to the video. + * + * @param Zend_Gdata_YouTube_Extension_Statistics $statistics The statistics relating to the video + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setStatistics($statistics = null) + { + $this->_statistics = $statistics; + return $this; + } + + /** + * Returns the statistics relating to the video. + * + * @return Zend_Gdata_YouTube_Extension_Statistics The statistics relating to the video + */ + public function getStatistics() + { + return $this->_statistics; + } + + /** + * Specifies that the video has racy content. + * + * @param Zend_Gdata_YouTube_Extension_Racy $racy The racy flag object + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setRacy($racy = null) + { + if ($this->getMajorProtocolVersion() == 2) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException( + 'Calling getRacy() on a YouTube VideoEntry is deprecated ' . + 'as of version 2 of the API.'); + } + + $this->_racy = $racy; + return $this; + } + + /** + * Returns the racy flag object. + * + * @throws Zend_Gdata_App_VersionException + * @return Zend_Gdata_YouTube_Extension_Racy|null The racy flag object + */ + public function getRacy() + { + if ($this->getMajorProtocolVersion() == 2) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException( + 'Calling getRacy() on a YouTube VideoEntry is deprecated ' . + 'as of version 2 of the API.'); + } + return $this->_racy; + } + + /** + * Sets the rating relating to the video. + * + * @param Zend_Gdata_Extension_Rating $rating The rating relating to the video + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setRating($rating = null) + { + $this->_rating = $rating; + return $this; + } + + /** + * Returns the rating relating to the video. + * + * @return Zend_Gdata_Extension_Rating The rating relating to the video + */ + public function getRating() + { + return $this->_rating; + } + + /** + * Sets the comments relating to the video. + * + * @param Zend_Gdata_Extension_Comments $comments The comments relating to the video + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setComments($comments = null) + { + $this->_comments = $comments; + return $this; + } + + /** + * Returns the comments relating to the video. + * + * @return Zend_Gdata_Extension_Comments The comments relating to the video + */ + public function getComments() + { + return $this->_comments; + } + + /** + * Sets the array of embedded feeds related to the video + * + * @param array $feedLink The array of embedded feeds relating to the video + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setFeedLink($feedLink = null) + { + $this->_feedLink = $feedLink; + return $this; + } + + /** + * Get the feed link property for this entry. + * + * @see setFeedLink + * @param string $rel (optional) The rel value of the link to be found. + * If null, the array of links is returned. + * @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink + * object corresponding to the requested rel value is returned + * if found, or null if the requested value is not found. If + * $rel is null or not specified, an array of all available + * feed links for this entry is returned, or null if no feed + * links are set. + */ + public function getFeedLink($rel = null) + { + if ($rel == null) { + return $this->_feedLink; + } else { + foreach ($this->_feedLink as $feedLink) { + if ($feedLink->rel == $rel) { + return $feedLink; + } + } + return null; + } + } + + /** + * Returns the link element relating to video responses. + * + * @return Zend_Gdata_App_Extension_Link + */ + public function getVideoResponsesLink() + { + return $this->getLink(Zend_Gdata_YouTube::VIDEO_RESPONSES_REL); + } + + /** + * Returns the link element relating to video ratings. + * + * @return Zend_Gdata_App_Extension_Link + */ + public function getVideoRatingsLink() + { + return $this->getLink(Zend_Gdata_YouTube::VIDEO_RATINGS_REL); + } + + /** + * Returns the link element relating to video complaints. + * + * @return Zend_Gdata_App_Extension_Link + */ + public function getVideoComplaintsLink() + { + return $this->getLink(Zend_Gdata_YouTube::VIDEO_COMPLAINTS_REL); + } + + /** + * Gets the YouTube video ID based upon the atom:id value + * + * @return string The video ID + */ + public function getVideoId() + { + if ($this->getMajorProtocolVersion() == 2) { + $videoId = $this->getMediaGroup()->getVideoId()->text; + } else { + $fullId = $this->getId()->getText(); + $position = strrpos($fullId, '/'); + if ($position === false) { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Slash not found in atom:id of ' . $fullId); + } else { + $videoId = substr($fullId, $position + 1); + } + } + return $videoId; + } + + /** + * Gets the date that the video was recorded. + * + * @return string|null The date that the video was recorded + */ + public function getVideoRecorded() + { + $recorded = $this->getRecorded(); + if ($recorded != null) { + return $recorded->getText(); + } else { + return null; + } + } + + /** + * Sets the date that the video was recorded. + * + * @param string $recorded The date that the video was recorded, in the + * format of '2001-06-19' + */ + public function setVideoRecorded($recorded) + { + $this->setRecorded( + new Zend_Gdata_YouTube_Extension_Recorded($recorded)); + return $this; + } + + /** + * Gets the georss:where element + * + * @return Zend_Gdata_Geo_Extension_GeoRssWhere + */ + public function getWhere() + { + return $this->_where; + } + + /** + * Sets the georss:where element + * + * @param Zend_Gdata_Geo_Extension_GeoRssWhere $value The georss:where class value + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setWhere($value) + { + $this->_where = $value; + return $this; + } + + /** + * Gets the title of the video as a string. null is returned + * if the video title is not available. + * + * @return string|null The title of the video + */ + public function getVideoTitle() + { + $this->ensureMediaGroupIsNotNull(); + if ($this->getMediaGroup()->getTitle() != null) { + return $this->getMediaGroup()->getTitle()->getText(); + } else { + return null; + } + } + + /** + * Sets the title of the video as a string. + * + * @param string $title Title for the video + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setVideoTitle($title) + { + $this->ensureMediaGroupIsNotNull(); + $this->getMediaGroup()->setTitle( + new Zend_Gdata_Media_Extension_MediaTitle($title)); + return $this; + } + + /** + * Sets the description of the video as a string. + * + * @param string $description Description for the video + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setVideoDescription($description) + { + $this->ensureMediaGroupIsNotNull(); + $this->getMediaGroup()->setDescription( + new Zend_Gdata_Media_Extension_MediaDescription($description)); + return $this; + } + + + /** + * Gets the description of the video as a string. null is returned + * if the video description is not available. + * + * @return string|null The description of the video + */ + public function getVideoDescription() + { + $this->ensureMediaGroupIsNotNull(); + if ($this->getMediaGroup()->getDescription() != null) { + return $this->getMediaGroup()->getDescription()->getText(); + } else { + return null; + } + } + + /** + * Gets the URL of the YouTube video watch page. null is returned + * if the video watch page URL is not available. + * + * @return string|null The URL of the YouTube video watch page + */ + public function getVideoWatchPageUrl() + { + $this->ensureMediaGroupIsNotNull(); + if ($this->getMediaGroup()->getPlayer() != null && + array_key_exists(0, $this->getMediaGroup()->getPlayer())) { + $players = $this->getMediaGroup()->getPlayer(); + return $players[0]->getUrl(); + } else { + return null; + } + } + + /** + * Gets an array of the thumbnails representing the video. + * Each thumbnail is an element of the array, and is an + * array of the thumbnail properties - time, height, width, + * and url. For convient usage inside a foreach loop, an + * empty array is returned if there are no thumbnails. + * + * @return array An array of video thumbnails. + */ + public function getVideoThumbnails() + { + $this->ensureMediaGroupIsNotNull(); + if ($this->getMediaGroup()->getThumbnail() != null) { + + $thumbnailArray = array(); + + foreach ($this->getMediaGroup()->getThumbnail() as $thumbnailObj) { + $thumbnail = array(); + $thumbnail['time'] = $thumbnailObj->time; + $thumbnail['height'] = $thumbnailObj->height; + $thumbnail['width'] = $thumbnailObj->width; + $thumbnail['url'] = $thumbnailObj->url; + $thumbnailArray[] = $thumbnail; + } + return $thumbnailArray; + } else { + return array(); + } + } + + /** + * Gets the URL of the flash player SWF. null is returned if the + * duration value is not available. + * + * @return string|null The URL of the flash player SWF + */ + public function getFlashPlayerUrl() + { + $this->ensureMediaGroupIsNotNull(); + foreach ($this->getMediaGroup()->getContent() as $content) { + if ($content->getType() === 'application/x-shockwave-flash') { + return $content->getUrl(); + } + } + return null; + } + + /** + * Gets the duration of the video, in seconds. null is returned + * if the duration value is not available. + * + * @return string|null The duration of the video, in seconds. + */ + public function getVideoDuration() + { + $this->ensureMediaGroupIsNotNull(); + if ($this->getMediaGroup()->getDuration() != null) { + return $this->getMediaGroup()->getDuration()->getSeconds(); + } else { + return null; + } + } + + /** + * Checks whether the video is private. + * + * @return bool Return true if video is private + */ + public function isVideoPrivate() + { + $this->ensureMediaGroupIsNotNull(); + if ($this->getMediaGroup()->getPrivate() != null) { + return true; + } else { + return false; + } + } + + /** + * Sets video to private. + * + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setVideoPrivate() + { + $this->ensureMediaGroupIsNotNull(); + $this->getMediaGroup()->setPrivate(new Zend_Gdata_YouTube_Extension_Private()); + return $this; + } + + /** + * Sets a private video to be public. + * + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setVideoPublic() + { + $this->ensureMediaGroupIsNotNull(); + $this->getMediaGroup()->private = null; + return $this; + } + + /** + * Gets an array of the tags assigned to this video. For convient + * usage inside a foreach loop, an empty array is returned when there + * are no tags assigned. + * + * @return array An array of the tags assigned to this video + */ + public function getVideoTags() + { + $this->ensureMediaGroupIsNotNull(); + if ($this->getMediaGroup()->getKeywords() != null) { + + $keywords = $this->getMediaGroup()->getKeywords(); + $keywordsString = $keywords->getText(); + if (strlen(trim($keywordsString)) > 0) { + return split('(, *)|,', $keywordsString); + } + } + return array(); + } + + /** + * Sets the keyword tags for a video. + * + * @param mixed $tags Either a comma-separated string or an array + * of tags for the video + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setVideoTags($tags) + { + $this->ensureMediaGroupIsNotNull(); + $keywords = new Zend_Gdata_Media_Extension_MediaKeywords(); + if (is_array($tags)) { + $tags = implode(', ', $tags); + } + $keywords->setText($tags); + $this->getMediaGroup()->setKeywords($keywords); + return $this; + } + + /** + * Gets the number of views for this video. null is returned if the + * number of views is not available. + * + * @return string|null The number of views for this video + */ + public function getVideoViewCount() + { + if ($this->getStatistics() != null) { + return $this->getStatistics()->getViewCount(); + } else { + return null; + } + } + + /** + * Gets the location specified for this video, if available. The location + * is returned as an array containing the keys 'longitude' and 'latitude'. + * null is returned if the location is not available. + * + * @return array|null The location specified for this video + */ + public function getVideoGeoLocation() + { + if ($this->getWhere() != null && + $this->getWhere()->getPoint() != null && + ($position = $this->getWhere()->getPoint()->getPos()) != null) { + + $positionString = $position->__toString(); + + if (strlen(trim($positionString)) > 0) { + $positionArray = explode(' ', trim($positionString)); + if (count($positionArray) == 2) { + $returnArray = array(); + $returnArray['latitude'] = $positionArray[0]; + $returnArray['longitude'] = $positionArray[1]; + return $returnArray; + } + } + } + return null; + } + + /** + * Gets the rating information for this video, if available. The rating + * is returned as an array containing the keys 'average' and 'numRaters'. + * null is returned if the rating information is not available. + * + * @return array|null The rating information for this video + */ + public function getVideoRatingInfo() + { + if ($this->getRating() != null) { + $returnArray = array(); + $returnArray['average'] = $this->getRating()->getAverage(); + $returnArray['numRaters'] = $this->getRating()->getNumRaters(); + return $returnArray; + } else { + return null; + } + } + + /** + * Gets the category of this video, if available. The category is returned + * as a string. Valid categories are found at: + * http://gdata.youtube.com/schemas/2007/categories.cat + * If the category is not set, null is returned. + * + * @return string|null The category of this video + */ + public function getVideoCategory() + { + $this->ensureMediaGroupIsNotNull(); + $categories = $this->getMediaGroup()->getCategory(); + if ($categories != null) { + foreach($categories as $category) { + if ($category->getScheme() == self::YOUTUBE_CATEGORY_SCHEMA) { + return $category->getText(); + } + } + } + return null; + } + + /** + * Sets the category of the video as a string. + * + * @param string $category Categories for the video + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setVideoCategory($category) + { + $this->ensureMediaGroupIsNotNull(); + $this->getMediaGroup()->setCategory(array(new Zend_Gdata_Media_Extension_MediaCategory($category, self::YOUTUBE_CATEGORY_SCHEMA))); + return $this; + } + + /** + * Gets the developer tags for the video, if available and if client is + * authenticated with a valid developerKey. The tags are returned + * as an array. + * If no tags are set, null is returned. + * + * @return array|null The developer tags for this video or null if none were set. + */ + public function getVideoDeveloperTags() + { + $developerTags = null; + $this->ensureMediaGroupIsNotNull(); + + $categoryArray = $this->getMediaGroup()->getCategory(); + if ($categoryArray != null) { + foreach ($categoryArray as $category) { + if ($category instanceof Zend_Gdata_Media_Extension_MediaCategory) { + if ($category->getScheme() == self::YOUTUBE_DEVELOPER_TAGS_SCHEMA) { + $developerTags[] = $category->getText(); + } + } + } + return $developerTags; + } + return null; + } + + /** + * Adds a developer tag to array of tags for the video. + * + * @param string $developerTag DeveloperTag for the video + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function addVideoDeveloperTag($developerTag) + { + $this->ensureMediaGroupIsNotNull(); + $newCategory = new Zend_Gdata_Media_Extension_MediaCategory($developerTag, self::YOUTUBE_DEVELOPER_TAGS_SCHEMA); + + if ($this->getMediaGroup()->getCategory() == null) { + $this->getMediaGroup()->setCategory($newCategory); + } else { + $categories = $this->getMediaGroup()->getCategory(); + $categories[] = $newCategory; + $this->getMediaGroup()->setCategory($categories); + } + return $this; + } + + /** + * Set multiple developer tags for the video as strings. + * + * @param array $developerTags Array of developerTag for the video + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface + */ + public function setVideoDeveloperTags($developerTags) + { + foreach($developerTags as $developerTag) { + $this->addVideoDeveloperTag($developerTag); + } + return $this; + } + + + /** + * Get the current publishing state of the video. + * + * @return Zend_Gdata_YouTube_Extension_State|null The publishing state of this video + */ + public function getVideoState() + { + $control = $this->getControl(); + if ($control != null && + $control->getDraft() != null && + $control->getDraft()->getText() == 'yes') { + + return $control->getState(); + } + return null; + } + + /** + * Get the VideoEntry's Zend_Gdata_YouTube_Extension_MediaGroup object. + * If the mediaGroup does not exist, then set it. + * + * @return void + */ + public function ensureMediaGroupIsNotNull() + { + if ($this->getMediagroup() == null) { + $this->setMediagroup(new Zend_Gdata_YouTube_Extension_MediaGroup()); + } + } + + /** + * Helper function to conveniently set a video's rating. + * + * @param integer $ratingValue A number representing the rating. Must + * be between 1 and 5 inclusive. + * @throws Zend_Gdata_Exception + * @return Zend_Gdata_YouTube_VideoEntry Provides a fluent interface. + */ + public function setVideoRating($ratingValue) + { + if ($ratingValue < 1 || $ratingValue > 5) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Rating for video entry must be between 1 and 5 inclusive.'); + } + + require_once 'Zend/Gdata/Extension/Rating.php'; + $rating = new Zend_Gdata_Extension_Rating(null, 1, 5, null, + $ratingValue); + $this->setRating($rating); + return $this; + } + + /** + * Retrieve the URL for a video's comment feed. + * + * @return string|null The URL if found, or null if not found. + */ + public function getVideoCommentFeedUrl() + { + $commentsExtension = $this->getComments(); + $commentsFeedUrl = null; + if ($commentsExtension) { + $commentsFeedLink = $commentsExtension->getFeedLink(); + if ($commentsFeedLink) { + $commentsFeedUrl = $commentsFeedLink->getHref(); + } + } + return $commentsFeedUrl; + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/VideoFeed.php b/applications/core/lib/Zend/Gdata/YouTube/VideoFeed.php new file mode 100644 index 0000000..b9f55ef --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/VideoFeed.php @@ -0,0 +1,64 @@ +<?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 YouTube + * @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_Media_Feed + */ +require_once 'Zend/Gdata/Media/Feed.php'; + +/** + * @see Zend_Gdata_YouTube_VideoEntry + */ +require_once 'Zend/Gdata/YouTube/VideoEntry.php'; + +/** + * The YouTube video flavor of an Atom Feed with media support + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_VideoFeed extends Zend_Gdata_Media_Feed +{ + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_YouTube_VideoEntry'; + + /** + * Creates a Video feed, representing a list of videos + * + * @param DOMElement $element (optional) DOMElement from which this + * object should be constructed. + */ + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_YouTube::$namespaces); + parent::__construct($element); + } + +} diff --git a/applications/core/lib/Zend/Gdata/YouTube/VideoQuery.php b/applications/core/lib/Zend/Gdata/YouTube/VideoQuery.php new file mode 100644 index 0000000..1a43a46 --- /dev/null +++ b/applications/core/lib/Zend/Gdata/YouTube/VideoQuery.php @@ -0,0 +1,539 @@ +<?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 YouTube + * @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_YouTube + */ +require_once('Zend/Gdata/YouTube.php'); + +/** + * Zend_Gdata_Query + */ +require_once('Zend/Gdata/Query.php'); + +/** + * Assists in constructing queries for YouTube videos + * + * @link http://code.google.com/apis/youtube/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage YouTube + * @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_YouTube_VideoQuery extends Zend_Gdata_Query +{ + + /** + * Create Gdata_YouTube_VideoQuery object + */ + public function __construct($url = null) + { + parent::__construct($url); + } + + /** + * Sets the type of feed this query should be used to search + * + * @param string $feedType The type of feed + * @param string $videoId The ID of the video associated with this query + * @param string $entry The ID of the entry associated with this query + */ + public function setFeedType($feedType, $videoId = null, $entry = null) + { + switch ($feedType) { + case 'top rated': + $this->_url = Zend_Gdata_YouTube::STANDARD_TOP_RATED_URI; + break; + case 'most viewed': + $this->_url = Zend_Gdata_YouTube::STANDARD_MOST_VIEWED_URI; + break; + case 'recently featured': + $this->_url = Zend_Gdata_YouTube::STANDARD_RECENTLY_FEATURED_URI; + break; + case 'mobile': + $this->_url = Zend_Gdata_YouTube::STANDARD_WATCH_ON_MOBILE_URI; + break; + case 'related': + if ($videoId === null) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Video ID must be set for feed of type: ' . $feedType); + } else { + $this->_url = Zend_Gdata_YouTube::VIDEO_URI . '/' . $videoId . + '/related'; + } + break; + case 'responses': + if ($videoId === null) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_Exception( + 'Video ID must be set for feed of type: ' . $feedType); + } else { + $this->_url = Zend_Gdata_YouTube::VIDEO_URI . '/' . $videoId . + 'responses'; + } + break; + case 'comments': + if ($videoId === null) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_Exception( + 'Video ID must be set for feed of type: ' . $feedType); + } else { + $this->_url = Zend_Gdata_YouTube::VIDEO_URI . '/' . + $videoId . 'comments'; + if ($entry !== null) { + $this->_url .= '/' . $entry; + } + } + break; + default: + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception('Unknown feed type'); + break; + } + } + + /** + * Sets the location parameter for the query + * + * @param string $value + * @throws Zend_Gdata_App_InvalidArgumentException + * @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface + */ + public function setLocation($value) + { + switch($value) { + case null: + unset($this->_params['location']); + default: + $parameters = explode(',', $value); + if (count($parameters) != 2) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'You must provide 2 coordinates to the location ' . + 'URL parameter'); + } + + foreach($parameters as $param) { + $temp = trim($param); + // strip off the optional exclamation mark for numeric check + if (substr($temp, -1) == '!') { + $temp = substr($temp, -1); + } + if (!is_numeric($temp)) { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Value provided to location parameter must' . + ' be in the form of two coordinates'); + } + } + $this->_params['location'] = $value; + } + } + + /** + * Get the value of the location parameter + * + * @return string|null Return the location if it exists, null otherwise. + */ + public function getLocation() + { + if (array_key_exists('location', $this->_params)) { + return $this->_params['location']; + } else { + return null; + } + } + + + /** + * Sets the location-radius parameter for the query + * + * @param string $value + * @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface + */ + public function setLocationRadius($value) + { + switch($value) { + case null: + unset($this->_params['location-radius']); + default: + $this->_params['location-radius'] = $value; + } + } + + /** + * Get the value of the location-radius parameter + * + * @return string|null Return the location-radius if it exists, + * null otherwise. + */ + public function getLocationRadius() + { + if (array_key_exists('location-radius', $this->_params)) { + return $this->_params['location-radius']; + } else { + return null; + } + } + + /** + * Sets the time period over which this query should apply + * + * @param string $value + * @throws Zend_Gdata_App_InvalidArgumentException + * @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface + */ + public function setTime($value = null) + { + switch ($value) { + case 'today': + $this->_params['time'] = 'today'; + break; + case 'this_week': + $this->_params['time'] = 'this_week'; + break; + case 'this_month': + $this->_params['time'] = 'this_month'; + break; + case 'all_time': + $this->_params['time'] = 'all_time'; + break; + case null: + unset($this->_params['time']); + default: + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Unknown time value'); + break; + } + return $this; + } + + /** + * Sets the value of the uploader parameter + * + * @param string $value The value of the uploader parameter. Currently this + * can only be set to the value of 'partner'. + * @throws Zend_Gdata_App_InvalidArgumentException + * @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface + */ + public function setUploader($value = null) + { + switch ($value) { + case 'partner': + $this->_params['uploader'] = 'partner'; + break; + case null: + unset($this->_params['uploader']); + break; + default: + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'Unknown value for uploader'); + } + return $this; + } + + /** + * Sets the formatted video query (vq) URL param value + * + * @param string $value + * @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface + */ + public function setVideoQuery($value = null) + { + if ($value != null) { + $this->_params['vq'] = $value; + } else { + unset($this->_params['vq']); + } + return $this; + } + + /** + * Sets the param to return videos of a specific format + * + * @param string $value + * @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface + */ + public function setFormat($value = null) + { + if ($value != null) { + $this->_params['format'] = $value; + } else { + unset($this->_params['format']); + } + return $this; + } + + /** + * Sets whether or not to include racy videos in the search results + * + * @param string $value + * @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface + */ + public function setRacy($value = null) + { + switch ($value) { + case 'include': + $this->_params['racy'] = $value; + break; + case 'exclude': + $this->_params['racy'] = $value; + break; + case null: + unset($this->_params['racy']); + break; + } + return $this; + } + + /** + * Whether or not to include racy videos in the search results + * + * @return string|null The value of racy if it exists, null otherwise. + */ + public function getRacy() + { + if (array_key_exists('racy', $this->_params)) { + return $this->_params['racy']; + } else { + return null; + } + } + + /** + * Set the safeSearch parameter + * + * @param string $value The value of the parameter, currently only 'none', + * 'moderate' or 'strict' are allowed values. + * @throws Zend_Gdata_App_InvalidArgumentException + * @return Zend_Gdata_YouTube_VideoQuery Provides a fluent interface + */ + public function setSafeSearch($value) + { + switch ($value) { + case 'none': + $this->_params['safeSearch'] = 'none'; + break; + case 'moderate': + $this->_params['safeSearch'] = 'moderate'; + break; + case 'strict': + $this->_params['safeSearch'] = 'strict'; + break; + case null: + unset($this->_params['safeSearch']); + default: + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException( + 'The safeSearch parameter only supports the values '. + '\'none\', \'moderate\' or \'strict\'.'); + } + } + + /** + * Return the value of the safeSearch parameter + * + * @return string|null The value of the safeSearch parameter if it has been + * set, null otherwise. + */ + public function getSafeSearch() + { + if (array_key_exists('safeSearch', $this->_params)) { + return $this->_params['safeSearch']; + } + return $this; + } + + /** + * Set the value of the orderby parameter + * + * @param string $value + * @return Zend_Gdata_YouTube_Query Provides a fluent interface + */ + public function setOrderBy($value) + { + if ($value != null) { + $this->_params['orderby'] = $value; + } else { + unset($this->_params['orderby']); + } + return $this; + } + + /** + * Return the value of the format parameter + * + * @return string|null The value of format if it exists, null otherwise. + */ + public function getFormat() + { + if (array_key_exists('format', $this->_params)) { + return $this->_params['format']; + } else { + return null; + } + } + + /** + * Return the value of the video query that has been set + * + * @return string|null The value of the video query if it exists, + * null otherwise. + */ + public function getVideoQuery() + { + if (array_key_exists('vq', $this->_params)) { + return $this->_params['vq']; + } else { + return null; + } + } + + /** + * Return the value of the time parameter + * + * @return string|null The time parameter if it exists, null otherwise. + */ + public function getTime() + { + if (array_key_exists('time', $this->_params)) { + return $this->_params['time']; + } else { + return null; + } + } + + /** + * Return the value of the orderby parameter if it exists + * + * @return string|null The value of orderby if it exists, null otherwise. + */ + public function getOrderBy() + { + if (array_key_exists('orderby', $this->_params)) { + return $this->_params['orderby']; + } else { + return null; + } + } + + /** + * Generate the query string from the URL parameters, optionally modifying + * them based on protocol version. + * + * @param integer $majorProtocolVersion The major protocol version + * @param integer $minorProtocolVersion The minor protocol version + * @throws Zend_Gdata_App_VersionException + * @return string querystring + */ + public function getQueryString($majorProtocolVersion = null, + $minorProtocolVersion = null) + { + $queryArray = array(); + + foreach ($this->_params as $name => $value) { + if (substr($name, 0, 1) == '_') { + continue; + } + + switch($name) { + case 'location-radius': + if ($majorProtocolVersion == 1) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException("The $name " . + "parameter is only supported in version 2."); + } + break; + + case 'racy': + if ($majorProtocolVersion == 2) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException("The $name " . + "parameter is not supported in version 2. " . + "Please use 'safeSearch'."); + } + break; + + case 'safeSearch': + if ($majorProtocolVersion == 1) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException("The $name " . + "parameter is only supported in version 2. " . + "Please use 'racy'."); + } + break; + + case 'uploader': + if ($majorProtocolVersion == 1) { + require_once 'Zend/Gdata/App/VersionException.php'; + throw new Zend_Gdata_App_VersionException("The $name " . + "parameter is only supported in version 2."); + } + break; + + case 'vq': + if ($majorProtocolVersion == 2) { + $name = 'q'; + } + break; + } + + $queryArray[] = urlencode($name) . '=' . urlencode($value); + + } + if (count($queryArray) > 0) { + return '?' . implode('&', $queryArray); + } else { + return ''; + } + } + + /** + * Returns the generated full query URL, optionally modifying it based on + * the protocol version. + * + * @param integer $majorProtocolVersion The major protocol version + * @param integer $minorProtocolVersion The minor protocol version + * @return string The URL + */ + public function getQueryUrl($majorProtocolVersion = null, + $minorProtocolVersion = null) + { + if (isset($this->_url)) { + $url = $this->_url; + } else { + $url = Zend_Gdata_YouTube::VIDEO_URI; + } + if ($this->getCategory() !== null) { + $url .= '/-/' . $this->getCategory(); + } + $url = $url . $this->getQueryString($majorProtocolVersion, + $minorProtocolVersion); + return $url; + } + +} |
