Remove Zend/Gdata from our vendor library
Let's waste less space
This commit is contained in:
parent
ddf2ef5cc9
commit
5178798fa9
|
@ -1,130 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics_AccountEntry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics_AccountFeed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics_DataEntry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics_DataFeed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics_AccountQuery
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics extends Zend_Gdata
|
||||
{
|
||||
|
||||
const AUTH_SERVICE_NAME = 'analytics';
|
||||
const ANALYTICS_FEED_URI = 'https://www.googleapis.com/analytics/v2.4/data';
|
||||
const ANALYTICS_ACCOUNT_FEED_URI = 'https://www.googleapis.com/analytics/v2.4/management/accounts';
|
||||
|
||||
public static $namespaces = array(
|
||||
array('analytics', 'http://schemas.google.com/analytics/2009', 1, 0),
|
||||
array('ga', 'http://schemas.google.com/ga/2009', 1, 0)
|
||||
);
|
||||
|
||||
/**
|
||||
* Create Gdata object
|
||||
*
|
||||
* @param Zend_Http_Client $client
|
||||
* @param string $applicationId The identity of the app in the form of
|
||||
* Company-AppName-Version
|
||||
*/
|
||||
public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
$this->registerPackage('Zend_Gdata_Analytics');
|
||||
$this->registerPackage('Zend_Gdata_Analytics_Extension');
|
||||
parent::__construct($client, $applicationId);
|
||||
$this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve account feed object
|
||||
*
|
||||
* @param string|Zend_Uri_Uri $uri
|
||||
* @return Zend_Gdata_Analytics_AccountFeed
|
||||
*/
|
||||
public function getAccountFeed($uri = self::ANALYTICS_ACCOUNT_FEED_URI)
|
||||
{
|
||||
if ($uri instanceof Query) {
|
||||
$uri = $uri->getQueryUrl();
|
||||
}
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Analytics_AccountFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve data feed object
|
||||
*
|
||||
* @param string|Zend_Uri_Uri $uri
|
||||
* @return Zend_Gdata_Analytics_DataFeed
|
||||
*/
|
||||
public function getDataFeed($uri = self::ANALYTICS_FEED_URI)
|
||||
{
|
||||
if ($uri instanceof Query) {
|
||||
$uri = $uri->getQueryUrl();
|
||||
}
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Analytics_DataFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new DataQuery object.
|
||||
*
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function newDataQuery()
|
||||
{
|
||||
return new Zend_Gdata_Analytics_DataQuery();
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a new AccountQuery object.
|
||||
*
|
||||
* @return Zend_Gdata_Analytics_AccountQuery
|
||||
*/
|
||||
public function newAccountQuery()
|
||||
{
|
||||
return new Zend_Gdata_Analytics_AccountQuery();
|
||||
}
|
||||
}
|
|
@ -1,97 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics_Extension_Dimension
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics_Extension_Metric
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics_Extension_Property
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics_Extension_TableId
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_AccountEntry extends Zend_Gdata_Entry
|
||||
{
|
||||
protected $_accountId;
|
||||
protected $_accountName;
|
||||
protected $_profileId;
|
||||
protected $_webPropertyId;
|
||||
protected $_currency;
|
||||
protected $_timezone;
|
||||
protected $_tableId;
|
||||
protected $_profileName;
|
||||
protected $_goal;
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry::__construct()
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Analytics::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DOMElement $child
|
||||
* @return void
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName){
|
||||
case $this->lookupNamespace('analytics') . ':' . 'property';
|
||||
$property = new Zend_Gdata_Analytics_Extension_Property();
|
||||
$property->transferFromDOM($child);
|
||||
$this->{$property->getName()} = $property;
|
||||
break;
|
||||
case $this->lookupNamespace('analytics') . ':' . 'tableId';
|
||||
$tableId = new Zend_Gdata_Analytics_Extension_TableId();
|
||||
$tableId->transferFromDOM($child);
|
||||
$this->_tableId = $tableId;
|
||||
break;
|
||||
case $this->lookupNamespace('ga') . ':' . 'goal';
|
||||
$goal = new Zend_Gdata_Analytics_Extension_Goal();
|
||||
$goal->transferFromDOM($child);
|
||||
$this->_goal = $goal;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_AccountFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Analytics_AccountEntry';
|
||||
|
||||
/**
|
||||
* The classname for the feed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_feedClassName = 'Zend_Gdata_Analytics_AccountFeed';
|
||||
|
||||
/**
|
||||
* @see Zend_GData_Feed::__construct()
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Analytics::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
}
|
|
@ -1,189 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Query
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_AccountQuery extends Zend_Gdata_Query
|
||||
{
|
||||
const ANALYTICS_FEED_URI = 'https://www.googleapis.com/analytics/v2.4/management/accounts';
|
||||
|
||||
/**
|
||||
* The default URI used for feeds.
|
||||
*/
|
||||
protected $_defaultFeedUri = self::ANALYTICS_FEED_URI;
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_accountId = '~all';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_webpropertyId = '~all';
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_profileId = '~all';
|
||||
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_webproperties = false;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_profiles = false;
|
||||
/**
|
||||
* @var bool
|
||||
*/
|
||||
protected $_goals = false;
|
||||
|
||||
/**
|
||||
* @param string $accountId
|
||||
* @return Zend_Gdata_Analytics_AccountQuery
|
||||
*/
|
||||
public function setAccountId($accountId)
|
||||
{
|
||||
$this->_accountId = $accountId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getAccountId()
|
||||
{
|
||||
return $this->_accountId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $webpropertyId
|
||||
* @return Zend_Gdata_Analytics_AccountQuery
|
||||
*/
|
||||
public function setWebpropertyId($webpropertyId)
|
||||
{
|
||||
$this->_webpropertyId = $webpropertyId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getWebpropertyId()
|
||||
{
|
||||
return $this->_webpropertyId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $profileId
|
||||
* @return Zend_Gdata_Analytics_AccountQuery
|
||||
*/
|
||||
public function setProfileId($profileId)
|
||||
{
|
||||
$this->_profileId = $profileId;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProfileId()
|
||||
{
|
||||
return $this->_profileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $accountId
|
||||
* @return Zend_Gdata_Analytics_AccountQuery
|
||||
*/
|
||||
public function webproperties($accountId = '~all')
|
||||
{
|
||||
$this->_webproperties = true;
|
||||
$this->setAccountId($accountId);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $webpropertyId
|
||||
* @param string $accountId
|
||||
* @return Zend_Gdata_Analytics_AccountQuery
|
||||
*/
|
||||
public function profiles($webpropertyId = '~all', $accountId = '~all')
|
||||
{
|
||||
$this->_profiles = true;
|
||||
if (null !== $accountId) {
|
||||
$this->setAccountId($accountId);
|
||||
}
|
||||
$this->setWebpropertyId($webpropertyId);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $webpropertyId
|
||||
* @param string $accountId
|
||||
* @param string $accountId
|
||||
* @return Zend_Gdata_Analytics_AccountQuery
|
||||
*/
|
||||
public function goals($profileId = '~all', $webpropertyId = '~all', $accountId = '~all')
|
||||
{
|
||||
$this->_goals = true;
|
||||
if (null !== $accountId) {
|
||||
$this->setAccountId($accountId);
|
||||
}
|
||||
if (null !== $webpropertyId) {
|
||||
$this->setWebpropertyId($webpropertyId);
|
||||
}
|
||||
$this->setProfileId($profileId);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string url
|
||||
*/
|
||||
public function getQueryUrl()
|
||||
{
|
||||
$url = $this->_defaultFeedUri;
|
||||
|
||||
// add account id
|
||||
if ($this->_webproperties or $this->_profiles or $this->_goals) {
|
||||
$url .= '/' . $this->_accountId . '/webproperties';
|
||||
}
|
||||
|
||||
if ($this->_profiles or $this->_goals) {
|
||||
$url .= '/' . $this->_webpropertyId . '/profiles';
|
||||
}
|
||||
|
||||
if ($this->_goals) {
|
||||
$url .= '/' . $this->_profileId . '/goals';
|
||||
}
|
||||
|
||||
$url .= $this->getQueryString();
|
||||
return $url;
|
||||
}
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_DataEntry extends Zend_Gdata_Entry
|
||||
{
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_dimensions = array();
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_metrics = array();
|
||||
|
||||
/**
|
||||
* @param DOMElement $element
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Analytics::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param DOMElement $child
|
||||
* @return void
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('analytics') . ':' . 'dimension';
|
||||
$dimension = new Zend_Gdata_Analytics_Extension_Dimension();
|
||||
$dimension->transferFromDOM($child);
|
||||
$this->_dimensions[] = $dimension;
|
||||
break;
|
||||
case $this->lookupNamespace('analytics') . ':' . 'metric';
|
||||
$metric = new Zend_Gdata_Analytics_Extension_Metric();
|
||||
$metric->transferFromDOM($child);
|
||||
$this->_metrics[] = $metric;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function getDimension($name)
|
||||
{
|
||||
foreach ($this->_dimensions as $dimension) {
|
||||
if ($dimension->getName() == $name) {
|
||||
return $dimension;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function getMetric($name)
|
||||
{
|
||||
foreach ($this->_metrics as $metric) {
|
||||
if ($metric->getName() == $name) {
|
||||
return $metric;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return mixed
|
||||
*/
|
||||
public function getValue($name)
|
||||
{
|
||||
if (null !== ($metric = $this->getMetric($name))) {
|
||||
return $metric;
|
||||
}
|
||||
return $this->getDimension($name);
|
||||
}
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Analytics
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Geo_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_DataFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Analytics_DataEntry';
|
||||
/**
|
||||
* The classname for the feed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_feedClassName = 'Zend_Gdata_Analytics_DataFeed';
|
||||
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Analytics::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
}
|
|
@ -1,402 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Query
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_DataQuery extends Zend_Gdata_Query
|
||||
{
|
||||
const ANALYTICS_FEED_URI = 'https://www.googleapis.com/analytics/v2.4/data';
|
||||
|
||||
/**
|
||||
* The default URI used for feeds.
|
||||
*/
|
||||
protected $_defaultFeedUri = self::ANALYTICS_FEED_URI;
|
||||
|
||||
// D1. Visitor
|
||||
const DIMENSION_BROWSER = 'ga:browser';
|
||||
const DIMENSION_BROWSER_VERSION = 'ga:browserVersion';
|
||||
const DIMENSION_CITY = 'ga:city';
|
||||
const DIMENSION_CONNECTIONSPEED = 'ga:connectionSpeed';
|
||||
const DIMENSION_CONTINENT = 'ga:continent';
|
||||
const DIMENSION_COUNTRY = 'ga:country';
|
||||
const DIMENSION_DATE = 'ga:date';
|
||||
const DIMENSION_DAY = 'ga:day';
|
||||
const DIMENSION_DAYS_SINCE_LAST_VISIT= 'ga:daysSinceLastVisit';
|
||||
const DIMENSION_FLASH_VERSION = 'ga:flashVersion';
|
||||
const DIMENSION_HOSTNAME = 'ga:hostname';
|
||||
const DIMENSION_HOUR = 'ga:hour';
|
||||
const DIMENSION_JAVA_ENABLED= 'ga:javaEnabled';
|
||||
const DIMENSION_LANGUAGE= 'ga:language';
|
||||
const DIMENSION_LATITUDE = 'ga:latitude';
|
||||
const DIMENSION_LONGITUDE = 'ga:longitude';
|
||||
const DIMENSION_MONTH = 'ga:month';
|
||||
const DIMENSION_NETWORK_DOMAIN = 'ga:networkDomain';
|
||||
const DIMENSION_NETWORK_LOCATION = 'ga:networkLocation';
|
||||
const DIMENSION_OPERATING_SYSTEM = 'ga:operatingSystem';
|
||||
const DIMENSION_OPERATING_SYSTEM_VERSION = 'ga:operatingSystemVersion';
|
||||
const DIMENSION_PAGE_DEPTH = 'ga:pageDepth';
|
||||
const DIMENSION_REGION = 'ga:region';
|
||||
const DIMENSION_SCREEN_COLORS= 'ga:screenColors';
|
||||
const DIMENSION_SCREEN_RESOLUTION = 'ga:screenResolution';
|
||||
const DIMENSION_SUB_CONTINENT = 'ga:subContinent';
|
||||
const DIMENSION_USER_DEFINED_VALUE = 'ga:userDefinedValue';
|
||||
const DIMENSION_VISIT_COUNT = 'ga:visitCount';
|
||||
const DIMENSION_VISIT_LENGTH = 'ga:visitLength';
|
||||
const DIMENSION_VISITOR_TYPE = 'ga:visitorType';
|
||||
const DIMENSION_WEEK = 'ga:week';
|
||||
const DIMENSION_YEAR = 'ga:year';
|
||||
|
||||
// D2. Campaign
|
||||
const DIMENSION_AD_CONTENT = 'ga:adContent';
|
||||
const DIMENSION_AD_GROUP = 'ga:adGroup';
|
||||
const DIMENSION_AD_SLOT = 'ga:adSlot';
|
||||
const DIMENSION_AD_SLOT_POSITION = 'ga:adSlotPosition';
|
||||
const DIMENSION_CAMPAIGN = 'ga:campaign';
|
||||
const DIMENSION_KEYWORD = 'ga:keyword';
|
||||
const DIMENSION_MEDIUM = 'ga:medium';
|
||||
const DIMENSION_REFERRAL_PATH = 'ga:referralPath';
|
||||
const DIMENSION_SOURCE = 'ga:source';
|
||||
|
||||
// D3. Content
|
||||
const DIMENSION_EXIT_PAGE_PATH = 'ga:exitPagePath';
|
||||
const DIMENSION_LANDING_PAGE_PATH = 'ga:landingPagePath';
|
||||
const DIMENSION_PAGE_PATH = 'ga:pagePath';
|
||||
const DIMENSION_PAGE_TITLE = 'ga:pageTitle';
|
||||
const DIMENSION_SECOND_PAGE_PATH = 'ga:secondPagePath';
|
||||
|
||||
// D4. Ecommerce
|
||||
const DIMENSION_AFFILIATION = 'ga:affiliation';
|
||||
const DIMENSION_DAYS_TO_TRANSACTION = 'ga:daysToTransaction';
|
||||
const DIMENSION_PRODUCT_CATEGORY = 'ga:productCategory';
|
||||
const DIMENSION_PRODUCT_NAME = 'ga:productName';
|
||||
const DIMENSION_PRODUCT_SKU = 'ga:productSku';
|
||||
const DIMENSION_TRANSACTION_ID = 'ga:transactionId';
|
||||
const DIMENSION_VISITS_TO_TRANSACTION = 'ga:visitsToTransaction';
|
||||
|
||||
// D5. Internal Search
|
||||
const DIMENSION_SEARCH_CATEGORY = 'ga:searchCategory';
|
||||
const DIMENSION_SEARCH_DESTINATION_PAGE = 'ga:searchDestinationPage';
|
||||
const DIMENSION_SEARCH_KEYWORD = 'ga:searchKeyword';
|
||||
const DIMENSION_SEARCH_KEYWORD_REFINEMENT = 'ga:searchKeywordRefinement';
|
||||
const DIMENSION_SEARCH_START_PAGE = 'ga:searchStartPage';
|
||||
const DIMENSION_SEARCH_USED = 'ga:searchUsed';
|
||||
|
||||
// D6. Navigation
|
||||
const DIMENSION_NEXT_PAGE_PATH = 'ga:nextPagePath';
|
||||
const DIMENSION_PREV_PAGE_PATH= 'ga:previousPagePath';
|
||||
|
||||
// D7. Events
|
||||
const DIMENSION_EVENT_CATEGORY = 'ga:eventCategory';
|
||||
const DIMENSION_EVENT_ACTION = 'ga:eventAction';
|
||||
const DIMENSION_EVENT_LABEL = 'ga:eventLabel';
|
||||
|
||||
// D8. Custon Variables
|
||||
const DIMENSION_CUSTOM_VAR_NAME_1 = 'ga:customVarName1';
|
||||
const DIMENSION_CUSTOM_VAR_NAME_2 = 'ga:customVarName2';
|
||||
const DIMENSION_CUSTOM_VAR_NAME_3 = 'ga:customVarName3';
|
||||
const DIMENSION_CUSTOM_VAR_NAME_4 = 'ga:customVarName4';
|
||||
const DIMENSION_CUSTOM_VAR_NAME_5 = 'ga:customVarName5';
|
||||
const DIMENSION_CUSTOM_VAR_VALUE_1 = 'ga:customVarValue1';
|
||||
const DIMENSION_CUSTOM_VAR_VALUE_2 = 'ga:customVarValue2';
|
||||
const DIMENSION_CUSTOM_VAR_VALUE_3 = 'ga:customVarValue3';
|
||||
const DIMENSION_CUSTOM_VAR_VALUE_4 = 'ga:customVarValue4';
|
||||
const DIMENSION_CUSTOM_VAR_VALUE_5 = 'ga:customVarValue5';
|
||||
|
||||
// M1. Visitor
|
||||
const METRIC_BOUNCES = 'ga:bounces';
|
||||
const METRIC_ENTRANCES = 'ga:entrances';
|
||||
const METRIC_EXITS = 'ga:exits';
|
||||
const METRIC_NEW_VISITS = 'ga:newVisits';
|
||||
const METRIC_PAGEVIEWS = 'ga:pageviews';
|
||||
const METRIC_TIME_ON_PAGE = 'ga:timeOnPage';
|
||||
const METRIC_TIME_ON_SITE = 'ga:timeOnSite';
|
||||
const METRIC_VISITORS = 'ga:visitors';
|
||||
const METRIC_VISITS = 'ga:visits';
|
||||
|
||||
// M2. Campaign
|
||||
const METRIC_AD_CLICKS = 'ga:adClicks';
|
||||
const METRIC_AD_COST = 'ga:adCost';
|
||||
const METRIC_CPC = 'ga:CPC';
|
||||
const METRIC_CPM = 'ga:CPM';
|
||||
const METRIC_CTR = 'ga:CTR';
|
||||
const METRIC_IMPRESSIONS = 'ga:impressions';
|
||||
|
||||
// M3. Content
|
||||
const METRIC_UNIQUE_PAGEVIEWS = 'ga:uniquePageviews';
|
||||
|
||||
// M4. Ecommerce
|
||||
const METRIC_ITEM_REVENUE = 'ga:itemRevenue';
|
||||
const METRIC_ITEM_QUANTITY = 'ga:itemQuantity';
|
||||
const METRIC_TRANSACTIONS = 'ga:transactions';
|
||||
const METRIC_TRANSACTION_REVENUE = 'ga:transactionRevenue';
|
||||
const METRIC_TRANSACTION_SHIPPING = 'ga:transactionShipping';
|
||||
const METRIC_TRANSACTION_TAX = 'ga:transactionTax';
|
||||
const METRIC_UNIQUE_PURCHASES = 'ga:uniquePurchases';
|
||||
|
||||
// M5. Internal Search
|
||||
const METRIC_SEARCH_DEPTH = 'ga:searchDepth';
|
||||
const METRIC_SEARCH_DURATION = 'ga:searchDuration';
|
||||
const METRIC_SEARCH_EXITS = 'ga:searchExits';
|
||||
const METRIC_SEARCH_REFINEMENTS = 'ga:searchRefinements';
|
||||
const METRIC_SEARCH_UNIQUES = 'ga:searchUniques';
|
||||
const METRIC_SEARCH_VISIT = 'ga:searchVisits';
|
||||
|
||||
// M6. Goals
|
||||
const METRIC_GOAL_COMPLETIONS_ALL = 'ga:goalCompletionsAll';
|
||||
const METRIC_GOAL_STARTS_ALL = 'ga:goalStartsAll';
|
||||
const METRIC_GOAL_VALUE_ALL = 'ga:goalValueAll';
|
||||
// TODO goals 1-20
|
||||
const METRIC_GOAL_1_COMPLETION = 'ga:goal1Completions';
|
||||
const METRIC_GOAL_1_STARTS = 'ga:goal1Starts';
|
||||
const METRIC_GOAL_1_VALUE = 'ga:goal1Value';
|
||||
|
||||
// M7. Events
|
||||
const METRIC_TOTAL_EVENTS = 'ga:totalEvents';
|
||||
const METRIC_UNIQUE_EVENTS = 'ga:uniqueEvents';
|
||||
const METRIC_EVENT_VALUE = 'ga:eventValue';
|
||||
|
||||
// suported filter operators
|
||||
const EQUALS = "==";
|
||||
const EQUALS_NOT = "!=";
|
||||
const GREATER = ">";
|
||||
const LESS = ">";
|
||||
const GREATER_EQUAL = ">=";
|
||||
const LESS_EQUAL = "<=";
|
||||
const CONTAINS = "=@";
|
||||
const CONTAINS_NOT ="!@";
|
||||
const REGULAR ="=~";
|
||||
const REGULAR_NOT ="!~";
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_profileId;
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_dimensions = array();
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_metrics = array();
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_sort = array();
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected $_filters = array();
|
||||
|
||||
/**
|
||||
* @param string $id
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function setProfileId($id)
|
||||
{
|
||||
$this->_profileId = $id;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getProfileId()
|
||||
{
|
||||
return $this->_profileId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dimension
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function addDimension($dimension)
|
||||
{
|
||||
$this->_dimensions[$dimension] = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $metric
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function addMetric($metric)
|
||||
{
|
||||
$this->_metrics[$metric] = true;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getDimensions()
|
||||
{
|
||||
return $this->_dimensions;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array
|
||||
*/
|
||||
public function getMetrics()
|
||||
{
|
||||
return $this->_metrics;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $dimension
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function removeDimension($dimension)
|
||||
{
|
||||
unset($this->_dimensions[$dimension]);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @param string $metric
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function removeMetric($metric)
|
||||
{
|
||||
unset($this->_metrics[$metric]);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function setStartDate($date)
|
||||
{
|
||||
$this->setParam("start-date", $date);
|
||||
return $this;
|
||||
}
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function setEndDate($date)
|
||||
{
|
||||
$this->setParam("end-date", $date);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filter
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function addFilter($filter)
|
||||
{
|
||||
$this->_filters[] = array($filter, true);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $filter
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function addOrFilter($filter)
|
||||
{
|
||||
$this->_filters[] = array($filter, false);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sort
|
||||
* @param boolean[optional] $descending
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function addSort($sort, $descending=false)
|
||||
{
|
||||
// add to sort storage
|
||||
$this->_sort[] = ($descending?'-':'').$sort;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function clearSort()
|
||||
{
|
||||
$this->_sort = array();
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $segment
|
||||
* @return Zend_Gdata_Analytics_DataQuery
|
||||
*/
|
||||
public function setSegment($segment)
|
||||
{
|
||||
$this->setParam('segment', $segment);
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string url
|
||||
*/
|
||||
public function getQueryUrl()
|
||||
{
|
||||
$uri = $this->_defaultFeedUri;
|
||||
if (isset($this->_url)) {
|
||||
$uri = $this->_url;
|
||||
}
|
||||
|
||||
$dimensions = $this->getDimensions();
|
||||
if (!empty($dimensions)) {
|
||||
$this->setParam('dimensions', implode(",", array_keys($dimensions)));
|
||||
}
|
||||
|
||||
$metrics = $this->getMetrics();
|
||||
if (!empty($metrics)) {
|
||||
$this->setParam('metrics', implode(",", array_keys($metrics)));
|
||||
}
|
||||
|
||||
// profile id (ga:tableId)
|
||||
if ($this->getProfileId() != null) {
|
||||
$this->setParam('ids', 'ga:'.ltrim($this->getProfileId(), "ga:"));
|
||||
}
|
||||
|
||||
// sorting
|
||||
if ($this->_sort) {
|
||||
$this->setParam('sort', implode(",", $this->_sort));
|
||||
}
|
||||
|
||||
// filtering
|
||||
$filters = "";
|
||||
foreach ($this->_filters as $filter) {
|
||||
$filters.=($filter[1]===true?';':',').$filter[0];
|
||||
}
|
||||
|
||||
if ($filters!="") {
|
||||
$this->setParam('filters', ltrim($filters, ",;"));
|
||||
}
|
||||
|
||||
$uri .= $this->getQueryString();
|
||||
return $uri;
|
||||
}
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_Metric
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_Extension_Dimension
|
||||
extends Zend_Gdata_Analytics_Extension_Metric
|
||||
{
|
||||
protected $_rootNamespace = 'ga';
|
||||
protected $_rootElement = 'dimension';
|
||||
protected $_value = null;
|
||||
protected $_name = null;
|
||||
}
|
|
@ -1,51 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_Goal extends Zend_Gdata_Extension
|
||||
{
|
||||
protected $_rootNamespace = 'ga';
|
||||
protected $_rootElement = 'goal';
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Analytics::$namespaces);
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
$attribs = $this->getExtensionAttributes();
|
||||
return $attribs['name']['value'];
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_Property
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_Extension_Metric
|
||||
extends Zend_Gdata_Analytics_Extension_Property
|
||||
{
|
||||
protected $_rootNamespace = 'ga';
|
||||
protected $_rootElement = 'metric';
|
||||
protected $_value = null;
|
||||
protected $_name = null;
|
||||
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'name':
|
||||
$this->_name = $attribute->nodeValue;
|
||||
break;
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,121 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_Extension_Property extends Zend_Gdata_Extension
|
||||
{
|
||||
protected $_rootNamespace = 'ga';
|
||||
protected $_rootElement = 'property';
|
||||
protected $_value = null;
|
||||
protected $_name = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Calendar_Extension_Timezone object.
|
||||
* @param string $value (optional) The text content of the element.
|
||||
*/
|
||||
public function __construct($value = null, $name = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Analytics::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
$this->_name = $name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'name':
|
||||
$name = explode(':', $attribute->nodeValue);
|
||||
$this->_name = end($name);
|
||||
break;
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's value attribute.
|
||||
*
|
||||
* @return string The value associated with this attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's value attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Analytics_Extension_Property The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $name
|
||||
* @return Zend_Gdata_Analytics_Extension_Property
|
||||
*/
|
||||
public function setName($name)
|
||||
{
|
||||
$this->_name = $name;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getName()
|
||||
{
|
||||
return $this->_name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
}
|
|
@ -1,111 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Analytics
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Analytics
|
||||
*/
|
||||
class Zend_Gdata_Analytics_Extension_TableId extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'ga';
|
||||
protected $_rootElement = 'tableId';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Calendar_Extension_Timezone object.
|
||||
* @param string $value (optional) The text content of the element.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Analytics::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_value != null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$this->_value = $child->nodeValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's value attribute.
|
||||
*
|
||||
* @return string The value associated with this attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's value attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Calendar_Extension_Timezone The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
}
|
File diff suppressed because it is too large
Load Diff
|
@ -1,40 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Exception
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gdata exceptions
|
||||
*
|
||||
* Class to represent exceptions that occur during Gdata operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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
|
||||
{
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_Exception
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gdata APP exceptions
|
||||
*
|
||||
* Class to represent exceptions that occur during Gdata APP operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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
|
||||
{
|
||||
}
|
|
@ -1,567 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Util
|
||||
*/
|
||||
|
||||
/** @see Zend_Xml_Security */
|
||||
|
||||
/**
|
||||
* Abstract class for all XML elements
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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();
|
||||
$doc = @Zend_Xml_Security::scan($xml, $doc);
|
||||
@ini_restore('track_errors');
|
||||
if (!$doc) {
|
||||
throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg");
|
||||
}
|
||||
$element = $doc->getElementsByTagName($this->_rootElement)->item(0);
|
||||
if (!$element) {
|
||||
throw new Zend_Gdata_App_Exception('No root <' . $this->_rootElement . '> element');
|
||||
}
|
||||
$this->transferFromDOM($element);
|
||||
} else {
|
||||
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 {
|
||||
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 {
|
||||
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))) {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,175 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_MediaSource
|
||||
*/
|
||||
|
||||
/**
|
||||
* Concrete class to use a file handle as an attachment within a MediaEntry.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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 {
|
||||
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 {
|
||||
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))) {
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,93 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_CaptchaRequiredException
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,382 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_FeedEntryParent
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Content
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Edited
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Published
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Source
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Summary
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Control
|
||||
*/
|
||||
|
||||
/**
|
||||
* Concrete class for working with Atom entries.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Zend_Exception
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gdata App exceptions
|
||||
*
|
||||
* Class to represent exceptions that occur during Gdata App operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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
|
||||
{
|
||||
}
|
|
@ -1,39 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Base
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gdata App extensions
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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
|
||||
{
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:author element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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';
|
||||
|
||||
}
|
|
@ -1,139 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:category element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,87 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Text
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:content element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:contributor element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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';
|
||||
|
||||
}
|
|
@ -1,96 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Draft
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the app:control element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,49 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the app:draft element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the app:edited element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:email element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,114 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:generator element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:icon element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:id element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,218 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data model for representing an atom:link element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:logo element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,47 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:name element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
}
|
|
@ -1,159 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Name
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Email
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Uri
|
||||
*/
|
||||
|
||||
/**
|
||||
* Base class for people (currently used by atom:author, atom:contributor)
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:published element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Text
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:rights element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,44 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_FeedSourceParent
|
||||
*/
|
||||
|
||||
/**
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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';
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Text
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:subtitle element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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';
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Text
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:summary element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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';
|
||||
|
||||
}
|
|
@ -1,89 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Text
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:title element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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';
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:updated element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,48 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the atom:uri element
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,348 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_FeedSourceParent
|
||||
*/
|
||||
|
||||
/**
|
||||
* Atom feed class
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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) {
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -1,669 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Element
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Author
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Category
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Contributor
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Id
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Link
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Rights
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Title
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Updated
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Version
|
||||
*/
|
||||
|
||||
/**
|
||||
* Abstract class for common functionality in entries and feeds
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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)) {
|
||||
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)) {
|
||||
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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,261 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_FeedSourceParent
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Generator
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Icon
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Logo
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Subtitle
|
||||
*/
|
||||
|
||||
/**
|
||||
* Atom feed class
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,119 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_Exception
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Http_Client_Exception
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gdata exceptions
|
||||
*
|
||||
* Class to represent exceptions that occur during Gdata operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_Exception
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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-2014 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
|
||||
{
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_Exception
|
||||
*/
|
||||
|
||||
/**
|
||||
* Gdata exceptions
|
||||
*
|
||||
* Class to represent exceptions that occur during Gdata operations.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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
|
||||
{
|
||||
}
|
|
@ -1,118 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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$
|
||||
* @copyright Copyright (c) 2005-2014 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
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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-2014 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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,115 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_MediaSource
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_MediaMimeStream
|
||||
*/
|
||||
|
||||
/**
|
||||
* Concrete class for working with Atom entries containing multi-part data.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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 {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'You must specify the media data as a class that conforms to Zend_Gdata_App_MediaSource.');
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,143 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_MediaData
|
||||
*/
|
||||
|
||||
/**
|
||||
* Concrete class to use a file handle as an attachment within a MediaEntry.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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) {
|
||||
throw new Zend_Gdata_App_IOException("Error reading file - " .
|
||||
$this->getFilename() . '. Read failed.');
|
||||
}
|
||||
fclose($fileHandle);
|
||||
return $result;
|
||||
} else {
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,73 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Interface for defining data that can be encoded and sent over the network.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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();
|
||||
}
|
|
@ -1,109 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Utility class for static functions needed by Zend_Gdata_App
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage App
|
||||
* @copyright Copyright (c) 2005-2014 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) {
|
||||
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) {
|
||||
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) {
|
||||
throw new Zend_Gdata_App_Exception("Namespace compatible with current protocol not found.");
|
||||
}
|
||||
|
||||
return $foundKey;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,41 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_Exception
|
||||
*/
|
||||
|
||||
/**
|
||||
* 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-2014 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
|
||||
{
|
||||
}
|
|
@ -1,241 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Gdata
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_HttpClient
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Version
|
||||
*/
|
||||
|
||||
/**
|
||||
* Wrapper around Zend_Http_Client to facilitate Google's "Account Authentication
|
||||
* Proxy for Web-Based Applications".
|
||||
*
|
||||
* @see http://code.google.com/apis/accounts/AuthForWebApps.html
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Gdata
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_AuthSub
|
||||
{
|
||||
|
||||
const AUTHSUB_REQUEST_URI = 'https://www.google.com/accounts/AuthSubRequest';
|
||||
|
||||
const AUTHSUB_SESSION_TOKEN_URI = 'https://www.google.com/accounts/AuthSubSessionToken';
|
||||
|
||||
const AUTHSUB_REVOKE_TOKEN_URI = 'https://www.google.com/accounts/AuthSubRevokeToken';
|
||||
|
||||
const AUTHSUB_TOKEN_INFO_URI = 'https://www.google.com/accounts/AuthSubTokenInfo';
|
||||
|
||||
/**
|
||||
* Creates a URI to request a single-use AuthSub token.
|
||||
*
|
||||
* @param string $next (required) URL identifying the service to be
|
||||
* accessed.
|
||||
* The resulting token will enable access to the specified service only.
|
||||
* Some services may limit scope further, such as read-only access.
|
||||
* @param string $scope (required) URL identifying the service to be
|
||||
* accessed. The resulting token will enable
|
||||
* access to the specified service only.
|
||||
* Some services may limit scope further, such
|
||||
* as read-only access.
|
||||
* @param int $secure (optional) Boolean flag indicating whether the
|
||||
* authentication transaction should issue a secure
|
||||
* token (1) or a non-secure token (0). Secure tokens
|
||||
* are available to registered applications only.
|
||||
* @param int $session (optional) Boolean flag indicating whether
|
||||
* the one-time-use token may be exchanged for
|
||||
* a session token (1) or not (0).
|
||||
* @param string $request_uri (optional) URI to which to direct the
|
||||
* authentication request.
|
||||
*/
|
||||
public static function getAuthSubTokenUri($next, $scope, $secure=0, $session=0,
|
||||
$request_uri = self::AUTHSUB_REQUEST_URI)
|
||||
{
|
||||
$querystring = '?next=' . urlencode($next)
|
||||
. '&scope=' . urldecode($scope)
|
||||
. '&secure=' . urlencode($secure)
|
||||
. '&session=' . urlencode($session);
|
||||
return $request_uri . $querystring;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Upgrades a single use token to a session token
|
||||
*
|
||||
* @param string $token The single use token which is to be upgraded
|
||||
* @param Zend_Http_Client $client (optional) HTTP client to use to
|
||||
* make the request
|
||||
* @param string $request_uri (optional) URI to which to direct
|
||||
* the session token upgrade
|
||||
* @return string The upgraded token value
|
||||
* @throws Zend_Gdata_App_AuthException
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
*/
|
||||
public static function getAuthSubSessionToken(
|
||||
$token, $client = null,
|
||||
$request_uri = self::AUTHSUB_SESSION_TOKEN_URI)
|
||||
{
|
||||
$client = self::getHttpClient($token, $client);
|
||||
|
||||
if ($client instanceof Zend_Gdata_HttpClient) {
|
||||
$filterResult = $client->filterHttpRequest('GET', $request_uri);
|
||||
$url = $filterResult['url'];
|
||||
$headers = $filterResult['headers'];
|
||||
$client->setHeaders($headers);
|
||||
$client->setUri($url);
|
||||
} else {
|
||||
$client->setUri($request_uri);
|
||||
}
|
||||
|
||||
try {
|
||||
$response = $client->request('GET');
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
|
||||
}
|
||||
|
||||
// Parse Google's response
|
||||
if ($response->isSuccessful()) {
|
||||
$goog_resp = array();
|
||||
foreach (explode("\n", $response->getBody()) as $l) {
|
||||
$l = chop($l);
|
||||
if ($l) {
|
||||
list($key, $val) = explode('=', chop($l), 2);
|
||||
$goog_resp[$key] = $val;
|
||||
}
|
||||
}
|
||||
return $goog_resp['Token'];
|
||||
} else {
|
||||
throw new Zend_Gdata_App_AuthException(
|
||||
'Token upgrade failed. Reason: ' . $response->getBody());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Revoke a token
|
||||
*
|
||||
* @param string $token The token to revoke
|
||||
* @param Zend_Http_Client $client (optional) HTTP client to use to make the request
|
||||
* @param string $request_uri (optional) URI to which to direct the revokation request
|
||||
* @return boolean Whether the revokation was successful
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
*/
|
||||
public static function AuthSubRevokeToken($token, $client = null,
|
||||
$request_uri = self::AUTHSUB_REVOKE_TOKEN_URI)
|
||||
{
|
||||
$client = self::getHttpClient($token, $client);
|
||||
|
||||
if ($client instanceof Zend_Gdata_HttpClient) {
|
||||
$filterResult = $client->filterHttpRequest('GET', $request_uri);
|
||||
$url = $filterResult['url'];
|
||||
$headers = $filterResult['headers'];
|
||||
$client->setHeaders($headers);
|
||||
$client->setUri($url);
|
||||
$client->resetParameters();
|
||||
} else {
|
||||
$client->setUri($request_uri);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
try {
|
||||
$response = $client->request('GET');
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
ob_end_clean();
|
||||
throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
|
||||
}
|
||||
ob_end_clean();
|
||||
// Parse Google's response
|
||||
if ($response->isSuccessful()) {
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* get token information
|
||||
*
|
||||
* @param string $token The token to retrieve information about
|
||||
* @param Zend_Http_Client $client (optional) HTTP client to use to
|
||||
* make the request
|
||||
* @param string $request_uri (optional) URI to which to direct
|
||||
* the information request
|
||||
*/
|
||||
public static function getAuthSubTokenInfo(
|
||||
$token, $client = null, $request_uri = self::AUTHSUB_TOKEN_INFO_URI)
|
||||
{
|
||||
$client = self::getHttpClient($token, $client);
|
||||
|
||||
if ($client instanceof Zend_Gdata_HttpClient) {
|
||||
$filterResult = $client->filterHttpRequest('GET', $request_uri);
|
||||
$url = $filterResult['url'];
|
||||
$headers = $filterResult['headers'];
|
||||
$client->setHeaders($headers);
|
||||
$client->setUri($url);
|
||||
} else {
|
||||
$client->setUri($request_uri);
|
||||
}
|
||||
|
||||
ob_start();
|
||||
try {
|
||||
$response = $client->request('GET');
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
ob_end_clean();
|
||||
throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
|
||||
}
|
||||
ob_end_clean();
|
||||
return $response->getBody();
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieve a HTTP client object with AuthSub credentials attached
|
||||
* as the Authorization header
|
||||
*
|
||||
* @param string $token The token to retrieve information about
|
||||
* @param Zend_Gdata_HttpClient $client (optional) HTTP client to use to make the request
|
||||
*/
|
||||
public static function getHttpClient($token, $client = null)
|
||||
{
|
||||
if ($client == null) {
|
||||
$client = new Zend_Gdata_HttpClient();
|
||||
}
|
||||
if (!$client instanceof Zend_Gdata_HttpClient) {
|
||||
throw new Zend_Gdata_App_HttpException('Client is not an instance of Zend_Gdata_HttpClient.');
|
||||
}
|
||||
$useragent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setConfig(array(
|
||||
'strictredirects' => true,
|
||||
'useragent' => $useragent
|
||||
)
|
||||
);
|
||||
$client->setAuthSubToken($token);
|
||||
return $client;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,198 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_DublinCore
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_CollectionEntry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_CollectionFeed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_VolumeEntry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_VolumeFeed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service class for interacting with the Books service
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books extends Zend_Gdata
|
||||
{
|
||||
const VOLUME_FEED_URI = 'https://books.google.com/books/feeds/volumes';
|
||||
const MY_LIBRARY_FEED_URI = 'https://books.google.com/books/feeds/users/me/collections/library/volumes';
|
||||
const MY_ANNOTATION_FEED_URI = 'https://books.google.com/books/feeds/users/me/volumes';
|
||||
const AUTH_SERVICE_NAME = 'print';
|
||||
|
||||
/**
|
||||
* Namespaces used for Zend_Gdata_Books
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $namespaces = array(
|
||||
array('gbs', 'http://schemas.google.com/books/2008', 1, 0),
|
||||
array('dc', 'http://purl.org/dc/terms', 1, 0)
|
||||
);
|
||||
|
||||
/**
|
||||
* Create Zend_Gdata_Books object
|
||||
*
|
||||
* @param Zend_Http_Client $client (optional) The HTTP client to use when
|
||||
* when communicating with the Google servers.
|
||||
* @param string $applicationId The identity of the app in the form of Company-AppName-Version
|
||||
*/
|
||||
public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
$this->registerPackage('Zend_Gdata_Books');
|
||||
$this->registerPackage('Zend_Gdata_Books_Extension');
|
||||
parent::__construct($client, $applicationId);
|
||||
$this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a feed of volumes.
|
||||
*
|
||||
* @param Zend_Gdata_Query|string|null $location (optional) The URL to
|
||||
* query or a Zend_Gdata_Query object from which a URL can be
|
||||
* determined.
|
||||
* @return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the
|
||||
* specified URL.
|
||||
*/
|
||||
public function getVolumeFeed($location = null)
|
||||
{
|
||||
if ($location == null) {
|
||||
$uri = self::VOLUME_FEED_URI;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a specific volume entry.
|
||||
*
|
||||
* @param string|null $volumeId The volumeId of interest.
|
||||
* @param Zend_Gdata_Query|string|null $location (optional) The URL to
|
||||
* query or a Zend_Gdata_Query object from which a URL can be
|
||||
* determined.
|
||||
* @return Zend_Gdata_Books_VolumeEntry The feed of volumes found at the
|
||||
* specified URL.
|
||||
*/
|
||||
public function getVolumeEntry($volumeId = null, $location = null)
|
||||
{
|
||||
if ($volumeId !== null) {
|
||||
$uri = self::VOLUME_FEED_URI . "/" . $volumeId;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getEntry($uri, 'Zend_Gdata_Books_VolumeEntry');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a feed of volumes, by default the User library feed.
|
||||
*
|
||||
* @param Zend_Gdata_Query|string|null $location (optional) The URL to
|
||||
* query.
|
||||
* @return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the
|
||||
* specified URL.
|
||||
*/
|
||||
public function getUserLibraryFeed($location = null)
|
||||
{
|
||||
if ($location == null) {
|
||||
$uri = self::MY_LIBRARY_FEED_URI;
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a feed of volumes, by default the User annotation feed
|
||||
*
|
||||
* @param Zend_Gdata_Query|string|null $location (optional) The URL to
|
||||
* query.
|
||||
* @return Zend_Gdata_Books_VolumeFeed The feed of volumes found at the
|
||||
* specified URL.
|
||||
*/
|
||||
public function getUserAnnotationFeed($location = null)
|
||||
{
|
||||
if ($location == null) {
|
||||
$uri = self::MY_ANNOTATION_FEED_URI;
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Books_VolumeFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Insert a Volume / Annotation
|
||||
*
|
||||
* @param Zend_Gdata_Books_VolumeEntry $entry
|
||||
* @param Zend_Gdata_Query|string|null $location (optional) The URL to
|
||||
* query
|
||||
* @return Zend_Gdata_Books_VolumeEntry The inserted volume entry.
|
||||
*/
|
||||
public function insertVolume($entry, $location = null)
|
||||
{
|
||||
if ($location == null) {
|
||||
$uri = self::MY_LIBRARY_FEED_URI;
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::insertEntry(
|
||||
$entry, $uri, 'Zend_Gdata_Books_VolumeEntry');
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a Volume
|
||||
*
|
||||
* @param Zend_Gdata_Books_VolumeEntry $entry
|
||||
* @return void
|
||||
*/
|
||||
public function deleteVolume($entry)
|
||||
{
|
||||
$entry->delete();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,55 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes an entry in a feed of collections
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_CollectionEntry extends Zend_Gdata_Entry
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_CollectionEntry which
|
||||
* Describes an entry in a feed of collections
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes a Book Search collection feed
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_CollectionFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_CollectionFeed which
|
||||
* Describes a Book Search collection feed
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Books_CollectionEntry';
|
||||
|
||||
}
|
||||
|
|
@ -1,62 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_Extension_BooksLink
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes an annotation link
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_Extension_AnnotationLink extends
|
||||
Zend_Gdata_Books_Extension_BooksLink
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_Extension_AnnotationLink which
|
||||
* Describes an annotation link
|
||||
*
|
||||
* @param string|null $href Linked resource URI
|
||||
* @param string|null $rel Forward relationship
|
||||
* @param string|null $type Resource MIME type
|
||||
* @param string|null $hrefLang Resource language
|
||||
* @param string|null $title Human-readable resource title
|
||||
* @param string|null $length Resource length in octets
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Category
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes a books category
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_Extension_BooksCategory extends
|
||||
Zend_Gdata_App_Extension_Category
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_Extension_BooksCategory which
|
||||
* Describes a books category
|
||||
*
|
||||
* @param string|null $term An identifier representing the category within
|
||||
* the categorization scheme.
|
||||
* @param string|null $scheme A string containing a URI identifying the
|
||||
* categorization scheme.
|
||||
* @param string|null $label A human-readable label for display in
|
||||
* end-user applications.
|
||||
*/
|
||||
public function __construct($term = null, $scheme = null, $label = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($term, $scheme, $label);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,60 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Link
|
||||
*/
|
||||
|
||||
/**
|
||||
* Extends the base Link class with Books extensions
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_Extension_BooksLink extends Zend_Gdata_App_Extension_Link
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_Extension_BooksLink which
|
||||
* Extends the base Link class with Books extensions
|
||||
*
|
||||
* @param string|null $href Linked resource URI
|
||||
* @param string|null $rel Forward relationship
|
||||
* @param string|null $type Resource MIME type
|
||||
* @param string|null $hrefLang Resource language
|
||||
* @param string|null $title Human-readable resource title
|
||||
* @param string|null $length Resource length in octets
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,121 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes an embeddability
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_Extension_Embeddability extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gbs';
|
||||
protected $_rootElement = 'embeddability';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_Extension_Embeddability which
|
||||
* Describes an embeddability.
|
||||
*
|
||||
* @param string|null $value A programmatic value representing the book's
|
||||
* embeddability.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build this object back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistance.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_value !== null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts XML attributes from the DOM and converts them to the
|
||||
* appropriate object members.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute to be handled.
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the programmatic value that describes the embeddability of a
|
||||
* volume in Google Book Search
|
||||
*
|
||||
* @return string|null The value
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the programmatic value that describes the embeddability of a
|
||||
* volume in Google Book Search
|
||||
*
|
||||
* @param string|null $value Programmatic value that describes the
|
||||
* embeddability of a volume in Google Book Search
|
||||
* @return Zend_Gdata_Books_Extension_Embeddability Provides a fluent
|
||||
* interface
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,58 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_Extension_BooksLink
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes an info link
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_Extension_InfoLink extends
|
||||
Zend_Gdata_Books_Extension_BooksLink
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_Extension_InfoLink which
|
||||
* Describes an info link
|
||||
*
|
||||
* @param string|null $href Linked resource URI
|
||||
* @param string|null $rel Forward relationship
|
||||
* @param string|null $type Resource MIME type
|
||||
* @param string|null $hrefLang Resource language
|
||||
* @param string|null $title Human-readable resource title
|
||||
* @param string|null $length Resource length in octets
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_Extension_BooksLink
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes a preview link
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_Extension_PreviewLink extends
|
||||
Zend_Gdata_Books_Extension_BooksLink
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_Extension_PreviewLink which
|
||||
* Describes a preview link
|
||||
*
|
||||
* @param string|null $href Linked resource URI
|
||||
* @param string|null $rel Forward relationship
|
||||
* @param string|null $type Resource MIME type
|
||||
* @param string|null $hrefLang Resource language
|
||||
* @param string|null $title Human-readable resource title
|
||||
* @param string|null $length Resource length in octets
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,151 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* User-provided review
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_Extension_Review extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gbs';
|
||||
protected $_rootElement = 'review';
|
||||
protected $_lang = null;
|
||||
protected $_type = null;
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_Extension_Review which
|
||||
* User-provided review
|
||||
*
|
||||
* @param string|null $lang Review language.
|
||||
* @param string|null $type Type of text construct (typically text, html,
|
||||
* or xhtml).
|
||||
* @param string|null $value Text content of the review.
|
||||
*/
|
||||
public function __construct($lang = null, $type = null, $value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_lang = $lang;
|
||||
$this->_type = $type;
|
||||
$this->_text = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build this object back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistance.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_lang !== null) {
|
||||
$element->setAttribute('lang', $this->_lang);
|
||||
}
|
||||
if ($this->_type !== null) {
|
||||
$element->setAttribute('type', $this->_type);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts XML attributes from the DOM and converts them to the
|
||||
* appropriate object members.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute to be handled.
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'lang':
|
||||
$this->_lang = $attribute->nodeValue;
|
||||
break;
|
||||
case 'type':
|
||||
$this->_type = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the language of link title
|
||||
*
|
||||
* @return string The lang
|
||||
*/
|
||||
public function getLang()
|
||||
{
|
||||
return $this->_lang;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the type of text construct (typically 'text', 'html' or 'xhtml')
|
||||
*
|
||||
* @return string The type
|
||||
*/
|
||||
public function getType()
|
||||
{
|
||||
return $this->_type;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the language of link title
|
||||
*
|
||||
* @param string $lang language of link title
|
||||
* @return Zend_Gdata_Books_Extension_Review Provides a fluent interface
|
||||
*/
|
||||
public function setLang($lang)
|
||||
{
|
||||
$this->_lang = $lang;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the type of text construct (typically 'text', 'html' or 'xhtml')
|
||||
*
|
||||
* @param string $type type of text construct (typically 'text', 'html' or 'xhtml')
|
||||
* @return Zend_Gdata_Books_Extension_Review Provides a fluent interface
|
||||
*/
|
||||
public function setType($type)
|
||||
{
|
||||
$this->_type = $type;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_Extension_BooksLink
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes a thumbnail link
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_Extension_ThumbnailLink extends
|
||||
Zend_Gdata_Books_Extension_BooksLink
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_Extension_ThumbnailLink which
|
||||
* Describes a thumbnail link
|
||||
*
|
||||
* @param string|null $href Linked resource URI
|
||||
* @param string|null $rel Forward relationship
|
||||
* @param string|null $type Resource MIME type
|
||||
* @param string|null $hrefLang Resource language
|
||||
* @param string|null $title Human-readable resource title
|
||||
* @param string|null $length Resource length in octets
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,122 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes a viewability
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_Extension_Viewability extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gbs';
|
||||
protected $_rootElement = 'viewability';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_Extension_Viewability which
|
||||
* Describes a viewability
|
||||
*
|
||||
* @param string|null $value A programmatic value representing the book's
|
||||
* viewability mode.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build this object back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistance.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_value !== null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Extracts XML attributes from the DOM and converts them to the
|
||||
* appropriate object members.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute to be handled.
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the programmatic value that describes the viewability of a volume
|
||||
* in Google Book Search
|
||||
*
|
||||
* @return string The value
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the programmatic value that describes the viewability of a volume in
|
||||
* Google Book Search
|
||||
*
|
||||
* @param string $value programmatic value that describes the viewability
|
||||
* of a volume in Googl eBook Search
|
||||
* @return Zend_Gdata_Books_Extension_Viewability Provides a fluent
|
||||
* interface
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,671 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_Comments
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_DublinCore_Extension_Creator
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_DublinCore_Extension_Date
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_DublinCore_Extension_Description
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_Extension_Embeddability
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_DublinCore_Extension_Format
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_DublinCore_Extension_Identifier
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_DublinCore_Extension_Language
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_DublinCore_Extension_Publisher
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_Rating
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_Extension_Review
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_DublinCore_Extension_Subject
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_DublinCore_Extension_Title
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Books_Extension_Viewability
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes an entry in a feed of Book Search volumes
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_VolumeEntry extends Zend_Gdata_Entry
|
||||
{
|
||||
|
||||
const THUMBNAIL_LINK_REL = 'http://schemas.google.com/books/2008/thumbnail';
|
||||
const PREVIEW_LINK_REL = 'http://schemas.google.com/books/2008/preview';
|
||||
const INFO_LINK_REL = 'http://schemas.google.com/books/2008/info';
|
||||
const ANNOTATION_LINK_REL = 'http://schemas.google.com/books/2008/annotation';
|
||||
|
||||
protected $_comments = null;
|
||||
protected $_creators = array();
|
||||
protected $_dates = array();
|
||||
protected $_descriptions = array();
|
||||
protected $_embeddability = null;
|
||||
protected $_formats = array();
|
||||
protected $_identifiers = array();
|
||||
protected $_languages = array();
|
||||
protected $_publishers = array();
|
||||
protected $_rating = null;
|
||||
protected $_review = null;
|
||||
protected $_subjects = array();
|
||||
protected $_titles = array();
|
||||
protected $_viewability = null;
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_VolumeEntry which
|
||||
* Describes an entry in a feed of Book Search volumes
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build this object back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistance.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc);
|
||||
if ($this->_creators !== null) {
|
||||
foreach ($this->_creators as $creators) {
|
||||
$element->appendChild($creators->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
}
|
||||
if ($this->_dates !== null) {
|
||||
foreach ($this->_dates as $dates) {
|
||||
$element->appendChild($dates->getDOM($element->ownerDocument));
|
||||
}
|
||||
}
|
||||
if ($this->_descriptions !== null) {
|
||||
foreach ($this->_descriptions as $descriptions) {
|
||||
$element->appendChild($descriptions->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
}
|
||||
if ($this->_formats !== null) {
|
||||
foreach ($this->_formats as $formats) {
|
||||
$element->appendChild($formats->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
}
|
||||
if ($this->_identifiers !== null) {
|
||||
foreach ($this->_identifiers as $identifiers) {
|
||||
$element->appendChild($identifiers->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
}
|
||||
if ($this->_languages !== null) {
|
||||
foreach ($this->_languages as $languages) {
|
||||
$element->appendChild($languages->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
}
|
||||
if ($this->_publishers !== null) {
|
||||
foreach ($this->_publishers as $publishers) {
|
||||
$element->appendChild($publishers->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
}
|
||||
if ($this->_subjects !== null) {
|
||||
foreach ($this->_subjects as $subjects) {
|
||||
$element->appendChild($subjects->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
}
|
||||
if ($this->_titles !== null) {
|
||||
foreach ($this->_titles as $titles) {
|
||||
$element->appendChild($titles->getDOM($element->ownerDocument));
|
||||
}
|
||||
}
|
||||
if ($this->_comments !== null) {
|
||||
$element->appendChild($this->_comments->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
if ($this->_embeddability !== null) {
|
||||
$element->appendChild($this->_embeddability->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
if ($this->_rating !== null) {
|
||||
$element->appendChild($this->_rating->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
if ($this->_review !== null) {
|
||||
$element->appendChild($this->_review->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
if ($this->_viewability !== null) {
|
||||
$element->appendChild($this->_viewability->getDOM(
|
||||
$element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual objects of the appropriate type and stores
|
||||
* them in this object based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process.
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('dc') . ':' . 'creator':
|
||||
$creators = new Zend_Gdata_DublinCore_Extension_Creator();
|
||||
$creators->transferFromDOM($child);
|
||||
$this->_creators[] = $creators;
|
||||
break;
|
||||
case $this->lookupNamespace('dc') . ':' . 'date':
|
||||
$dates = new Zend_Gdata_DublinCore_Extension_Date();
|
||||
$dates->transferFromDOM($child);
|
||||
$this->_dates[] = $dates;
|
||||
break;
|
||||
case $this->lookupNamespace('dc') . ':' . 'description':
|
||||
$descriptions = new Zend_Gdata_DublinCore_Extension_Description();
|
||||
$descriptions->transferFromDOM($child);
|
||||
$this->_descriptions[] = $descriptions;
|
||||
break;
|
||||
case $this->lookupNamespace('dc') . ':' . 'format':
|
||||
$formats = new Zend_Gdata_DublinCore_Extension_Format();
|
||||
$formats->transferFromDOM($child);
|
||||
$this->_formats[] = $formats;
|
||||
break;
|
||||
case $this->lookupNamespace('dc') . ':' . 'identifier':
|
||||
$identifiers = new Zend_Gdata_DublinCore_Extension_Identifier();
|
||||
$identifiers->transferFromDOM($child);
|
||||
$this->_identifiers[] = $identifiers;
|
||||
break;
|
||||
case $this->lookupNamespace('dc') . ':' . 'language':
|
||||
$languages = new Zend_Gdata_DublinCore_Extension_Language();
|
||||
$languages->transferFromDOM($child);
|
||||
$this->_languages[] = $languages;
|
||||
break;
|
||||
case $this->lookupNamespace('dc') . ':' . 'publisher':
|
||||
$publishers = new Zend_Gdata_DublinCore_Extension_Publisher();
|
||||
$publishers->transferFromDOM($child);
|
||||
$this->_publishers[] = $publishers;
|
||||
break;
|
||||
case $this->lookupNamespace('dc') . ':' . 'subject':
|
||||
$subjects = new Zend_Gdata_DublinCore_Extension_Subject();
|
||||
$subjects->transferFromDOM($child);
|
||||
$this->_subjects[] = $subjects;
|
||||
break;
|
||||
case $this->lookupNamespace('dc') . ':' . 'title':
|
||||
$titles = new Zend_Gdata_DublinCore_Extension_Title();
|
||||
$titles->transferFromDOM($child);
|
||||
$this->_titles[] = $titles;
|
||||
break;
|
||||
case $this->lookupNamespace('gd') . ':' . 'comments':
|
||||
$comments = new Zend_Gdata_Extension_Comments();
|
||||
$comments->transferFromDOM($child);
|
||||
$this->_comments = $comments;
|
||||
break;
|
||||
case $this->lookupNamespace('gbs') . ':' . 'embeddability':
|
||||
$embeddability = new Zend_Gdata_Books_Extension_Embeddability();
|
||||
$embeddability->transferFromDOM($child);
|
||||
$this->_embeddability = $embeddability;
|
||||
break;
|
||||
case $this->lookupNamespace('gd') . ':' . 'rating':
|
||||
$rating = new Zend_Gdata_Extension_Rating();
|
||||
$rating->transferFromDOM($child);
|
||||
$this->_rating = $rating;
|
||||
break;
|
||||
case $this->lookupNamespace('gbs') . ':' . 'review':
|
||||
$review = new Zend_Gdata_Books_Extension_Review();
|
||||
$review->transferFromDOM($child);
|
||||
$this->_review = $review;
|
||||
break;
|
||||
case $this->lookupNamespace('gbs') . ':' . 'viewability':
|
||||
$viewability = new Zend_Gdata_Books_Extension_Viewability();
|
||||
$viewability->transferFromDOM($child);
|
||||
$this->_viewability = $viewability;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the Comments class
|
||||
*
|
||||
* @return Zend_Gdata_Extension_Comments|null The comments
|
||||
*/
|
||||
public function getComments()
|
||||
{
|
||||
return $this->_comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the creators
|
||||
*
|
||||
* @return array The creators
|
||||
*/
|
||||
public function getCreators()
|
||||
{
|
||||
return $this->_creators;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the dates
|
||||
*
|
||||
* @return array The dates
|
||||
*/
|
||||
public function getDates()
|
||||
{
|
||||
return $this->_dates;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the descriptions
|
||||
*
|
||||
* @return array The descriptions
|
||||
*/
|
||||
public function getDescriptions()
|
||||
{
|
||||
return $this->_descriptions;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the embeddability
|
||||
*
|
||||
* @return Zend_Gdata_Books_Extension_Embeddability|null The embeddability
|
||||
*/
|
||||
public function getEmbeddability()
|
||||
{
|
||||
return $this->_embeddability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the formats
|
||||
*
|
||||
* @return array The formats
|
||||
*/
|
||||
public function getFormats()
|
||||
{
|
||||
return $this->_formats;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the identifiers
|
||||
*
|
||||
* @return array The identifiers
|
||||
*/
|
||||
public function getIdentifiers()
|
||||
{
|
||||
return $this->_identifiers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the languages
|
||||
*
|
||||
* @return array The languages
|
||||
*/
|
||||
public function getLanguages()
|
||||
{
|
||||
return $this->_languages;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the publishers
|
||||
*
|
||||
* @return array The publishers
|
||||
*/
|
||||
public function getPublishers()
|
||||
{
|
||||
return $this->_publishers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rating
|
||||
*
|
||||
* @return Zend_Gdata_Extension_Rating|null The rating
|
||||
*/
|
||||
public function getRating()
|
||||
{
|
||||
return $this->_rating;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the review
|
||||
*
|
||||
* @return Zend_Gdata_Books_Extension_Review|null The review
|
||||
*/
|
||||
public function getReview()
|
||||
{
|
||||
return $this->_review;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the subjects
|
||||
*
|
||||
* @return array The subjects
|
||||
*/
|
||||
public function getSubjects()
|
||||
{
|
||||
return $this->_subjects;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the titles
|
||||
*
|
||||
* @return array The titles
|
||||
*/
|
||||
public function getTitles()
|
||||
{
|
||||
return $this->_titles;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the viewability
|
||||
*
|
||||
* @return Zend_Gdata_Books_Extension_Viewability|null The viewability
|
||||
*/
|
||||
public function getViewability()
|
||||
{
|
||||
return $this->_viewability;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the Comments class
|
||||
*
|
||||
* @param Zend_Gdata_Extension_Comments|null $comments Comments class
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setComments($comments)
|
||||
{
|
||||
$this->_comments = $comments;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the creators
|
||||
*
|
||||
* @param array $creators Creators|null
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setCreators($creators)
|
||||
{
|
||||
$this->_creators = $creators;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the dates
|
||||
*
|
||||
* @param array $dates dates
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setDates($dates)
|
||||
{
|
||||
$this->_dates = $dates;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the descriptions
|
||||
*
|
||||
* @param array $descriptions descriptions
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setDescriptions($descriptions)
|
||||
{
|
||||
$this->_descriptions = $descriptions;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the embeddability
|
||||
*
|
||||
* @param Zend_Gdata_Books_Extension_Embeddability|null $embeddability
|
||||
* embeddability
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setEmbeddability($embeddability)
|
||||
{
|
||||
$this->_embeddability = $embeddability;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the formats
|
||||
*
|
||||
* @param array $formats formats
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setFormats($formats)
|
||||
{
|
||||
$this->_formats = $formats;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the identifiers
|
||||
*
|
||||
* @param array $identifiers identifiers
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setIdentifiers($identifiers)
|
||||
{
|
||||
$this->_identifiers = $identifiers;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the languages
|
||||
*
|
||||
* @param array $languages languages
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setLanguages($languages)
|
||||
{
|
||||
$this->_languages = $languages;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the publishers
|
||||
*
|
||||
* @param array $publishers publishers
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setPublishers($publishers)
|
||||
{
|
||||
$this->_publishers = $publishers;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the rating
|
||||
*
|
||||
* @param Zend_Gdata_Extension_Rating|null $rating rating
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setRating($rating)
|
||||
{
|
||||
$this->_rating = $rating;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the review
|
||||
*
|
||||
* @param Zend_Gdata_Books_Extension_Review|null $review review
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setReview($review)
|
||||
{
|
||||
$this->_review = $review;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the subjects
|
||||
*
|
||||
* @param array $subjects subjects
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setSubjects($subjects)
|
||||
{
|
||||
$this->_subjects = $subjects;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the titles
|
||||
*
|
||||
* @param array $titles titles
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setTitles($titles)
|
||||
{
|
||||
$this->_titles = $titles;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the viewability
|
||||
*
|
||||
* @param Zend_Gdata_Books_Extension_Viewability|null $viewability
|
||||
* viewability
|
||||
* @return Zend_Gdata_Books_VolumeEntry Provides a fluent interface
|
||||
*/
|
||||
public function setViewability($viewability)
|
||||
{
|
||||
$this->_viewability = $viewability;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Gets the volume ID based upon the atom:id value
|
||||
*
|
||||
* @return string The volume ID
|
||||
* @throws Zend_Gdata_App_Exception
|
||||
*/
|
||||
public function getVolumeId()
|
||||
{
|
||||
$fullId = $this->getId()->getText();
|
||||
$position = strrpos($fullId, '/');
|
||||
if ($position === false) {
|
||||
throw new Zend_Gdata_App_Exception('Slash not found in atom:id');
|
||||
} else {
|
||||
return substr($fullId, strrpos($fullId,'/') + 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the thumbnail link
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_link|null The thumbnail link
|
||||
*/
|
||||
public function getThumbnailLink()
|
||||
{
|
||||
return $this->getLink(self::THUMBNAIL_LINK_REL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the preview link
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link|null The preview link
|
||||
*/
|
||||
public function getPreviewLink()
|
||||
{
|
||||
return $this->getLink(self::PREVIEW_LINK_REL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the info link
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link|null The info link
|
||||
*/
|
||||
public function getInfoLink()
|
||||
{
|
||||
return $this->getLink(self::INFO_LINK_REL);
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the annotations link
|
||||
*
|
||||
* @return Zend_Gdata_App_Extension_Link|null The annotations link
|
||||
*/
|
||||
public function getAnnotationLink()
|
||||
{
|
||||
return $this->getLink(self::ANNOTATION_LINK_REL);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,61 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
|
||||
/**
|
||||
* Describes a Book Search volume feed
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_VolumeFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_Books_VolumeFeed which
|
||||
* Describes a Book Search volume feed
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Books::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Books_VolumeEntry';
|
||||
|
||||
}
|
||||
|
|
@ -1,110 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_Books
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_Query
|
||||
*/
|
||||
|
||||
/**
|
||||
* Assists in constructing queries for Books volumes
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Books
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Books_VolumeQuery extends Zend_Gdata_Query
|
||||
{
|
||||
|
||||
/**
|
||||
* Create Gdata_Books_VolumeQuery object
|
||||
*
|
||||
* @param string|null $url If non-null, pre-initializes the instance to
|
||||
* use a given URL.
|
||||
*/
|
||||
public function __construct($url = null)
|
||||
{
|
||||
parent::__construct($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the minimum level of viewability of volumes to return in the search results
|
||||
*
|
||||
* @param string|null $value The minimum viewability - 'full' or 'partial'
|
||||
* @return Zend_Gdata_Books_VolumeQuery Provides a fluent interface
|
||||
*/
|
||||
public function setMinViewability($value = null)
|
||||
{
|
||||
switch ($value) {
|
||||
case 'full_view':
|
||||
$this->_params['min-viewability'] = 'full';
|
||||
break;
|
||||
case 'partial_view':
|
||||
$this->_params['min-viewability'] = 'partial';
|
||||
break;
|
||||
case null:
|
||||
unset($this->_params['min-viewability']);
|
||||
break;
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimum viewability of volumes to include in search results
|
||||
*
|
||||
* @return string|null min-viewability
|
||||
*/
|
||||
public function getMinViewability()
|
||||
{
|
||||
if (array_key_exists('min-viewability', $this->_params)) {
|
||||
return $this->_params['min-viewability'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the generated full query URL
|
||||
*
|
||||
* @return string The URL
|
||||
*/
|
||||
public function getQueryUrl()
|
||||
{
|
||||
if (isset($this->_url)) {
|
||||
$url = $this->_url;
|
||||
} else {
|
||||
$url = Zend_Gdata_Books::VOLUME_FEED_URI;
|
||||
}
|
||||
if ($this->getCategory() !== null) {
|
||||
$url .= '/-/' . $this->getCategory();
|
||||
}
|
||||
$url = $url . $this->getQueryString();
|
||||
return $url;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,162 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Calendar_EventFeed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Calendar_EventEntry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Calendar_ListFeed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Calendar_ListEntry
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service class for interacting with the Google Calendar data API
|
||||
* @link http://code.google.com/apis/gdata/calendar.html
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar extends Zend_Gdata
|
||||
{
|
||||
|
||||
const CALENDAR_FEED_URI = 'https://www.google.com/calendar/feeds';
|
||||
const CALENDAR_EVENT_FEED_URI = 'https://www.google.com/calendar/feeds/default/private/full';
|
||||
const AUTH_SERVICE_NAME = 'cl';
|
||||
|
||||
protected $_defaultPostUri = self::CALENDAR_EVENT_FEED_URI;
|
||||
|
||||
/**
|
||||
* Namespaces used for Zend_Gdata_Calendar
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $namespaces = array(
|
||||
array('gCal', 'http://schemas.google.com/gCal/2005', 1, 0)
|
||||
);
|
||||
|
||||
/**
|
||||
* Create Gdata_Calendar object
|
||||
*
|
||||
* @param Zend_Http_Client $client (optional) The HTTP client to use when
|
||||
* when communicating with the Google servers.
|
||||
* @param string $applicationId The identity of the app in the form of Company-AppName-Version
|
||||
*/
|
||||
public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
$this->registerPackage('Zend_Gdata_Calendar');
|
||||
$this->registerPackage('Zend_Gdata_Calendar_Extension');
|
||||
parent::__construct($client, $applicationId);
|
||||
$this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive feed object
|
||||
*
|
||||
* @param mixed $location The location for the feed, as a URL or Query
|
||||
* @return Zend_Gdata_Calendar_EventFeed
|
||||
*/
|
||||
public function getCalendarEventFeed($location = null)
|
||||
{
|
||||
if ($location == null) {
|
||||
$uri = self::CALENDAR_EVENT_FEED_URI;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Calendar_EventFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object
|
||||
*
|
||||
* @return Zend_Gdata_Calendar_EventEntry
|
||||
*/
|
||||
public function getCalendarEventEntry($location = null)
|
||||
{
|
||||
if ($location == null) {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Location must not be null');
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getEntry($uri, 'Zend_Gdata_Calendar_EventEntry');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Retrieve feed object
|
||||
*
|
||||
* @return Zend_Gdata_Calendar_ListFeed
|
||||
*/
|
||||
public function getCalendarListFeed()
|
||||
{
|
||||
$uri = self::CALENDAR_FEED_URI . '/default';
|
||||
return parent::getFeed($uri,'Zend_Gdata_Calendar_ListFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entryobject
|
||||
*
|
||||
* @return Zend_Gdata_Calendar_ListEntry
|
||||
*/
|
||||
public function getCalendarListEntry($location = null)
|
||||
{
|
||||
if ($location == null) {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Location must not be null');
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getEntry($uri,'Zend_Gdata_Calendar_ListEntry');
|
||||
}
|
||||
|
||||
public function insertEvent($event, $uri=null)
|
||||
{
|
||||
if ($uri == null) {
|
||||
$uri = $this->_defaultPostUri;
|
||||
}
|
||||
$newEvent = $this->insertEntry($event, $uri, 'Zend_Gdata_Calendar_EventEntry');
|
||||
return $newEvent;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,158 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Kind_EventEntry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Calendar_Extension_SendEventNotifications
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Calendar_Extension_Timezone
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Calendar_Extension_Link
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Calendar_Extension_QuickAdd
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data model class for a Google Calendar Event Entry
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_EventEntry extends Zend_Gdata_Kind_EventEntry
|
||||
{
|
||||
|
||||
protected $_entryClassName = 'Zend_Gdata_Calendar_EventEntry';
|
||||
protected $_sendEventNotifications = null;
|
||||
protected $_timezone = null;
|
||||
protected $_quickadd = null;
|
||||
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_sendEventNotifications != null) {
|
||||
$element->appendChild($this->_sendEventNotifications->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_timezone != null) {
|
||||
$element->appendChild($this->_timezone->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_quickadd != null) {
|
||||
$element->appendChild($this->_quickadd->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gCal') . ':' . 'sendEventNotifications';
|
||||
$sendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications();
|
||||
$sendEventNotifications->transferFromDOM($child);
|
||||
$this->_sendEventNotifications = $sendEventNotifications;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone';
|
||||
$timezone = new Zend_Gdata_Calendar_Extension_Timezone();
|
||||
$timezone->transferFromDOM($child);
|
||||
$this->_timezone = $timezone;
|
||||
break;
|
||||
case $this->lookupNamespace('atom') . ':' . 'link';
|
||||
$link = new Zend_Gdata_Calendar_Extension_Link();
|
||||
$link->transferFromDOM($child);
|
||||
$this->_link[] = $link;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'quickadd';
|
||||
$quickadd = new Zend_Gdata_Calendar_Extension_QuickAdd();
|
||||
$quickadd->transferFromDOM($child);
|
||||
$this->_quickadd = $quickadd;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function getSendEventNotifications()
|
||||
{
|
||||
return $this->_sendEventNotifications;
|
||||
}
|
||||
|
||||
public function setSendEventNotifications($value)
|
||||
{
|
||||
$this->_sendEventNotifications = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTimezone()
|
||||
{
|
||||
return $this->_timezone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Calendar_Extension_Timezone $value
|
||||
* @return Zend_Gdata_Extension_EventEntry Provides a fluent interface
|
||||
*/
|
||||
public function setTimezone($value)
|
||||
{
|
||||
$this->_timezone = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getQuickAdd()
|
||||
{
|
||||
return $this->_quickadd;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Calendar_Extension_QuickAdd $value
|
||||
* @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
|
||||
*/
|
||||
public function setQuickAdd($value)
|
||||
{
|
||||
$this->_quickadd = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_Timezone
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data model for a Google Calendar feed of events
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_EventFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
|
||||
protected $_timezone = null;
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Calendar_EventEntry';
|
||||
|
||||
/**
|
||||
* The classname for the feed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_feedClassName = 'Zend_Gdata_Calendar_EventFeed';
|
||||
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_timezone != null) {
|
||||
$element->appendChild($this->_timezone->getDOM($element->ownerDocument));
|
||||
}
|
||||
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone';
|
||||
$timezone = new Zend_Gdata_Calendar_Extension_Timezone();
|
||||
$timezone->transferFromDOM($child);
|
||||
$this->_timezone = $timezone;
|
||||
break;
|
||||
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function getTimezone()
|
||||
{
|
||||
return $this->_timezone;
|
||||
}
|
||||
|
||||
public function setTimezone($value)
|
||||
{
|
||||
$this->_timezone = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,485 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_App_util
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_Query
|
||||
*/
|
||||
|
||||
/**
|
||||
* Assists in constructing queries for Google Calendar events
|
||||
*
|
||||
* @link http://code.google.com/apis/gdata/calendar/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_EventQuery extends Zend_Gdata_Query
|
||||
{
|
||||
|
||||
const CALENDAR_FEED_URI = 'https://www.google.com/calendar/feeds';
|
||||
|
||||
/**
|
||||
* The default URI used for feeds.
|
||||
*/
|
||||
protected $_defaultFeedUri = self::CALENDAR_FEED_URI;
|
||||
|
||||
/**
|
||||
* The comment ID to retrieve. If null, no specific comment will be
|
||||
* retrieved unless already included in the query URI. The event ID
|
||||
* ($_event) must be set, otherwise this property is ignored.
|
||||
*/
|
||||
protected $_comments = null;
|
||||
|
||||
/**
|
||||
* The calendar address to be requested by queries. This may be an email
|
||||
* address if requesting the primary calendar for a user. Defaults to
|
||||
* "default" (the currently authenticated user). A null value should be
|
||||
* used when the calendar address has already been set as part of the
|
||||
* query URI.
|
||||
*/
|
||||
protected $_user = 'default';
|
||||
|
||||
/*
|
||||
* The visibility to be requested by queries. Defaults to "public". A
|
||||
* null value should be used when the calendar address has already been
|
||||
* set as part of the query URI.
|
||||
*/
|
||||
protected $_visibility = 'public';
|
||||
|
||||
/**
|
||||
* Projection to be requested by queries. Defaults to "full". A null value
|
||||
* should be used when the calendar address has already been set as part
|
||||
* of the query URI.
|
||||
*/
|
||||
protected $_projection = 'full';
|
||||
|
||||
/**
|
||||
* The event ID to retrieve. If null, no specific event will be retrieved
|
||||
* unless already included in the query URI.
|
||||
*/
|
||||
protected $_event = null;
|
||||
|
||||
/**
|
||||
* Create Gdata_Calendar_EventQuery object. If a URL is provided,
|
||||
* it becomes the base URL, and additional URL components may be
|
||||
* appended. For instance, if $url is 'https://www.google.com/calendar',
|
||||
* the default URL constructed will be
|
||||
* 'https://www.google.com/calendar/default/public/full'.
|
||||
*
|
||||
* If the URL already contains a calendar ID, projection, visibility,
|
||||
* event ID, or comment ID, you will need to set these fields to null
|
||||
* to prevent them from being inserted. See this class's properties for
|
||||
* more information.
|
||||
*
|
||||
* @param string $url The URL to use as the base path for requests
|
||||
*/
|
||||
public function __construct($url = null)
|
||||
{
|
||||
parent::__construct($url);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see $_comments
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function setComments($value)
|
||||
{
|
||||
$this->_comments = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see $_event
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function setEvent($value)
|
||||
{
|
||||
$this->_event = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see $_projection
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function setProjection($value)
|
||||
{
|
||||
$this->_projection = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see $_user
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function setUser($value)
|
||||
{
|
||||
$this->_user = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see $_visibility
|
||||
* @param bool $value
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function setVisibility($value)
|
||||
{
|
||||
$this->_visibility = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see $_comments;
|
||||
* @return string comments
|
||||
*/
|
||||
public function getComments()
|
||||
{
|
||||
return $this->_comments;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see $_event;
|
||||
* @return string event
|
||||
*/
|
||||
public function getEvent()
|
||||
{
|
||||
return $this->_event;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see $_projection
|
||||
* @return string projection
|
||||
*/
|
||||
public function getProjection()
|
||||
{
|
||||
return $this->_projection;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see $_user
|
||||
* @return string user
|
||||
*/
|
||||
public function getUser()
|
||||
{
|
||||
return $this->_user;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see $_visibility
|
||||
* @return string visibility
|
||||
*/
|
||||
public function getVisibility()
|
||||
{
|
||||
return $this->_visibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function setStartMax($value)
|
||||
{
|
||||
if ($value != null) {
|
||||
$this->_params['start-max'] = Zend_Gdata_App_Util::formatTimestamp($value);
|
||||
} else {
|
||||
unset($this->_params['start-max']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param int $value
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function setStartMin($value)
|
||||
{
|
||||
if ($value != null) {
|
||||
$this->_params['start-min'] = Zend_Gdata_App_Util::formatTimestamp($value);
|
||||
} else {
|
||||
unset($this->_params['start-min']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function setOrderBy($value)
|
||||
{
|
||||
if ($value != null) {
|
||||
$this->_params['orderby'] = $value;
|
||||
} else {
|
||||
unset($this->_params['orderby']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int start-max
|
||||
*/
|
||||
public function getStartMax()
|
||||
{
|
||||
if (array_key_exists('start-max', $this->_params)) {
|
||||
return $this->_params['start-max'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int start-min
|
||||
*/
|
||||
public function getStartMin()
|
||||
{
|
||||
if (array_key_exists('start-min', $this->_params)) {
|
||||
return $this->_params['start-min'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string orderby
|
||||
*/
|
||||
public function getOrderBy()
|
||||
{
|
||||
if (array_key_exists('orderby', $this->_params)) {
|
||||
return $this->_params['orderby'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string sortorder
|
||||
*/
|
||||
public function getSortOrder()
|
||||
{
|
||||
if (array_key_exists('sortorder', $this->_params)) {
|
||||
return $this->_params['sortorder'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string sortorder
|
||||
*/
|
||||
public function setSortOrder($value)
|
||||
{
|
||||
if ($value != null) {
|
||||
$this->_params['sortorder'] = $value;
|
||||
} else {
|
||||
unset($this->_params['sortorder']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string recurrence-expansion-start
|
||||
*/
|
||||
public function getRecurrenceExpansionStart()
|
||||
{
|
||||
if (array_key_exists('recurrence-expansion-start', $this->_params)) {
|
||||
return $this->_params['recurrence-expansion-start'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string recurrence-expansion-start
|
||||
*/
|
||||
public function setRecurrenceExpansionStart($value)
|
||||
{
|
||||
if ($value != null) {
|
||||
$this->_params['recurrence-expansion-start'] = Zend_Gdata_App_Util::formatTimestamp($value);
|
||||
} else {
|
||||
unset($this->_params['recurrence-expansion-start']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @return string recurrence-expansion-end
|
||||
*/
|
||||
public function getRecurrenceExpansionEnd()
|
||||
{
|
||||
if (array_key_exists('recurrence-expansion-end', $this->_params)) {
|
||||
return $this->_params['recurrence-expansion-end'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string recurrence-expansion-end
|
||||
*/
|
||||
public function setRecurrenceExpansionEnd($value)
|
||||
{
|
||||
if ($value != null) {
|
||||
$this->_params['recurrence-expansion-end'] = Zend_Gdata_App_Util::formatTimestamp($value);
|
||||
} else {
|
||||
unset($this->_params['recurrence-expansion-end']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value Also accepts bools.
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function getSingleEvents()
|
||||
{
|
||||
if (array_key_exists('singleevents', $this->_params)) {
|
||||
$value = $this->_params['singleevents'];
|
||||
switch ($value) {
|
||||
case 'true':
|
||||
return true;
|
||||
break;
|
||||
case 'false':
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'Invalid query param value for futureevents: ' .
|
||||
$value . ' It must be a boolean.');
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value Also accepts bools. If using a string, must be either "true" or "false".
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function setSingleEvents($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
if (is_bool($value)) {
|
||||
$this->_params['singleevents'] = ($value?'true':'false');
|
||||
} elseif ($value == 'true' | $value == 'false') {
|
||||
$this->_params['singleevents'] = $value;
|
||||
} else {
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'Invalid query param value for futureevents: ' .
|
||||
$value . ' It must be a boolean.');
|
||||
}
|
||||
} else {
|
||||
unset($this->_params['singleevents']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string futureevents
|
||||
*/
|
||||
public function getFutureEvents()
|
||||
{
|
||||
if (array_key_exists('futureevents', $this->_params)) {
|
||||
$value = $this->_params['futureevents'];
|
||||
switch ($value) {
|
||||
case 'true':
|
||||
return true;
|
||||
break;
|
||||
case 'false':
|
||||
return false;
|
||||
break;
|
||||
default:
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'Invalid query param value for futureevents: ' .
|
||||
$value . ' It must be a boolean.');
|
||||
}
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $value Also accepts bools. If using a string, must be either "true" or "false" or
|
||||
* an exception will be thrown on retrieval.
|
||||
* @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface
|
||||
*/
|
||||
public function setFutureEvents($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
if (is_bool($value)) {
|
||||
$this->_params['futureevents'] = ($value?'true':'false');
|
||||
} elseif ($value == 'true' | $value == 'false') {
|
||||
$this->_params['futureevents'] = $value;
|
||||
} else {
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'Invalid query param value for futureevents: ' .
|
||||
$value . ' It must be a boolean.');
|
||||
}
|
||||
} else {
|
||||
unset($this->_params['futureevents']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string url
|
||||
*/
|
||||
public function getQueryUrl()
|
||||
{
|
||||
if (isset($this->_url)) {
|
||||
$uri = $this->_url;
|
||||
} else {
|
||||
$uri = $this->_defaultFeedUri;
|
||||
}
|
||||
if ($this->getUser() != null) {
|
||||
$uri .= '/' . $this->getUser();
|
||||
}
|
||||
if ($this->getVisibility() != null) {
|
||||
$uri .= '/' . $this->getVisibility();
|
||||
}
|
||||
if ($this->getProjection() != null) {
|
||||
$uri .= '/' . $this->getProjection();
|
||||
}
|
||||
if ($this->getEvent() != null) {
|
||||
$uri .= '/' . $this->getEvent();
|
||||
if ($this->getComments() != null) {
|
||||
$uri .= '/comments/' . $this->getComments();
|
||||
}
|
||||
}
|
||||
$uri .= $this->getQueryString();
|
||||
return $uri;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the gCal:accessLevel element used by the Calendar data API
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_Extension_AccessLevel extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'accesslevel';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Calendar_Extension_AccessLevel object.
|
||||
* @param string $value (optional) The text content of the element.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_value != null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's value attribute.
|
||||
*
|
||||
* @return string The attribute being modified.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set the value for this element's value attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Calendar_Extension_Selected The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,124 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the gCal:color element used by the Calendar data API
|
||||
* to define the color of a calendar in the UI.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_Extension_Color extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'color';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Calendar_Extension_Color object.
|
||||
* @param string $value (optional) The text content of the element.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_value != null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's value attribute.
|
||||
*
|
||||
* @return string The value associated with this attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's value attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Calendar_Extension_Color The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,132 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the gCal:hidden element used by the Calendar data API
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_Extension_Hidden extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'hidden';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Calendar_Extension_Hidden object.
|
||||
* @param bool $value (optional) The value of the element.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_value !== null) {
|
||||
$element->setAttribute('value', ($this->_value ? "true" : "false"));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_value = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
$this->_value = false;
|
||||
}
|
||||
else {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's value attribute.
|
||||
*
|
||||
* @return string The requested attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's value attribute.
|
||||
*
|
||||
* @param bool $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Calendar_Extension_Hidden The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
<?php
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Specialized Link class for use with Calendar. Enables use of gCal extension elements.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_Extension_Link extends Zend_Gdata_App_Extension_Link
|
||||
{
|
||||
|
||||
protected $_webContent = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Calendar_Extension_Link object.
|
||||
* @see Zend_Gdata_App_Extension_Link#__construct
|
||||
* @param Zend_Gdata_Calendar_Extension_Webcontent $webContent
|
||||
*/
|
||||
public function __construct($href = null, $rel = null, $type = null,
|
||||
$hrefLang = null, $title = null, $length = null, $webContent = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
||||
$this->_webContent = $webContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_webContent != null) {
|
||||
$element->appendChild($this->_webContent->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates individual Entry objects of the appropriate type and
|
||||
* stores them as members of this entry based upon DOM data.
|
||||
*
|
||||
* @param DOMNode $child The DOMNode to process
|
||||
*/
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gCal') . ':' . 'webContent':
|
||||
$webContent = new Zend_Gdata_Calendar_Extension_WebContent();
|
||||
$webContent->transferFromDOM($child);
|
||||
$this->_webContent = $webContent;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's WebContent attribute.
|
||||
*
|
||||
* @return Zend_Gdata_Calendar_Extension_Webcontent The WebContent value
|
||||
*/
|
||||
public function getWebContent()
|
||||
{
|
||||
return $this->_webContent;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's WebContent attribute.
|
||||
*
|
||||
* @param Zend_Gdata_Calendar_Extension_WebContent $value The desired value for this attribute.
|
||||
* @return Zend_Calendar_Extension_Link The element being modified. Provides a fluent interface.
|
||||
*/
|
||||
public function setWebContent($value)
|
||||
{
|
||||
$this->_webContent = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
@ -1,131 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the gCal:quickAdd element used by the Calendar data API
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_Extension_QuickAdd extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'quickadd';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Calendar_Extension_QuickAdd object.
|
||||
* @param string $value (optional) The text content of the element.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_value !== null) {
|
||||
$element->setAttribute('value', ($this->_value ? "true" : "false"));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_value = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
$this->_value = false;
|
||||
}
|
||||
else {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's value attribute.
|
||||
*
|
||||
* @return string The value associated with this attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's value attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Calendar_Extension_QuickAdd The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the gCal:selected element used by the Calendar data API
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_Extension_Selected extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'selected';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Calendar_Extension_Selected object.
|
||||
* @param bool $value (optional) The value of the element.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_value !== null) {
|
||||
$element->setAttribute('value', ($this->_value ? "true" : "false"));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_value = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
$this->_value = false;
|
||||
}
|
||||
else {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's value attribute.
|
||||
*
|
||||
* @return bool The value associated with this attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's value attribute.
|
||||
*
|
||||
* @param bool $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Calendar_Extension_Selected The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,131 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Data model class to represent an entry's sendEventNotifications
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_Extension_SendEventNotifications extends Zend_Gdata_Extension
|
||||
{
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'sendEventNotifications';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Extension_SendEventNotifications object.
|
||||
* @param bool $value (optional) SendEventNotifications value as URI.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_value !== null) {
|
||||
$element->setAttribute('value', ($this->_value ? "true" : "false"));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
if ($attribute->nodeValue == "true") {
|
||||
$this->_value = true;
|
||||
}
|
||||
else if ($attribute->nodeValue == "false") {
|
||||
$this->_value = false;
|
||||
}
|
||||
else {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
||||
}
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's Value attribute.
|
||||
*
|
||||
* @return string The requested attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's Value attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Extension_SendEventNotifications The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,123 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the gCal:timezone element used by the Calendar data API
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_Extension_Timezone extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'timezone';
|
||||
protected $_value = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Calendar_Extension_Timezone object.
|
||||
* @param string $value (optional) The text content of the element.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_value = $value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_value != null) {
|
||||
$element->setAttribute('value', $this->_value);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'value':
|
||||
$this->_value = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's value attribute.
|
||||
*
|
||||
* @return string The value associated with this attribute.
|
||||
*/
|
||||
public function getValue()
|
||||
{
|
||||
return $this->_value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's value attribute.
|
||||
*
|
||||
* @param string $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Calendar_Extension_Timezone The element being modified.
|
||||
*/
|
||||
public function setValue($value)
|
||||
{
|
||||
$this->_value = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Magic toString method allows using this directly via echo
|
||||
* Works best in PHP >= 4.2.0
|
||||
*/
|
||||
public function __toString()
|
||||
{
|
||||
return $this->getValue();
|
||||
}
|
||||
|
||||
}
|
|
@ -1,176 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the gCal:webContent element used by the Calendar data API
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_Extension_WebContent extends Zend_Gdata_App_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'gCal';
|
||||
protected $_rootElement = 'webContent';
|
||||
protected $_url = null;
|
||||
protected $_height = null;
|
||||
protected $_width = null;
|
||||
|
||||
/**
|
||||
* Constructs a new Zend_Gdata_Calendar_Extension_WebContent object.
|
||||
* @param string $url (optional) The value for this element's URL attribute.
|
||||
* @param string $height (optional) The value for this element's height attribute.
|
||||
* @param string $width (optional) The value for this element's width attribute.
|
||||
*/
|
||||
public function __construct($url = null, $height = null, $width = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_url = $url;
|
||||
$this->_height = $height;
|
||||
$this->_width = $width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves a DOMElement which corresponds to this element and all
|
||||
* child properties. This is used to build an entry back into a DOM
|
||||
* and eventually XML text for sending to the server upon updates, or
|
||||
* for application storage/persistence.
|
||||
*
|
||||
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
||||
* @return DOMElement The DOMElement representing this element and all
|
||||
* child properties.
|
||||
*/
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->url != null) {
|
||||
$element->setAttribute('url', $this->_url);
|
||||
}
|
||||
if ($this->height != null) {
|
||||
$element->setAttribute('height', $this->_height);
|
||||
}
|
||||
if ($this->width != null) {
|
||||
$element->setAttribute('width', $this->_width);
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Given a DOMNode representing an attribute, tries to map the data into
|
||||
* instance members. If no mapping is defined, the name and value are
|
||||
* stored in an array.
|
||||
*
|
||||
* @param DOMNode $attribute The DOMNode attribute needed to be handled
|
||||
*/
|
||||
protected function takeAttributeFromDOM($attribute)
|
||||
{
|
||||
switch ($attribute->localName) {
|
||||
case 'url':
|
||||
$this->_url = $attribute->nodeValue;
|
||||
break;
|
||||
case 'height':
|
||||
$this->_height = $attribute->nodeValue;
|
||||
break;
|
||||
case 'width':
|
||||
$this->_width = $attribute->nodeValue;
|
||||
break;
|
||||
default:
|
||||
parent::takeAttributeFromDOM($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's URL attribute.
|
||||
*
|
||||
* @return string The desired value for this attribute.
|
||||
*/
|
||||
public function getURL()
|
||||
{
|
||||
return $this->_url;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's URL attribute.
|
||||
*
|
||||
* @param bool $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Calendar_Extension_WebContent The element being modified.
|
||||
*/
|
||||
public function setURL($value)
|
||||
{
|
||||
$this->_url = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's height attribute.
|
||||
*
|
||||
* @return int The desired value for this attribute.
|
||||
*/
|
||||
public function getHeight()
|
||||
{
|
||||
return $this->_height;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's height attribute.
|
||||
*
|
||||
* @param int $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Calendar_Extension_WebContent The element being modified.
|
||||
*/
|
||||
public function setHeight($value)
|
||||
{
|
||||
$this->_height = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the value for this element's height attribute.
|
||||
*
|
||||
* @return int The desired value for this attribute.
|
||||
*/
|
||||
public function getWidth()
|
||||
{
|
||||
return $this->_width;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value for this element's height attribute.
|
||||
*
|
||||
* @param int $value The desired value for this attribute.
|
||||
* @return Zend_Gdata_Calendar_Extension_WebContent The element being modified.
|
||||
*/
|
||||
public function setWidth($value)
|
||||
{
|
||||
$this->_width = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,238 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Entry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Calendar_Extension_AccessLevel
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Calendar_Extension_Color
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Calendar_Extension_Hidden
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Calendar_Extension_Selected
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_EventStatus
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_Visibility
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* @see Zend_Extension_Where
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a Calendar entry in the Calendar data API meta feed of a user's
|
||||
* calendars.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_ListEntry extends Zend_Gdata_Entry
|
||||
{
|
||||
|
||||
protected $_color = null;
|
||||
protected $_accessLevel = null;
|
||||
protected $_hidden = null;
|
||||
protected $_selected = null;
|
||||
protected $_timezone = null;
|
||||
protected $_where = array();
|
||||
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_accessLevel != null) {
|
||||
$element->appendChild($this->_accessLevel->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_color != null) {
|
||||
$element->appendChild($this->_color->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_hidden != null) {
|
||||
$element->appendChild($this->_hidden->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_selected != null) {
|
||||
$element->appendChild($this->_selected->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_timezone != null) {
|
||||
$element->appendChild($this->_timezone->getDOM($element->ownerDocument));
|
||||
}
|
||||
if ($this->_where != null) {
|
||||
foreach ($this->_where as $where) {
|
||||
$element->appendChild($where->getDOM($element->ownerDocument));
|
||||
}
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gCal') . ':' . 'accesslevel';
|
||||
$accessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel();
|
||||
$accessLevel->transferFromDOM($child);
|
||||
$this->_accessLevel = $accessLevel;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'color';
|
||||
$color = new Zend_Gdata_Calendar_Extension_Color();
|
||||
$color->transferFromDOM($child);
|
||||
$this->_color = $color;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'hidden';
|
||||
$hidden = new Zend_Gdata_Calendar_Extension_Hidden();
|
||||
$hidden->transferFromDOM($child);
|
||||
$this->_hidden = $hidden;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'selected';
|
||||
$selected = new Zend_Gdata_Calendar_Extension_Selected();
|
||||
$selected->transferFromDOM($child);
|
||||
$this->_selected = $selected;
|
||||
break;
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone';
|
||||
$timezone = new Zend_Gdata_Calendar_Extension_Timezone();
|
||||
$timezone->transferFromDOM($child);
|
||||
$this->_timezone = $timezone;
|
||||
break;
|
||||
case $this->lookupNamespace('gd') . ':' . 'where';
|
||||
$where = new Zend_Gdata_Extension_Where();
|
||||
$where->transferFromDOM($child);
|
||||
$this->_where[] = $where;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function getAccessLevel()
|
||||
{
|
||||
return $this->_accessLevel;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Calendar_Extension_AccessLevel $value
|
||||
* @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
|
||||
*/
|
||||
public function setAccessLevel($value)
|
||||
{
|
||||
$this->_accessLevel = $value;
|
||||
return $this;
|
||||
}
|
||||
public function getColor()
|
||||
{
|
||||
return $this->_color;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Calendar_Extension_Color $value
|
||||
* @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
|
||||
*/
|
||||
public function setColor($value)
|
||||
{
|
||||
$this->_color = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getHidden()
|
||||
{
|
||||
return $this->_hidden;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Calendar_Extension_Hidden $value
|
||||
* @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
|
||||
*/
|
||||
public function setHidden($value)
|
||||
{
|
||||
$this->_hidden = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getSelected()
|
||||
{
|
||||
return $this->_selected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Calendar_Extension_Selected $value
|
||||
* @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
|
||||
*/
|
||||
public function setSelected($value)
|
||||
{
|
||||
$this->_selected = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getTimezone()
|
||||
{
|
||||
return $this->_timezone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Calendar_Extension_Timezone $value
|
||||
* @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
|
||||
*/
|
||||
public function setTimezone($value)
|
||||
{
|
||||
$this->_timezone = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
public function getWhere()
|
||||
{
|
||||
return $this->_where;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Extension_Where $value
|
||||
* @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
|
||||
*/
|
||||
public function setWhere($value)
|
||||
{
|
||||
$this->_where = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,104 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension_Timezone
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents the meta-feed list of calendars
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Calendar
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Calendar_ListFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
protected $_timezone = null;
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Calendar_ListEntry';
|
||||
|
||||
/**
|
||||
* The classname for the feed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_feedClassName = 'Zend_Gdata_Calendar_ListFeed';
|
||||
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
||||
{
|
||||
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
||||
if ($this->_timezone != null) {
|
||||
$element->appendChild($this->_timezone->getDOM($element->ownerDocument));
|
||||
}
|
||||
return $element;
|
||||
}
|
||||
|
||||
protected function takeChildFromDOM($child)
|
||||
{
|
||||
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
||||
switch ($absoluteNodeName) {
|
||||
case $this->lookupNamespace('gCal') . ':' . 'timezone';
|
||||
$timezone = new Zend_Gdata_Calendar_Extension_Timezone();
|
||||
$timezone->transferFromDOM($child);
|
||||
$this->_timezone = $timezone;
|
||||
break;
|
||||
default:
|
||||
parent::takeChildFromDOM($child);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public function getTimezone()
|
||||
{
|
||||
return $this->_timezone;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Zend_Gdata_Calendar_Extension_Timezone $value
|
||||
* @return Zend_Gdata_Extension_ListEntry Provides a fluent interface
|
||||
*/
|
||||
public function setTimezone($value)
|
||||
{
|
||||
$this->_timezone = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,174 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Gdata
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_HttpClient
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Version
|
||||
*/
|
||||
|
||||
/**
|
||||
* Class to facilitate Google's "Account Authentication
|
||||
* for Installed Applications" also known as "ClientLogin".
|
||||
* @see http://code.google.com/apis/accounts/AuthForInstalledApps.html
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Gdata
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_ClientLogin
|
||||
{
|
||||
|
||||
/**
|
||||
* The Google client login URI
|
||||
*
|
||||
*/
|
||||
const CLIENTLOGIN_URI = 'https://www.google.com/accounts/ClientLogin';
|
||||
|
||||
/**
|
||||
* The default 'source' parameter to send to Google
|
||||
*
|
||||
*/
|
||||
const DEFAULT_SOURCE = 'Zend-ZendFramework';
|
||||
|
||||
/**
|
||||
* Set Google authentication credentials.
|
||||
* Must be done before trying to do any Google Data operations that
|
||||
* require authentication.
|
||||
* For example, viewing private data, or posting or deleting entries.
|
||||
*
|
||||
* @param string $email
|
||||
* @param string $password
|
||||
* @param string $service
|
||||
* @param Zend_Gdata_HttpClient $client
|
||||
* @param string $source
|
||||
* @param string $loginToken The token identifier as provided by the server.
|
||||
* @param string $loginCaptcha The user's response to the CAPTCHA challenge.
|
||||
* @param string $accountType An optional string to identify whether the
|
||||
* account to be authenticated is a google or a hosted account. Defaults to
|
||||
* 'HOSTED_OR_GOOGLE'. See: http://code.google.com/apis/accounts/docs/AuthForInstalledApps.html#Request
|
||||
* @throws Zend_Gdata_App_AuthException
|
||||
* @throws Zend_Gdata_App_HttpException
|
||||
* @throws Zend_Gdata_App_CaptchaRequiredException
|
||||
* @return Zend_Gdata_HttpClient
|
||||
*/
|
||||
public static function getHttpClient($email, $password, $service = 'xapi',
|
||||
$client = null,
|
||||
$source = self::DEFAULT_SOURCE,
|
||||
$loginToken = null,
|
||||
$loginCaptcha = null,
|
||||
$loginUri = self::CLIENTLOGIN_URI,
|
||||
$accountType = 'HOSTED_OR_GOOGLE')
|
||||
{
|
||||
if (! ($email && $password)) {
|
||||
throw new Zend_Gdata_App_AuthException(
|
||||
'Please set your Google credentials before trying to ' .
|
||||
'authenticate');
|
||||
}
|
||||
|
||||
if ($client == null) {
|
||||
$client = new Zend_Gdata_HttpClient();
|
||||
}
|
||||
if (!$client instanceof Zend_Http_Client) {
|
||||
throw new Zend_Gdata_App_HttpException(
|
||||
'Client is not an instance of Zend_Http_Client.');
|
||||
}
|
||||
|
||||
// Build the HTTP client for authentication
|
||||
$client->setUri($loginUri);
|
||||
$useragent = $source . ' Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setConfig(array(
|
||||
'maxredirects' => 0,
|
||||
'strictredirects' => true,
|
||||
'useragent' => $useragent
|
||||
)
|
||||
);
|
||||
$client->setParameterPost('accountType', $accountType);
|
||||
$client->setParameterPost('Email', (string) $email);
|
||||
$client->setParameterPost('Passwd', (string) $password);
|
||||
$client->setParameterPost('service', (string) $service);
|
||||
$client->setParameterPost('source', (string) $source);
|
||||
if ($loginToken || $loginCaptcha) {
|
||||
if($loginToken && $loginCaptcha) {
|
||||
$client->setParameterPost('logintoken', (string) $loginToken);
|
||||
$client->setParameterPost('logincaptcha',
|
||||
(string) $loginCaptcha);
|
||||
}
|
||||
else {
|
||||
throw new Zend_Gdata_App_AuthException(
|
||||
'Please provide both a token ID and a user\'s response ' .
|
||||
'to the CAPTCHA challenge.');
|
||||
}
|
||||
}
|
||||
|
||||
// Send the authentication request
|
||||
// For some reason Google's server causes an SSL error. We use the
|
||||
// output buffer to supress an error from being shown. Ugly - but works!
|
||||
ob_start();
|
||||
try {
|
||||
$response = $client->request('POST');
|
||||
} catch (Zend_Http_Client_Exception $e) {
|
||||
throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
|
||||
}
|
||||
ob_end_clean();
|
||||
|
||||
// Parse Google's response
|
||||
$goog_resp = array();
|
||||
foreach (explode("\n", $response->getBody()) as $l) {
|
||||
$l = chop($l);
|
||||
if ($l) {
|
||||
list($key, $val) = explode('=', chop($l), 2);
|
||||
$goog_resp[$key] = $val;
|
||||
}
|
||||
}
|
||||
|
||||
if ($response->getStatus() == 200) {
|
||||
$client->setClientLoginToken($goog_resp['Auth']);
|
||||
$useragent = $source . ' Zend_Framework_Gdata/' . Zend_Version::VERSION;
|
||||
$client->setConfig(array(
|
||||
'strictredirects' => true,
|
||||
'useragent' => $useragent
|
||||
)
|
||||
);
|
||||
return $client;
|
||||
|
||||
} elseif ($response->getStatus() == 403) {
|
||||
// Check if the server asked for a CAPTCHA
|
||||
if (array_key_exists('Error', $goog_resp) &&
|
||||
$goog_resp['Error'] == 'CaptchaRequired') {
|
||||
throw new Zend_Gdata_App_CaptchaRequiredException(
|
||||
$goog_resp['CaptchaToken'], $goog_resp['CaptchaUrl']);
|
||||
}
|
||||
else {
|
||||
throw new Zend_Gdata_App_AuthException('Authentication with Google failed. Reason: ' .
|
||||
(isset($goog_resp['Error']) ? $goog_resp['Error'] : 'Unspecified.'));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -1,315 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Docs
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Docs_DocumentListFeed
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Docs_DocumentListEntry
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Category
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_App_Extension_Title
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service class for interacting with the Google Document List data API
|
||||
* @link http://code.google.com/apis/documents/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Docs
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Docs extends Zend_Gdata
|
||||
{
|
||||
const DOCUMENTS_LIST_FEED_URI = 'https://docs.google.com/feeds/documents/private/full';
|
||||
const DOCUMENTS_FOLDER_FEED_URI = 'https://docs.google.com/feeds/folders/private/full';
|
||||
const DOCUMENTS_CATEGORY_SCHEMA = 'http://schemas.google.com/g/2005#kind';
|
||||
const DOCUMENTS_CATEGORY_TERM = 'http://schemas.google.com/docs/2007#folder';
|
||||
const AUTH_SERVICE_NAME = 'writely';
|
||||
|
||||
/**
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultPostUri = self::DOCUMENTS_LIST_FEED_URI;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
protected static $SUPPORTED_FILETYPES = array(
|
||||
'TXT' => 'text/plain',
|
||||
'CSV' => 'text/csv',
|
||||
'TSV' => 'text/tab-separated-values',
|
||||
'TAB' => 'text/tab-separated-values',
|
||||
'HTML' => 'text/html',
|
||||
'HTM' => 'text/html',
|
||||
'DOC' => 'application/msword',
|
||||
'DOCX' => 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',
|
||||
'ODS' => 'application/vnd.oasis.opendocument.spreadsheet',
|
||||
'ODT' => 'application/vnd.oasis.opendocument.text',
|
||||
'RTF' => 'application/rtf',
|
||||
'SXW' => 'application/vnd.sun.xml.writer',
|
||||
'XLS' => 'application/vnd.ms-excel',
|
||||
'XLSX' => 'application/vnd.ms-excel',
|
||||
'PPT' => 'application/vnd.ms-powerpoint',
|
||||
'PPS' => 'application/vnd.ms-powerpoint'
|
||||
);
|
||||
|
||||
/**
|
||||
* Create Gdata_Docs object
|
||||
*
|
||||
* @param Zend_Http_Client $client (optional) The HTTP client to use when
|
||||
* when communicating with the Google servers.
|
||||
* @param string $applicationId The identity of the app in the form of Company-AppName-Version
|
||||
*/
|
||||
public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
$this->registerPackage('Zend_Gdata_Docs');
|
||||
parent::__construct($client, $applicationId);
|
||||
$this->_httpClient->setParameterPost('service', self::AUTH_SERVICE_NAME);
|
||||
}
|
||||
|
||||
/**
|
||||
* Looks up the mime type based on the file name extension. For example,
|
||||
* calling this method with 'csv' would return
|
||||
* 'text/comma-separated-values'. The Mime type is sent as a header in
|
||||
* the upload HTTP POST request.
|
||||
*
|
||||
* @param string $fileExtension
|
||||
* @return string The mime type to be sent to the server to tell it how the
|
||||
* multipart mime data should be interpreted.
|
||||
*/
|
||||
public static function lookupMimeType($fileExtension)
|
||||
{
|
||||
return self::$SUPPORTED_FILETYPES[strtoupper($fileExtension)];
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive feed object containing entries for the user's documents.
|
||||
*
|
||||
* @param mixed $location The location for the feed, as a URL or Query
|
||||
* @return Zend_Gdata_Docs_DocumentListFeed
|
||||
*/
|
||||
public function getDocumentListFeed($location = null)
|
||||
{
|
||||
if ($location === null) {
|
||||
$uri = self::DOCUMENTS_LIST_FEED_URI;
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getFeed($uri, 'Zend_Gdata_Docs_DocumentListFeed');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object representing a single document.
|
||||
*
|
||||
* @param mixed $location The location for the entry, as a URL or Query
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry
|
||||
* @throws Zend_Gdata_App_InvalidArgumentException
|
||||
*/
|
||||
public function getDocumentListEntry($location = null)
|
||||
{
|
||||
if ($location === null) {
|
||||
throw new Zend_Gdata_App_InvalidArgumentException(
|
||||
'Location must not be null'
|
||||
);
|
||||
} else if ($location instanceof Zend_Gdata_Query) {
|
||||
$uri = $location->getQueryUrl();
|
||||
} else {
|
||||
$uri = $location;
|
||||
}
|
||||
return parent::getEntry($uri, 'Zend_Gdata_Docs_DocumentListEntry');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object representing a single document.
|
||||
*
|
||||
* This method builds the URL where this item is stored using the type
|
||||
* and the id of the document.
|
||||
* @param string $docId The URL key for the document. Examples:
|
||||
* dcmg89gw_62hfjj8m, pKq0CzjiF3YmGd0AIlHKqeg
|
||||
* @param string $docType The type of the document as used in the Google
|
||||
* Document List URLs. Examples: document, spreadsheet, presentation
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry
|
||||
*/
|
||||
public function getDoc($docId, $docType)
|
||||
{
|
||||
$location = 'https://docs.google.com/feeds/documents/private/full/' .
|
||||
$docType . '%3A' . $docId;
|
||||
|
||||
return $this->getDocumentListEntry($location);
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object for the desired word processing document.
|
||||
*
|
||||
* @param string $id The URL id for the document. Example: dcmg89gw_62hfjj8m
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry
|
||||
*/
|
||||
public function getDocument($id)
|
||||
{
|
||||
return $this->getDoc($id, 'document');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object for the desired spreadsheet.
|
||||
*
|
||||
* @param string $id The URL id for the document. Example: pKq0CzjiF3YmGd0AIlHKqeg
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry
|
||||
*/
|
||||
public function getSpreadsheet($id)
|
||||
{
|
||||
return $this->getDoc($id, 'spreadsheet');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retreive entry object for the desired presentation.
|
||||
*
|
||||
* @param string $id The URL id for the document. Example: dcmg89gw_21gtrjcn
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry
|
||||
*/
|
||||
public function getPresentation($id)
|
||||
{
|
||||
return $this->getDoc($id, 'presentation');
|
||||
}
|
||||
|
||||
/**
|
||||
* Upload a local file to create a new Google Document entry.
|
||||
*
|
||||
* @param string $fileLocation The full or relative path of the file to
|
||||
* be uploaded.
|
||||
* @param string $title The name that this document should have on the
|
||||
* server. If set, the title is used as the slug header in the
|
||||
* POST request. If no title is provided, the location of the
|
||||
* file will be used as the slug header in the request. If no
|
||||
* mimeType is provided, this method attempts to determine the
|
||||
* mime type based on the slugHeader by looking for .doc,
|
||||
* .csv, .txt, etc. at the end of the file name.
|
||||
* Example value: 'test.doc'.
|
||||
* @param string $mimeType Describes the type of data which is being sent
|
||||
* to the server. This must be one of the accepted mime types
|
||||
* which are enumerated in SUPPORTED_FILETYPES.
|
||||
* @param string $uri (optional) The URL to which the upload should be
|
||||
* made.
|
||||
* Example: 'https://docs.google.com/feeds/documents/private/full'.
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry The entry for the newly
|
||||
* created Google Document.
|
||||
*/
|
||||
public function uploadFile($fileLocation, $title = null, $mimeType = null,
|
||||
$uri = null
|
||||
)
|
||||
{
|
||||
// Set the URI to which the file will be uploaded.
|
||||
if ($uri === null) {
|
||||
$uri = $this->_defaultPostUri;
|
||||
}
|
||||
|
||||
// Create the media source which describes the file.
|
||||
$fs = $this->newMediaFileSource($fileLocation);
|
||||
if ($title !== null) {
|
||||
$slugHeader = $title;
|
||||
} else {
|
||||
$slugHeader = $fileLocation;
|
||||
}
|
||||
|
||||
// Set the slug header to tell the Google Documents server what the
|
||||
// title of the document should be and what the file extension was
|
||||
// for the original file.
|
||||
$fs->setSlug($slugHeader);
|
||||
|
||||
// Set the mime type of the data.
|
||||
if ($mimeType === null) {
|
||||
$filenameParts = explode('.', $fileLocation);
|
||||
$fileExtension = end($filenameParts);
|
||||
$mimeType = self::lookupMimeType($fileExtension);
|
||||
}
|
||||
|
||||
// Set the mime type for the upload request.
|
||||
$fs->setContentType($mimeType);
|
||||
|
||||
// Send the data to the server.
|
||||
return $this->insertDocument($fs, $uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new folder in Google Docs
|
||||
*
|
||||
* @param string $folderName The folder name to create
|
||||
* @param string|null $folderResourceId The parent folder to create it in
|
||||
* ("folder%3Amy_parent_folder")
|
||||
* @return Zend_Gdata_Entry The folder entry created.
|
||||
* @todo ZF-8732: This should return a *subclass* of Zend_Gdata_Entry, but
|
||||
* the appropriate type doesn't exist yet.
|
||||
*/
|
||||
public function createFolder($folderName, $folderResourceId = null)
|
||||
{
|
||||
$category = new Zend_Gdata_App_Extension_Category(
|
||||
self::DOCUMENTS_CATEGORY_TERM,
|
||||
self::DOCUMENTS_CATEGORY_SCHEMA
|
||||
);
|
||||
$title = new Zend_Gdata_App_Extension_Title($folderName);
|
||||
$entry = new Zend_Gdata_Entry();
|
||||
|
||||
$entry->setCategory(array($category));
|
||||
$entry->setTitle($title);
|
||||
|
||||
$uri = self::DOCUMENTS_LIST_FEED_URI;
|
||||
if ($folderResourceId != null) {
|
||||
$uri = self::DOCUMENTS_FOLDER_FEED_URI . '/' . $folderResourceId;
|
||||
}
|
||||
|
||||
return $this->insertEntry($entry, $uri);
|
||||
}
|
||||
|
||||
/**
|
||||
* Inserts an entry to a given URI and returns the response as an Entry.
|
||||
*
|
||||
* @param mixed $data The Zend_Gdata_Docs_DocumentListEntry or media
|
||||
* source to post. If it is a DocumentListEntry, the mediaSource
|
||||
* should already have been set. If $data is a mediaSource, it
|
||||
* should have the correct slug header and mime type.
|
||||
* @param string $uri POST URI
|
||||
* @param string $className (optional) The class of entry to be returned.
|
||||
* The default is a 'Zend_Gdata_Docs_DocumentListEntry'.
|
||||
* @return Zend_Gdata_Docs_DocumentListEntry The entry returned by the
|
||||
* service after insertion.
|
||||
*/
|
||||
public function insertDocument($data, $uri,
|
||||
$className = 'Zend_Gdata_Docs_DocumentListEntry')
|
||||
{
|
||||
return $this->insertEntry($data, $uri, $className);
|
||||
}
|
||||
}
|
|
@ -1,53 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Docs
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_EntryAtom
|
||||
*/
|
||||
|
||||
/**
|
||||
* Represents a Documents List entry in the Documents List data API meta feed
|
||||
* of a user's documents.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Docs
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Docs_DocumentListEntry extends Zend_Gdata_Entry
|
||||
{
|
||||
|
||||
/**
|
||||
* Create a new instance of an entry representing a document.
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Docs::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,67 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Docs
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Feed
|
||||
*/
|
||||
|
||||
|
||||
/**
|
||||
* Data model for a Google Documents List feed of documents
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Docs
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Docs_DocumentListFeed extends Zend_Gdata_Feed
|
||||
{
|
||||
|
||||
/**
|
||||
* The classname for individual feed elements.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_entryClassName = 'Zend_Gdata_Docs_DocumentListEntry';
|
||||
|
||||
/**
|
||||
* The classname for the feed.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_feedClassName = 'Zend_Gdata_Docs_DocumentListFeed';
|
||||
|
||||
/**
|
||||
* Create a new instance of a feed for a list of documents.
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($element = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_Docs::$namespaces);
|
||||
parent::__construct($element);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,219 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 Docs
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* Zend_Gdata_Query
|
||||
*/
|
||||
|
||||
/**
|
||||
* Assists in constructing queries for Google Document List documents
|
||||
*
|
||||
* @link http://code.google.com/apis/gdata/spreadsheets/
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage Docs
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_Docs_Query extends Zend_Gdata_Query
|
||||
{
|
||||
|
||||
/**
|
||||
* The base URL for retrieving a document list
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
const DOCUMENTS_LIST_FEED_URI = 'https://docs.google.com/feeds/documents';
|
||||
|
||||
/**
|
||||
* The generic base URL used by some inherited methods
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_defaultFeedUri = self::DOCUMENTS_LIST_FEED_URI;
|
||||
|
||||
/**
|
||||
* The visibility to be used when querying for the feed. A request for a
|
||||
* feed with private visbility requires the user to be authenricated.
|
||||
* Private is the only avilable visibility for the documents list.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_visibility = 'private';
|
||||
|
||||
/**
|
||||
* The projection determines how much detail should be given in the
|
||||
* result of the query. Full is the only valid projection for the
|
||||
* documents list.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $_projection = 'full';
|
||||
|
||||
/**
|
||||
* Constructs a new instance of a Zend_Gdata_Docs_Query object.
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the projection for this query. Common values for projection
|
||||
* include 'full'.
|
||||
*
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Docs_Query Provides a fluent interface
|
||||
*/
|
||||
public function setProjection($value)
|
||||
{
|
||||
$this->_projection = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the visibility for this query. Common values for visibility
|
||||
* include 'private'.
|
||||
*
|
||||
* @return Zend_Gdata_Docs_Query Provides a fluent interface
|
||||
*/
|
||||
public function setVisibility($value)
|
||||
{
|
||||
$this->_visibility = $value;
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the projection for this query.
|
||||
*
|
||||
* @return string projection
|
||||
*/
|
||||
public function getProjection()
|
||||
{
|
||||
return $this->_projection;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the visibility for this query.
|
||||
*
|
||||
* @return string visibility
|
||||
*/
|
||||
public function getVisibility()
|
||||
{
|
||||
return $this->_visibility;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title attribute for this query. The title parameter is used
|
||||
* to restrict the results to documents whose titles either contain or
|
||||
* completely match the title.
|
||||
*
|
||||
* @param string $value
|
||||
* @return Zend_Gdata_Docs_Query Provides a fluent interface
|
||||
*/
|
||||
public function setTitle($value)
|
||||
{
|
||||
if ($value !== null) {
|
||||
$this->_params['title'] = $value;
|
||||
} else {
|
||||
unset($this->_params['title']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title attribute for this query.
|
||||
*
|
||||
* @return string title
|
||||
*/
|
||||
public function getTitle()
|
||||
{
|
||||
if (array_key_exists('title', $this->_params)) {
|
||||
return $this->_params['title'];
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the title-exact attribute for this query.
|
||||
* If title-exact is set to true, the title query parameter will be used
|
||||
* in an exact match. Only documents with a title identical to the
|
||||
* title parameter will be returned.
|
||||
*
|
||||
* @param boolean $value Use either true or false
|
||||
* @return Zend_Gdata_Docs_Query Provides a fluent interface
|
||||
*/
|
||||
public function setTitleExact($value)
|
||||
{
|
||||
if ($value) {
|
||||
$this->_params['title-exact'] = $value;
|
||||
} else {
|
||||
unset($this->_params['title-exact']);
|
||||
}
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the title-exact attribute for this query.
|
||||
*
|
||||
* @return string title-exact
|
||||
*/
|
||||
public function getTitleExact()
|
||||
{
|
||||
if (array_key_exists('title-exact', $this->_params)) {
|
||||
return $this->_params['title-exact'];
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the full query URL for this query.
|
||||
*
|
||||
* @return string url
|
||||
*/
|
||||
public function getQueryUrl()
|
||||
{
|
||||
$uri = $this->_defaultFeedUri;
|
||||
|
||||
if ($this->_visibility !== null) {
|
||||
$uri .= '/' . $this->_visibility;
|
||||
} else {
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'A visibility must be provided for cell queries.');
|
||||
}
|
||||
|
||||
if ($this->_projection !== null) {
|
||||
$uri .= '/' . $this->_projection;
|
||||
} else {
|
||||
throw new Zend_Gdata_App_Exception(
|
||||
'A projection must be provided for cell queries.');
|
||||
}
|
||||
|
||||
$uri .= $this->getQueryString();
|
||||
return $uri;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,64 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata
|
||||
*/
|
||||
|
||||
/**
|
||||
* Service class for interacting with the services which use the
|
||||
* DublinCore extensions.
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_DublinCore extends Zend_Gdata
|
||||
{
|
||||
|
||||
/**
|
||||
* Namespaces used for Zend_Gdata_DublinCore
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
public static $namespaces = array(
|
||||
array('dc', 'http://purl.org/dc/terms', 1, 0)
|
||||
);
|
||||
|
||||
/**
|
||||
* Create Zend_Gdata_DublinCore object
|
||||
*
|
||||
* @param Zend_Http_Client $client (optional) The HTTP client to use when
|
||||
* when communicating with the Google servers.
|
||||
* @param string $applicationId The identity of the app in the form of Company-AppName-Version
|
||||
*/
|
||||
public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
|
||||
{
|
||||
$this->registerPackage('Zend_Gdata_DublinCore');
|
||||
$this->registerPackage('Zend_Gdata_DublinCore_Extension');
|
||||
parent::__construct($client, $applicationId);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Entity primarily responsible for making the resource
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_DublinCore_Extension_Creator extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'dc';
|
||||
protected $_rootElement = 'creator';
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_DublinCore_Extension_Creator which
|
||||
* Entity primarily responsible for making the resource
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_text = $value;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,59 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Point or period of time associated with an event in the lifecycle of the
|
||||
* resource
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_DublinCore_Extension_Date extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'dc';
|
||||
protected $_rootElement = 'date';
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_DublinCore_Extension_Date which
|
||||
* Point or period of time associated with an event in the lifecycle of the
|
||||
* resource
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_text = $value;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* Account of the resource
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_DublinCore_Extension_Description extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'dc';
|
||||
protected $_rootElement = 'description';
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_DublinCore_Extension_Description which
|
||||
* Account of the resource
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_text = $value;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* File format, physical medium, or dimensions of the resource
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_DublinCore_Extension_Format extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'dc';
|
||||
protected $_rootElement = 'format';
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_DublinCore_Extension_Format which
|
||||
* File format, physical medium, or dimensions of the resource
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_text = $value;
|
||||
}
|
||||
|
||||
}
|
|
@ -1,57 +0,0 @@
|
|||
<?php
|
||||
|
||||
/**
|
||||
* Zend Framework
|
||||
*
|
||||
* LICENSE
|
||||
*
|
||||
* This source file is subject to the new BSD license that is bundled
|
||||
* with this package in the file LICENSE.txt.
|
||||
* It is also available through the world-wide-web at this URL:
|
||||
* http://framework.zend.com/license/new-bsd
|
||||
* If you 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 DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
* @version $Id$
|
||||
*/
|
||||
|
||||
/**
|
||||
* @see Zend_Gdata_Extension
|
||||
*/
|
||||
|
||||
/**
|
||||
* An unambiguous reference to the resource within a given context
|
||||
*
|
||||
* @category Zend
|
||||
* @package Zend_Gdata
|
||||
* @subpackage DublinCore
|
||||
* @copyright Copyright (c) 2005-2014 Zend Technologies USA Inc. (http://www.zend.com)
|
||||
* @license http://framework.zend.com/license/new-bsd New BSD License
|
||||
*/
|
||||
class Zend_Gdata_DublinCore_Extension_Identifier extends Zend_Gdata_Extension
|
||||
{
|
||||
|
||||
protected $_rootNamespace = 'dc';
|
||||
protected $_rootElement = 'identifier';
|
||||
|
||||
/**
|
||||
* Constructor for Zend_Gdata_DublinCore_Extension_Identifier which
|
||||
* An unambiguous reference to the resource within a given context
|
||||
*
|
||||
* @param DOMElement $element (optional) DOMElement from which this
|
||||
* object should be constructed.
|
||||
*/
|
||||
public function __construct($value = null)
|
||||
{
|
||||
$this->registerAllNamespaces(Zend_Gdata_DublinCore::$namespaces);
|
||||
parent::__construct();
|
||||
$this->_text = $value;
|
||||
}
|
||||
|
||||
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue