mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-23 00:23:53 +00:00
Facebook: Messages without images and links but with a subject and a text larger than 500 characters will be posted as notes.
This commit is contained in:
parent
40ce1054b7
commit
977ac72f66
1 changed files with 15 additions and 4 deletions
|
@ -1009,10 +1009,14 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
'access_token' => $fb_token,
|
'access_token' => $fb_token,
|
||||||
'message' => $msg
|
'message' => $msg
|
||||||
);
|
);
|
||||||
if(isset($image))
|
if(isset($image)) {
|
||||||
$postvars['picture'] = $image;
|
$postvars['picture'] = $image;
|
||||||
if(isset($link))
|
//$postvars['type'] = "photo";
|
||||||
|
}
|
||||||
|
if(isset($link)) {
|
||||||
$postvars['link'] = $link;
|
$postvars['link'] = $link;
|
||||||
|
//$postvars['type'] = "link";
|
||||||
|
}
|
||||||
if(isset($linkname))
|
if(isset($linkname))
|
||||||
$postvars['name'] = $linkname;
|
$postvars['name'] = $linkname;
|
||||||
}
|
}
|
||||||
|
@ -1029,11 +1033,18 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
|
|
||||||
if($reply) {
|
if($reply) {
|
||||||
$url = 'https://graph.facebook.com/' . $reply . '/' . (($likes) ? 'likes' : 'comments');
|
$url = 'https://graph.facebook.com/' . $reply . '/' . (($likes) ? 'likes' : 'comments');
|
||||||
}
|
} else if (($link != "") or ($image != "") or ($b['title'] == '') or (strlen($msg) < 500)) {
|
||||||
else {
|
|
||||||
$url = 'https://graph.facebook.com/me/feed';
|
$url = 'https://graph.facebook.com/me/feed';
|
||||||
if($b['plink'])
|
if($b['plink'])
|
||||||
$postvars['actions'] = '{"name": "' . t('View on Friendica') . '", "link": "' . $b['plink'] . '"}';
|
$postvars['actions'] = '{"name": "' . t('View on Friendica') . '", "link": "' . $b['plink'] . '"}';
|
||||||
|
} else {
|
||||||
|
// if its only a message and a subject and the message is larger than 500 characters then post it as note
|
||||||
|
$postvars = array(
|
||||||
|
'access_token' => $fb_token,
|
||||||
|
'message' => bbcode($b['body']),
|
||||||
|
'subject' => $b['title'],
|
||||||
|
);
|
||||||
|
$url = 'https://graph.facebook.com/me/notes';
|
||||||
}
|
}
|
||||||
|
|
||||||
logger('facebook: post to ' . $url);
|
logger('facebook: post to ' . $url);
|
||||||
|
|
Loading…
Reference in a new issue