$_REQUEST['profile_uid'] = $uid;
$_REQUEST['source'] = $source;
+ $_REQUEST['extid'] = NETWORK_GPLUS;
// $_REQUEST['verb']
// $_REQUEST['parent']
function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
require_once("include/Photo.php");
+ require_once("include/items.php");
+ require_once("include/network.php");
$post = "";
$quote = "";
- $type = "";
+ $pagedata = array();
+ $pagedata["type"] = "";
foreach ($item->object->attachments as $attachment) {
switch($attachment->objectType) {
case "video":
- $post .= "\n[class=type-video][bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n[/class]";
+ $pagedata["type"] = "video";
+ $pagedata["url"] = original_url($attachment->url);
+ $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
break;
case "article":
- $post .= "\n[class=type-link][bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
+ $pagedata["type"] = "link";
+ $pagedata["url"] = original_url($attachment->url);
+ $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
if ($images["full"] != "")
- $post .= "\n[img]".$images["full"]."[/img]";
+ $pagedata["images"][0]["src"] = $images["full"];
$quote = trim(fromgplus_html2bbcode($attachment->content));
+
if ($quote != "")
- $quote = "\n[quote]".$quote."[/quote]";
+ $pagedata["text"] = $quote;
- $quote .= "[/class]";
break;
case "photo":
$images = store_photo($a, $uid, "", $attachment->image->url);
}
- if ($images["preview"] != "")
+ if ($images["preview"] != "") {
$post .= "\n[url=".$images["page"]."][img]".$images["preview"]."[/img][/url]\n";
- elseif ($images["full"] != "")
+ $pagedata["images"][0]["src"] = $images["preview"];
+ $pagedata["url"] = $images["page"];
+ } elseif ($images["full"] != "") {
$post .= "\n[img]".$images["full"]."[/img]\n";
+ $pagedata["images"][0]["src"] = $images["full"];
+
+ if ($images["preview"] != "")
+ $pagedata["images"][1]["src"] = $images["preview"];
+ }
- if (($attachment->displayName != "") AND (fromgplus_cleantext($attachment->displayName) != fromgplus_cleantext($displaytext)))
+ if (($attachment->displayName != "") AND (fromgplus_cleantext($attachment->displayName) != fromgplus_cleantext($displaytext))) {
$post .= fromgplus_html2bbcode($attachment->displayName)."\n";
+ $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
+ }
break;
case "photo-album":
- $post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
+ $pagedata["url"] = original_url($attachment->url);
+ $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
+ $post .= "\n\n[bookmark=".$pagedata["url"]."]".$pagedata["title"]."[/bookmark]\n";
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
- if ($images["preview"] != "")
+
+ if ($images["preview"] != "") {
$post .= "\n[url=".$images["full"]."][img]".$images["preview"]."[/img][/url]\n";
- elseif ($images["full"] != "")
+ $pagedata["images"][0]["src"] = $images["preview"];
+ $pagedata["url"] = $images["full"];
+ } elseif ($images["full"] != "") {
$post .= "\n[img]".$images["full"]."[/img]\n";
+ $pagedata["images"][0]["src"] = $images["full"];
+ if ($images["preview"] != "")
+ $pagedata["images"][1]["src"] = $images["preview"];
+ }
break;
case "album":
- $post .= "\n[class=type-link][bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]";
+ $pagedata["type"] = "link";
+ $pagedata["url"] = original_url($attachment->url);
+ $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
$thumb = $attachment->thumbnails[0];
- $post .= "\n[img]".$thumb->image->url."[/img]";
+ $pagedata["images"][0]["src"] = $thumb->image->url;
$quote = trim(fromgplus_html2bbcode($thumb->description));
if ($quote != "")
- $quote = "\n[quote]".$quote."[/quote]";
+ $pagedata["text"] = $quote;
- //foreach($attachment->thumbnails as $thumb) {
- // $preview = "/w".$thumb->image->width."-h".$thumb->image->height."/";
- // $preview2 = "/w".$thumb->image->width."-h".$thumb->image->height."-p/";
- // $image = str_replace(array($preview, $preview2), array("/", "/"), $thumb->image->url);
-
- // $post .= "\n[url=".$thumb->url."][img]".$image."[/img][/url]\n";
- //}
- $quote .= "[/class]";
break;
+
case "audio":
- $post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
+ $pagedata["url"] = original_url($attachment->url);
+ $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
+ $post .= "\n\n[bookmark=".$pagedata["url"]."]".$pagedata["title"]."[/bookmark]\n";
break;
+
//default:
// die($attachment->objectType);
}
}
+
+ if ($pagedata["type"] != "")
+ return(add_page_info_data($pagedata));
+
return($post.$quote);
}
$reversed = array_reverse($activities->items);
foreach($reversed as $item) {
+
if (strtotime($item->published) <= $initiallastdate)
continue;
if ($first_time)
continue;
- if ($item->access->description == "Public")
-
- // Loop prevention - ignore postings from HootSuite
- if ($item->provider->title == "HootSuite")
- continue;
+ if ($item->access->description == "Public") {
// Loop prevention through the special blank from the googleplus connector
- if (strstr($item->object->content, $blank))
+ //if (strstr($item->object->content, $blank))
+ if (strrpos($item->object->content, $blank) >= strlen($item->object->content) - 5)
continue;
switch($item->object->objectType) {
else
$location = "";
- fromgplus_post($a, $uid, "Google+", $post, $location);
- //fromgplus_post($a, $uid, $item->provider->title, $post, $location);
+ //fromgplus_post($a, $uid, "Google+", $post, $location);
+ fromgplus_post($a, $uid, $item->provider->title, $post, $location);
break;
else
$location = "";
- fromgplus_post($a, $uid, "Google+", $post, $location);
- //fromgplus_post($a, $uid, $item->provider->title, $post, $location);
+ //fromgplus_post($a, $uid, "Google+", $post, $location);
+ fromgplus_post($a, $uid, $item->provider->title, $post, $location);
break;
}
+ }
}
if ($lastdate != 0)
set_pconfig($uid,'fromgplus','lastdate', $lastdate);