mirror of
https://git.friendi.ca/friendica/friendica-addons.git
synced 2024-11-22 09:53:39 +00:00
Tumblr: Export improved - autodetection of links.
This commit is contained in:
parent
7e9b3450c5
commit
eeed84f200
1 changed files with 16 additions and 7 deletions
|
@ -168,22 +168,31 @@ function tumblr_send(&$a,&$b) {
|
||||||
if(count($tag_arr))
|
if(count($tag_arr))
|
||||||
$tags = implode(',',$tag_arr);
|
$tags = implode(',',$tag_arr);
|
||||||
|
|
||||||
|
$link = "";
|
||||||
if ($b['title'] == '') {
|
if ($b['title'] == '') {
|
||||||
// Take the description from the bookmark
|
// Take the description from the bookmark
|
||||||
if(preg_match("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/is",$b['body'],$matches))
|
if(preg_match("/\[bookmark\=([^\]]*)\](.*?)\[\/bookmark\]/is",$b['body'],$matches))
|
||||||
$b['title'] = $matches[2];
|
$link = $matches[1];
|
||||||
|
$b['title'] = html_entity_decode($matches[2],ENT_QUOTES,'UTF-8');
|
||||||
}
|
}
|
||||||
|
|
||||||
$params = array(
|
$params = array(
|
||||||
'email' => $tmbl_username,
|
'email' => $tmbl_username,
|
||||||
'password' => $tmbl_password,
|
'password' => $tmbl_password,
|
||||||
'title' => $b['title'],
|
|
||||||
'type' => 'regular',
|
|
||||||
'format' => 'html',
|
'format' => 'html',
|
||||||
'generator' => 'Friendica',
|
'generator' => 'Friendica',
|
||||||
'tags' => $tags,
|
'tags' => $tags);
|
||||||
'body' => bbcode($b['body'])
|
|
||||||
);
|
if ($link != '') {
|
||||||
|
$params['type'] = "link";
|
||||||
|
$params['name'] = $b['title'],
|
||||||
|
$params['url'] = $link;
|
||||||
|
$params['description'] = bbcode($b['body']);
|
||||||
|
} else {
|
||||||
|
$params['type'] = "regular";
|
||||||
|
$params['title'] = $b['title'],
|
||||||
|
$params['body'] = bbcode($b['body']);
|
||||||
|
}
|
||||||
|
|
||||||
$x = post_url($tmbl_blog,$params);
|
$x = post_url($tmbl_blog,$params);
|
||||||
$ret_code = $a->get_curl_code();
|
$ret_code = $a->get_curl_code();
|
||||||
|
@ -192,7 +201,7 @@ function tumblr_send(&$a,&$b) {
|
||||||
elseif($ret_code == 403)
|
elseif($ret_code == 403)
|
||||||
logger('tumblr_send: authentication failure');
|
logger('tumblr_send: authentication failure');
|
||||||
else
|
else
|
||||||
logger('tumblr_send: general error: ' . print_r($x,true));
|
logger('tumblr_send: general error: ' . print_r($x,true));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue