]> git.mxchange.org Git - friendica-addons.git/blobdiff - fromgplus/fromgplus.php
Merge pull request #255 from annando/1502-pledgie-deactivated
[friendica-addons.git] / fromgplus / fromgplus.php
index a80bf7e1be4b059f099952806c734e8af9246316..e0725a46df22a295d529653db453358be85be6c3 100644 (file)
@@ -138,6 +138,7 @@ function fromgplus_post($a, $uid, $source, $body, $location) {
 
        $_REQUEST['profile_uid'] = $uid;
        $_REQUEST['source'] = $source;
+       $_REQUEST['extid'] = NETWORK_GPLUS;
 
        // $_REQUEST['verb']
        // $_REQUEST['parent']
@@ -276,6 +277,7 @@ function fromgplus_cleantext($text) {
 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 = "";
@@ -286,13 +288,13 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
                switch($attachment->objectType) {
                        case "video":
                                $pagedata["type"] = "video";
-                               $pagedata["url"] = $attachment->url;
+                               $pagedata["url"] = original_url($attachment->url);
                                $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
                                break;
 
                        case "article":
                                $pagedata["type"] = "link";
-                               $pagedata["url"] = $attachment->url;
+                               $pagedata["url"] = original_url($attachment->url);
                                $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
 
                                $images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
@@ -336,9 +338,9 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
                                break;
 
                        case "photo-album":
-                               $pagedata["url"] = $attachment->url;
+                               $pagedata["url"] = original_url($attachment->url);
                                $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
-                               $post .= "\n\n[bookmark=".$attachment->url."]".fromgplus_html2bbcode($attachment->displayName)."[/bookmark]\n";
+                               $post .= "\n\n[bookmark=".$pagedata["url"]."]".$pagedata["title"]."[/bookmark]\n";
 
                                $images = fromgplus_cleanupgoogleproxy($attachment->fullImage, $attachment->image);
 
@@ -357,7 +359,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
 
                        case "album":
                                $pagedata["type"] = "link";
-                               $pagedata["url"] = $attachment->url;
+                               $pagedata["url"] = original_url($attachment->url);
                                $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
 
                                $thumb = $attachment->thumbnails[0];
@@ -370,7 +372,7 @@ function fromgplus_handleattachments($a, $uid, $item, $displaytext, $shared) {
                                break;
 
                        case "audio":
-                               $pagedata["url"] = $attachment->url;
+                               $pagedata["url"] = original_url($attachment->url);
                                $pagedata["title"] = fromgplus_html2bbcode($attachment->displayName);
                                $post .= "\n\n[bookmark=".$pagedata["url"]."]".$pagedata["title"]."[/bookmark]\n";
                                break;
@@ -414,6 +416,7 @@ function fromgplus_fetch($a, $uid) {
        $reversed = array_reverse($activities->items);
 
        foreach($reversed as $item) {
+
                if (strtotime($item->published) <= $initiallastdate)
                        continue;
 
@@ -429,14 +432,11 @@ function fromgplus_fetch($a, $uid) {
                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) {
@@ -452,8 +452,8 @@ function fromgplus_fetch($a, $uid) {
                                        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;
 
@@ -486,10 +486,11 @@ function fromgplus_fetch($a, $uid) {
                                        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);