/** * 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\\Feed') { $app = new GData($client); $requestData = $app->decodeRequest('GET', $uri); $response = $app->performHttpRequest($requestData['method'], $requestData['url']); $feedContent = $response->getBody(); $feed = self::importString($feedContent, $className); if ($client != null) { $feed->setHttpClient($client); } return $feed; }
/** * Create Zend_Gdata_Geo object * * @param \Zend\Http\Client $client (optional) The HTTP client to use when * when communicating with the Google Apps servers. * @param string $applicationId The identity of the app in the form of Company-AppName-Version */ public function __construct($client = null, $applicationId = 'MyCompany-MyApp-1.0') { $this->registerPackage('Zend\GData\Geo'); $this->registerPackage('Zend\GData\Geo\Extension'); parent::__construct($client, $applicationId); }
/** * Provides a magic factory method to instantiate new objects with * shorter syntax than would otherwise be required by the Zend Framework * naming conventions. For more information, see App::__call(). * * This overrides the default behavior of __call() so that query classes * do not need to have their domain manually set when created with * a magic factory method. * * @see App::__call() * @param string $method The method name being called * @param array $args The arguments passed to the call * @throws App\Exception */ public function __call($method, $args) { if (preg_match('/^new(\\w+Query)/', $method, $matches)) { $class = $matches[1]; $foundClassName = null; foreach ($this->_registeredPackages as $name) { try { // Autoloading disabled on next line for compatibility // with magic factories. See ZF-6660. if (class_exists($name . '\\' . $class)) { $foundClassName = $name . '\\' . $class; break; } } catch (\Exception $e) { // package wasn't here- continue searching } } if ($foundClassName != null) { $reflectionObj = new \ReflectionClass($foundClassName); // Prepend the domain to the query $args = array_merge(array($this->getDomain()), $args); return $reflectionObj->newInstanceArgs($args); } else { throw new App\Exception("Unable to find '{$class}' in registered packages"); } } else { return parent::__call($method, $args); } }
/** * Retreive entryobject * * @return \ZendGData\Calendar\ListEntry */ public function getCalendarListEntry($location = null) { if ($location == null) { throw new App\InvalidArgumentException('Location must not be null'); } elseif ($location instanceof Query) { $uri = $location->getQueryUrl(); } else { $uri = $location; } return parent::getEntry($uri, 'ZendGData\\Calendar\\ListEntry'); }
/** * Insert a Volume / Annotation * * @param \Zend\GData\Books\VolumeEntry $entry * @param \Zend\GData\Query|string|null $location (optional) The URL to * query * @return \Zend\GData\Books\VolumeEntry The inserted volume entry. */ public function insertVolume($entry, $location = null) { if ($location == null) { $uri = self::MY_LIBRARY_FEED_URI; } else { $uri = $location; } return parent::insertEntry($entry, $uri, 'Zend\\GData\\Books\\VolumeEntry'); }
/** * Retreive a single CommentEntry object. * * @param mixed $location The location for the feed, as a URL or Query. * @return \ZendGData\Photos\CommentEntry * @throws \ZendGData\App\Exception * @throws \ZendGData\App\HttpException */ public function getCommentEntry($location) { if ($location === null) { throw new App\InvalidArgumentException('Location must not be null'); } elseif ($location instanceof Photos\UserQuery) { $location->setType('entry'); $uri = $location->getQueryUrl(); } elseif ($location instanceof Query) { $uri = $location->getQueryUrl(); } else { $uri = $location; } return parent::getEntry($uri, 'ZendGData\\Photos\\CommentEntry'); }
/** * Gets a list entry. * * @param string $location A ListQuery or a URI specifying the entry location. * @return ListEntry */ public function getListEntry($location) { if ($location instanceof Spreadsheets\ListQuery) { $uri = $location->getQueryUrl(); } else { $uri = $location; } return parent::getEntry($uri, 'Zend\\GData\\Spreadsheets\\ListEntry'); }
/** * Retrieve feed object * * @param mixed $location The location for the feed, as a URL or Query * @return \Zend\GData\GBase\SnippetFeed */ public function getGBaseSnippetFeed($location = null) { if ($location === null) { $uri = self::GBASE_SNIPPET_FEED_URI; } else if ($location instanceof Query) { $uri = $location->getQueryUrl(); } else { $uri = $location; } return parent::getFeed($uri, 'Zend\GData\GBase\SnippetFeed'); }
/** * Retrieve a profile entry object * * @param mixed $query The query for the feed, as a URL or Query * @return \Zend\GData\Health\ProfileEntry */ public function getHealthProfileEntry($query = null) { if ($query === null) { throw new App\InvalidArgumentException('Query must not be null'); } else { if ($query instanceof Query) { $uri = $query->getQueryUrl(); } else { $uri = $query; } } return parent::getEntry($uri, 'Zend\\GData\\Health\\ProfileEntry'); }