Support for new "share_header" function

This commit is contained in:
Michael Vogel 2015-04-06 14:04:40 +02:00
parent 09a3321689
commit e98c299cd2
3 changed files with 34 additions and 10 deletions

View file

@ -9,6 +9,8 @@
define('FROMGPLUS_DEFAULT_POLL_INTERVAL', 30); // given in minutes
require_once('mod/share.php');
function fromgplus_install() {
register_hook('connector_settings', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings');
register_hook('connector_settings_post', 'addon/fromgplus/fromgplus.php', 'fromgplus_addon_settings_post');
@ -461,10 +463,17 @@ function fromgplus_fetch($a, $uid) {
$post = fromgplus_html2bbcode($item->annotation)."\n";
if (!intval(get_config('system','old_share'))) {
$post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName).
"' profile='".$item->object->actor->url.
"' avatar='".$item->object->actor->image->url.
"' link='".$item->object->url."']";
if (function_exists("share_header"))
$post .= share_header($item->object->actor->displayName, $item->object->actor->url,
$item->object->actor->image->url, "",
datetime_convert('UTC','UTC',$item->object->published),$item->object->url);
else
$post .= "[share author='".str_replace("'", "'",$item->object->actor->displayName).
"' profile='".$item->object->actor->url.
"' avatar='".$item->object->actor->image->url.
"' posted='".datetime_convert('UTC','UTC',$item->object->published).
"' link='".$item->object->url."']";
$post .= fromgplus_html2bbcode($item->object->content);

View file

@ -68,8 +68,10 @@ function pumpio_registerclient(&$a, $host) {
if ($application_name == "")
$application_name = $a->get_hostname();
$adminlist = explode(",", str_replace(" ", "", $a->config['admin_email']));
$params["type"] = "client_associate";
$params["contacts"] = $a->config['admin_email'];
$params["contacts"] = $adminlist[0];
$params["application_type"] = "native";
$params["application_name"] = $application_name;
$params["logo_url"] = $a->get_baseurl()."/images/friendica-256.png";
@ -302,6 +304,7 @@ function pumpio_settings_post(&$a,&$b) {
set_pconfig(local_user(),'pumpio','mirror',false);
set_pconfig(local_user(),'pumpio','post_by_default',false);
set_pconfig(local_user(),'pumpio','lastdate', 0);
set_pconfig(local_user(),'pumpio','last_id', '');
} else {
// filtering the username if it is filled wrong
$user = $_POST['pumpio_user'];
@ -1233,6 +1236,7 @@ function pumpio_dopost(&$a, $client, $uid, $self, $post, $own_id, $threadcomplet
$postarray['body'] = "[share author='".$post->object->author->displayName.
"' profile='".$post->object->author->url.
"' avatar='".$post->object->author->image->url.
"' posted='".datetime_convert('UTC','UTC',$post->object->created).
"' link='".$post->links->self->href."']".$postarray['body']."[/share]";
} else {
// Let shares look like wall-to-wall posts

View file

@ -733,6 +733,7 @@ function twitter_fetchtimeline($a, $uid) {
require_once('mod/item.php');
require_once('include/items.php');
require_once('mod/share.php');
require_once('library/twitteroauth.php');
$connection = new TwitterOAuth($ckey,$csecret,$otoken,$osecret);
@ -798,11 +799,20 @@ function twitter_fetchtimeline($a, $uid) {
$converted = twitter_expand_entities($a, $_REQUEST['body'], $post->retweeted_status, true, $picture);
$_REQUEST['body'] = $converted["body"];
$_REQUEST['body'] = "[share author='".$post->retweeted_status->user->name.
"' profile='https://twitter.com/".$post->retweeted_status->user->screen_name.
"' avatar='".$post->retweeted_status->user->profile_image_url_https.
"' link='https://twitter.com/".$post->retweeted_status->user->screen_name."/status/".$post->retweeted_status->id_str."']".
$_REQUEST['body'];
if (function_exists("share_header"))
$_REQUEST['body'] = share_header($post->retweeted_status->user->name, "https://twitter.com/".$post->retweeted_status->user->screen_name,
$post->retweeted_status->user->profile_image_url_https, "",
datetime_convert('UTC','UTC',$post->retweeted_status->created_at),
"https://twitter.com/".$post->retweeted_status->user->screen_name."/status/".$post->retweeted_status->id_str).
$_REQUEST['body'];
else
$_REQUEST['body'] = "[share author='".$post->retweeted_status->user->name.
"' profile='https://twitter.com/".$post->retweeted_status->user->screen_name.
"' avatar='".$post->retweeted_status->user->profile_image_url_https.
"' posted='".datetime_convert('UTC','UTC',$post->retweeted_status->created_at).
"' link='https://twitter.com/".$post->retweeted_status->user->screen_name."/status/".$post->retweeted_status->id_str."']".
$_REQUEST['body'];
$_REQUEST['body'] .= "[/share]";
} else {
$_REQUEST["body"] = $post->text;
@ -1446,6 +1456,7 @@ function twitter_createpost($a, $uid, $post, $self, $create_user, $only_existing
$postarray['body'] = "[share author='".$post->retweeted_status->user->name.
"' profile='https://twitter.com/".$post->retweeted_status->user->screen_name.
"' avatar='".$post->retweeted_status->user->profile_image_url_https.
"' posted='".datetime_convert('UTC','UTC',$post->retweeted_status->created_at).
"' link='https://twitter.com/".$post->retweeted_status->user->screen_name."/status/".$post->retweeted_status->id_str."']".
$postarray['body'];
$postarray['body'] .= "[/share]";