diff options
Diffstat (limited to '')
46 files changed, 6531 insertions, 0 deletions
diff --git a/webmail/program/lib/Zend/Gdata/App.php b/webmail/program/lib/Zend/Gdata/App.php new file mode 100644 index 0000000..b62d95f --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App.php @@ -0,0 +1,1243 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: App.php 25259 2013-02-13 17:38:12Z frosch $ + */ + +/** + * Zend_Gdata_Feed + */ +require_once 'Zend/Gdata/App/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'; + +/** + * Zend_Uri/Http + */ +require_once 'Zend/Uri/Http.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-2012 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; + self::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 == 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 and If-Match headers + $this->_httpClient->resetParameters(); + $this->_httpClient->setHeaders(array('Slug', 'If-Match')); + + // Set the params for the new request to be performed + $this->_httpClient->setHeaders($headers); + require_once 'Zend/Uri/Http.php'; + $uri = Zend_Uri_Http::fromString($url); + preg_match("/^(.*?)(\?.*)?$/", $url, $matches); + $this->_httpClient->setUri($matches[1]); + $queryArray = $uri->getQueryAsArray(); + foreach ($queryArray as $name => $value) { + $this->_httpClient->setParameterGet($name, $value); + } + + + $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 + * @param bool $useObjectMapping Enable/disable the use of XML to object mapping. + * @throws Zend_Gdata_App_Exception + * @return string|Zend_Gdata_App_Feed Returns string only if the fourth + * parameter ($useObjectMapping) is set + * to false. + */ + public static function import($uri, $client = null, + $className='Zend_Gdata_App_Feed', $useObjectMapping = true) + { + $app = new Zend_Gdata_App($client); + $requestData = $app->prepareRequest('GET', $uri); + $response = $app->performHttpRequest( + $requestData['method'], $requestData['url']); + + $feedContent = $response->getBody(); + if (false === $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) + { + if (!class_exists($className, false)) { + require_once 'Zend/Loader.php'; + @Zend_Loader::loadClass($className); + } + + // 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_App_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()) + { + if (!class_exists($className, false)) { + require_once 'Zend/Loader.php'; + @Zend_Loader::loadClass($className); + } + + $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'; + } + + if (!class_exists($className, false)) { + require_once 'Zend/Loader.php'; + @Zend_Loader::loadClass($className); + } + + $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 { + // Autoloading disabled on next line for compatibility + // with magic factories. See ZF-6660. + if (!class_exists($name . '_' . $class, false)) { + require_once 'Zend/Loader.php'; + @Zend_Loader::loadClass($name . '_' . $class); + } + $foundClassName = $name . '_' . $class; + break; + } catch (Zend_Exception $e) { + // package wasn't here- continue searching + } catch (ErrorException $e) { + // package wasn't here- continue searching + // @see ZF-7013 and ZF-11959 + } + } + 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 object $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 string $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/webmail/program/lib/Zend/Gdata/App/AuthException.php b/webmail/program/lib/Zend/Gdata/App/AuthException.php new file mode 100644 index 0000000..58fad73 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/AuthException.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: AuthException.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/BadMethodCallException.php b/webmail/program/lib/Zend/Gdata/App/BadMethodCallException.php new file mode 100644 index 0000000..784608d --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/BadMethodCallException.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: BadMethodCallException.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * 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-2012 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/webmail/program/lib/Zend/Gdata/App/Base.php b/webmail/program/lib/Zend/Gdata/App/Base.php new file mode 100644 index 0000000..a3ed7ce --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Base.php @@ -0,0 +1,572 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Base.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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 . ' ' . + ($majorVersion === null ? 'NULL' : $majorVersion) . + ' '. ($minorVersion === null ? '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/webmail/program/lib/Zend/Gdata/App/BaseMediaSource.php b/webmail/program/lib/Zend/Gdata/App/BaseMediaSource.php new file mode 100644 index 0000000..9190465 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/BaseMediaSource.php @@ -0,0 +1,179 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: BaseMediaSource.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/CaptchaRequiredException.php b/webmail/program/lib/Zend/Gdata/App/CaptchaRequiredException.php new file mode 100644 index 0000000..b09e668 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/CaptchaRequiredException.php @@ -0,0 +1,94 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: CaptchaRequiredException.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Entry.php b/webmail/program/lib/Zend/Gdata/App/Entry.php new file mode 100644 index 0000000..1a24f3b --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Entry.php @@ -0,0 +1,389 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Entry.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Exception.php b/webmail/program/lib/Zend/Gdata/App/Exception.php new file mode 100644 index 0000000..bcfe255 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Exception.php @@ -0,0 +1,43 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Exception.php 24593 2012-01-05 20:35:02Z matthew $ + */ + + +/** + * 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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension.php b/webmail/program/lib/Zend/Gdata/App/Extension.php new file mode 100644 index 0000000..dd379c8 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Extension.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Author.php b/webmail/program/lib/Zend/Gdata/App/Extension/Author.php new file mode 100644 index 0000000..1354d8b --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Author.php @@ -0,0 +1,43 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Author.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Category.php b/webmail/program/lib/Zend/Gdata/App/Extension/Category.php new file mode 100644 index 0000000..06952bc --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Category.php @@ -0,0 +1,140 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Category.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Content.php b/webmail/program/lib/Zend/Gdata/App/Extension/Content.php new file mode 100644 index 0000000..36ff99a --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Content.php @@ -0,0 +1,88 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Content.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Contributor.php b/webmail/program/lib/Zend/Gdata/App/Extension/Contributor.php new file mode 100644 index 0000000..7f5f1c5 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Contributor.php @@ -0,0 +1,43 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Contributor.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Control.php b/webmail/program/lib/Zend/Gdata/App/Extension/Control.php new file mode 100644 index 0000000..8f02b4d --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Control.php @@ -0,0 +1,98 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Control.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Draft.php b/webmail/program/lib/Zend/Gdata/App/Extension/Draft.php new file mode 100644 index 0000000..62a91ea --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Draft.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Draft.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Edited.php b/webmail/program/lib/Zend/Gdata/App/Extension/Edited.php new file mode 100644 index 0000000..1a3a74a --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Edited.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Edited.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Element.php b/webmail/program/lib/Zend/Gdata/App/Extension/Element.php new file mode 100644 index 0000000..f473d90 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Element.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Element.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Email.php b/webmail/program/lib/Zend/Gdata/App/Extension/Email.php new file mode 100644 index 0000000..48fdb4d --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Email.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Email.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Generator.php b/webmail/program/lib/Zend/Gdata/App/Extension/Generator.php new file mode 100644 index 0000000..2f521d6 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Generator.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Generator.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Icon.php b/webmail/program/lib/Zend/Gdata/App/Extension/Icon.php new file mode 100644 index 0000000..3e55cbb --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Icon.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Icon.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Id.php b/webmail/program/lib/Zend/Gdata/App/Extension/Id.php new file mode 100644 index 0000000..bdac0cd --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Id.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Id.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Link.php b/webmail/program/lib/Zend/Gdata/App/Extension/Link.php new file mode 100644 index 0000000..ee76700 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Link.php @@ -0,0 +1,219 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Link.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Logo.php b/webmail/program/lib/Zend/Gdata/App/Extension/Logo.php new file mode 100644 index 0000000..956f2f4 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Logo.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Logo.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Name.php b/webmail/program/lib/Zend/Gdata/App/Extension/Name.php new file mode 100644 index 0000000..c851028 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Name.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Name.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Person.php b/webmail/program/lib/Zend/Gdata/App/Extension/Person.php new file mode 100644 index 0000000..7f5c2bf --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Person.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Person.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Published.php b/webmail/program/lib/Zend/Gdata/App/Extension/Published.php new file mode 100644 index 0000000..2442284 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Published.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Published.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Rights.php b/webmail/program/lib/Zend/Gdata/App/Extension/Rights.php new file mode 100644 index 0000000..d8a5a39 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Rights.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Rights.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Source.php b/webmail/program/lib/Zend/Gdata/App/Extension/Source.php new file mode 100644 index 0000000..1779c17 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Source.php @@ -0,0 +1,46 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Source.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Subtitle.php b/webmail/program/lib/Zend/Gdata/App/Extension/Subtitle.php new file mode 100644 index 0000000..ff8ee18 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Subtitle.php @@ -0,0 +1,43 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Subtitle.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Summary.php b/webmail/program/lib/Zend/Gdata/App/Extension/Summary.php new file mode 100644 index 0000000..98b9339 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Summary.php @@ -0,0 +1,43 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Summary.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Text.php b/webmail/program/lib/Zend/Gdata/App/Extension/Text.php new file mode 100644 index 0000000..9fc0c5d --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Text.php @@ -0,0 +1,90 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Text.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Title.php b/webmail/program/lib/Zend/Gdata/App/Extension/Title.php new file mode 100644 index 0000000..69899bb --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Title.php @@ -0,0 +1,43 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Title.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Updated.php b/webmail/program/lib/Zend/Gdata/App/Extension/Updated.php new file mode 100644 index 0000000..af378df --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Updated.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Updated.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Extension/Uri.php b/webmail/program/lib/Zend/Gdata/App/Extension/Uri.php new file mode 100644 index 0000000..2168b1a --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Extension/Uri.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 uri + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Uri.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/Feed.php b/webmail/program/lib/Zend/Gdata/App/Feed.php new file mode 100755 index 0000000..1f8ef84 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Feed.php @@ -0,0 +1,352 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Feed.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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, Countable +{ + + /** + * 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/webmail/program/lib/Zend/Gdata/App/FeedEntryParent.php b/webmail/program/lib/Zend/Gdata/App/FeedEntryParent.php new file mode 100755 index 0000000..51ff913 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/FeedEntryParent.php @@ -0,0 +1,681 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: FeedEntryParent.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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_FeedEntryParent 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_FeedEntryParent 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_FeedEntryParent 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/webmail/program/lib/Zend/Gdata/App/FeedSourceParent.php b/webmail/program/lib/Zend/Gdata/App/FeedSourceParent.php new file mode 100644 index 0000000..e61e41d --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/FeedSourceParent.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: FeedSourceParent.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/HttpException.php b/webmail/program/lib/Zend/Gdata/App/HttpException.php new file mode 100644 index 0000000..4ea6147 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/HttpException.php @@ -0,0 +1,121 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: HttpException.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * 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-2012 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/webmail/program/lib/Zend/Gdata/App/IOException.php b/webmail/program/lib/Zend/Gdata/App/IOException.php new file mode 100644 index 0000000..6fe1a62 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/IOException.php @@ -0,0 +1,43 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: IOException.php 24593 2012-01-05 20:35:02Z matthew $ + */ + + +/** + * 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-2012 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/webmail/program/lib/Zend/Gdata/App/InvalidArgumentException.php b/webmail/program/lib/Zend/Gdata/App/InvalidArgumentException.php new file mode 100644 index 0000000..b48777e --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/InvalidArgumentException.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: InvalidArgumentException.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * 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-2012 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/webmail/program/lib/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php b/webmail/program/lib/Zend/Gdata/App/LoggingHttpClientAdapterSocket.php new file mode 100644 index 0000000..b7c7aa5 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/LoggingHttpClientAdapterSocket.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @version $Id: LoggingHttpClientAdapterSocket.php 24593 2012-01-05 20:35:02Z matthew $ + * @copyright Copyright (c) 2005-2012 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'; + +/** + * 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-2012 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/webmail/program/lib/Zend/Gdata/App/MediaEntry.php b/webmail/program/lib/Zend/Gdata/App/MediaEntry.php new file mode 100644 index 0000000..68b47b1 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/MediaEntry.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: MediaEntry.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/MediaFileSource.php b/webmail/program/lib/Zend/Gdata/App/MediaFileSource.php new file mode 100644 index 0000000..e37bd75 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/MediaFileSource.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: MediaFileSource.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @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-2012 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/webmail/program/lib/Zend/Gdata/App/MediaSource.php b/webmail/program/lib/Zend/Gdata/App/MediaSource.php new file mode 100644 index 0000000..b99a939 --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/MediaSource.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: MediaSource.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * Interface for defining data that can be encoded and sent over the network. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 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/webmail/program/lib/Zend/Gdata/App/Util.php b/webmail/program/lib/Zend/Gdata/App/Util.php new file mode 100644 index 0000000..145895a --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/Util.php @@ -0,0 +1,112 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Util.php 24643 2012-02-25 21:35:32Z adamlundrigan $ + */ + +/** + * Utility class for static functions needed by Zend_Gdata_App + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 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((string)$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/webmail/program/lib/Zend/Gdata/App/VersionException.php b/webmail/program/lib/Zend/Gdata/App/VersionException.php new file mode 100644 index 0000000..4212b9e --- /dev/null +++ b/webmail/program/lib/Zend/Gdata/App/VersionException.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 license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage App + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: VersionException.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * 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-2012 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 +{ +} |
