source: extensions/Google2Piwigo/include/Zend/Gdata/Gapps/Query.php @ 17475

Revision 17475, 3.7 KB checked in by mistic100, 7 years ago (diff)

new extension: Google2Piwigo

Line 
1<?php
2
3/**
4 * Zend Framework
5 *
6 * LICENSE
7 *
8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
15 *
16 * @category   Zend
17 * @package    Zend_Gdata
18 * @subpackage Gapps
19 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license    http://framework.zend.com/license/new-bsd     New BSD License
21 * @version    $Id: Query.php 24594 2012-01-05 21:27:01Z matthew $
22 */
23
24/**
25 * Zend_Gdata_Query
26 */
27require_once('Zend/Gdata/Query.php');
28
29/**
30 * Zend_Gdata_Gapps
31 */
32require_once('Zend/Gdata/Gapps.php');
33
34/**
35 * Assists in constructing queries for Google Apps entries. This class
36 * provides common methods used by all other Google Apps query classes.
37 *
38 * This class should never be instantiated directly. Instead, instantiate a
39 * class which inherits from this class.
40  *
41 * @category   Zend
42 * @package    Zend_Gdata
43 * @subpackage Gapps
44 * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
45 * @license    http://framework.zend.com/license/new-bsd     New BSD License
46 */
47abstract class Zend_Gdata_Gapps_Query extends Zend_Gdata_Query
48{
49
50    /**
51     * The domain which is being administered via the Provisioning API.
52     *
53     * @var string
54     */
55    protected $_domain = null;
56
57    /**
58     * Create a new instance.
59     *
60     * @param string $domain (optional) The Google Apps-hosted domain to use
61     *          when constructing query URIs.
62     */
63    public function __construct($domain = null)
64    {
65        parent::__construct();
66        $this->_domain = $domain;
67    }
68
69    /**
70     * Set domain for this service instance. This should be a fully qualified
71     * domain, such as 'foo.example.com'.
72     *
73     * This value is used when calculating URLs for retrieving and posting
74     * entries. If no value is specified, a URL will have to be manually
75     * constructed prior to using any methods which interact with the Google
76     * Apps provisioning service.
77     *
78     * @param string $value The domain to be used for this session.
79     */
80    public function setDomain($value)
81    {
82        $this->_domain = $value;
83    }
84
85    /**
86     * Get domain for this service instance. This should be a fully qualified
87     * domain, such as 'foo.example.com'. If no domain is set, null will be
88     * returned.
89     *
90     * @see setDomain
91     * @return string The domain to be used for this session, or null if not
92     *          set.
93     */
94    public function getDomain()
95    {
96        return $this->_domain;
97    }
98
99    /**
100     * Returns the base URL used to access the Google Apps service, based
101     * on the current domain. The current domain can be temporarily
102     * overridden by providing a fully qualified domain as $domain.
103     *
104     * @see setDomain
105     * @param string $domain (optional) A fully-qualified domain to use
106     *          instead of the default domain for this service instance.
107     */
108     public function getBaseUrl($domain = null)
109     {
110         if ($domain !== null) {
111             return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $domain;
112         }
113         else if ($this->_domain !== null) {
114             return Zend_Gdata_Gapps::APPS_BASE_FEED_URI . '/' . $this->_domain;
115         }
116         else {
117             require_once 'Zend/Gdata/App/InvalidArgumentException.php';
118             throw new Zend_Gdata_App_InvalidArgumentException(
119                 'Domain must be specified.');
120         }
121     }
122
123}
Note: See TracBrowser for help on using the repository browser.