Ver código fonte

Zend_Gdata
--------
[ZF-9353] Loads required classes
[ZF-9352] Sets HTTP query params based on URL



git-svn-id: http://framework.zend.com/svn/framework/standard/trunk@21361 44c647ce-9c0f-0410-b52a-842ac1e357ba

rboyd 16 anos atrás
pai
commit
f1ae2267c9
1 arquivos alterados com 24 adições e 1 exclusões
  1. 24 1
      library/Zend/Gdata/App.php

+ 24 - 1
library/Zend/Gdata/App.php

@@ -640,7 +640,15 @@ class Zend_Gdata_App
 
         // Set the params for the new request to be performed
         $this->_httpClient->setHeaders($headers);
-        $this->_httpClient->setUri($url);
+        $uri = Zend_Uri_Http::fromString($url);
+        preg_match("/^(.*?)(\?.*)?$/", $url, $matches);
+        $this->_httpClient->setUri($matches[1]);
+        $queryArray = $uri->getQueryAsArray();
+        foreach ($queryArray as $name => $value) { 
+          $this->_httpClient->setParameterGet($name, $value);
+        }
+
+
         $this->_httpClient->setConfig(array('maxredirects' => 0));
 
         // Set the proper adapter if we are handling a streaming upload
@@ -800,6 +808,11 @@ class Zend_Gdata_App
         $className='Zend_Gdata_App_Feed', $majorProtocolVersion = null,
         $minorProtocolVersion = null)
     {
+        if (!class_exists($className, false)) {
+          require_once 'Zend/Loader.php';
+          @Zend_Loader::loadClass($className);
+        }
+
         // Load the feed as an XML DOMDocument object
         @ini_set('track_errors', 1);
         $doc = new DOMDocument();
@@ -953,6 +966,11 @@ class Zend_Gdata_App
     public function insertEntry($data, $uri, $className='Zend_Gdata_App_Entry',
         $extraHeaders = array())
     {
+        if (!class_exists($className, false)) {
+          require_once 'Zend/Loader.php';
+          @Zend_Loader::loadClass($className);
+        }
+
         $response = $this->post($data, $uri, null, null, $extraHeaders);
 
         $returnEntry = new $className($response->getBody());
@@ -989,6 +1007,11 @@ class Zend_Gdata_App
             $className = 'Zend_Gdata_App_Entry';
         }
 
+        if (!class_exists($className, false)) {
+          require_once 'Zend/Loader.php';
+          @Zend_Loader::loadClass($className);
+        }
+
         $response = $this->put($data, $uri, null, null, $extraHeaders);
         $returnEntry = new $className($response->getBody());
         $returnEntry->setHttpClient(self::getstaticHttpClient());