Source for file data.php
Documentation is available at data.php
* @package Joomla.Platform
* @copyright Copyright (C) 2005 - 2013 Open Source Matters, Inc. All rights reserved
* @license GNU General Public License version 2 or later; see LICENSE
* Google API data class for the Joomla Platform.
* @package Joomla.Platform
* @var JRegistry Options for the Google data object.
* @var JGoogleAuth Authentication client for the Google data object.
* @param JRegistry $options Google options object.
* @param JGoogleAuth $auth Google data http client object.
public function __construct(JRegistry $options =
null, JGoogleAuth $auth =
null)
* Method to authenticate to Google
* @return boolean True on success.
* @return boolean True if authenticated.
* @param string $data XML data to be parsed
* @return SimpleXMLElement XMLElement of parsed data
* @throws UnexpectedValueException
protected static function safeXML($data)
return new SimpleXMLElement($data, LIBXML_NOWARNING |
LIBXML_NOERROR);
throw
new UnexpectedValueException("Unexpected data received from Google: `$data`.");
* Method to retrieve a list of data
* @param array $url URL to GET
* @param int $maxpages Maximum number of pages to return
* @param string $token Next page token
* @return mixed Data from Google
* @throws UnexpectedValueException
protected function listGetData($url, $maxpages =
1, $token =
null)
if (strpos($url, '&') && isset
($token))
$qurl .=
'&pageToken=' .
$token;
$qurl .=
'pageToken=' .
$token;
$jdata =
$this->query($qurl);
$data['items'] =
array_merge($data['items'], $this->listGetData($url, $maxpages -
1, $data['nextPageToken']));
throw
new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.
");
* Method to retrieve data from Google
* @param string $url The URL for the request.
* @param mixed $data The data to include in the request.
* @param array $headers The headers to send with the request.
* @param string $method The type of http request to send.
* @return mixed Data from Google.
protected function query($url, $data =
null, $headers =
null, $method =
'get')
return $this->auth->query($url, $data, $headers, $method);
* Get an option from the JGoogleData instance.
* @param string $key The name of the option to get.
* @return mixed The option value.
* Set an option for the JGoogleData instance.
* @param string $key The name of the option to set.
* @param mixed $value The option value to set.
* @return JGoogleData This object for method chaining.
Documentation generated on Tue, 19 Nov 2013 14:57:46 +0100 by phpDocumentor 1.4.3