adding zend project folders into old campcaster.

This commit is contained in:
naomiaro 2010-12-07 14:19:27 -05:00
parent 56abfaf28e
commit 7ef0c18b26
4045 changed files with 1054952 additions and 0 deletions

View file

@ -0,0 +1,214 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: EmailListEntry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Extension_FeedLink
*/
require_once 'Zend/Gdata/Extension/FeedLink.php';
/**
* @see Zend_Gdata_Gapps_Extension_EmailList
*/
require_once 'Zend/Gdata/Gapps/Extension/EmailList.php';
/**
* Data model class for a Google Apps Email List Entry.
*
* Each email list entry describes a single email list within a Google Apps
* hosted domain. Email lists may contain multiple recipients, as
* described by instances of Zend_Gdata_Gapps_EmailListRecipient. Multiple
* entries are contained within instances of Zend_Gdata_Gapps_EmailListFeed.
*
* To transfer email list entries to and from the Google Apps servers,
* including creating new entries, refer to the Google Apps service class,
* Zend_Gdata_Gapps.
*
* This class represents <atom:entry> in the Google Data protocol.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_EmailListEntry extends Zend_Gdata_Entry
{
protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListEntry';
/**
* <apps:emailList> child element containing general information about
* this email list.
*
* @var Zend_Gdata_Gapps_Extension_EmailList
*/
protected $_emailList = null;
/**
* <gd:feedLink> element containing information about other feeds
* relevant to this entry.
*
* @var Zend_Gdata_Extension_FeedLink
*/
protected $_feedLink = array();
/**
* Create a new instance.
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_emailList !== null) {
$element->appendChild($this->_emailList->getDOM($element->ownerDocument));
}
foreach ($this->_feedLink as $feedLink) {
$element->appendChild($feedLink->getDOM($element->ownerDocument));
}
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them as members of this entry based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('apps') . ':' . 'emailList';
$emailList = new Zend_Gdata_Gapps_Extension_EmailList();
$emailList->transferFromDOM($child);
$this->_emailList = $emailList;
break;
case $this->lookupNamespace('gd') . ':' . 'feedLink';
$feedLink = new Zend_Gdata_Extension_FeedLink();
$feedLink->transferFromDOM($child);
$this->_feedLink[] = $feedLink;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Retrieve the email list property for this entry.
*
* @see setEmailList
* @return Zend_Gdata_Gapps_Extension_EmailList The requested object
* or null if not set.
*/
public function getEmailList()
{
return $this->_emailList;
}
/**
* Set the email list property for this entry. This property contains
* information such as the name of this email list.
*
* This corresponds to the <apps:emailList> property in the Google Data
* protocol.
*
* @param Zend_Gdata_Gapps_Extension_EmailList $value The desired value
* this element, or null to unset.
* @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface
*/
public function setEmailList($value)
{
$this->_emailList = $value;
return $this;
}
/**
* Get the feed link property for this entry.
*
* @see setFeedLink
* @param string $rel (optional) The rel value of the link to be found.
* If null, the array of links is returned.
* @return mixed If $rel is specified, a Zend_Gdata_Extension_FeedLink
* object corresponding to the requested rel value is returned
* if found, or null if the requested value is not found. If
* $rel is null or not specified, an array of all available
* feed links for this entry is returned, or null if no feed
* links are set.
*/
public function getFeedLink($rel = null)
{
if ($rel == null) {
return $this->_feedLink;
} else {
foreach ($this->_feedLink as $feedLink) {
if ($feedLink->rel == $rel) {
return $feedLink;
}
}
return null;
}
}
/**
* Set the feed link property for this entry. Feed links provide
* information about other feeds associated with this entry.
*
* This corresponds to the <gd:feedLink> property in the Google Data
* protocol.
*
* @param array $value A collection of Zend_Gdata_Gapps_Extension_FeedLink
* instances representing all feed links for this entry, or
* null to unset.
* @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface
*/
public function setFeedLink($value)
{
$this->_feedLink = $value;
return $this;
}
}

View file

@ -0,0 +1,53 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: EmailListFeed.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
* @see Zend_Gdata_Gapps_EmailListEntry
*/
require_once 'Zend/Gdata/Gapps/EmailListEntry.php';
/**
* Data model for a collection of Google Apps email list entries, usually
* provided by the Google Apps servers.
*
* For information on requesting this feed from a server, see the Google
* Apps service class, Zend_Gdata_Gapps.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_EmailListFeed extends Zend_Gdata_Feed
{
protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListEntry';
protected $_feedClassName = 'Zend_Gdata_Gapps_EmailListFeed';
}

View file

@ -0,0 +1,187 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you 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 Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: EmailListQuery.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Gapps_Query
*/
require_once('Zend/Gdata/Gapps/Query.php');
/**
* Assists in constructing queries for Google Apps email list entries.
* Instances of this class can be provided in many places where a URL is
* required.
*
* For information on submitting queries to a server, see the Google Apps
* service class, Zend_Gdata_Gapps.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_EmailListQuery extends Zend_Gdata_Gapps_Query
{
/**
* A string which, if not null, indicates which email list should
* be retrieved by this query.
*
* @var string
*/
protected $_emailListName = null;
/**
* Create a new instance.
*
* @param string $domain (optional) The Google Apps-hosted domain to use
* when constructing query URIs.
* @param string $emailListName (optional) Value for the emailListName
* property.
* @param string $recipient (optional) Value for the recipient
* property.
* @param string $startEmailListName (optional) Value for the
* startEmailListName property.
*/
public function __construct($domain = null, $emailListName = null,
$recipient = null, $startEmailListName = null)
{
parent::__construct($domain);
$this->setEmailListName($emailListName);
$this->setRecipient($recipient);
$this->setStartEmailListName($startEmailListName);
}
/**
* Set the email list name to query for. When set, only lists with a name
* matching this value will be returned in search results. Set to
* null to disable filtering by list name.
*
* @param string $value The email list name to filter search results by,
* or null to disable.
*/
public function setEmailListName($value)
{
$this->_emailListName = $value;
}
/**
* Get the email list name to query for. If no name is set, null will be
* returned.
*
* @see setEmailListName
* @return string The email list name to filter search results by, or null
* if disabled.
*/
public function getEmailListName()
{
return $this->_emailListName;
}
/**
* Set the recipient to query for. When set, only subscribers with an
* email address matching this value will be returned in search results.
* Set to null to disable filtering by username.
*
* @param string $value The recipient email address to filter search
* results by, or null to disable.
*/
public function setRecipient($value)
{
if ($value !== null) {
$this->_params['recipient'] = $value;
}
else {
unset($this->_params['recipient']);
}
}
/**
* Get the recipient email address to query for. If no recipient is set,
* null will be returned.
*
* @see setRecipient
* @return string The recipient email address to filter search results by,
* or null if disabled.
*/
public function getRecipient()
{
if (array_key_exists('recipient', $this->_params)) {
return $this->_params['recipient'];
} else {
return null;
}
}
/**
* Set the first email list which should be displayed when retrieving
* a list of email lists.
*
* @param string $value The first email list to be returned, or null to
* disable.
*/
public function setStartEmailListName($value)
{
if ($value !== null) {
$this->_params['startEmailListName'] = $value;
} else {
unset($this->_params['startEmailListName']);
}
}
/**
* Get the first email list which should be displayed when retrieving
* a list of email lists.
*
* @return string The first email list to be returned, or null to
* disable.
*/
public function getStartEmailListName()
{
if (array_key_exists('startEmailListName', $this->_params)) {
return $this->_params['startEmailListName'];
} else {
return null;
}
}
/**
* Returns the URL generated for this query, based on it's current
* parameters.
*
* @return string A URL generated based on the state of this query.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function getQueryUrl()
{
$uri = $this->getBaseUrl();
$uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_PATH;
if ($this->_emailListName !== null) {
$uri .= '/' . $this->_emailListName;
}
$uri .= $this->getQueryString();
return $uri;
}
}

View file

@ -0,0 +1,146 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: EmailListRecipientEntry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Extension_Who
*/
require_once 'Zend/Gdata/Extension/Who.php';
/**
* Data model class for a Google Apps Email List Recipient Entry.
*
* Each instance of this class represents a recipient of an email list
* hosted on a Google Apps domain. Each email list may contain multiple
* recipients. Email lists themselves are described by
* Zend_Gdata_EmailListEntry. Multiple recipient entries are contained within
* instances of Zend_Gdata_Gapps_EmailListRecipientFeed.
*
* To transfer email list recipients to and from the Google Apps servers,
* including creating new recipients, refer to the Google Apps service class,
* Zend_Gdata_Gapps.
*
* This class represents <atom:entry> in the Google Data protocol.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_EmailListRecipientEntry extends Zend_Gdata_Entry
{
protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListRecipientEntry';
/**
* <gd:who> element used to store the email address of the current
* recipient. Only the email property of this element should be
* populated.
*
* @var Zend_Gdata_Extension_Who
*/
protected $_who = null;
/**
* Create a new instance.
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_who !== null) {
$element->appendChild($this->_who->getDOM($element->ownerDocument));
}
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them as members of this entry based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('gd') . ':' . 'who';
$who = new Zend_Gdata_Extension_Who();
$who->transferFromDOM($child);
$this->_who = $who;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Get the value of the who property for this object.
*
* @see setWho
* @return Zend_Gdata_Extension_Who The requested object.
*/
public function getWho()
{
return $this->_who;
}
/**
* Set the value of the who property for this object. This property
* is used to store the email address of the current recipient.
*
* @param Zend_Gdata_Extension_Who $value The desired value for this
* instance's who property.
* @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface.
*/
public function setWho($value)
{
$this->_who = $value;
return $this;
}
}

View file

@ -0,0 +1,53 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: EmailListRecipientFeed.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
* @see Zend_Gdata_Gapps_EmailListRecipientEntry
*/
require_once 'Zend/Gdata/Gapps/EmailListRecipientEntry.php';
/**
* Data model for a collection of Google Apps email list recipient entries,
* usually provided by the Google Apps servers.
*
* For information on requesting this feed from a server, see the Google
* Apps service class, Zend_Gdata_Gapps.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_EmailListRecipientFeed extends Zend_Gdata_Feed
{
protected $_entryClassName = 'Zend_Gdata_Gapps_EmailListRecipientEntry';
protected $_feedClassName = 'Zend_Gdata_Gapps_EmailListRecipientFeed';
}

View file

@ -0,0 +1,153 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: EmailListRecipientQuery.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Gapps_Query
*/
require_once('Zend/Gdata/Gapps/Query.php');
/**
* Assists in constructing queries for Google Apps email list recipient
* entries. Instances of this class can be provided in many places where a
* URL is required.
*
* For information on submitting queries to a server, see the Google Apps
* service class, Zend_Gdata_Gapps.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_EmailListRecipientQuery extends Zend_Gdata_Gapps_Query
{
/**
* If not null, specifies the name of the email list which
* should be requested by this query.
*
* @var string
*/
protected $_emailListName = null;
/**
* Create a new instance.
*
* @param string $domain (optional) The Google Apps-hosted domain to use
* when constructing query URIs.
* @param string $emailListName (optional) Value for the emailListName
* property.
* @param string $startRecipient (optional) Value for the
* startRecipient property.
*/
public function __construct($domain = null, $emailListName = null,
$startRecipient = null)
{
parent::__construct($domain);
$this->setEmailListName($emailListName);
$this->setStartRecipient($startRecipient);
}
/**
* Set the email list name to query for. When set, only lists with a name
* matching this value will be returned in search results. Set to
* null to disable filtering by list name.
*
* @param string $value The email list name to filter search results by,
* or null to disable.
*/
public function setEmailListName($value)
{
$this->_emailListName = $value;
}
/**
* Get the email list name to query for. If no name is set, null will be
* returned.
*
* @param string $value The email list name to filter search results by,
* or null if disabled.
*/
public function getEmailListName()
{
return $this->_emailListName;
}
/**
* Set the first recipient which should be displayed when retrieving
* a list of email list recipients.
*
* @param string $value The first recipient to be returned, or null to
* disable.
*/
public function setStartRecipient($value)
{
if ($value !== null) {
$this->_params['startRecipient'] = $value;
} else {
unset($this->_params['startRecipient']);
}
}
/**
* Get the first recipient which should be displayed when retrieving
* a list of email list recipients.
*
* @return string The first recipient to be returned, or null if
* disabled.
*/
public function getStartRecipient()
{
if (array_key_exists('startRecipient', $this->_params)) {
return $this->_params['startRecipient'];
} else {
return null;
}
}
/**
* Returns the URL generated for this query, based on it's current
* parameters.
*
* @return string A URL generated based on the state of this query.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function getQueryUrl()
{
$uri = $this->getBaseUrl();
$uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_PATH;
if ($this->_emailListName !== null) {
$uri .= '/' . $this->_emailListName;
} else {
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'EmailListName must not be null');
}
$uri .= Zend_Gdata_Gapps::APPS_EMAIL_LIST_RECIPIENT_POSTFIX . '/';
$uri .= $this->getQueryString();
return $uri;
}
}

View file

@ -0,0 +1,233 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you 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 Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Error.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Gdata_App_Base
*/
require_once 'Zend/Gdata/App/Base.php';
/**
* Gdata Gapps Error class. This class is used to represent errors returned
* within an AppsForYourDomainErrors message received from the Google Apps
* servers.
*
* Several different errors may be represented by this class, determined by
* the error code returned by the server. For a list of error codes
* available at the time of this writing, see getErrorCode.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_Error extends Zend_Gdata_App_Base
{
// Error codes as defined at
// http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html#appendix_d
const UNKNOWN_ERROR = 1000;
const USER_DELETED_RECENTLY = 1100;
const USER_SUSPENDED = 1101;
const DOMAIN_USER_LIMIT_EXCEEDED = 1200;
const DOMAIN_ALIAS_LIMIT_EXCEEDED = 1201;
const DOMAIN_SUSPENDED = 1202;
const DOMAIN_FEATURE_UNAVAILABLE = 1203;
const ENTITY_EXISTS = 1300;
const ENTITY_DOES_NOT_EXIST = 1301;
const ENTITY_NAME_IS_RESERVED = 1302;
const ENTITY_NAME_NOT_VALID = 1303;
const INVALID_GIVEN_NAME = 1400;
const INVALID_FAMILY_NAME = 1401;
const INVALID_PASSWORD = 1402;
const INVALID_USERNAME = 1403;
const INVALID_HASH_FUNCTION_NAME = 1404;
const INVALID_HASH_DIGEST_LENGTH = 1405;
const INVALID_EMAIL_ADDRESS = 1406;
const INVALID_QUERY_PARAMETER_VALUE = 1407;
const TOO_MANY_RECIPIENTS_ON_EMAIL_LIST = 1500;
protected $_errorCode = null;
protected $_reason = null;
protected $_invalidInput = null;
public function __construct($errorCode = null, $reason = null,
$invalidInput = null) {
parent::__construct("Google Apps error received: $errorCode ($reason)");
$this->_errorCode = $errorCode;
$this->_reason = $reason;
$this->_invalidInput = $invalidInput;
}
/**
* Set the error code for this exception. For more information about
* error codes, see getErrorCode.
*
* @see getErrorCode
* @param integer $value The new value for the error code.
*/
public function setErrorCode($value) {
$this->_errorCode = $value;
}
/**
* Get the error code for this exception. Currently valid values are
* available as constants within this class. These values are:
*
* UNKNOWN_ERROR (1000)
* USER_DELETED_RECENTLY (1100)
* USER_SUSPENDED (1101)
* DOMAIN_USER_LIMIT_EXCEEDED (1200)
* DOMAIN_ALIAS_LIMIT_EXCEEDED (1201)
* DOMAIN_SUSPENDED (1202)
* DOMAIN_FEATURE_UNAVAILABLE (1203)
* ENTITY_EXISTS (1300)
* ENTITY_DOES_NOT_EXIST (1301)
* ENTITY_NAME_IS_RESERVED (1302)
* ENTITY_NAME_NOT_VALID (1303)
* INVALID_GIVEN_NAME (1400)
* INVALID_FAMILY_NAME (1401)
* INVALID_PASSWORD (1402)
* INVALID_USERNAME (1403)
* INVALID_HASH_FUNCTION_NAME (1404)
* INVALID_HASH_DIGEST_LENGTH (1405)
* INVALID_EMAIL_ADDRESS (1406)
* INVALID_QUERY_PARAMETER_VALUE (1407)
* TOO_MANY_RECIPIENTS_ON_EMAIL_LIST (1500)
*
* Numbers in parenthesis indicate the actual integer value of the
* constant. This list should not be treated as exhaustive, as additional
* error codes may be added at any time.
*
* For more information about these codes and their meaning, please
* see Appendix D of the Google Apps Provisioning API Reference.
*
* @link http://code.google.com/apis/apps/gdata_provisioning_api_v2.0_reference.html#appendix_d Google Apps Provisioning API Reference: Appendix D - Gdata Error Codes
* @see setErrorCode
* @return integer The error code returned by the Google Apps server.
*/
public function getErrorCode() {
return $this->_errorCode;
}
/**
* Set human-readable text describing the reason this exception occurred.
*
* @see getReason
* @param string $value The reason this exception occurred.
*/
public function setReason($value) {
$this->_reason = $value;
}
/**
* Get human-readable text describing the reason this exception occurred.
*
* @see setReason
* @return string The reason this exception occurred.
*/
public function getReason() {
return $this->_reason;
}
/**
* Set the invalid input which caused this exception.
*
* @see getInvalidInput
* @param string $value The invalid input that triggered this exception.
*/
public function setInvalidInput($value) {
$this->_invalidInput = $value;
}
/**
* Set the invalid input which caused this exception.
*
* @see setInvalidInput
* @return string The reason this exception occurred.
*/
public function getInvalidInput() {
return $this->_invalidInput;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_errorCode !== null) {
$element->setAttribute('errorCode', $this->_errorCode);
}
if ($this->_reason !== null) {
$element->setAttribute('reason', $this->_reason);
}
if ($this->_invalidInput !== null) {
$element->setAttribute('invalidInput', $this->_invalidInput);
}
return $element;
}
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and value are
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
*/
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'errorCode':
$this->_errorCode = $attribute->nodeValue;
break;
case 'reason':
$this->_reason = $attribute->nodeValue;
break;
case 'invalidInput':
$this->_invalidInput = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
}
}
/**
* Get a human readable version of this exception.
*
* @return string
*/
public function __toString() {
return "Error " . $this->getErrorCode() . ": " . $this->getReason() .
"\n\tInvalid Input: \"" . $this->getInvalidInput() . "\"";
}
}

View file

@ -0,0 +1,144 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: EmailList.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* @see Zend_Gdata_Gapps
*/
require_once 'Zend/Gdata/Gapps.php';
/**
* Represents the apps:emailList element used by the Apps data API. This
* class represents properties of an email list and is usually contained
* within an instance of Zend_Gdata_Gapps_EmailListEntry.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_Extension_EmailList extends Zend_Gdata_Extension
{
protected $_rootNamespace = 'apps';
protected $_rootElement = 'emailList';
/**
* The name of the email list. This name is used as the email address
* for this list.
*
* @var string
*/
protected $_name = null;
/**
* Constructs a new Zend_Gdata_Gapps_Extension_EmailList object.
*
* @param string $name (optional) The name to be used for this email list.
*/
public function __construct($name = null)
{
$this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
parent::__construct();
$this->_name = $name;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_name !== null) {
$element->setAttribute('name', $this->_name);
}
return $element;
}
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and value are
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
*/
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'name':
$this->_name = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
}
}
/**
* Get the value for this element's name attribute.
*
* @see setName
* @return string The requested attribute.
*/
public function getName()
{
return $this->_name;
}
/**
* Set the value for this element's name attribute. This is the unique
* name which will be used to identify this email list within this
* domain, and will be used to form this email list's email address.
*
* @param string $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_EmailList The element being modified.
*/
public function setName($value)
{
$this->_name = $value;
return $this;
}
/**
* Magic toString method allows using this directly via echo
* Works best in PHP >= 4.2.0
*
* @return string
*/
public function __toString()
{
return $this->getName();
}
}

View file

@ -0,0 +1,485 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you 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 Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Login.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* @see Zend_Gdata_Gapps
*/
require_once 'Zend/Gdata/Gapps.php';
/**
* Represents the apps:login element used by the Apps data API. This
* class is used to describe properties of a user, and is usually contained
* within instances of Zene_Gdata_Gapps_UserEntry or any other class
* which is linked to a particular username.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_Extension_Login extends Zend_Gdata_Extension
{
protected $_rootNamespace = 'apps';
protected $_rootElement = 'login';
/**
* The username for this user. This is used as the user's email address
* and when logging in to Google Apps-hosted services.
*
* @var string
*/
protected $_username = null;
/**
* The password for the user. May be in cleartext or as an SHA-1
* digest, depending on the value of _hashFunctionName.
*
* @var string
*/
protected $_password = null;
/**
* Specifies whether the password stored in _password is in cleartext
* or is an SHA-1 digest of a password. If the password is cleartext,
* then this should be null. If the password is an SHA-1 digest, then
* this should be set to 'SHA-1'.
*
* At the time of writing, no other hash functions are supported
*
* @var string
*/
protected $_hashFunctionName = null;
/**
* True if the user has administrative rights for this domain, false
* otherwise.
*
* @var boolean
*/
protected $_admin = null;
/**
* True if the user has agreed to the terms of service for Google Apps,
* false otherwise.
*
* @var boolean.
*/
protected $_agreedToTerms = null;
/**
* True if this user has been suspended, false otherwise.
*
* @var boolean
*/
protected $_suspended = null;
/**
* True if the user will be required to change their password at
* their next login, false otherwise.
*
* @var boolean
*/
protected $_changePasswordAtNextLogin = null;
/**
* Constructs a new Zend_Gdata_Gapps_Extension_Login object.
*
* @param string $username (optional) The username to be used for this
* login.
* @param string $password (optional) The password to be used for this
* login.
* @param string $hashFunctionName (optional) The name of the hash
* function used to protect the password, or null if no
* has function has been applied. As of this writing,
* the only valid values are 'SHA-1' or null.
* @param boolean $admin (optional) Whether the user is an administrator
* or not.
* @param boolean $suspended (optional) Whether this login is suspended or not.
* @param boolean $changePasswordAtNextLogin (optional) Whether
* the user is required to change their password at their
* next login.
* @param boolean $agreedToTerms (optional) Whether the user has
* agreed to the terms of service.
*/
public function __construct($username = null, $password = null,
$hashFunctionName = null, $admin = null, $suspended = null,
$changePasswordAtNextLogin = null, $agreedToTerms = null)
{
$this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
parent::__construct();
$this->_username = $username;
$this->_password = $password;
$this->_hashFunctionName = $hashFunctionName;
$this->_admin = $admin;
$this->_agreedToTerms = $agreedToTerms;
$this->_suspended = $suspended;
$this->_changePasswordAtNextLogin = $changePasswordAtNextLogin;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_username !== null) {
$element->setAttribute('userName', $this->_username);
}
if ($this->_password !== null) {
$element->setAttribute('password', $this->_password);
}
if ($this->_hashFunctionName !== null) {
$element->setAttribute('hashFunctionName', $this->_hashFunctionName);
}
if ($this->_admin !== null) {
$element->setAttribute('admin', ($this->_admin ? "true" : "false"));
}
if ($this->_agreedToTerms !== null) {
$element->setAttribute('agreedToTerms', ($this->_agreedToTerms ? "true" : "false"));
}
if ($this->_suspended !== null) {
$element->setAttribute('suspended', ($this->_suspended ? "true" : "false"));
}
if ($this->_changePasswordAtNextLogin !== null) {
$element->setAttribute('changePasswordAtNextLogin', ($this->_changePasswordAtNextLogin ? "true" : "false"));
}
return $element;
}
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and value are
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
* @throws Zend_Gdata_App_InvalidArgumentException
*/
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'userName':
$this->_username = $attribute->nodeValue;
break;
case 'password':
$this->_password = $attribute->nodeValue;
break;
case 'hashFunctionName':
$this->_hashFunctionName = $attribute->nodeValue;
break;
case 'admin':
if ($attribute->nodeValue == "true") {
$this->_admin = true;
}
else if ($attribute->nodeValue == "false") {
$this->_admin = false;
}
else {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#admin.");
}
break;
case 'agreedToTerms':
if ($attribute->nodeValue == "true") {
$this->_agreedToTerms = true;
}
else if ($attribute->nodeValue == "false") {
$this->_agreedToTerms = false;
}
else {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#agreedToTerms.");
}
break;
case 'suspended':
if ($attribute->nodeValue == "true") {
$this->_suspended = true;
}
else if ($attribute->nodeValue == "false") {
$this->_suspended = false;
}
else {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#suspended.");
}
break;
case 'changePasswordAtNextLogin':
if ($attribute->nodeValue == "true") {
$this->_changePasswordAtNextLogin = true;
}
else if ($attribute->nodeValue == "false") {
$this->_changePasswordAtNextLogin = false;
}
else {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for apps:login#changePasswordAtNextLogin.");
}
break;
default:
parent::takeAttributeFromDOM($attribute);
}
}
/**
* Get the value for this element's username attribute.
*
* @see setUsername
* @return string The attribute being modified.
*/
public function getUsername()
{
return $this->_username;
}
/**
* Set the value for this element's username attribute. This string
* is used to uniquely identify the user in this domian and is used
* to form this user's email address.
*
* @param string $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface.
*/
public function setUsername($value)
{
$this->_username = $value;
return $this;
}
/**
* Get the value for this element's password attribute.
*
* @see setPassword
* @return string The requested attribute.
*/
public function getPassword()
{
return $this->_password;
}
/**
* Set the value for this element's password attribute. As of this
* writing, this can be either be provided as plaintext or hashed using
* the SHA-1 algorithm for protection. If using a hash function,
* this must be indicated by calling setHashFunctionName().
*
* @param string $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface.
*/
public function setPassword($value)
{
$this->_password = $value;
return $this;
}
/**
* Get the value for this element's hashFunctionName attribute.
*
* @see setHashFunctionName
* @return string The requested attribute.
*/
public function getHashFunctionName()
{
return $this->_hashFunctionName;
}
/**
* Set the value for this element's hashFunctionName attribute. This
* indicates whether the password supplied with setPassword() is in
* plaintext or has had a hash function applied to it. If null,
* plaintext is assumed. As of this writing, the only valid hash
* function is 'SHA-1'.
*
* @param string $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface.
*/
public function setHashFunctionName($value)
{
$this->_hashFunctionName = $value;
return $this;
}
/**
* Get the value for this element's admin attribute.
*
* @see setAdmin
* @return boolean The requested attribute.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function getAdmin()
{
if (!(is_bool($this->_admin))) {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for admin.');
}
return $this->_admin;
}
/**
* Set the value for this element's admin attribute. This indicates
* whether this user is an administrator for this domain.
*
* @param boolean $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function setAdmin($value)
{
if (!(is_bool($value))) {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.');
}
$this->_admin = $value;
return $this;
}
/**
* Get the value for this element's agreedToTerms attribute.
*
* @see setAgreedToTerms
* @return boolean The requested attribute.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function getAgreedToTerms()
{
if (!(is_bool($this->_agreedToTerms))) {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for agreedToTerms.');
}
return $this->_agreedToTerms;
}
/**
* Set the value for this element's agreedToTerms attribute. This
* indicates whether this user has agreed to the terms of service.
*
* @param boolean $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function setAgreedToTerms($value)
{
if (!(is_bool($value))) {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.');
}
$this->_agreedToTerms = $value;
return $this;
}
/**
* Get the value for this element's suspended attribute.
*
* @see setSuspended
* @return boolean The requested attribute.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function getSuspended()
{
if (!(is_bool($this->_suspended))) {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for suspended.');
}
return $this->_suspended;
}
/**
* Set the value for this element's suspended attribute. If true, the
* user will not be able to login to this domain until unsuspended.
*
* @param boolean $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function setSuspended($value)
{
if (!(is_bool($value))) {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.');
}
$this->_suspended = $value;
return $this;
}
/**
* Get the value for this element's changePasswordAtNextLogin attribute.
*
* @see setChangePasswordAtNextLogin
* @return boolean The requested attribute.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function getChangePasswordAtNextLogin()
{
if (!(is_bool($this->_changePasswordAtNextLogin))) {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for changePasswordAtNextLogin.');
}
return $this->_changePasswordAtNextLogin;
}
/**
* Set the value for this element's changePasswordAtNextLogin attribute.
* If true, the user will be forced to set a new password the next
* time they login.
*
* @param boolean $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Login Provides a fluent interface.
* @throws Zend_Gdata_App_InvalidArgumentException
*/
public function setChangePasswordAtNextLogin($value)
{
if (!(is_bool($value))) {
require_once('Zend/Gdata/App/InvalidArgumentException.php');
throw new Zend_Gdata_App_InvalidArgumentException('Expected boolean for $value.');
}
$this->_changePasswordAtNextLogin = $value;
return $this;
}
/**
* Magic toString method allows using this directly via echo
* Works best in PHP >= 4.2.0
*/
public function __toString()
{
return "Username: " . $this->getUsername() .
"\nPassword: " . (($this->getPassword() === null) ? "NOT SET" : "SET") .
"\nPassword Hash Function: " . $this->getHashFunctionName() .
"\nAdministrator: " . ($this->getAdmin() ? "Yes" : "No") .
"\nAgreed To Terms: " . ($this->getAgreedToTerms() ? "Yes" : "No") .
"\nSuspended: " . ($this->getSuspended() ? "Yes" : "No");
}
}

View file

@ -0,0 +1,181 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Name.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* @see Zend_Gdata_Gapps
*/
require_once 'Zend/Gdata/Gapps.php';
/**
* Represents the apps:name element used by the Apps data API. This is used
* to represent a user's full name. This class is usually contained within
* instances of Zend_Gdata_Gapps_UserEntry.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_Extension_Name extends Zend_Gdata_Extension
{
protected $_rootNamespace = 'apps';
protected $_rootElement = 'name';
/**
* The associated user's family name.
*
* @var string
*/
protected $_familyName = null;
/**
* The associated user's given name.
*
* @var string
*/
protected $_givenName = null;
/**
* Constructs a new Zend_Gdata_Gapps_Extension_Name object.
*
* @param string $familyName (optional) The familyName to be set for this
* object.
* @param string $givenName (optional) The givenName to be set for this
* object.
*/
public function __construct($familyName = null, $givenName = null)
{
$this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
parent::__construct();
$this->_familyName = $familyName;
$this->_givenName = $givenName;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_familyName !== null) {
$element->setAttribute('familyName', $this->_familyName);
}
if ($this->_givenName !== null) {
$element->setAttribute('givenName', $this->_givenName);
}
return $element;
}
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and value are
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
*/
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'familyName':
$this->_familyName = $attribute->nodeValue;
break;
case 'givenName':
$this->_givenName = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
}
}
/**
* Get the value for this element's familyName attribute.
*
* @see setFamilyName
* @return string The requested attribute.
*/
public function getFamilyName()
{
return $this->_familyName;
}
/**
* Set the value for this element's familyName attribute. This
* represents a user's family name.
*
* @param string $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Name Provides a fluent interface..
*/
public function setFamilyName($value)
{
$this->_familyName = $value;
return $this;
}
/**
* Get the value for this element's givenName attribute.
*
* @see setGivenName
* @return string The requested attribute.
*/
public function getGivenName()
{
return $this->_givenName;
}
/**
* Set the value for this element's givenName attribute. This
* represents a user's given name.
*
* @param string $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Name Provides a fluent interface.
*/
public function setGivenName($value)
{
$this->_givenName = $value;
return $this;
}
/**
* Magic toString method allows using this directly via echo
* Works best in PHP >= 4.2.0
*/
public function __toString()
{
return $this->getGivenName() . ' ' . $this->getFamilyName();
}
}

View file

@ -0,0 +1,142 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Nickname.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* @see Zend_Gdata_Gapps
*/
require_once 'Zend/Gdata/Gapps.php';
/**
* Represents the apps:nickname element used by the Apps data API. This
* is used to describe a nickname's properties, and is usually contained
* within instances of Zend_Gdata_Gapps_NicknameEntry.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_Extension_Nickname extends Zend_Gdata_Extension
{
protected $_rootNamespace = 'apps';
protected $_rootElement = 'nickname';
/**
* The name of the nickname. This name is used as the email address
* for this nickname.
*
* @var string
*/
protected $_name = null;
/**
* Constructs a new Zend_Gdata_Gapps_Extension_Nickname object.
* @param string $name (optional) The nickname being represented.
*/
public function __construct($name = null)
{
$this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
parent::__construct();
$this->_name = $name;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_name !== null) {
$element->setAttribute('name', $this->_name);
}
return $element;
}
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and value are
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
*/
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'name':
$this->_name = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
}
}
/**
* Get the value for this element's name attribute.
*
* @see setName
* @return string The requested attribute.
*/
public function getName()
{
return $this->_name;
}
/**
* Set the value for this element's name attribute. This name uniquely
* describes this nickname within the domain. Emails addressed to this
* name will be delivered to the user who owns this nickname.
*
* @param string $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Nickname Provides a fluent
* interface.
*/
public function setName($value)
{
$this->_name = $value;
return $this;
}
/**
* Magic toString method allows using this directly via echo
* Works best in PHP >= 4.2.0
*/
public function __toString()
{
return $this->getName();
}
}

View file

@ -0,0 +1,142 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Quota.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Extension
*/
require_once 'Zend/Gdata/Extension.php';
/**
* @see Zend_Gdata_Gapps
*/
require_once 'Zend/Gdata/Gapps.php';
/**
* Represents the apps:quota element used by the Apps data API. This is
* used to indicate the amount of storage space available to a user. Quotas
* may not be able to be set, depending on the domain used. This class
* is usually contained within an instance of Zend_Gdata_Gapps_UserEntry.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_Extension_Quota extends Zend_Gdata_Extension
{
protected $_rootNamespace = 'apps';
protected $_rootElement = 'quota';
/**
* The amount of storage space available to the user in megabytes.
*
* @var integer
*/
protected $_limit = null;
/**
* Constructs a new Zend_Gdata_Gapps_Extension_Quota object.
*
* @param string $limit (optional) The limit, in bytes, for this quota.
*/
public function __construct($limit = null)
{
$this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
parent::__construct();
$this->_limit = $limit;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_limit !== null) {
$element->setAttribute('limit', $this->_limit);
}
return $element;
}
/**
* Given a DOMNode representing an attribute, tries to map the data into
* instance members. If no mapping is defined, the name and value are
* stored in an array.
*
* @param DOMNode $attribute The DOMNode attribute needed to be handled
*/
protected function takeAttributeFromDOM($attribute)
{
switch ($attribute->localName) {
case 'limit':
$this->_limit = $attribute->nodeValue;
break;
default:
parent::takeAttributeFromDOM($attribute);
}
}
/**
* Get the value for this element's limit attribute.
*
* @see setLimit
* @return string The requested attribute.
*/
public function getLimit()
{
return $this->_limit;
}
/**
* Set the value for this element's limit attribute. This is the amount
* of storage space, in bytes, that should be made available to
* the associated user.
*
* @param string $value The desired value for this attribute.
* @return Zend_Gdata_Gapps_Extension_Quota Provides a fluent interface.
*/
public function setLimit($value)
{
$this->_limit = $value;
return $this;
}
/**
* Magic toString method allows using this directly via echo
* Works best in PHP >= 4.2.0
*/
public function __toString()
{
return $this->getLimit();
}
}

View file

@ -0,0 +1,189 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you 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 Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: NicknameEntry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Gapps_Extension_Login
*/
require_once 'Zend/Gdata/Gapps/Extension/Login.php';
/**
* @see Zend_Gdata_Gapps_Extension_Nickname
*/
require_once 'Zend/Gdata/Gapps/Extension/Nickname.php';
/**
* Data model class for a Google Apps Nickname Entry.
*
* Each nickname entry describes a single nickname within a Google Apps
* hosted domain. Each user may own several nicknames, but each nickname may
* only belong to one user. Multiple entries are contained within instances
* of Zend_Gdata_Gapps_NicknameFeed.
*
* To transfer nickname entries to and from the Google Apps servers,
* including creating new entries, refer to the Google Apps service class,
* Zend_Gdata_Gapps.
*
* This class represents <atom:entry> in the Google Data protocol.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_NicknameEntry extends Zend_Gdata_Entry
{
protected $_entryClassName = 'Zend_Gdata_Gapps_NicknameEntry';
/**
* <apps:login> element used to hold information about the owner
* of this nickname, including their username.
*
* @var Zend_Gdata_Gapps_Extension_Login
*/
protected $_login = null;
/**
* <apps:nickname> element used to hold the name of this nickname.
*
* @var Zend_Gdata_Gapps_Extension_Nickname
*/
protected $_nickname = null;
/**
* Create a new instance.
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_login !== null) {
$element->appendChild($this->_login->getDOM($element->ownerDocument));
}
if ($this->_nickname !== null) {
$element->appendChild($this->_nickname->getDOM($element->ownerDocument));
}
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them as members of this entry based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('apps') . ':' . 'login';
$login = new Zend_Gdata_Gapps_Extension_Login();
$login->transferFromDOM($child);
$this->_login = $login;
break;
case $this->lookupNamespace('apps') . ':' . 'nickname';
$nickname = new Zend_Gdata_Gapps_Extension_Nickname();
$nickname->transferFromDOM($child);
$this->_nickname = $nickname;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Get the value of the login property for this object.
*
* @see setLogin
* @return Zend_Gdata_Gapps_Extension_Login The requested object.
*/
public function getLogin()
{
return $this->_login;
}
/**
* Set the value of the login property for this object. This property
* is used to store the username address of the current user.
*
* @param Zend_Gdata_Gapps_Extension_Login $value The desired value for
* this instance's login property.
* @return Zend_Gdata_Gapps_NicknameEntry Provides a fluent interface.
*/
public function setLogin($value)
{
$this->_login = $value;
return $this;
}
/**
* Get the value of the nickname property for this object.
*
* @see setNickname
* @return Zend_Gdata_Gapps_Extension_Nickname The requested object.
*/
public function getNickname()
{
return $this->_nickname;
}
/**
* Set the value of the nickname property for this object. This property
* is used to store the the name of the current nickname.
*
* @param Zend_Gdata_Gapps_Extension_Nickname $value The desired value for
* this instance's nickname property.
* @return Zend_Gdata_Gapps_NicknameEntry Provides a fluent interface.
*/
public function setNickname($value)
{
$this->_nickname = $value;
return $this;
}
}

View file

@ -0,0 +1,53 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: NicknameFeed.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
* @see Zend_Gdata_Gapps_NicknameEntry
*/
require_once 'Zend/Gdata/Gapps/NicknameEntry.php';
/**
* Data model for a collection of Google Apps nickname entries, usually
* provided by the Google Apps servers.
*
* For information on requesting this feed from a server, see the Google
* Apps service class, Zend_Gdata_Gapps.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_NicknameFeed extends Zend_Gdata_Feed
{
protected $_entryClassName = 'Zend_Gdata_Gapps_NicknameEntry';
protected $_feedClassName = 'Zend_Gdata_Gapps_NicknameFeed';
}

View file

@ -0,0 +1,186 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: NicknameQuery.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Gapps_Query
*/
require_once('Zend/Gdata/Gapps/Query.php');
/**
* Assists in constructing queries for Google Apps nickname entries.
* Instances of this class can be provided in many places where a URL is
* required.
*
* For information on submitting queries to a server, see the Google Apps
* service class, Zend_Gdata_Gapps.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_NicknameQuery extends Zend_Gdata_Gapps_Query
{
/**
* If not null, indicates the name of the nickname entry which
* should be returned by this query.
*
* @var string
*/
protected $_nickname = null;
/**
* Create a new instance.
*
* @param string $domain (optional) The Google Apps-hosted domain to use
* when constructing query URIs.
* @param string $nickname (optional) Value for the nickname
* property.
* @param string $username (optional) Value for the username
* property.
* @param string $startNickname (optional) Value for the
* startNickname property.
*/
public function __construct($domain = null, $nickname = null,
$username = null, $startNickname = null)
{
parent::__construct($domain);
$this->setNickname($nickname);
$this->setUsername($username);
$this->setStartNickname($startNickname);
}
/**
* Set the nickname to query for. When set, only users with a nickname
* matching this value will be returned in search results. Set to
* null to disable filtering by username.
*
* @param string $value The nickname to filter search results by, or null
* to disable.
*/
public function setNickname($value)
{
$this->_nickname = $value;
}
/**
* Get the nickname to query for. If no nickname is set, null will be
* returned.
*
* @see setNickname
* @return string The nickname to filter search results by, or null if
* disabled.
*/
public function getNickname()
{
return $this->_nickname;
}
/**
* Set the username to query for. When set, only users with a username
* matching this value will be returned in search results. Set to
* null to disable filtering by username.
*
* @param string $value The username to filter search results by, or null
* to disable.
*/
public function setUsername($value)
{
if ($value !== null) {
$this->_params['username'] = $value;
}
else {
unset($this->_params['username']);
}
}
/**
* Get the username to query for. If no username is set, null will be
* returned.
*
* @see setUsername
* @return string The username to filter search results by, or null if
* disabled.
*/
public function getUsername()
{
if (array_key_exists('username', $this->_params)) {
return $this->_params['username'];
} else {
return null;
}
}
/**
* Set the first nickname which should be displayed when retrieving
* a list of nicknames.
*
* @param string $value The first nickname to be returned, or null to
* disable.
*/
public function setStartNickname($value)
{
if ($value !== null) {
$this->_params['startNickname'] = $value;
} else {
unset($this->_params['startNickname']);
}
}
/**
* Get the first nickname which should be displayed when retrieving
* a list of nicknames.
*
* @return string The first nickname to be returned, or null to
* disable.
*/
public function getStartNickname()
{
if (array_key_exists('startNickname', $this->_params)) {
return $this->_params['startNickname'];
} else {
return null;
}
}
/**
* Returns the URL generated for this query, based on it's current
* parameters.
*
* @return string A URL generated based on the state of this query.
*/
public function getQueryUrl()
{
$uri = $this->getBaseUrl();
$uri .= Zend_Gdata_Gapps::APPS_NICKNAME_PATH;
if ($this->_nickname !== null) {
$uri .= '/' . $this->_nickname;
}
$uri .= $this->getQueryString();
return $uri;
}
}

View file

@ -0,0 +1,123 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Query.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Gdata_Query
*/
require_once('Zend/Gdata/Query.php');
/**
* Zend_Gdata_Gapps
*/
require_once('Zend/Gdata/Gapps.php');
/**
* Assists in constructing queries for Google Apps entries. This class
* provides common methods used by all other Google Apps query classes.
*
* This class should never be instantiated directly. Instead, instantiate a
* class which inherits from this class.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Gdata_Gapps_Query extends Zend_Gdata_Query
{
/**
* The domain which is being administered via the Provisioning API.
*
* @var string
*/
protected $_domain = null;
/**
* Create a new instance.
*
* @param string $domain (optional) The Google Apps-hosted domain to use
* when constructing query URIs.
*/
public function __construct($domain = null)
{
parent::__construct();
$this->_domain = $domain;
}
/**
* Set domain for this service instance. This should be a fully qualified
* domain, such as 'foo.example.com'.
*
* This value is used when calculating URLs for retrieving and posting
* entries. If no value is specified, a URL will have to be manually
* constructed prior to using any methods which interact with the Google
* Apps provisioning service.
*
* @param string $value The domain to be used for this session.
*/
public function setDomain($value)
{
$this->_domain = $value;
}
/**
* Get domain for this service instance. This should be a fully qualified
* domain, such as 'foo.example.com'. If no domain is set, null will be
* returned.
*
* @see setDomain
* @return string The domain to be used for this session, or null if not
* set.
*/
public function getDomain()
{
return $this->_domain;
}
/**
* Returns the base URL used to access the Google Apps service, based
* on the current domain. The current domain can be temporarily
* overridden by providing a fully qualified domain as $domain.
*
* @see setDomain
* @param string $domain (optional) A fully-qualified domain to use
* instead of the default domain for this service instance.
*/
public function getBaseUrl($domain = null)
{
if ($domain !== null) {
return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $domain;
}
else if ($this->_domain !== null) {
return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $this->_domain;
}
else {
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'Domain must be specified.');
}
}
}

View file

@ -0,0 +1,208 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: ServiceException.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* Zend_Exception
*/
require_once 'Zend/Exception.php';
/**
* Zend_Gdata_Gapps_Error
*/
require_once 'Zend/Gdata/Gapps/Error.php';
/**
* Gdata Gapps Exception class. This is thrown when an
* AppsForYourDomainErrors message is received from the Google Apps
* servers.
*
* Several different errors may be represented by this exception. For a list
* of error codes available, see getErrorCode.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_ServiceException extends Zend_Exception
{
protected $_rootElement = "AppsForYourDomainErrors";
/**
* Array of Zend_Gdata_Error objects indexed by error code.
*
* @var array
*/
protected $_errors = array();
/**
* Create a new ServiceException.
*
* @return array An array containing a collection of
* Zend_Gdata_Gapps_Error objects.
*/
public function __construct($errors = null) {
parent::__construct("Server errors encountered");
if ($errors !== null) {
$this->setErrors($errors);
}
}
/**
* Add a single Error object to the list of errors received by the
* server.
*
* @param Zend_Gdata_Gapps_Error $error An instance of an error returned
* by the server. The error's errorCode must be set.
* @throws Zend_Gdata_App_Exception
*/
public function addError($error) {
// Make sure that we don't try to index an error that doesn't
// contain an index value.
if ($error->getErrorCode() == null) {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception("Error encountered without corresponding error code.");
}
$this->_errors[$error->getErrorCode()] = $error;
}
/**
* Set the list of errors as sent by the server inside of an
* AppsForYourDomainErrors tag.
*
* @param array $array An associative array containing a collection of
* Zend_Gdata_Gapps_Error objects. All errors must have their
* errorCode value set.
* @throws Zend_Gdata_App_Exception
*/
public function setErrors($array) {
$this->_errors = array();
foreach ($array as $error) {
$this->addError($error);
}
}
/**
* Get the list of errors as sent by the server inside of an
* AppsForYourDomainErrors tag.
*
* @return array An associative array containing a collection of
* Zend_Gdata_Gapps_Error objects, indexed by error code.
*/
public function getErrors() {
return $this->_errors;
}
/**
* Return the Error object associated with a specific error code.
*
* @return Zend_Gdata_Gapps_Error The Error object requested, or null
* if not found.
*/
public function getError($errorCode) {
if (array_key_exists($errorCode, $this->_errors)) {
$result = $this->_errors[$errorCode];
return $result;
} else {
return null;
}
}
/**
* Check whether or not a particular error code was returned by the
* server.
*
* @param integer $errorCode The error code to check against.
* @return boolean Whether or not the supplied error code was returned
* by the server.
*/
public function hasError($errorCode) {
return array_key_exists($errorCode, $this->_errors);
}
/**
* Import an AppsForYourDomain error from XML.
*
* @param string $string The XML data to be imported
* @return Zend_Gdata_Gapps_ServiceException Provides a fluent interface.
* @throws Zend_Gdata_App_Exception
*/
public function importFromString($string) {
if ($string) {
// Check to see if an AppsForYourDomainError exists
//
// track_errors is temporarily enabled so that if an error
// occurs while parsing the XML we can append it to an
// exception by referencing $php_errormsg
@ini_set('track_errors', 1);
$doc = new DOMDocument();
$success = @$doc->loadXML($string);
@ini_restore('track_errors');
if (!$success) {
require_once 'Zend/Gdata/App/Exception.php';
// $php_errormsg is automatically generated by PHP if
// an error occurs while calling loadXML(), above.
throw new Zend_Gdata_App_Exception("DOMDocument cannot parse XML: $php_errormsg");
}
// Ensure that the outermost node is an AppsForYourDomain error.
// If it isn't, something has gone horribly wrong.
$rootElement = $doc->getElementsByTagName($this->_rootElement)->item(0);
if (!$rootElement) {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('No root <' . $this->_rootElement . '> element found, cannot parse feed.');
}
foreach ($rootElement->childNodes as $errorNode) {
if (!($errorNode instanceof DOMText)) {
$error = new Zend_Gdata_Gapps_Error();
$error->transferFromDom($errorNode);
$this->addError($error);
}
}
return $this;
} else {
require_once 'Zend/Gdata/App/Exception.php';
throw new Zend_Gdata_App_Exception('XML passed to transferFromXML cannot be null');
}
}
/**
* Get a human readable version of this exception.
*
* @return string
*/
public function __toString() {
$result = "The server encountered the following errors processing the request:";
foreach ($this->_errors as $error) {
$result .= "\n" . $error->__toString();
}
return $result;
}
}

View file

@ -0,0 +1,295 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you 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 Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: UserEntry.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Extension_FeedLink
*/
require_once 'Zend/Gdata/Extension/FeedLink.php';
/**
* @see Zend_Gdata_Gapps_Extension_Login
*/
require_once 'Zend/Gdata/Gapps/Extension/Login.php';
/**
* @see Zend_Gdata_Gapps_Extension_Name
*/
require_once 'Zend/Gdata/Gapps/Extension/Name.php';
/**
* @see Zend_Gdata_Gapps_Extension_Quota
*/
require_once 'Zend/Gdata/Gapps/Extension/Quota.php';
/**
* Data model class for a Google Apps User Entry.
*
* Each user entry describes a single user within a Google Apps hosted
* domain.
*
* To transfer user entries to and from the Google Apps servers, including
* creating new entries, refer to the Google Apps service class,
* Zend_Gdata_Gapps.
*
* This class represents <atom:entry> in the Google Data protocol.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_UserEntry extends Zend_Gdata_Entry
{
protected $_entryClassName = 'Zend_Gdata_Gapps_UserEntry';
/**
* <apps:login> element containing information about this user's
* account, including their username and permissions.
*
* @var Zend_Gdata_Gapps_Extension_Login
*/
protected $_login = null;
/**
* <apps:name> element containing the user's actual name.
*
* @var Zend_Gdata_Gapps_Extension_Name
*/
protected $_name = null;
/**
* <apps:quotq> element describing any storage quotas in place for
* this user.
*
* @var Zend_Gdata_Gapps_Extension_Quota
*/
protected $_quota = null;
/**
* <gd:feedLink> element containing information about other feeds
* relevant to this entry.
*
* @var Zend_Gdata_Extension_FeedLink
*/
protected $_feedLink = array();
/**
* Create a new instance.
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
$this->registerAllNamespaces(Zend_Gdata_Gapps::$namespaces);
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_login !== null) {
$element->appendChild($this->_login->getDOM($element->ownerDocument));
}
if ($this->_name !== null) {
$element->appendChild($this->_name->getDOM($element->ownerDocument));
}
if ($this->_quota !== null) {
$element->appendChild($this->_quota->getDOM($element->ownerDocument));
}
foreach ($this->_feedLink as $feedLink) {
$element->appendChild($feedLink->getDOM($element->ownerDocument));
}
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them as members of this entry based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
switch ($absoluteNodeName) {
case $this->lookupNamespace('apps') . ':' . 'login';
$login = new Zend_Gdata_Gapps_Extension_Login();
$login->transferFromDOM($child);
$this->_login = $login;
break;
case $this->lookupNamespace('apps') . ':' . 'name';
$name = new Zend_Gdata_Gapps_Extension_Name();
$name->transferFromDOM($child);
$this->_name = $name;
break;
case $this->lookupNamespace('apps') . ':' . 'quota';
$quota = new Zend_Gdata_Gapps_Extension_Quota();
$quota->transferFromDOM($child);
$this->_quota = $quota;
break;
case $this->lookupNamespace('gd') . ':' . 'feedLink';
$feedLink = new Zend_Gdata_Extension_FeedLink();
$feedLink->transferFromDOM($child);
$this->_feedLink[] = $feedLink;
break;
default:
parent::takeChildFromDOM($child);
break;
}
}
/**
* Get the value of the login property for this object.
*
* @see setLogin
* @return Zend_Gdata_Gapps_Extension_Login The requested object.
*/
public function getLogin()
{
return $this->_login;
}
/**
* Set the value of the login property for this object. This property
* is used to store the username address of the current user.
*
* @param Zend_Gdata_Gapps_Extension_Login $value The desired value for
* this instance's login property.
* @return Zend_Gdata_Gapps_UserEntry Provides a fluent interface.
*/
public function setLogin($value)
{
$this->_login = $value;
return $this;
}
/**
* Get the value of the name property for this object.
*
* @see setName
* @return Zend_Gdata_Gapps_Extension_Name The requested object.
*/
public function getName()
{
return $this->_name;
}
/**
* Set the value of the name property for this object. This property
* is used to store the full name of the current user.
*
* @param Zend_Gdata_Gapps_Extension_Name $value The desired value for
* this instance's name property.
* @return Zend_Gdata_Gapps_UserEntry Provides a fluent interface.
*/
public function setName($value)
{
$this->_name = $value;
return $this;
}
/**
* Get the value of the quota property for this object.
*
* @see setQuota
* @return Zend_Gdata_Gapps_Extension_Quota The requested object.
*/
public function getQuota()
{
return $this->_quota;
}
/**
* Set the value of the quota property for this object. This property
* is used to store the amount of storage available for the current
* user. Quotas may not be modifiable depending on the domain used.
*
* @param Zend_Gdata_Gapps_Extension_Quota $value The desired value for
* this instance's quota property.
* @return Zend_Gdata_Gapps_UserEntry Provides a fluent interface.
*/
public function setQuota($value)
{
$this->_quota = $value;
return $this;
}
/**
* Returns all feed links for this entry, or if a rel value is
* specified, the feed link associated with that value is returned.
*
* @param string $rel The rel value of the link to be found. If null,
* the array of links is returned instead.
* @return mixed Either an array of Zend_Gdata_Extension_FeedLink
* objects if $rel is null, a single
* Zend_Gdata_Extension_FeedLink object if $rel is specified
* and a matching feed link is found, or null if $rel is
* specified and no matching feed link is found.
*/
public function getFeedLink($rel = null)
{
if ($rel == null) {
return $this->_feedLink;
} else {
foreach ($this->_feedLink as $feedLink) {
if ($feedLink->rel == $rel) {
return $feedLink;
}
}
return null;
}
}
/**
* Set the value of the feed link property for this object. This property
* is used to provide links to alternative feeds relevant to this entry.
*
* @param array $value A collection of
* Zend_Gdata_Gapps_Extension_FeedLink objects.
* @return Zend_Gdata_Gapps_EventEntry Provides a fluent interface.
*/
public function setFeedLink($value)
{
$this->_feedLink = $value;
return $this;
}
}

View file

@ -0,0 +1,53 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: UserFeed.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
* @see Zend_Gdata_Gapps_UserEntry
*/
require_once 'Zend/Gdata/Gapps/UserEntry.php';
/**
* Data model for a collection of Google Apps user entries, usually
* provided by the Google Apps servers.
*
* For information on requesting this feed from a server, see the Google
* Apps service class, Zend_Gdata_Gapps.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_UserFeed extends Zend_Gdata_Feed
{
protected $_entryClassName = 'Zend_Gdata_Gapps_UserEntry';
protected $_feedClassName = 'Zend_Gdata_Gapps_UserFeed';
}

View file

@ -0,0 +1,147 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: UserQuery.php 20096 2010-01-06 02:05:09Z bkarwin $
*/
/**
* @see Zend_Gdata_Gapps_Query
*/
require_once('Zend/Gdata/Gapps/Query.php');
/**
* Assists in constructing queries for Google Apps user entries.
* Instances of this class can be provided in many places where a URL is
* required.
*
* For information on submitting queries to a server, see the Google Apps
* service class, Zend_Gdata_Gapps.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Gapps
* @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Gapps_UserQuery extends Zend_Gdata_Gapps_Query
{
/**
* If not null, specifies the username of the user who should be
* retrieved by this query.
*
* @var string
*/
protected $_username = null;
/**
* Create a new instance.
*
* @param string $domain (optional) The Google Apps-hosted domain to use
* when constructing query URIs.
* @param string $username (optional) Value for the username
* property.
* @param string $startUsername (optional) Value for the
* startUsername property.
*/
public function __construct($domain = null, $username = null,
$startUsername = null)
{
parent::__construct($domain);
$this->setUsername($username);
$this->setStartUsername($startUsername);
}
/**
* Set the username to query for. When set, only users with a username
* matching this value will be returned in search results. Set to
* null to disable filtering by username.
*
* @see getUsername
* @param string $value The username to filter search results by, or null to
* disable.
*/
public function setUsername($value)
{
$this->_username = $value;
}
/**
* Get the username to query for. If no username is set, null will be
* returned.
*
* @param string $value The username to filter search results by, or
* null if disabled.
*/
public function getUsername()
{
return $this->_username;
}
/**
* Set the first username which should be displayed when retrieving
* a list of users.
*
* @param string $value The first username to be returned, or null to
* disable.
*/
public function setStartUsername($value)
{
if ($value !== null) {
$this->_params['startUsername'] = $value;
} else {
unset($this->_params['startUsername']);
}
}
/**
* Get the first username which should be displayed when retrieving
* a list of users.
*
* @see setStartUsername
* @return string The first username to be returned, or null if
* disabled.
*/
public function getStartUsername()
{
if (array_key_exists('startUsername', $this->_params)) {
return $this->_params['startUsername'];
} else {
return null;
}
}
/**
* Returns the query URL generated by this query instance.
*
* @return string The query URL for this instance.
*/
public function getQueryUrl()
{
$uri = $this->getBaseUrl();
$uri .= Zend_Gdata_Gapps::APPS_USER_PATH;
if ($this->_username !== null) {
$uri .= '/' . $this->_username;
}
$uri .= $this->getQueryString();
return $uri;
}
}