CommunityID/libs/Zend/Gdata/Gapps/Query.php

124 lines
3.7 KiB
PHP
Raw Normal View History

2019-07-17 20:08:50 +00:00
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you 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
2019-07-17 20:19:00 +00:00
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
2019-07-17 20:08:50 +00:00
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Query.php 18951 2009-11-12 16:26:19Z alexander $
2019-07-17 20:08:50 +00:00
*/
/**
* 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
2019-07-17 20:08:50 +00:00
* provides common methods used by all other Google Apps query classes.
*
* This class should never be instantiated directly. Instead, instantiate a
2019-07-17 20:08:50 +00:00
* class which inherits from this class.
*
2019-07-17 20:08:50 +00:00
* @category Zend
* @package Zend_Gdata
2019-07-17 20:16:19 +00:00
* @subpackage Gapps
2019-07-17 20:19:00 +00:00
* @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
2019-07-17 20:08:50 +00:00
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
abstract class Zend_Gdata_Gapps_Query extends Zend_Gdata_Query
{
2019-07-17 20:08:50 +00:00
/**
* The domain which is being administered via the Provisioning API.
*
* @var string
*/
protected $_domain = null;
2019-07-17 20:08:50 +00:00
/**
* Create a new instance.
*
* @param string $domain (optional) The Google Apps-hosted domain to use
2019-07-17 20:08:50 +00:00
* when constructing query URIs.
*/
public function __construct($domain = null)
{
parent::__construct();
$this->_domain = $domain;
}
2019-07-17 20:08:50 +00:00
/**
* Set domain for this service instance. This should be a fully qualified
2019-07-17 20:08:50 +00:00
* 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
2019-07-17 20:08:50 +00:00
* Apps provisioning service.
*
2019-07-17 20:08:50 +00:00
* @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
2019-07-17 20:08:50 +00:00
* returned.
*
2019-07-17 20:08:50 +00:00
* @see setDomain
* @return string The domain to be used for this session, or null if not
2019-07-17 20:08:50 +00:00
* set.
*/
public function getDomain()
{
return $this->_domain;
}
2019-07-17 20:08:50 +00:00
/**
* Returns the base URL used to access the Google Apps service, based
* on the current domain. The current domain can be temporarily
2019-07-17 20:08:50 +00:00
* overridden by providing a fully qualified domain as $domain.
*
* @see setDomain
* @param string $domain (optional) A fully-qualified domain to use
2019-07-17 20:08:50 +00:00
* 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.');
}
}
}