]> git.mxchange.org Git - friendica-addons.git/blobdiff - pumpio/pumpio.php
Rendertime: possibility to define a minimal value for displaying the execution times
[friendica-addons.git] / pumpio / pumpio.php
index 42346fa4dfed4156f316ada77b1335f56166d8ab..cd44b682e6ddf5e760cd65ade8e4ed152cee7252 100644 (file)
@@ -23,7 +23,6 @@ use Friendica\Protocol\Activity;
 use Friendica\Protocol\ActivityNamespace;
 use Friendica\Util\ConfigFileLoader;
 use Friendica\Util\DateTimeFormat;
-use Friendica\Util\Network;
 use Friendica\Util\Strings;
 use Friendica\Util\XML;
 
@@ -46,19 +45,6 @@ function pumpio_install()
        Hook::register('check_item_notification', 'addon/pumpio/pumpio.php', 'pumpio_check_item_notification');
 }
 
-function pumpio_uninstall()
-{
-       Hook::unregister('load_config',      'addon/pumpio/pumpio.php', 'pumpio_load_config');
-       Hook::unregister('hook_fork',        'addon/pumpio/pumpio.php', 'pumpio_hook_fork');
-       Hook::unregister('post_local',       'addon/pumpio/pumpio.php', 'pumpio_post_local');
-       Hook::unregister('notifier_normal',  'addon/pumpio/pumpio.php', 'pumpio_send');
-       Hook::unregister('jot_networks',     'addon/pumpio/pumpio.php', 'pumpio_jot_nets');
-       Hook::unregister('connector_settings',      'addon/pumpio/pumpio.php', 'pumpio_settings');
-       Hook::unregister('connector_settings_post', 'addon/pumpio/pumpio.php', 'pumpio_settings_post');
-       Hook::unregister('cron', 'addon/pumpio/pumpio.php', 'pumpio_cron');
-       Hook::unregister('check_item_notification', 'addon/pumpio/pumpio.php', 'pumpio_check_item_notification');
-}
-
 function pumpio_module() {}
 
 function pumpio_content(App $a)
@@ -159,8 +145,7 @@ function pumpio_connect(App $a)
        if (($consumer_key == "") || ($consumer_secret == "")) {
                Logger::log("pumpio_connect: ".sprintf("Unable to register the client at the pump.io server '%s'.", $hostname));
 
-               $o .= DI::l10n()->t("Unable to register the client at the pump.io server '%s'.", $hostname);
-               return $o;
+               return DI::l10n()->t("Unable to register the client at the pump.io server '%s'.", $hostname);
        }
 
        // The callback URL is the script that gets called after the user authenticates with pumpio
@@ -925,8 +910,6 @@ function pumpio_dounlike(App $a, $uid, $self, $post, $own_id)
 
 function pumpio_dolike(App $a, $uid, $self, $post, $own_id, $threadcompletion = true)
 {
-       require_once('include/items.php');
-
        if (empty($post->object->id)) {
                Logger::log('Got empty like: '.print_r($post, true), Logger::DEBUG);
                return;
@@ -1071,7 +1054,7 @@ function pumpio_get_contact($uid, $contact, $no_insert = false)
        }
 
        if (!empty($contact->image->url)) {
-               Contact::updateAvatar($contact->image->url, $uid, $contact_id);
+               Contact::updateAvatar($contact_id, $contact->image->url);
        }
 
        return $contact_id;
@@ -1096,8 +1079,6 @@ function pumpio_dodelete(App $a, $uid, $self, $post, $own_id)
 
 function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcompletion = true)
 {
-       require_once('include/items.php');
-
        if (($post->verb == "like") || ($post->verb == "favorite")) {
                return pumpio_dolike($a, $uid, $self, $post, $own_id);
        }
@@ -1277,9 +1258,8 @@ function pumpio_dopost(App $a, $client, $uid, $self, $post, $own_id, $threadcomp
                        $created = '';
                }
 
-               $postarray['body'] = share_header($share_author, $post->object->author->url,
-                                               $post->object->author->image->url, "",
-                                               $created, $post->links->self->href).
+               $postarray['body'] = Friendica\Content\Text\BBCode::getShareOpeningTag($share_author, $post->object->author->url,
+                                               $post->object->author->image->url, $post->links->self->href, $created) .
                                        $postarray['body']."[/share]";
        }
 
@@ -1523,12 +1503,12 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
 
        // Fetching the original post
        $condition = ["`uri` = ? AND `uid` = ? AND `extid` != ''", $id, $uid];
-       $item = Item::selectFirst(['extid'], $condition);
-       if (!DBA::isResult($item)) {
+       $original = Item::selectFirst(['extid'], $condition);
+       if (!DBA::isResult($original)) {
                return false;
        }
 
-       $url = $item["extid"];
+       $url = $original["extid"];
 
        $client = new oauth_client_class;
        $client->oauth_version = '1.0a';
@@ -1610,7 +1590,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id)
 
 function pumpio_reachable($url)
 {
-       return Network::curl($url, false, ['timeout' => 10])->isSuccess();
+       return DI::httpRequest()->get($url, ['timeout' => 10])->isSuccess();
 }
 
 /*