web/lib/Zend/Gdata/AuthSub.php
changeset 807 877f952ae2bd
parent 207 621fa6caec0c
child 1230 68c69c656a2c
equal deleted inserted replaced
805:5e7a0fedabdf 807:877f952ae2bd
    14  * to license@zend.com so we can send you a copy immediately.
    14  * to license@zend.com so we can send you a copy immediately.
    15  *
    15  *
    16  * @category   Zend
    16  * @category   Zend
    17  * @package    Zend_Gdata
    17  * @package    Zend_Gdata
    18  * @subpackage Gdata
    18  * @subpackage Gdata
    19  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    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
    20  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    21  * @version    $Id: AuthSub.php 20096 2010-01-06 02:05:09Z bkarwin $
    21  * @version    $Id: AuthSub.php 24593 2012-01-05 20:35:02Z matthew $
    22  */
    22  */
    23 
    23 
    24 /**
    24 /**
    25  * Zend_Gdata_HttpClient
    25  * Zend_Gdata_HttpClient
    26  */
    26  */
    38  * @see http://code.google.com/apis/accounts/AuthForWebApps.html
    38  * @see http://code.google.com/apis/accounts/AuthForWebApps.html
    39  *
    39  *
    40  * @category   Zend
    40  * @category   Zend
    41  * @package    Zend_Gdata
    41  * @package    Zend_Gdata
    42  * @subpackage Gdata
    42  * @subpackage Gdata
    43  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
    43  * @copyright  Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com)
    44  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    44  * @license    http://framework.zend.com/license/new-bsd     New BSD License
    45  */
    45  */
    46 class Zend_Gdata_AuthSub
    46 class Zend_Gdata_AuthSub
    47 {
    47 {
    48 
    48 
   167 
   167 
   168         ob_start();
   168         ob_start();
   169         try {
   169         try {
   170             $response = $client->request('GET');
   170             $response = $client->request('GET');
   171         } catch (Zend_Http_Client_Exception $e) {
   171         } catch (Zend_Http_Client_Exception $e) {
       
   172             ob_end_clean();
   172             require_once 'Zend/Gdata/App/HttpException.php';
   173             require_once 'Zend/Gdata/App/HttpException.php';
   173             throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
   174             throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
   174         }
   175         }
   175         ob_end_clean();
   176         ob_end_clean();
   176         // Parse Google's response
   177         // Parse Google's response
   208 
   209 
   209         ob_start();
   210         ob_start();
   210         try {
   211         try {
   211             $response = $client->request('GET');
   212             $response = $client->request('GET');
   212         } catch (Zend_Http_Client_Exception $e) {
   213         } catch (Zend_Http_Client_Exception $e) {
       
   214             ob_end_clean();
   213             require_once 'Zend/Gdata/App/HttpException.php';
   215             require_once 'Zend/Gdata/App/HttpException.php';
   214             throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
   216             throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
   215         }
   217         }
   216         ob_end_clean();
   218         ob_end_clean();
   217         return $response->getBody();
   219         return $response->getBody();
   227     public static function getHttpClient($token, $client = null)
   229     public static function getHttpClient($token, $client = null)
   228     {
   230     {
   229         if ($client == null) {
   231         if ($client == null) {
   230             $client = new Zend_Gdata_HttpClient();
   232             $client = new Zend_Gdata_HttpClient();
   231         }
   233         }
   232         if (!$client instanceof Zend_Http_Client) {
   234         if (!$client instanceof Zend_Gdata_HttpClient) {
   233             require_once 'Zend/Gdata/App/HttpException.php';
   235             require_once 'Zend/Gdata/App/HttpException.php';
   234             throw new Zend_Gdata_App_HttpException('Client is not an instance of Zend_Http_Client.');
   236             throw new Zend_Gdata_App_HttpException('Client is not an instance of Zend_Gdata_HttpClient.');
   235         }
   237         }
   236         $useragent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION;
   238         $useragent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION;
   237         $client->setConfig(array(
   239         $client->setConfig(array(
   238                 'strictredirects' => true,
   240                 'strictredirects' => true,
   239                 'useragent' => $useragent
   241                 'useragent' => $useragent