]> git.mxchange.org Git - friendica-addons.git/blobdiff - fromgplus/fromgplus.php
Merge pull request #298 from tobiasd/master
[friendica-addons.git] / fromgplus / fromgplus.php
index 17300ae8ee0a74f12d083a5a7c2f4fd94227defd..933567ce7c07f5a9a788fd95292d25f8747076d4 100644 (file)
@@ -9,6 +9,8 @@
 
 define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes
 
+require_once('mod/share.php');
+
 function fromgplus_install() {
        register_hook('connector_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings');
        register_hook('connector_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post');
@@ -416,6 +418,7 @@ function fromgplus_fetch($a, $uid) {
        $reversed = array_reverse($activities->items);
 
        foreach($reversed as $item) {
+
                if (strtotime($item->published) <= $initiallastdate)
                        continue;
 
@@ -431,14 +434,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) {
@@ -454,8 +454,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;
 
@@ -463,10 +463,17 @@ function fromgplus_fetch($a, $uid) {
                                        $post = fromgplus_html2bbcode($item->annotation)."\n";
 
                                        if (!intval(get_config('system','old_share'))) {
-                                               $post .= "[share author='".str_replace("'", "&#039;",$item->object->actor->displayName).
-                                                               "' profile='".$item->object->actor->url.
-                                                               "' avatar='".$item->object->actor->image->url.
-                                                               "' link='".$item->object->url."']";
+
+                                               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("'", "&#039;",$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);
 
@@ -488,10 +495,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);