]> git.mxchange.org Git - friendica-addons.git/commitdiff
Support for new "share_header" function
authorMichael Vogel <icarus@dabo.de>
Mon, 6 Apr 2015 12:04:40 +0000 (14:04 +0200)
committerMichael Vogel <icarus@dabo.de>
Mon, 6 Apr 2015 12:04:40 +0000 (14:04 +0200)
fromgplus/fromgplus.php
pumpio/pumpio.php
twitter/twitter.php

index e0725a46df22a295d529653db453358be85be6c3..933567ce7c07f5a9a788fd95292d25f8747076d4 100644 (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("'", "&#039;",$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("'", "&#039;",$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);
 
index b413f59e522387bdcf45ff4f95b79af463b6f95a..2b8cc6d8b9bdabaab3dbf39a49419770a924d181 100644 (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
index 8d7e21fbbfd083e9209cfdbf90e84beef8953a61..d7a5eec50b0cd5c21d8c917e4720e7667b765286 100644 (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]";