|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/App/Feed.php'; 00028 00032 require_once 'Zend/Http/Client.php'; 00033 00037 require_once 'Zend/Version.php'; 00038 00042 require_once 'Zend/Gdata/App/MediaSource.php'; 00043 00055 class Zend_Gdata_App 00056 { 00057 00062 const DEFAULT_MAJOR_PROTOCOL_VERSION = 1; 00063 00068 const DEFAULT_MINOR_PROTOCOL_VERSION = null; 00069 00075 protected $_httpClient; 00076 00082 protected static $_staticHttpClient = null; 00083 00089 protected static $_httpMethodOverride = false; 00090 00096 protected static $_gzipEnabled = false; 00097 00104 protected static $_verboseExceptionMessages = true; 00105 00111 protected $_defaultPostUri = null; 00112 00118 protected $_registeredPackages = array( 00119 'Zend_Gdata_App_Extension', 00120 'Zend_Gdata_App'); 00121 00127 protected static $_maxRedirects = 5; 00128 00140 protected $_majorProtocolVersion; 00141 00156 protected $_minorProtocolVersion; 00157 00163 protected $_useObjectMapping = true; 00164 00171 public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0') 00172 { 00173 $this->setHttpClient($client, $applicationId); 00174 // Set default protocol version. Subclasses should override this as 00175 // needed once a given service supports a new version. 00176 $this->setMajorProtocolVersion(self::DEFAULT_MAJOR_PROTOCOL_VERSION); 00177 $this->setMinorProtocolVersion(self::DEFAULT_MINOR_PROTOCOL_VERSION); 00178 } 00179 00188 public function registerPackage($name) 00189 { 00190 array_unshift($this->_registeredPackages, $name); 00191 } 00192 00203 public function getFeed($uri, $className='Zend_Gdata_App_Feed') 00204 { 00205 return $this->importUrl($uri, $className, null); 00206 } 00207 00218 public function getEntry($uri, $className='Zend_Gdata_App_Entry') 00219 { 00220 return $this->importUrl($uri, $className, null); 00221 } 00222 00228 public function getHttpClient() 00229 { 00230 return $this->_httpClient; 00231 } 00232 00240 public function setHttpClient($client, 00241 $applicationId = 'MyCompany-MyApp-1.0') 00242 { 00243 if ($client === null) { 00244 $client = new Zend_Http_Client(); 00245 } 00246 if (!$client instanceof Zend_Http_Client) { 00247 require_once 'Zend/Gdata/App/HttpException.php'; 00248 throw new Zend_Gdata_App_HttpException( 00249 'Argument is not an instance of Zend_Http_Client.'); 00250 } 00251 $userAgent = $applicationId . ' Zend_Framework_Gdata/' . 00252 Zend_Version::VERSION; 00253 $client->setHeaders('User-Agent', $userAgent); 00254 $client->setConfig(array( 00255 'strictredirects' => true 00256 ) 00257 ); 00258 $this->_httpClient = $client; 00259 self::setStaticHttpClient($client); 00260 return $this; 00261 } 00262 00271 public static function setStaticHttpClient(Zend_Http_Client $httpClient) 00272 { 00273 self::$_staticHttpClient = $httpClient; 00274 } 00275 00276 00282 public static function getStaticHttpClient() 00283 { 00284 if (!self::$_staticHttpClient instanceof Zend_Http_Client) { 00285 $client = new Zend_Http_Client(); 00286 $userAgent = 'Zend_Framework_Gdata/' . Zend_Version::VERSION; 00287 $client->setHeaders('User-Agent', $userAgent); 00288 $client->setConfig(array( 00289 'strictredirects' => true 00290 ) 00291 ); 00292 self::$_staticHttpClient = $client; 00293 } 00294 return self::$_staticHttpClient; 00295 } 00296 00310 public static function setHttpMethodOverride($override = true) 00311 { 00312 self::$_httpMethodOverride = $override; 00313 } 00314 00320 public static function getHttpMethodOverride() 00321 { 00322 return self::$_httpMethodOverride; 00323 } 00324 00331 public static function setGzipEnabled($enabled = false) 00332 { 00333 if ($enabled && !function_exists('gzinflate')) { 00334 require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 00335 throw new Zend_Gdata_App_InvalidArgumentException( 00336 'You cannot enable gzipped responses if the zlib module ' . 00337 'is not enabled in your PHP installation.'); 00338 00339 } 00340 self::$_gzipEnabled = $enabled; 00341 } 00342 00348 public static function getGzipEnabled() 00349 { 00350 return self::$_gzipEnabled; 00351 } 00352 00361 public static function getVerboseExceptionMessages() 00362 { 00363 return self::$_verboseExceptionMessages; 00364 } 00365 00374 public static function setVerboseExceptionMessages($verbose) 00375 { 00376 self::$_verboseExceptionMessages = $verbose; 00377 } 00378 00385 public static function setMaxRedirects($maxRedirects) 00386 { 00387 self::$_maxRedirects = $maxRedirects; 00388 } 00389 00395 public static function getMaxRedirects() 00396 { 00397 return self::$_maxRedirects; 00398 } 00399 00408 public function setMajorProtocolVersion($value) 00409 { 00410 if (!($value >= 1)) { 00411 require_once('Zend/Gdata/App/InvalidArgumentException.php'); 00412 throw new Zend_Gdata_App_InvalidArgumentException( 00413 'Major protocol version must be >= 1'); 00414 } 00415 $this->_majorProtocolVersion = $value; 00416 } 00417 00424 public function getMajorProtocolVersion() 00425 { 00426 return $this->_majorProtocolVersion; 00427 } 00428 00438 public function setMinorProtocolVersion($value) 00439 { 00440 if (!($value >= 0)) { 00441 require_once('Zend/Gdata/App/InvalidArgumentException.php'); 00442 throw new Zend_Gdata_App_InvalidArgumentException( 00443 'Minor protocol version must be >= 0'); 00444 } 00445 $this->_minorProtocolVersion = $value; 00446 } 00447 00455 public function getMinorProtocolVersion() 00456 { 00457 return $this->_minorProtocolVersion; 00458 } 00459 00483 public function prepareRequest($method, 00484 $url = null, 00485 $headers = array(), 00486 $data = null, 00487 $contentTypeOverride = null) 00488 { 00489 // As a convenience, if $headers is null, we'll convert it back to 00490 // an empty array. 00491 if ($headers === null) { 00492 $headers = array(); 00493 } 00494 00495 $rawData = null; 00496 $finalContentType = null; 00497 if ($url == null) { 00498 $url = $this->_defaultPostUri; 00499 } 00500 00501 if (is_string($data)) { 00502 $rawData = $data; 00503 if ($contentTypeOverride === null) { 00504 $finalContentType = 'application/atom+xml'; 00505 } 00506 } elseif ($data instanceof Zend_Gdata_App_MediaEntry) { 00507 $rawData = $data->encode(); 00508 if ($data->getMediaSource() !== null) { 00509 $finalContentType = $rawData->getContentType(); 00510 $headers['MIME-version'] = '1.0'; 00511 $headers['Slug'] = $data->getMediaSource()->getSlug(); 00512 } else { 00513 $finalContentType = 'application/atom+xml'; 00514 } 00515 if ($method == 'PUT' || $method == 'DELETE') { 00516 $editLink = $data->getEditLink(); 00517 if ($editLink != null && $url == null) { 00518 $url = $editLink->getHref(); 00519 } 00520 } 00521 } elseif ($data instanceof Zend_Gdata_App_Entry) { 00522 $rawData = $data->saveXML(); 00523 $finalContentType = 'application/atom+xml'; 00524 if ($method == 'PUT' || $method == 'DELETE') { 00525 $editLink = $data->getEditLink(); 00526 if ($editLink != null) { 00527 $url = $editLink->getHref(); 00528 } 00529 } 00530 } elseif ($data instanceof Zend_Gdata_App_MediaSource) { 00531 $rawData = $data->encode(); 00532 if ($data->getSlug() !== null) { 00533 $headers['Slug'] = $data->getSlug(); 00534 } 00535 $finalContentType = $data->getContentType(); 00536 } 00537 00538 if ($method == 'DELETE') { 00539 $rawData = null; 00540 } 00541 00542 // Set an If-Match header if: 00543 // - This isn't a DELETE 00544 // - If this isn't a GET, the Etag isn't weak 00545 // - A similar header (If-Match/If-None-Match) hasn't already been 00546 // set. 00547 if ($method != 'DELETE' && ( 00548 !array_key_exists('If-Match', $headers) && 00549 !array_key_exists('If-None-Match', $headers) 00550 ) ) { 00551 $allowWeak = $method == 'GET'; 00552 if ($ifMatchHeader = $this->generateIfMatchHeaderData( 00553 $data, $allowWeak)) { 00554 $headers['If-Match'] = $ifMatchHeader; 00555 } 00556 } 00557 00558 if ($method != 'POST' && $method != 'GET' && Zend_Gdata_App::getHttpMethodOverride()) { 00559 $headers['x-http-method-override'] = $method; 00560 $method = 'POST'; 00561 } else { 00562 $headers['x-http-method-override'] = null; 00563 } 00564 00565 if ($contentTypeOverride != null) { 00566 $finalContentType = $contentTypeOverride; 00567 } 00568 00569 return array('method' => $method, 'url' => $url, 00570 'data' => $rawData, 'headers' => $headers, 00571 'contentType' => $finalContentType); 00572 } 00573 00589 public function performHttpRequest($method, $url, $headers = null, 00590 $body = null, $contentType = null, $remainingRedirects = null) 00591 { 00592 require_once 'Zend/Http/Client/Exception.php'; 00593 if ($remainingRedirects === null) { 00594 $remainingRedirects = self::getMaxRedirects(); 00595 } 00596 if ($headers === null) { 00597 $headers = array(); 00598 } 00599 // Append a Gdata version header if protocol v2 or higher is in use. 00600 // (Protocol v1 does not use this header.) 00601 $major = $this->getMajorProtocolVersion(); 00602 $minor = $this->getMinorProtocolVersion(); 00603 if ($major >= 2) { 00604 $headers['GData-Version'] = $major + 00605 (($minor === null) ? '.' + $minor : ''); 00606 } 00607 00608 // check the overridden method 00609 if (($method == 'POST' || $method == 'PUT') && $body === null && 00610 $headers['x-http-method-override'] != 'DELETE') { 00611 require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 00612 throw new Zend_Gdata_App_InvalidArgumentException( 00613 'You must specify the data to post as either a ' . 00614 'string or a child of Zend_Gdata_App_Entry'); 00615 } 00616 if ($url === null) { 00617 require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 00618 throw new Zend_Gdata_App_InvalidArgumentException( 00619 'You must specify an URI to which to post.'); 00620 } 00621 $headers['Content-Type'] = $contentType; 00622 if (Zend_Gdata_App::getGzipEnabled()) { 00623 // some services require the word 'gzip' to be in the user-agent 00624 // header in addition to the accept-encoding header 00625 if (strpos($this->_httpClient->getHeader('User-Agent'), 00626 'gzip') === false) { 00627 $headers['User-Agent'] = 00628 $this->_httpClient->getHeader('User-Agent') . ' (gzip)'; 00629 } 00630 $headers['Accept-encoding'] = 'gzip, deflate'; 00631 } else { 00632 $headers['Accept-encoding'] = 'identity'; 00633 } 00634 00635 // Make sure the HTTP client object is 'clean' before making a request 00636 // In addition to standard headers to reset via resetParameters(), 00637 // also reset the Slug and If-Match headers 00638 $this->_httpClient->resetParameters(); 00639 $this->_httpClient->setHeaders(array('Slug', 'If-Match')); 00640 00641 // Set the params for the new request to be performed 00642 $this->_httpClient->setHeaders($headers); 00643 $this->_httpClient->setUri($url); 00644 $this->_httpClient->setConfig(array('maxredirects' => 0)); 00645 00646 // Set the proper adapter if we are handling a streaming upload 00647 $usingMimeStream = false; 00648 $oldHttpAdapter = null; 00649 00650 if ($body instanceof Zend_Gdata_MediaMimeStream) { 00651 $usingMimeStream = true; 00652 $this->_httpClient->setRawDataStream($body, $contentType); 00653 $oldHttpAdapter = $this->_httpClient->getAdapter(); 00654 00655 if ($oldHttpAdapter instanceof Zend_Http_Client_Adapter_Proxy) { 00656 require_once 'Zend/Gdata/HttpAdapterStreamingProxy.php'; 00657 $newAdapter = new Zend_Gdata_HttpAdapterStreamingProxy(); 00658 } else { 00659 require_once 'Zend/Gdata/HttpAdapterStreamingSocket.php'; 00660 $newAdapter = new Zend_Gdata_HttpAdapterStreamingSocket(); 00661 } 00662 $this->_httpClient->setAdapter($newAdapter); 00663 } else { 00664 $this->_httpClient->setRawData($body, $contentType); 00665 } 00666 00667 try { 00668 $response = $this->_httpClient->request($method); 00669 // reset adapter 00670 if ($usingMimeStream) { 00671 $this->_httpClient->setAdapter($oldHttpAdapter); 00672 } 00673 } catch (Zend_Http_Client_Exception $e) { 00674 // reset adapter 00675 if ($usingMimeStream) { 00676 $this->_httpClient->setAdapter($oldHttpAdapter); 00677 } 00678 require_once 'Zend/Gdata/App/HttpException.php'; 00679 throw new Zend_Gdata_App_HttpException($e->getMessage(), $e); 00680 } 00681 if ($response->isRedirect() && $response->getStatus() != '304') { 00682 if ($remainingRedirects > 0) { 00683 $newUrl = $response->getHeader('Location'); 00684 $response = $this->performHttpRequest( 00685 $method, $newUrl, $headers, $body, 00686 $contentType, $remainingRedirects); 00687 } else { 00688 require_once 'Zend/Gdata/App/HttpException.php'; 00689 throw new Zend_Gdata_App_HttpException( 00690 'Number of redirects exceeds maximum', null, $response); 00691 } 00692 } 00693 if (!$response->isSuccessful()) { 00694 require_once 'Zend/Gdata/App/HttpException.php'; 00695 $exceptionMessage = 'Expected response code 200, got ' . 00696 $response->getStatus(); 00697 if (self::getVerboseExceptionMessages()) { 00698 $exceptionMessage .= "\n" . $response->getBody(); 00699 } 00700 $exception = new Zend_Gdata_App_HttpException($exceptionMessage); 00701 $exception->setResponse($response); 00702 throw $exception; 00703 } 00704 return $response; 00705 } 00706 00719 public static function import($uri, $client = null, 00720 $className='Zend_Gdata_App_Feed') 00721 { 00722 $app = new Zend_Gdata_App($client); 00723 $requestData = $app->prepareRequest('GET', $uri); 00724 $response = $app->performHttpRequest( 00725 $requestData['method'], $requestData['url']); 00726 00727 $feedContent = $response->getBody(); 00728 if (!$this->_useObjectMapping) { 00729 return $feedContent; 00730 } 00731 $feed = self::importString($feedContent, $className); 00732 if ($client != null) { 00733 $feed->setHttpClient($client); 00734 } 00735 return $feed; 00736 } 00737 00751 public function importUrl($url, $className='Zend_Gdata_App_Feed', 00752 $extraHeaders = array()) 00753 { 00754 $response = $this->get($url, $extraHeaders); 00755 00756 $feedContent = $response->getBody(); 00757 if (!$this->_useObjectMapping) { 00758 return $feedContent; 00759 } 00760 00761 $protocolVersionStr = $response->getHeader('GData-Version'); 00762 $majorProtocolVersion = null; 00763 $minorProtocolVersion = null; 00764 if ($protocolVersionStr !== null) { 00765 // Extract protocol major and minor version from header 00766 $delimiterPos = strpos($protocolVersionStr, '.'); 00767 $length = strlen($protocolVersionStr); 00768 $major = substr($protocolVersionStr, 0, $delimiterPos); 00769 $minor = substr($protocolVersionStr, $delimiterPos + 1, $length); 00770 $majorProtocolVersion = $major; 00771 $minorProtocolVersion = $minor; 00772 } 00773 00774 $feed = self::importString($feedContent, $className, 00775 $majorProtocolVersion, $minorProtocolVersion); 00776 if ($this->getHttpClient() != null) { 00777 $feed->setHttpClient($this->getHttpClient()); 00778 } 00779 $etag = $response->getHeader('ETag'); 00780 if ($etag !== null) { 00781 $feed->setEtag($etag); 00782 } 00783 return $feed; 00784 } 00785 00786 00799 public static function importString($string, 00800 $className='Zend_Gdata_App_Feed', $majorProtocolVersion = null, 00801 $minorProtocolVersion = null) 00802 { 00803 // Load the feed as an XML DOMDocument object 00804 @ini_set('track_errors', 1); 00805 $doc = new DOMDocument(); 00806 $success = @$doc->loadXML($string); 00807 @ini_restore('track_errors'); 00808 00809 if (!$success) { 00810 require_once 'Zend/Gdata/App/Exception.php'; 00811 throw new Zend_Gdata_App_Exception( 00812 "DOMDocument cannot parse XML: $php_errormsg"); 00813 } 00814 00815 $feed = new $className(); 00816 $feed->setMajorProtocolVersion($majorProtocolVersion); 00817 $feed->setMinorProtocolVersion($minorProtocolVersion); 00818 $feed->transferFromXML($string); 00819 $feed->setHttpClient(self::getstaticHttpClient()); 00820 return $feed; 00821 } 00822 00823 00833 public static function importFile($filename, 00834 $className='Zend_Gdata_App_Feed', $useIncludePath = false) 00835 { 00836 @ini_set('track_errors', 1); 00837 $feed = @file_get_contents($filename, $useIncludePath); 00838 @ini_restore('track_errors'); 00839 if ($feed === false) { 00840 require_once 'Zend/Gdata/App/Exception.php'; 00841 throw new Zend_Gdata_App_Exception( 00842 "File could not be loaded: $php_errormsg"); 00843 } 00844 return self::importString($feed, $className); 00845 } 00846 00856 public function get($uri, $extraHeaders = array()) 00857 { 00858 $requestData = $this->prepareRequest('GET', $uri, $extraHeaders); 00859 return $this->performHttpRequest( 00860 $requestData['method'], $requestData['url'], 00861 $requestData['headers']); 00862 } 00863 00878 public function post($data, $uri = null, $remainingRedirects = null, 00879 $contentType = null, $extraHeaders = null) 00880 { 00881 $requestData = $this->prepareRequest( 00882 'POST', $uri, $extraHeaders, $data, $contentType); 00883 return $this->performHttpRequest( 00884 $requestData['method'], $requestData['url'], 00885 $requestData['headers'], $requestData['data'], 00886 $requestData['contentType']); 00887 } 00888 00903 public function put($data, $uri = null, $remainingRedirects = null, 00904 $contentType = null, $extraHeaders = null) 00905 { 00906 $requestData = $this->prepareRequest( 00907 'PUT', $uri, $extraHeaders, $data, $contentType); 00908 return $this->performHttpRequest( 00909 $requestData['method'], $requestData['url'], 00910 $requestData['headers'], $requestData['data'], 00911 $requestData['contentType']); 00912 } 00913 00923 public function delete($data, $remainingRedirects = null) 00924 { 00925 if (is_string($data)) { 00926 $requestData = $this->prepareRequest('DELETE', $data); 00927 } else { 00928 $headers = array(); 00929 00930 $requestData = $this->prepareRequest( 00931 'DELETE', null, $headers, $data); 00932 } 00933 return $this->performHttpRequest($requestData['method'], 00934 $requestData['url'], 00935 $requestData['headers'], 00936 '', 00937 $requestData['contentType'], 00938 $remainingRedirects); 00939 } 00940 00953 public function insertEntry($data, $uri, $className='Zend_Gdata_App_Entry', 00954 $extraHeaders = array()) 00955 { 00956 $response = $this->post($data, $uri, null, null, $extraHeaders); 00957 00958 $returnEntry = new $className($response->getBody()); 00959 $returnEntry->setHttpClient(self::getstaticHttpClient()); 00960 00961 $etag = $response->getHeader('ETag'); 00962 if ($etag !== null) { 00963 $returnEntry->setEtag($etag); 00964 } 00965 00966 return $returnEntry; 00967 } 00968 00983 public function updateEntry($data, $uri = null, $className = null, 00984 $extraHeaders = array()) 00985 { 00986 if ($className === null && $data instanceof Zend_Gdata_App_Entry) { 00987 $className = get_class($data); 00988 } elseif ($className === null) { 00989 $className = 'Zend_Gdata_App_Entry'; 00990 } 00991 00992 $response = $this->put($data, $uri, null, null, $extraHeaders); 00993 $returnEntry = new $className($response->getBody()); 00994 $returnEntry->setHttpClient(self::getstaticHttpClient()); 00995 00996 $etag = $response->getHeader('ETag'); 00997 if ($etag !== null) { 00998 $returnEntry->setEtag($etag); 00999 } 01000 01001 return $returnEntry; 01002 } 01003 01017 public function __call($method, $args) 01018 { 01019 if (preg_match('/^new(\w+)/', $method, $matches)) { 01020 $class = $matches[1]; 01021 $foundClassName = null; 01022 foreach ($this->_registeredPackages as $name) { 01023 try { 01024 // Autoloading disabled on next line for compatibility 01025 // with magic factories. See ZF-6660. 01026 if (!class_exists($name . '_' . $class, false)) { 01027 require_once 'Zend/Loader.php'; 01028 @Zend_Loader::loadClass($name . '_' . $class); 01029 } 01030 $foundClassName = $name . '_' . $class; 01031 break; 01032 } catch (Zend_Exception $e) { 01033 // package wasn't here- continue searching 01034 } 01035 } 01036 if ($foundClassName != null) { 01037 $reflectionObj = new ReflectionClass($foundClassName); 01038 $instance = $reflectionObj->newInstanceArgs($args); 01039 if ($instance instanceof Zend_Gdata_App_FeedEntryParent) { 01040 $instance->setHttpClient($this->_httpClient); 01041 01042 // Propogate version data 01043 $instance->setMajorProtocolVersion( 01044 $this->_majorProtocolVersion); 01045 $instance->setMinorProtocolVersion( 01046 $this->_minorProtocolVersion); 01047 } 01048 return $instance; 01049 } else { 01050 require_once 'Zend/Gdata/App/Exception.php'; 01051 throw new Zend_Gdata_App_Exception( 01052 "Unable to find '${class}' in registered packages"); 01053 } 01054 } else { 01055 require_once 'Zend/Gdata/App/Exception.php'; 01056 throw new Zend_Gdata_App_Exception("No such method ${method}"); 01057 } 01058 } 01059 01070 public function retrieveAllEntriesForFeed($feed) { 01071 $feedClass = get_class($feed); 01072 $reflectionObj = new ReflectionClass($feedClass); 01073 $result = $reflectionObj->newInstance(); 01074 do { 01075 foreach ($feed as $entry) { 01076 $result->addEntry($entry); 01077 } 01078 01079 $next = $feed->getLink('next'); 01080 if ($next !== null) { 01081 $feed = $this->getFeed($next->href, $feedClass); 01082 } else { 01083 $feed = null; 01084 } 01085 } 01086 while ($feed != null); 01087 return $result; 01088 } 01089 01098 public function enableRequestDebugLogging($logfile) 01099 { 01100 $this->_httpClient->setConfig(array( 01101 'adapter' => 'Zend_Gdata_App_LoggingHttpClientAdapterSocket', 01102 'logfile' => $logfile 01103 )); 01104 } 01105 01118 public function getNextFeed($feed, $className = null) 01119 { 01120 $nextLink = $feed->getNextLink(); 01121 if (!$nextLink) { 01122 return null; 01123 } 01124 $nextLinkHref = $nextLink->getHref(); 01125 01126 if ($className === null) { 01127 $className = get_class($feed); 01128 } 01129 01130 return $this->getFeed($nextLinkHref, $className); 01131 } 01132 01145 public function getPreviousFeed($feed, $className = null) 01146 { 01147 $previousLink = $feed->getPreviousLink(); 01148 if (!$previousLink) { 01149 return null; 01150 } 01151 $previousLinkHref = $previousLink->getHref(); 01152 01153 if ($className === null) { 01154 $className = get_class($feed); 01155 } 01156 01157 return $this->getFeed($previousLinkHref, $className); 01158 } 01159 01169 public function generateIfMatchHeaderData($data, $allowWeek) 01170 { 01171 $result = ''; 01172 // Set an If-Match header if an ETag has been set (version >= 2 only) 01173 if ($this->_majorProtocolVersion >= 2 && 01174 $data instanceof Zend_Gdata_App_Entry) { 01175 $etag = $data->getEtag(); 01176 if (($etag !== null) && 01177 ($allowWeek || substr($etag, 0, 2) != 'W/')) { 01178 $result = $data->getEtag(); 01179 } 01180 } 01181 return $result; 01182 } 01183 01190 public function usingObjectMapping() 01191 { 01192 return $this->_useObjectMapping; 01193 } 01194 01202 public function useObjectMapping($value) 01203 { 01204 if ($value === True) { 01205 $this->_useObjectMapping = true; 01206 } else { 01207 $this->_useObjectMapping = false; 01208 } 01209 } 01210 01211 }