]> git.mxchange.org Git - friendica-addons.git/commitdiff
Merge pull request #165 from annando/master
authortobiasd <tobias.diekershoff@gmx.net>
Thu, 28 Nov 2013 05:31:22 +0000 (21:31 -0800)
committertobiasd <tobias.diekershoff@gmx.net>
Thu, 28 Nov 2013 05:31:22 +0000 (21:31 -0800)
fromgplus: doubled text and avoiding first time spam

1  2 
fromgplus/fromgplus.php

diff --combined fromgplus/fromgplus.php
index 058c6e406ac3450608ed23ea667d990f9a82fe9c,711a73c3acd2d7c26d0d082018fecdfb4be9dff9..97213d38e992b68e7ee11d29fe2bffb39c733493
@@@ -45,7 -45,7 +45,7 @@@ function fromgplus_addon_settings(&$a,&
        $s .= '</div><div class="clear"></div>';
  
        $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="fromgplus-submit" name="fromgplus-submit" 
 -class="settings-submit" value="' . t('Submit') . '" /></div>';
 +class="settings-submit" value="' . t('Save Settings') . '" /></div>';
        $s .= '</div>';
  
        return;
@@@ -101,6 -101,10 +101,10 @@@ function fromgplus_post($a, $uid, $sour
  
        //$uid = 2;
  
+       // Don't know what it is. Maybe some trash from the mobile client
+       $trash = html_entity_decode("&#xFEFF;", ENT_QUOTES, 'UTF-8');
+       $body = str_replace($trash, "", $body);
        $body = trim($body);
  
          if (substr($body, 0, 3) == "[b]") {
@@@ -223,10 -227,14 +227,14 @@@ function fromgplus_cleanupgoogleproxy($
  }
  
  function fromgplus_cleantext($text) {
+       // Don't know what it is. But it is added to the text.
+       $trash = html_entity_decode("&#xFEFF;", ENT_QUOTES, 'UTF-8');
        $text = strip_tags($text);
        $text = html_entity_decode($text);
        $text = trim($text);
-       $text = str_replace(array("\n", "\r", " "), array("", "", ""), $text);
+       $text = str_replace(array("\n", "\r", " ", $trash), array("", "", "", ""), $text);
        return($text);
  }
  
@@@ -322,6 -330,8 +330,8 @@@ function fromgplus_fetch($a, $uid) 
  
        $initiallastdate = get_pconfig($uid,'fromgplus','lastdate');
  
+       $first_time = ($initiallastdate == "");
        $lastdate = 0;
  
        if (!is_array($activities->items))
                if ($lastdate < strtotime($item->published))
                        $lastdate = strtotime($item->published);
  
+               if ($first_time)
+                       continue;
                if ($item->access->description == "Public")
  
                        // Loop prevention - ignore postings from HootSuite