forked from friendica/friendica-addons
Merge pull request #165 from annando/master
fromgplus: doubled text and avoiding first time spam
This commit is contained in:
commit
b2e60b8c61
2 changed files with 15 additions and 2 deletions
|
@ -371,7 +371,7 @@ function appnetpost_feeditem($pid, $uid) {
|
|||
$title = substr($title, 0, -3)."...";
|
||||
}
|
||||
|
||||
if (!strstr($title, $msglink))
|
||||
if (($msglink != "") AND !strstr($title, $msglink))
|
||||
$title = trim($title." ".$msglink);
|
||||
else
|
||||
$title = trim($title);
|
||||
|
|
|
@ -101,6 +101,10 @@ function fromgplus_post($a, $uid, $source, $body, $location) {
|
|||
|
||||
//$uid = 2;
|
||||
|
||||
// Don't know what it is. Maybe some trash from the mobile client
|
||||
$trash = html_entity_decode("", ENT_QUOTES, 'UTF-8');
|
||||
$body = str_replace($trash, "", $body);
|
||||
|
||||
$body = trim($body);
|
||||
|
||||
if (substr($body, 0, 3) == "[b]") {
|
||||
|
@ -223,10 +227,14 @@ function fromgplus_cleanupgoogleproxy($fullImage, $image) {
|
|||
}
|
||||
|
||||
function fromgplus_cleantext($text) {
|
||||
|
||||
// Don't know what it is. But it is added to the text.
|
||||
$trash = html_entity_decode("", 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 @@ function fromgplus_fetch($a, $uid) {
|
|||
|
||||
$initiallastdate = get_pconfig($uid,'fromgplus','lastdate');
|
||||
|
||||
$first_time = ($initiallastdate == "");
|
||||
|
||||
$lastdate = 0;
|
||||
|
||||
if (!is_array($activities->items))
|
||||
|
@ -336,6 +346,9 @@ function fromgplus_fetch($a, $uid) {
|
|||
if ($lastdate < strtotime($item->published))
|
||||
$lastdate = strtotime($item->published);
|
||||
|
||||
if ($first_time)
|
||||
continue;
|
||||
|
||||
if ($item->access->description == "Public")
|
||||
|
||||
// Loop prevention - ignore postings from HootSuite
|
||||
|
|
Loading…
Reference in a new issue