Merge pull request #192 from annando/master

buffer: Export to app.net now is in Markdown (can be made better)
This commit is contained in:
tobiasd 2014-05-18 20:00:47 +02:00
commit bd04842776
2 changed files with 17 additions and 3 deletions

View File

@ -326,6 +326,7 @@ function buffer_send(&$a,&$b) {
$post["preview"] = $a->get_baseurl() . "/privacy_image_cache/".privacy_image_cache_cachename($post["preview"]); $post["preview"] = $a->get_baseurl() . "/privacy_image_cache/".privacy_image_cache_cachename($post["preview"]);
} }
//if ($profile->service == "twitter") {
if ($includedlinks) { if ($includedlinks) {
if (isset($post["url"])) if (isset($post["url"]))
$post["url"] = short_link($post["url"]); $post["url"] = short_link($post["url"]);
@ -337,8 +338,20 @@ function buffer_send(&$a,&$b) {
// Seems like a bug to me // Seems like a bug to me
// Buffer doesn't add links to Twitter and App.net (but pictures) // Buffer doesn't add links to Twitter and App.net (but pictures)
if ($includedlinks AND isset($post["url"])) //if ($includedlinks AND isset($post["url"]))
if (($profile->service == "twitter") AND isset($post["url"]))
$post["text"] .= " ".$post["url"]; $post["text"] .= " ".$post["url"];
elseif (($profile->service == "appdotnet") AND isset($post["url"]) AND isset($post["title"])) {
$maxdesclength = $limit - (strlen($post["text"]) + 1);
if (strlen($post["title"]) > $maxdesclength)
$posttitle = trim(substr($post["title"], 0, $maxdesclength - 3))."...";
else
$posttitle = trim($post["title"]);
$post["text"] .= "\n[".$posttitle."](".$post["url"].")";
} elseif (($profile->service == "appdotnet") AND isset($post["url"]))
$post["text"] .= " ".$post["url"];
$message = array(); $message = array();
$message["text"] = $post["text"]; $message["text"] = $post["text"];

View File

@ -282,6 +282,9 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
if (isset($post->attachment->name) and isset($post->attachment->href)) { if (isset($post->attachment->name) and isset($post->attachment->href)) {
$oembed_data = oembed_fetch_url($post->attachment->href); $oembed_data = oembed_fetch_url($post->attachment->href);
$type = $oembed_data->type; $type = $oembed_data->type;
if ($type == "rich")
$type = "link";
$content = "[bookmark=".$post->attachment->href."]".$post->attachment->name."[/bookmark]"; $content = "[bookmark=".$post->attachment->href."]".$post->attachment->name."[/bookmark]";
} elseif (isset($post->attachment->name) AND ($post->attachment->name != "")) } elseif (isset($post->attachment->name) AND ($post->attachment->name != ""))
$content = "[b]" . $post->attachment->name."[/b]"; $content = "[b]" . $post->attachment->name."[/b]";
@ -370,7 +373,6 @@ function fbsync_createpost($a, $uid, $self, $contacts, $applications, $post, $cr
// $postarray["body"] = "Type: ".$post->type."\n".$postarray["body"]; // $postarray["body"] = "Type: ".$post->type."\n".$postarray["body"];
//print_r($post); //print_r($post);
//print_r($postarray); //print_r($postarray);
$item = item_store($postarray); $item = item_store($postarray);
logger('fbsync_createpost: User '.$self[0]["nick"].' posted feed item '.$item, LOGGER_DEBUG); logger('fbsync_createpost: User '.$self[0]["nick"].' posted feed item '.$item, LOGGER_DEBUG);
} }
@ -933,7 +935,6 @@ function fbsync_fetchfeed($a, $uid) {
$url = "https://graph.facebook.com/fql?q=".urlencode(json_encode($fql))."&access_token=".$access_token; $url = "https://graph.facebook.com/fql?q=".urlencode(json_encode($fql))."&access_token=".$access_token;
$feed = fetch_url($url); $feed = fetch_url($url);
//file_put_contents("/home/ike/pirati.ca/htdocs/fb.".$uid, $feed);
$data = json_decode($feed); $data = json_decode($feed);
if (!is_array($data->data)) { if (!is_array($data->data)) {