| Current Path : /home/w/u/e/wuectly/www/03cbe/ |
| Current File : /home/w/u/e/wuectly/www/03cbe/google.zip |
PK t!]K�,K� � embed.phpnu &1i� <?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google API object class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
abstract class JGoogleEmbed
{
/**
* @var Registry Options for the Google data object.
* @since 3.1.4
*/
protected $options;
/**
* @var JUri URI of the page being rendered.
* @since 3.1.4
*/
protected $uri;
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JUri $uri URL of the page being rendered
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JUri $uri = null)
{
$this->options = $options ? $options : new Registry;
$this->uri = $uri ? $uri : JUri::getInstance();
}
/**
* Method to retrieve the javascript header for the embed API
*
* @return string The header
*
* @since 3.1.4
*/
public function isSecure()
{
return $this->uri->getScheme() == 'https';
}
/**
* Method to retrieve the header for the API
*
* @return string The header
*
* @since 3.1.4
*/
abstract public function getHeader();
/**
* Method to retrieve the body for the API
*
* @return string The body
*
* @since 3.1.4
*/
abstract public function getBody();
/**
* Method to output the javascript header for the embed API
*
* @return null
*
* @since 3.1.4
*/
public function echoHeader()
{
echo $this->getHeader();
}
/**
* Method to output the body for the API
*
* @return null
*
* @since 3.1.4
*/
public function echoBody()
{
echo $this->getBody();
}
/**
* Get an option from the JGoogleEmbed instance.
*
* @param string $key The name of the option to get.
*
* @return mixed The option value.
*
* @since 3.1.4
*/
public function getOption($key)
{
return $this->options->get($key);
}
/**
* Set an option for the JGoogleEmbed instance.
*
* @param string $key The name of the option to set.
* @param mixed $value The option value to set.
*
* @return JGoogleEmbed This object for method chaining.
*
* @since 3.1.4
*/
public function setOption($key, $value)
{
$this->options->set($key, $value);
return $this;
}
}
PK t!]��ͽ�= �= data/calendar.phpnu &1i� <?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google Calendar data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataCalendar extends JGoogleData
{
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth = null)
{
parent::__construct($options, $auth);
if (isset($this->auth) && !$this->auth->getOption('scope'))
{
$this->auth->setOption('scope', 'https://www.googleapis.com/auth/calendar');
}
}
/**
* Method to remove a calendar from a user's calendar list
*
* @param string $calendarID ID of calendar to delete
*
* @return boolean Success or failure
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function removeCalendar($calendarID)
{
if ($this->isAuthenticated())
{
$jdata = $this->query('https://www.googleapis.com/calendar/v3/users/me/calendarList/' . urlencode($calendarID), null, null, 'delete');
if ($jdata->body != '')
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
return true;
}
else
{
return false;
}
}
/**
* Method to get a calendar's settings from Google
*
* @param string $calendarID ID of calendar to get.
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function getCalendar($calendarID)
{
if ($this->isAuthenticated())
{
$jdata = $this->query('https://www.googleapis.com/calendar/v3/users/me/calendarList/' . urlencode($calendarID));
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to add a calendar to a user's Google Calendar list
*
* @param string $calendarID New calendar ID
* @param array $options New calendar settings
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function addCalendar($calendarID, $options = array())
{
if ($this->isAuthenticated())
{
$options['id'] = $calendarID;
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList';
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to retrieve calendar list from Google
*
* @param array $options Search settings
* @param int $maxpages Maximum number of pages of calendars to return
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listCalendars($options = array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to edit a Google Calendar's settings
*
* @param string $calendarID Calendar ID
* @param array $options Calendar settings
*
* @return mixed Data from Google
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function editCalendarSettings($calendarID, $options)
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList/' . urlencode($calendarID);
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'put');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to clear a Google Calendar
*
* @param string $calendarID ID of calendar to clear
*
* @return boolean Success or failure
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function clearCalendar($calendarID)
{
if ($this->isAuthenticated())
{
$data = $this->query('https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode($calendarID) . '/clear', null, null, 'post');
if ($data->body != '')
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$data->body}`.");
}
return true;
}
else
{
return false;
}
}
/**
* Method to delete a calendar from Google
*
* @param string $calendarID ID of calendar to delete.
*
* @return boolean Success or failure
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function deleteCalendar($calendarID)
{
if ($this->isAuthenticated())
{
$data = $this->query('https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode($calendarID), null, null, 'delete');
if ($data->body != '')
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$data->body}`.");
}
return true;
}
else
{
return false;
}
}
/**
* Method to create a Google Calendar
*
* @param string $title New calendar title
* @param array $options New calendar settings
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function createCalendar($title, $options = array())
{
if ($this->isAuthenticated())
{
$options['summary'] = $title;
$url = 'https://www.googleapis.com/calendar/v3/calendars';
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to edit a Google Calendar
*
* @param string $calendarID Calendar ID.
* @param array $options Calendar settings.
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function editCalendar($calendarID, $options)
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode($calendarID);
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'put');
$data = json_decode($jdata->body, true);
if ($data && array_key_exists('items', $data))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to delete an event from a Google Calendar
*
* @param string $calendarID ID of calendar to delete from
* @param string $eventID ID of event to delete.
*
* @return boolean Success or failure.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function deleteEvent($calendarID, $eventID)
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode($calendarID) . '/events/' . urlencode($eventID);
$data = $this->query($url, null, null, 'delete');
if ($data->body != '')
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$data->body}`.");
}
return true;
}
else
{
return false;
}
}
/**
* Method to get an event from a Google Calendar
*
* @param string $calendarID ID of calendar
* @param string $eventID ID of event to get
* @param array $options Options to send to Google
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function getEvent($calendarID, $eventID, $options = array())
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendarList/';
$url .= urlencode($calendarID) . '/events/' . urlencode($eventID) . '?' . http_build_query($options);
$jdata = $this->query($url);
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to create a Google Calendar event
*
* @param string $calendarID ID of calendar
* @param mixed $start Event start time
* @param mixed $end Event end time
* @param array $options New event settings
* @param mixed $timezone Timezone for event
* @param boolean $allday Treat event as an all-day event
* @param boolean $notify Notify participants
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws InvalidArgumentException
* @throws UnexpectedValueException
*/
public function createEvent($calendarID, $start, $end = false, $options = array(), $timezone = false, $allday = false, $notify = false)
{
if ($this->isAuthenticated())
{
if (!$start)
{
$startobj = new DateTime;
}
elseif (is_int($start))
{
$startobj = new DateTime;
$startobj->setTimestamp($start);
}
elseif (is_string($start))
{
$startobj = new DateTime($start);
}
elseif (is_a($start, 'DateTime'))
{
$startobj = $start;
}
else
{
throw new InvalidArgumentException('Invalid event start time.');
}
if (!$end)
{
$endobj = $startobj;
}
elseif (is_int($end))
{
$endobj = new DateTime;
$endobj->setTimestamp($end);
}
elseif (is_string($end))
{
$endobj = new DateTime($end);
}
elseif (is_a($end, 'DateTime'))
{
$endobj = $end;
}
else
{
throw new InvalidArgumentException('Invalid event end time.');
}
if ($allday)
{
$options['start'] = array('date' => $startobj->format('Y-m-d'));
$options['end'] = array('date' => $endobj->format('Y-m-d'));
}
else
{
$options['start'] = array('dateTime' => $startobj->format(DateTime::RFC3339));
$options['end'] = array('dateTime' => $endobj->format(DateTime::RFC3339));
}
if ($timezone === true)
{
$options['start']['timeZone'] = $startobj->getTimezone()->getName();
$options['end']['timeZone'] = $endobj->getTimezone()->getName();
}
elseif (is_a($timezone, 'DateTimeZone'))
{
$options['start']['timeZone'] = $timezone->getName();
$options['end']['timeZone'] = $timezone->getName();
}
elseif (is_string($timezone))
{
$options['start']['timeZone'] = $timezone;
$options['end']['timeZone'] = $timezone;
}
$url = 'https://www.googleapis.com/calendar/v3/calendars/' . urlencode($calendarID) . '/events' . ($notify ? '?sendNotifications=true' : '');
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to retrieve a list of events on a Google calendar
*
* @param string $calendarID Calendar ID
* @param string $eventID ID of the event to change
* @param array $options Search settings
* @param int $maxpages Minimum number of events to retrieve (more may be retrieved depending on page size)
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listRecurrences($calendarID, $eventID, $options = array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/calendar/v3/users/me/calendars/' . urlencode($calendarID) . '/events/' . urlencode($eventID) . '/instances';
$url .= '?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to retrieve a list of events on a Google calendar
*
* @param string $calendarID Calendar ID
* @param array $options Calendar settings
* @param int $maxpages Cycle through pages of data to generate a complete list
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function listEvents($calendarID, $options = array(), $maxpages = 1)
{
if ($this->isAuthenticated())
{
$next = array_key_exists('nextPageToken', $options) ? $options['nextPage'] : null;
unset($options['nextPageToken']);
$url = 'https://www.googleapis.com/calendar/v3/calendars/' . urlencode($calendarID) . '/events?' . http_build_query($options);
return $this->listGetData($url, $maxpages, $next);
}
else
{
return false;
}
}
/**
* Method to move an event from one calendar to another
*
* @param string $calendarID Calendar ID
* @param string $eventID ID of the event to change
* @param string $destID Calendar ID
* @param boolean $notify Notify participants of changes
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function moveEvent($calendarID, $eventID, $destID, $notify = false)
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/calendars/' . urlencode($calendarID) . '/events/' . urlencode($eventID) . '/move';
$url .= '?destination=' . $destID . ($notify ? '&sendNotifications=true' : '');
$jdata = $this->query($url, null, null, 'post');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
/**
* Method to edit a Google Calendar event
*
* @param string $calendarID Calendar ID
* @param string $eventID ID of the event to change
* @param array $options Event settings
* @param boolean $notify Notify participants of changes
*
* @return mixed Data from Google.
*
* @since 3.1.4
* @throws UnexpectedValueException
*/
public function editEvent($calendarID, $eventID, $options, $notify = false)
{
if ($this->isAuthenticated())
{
$url = 'https://www.googleapis.com/calendar/v3/calendars/';
$url .= urlencode($calendarID) . '/events/' . urlencode($eventID) . ($notify ? '?sendNotifications=true' : '');
$jdata = $this->query($url, json_encode($options), array('Content-type' => 'application/json'), 'put');
if ($data = json_decode($jdata->body, true))
{
return $data;
}
else
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
}
else
{
return false;
}
}
}
PK t!]��l8� �
data/plus.phpnu &1i� <?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google+ data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataPlus extends JGoogleData
{
/**
* @var JGoogleDataPlusPeople Google+ API object for people.
* @since 3.1.4
*/
protected $people;
/**
* @var JGoogleDataPlusActivities Google+ API object for people.
* @since 3.1.4
*/
protected $activities;
/**
* @var JGoogleDataPlusComments Google+ API object for people.
* @since 3.1.4
*/
protected $comments;
/**
* Constructor.
*
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(Registry $options = null, JGoogleAuth $auth = null)
{
// Setup the default API url if not already set.
$options->def('api.url', 'https://www.googleapis.com/plus/v1/');
parent::__construct($options, $auth);
if (isset($this->auth) && !$this->auth->getOption('scope'))
{
$this->auth->setOption('scope', 'https://www.googleapis.com/auth/plus.me');
}
}
/**
* Magic method to lazily create API objects
*
* @param string $name Name of property to retrieve
*
* @return JGoogleDataPlus Google+ API object (people, activities, comments).
*
* @since 3.1.4
*/
public function __get($name)
{
switch ($name)
{
case 'people':
if ($this->people == null)
{
$this->people = new JGoogleDataPlusPeople($this->options, $this->auth);
}
return $this->people;
case 'activities':
if ($this->activities == null)
{
$this->activities = new JGoogleDataPlusActivities($this->options, $this->auth);
}
return $this->activities;
case 'comments':
if ($this->comments == null)
{
$this->comments = new JGoogleDataPlusComments($this->options, $this->auth);
}
return $this->comments;
}
}
}
PK t!]Lb2� � data/picasa/photo.phpnu &1i� <?php
/**
* @package Joomla.Platform
* @subpackage Google
*
* @copyright (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
* @license GNU General Public License version 2 or later; see LICENSE
*/
defined('JPATH_PLATFORM') or die;
use Joomla\Registry\Registry;
/**
* Google Picasa data class for the Joomla Platform.
*
* @since 3.1.4
* @deprecated 4.0 Use the `joomla/google` package via Composer instead
*/
class JGoogleDataPicasaPhoto extends JGoogleData
{
/**
* @var SimpleXMLElement The photo's XML
* @since 3.1.4
*/
protected $xml;
/**
* Constructor.
*
* @param SimpleXMLElement $xml XML from Google
* @param Registry $options Google options object
* @param JGoogleAuth $auth Google data http client object
*
* @since 3.1.4
*/
public function __construct(SimpleXMLElement $xml, Registry $options = null, JGoogleAuth $auth = null)
{
$this->xml = $xml;
parent::__construct($options, $auth);
if (isset($this->auth) && !$this->auth->getOption('scope'))
{
$this->auth->setOption('scope', 'https://picasaweb.google.com/data/');
}
}
/**
* Method to delete a Picasa photo
*
* @param mixed $match Check for most up to date photo
*
* @return boolean Success or failure.
*
* @since 3.1.4
* @throws Exception
* @throws RuntimeException
* @throws UnexpectedValueException
*/
public function delete($match = '*')
{
if ($this->isAuthenticated())
{
$url = $this->getLink();
if ($match === true)
{
$match = $this->xml->xpath('./@gd:etag');
$match = $match[0];
}
try
{
$jdata = $this->query($url, null, array('GData-Version' => 2, 'If-Match' => $match), 'delete');
}
catch (Exception $e)
{
if (strpos($e->getMessage(), 'Error code 412 received requesting data: Mismatch: etags') === 0)
{
throw new RuntimeException("Etag match failed: `$match`.", $e->getCode(), $e);
}
throw $e;
}
if ($jdata->body != '')
{
throw new UnexpectedValueException("Unexpected data received from Google: `{$jdata->body}`.");
}
$this->xml = null;
return true;
}
else
{
return false;
}
}
/**
* Method to get the photo link
*
* @param string $type Type of link to return
*
* @return string Link or false on failure
*
* @since 3.1.4
*/
public function getLink($type = 'edit')
{
$links = $this->xml->link;
foreach ($links as $link)
{
if ($link->attributes()->rel == $type)
{
return (string) $link->attributes()->href;
}
}
return false;
}
/**
* Method to get the photo's URL
*
* @return string Link
*
* @since 3.1.4
*/
public function getUrl()
{
return (string) $this->xml->children()->content->attributes()->src;
}
/**
* Method to get the photo's thumbnails
*
* @return array An array of thumbnails
*
* @since 3.1.4
*/
public function getThumbnails()
{
$thumbs = array();
foreach ($this->xml->children('media', true)->group->thumbnail as $item)
{
$url = (string) $item->attributes()->url;
$width = (int) $item->attributes()->width;
$height = (int) $item->attributes()->height;
$thumbs[$width] = array('url' => $url, 'w' => $width, 'h' => $height);
}
return $thumbs;
}
/**
* Method to get the title of the photo
*
* @return string Photo title
*
* @since 3.1.4
*/
public function getTitle()
{
return (string) $this->xml->children()->title;
}
/**
* Method to get the summary of the photo
*
* @return string Photo description
*
* @since 3.1.4
*/
public function getSummary()
{
return (string) $this->xml->children()->summary;
}
/**
* Method to get the access level of the photo
*
* @return string Photo access level
*
* @since 3.1.4
*/
public function getAccess()
{
return (string) $this->xml->children('gphoto', true)->access;
}
/**
* Method to get the time of the photo
*
* @return double Photo time
*
* @since 3.1.4
*/
public function getTime()
{
return (double) $this->xml->children('gphoto', true)->timestamp / 1000;
}
/**
* Method to get the size of the photo
*
* @return int Photo size
*
* @since 3.1.4
*/
public function getSize()
{
return (int) $this->xml->children('gphoto', true)->size;
}
/**
* Method to get the height of the photo
*
* @return int Photo height
*
* @since 3.1.4
*/
public function getHeight()
{
return (int) $this->xml->children('gphoto', true)->height;
}
/**
* Method to get the width of the photo
*
* @return int Photo width
*
* @since 3.1.4
*/
public function getWidth()
{
return (int) $this->xml->children('gphoto', true)->width;
}
/**
* Method to set the title of the photo
*
* @param string $title New photo title
*
* @return JGoogleDataPicasaPhoto The object for method chaining
*
* @since 3.1.4
*/
public function setTitle($title)
{
$this->xml->children()->title = $title;
return $this;
}
/**
* Method to set the summary of the photo
*
* @param string $summary New photo description
*
* @return JGoogleDataPicasaPhoto The object for method chaining
*
* @since 3.1.4
*/
public function setSummary($summary)
{
$this->xml->children()->summary = $summary;
return $this;
}
/**
* Method to set the access level of the photo
*
* @param string $access New photo access level
*
* @return JGoogleDataPicasaPhoto The object for method chaining
*
* @since 3.1.4
*/
public function setAccess($access)
{
$this->xml->children('gphoto', true)->access = $access;
return $this;
}
/**
* Method to set the time of the photo
*
* @param int $time New photo time
*
* @return JGoogleDataPicasaPhoto The object for method chaining
*
* @since 3.1.4
*/
public function setTime($time)
{
$this->xml->children('gphoto', true)->timestamp = $time * 1000;
return $this;
}
/**
* Method to modify a Picasa Photo
*
* @param string $match Optional eTag matching parameter
*
* @return mixed Data from Google.
*
* @since 3.1.4
*/
public function save($match = '*')
{
if ($this->isAuthenticated())
{
$url = $this->getLink();
if ($match === true)
{
$match = $this->xml->xpath('./@gd:etag');
$match = $match[0];
}
try
{
$headers = array('GData-Version' => 2, 'Content-type' => 'application/atom+xml', 'If-Match' => $match);
$jdata = $this->query($url, $this->xml->asXml(), $headers, 'put');
}
catch (Exception $e)
{
if (strpos($e->getMessage(), 'Error code 412 received requesting data: Mismatch: etags') === 0)
{
throw new RuntimeException("Etag match failed: `$match`.", $e->getCode(), $e);
}
throw $e;
}
$this->xml = $this->safeXml($jdata->body);
return $this;
}
else
{
return false;
}
}
/**
* Refresh photo data
*
* @return mixed Data from Google
*
* @since 3.1.4
*/
public function refresh()
{
if ($this->isAuthenticated())
{
$url = $this->getLink();
$jdata = $this->query($url, null, array('GData-Version' => 2));
$this->xml = $this->safeXml($jdata->body);
return $this;
}
else
{
return false;
}
}
}
PK t!]]2��a'