10 defined(
'JPATH_PLATFORM') or die;
31 parent::__construct($options, $auth);
33 if (isset($this->auth) && !$this->auth->getOption(
'scope'))
35 $this->auth->setOption(
'scope',
'https://www.googleapis.com/auth/plus.me');
54 public function listActivities($userId, $collection, $fields = null, $max = 10, $token = null, $alt = null)
56 if ($this->isAuthenticated())
58 $url = $this->getOption(
'api.url') .
'people/' . $userId .
'/activities/' . $collection;
63 $url .=
'?fields=' . $fields;
69 $url .= (strpos($url,
'?') ===
false) ?
'?maxResults=' :
'&maxResults=';
76 $url .= (strpos($url,
'?') ===
false) ?
'?pageToken=' :
'&pageToken=';
83 $url .= (strpos($url,
'?') ===
false) ?
'?alt=' :
'&alt=';
87 $jdata = $this->auth->query($url);
89 return json_decode($jdata->body,
true);
108 public function getActivity($id, $fields = null, $alt = null)
110 if ($this->isAuthenticated())
112 $url = $this->getOption(
'api.url') .
'activities/' . $id;
117 $url .=
'?fields=' . $fields;
123 $url .= (strpos($url,
'?') ===
false) ?
'?alt=' :
'&alt=';
127 $jdata = $this->auth->query($url);
129 return json_decode($jdata->body,
true);
152 public function search($query, $fields = null, $language = null, $max = 10, $order = null, $token = null)
154 if ($this->isAuthenticated())
156 $url = $this->getOption(
'api.url') .
'activities?query=' . urlencode($query);
161 $url .=
'&fields=' . $fields;
167 $url .=
'&language=' . $language;
173 $url .=
'&maxResults=' . $max;
179 $url .=
'&orderBy=' . $order;
185 $url .=
'&pageToken=' . $token;
188 $jdata = $this->auth->query($url);
190 return json_decode($jdata->body,
true);