forked from friendica/friendica-addons
Facebook: Trying to optimise the handling of videos
Tumblr: Changed the way the HTML is generated
This commit is contained in:
parent
cc74af9d09
commit
4f3e76e87e
|
@ -416,7 +416,7 @@ function fb_get_friends($uid, $fullsync = true) {
|
||||||
return;
|
return;
|
||||||
$s = fetch_url('https://graph.facebook.com/me/friends?access_token=' . $access_token);
|
$s = fetch_url('https://graph.facebook.com/me/friends?access_token=' . $access_token);
|
||||||
if($s) {
|
if($s) {
|
||||||
logger('facebook: fb_get_friends: ' . $s, LOGGER_DATA);
|
logger('facebook: fb_gwet_friends: ' . $s, LOGGER_DATA);
|
||||||
$j = json_decode($s);
|
$j = json_decode($s);
|
||||||
logger('facebook: fb_get_friends: json: ' . print_r($j,true), LOGGER_DATA);
|
logger('facebook: fb_get_friends: json: ' . print_r($j,true), LOGGER_DATA);
|
||||||
if(! $j->data)
|
if(! $j->data)
|
||||||
|
@ -1101,21 +1101,25 @@ function facebook_post_hook(&$a,&$b) {
|
||||||
|
|
||||||
logger('Facebook post: msg=' . $msg, LOGGER_DATA);
|
logger('Facebook post: msg=' . $msg, LOGGER_DATA);
|
||||||
|
|
||||||
if($likes) {
|
if($likes) {
|
||||||
$postvars = array('access_token' => $fb_token);
|
$postvars = array('access_token' => $fb_token);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
// message, picture, link, name, caption, description, source, place, tags
|
||||||
$postvars = array(
|
$postvars = array(
|
||||||
'access_token' => $fb_token,
|
'access_token' => $fb_token,
|
||||||
'message' => $msg
|
'message' => $msg
|
||||||
);
|
);
|
||||||
if(isset($image)) {
|
if(isset($image)) {
|
||||||
$postvars['picture'] = $image;
|
$postvars['picture'] = $image;
|
||||||
//$postvars['type'] = "photo";
|
|
||||||
}
|
}
|
||||||
if(isset($link)) {
|
if(isset($link)) {
|
||||||
$postvars['link'] = $link;
|
$postvars['link'] = $link;
|
||||||
//$postvars['type'] = "link";
|
|
||||||
|
// The following doesn't work - why?
|
||||||
|
if ((stristr($link,'youtube')) || (stristr($link,'youtu.be')) || (stristr($link,'vimeo'))) {
|
||||||
|
$postvars['source'] = $link;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(isset($linkname))
|
if(isset($linkname))
|
||||||
$postvars['name'] = $linkname;
|
$postvars['name'] = $linkname;
|
||||||
|
@ -1133,7 +1137,7 @@ 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 if (($link != "") or ($image != "") or ($b['title'] == '') or (strlen($msg) < 500)) {
|
||||||
$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'] . '"}';
|
||||||
|
@ -1778,7 +1782,7 @@ function fb_consume_stream($uid,$j,$wall = false) {
|
||||||
// oembed display a picture of the video as well
|
// oembed display a picture of the video as well
|
||||||
if ($entry->type != "video") {
|
if ($entry->type != "video") {
|
||||||
if(isset($entry->picture) && isset($entry->link)) {
|
if(isset($entry->picture) && isset($entry->link)) {
|
||||||
$datarray['body'] .= "\n" . '[url=' . $entry->link . '][img]'.$entry->picture.'[/img][/url]';
|
$datarray['body'] .= "\n" . '[url=' . $entry->link . '][img]'.$entry->picture.'[/img][/url]';
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if(isset($entry->picture))
|
if(isset($entry->picture))
|
||||||
|
|
|
@ -204,19 +204,18 @@ function tumblr_send(&$a,&$b) {
|
||||||
$params['embed'] = $link;
|
$params['embed'] = $link;
|
||||||
if ($title != '')
|
if ($title != '')
|
||||||
$params['caption'] = '<h1><a href="'.$link.'">'.$title.
|
$params['caption'] = '<h1><a href="'.$link.'">'.$title.
|
||||||
"</a></h1><p>".bbcode($body)."</p>";
|
"</a></h1><p>".bbcode($body, false, false)."</p>";
|
||||||
else
|
else
|
||||||
$params['caption'] = bbcode($body);
|
$params['caption'] = bbcode($body, false, false);
|
||||||
} else if (($link != '') and !$video) {
|
} else if (($link != '') and !$video) {
|
||||||
$params['type'] = "link";
|
$params['type'] = "link";
|
||||||
$params['name'] = $title;
|
$params['name'] = $title;
|
||||||
$params['url'] = $link;
|
$params['url'] = $link;
|
||||||
//$params['description'] = bbcode($body);
|
$params['description'] = bbcode($b["body"], false, false);
|
||||||
$params['description'] = bbcode($b["body"]);
|
|
||||||
} else {
|
} else {
|
||||||
$params['type'] = "regular";
|
$params['type'] = "regular";
|
||||||
$params['title'] = $title;
|
$params['title'] = $title;
|
||||||
$params['body'] = bbcode($b['body']);
|
$params['body'] = bbcode($b['body'], false, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
$x = post_url($tmbl_blog,$params);
|
$x = post_url($tmbl_blog,$params);
|
||||||
|
|
Loading…
Reference in a new issue