Merge pull request #190 from annando/master

pumpio: wrong date, fromgplus: better support of albums
This commit is contained in:
tobiasd 2014-05-16 07:36:51 +02:00
commit 93b6ead462
2 changed files with 21 additions and 22 deletions

View File

@ -257,28 +257,16 @@ function fromgplus_handleattachments($item, $displaytext) {
foreach ($item->object->attachments as $attachment) { foreach ($item->object->attachments as $attachment) {
switch($attachment->objectType) { switch($attachment->objectType) {
case "video": case "video":
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n"; $post .= "\n[class=type-video][bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n[/class]";
/*$images = cleanupgoogleproxy($attachment->fullImage, $attachment->image);
if ($images["preview"] != "")
$post .= "\n[url=".$images["full"]."][img]".$images["preview"]."[/img][/url]\n";
elseif ($images["full"] != "")
$post .= "\n[img]".$images["full"]."[/img]\n";*/
break; break;
case "article": case "article":
$post .= "\n[class=type-link][bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n"; $post .= "\n[class=type-link][bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
$images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image); $images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
//if ($images["preview"] != "")
// $post .= "\n[url=".$images["full"]."][img]".$images["preview"]."[/img][/url]\n";
//elseif ($images["full"] != "")
// $post .= "\n[img]".$images["full"]."[/img]\n";
if ($images["full"] != "") if ($images["full"] != "")
$post .= "\n[img]".$images["full"]."[/img]"; $post .= "\n[img]".$images["full"]."[/img]";
//$post .= "[quote]".trim(fromgplus_html2bbcode($attachment->content))."[/quote]";
$quote = trim(fromgplus_html2bbcode($attachment->content)); $quote = trim(fromgplus_html2bbcode($attachment->content));
if ($quote != "") if ($quote != "")
$quote = "\n[quote]".$quote."[/quote]"; $quote = "\n[quote]".$quote."[/quote]";
@ -309,13 +297,23 @@ function fromgplus_handleattachments($item, $displaytext) {
break; break;
case "album": case "album":
foreach($attachment->thumbnails as $thumb) { $post .= "\n[class=type-link][bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]";
$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"; $thumb = $attachment->thumbnails[0];
} $post .= "\n[img]".$thumb->image->url."[/img]";
$quote = trim(fromgplus_html2bbcode($thumb->description));
if ($quote != "")
$quote = "\n[quote]".$quote."[/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; break;
case "audio": case "audio":
$post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n"; $post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
@ -338,6 +336,7 @@ function fromgplus_fetch($a, $uid) {
$result = fetch_url("https://www.googleapis.com/plus/v1/people/".$account."/activities/public?alt=json&pp=1&key=".$key."&maxResults=".$maxfetch); $result = fetch_url("https://www.googleapis.com/plus/v1/people/".$account."/activities/public?alt=json&pp=1&key=".$key."&maxResults=".$maxfetch);
//$result = file_get_contents("google.txt"); //$result = file_get_contents("google.txt");
//$result = file_get_contents("addon/fromgplus/album.txt");
//file_put_contents("google.txt", $result); //file_put_contents("google.txt", $result);
$activities = json_decode($result); $activities = json_decode($result);

View File

@ -678,11 +678,11 @@ function pumpio_fetchtimeline(&$a, $uid) {
if (count($posts)) { if (count($posts)) {
foreach ($posts as $post) { foreach ($posts as $post) {
if ($post->generator->published <= $initiallastdate) if ($post->published <= $initiallastdate)
continue; continue;
if ($lastdate < $post->generator->published) if ($lastdate < $post->published)
$lastdate = $post->generator->published; $lastdate = $post->published;
if ($first_time) if ($first_time)
continue; continue;