• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • Examples
  • File List

E:/E/GEAMP/www/openbiz/openbiz/others/Zend/Gdata.php

00001 <?php
00002 
00027 require_once 'Zend/Gdata/App.php';
00028 
00044 class Zend_Gdata extends Zend_Gdata_App
00045 {
00046 
00052     const AUTH_SERVICE_NAME = 'xapi';
00053 
00059     protected $_defaultPostUri = null;
00060 
00066     protected $_registeredPackages = array(
00067             'Zend_Gdata_Kind',
00068             'Zend_Gdata_Extension',
00069             'Zend_Gdata',
00070             'Zend_Gdata_App_Extension',
00071             'Zend_Gdata_App');
00072 
00078     public static $namespaces = array(
00079         array('gd', 'http://schemas.google.com/g/2005', 1, 0),
00080         array('openSearch', 'http://a9.com/-/spec/opensearchrss/1.0/', 1, 0),
00081         array('openSearch', 'http://a9.com/-/spec/opensearch/1.1/', 2, 0),
00082         array('rss', 'http://blogs.law.harvard.edu/tech/rss', 1, 0)
00083     );
00084 
00090     protected $_httpClient;
00091 
00097     protected static $_staticHttpClient = null;
00098 
00106     public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0')
00107     {
00108         parent::__construct($client, $applicationId);
00109     }
00110 
00123     public static function import($uri, $client = null,
00124         $className='Zend_Gdata_Feed')
00125     {
00126         $app = new Zend_Gdata($client);
00127         $requestData = $app->decodeRequest('GET', $uri);
00128         $response = $app->performHttpRequest($requestData['method'], $requestData['url']);
00129 
00130         $feedContent = $response->getBody();
00131 
00132         $feed = self::importString($feedContent, $className);
00133         if ($client != null) {
00134             $feed->setHttpClient($client);
00135         }
00136         return $feed;
00137     }
00138 
00150     public function getFeed($location, $className='Zend_Gdata_Feed')
00151     {
00152         if (is_string($location)) {
00153             $uri = $location;
00154         } elseif ($location instanceof Zend_Gdata_Query) {
00155             $uri = $location->getQueryUrl();
00156         } else {
00157             require_once 'Zend/Gdata/App/InvalidArgumentException.php';
00158             throw new Zend_Gdata_App_InvalidArgumentException(
00159                     'You must specify the location as either a string URI ' .
00160                     'or a child of Zend_Gdata_Query');
00161         }
00162         return parent::getFeed($uri, $className);
00163     }
00164 
00175     public function getEntry($location, $className='Zend_Gdata_Entry')
00176     {
00177         if (is_string($location)) {
00178             $uri = $location;
00179         } elseif ($location instanceof Zend_Gdata_Query) {
00180             $uri = $location->getQueryUrl();
00181         } else {
00182             require_once 'Zend/Gdata/App/InvalidArgumentException.php';
00183             throw new Zend_Gdata_App_InvalidArgumentException(
00184                     'You must specify the location as either a string URI ' .
00185                     'or a child of Zend_Gdata_Query');
00186         }
00187         return parent::getEntry($uri, $className);
00188     }
00189 
00210     public function performHttpRequest($method, $url, $headers = array(), $body = null, $contentType = null, $remainingRedirects = null)
00211     {
00212         if ($this->_httpClient instanceof Zend_Gdata_HttpClient) {
00213             $filterResult = $this->_httpClient->filterHttpRequest($method, $url, $headers, $body, $contentType);
00214             $method = $filterResult['method'];
00215             $url = $filterResult['url'];
00216             $body = $filterResult['body'];
00217             $headers = $filterResult['headers'];
00218             $contentType = $filterResult['contentType'];
00219             return $this->_httpClient->filterHttpResponse(parent::performHttpRequest($method, $url, $headers, $body, $contentType, $remainingRedirects));
00220         } else {
00221             return parent::performHttpRequest($method, $url, $headers, $body, $contentType, $remainingRedirects);
00222         }
00223     }
00224 
00230     public function isAuthenticated()
00231     {
00232         $client = parent::getHttpClient();
00233         if ($client->getClientLoginToken() ||
00234             $client->getAuthSubToken()) {
00235                 return true;
00236         }
00237 
00238         return false;
00239     }
00240 
00241 }

Generated on Thu Apr 19 2012 17:01:17 for openbiz by  doxygen 1.7.2