+ if ($lastdate < strtotime($item->published))
+ $lastdate = strtotime($item->published);
+
+ PConfig::set($uid,'fromgplus','lastdate', $lastdate);
+
+ if ($first_time)
+ continue;
+
+ if ($item->access->description == "Public") {
+
+ // Loop prevention through the special blank from the googleplus connector
+ //if (strstr($item->object->content, $blank))
+ if (strrpos($item->object->content, $blank) >= strlen($item->object->content) - 5)
+ continue;
+
+ switch($item->object->objectType) {
+ case "note":
+ $post = fromgplus_html2bbcode($item->object->content);
+
+ if (is_array($item->object->attachments))
+ $post .= fromgplus_handleattachments($a, $uid, $item, $item->object->content, false);
+
+ $coord = "";
+ $location = "";
+ if (isset($item->location)) {
+ if (isset($item->location->address->formatted))
+ $location = $item->location->address->formatted;
+
+ if (isset($item->location->displayName))
+ $location = $item->location->displayName;
+
+ if (isset($item->location->position->latitude) &&
+ isset($item->location->position->longitude))
+ $coord = $item->location->position->latitude." ".$item->location->position->longitude;
+
+ } elseif (isset($item->address))
+ $location = $item->address;
+
+ fromgplus_post($a, $uid, $item->provider->title, $post, $location, $coord, $item->id);
+
+ break;
+
+ case "activity":
+ $post = fromgplus_html2bbcode($item->annotation)."\n";
+
+ if (!intval(Config::get('system','old_share'))) {
+
+ if (function_exists("share_header"))
+ $post .= share_header($item->object->actor->displayName, $item->object->actor->url,
+ $item->object->actor->image->url, "",
+ datetime_convert('UTC','UTC',$item->object->published),$item->object->url);
+ else
+ $post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName).
+ "' profile='".$item->object->actor->url.
+ "' avatar='".$item->object->actor->image->url.
+ "' posted='".datetime_convert('UTC','UTC',$item->object->published).
+ "' link='".$item->object->url."']";
+
+ $post .= fromgplus_html2bbcode($item->object->content);
+
+ if (is_array($item->object->attachments))
+ $post .= "\n".trim(fromgplus_handleattachments($a, $uid, $item, $item->object->content, true));
+
+ $post .= "[/share]";
+ } else {
+ $post .= fromgplus_html2bbcode("♲");
+ $post .= " [url=".$item->object->actor->url."]".$item->object->actor->displayName."[/url] \n";
+ $post .= fromgplus_html2bbcode($item->object->content);
+
+ if (is_array($item->object->attachments))
+ $post .= "\n".trim(fromgplus_handleattachments($a, $uid, $item, $item->object->content, true));
+ }
+
+ $coord = "";
+ $location = "";
+ if (isset($item->location)) {
+ if (isset($item->location->address->formatted))
+ $location = $item->location->address->formatted;
+
+ if (isset($item->location->displayName))
+ $location = $item->location->displayName;
+
+ if (isset($item->location->position->latitude) &&
+ isset($item->location->position->longitude))
+ $coord = $item->location->position->latitude." ".$item->location->position->longitude;
+
+ } elseif (isset($item->address))
+ $location = $item->address;
+
+ fromgplus_post($a, $uid, $item->provider->title, $post, $location, $coord, $item->id);
+ break;
+ }
+ }
+ }
+ if ($lastdate != 0)
+ PConfig::set($uid,'fromgplus','lastdate', $lastdate);