当前位置: 首页>>代码示例>>PHP>>正文


PHP Zend_Gdata_App类代码示例

本文整理汇总了PHP中Zend_Gdata_App的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Gdata_App类的具体用法?PHP Zend_Gdata_App怎么用?PHP Zend_Gdata_App使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Zend_Gdata_App类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: save

 public function save($dryRun = false, $uri = null, $className = null, $extraHeaders = array())
 {
     if ($dryRun == true) {
         $editLink = $this->getEditLink();
         if ($uri == null && $editLink !== null) {
             $uri = $editLink->getHref() . '?dry-run=true';
         }
         if ($uri === null) {
             require_once 'Zend/Gdata/App/InvalidArgumentException.php';
             throw new Zend_Gdata_App_InvalidArgumentException('You must specify an URI which needs deleted.');
         }
         $service = new Zend_Gdata_App($this->getHttpClient());
         return $service->updateEntry($this, $uri, $className, $extraHeaders);
     } else {
         parent::save($uri, $className, $extraHeaders);
     }
 }
开发者ID:hackingman,项目名称:TubeX,代码行数:17,代码来源:ItemEntry.php

示例2: testNormalAuthorShouldHaveNoExtensionElements

 public function testNormalAuthorShouldHaveNoExtensionElements()
 {
     $this->author->name = new Zend_Gdata_App_Extension_Name('Jeff Scudder');
     $this->assertEquals($this->author->name->text, 'Jeff Scudder');
     $this->assertEquals(count($this->author->extensionElements), 0);
     $newAuthor = new Zend_Gdata_App_Extension_Author();
     $newAuthor->transferFromXML($this->author->saveXML());
     $this->assertEquals(count($newAuthor->extensionElements), 0);
     $newAuthor->extensionElements = array(new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
     $this->assertEquals(count($newAuthor->extensionElements), 1);
     $this->assertEquals($newAuthor->name->text, 'Jeff Scudder');
     /* try constructing using magic factory */
     $app = new Zend_Gdata_App();
     $newAuthor2 = $app->newAuthor();
     $newAuthor2->transferFromXML($newAuthor->saveXML());
     $this->assertEquals(count($newAuthor2->extensionElements), 1);
     $this->assertEquals($newAuthor2->name->text, 'Jeff Scudder');
 }
开发者ID:crodriguezn,项目名称:crossfit-milagro,代码行数:18,代码来源:AuthorTest.php

示例3: testNormalCategoryShouldHaveNoExtensionElements

 public function testNormalCategoryShouldHaveNoExtensionElements()
 {
     $this->category->scheme = 'http://schemas.google.com/g/2005#kind';
     $this->assertEquals($this->category->scheme, 'http://schemas.google.com/g/2005#kind');
     $this->assertEquals(count($this->category->extensionElements), 0);
     $newCategory = new Zend_Gdata_App_Extension_Category();
     $newCategory->transferFromXML($this->category->saveXML());
     $this->assertEquals(0, count($newCategory->extensionElements));
     $newCategory->extensionElements = array(new Zend_Gdata_App_Extension_Element('foo', 'atom', null, 'bar'));
     $this->assertEquals(count($newCategory->extensionElements), 1);
     $this->assertEquals($newCategory->scheme, 'http://schemas.google.com/g/2005#kind');
     /* try constructing using magic factory */
     $app = new Zend_Gdata_App();
     $newCategory2 = $app->newCategory();
     $newCategory2->transferFromXML($newCategory->saveXML());
     $this->assertEquals(count($newCategory2->extensionElements), 1);
     $this->assertEquals($newCategory2->scheme, 'http://schemas.google.com/g/2005#kind');
 }
开发者ID:omusico,项目名称:logica,代码行数:18,代码来源:CategoryTest.php

示例4: import

 /**
  * Imports a feed located at $uri.
  *
  * @param  string $uri
  * @param  Zend_Http_Client $client The client used for communication
  * @param  string $className The class which is used as the return type
  * @throws Zend_Gdata_App_Exception
  * @return string|Zend_Gdata_App_Feed Returns string only if the object
  *                                    mapping has been disabled explicitly
  *                                    by passing false to the
  *                                    useObjectMapping() function.
  */
 public static function import($uri, $client = null, $className = 'Zend_Gdata_App_Feed')
 {
     $app = new Zend_Gdata_App($client);
     $requestData = $app->prepareRequest('GET', $uri);
     $response = $app->performHttpRequest($requestData['method'], $requestData['url']);
     $feedContent = $response->getBody();
     if (!$this->_useObjectMapping) {
         return $feedContent;
     }
     $feed = self::importString($feedContent, $className);
     if ($client != null) {
         $feed->setHttpClient($client);
     }
     return $feed;
 }
开发者ID:bizanto,项目名称:Hooked,代码行数:27,代码来源:App.php

示例5: getPreviousFeed

   /**
     * Retrieve the previous set of results from this feed.
     *
     * @throws Zend_Gdata_App_Exception
     * @return mixed|null Returns the previous set of results as a feed of
     *          the same class as this feed, or null if no results exist.
     */
    public function getPreviousFeed()
    {
        $previousLink = $this->getPreviousLink();
        if (!$previousLink) {
            require_once 'Zend/Gdata/App/HttpException.php';
            throw new Zend_Gdata_App_Exception('No link to previous set ' .
            'of results found.');
        }
        $previousLinkHref = $previousLink->getHref();
        $service = new Zend_Gdata_App($this->getHttpClient());

        return $service->getFeed($previousLinkHref, get_class($this));
    }
开发者ID:nhp,项目名称:shopware-4,代码行数:20,代码来源:Feed.php

示例6: delete

 /**
  * Deletes this entry to the server using the referenced
  * Zend_Http_Client to do a HTTP DELETE to the edit link stored in this
  * entry's link collection.
  *
  * @return void
  * @throws Zend_Gdata_App_Exception
  */
 public function delete()
 {
     $service = new Zend_Gdata_App($this->getHttpClient());
     $service->delete($this);
 }
开发者ID:omusico,项目名称:sugar_work,代码行数:13,代码来源:Entry.php

示例7: getEntry

 /**
  * Retreive entry object
  *
  * @param mixed $location The location as string or Zend_Gdata_Query
  * @return Zend_Gdata_Feed
  */
 public function getEntry($location, $className = 'Zend_Gdata_Entry')
 {
     if (is_string($location)) {
         $uri = $location;
     } elseif ($location instanceof Zend_Gdata_Query) {
         $uri = $location->getQueryUrl();
     } else {
         require_once 'Zend/Gdata/App/InvalidArgumentException.php';
         throw new Zend_Gdata_App_InvalidArgumentException('You must specify the location as either a string URI ' . 'or a child of Zend_Gdata_Query');
     }
     return parent::getEntry($uri, $className);
 }
开发者ID:dalinhuang,项目名称:popo,代码行数:18,代码来源:Gdata.php

示例8: testStaticImportWithoutUsingObjectMapping

 /**
  * @group ZF-10243
  */
 public function testStaticImportWithoutUsingObjectMapping()
 {
     $this->adapter->setResponse($this->httpEntrySample);
     $feed = Zend_Gdata_App::import('http://www.example.com', $this->client, 'Zend_Gdata_App_Feed', false);
     $this->assertContains('<id>12345678901234567890</id>', $feed);
 }
开发者ID:JeancarloPerez,项目名称:booking-system,代码行数:9,代码来源:AppTest.php

示例9: delete

 /**
  * DELETE entry with client object
  *
  * @param mixed $data The Zend_Gdata_App_Entry or URL to delete
  * @return void
  * @throws Zend_Gdata_App_Exception
  * @throws Zend_Gdata_App_HttpException
  * @throws Zend_Gdata_App_InvalidArgumentException
  */
 public function delete($data, $remainingRedirects = null)
 {
     require_once 'Zend/Http/Client/Exception.php';
     if ($remainingRedirects === null) {
         $remainingRedirects = self::getMaxRedirects();
     }
     if (is_string($data)) {
         $uri = $data;
     } elseif ($data instanceof Zend_Gdata_App_Entry) {
         $editLink = $data->getEditLink();
         if ($editLink != null) {
             $uri = $editLink->getHref();
         }
     } else {
         require_once 'Zend/Gdata/App/InvalidArgumentException.php';
         throw new Zend_Gdata_App_InvalidArgumentException('You must specify the data to post as either a string or a child of Zend_Gdata_App_Entry');
     }
     if ($uri === null) {
         require_once 'Zend/Gdata/App/InvalidArgumentException.php';
         throw new Zend_Gdata_App_InvalidArgumentException('You must specify an URI which needs deleted.');
     }
     $this->_httpClient->resetParameters();
     $this->_httpClient->setHeaders('x-http-method-override', null);
     $this->_httpClient->setUri($uri);
     $this->_httpClient->setConfig(array('maxredirects' => 0));
     try {
         if (Zend_Gdata_App::getHttpMethodOverride()) {
             $this->_httpClient->setHeaders(array('X-HTTP-Method-Override: DELETE'));
             $this->_httpClient->setRawData('');
             $response = $this->_httpClient->request('POST');
         } else {
             $response = $this->_httpClient->request('DELETE');
         }
     } catch (Zend_Http_Client_Exception $e) {
         require_once 'Zend/Gdata/App/HttpException.php';
         throw new Zend_Gdata_App_HttpException($e->getMessage(), $e);
     }
     if ($response->isRedirect()) {
         if ($remainingRedirects > 0) {
             $newUri = $response->getHeader('Location');
             $response = $this->delete($newUri, $remainingRedirects - 1);
         } else {
             require_once 'Zend/Gdata/App/HttpException.php';
             throw new Zend_Gdata_App_HttpException('No more redirects allowed', null, $response);
         }
     }
     if (!$response->isSuccessful()) {
         require_once 'Zend/Gdata/App/HttpException.php';
         $exception = new Zend_Gdata_App_HttpException('Expected response code 200, got ' . $response->getStatus());
         $exception->setResponse($response);
         throw $exception;
     }
     return $response;
 }
开发者ID:dalinhuang,项目名称:popo,代码行数:63,代码来源:App.php

示例10: testSetAndGetHttpMethodOverride

 public function testSetAndGetHttpMethodOverride()
 {
     Zend_Gdata_App::setHttpMethodOverride(true);
     $this->assertEquals(true, Zend_Gdata_App::getHttpMethodOverride());
 }
开发者ID:omusico,项目名称:logica,代码行数:5,代码来源:AppTest.php

示例11: performHttpRequest

 /**
  * Performs a HTTP request using the specified method.
  * 
  * Overrides the definition in the parent (Zend_Gdata_App)
  * and uses the Zend_Gdata_HttpClient functionality
  * to filter the HTTP requests and responses.
  *  
  * @param string $method The HTTP method for the request -
  *                       'GET', 'POST', 'PUT', 'DELETE'
  * @param string $url The URL to which this request is being performed,
  *                    or null if found in $data
  * @param array $headers An associative array of HTTP headers
  *                       for this request
  * @param string $body The body of the HTTP request
  * @param string $contentType The value for the content type of the
  *                            request body
  * @param int $remainingRedirects Number of redirects to follow
  *                                if requests results in one
  * @return Zend_Http_Response The response object
  */
 public function performHttpRequest($method, $url, $headers = array(), $body = null, $contentType = null, $remainingRedirects = null)
 {
     if ($this->_httpClient instanceof Zend_Gdata_HttpClient) {
         $filterResult = $this->_httpClient->filterHttpRequest($method, $url, $headers, $body, $contentType);
         $method = $filterResult['method'];
         $url = $filterResult['url'];
         $body = $filterResult['body'];
         $headers = $filterResult['headers'];
         $contentType = $filterResult['contentType'];
         return $this->_httpClient->filterHttpResponse(parent::performHttpRequest($method, $url, $headers, $body, $contentType, $remainingRedirects));
     } else {
         return parent::performHttpRequest($method, $url, $headers, $body, $contentType, $remainingRedirects);
     }
 }
开发者ID:janssit,项目名称:www.alu-andries.be,代码行数:34,代码来源:Gdata.php

示例12: delete

 /**
  * Deletes this entry to the server using the referenced 
  * Zend_Http_Client to do a HTTP DELETE to the edit link stored in this 
  * entry's link collection.  
  *
  * @return boolean The success of the delete operation
  * @throws Zend_Gdata_App_Exception
  */
 public function delete()
 {
     if ($this->id) {
         // If id is set, look for link rel="edit" in the
         // entry object and DELETE.
         $editLink = $this->getLink('edit');
         $editUri = $editLink->href;
         if (!$editUri) {
             throw new Zend_Gdata_App_Exception('Cannot delete entry; no link rel="edit" is present.');
         }
         $client = $this->getHttpClient();
         if (is_null($client)) {
             $client = Zend_Gdata_App::getStaticHttpClient();
         }
         $client->resetParameters();
         $client->setUri($editUri);
         $client->setHeaders('Content-Type', null);
         $client->setRawData('');
         if (Zend_Gdata_App::getHttpMethodOverride()) {
             $client->setHeaders('X-HTTP-Method-Override', 'DELETE');
             $response = $client->request('DELETE');
         } else {
             $response = $client->request('DELETE');
         }
         if ($response->getStatus() !== 200) {
             require_once 'Zend/Gdata/App/HttpException.php';
             $exception = new Zend_Gdata_App_HttpException('Expected response code 200, got ' . $response->getStatus());
             $exception->setResponse($response);
             throw $exception;
         }
         return true;
     } else {
         throw new Zend_Gdata_App_Exception('Cannot edit entry; no id is present');
     }
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:43,代码来源:Entry.php

示例13: isAuthenticated

 public function isAuthenticated()
 {
     $client = parent::getHttpClient();
     if ($client->getClientLoginToken() || $client->getAuthSubToken()) {
         return true;
     }
     return false;
 }
开发者ID:hackingman,项目名称:TubeX,代码行数:8,代码来源:Gdata.php

示例14: setHttpMethodOverride

 /**
  * Toggle using POST instead of PUT and DELETE HTTP methods
  *
  * Some feed implementations do not accept PUT and DELETE HTTP
  * methods, or they can't be used because of proxies or other
  * measures. This allows turning on using POST where PUT and
  * DELETE would normally be used; in addition, an
  * X-Method-Override header will be sent with a value of PUT or
  * DELETE as appropriate.
  *
  * @param  boolean $override Whether to override PUT and DELETE with POST.
  * @return void
  */
 public static function setHttpMethodOverride($override = true)
 {
     self::$_httpMethodOverride = $override;
 }
开发者ID:jorgenils,项目名称:zend-framework,代码行数:17,代码来源:App.php


注:本文中的Zend_Gdata_App类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。