]> git.mxchange.org Git - friendica-addons.git/blobdiff - statusnet/statusnet.php
modified: public_server/public_server.php
[friendica-addons.git] / statusnet / statusnet.php
index 0d3162efffc204b6f68b812f3996421c137a58c8..0ed0f55c048d4040a5567e4d792e2bdf11dbc3b2 100644 (file)
@@ -42,11 +42,8 @@ use Friendica\App;
 use Friendica\Content\OEmbed;
 use Friendica\Content\Text\HTML;
 use Friendica\Content\Text\Plaintext;
-use Friendica\Core\Config;
 use Friendica\Core\Hook;
-use Friendica\Core\L10n;
 use Friendica\Core\Logger;
-use Friendica\Core\PConfig;
 use Friendica\Core\Protocol;
 use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
@@ -113,7 +110,7 @@ function statusnet_jot_nets(App $a, array &$jotnets_fields)
                        'type' => 'checkbox',
                        'field' => [
                                'statusnet_enable',
-                               L10n::t('Post to GNU Social'),
+                               DI::l10n()->t('Post to GNU Social'),
                                DI::pConfig()->get(local_user(), 'statusnet', 'post_by_default')
                        ]
                ];
@@ -134,18 +131,18 @@ function statusnet_settings_post(App $a, $post)
                /*               * *
                 * if the GNU Social-disconnect checkbox is set, clear the GNU Social configuration
                 */
-               PConfig::delete(local_user(), 'statusnet', 'consumerkey');
-               PConfig::delete(local_user(), 'statusnet', 'consumersecret');
-               PConfig::delete(local_user(), 'statusnet', 'post');
-               PConfig::delete(local_user(), 'statusnet', 'post_by_default');
-               PConfig::delete(local_user(), 'statusnet', 'oauthtoken');
-               PConfig::delete(local_user(), 'statusnet', 'oauthsecret');
-               PConfig::delete(local_user(), 'statusnet', 'baseapi');
-               PConfig::delete(local_user(), 'statusnet', 'lastid');
-               PConfig::delete(local_user(), 'statusnet', 'mirror_posts');
-               PConfig::delete(local_user(), 'statusnet', 'import');
-               PConfig::delete(local_user(), 'statusnet', 'create_user');
-               PConfig::delete(local_user(), 'statusnet', 'own_url');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'consumerkey');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'consumersecret');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'post');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'post_by_default');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'oauthtoken');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'oauthsecret');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'baseapi');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'lastid');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'mirror_posts');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'import');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'create_user');
+               DI::pConfig()->delete(local_user(), 'statusnet', 'own_url');
        } else {
                if (isset($_POST['statusnet-preconf-apiurl'])) {
                        /*                       * *
@@ -153,18 +150,18 @@ function statusnet_settings_post(App $a, $post)
                         * use them. All the data are available in the global config.
                         * Check the API Url never the less and blame the admin if it's not working ^^
                         */
-                       $globalsn = Config::get('statusnet', 'sites');
+                       $globalsn = DI::config()->get('statusnet', 'sites');
                        foreach ($globalsn as $asn) {
                                if ($asn['apiurl'] == $_POST['statusnet-preconf-apiurl']) {
                                        $apibase = $asn['apiurl'];
                                        $c = Network::fetchUrl($apibase . 'statusnet/version.xml');
                                        if (strlen($c) > 0) {
-                                               PConfig::set(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey']);
-                                               PConfig::set(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret']);
-                                               PConfig::set(local_user(), 'statusnet', 'baseapi', $asn['apiurl']);
-                                               //PConfig::set(local_user(), 'statusnet', 'application_name', $asn['applicationname'] );
+                                               DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $asn['consumerkey']);
+                                               DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $asn['consumersecret']);
+                                               DI::pConfig()->set(local_user(), 'statusnet', 'baseapi', $asn['apiurl']);
+                                               //DI::pConfig()->set(local_user(), 'statusnet', 'application_name', $asn['applicationname'] );
                                        } else {
-                                               notice(L10n::t('Please contact your site administrator.<br />The provided API URL is not valid.') . EOL . $asn['apiurl'] . EOL);
+                                               notice(DI::l10n()->t('Please contact your site administrator.<br />The provided API URL is not valid.') . EOL . $asn['apiurl'] . EOL);
                                        }
                                }
                        }
@@ -178,22 +175,22 @@ function statusnet_settings_post(App $a, $post)
                                $c = Network::fetchUrl($apibase . 'statusnet/version.xml');
                                if (strlen($c) > 0) {
                                        //  ok the API path is correct, let's save the settings
-                                       PConfig::set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
-                                       PConfig::set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
-                                       PConfig::set(local_user(), 'statusnet', 'baseapi', $apibase);
-                                       //PConfig::set(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] );
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'baseapi', $apibase);
+                                       //DI::pConfig()->set(local_user(), 'statusnet', 'application_name', $_POST['statusnet-applicationname'] );
                                } else {
                                        //  the API path is not correct, maybe missing trailing / ?
                                        $apibase = $apibase . '/';
                                        $c = Network::fetchUrl($apibase . 'statusnet/version.xml');
                                        if (strlen($c) > 0) {
                                                //  ok the API path is now correct, let's save the settings
-                                               PConfig::set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
-                                               PConfig::set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
-                                               PConfig::set(local_user(), 'statusnet', 'baseapi', $apibase);
+                                               DI::pConfig()->set(local_user(), 'statusnet', 'consumerkey', $_POST['statusnet-consumerkey']);
+                                               DI::pConfig()->set(local_user(), 'statusnet', 'consumersecret', $_POST['statusnet-consumersecret']);
+                                               DI::pConfig()->set(local_user(), 'statusnet', 'baseapi', $apibase);
                                        } else {
                                                //  still not the correct API base, let's do noting
-                                               notice(L10n::t('We could not contact the GNU Social API with the Path you entered.') . EOL);
+                                               notice(DI::l10n()->t('We could not contact the GNU Social API with the Path you entered.') . EOL);
                                        }
                                }
                                DI::baseUrl()->redirect('settings/connectors');
@@ -209,25 +206,25 @@ function statusnet_settings_post(App $a, $post)
                                        $connection = new StatusNetOAuth($api, $ckey, $csecret, $_POST['statusnet-token'], $_POST['statusnet-token2']);
                                        $token = $connection->getAccessToken($_POST['statusnet-pin']);
                                        //  ok, now that we have the Access Token, save them in the user config
-                                       PConfig::set(local_user(), 'statusnet', 'oauthtoken', $token['oauth_token']);
-                                       PConfig::set(local_user(), 'statusnet', 'oauthsecret', $token['oauth_token_secret']);
-                                       PConfig::set(local_user(), 'statusnet', 'post', 1);
-                                       PConfig::set(local_user(), 'statusnet', 'post_taglinks', 1);
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'oauthtoken', $token['oauth_token']);
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'oauthsecret', $token['oauth_token_secret']);
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'post', 1);
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'post_taglinks', 1);
                                        //  reload the Addon Settings page, if we don't do it see Bug #42
                                        DI::baseUrl()->redirect('settings/connectors');
                                } else {
                                        //  if no PIN is supplied in the POST variables, the user has changed the setting
                                        //  to post a dent for every new __public__ posting to the wall
-                                       PConfig::set(local_user(), 'statusnet', 'post', intval($_POST['statusnet-enable']));
-                                       PConfig::set(local_user(), 'statusnet', 'post_by_default', intval($_POST['statusnet-default']));
-                                       PConfig::set(local_user(), 'statusnet', 'mirror_posts', intval($_POST['statusnet-mirror']));
-                                       PConfig::set(local_user(), 'statusnet', 'import', intval($_POST['statusnet-import']));
-                                       PConfig::set(local_user(), 'statusnet', 'create_user', intval($_POST['statusnet-create_user']));
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'post', intval($_POST['statusnet-enable']));
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'post_by_default', intval($_POST['statusnet-default']));
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'mirror_posts', intval($_POST['statusnet-mirror']));
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'import', intval($_POST['statusnet-import']));
+                                       DI::pConfig()->set(local_user(), 'statusnet', 'create_user', intval($_POST['statusnet-create_user']));
 
                                        if (!intval($_POST['statusnet-mirror']))
-                                               PConfig::delete(local_user(), 'statusnet', 'lastid');
+                                               DI::pConfig()->delete(local_user(), 'statusnet', 'lastid');
 
-                                       info(L10n::t('GNU Social settings updated.') . EOL);
+                                       info(DI::l10n()->t('GNU Social settings updated.') . EOL);
                                }
                        }
                }
@@ -268,18 +265,18 @@ function statusnet_settings(App $a, &$s)
        $css = (($enabled) ? '' : '-disabled');
 
        $s .= '<span id="settings_statusnet_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_statusnet_expanded\'); openClose(\'settings_statusnet_inflated\');">';
-       $s .= '<img class="connector' . $css . '" src="images/gnusocial.png" /><h3 class="connector">' . L10n::t('GNU Social Import/Export/Mirror') . '</h3>';
+       $s .= '<img class="connector' . $css . '" src="images/gnusocial.png" /><h3 class="connector">' . DI::l10n()->t('GNU Social Import/Export/Mirror') . '</h3>';
        $s .= '</span>';
        $s .= '<div id="settings_statusnet_expanded" class="settings-block" style="display: none;">';
        $s .= '<span class="fakelink" onclick="openClose(\'settings_statusnet_expanded\'); openClose(\'settings_statusnet_inflated\');">';
-       $s .= '<img class="connector' . $css . '" src="images/gnusocial.png" /><h3 class="connector">' . L10n::t('GNU Social Import/Export/Mirror') . '</h3>';
+       $s .= '<img class="connector' . $css . '" src="images/gnusocial.png" /><h3 class="connector">' . DI::l10n()->t('GNU Social Import/Export/Mirror') . '</h3>';
        $s .= '</span>';
 
        if ((!$ckey) && (!$csecret)) {
                /*               * *
                 * no consumer keys
                 */
-               $globalsn = Config::get('statusnet', 'sites');
+               $globalsn = DI::config()->get('statusnet', 'sites');
                /*               * *
                 * lets check if we have one or more globally configured GNU Social
                 * server OAuth credentials in the configuration. If so offer them
@@ -287,31 +284,31 @@ function statusnet_settings(App $a, &$s)
                 * ignore this option entirely.
                 */
                if (!$globalsn == null) {
-                       $s .= '<h4>' . L10n::t('Globally Available GNU Social OAuthKeys') . '</h4>';
-                       $s .= '<p>' . L10n::t("There are preconfigured OAuth key pairs for some GNU Social servers available. If you are using one of them, please use these credentials. If not feel free to connect to any other GNU Social instance \x28see below\x29.") . '</p>';
+                       $s .= '<h4>' . DI::l10n()->t('Globally Available GNU Social OAuthKeys') . '</h4>';
+                       $s .= '<p>' . DI::l10n()->t("There are preconfigured OAuth key pairs for some GNU Social servers available. If you are using one of them, please use these credentials. If not feel free to connect to any other GNU Social instance \x28see below\x29.") . '</p>';
                        $s .= '<div id="statusnet-preconf-wrapper">';
                        foreach ($globalsn as $asn) {
                                $s .= '<input type="radio" name="statusnet-preconf-apiurl" value="' . $asn['apiurl'] . '">' . $asn['sitename'] . '<br />';
                        }
                        $s .= '<p></p><div class="clear"></div></div>';
-                       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
+                       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div>';
                }
-               $s .= '<h4>' . L10n::t('Provide your own OAuth Credentials') . '</h4>';
-               $s .= '<p>' . L10n::t('No consumer key pair for GNU Social found. Register your Friendica Account as an desktop client on your GNU Social account, copy the consumer key pair here and enter the API base root.<br />Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendica installation at your favorited GNU Social installation.') . '</p>';
+               $s .= '<h4>' . DI::l10n()->t('Provide your own OAuth Credentials') . '</h4>';
+               $s .= '<p>' . DI::l10n()->t('No consumer key pair for GNU Social found. Register your Friendica Account as an desktop client on your GNU Social account, copy the consumer key pair here and enter the API base root.<br />Before you register your own OAuth key pair ask the administrator if there is already a key pair for this Friendica installation at your favorited GNU Social installation.') . '</p>';
                $s .= '<div id="statusnet-consumer-wrapper">';
-               $s .= '<label id="statusnet-consumerkey-label" for="statusnet-consumerkey">' . L10n::t('OAuth Consumer Key') . '</label>';
+               $s .= '<label id="statusnet-consumerkey-label" for="statusnet-consumerkey">' . DI::l10n()->t('OAuth Consumer Key') . '</label>';
                $s .= '<input id="statusnet-consumerkey" type="text" name="statusnet-consumerkey" size="35" /><br />';
                $s .= '<div class="clear"></div>';
-               $s .= '<label id="statusnet-consumersecret-label" for="statusnet-consumersecret">' . L10n::t('OAuth Consumer Secret') . '</label>';
+               $s .= '<label id="statusnet-consumersecret-label" for="statusnet-consumersecret">' . DI::l10n()->t('OAuth Consumer Secret') . '</label>';
                $s .= '<input id="statusnet-consumersecret" type="text" name="statusnet-consumersecret" size="35" /><br />';
                $s .= '<div class="clear"></div>';
-               $s .= '<label id="statusnet-baseapi-label" for="statusnet-baseapi">' . L10n::t("Base API Path \x28remember the trailing /\x29") . '</label>';
+               $s .= '<label id="statusnet-baseapi-label" for="statusnet-baseapi">' . DI::l10n()->t("Base API Path \x28remember the trailing /\x29") . '</label>';
                $s .= '<input id="statusnet-baseapi" type="text" name="statusnet-baseapi" size="35" /><br />';
                $s .= '<div class="clear"></div>';
-               //$s .= '<label id="statusnet-applicationname-label" for="statusnet-applicationname">'.L10n::t('GNU Socialapplication name').'</label>';
+               //$s .= '<label id="statusnet-applicationname-label" for="statusnet-applicationname">'.DI::l10n()->t('GNU Socialapplication name').'</label>';
                //$s .= '<input id="statusnet-applicationname" type="text" name="statusnet-applicationname" size="35" /><br />';
                $s .= '<p></p><div class="clear"></div>';
-               $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
+               $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div>';
                $s .= '</div>';
        } else {
                /*               * *
@@ -330,22 +327,22 @@ function statusnet_settings(App $a, &$s)
                        /*                       * *
                         *  make some nice form
                         */
-                       $s .= '<p>' . L10n::t('To connect to your GNU Social account click the button below to get a security code from GNU Social which you have to copy into the input box below and submit the form. Only your <strong>public</strong> posts will be posted to GNU Social.') . '</p>';
-                       $s .= '<a href="' . $connection->getAuthorizeURL($token, False) . '" target="_statusnet"><img src="addon/statusnet/signinwithstatusnet.png" alt="' . L10n::t('Log in with GNU Social') . '"></a>';
+                       $s .= '<p>' . DI::l10n()->t('To connect to your GNU Social account click the button below to get a security code from GNU Social which you have to copy into the input box below and submit the form. Only your <strong>public</strong> posts will be posted to GNU Social.') . '</p>';
+                       $s .= '<a href="' . $connection->getAuthorizeURL($token, False) . '" target="_statusnet"><img src="addon/statusnet/signinwithstatusnet.png" alt="' . DI::l10n()->t('Log in with GNU Social') . '"></a>';
                        $s .= '<div id="statusnet-pin-wrapper">';
-                       $s .= '<label id="statusnet-pin-label" for="statusnet-pin">' . L10n::t('Copy the security code from GNU Social here') . '</label>';
+                       $s .= '<label id="statusnet-pin-label" for="statusnet-pin">' . DI::l10n()->t('Copy the security code from GNU Social here') . '</label>';
                        $s .= '<input id="statusnet-pin" type="text" name="statusnet-pin" />';
                        $s .= '<input id="statusnet-token" type="hidden" name="statusnet-token" value="' . $token . '" />';
                        $s .= '<input id="statusnet-token2" type="hidden" name="statusnet-token2" value="' . $request_token['oauth_token_secret'] . '" />';
                        $s .= '</div><div class="clear"></div>';
-                       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
-                       $s .= '<h4>' . L10n::t('Cancel Connection Process') . '</h4>';
+                       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div>';
+                       $s .= '<h4>' . DI::l10n()->t('Cancel Connection Process') . '</h4>';
                        $s .= '<div id="statusnet-cancel-wrapper">';
-                       $s .= '<p>' . L10n::t('Current GNU Social API is') . ': ' . $api . '</p>';
-                       $s .= '<label id="statusnet-cancel-label" for="statusnet-cancel">' . L10n::t('Cancel GNU Social Connection') . '</label>';
+                       $s .= '<p>' . DI::l10n()->t('Current GNU Social API is') . ': ' . $api . '</p>';
+                       $s .= '<label id="statusnet-cancel-label" for="statusnet-cancel">' . DI::l10n()->t('Cancel GNU Social Connection') . '</label>';
                        $s .= '<input id="statusnet-cancel" type="checkbox" name="statusnet-disconnect" value="1" />';
                        $s .= '</div><div class="clear"></div>';
-                       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
+                       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div>';
                } else {
                        /*                       * *
                         *  we have an OAuth key / secret pair for the user
@@ -354,45 +351,45 @@ function statusnet_settings(App $a, &$s)
                        $connection = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
                        $details = $connection->get('account/verify_credentials');
                        if (!empty($details)) {
-                               $s .= '<div id="statusnet-info" ><img id="statusnet-avatar" src="' . $details->profile_image_url . '" /><p id="statusnet-info-block">' . L10n::t('Currently connected to: ') . '<a href="' . $details->statusnet_profile_url . '" target="_statusnet">' . $details->screen_name . '</a><br /><em>' . $details->description . '</em></p></div>';
+                               $s .= '<div id="statusnet-info" ><img id="statusnet-avatar" src="' . $details->profile_image_url . '" /><p id="statusnet-info-block">' . DI::l10n()->t('Currently connected to: ') . '<a href="' . $details->statusnet_profile_url . '" target="_statusnet">' . $details->screen_name . '</a><br /><em>' . $details->description . '</em></p></div>';
                        }
-                       $s .= '<p>' . L10n::t('If enabled all your <strong>public</strong> postings can be posted to the associated GNU Social account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.') . '</p>';
+                       $s .= '<p>' . DI::l10n()->t('If enabled all your <strong>public</strong> postings can be posted to the associated GNU Social account. You can choose to do so by default (here) or for every posting separately in the posting options when writing the entry.') . '</p>';
                        if ($a->user['hidewall']) {
-                               $s .= '<p>' . L10n::t('<strong>Note</strong>: Due your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to GNU Social will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '</p>';
+                               $s .= '<p>' . DI::l10n()->t('<strong>Note</strong>: Due your privacy settings (<em>Hide your profile details from unknown viewers?</em>) the link potentially included in public postings relayed to GNU Social will lead the visitor to a blank page informing the visitor that the access to your profile has been restricted.') . '</p>';
                        }
                        $s .= '<div id="statusnet-enable-wrapper">';
-                       $s .= '<label id="statusnet-enable-label" for="statusnet-checkbox">' . L10n::t('Allow posting to GNU Social') . '</label>';
+                       $s .= '<label id="statusnet-enable-label" for="statusnet-checkbox">' . DI::l10n()->t('Allow posting to GNU Social') . '</label>';
                        $s .= '<input id="statusnet-checkbox" type="checkbox" name="statusnet-enable" value="1" ' . $checked . '/>';
                        $s .= '<div class="clear"></div>';
-                       $s .= '<label id="statusnet-default-label" for="statusnet-default">' . L10n::t('Send public postings to GNU Social by default') . '</label>';
+                       $s .= '<label id="statusnet-default-label" for="statusnet-default">' . DI::l10n()->t('Send public postings to GNU Social by default') . '</label>';
                        $s .= '<input id="statusnet-default" type="checkbox" name="statusnet-default" value="1" ' . $defchecked . '/>';
                        $s .= '<div class="clear"></div>';
 
-                       $s .= '<label id="statusnet-mirror-label" for="statusnet-mirror">' . L10n::t('Mirror all posts from GNU Social that are no replies or repeated messages') . '</label>';
+                       $s .= '<label id="statusnet-mirror-label" for="statusnet-mirror">' . DI::l10n()->t('Mirror all posts from GNU Social that are no replies or repeated messages') . '</label>';
                        $s .= '<input id="statusnet-mirror" type="checkbox" name="statusnet-mirror" value="1" ' . $mirrorchecked . '/>';
 
                        $s .= '<div class="clear"></div>';
                        $s .= '</div>';
 
-                       $s .= '<label id="statusnet-import-label" for="statusnet-import">' . L10n::t('Import the remote timeline') . '</label>';
+                       $s .= '<label id="statusnet-import-label" for="statusnet-import">' . DI::l10n()->t('Import the remote timeline') . '</label>';
                        //$s .= '<input id="statusnet-import" type="checkbox" name="statusnet-import" value="1" '. $importchecked . '/>';
 
                        $s .= '<select name="statusnet-import" id="statusnet-import" />';
-                       $s .= '<option value="0" ' . $importselected[0] . '>' . L10n::t("Disabled") . '</option>';
-                       $s .= '<option value="1" ' . $importselected[1] . '>' . L10n::t("Full Timeline") . '</option>';
-                       $s .= '<option value="2" ' . $importselected[2] . '>' . L10n::t("Only Mentions") . '</option>';
+                       $s .= '<option value="0" ' . $importselected[0] . '>' . DI::l10n()->t("Disabled") . '</option>';
+                       $s .= '<option value="1" ' . $importselected[1] . '>' . DI::l10n()->t("Full Timeline") . '</option>';
+                       $s .= '<option value="2" ' . $importselected[2] . '>' . DI::l10n()->t("Only Mentions") . '</option>';
                        $s .= '</select>';
                        $s .= '<div class="clear"></div>';
                        /*
-                         $s .= '<label id="statusnet-create_user-label" for="statusnet-create_user">'.L10n::t('Automatically create contacts').'</label>';
+                         $s .= '<label id="statusnet-create_user-label" for="statusnet-create_user">'.DI::l10n()->t('Automatically create contacts').'</label>';
                          $s .= '<input id="statusnet-create_user" type="checkbox" name="statusnet-create_user" value="1" '. $create_userchecked . '/>';
                          $s .= '<div class="clear"></div>';
                         */
                        $s .= '<div id="statusnet-disconnect-wrapper">';
-                       $s .= '<label id="statusnet-disconnect-label" for="statusnet-disconnect">' . L10n::t('Clear OAuth configuration') . '</label>';
+                       $s .= '<label id="statusnet-disconnect-label" for="statusnet-disconnect">' . DI::l10n()->t('Clear OAuth configuration') . '</label>';
                        $s .= '<input id="statusnet-disconnect" type="checkbox" name="statusnet-disconnect" value="1" />';
                        $s .= '</div><div class="clear"></div>';
-                       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div>';
+                       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="statusnet-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div>';
                }
        }
        $s .= '</div><div class="clear"></div>';
@@ -597,7 +594,7 @@ function statusnet_post_hook(App $a, &$b)
                $dent = new StatusNetOAuth($api, $ckey, $csecret, $otoken, $osecret);
                $max_char = $dent->get_maxlength(); // max. length for a dent
 
-               PConfig::set($b['uid'], 'statusnet', 'max_char', $max_char);
+               DI::pConfig()->set($b['uid'], 'statusnet', 'max_char', $max_char);
 
                $tempfile = "";
                $msgarr = ItemContent::getPlaintextPost($b, $max_char, true, 7);
@@ -642,7 +639,7 @@ function statusnet_post_hook(App $a, &$b)
                                "\nmessage: " . $msg . "\nOriginal post: " . print_r($b, true) . "\nPost Data: " . print_r($postdata, true), Logger::DEBUG);
 
                        if (!empty($result->source)) {
-                               PConfig::set($b["uid"], "statusnet", "application_name", strip_tags($result->source));
+                               DI::pConfig()->set($b["uid"], "statusnet", "application_name", strip_tags($result->source));
                        }
 
                        if (!empty($result->error)) {
@@ -687,18 +684,18 @@ function statusnet_addon_admin_post(App $a)
                }
        }
 
-       $sites = Config::set('statusnet', 'sites', $sites);
+       $sites = DI::config()->set('statusnet', 'sites', $sites);
 }
 
 function statusnet_addon_admin(App $a, &$o)
 {
-       $sites = Config::get('statusnet', 'sites');
+       $sites = DI::config()->get('statusnet', 'sites');
        $sitesform = [];
        if (is_array($sites)) {
                foreach ($sites as $id => $s) {
                        $sitesform[] = [
                                'sitename' => ["sitename[$id]", "Site name", $s['sitename'], ""],
-                               'apiurl' => ["apiurl[$id]", "Api url", $s['apiurl'], L10n::t("Base API Path \x28remember the trailing /\x29")],
+                               'apiurl' => ["apiurl[$id]", "Api url", $s['apiurl'], DI::l10n()->t("Base API Path \x28remember the trailing /\x29")],
                                'secret' => ["secret[$id]", "Secret", $s['consumersecret'], ""],
                                'key' => ["key[$id]", "Key", $s['consumerkey'], ""],
                                //'applicationname' => Array("applicationname[$id]", "Application name", $s['applicationname'], ""),
@@ -709,16 +706,16 @@ function statusnet_addon_admin(App $a, &$o)
        /* empty form to add new site */
        $id = count($sitesform);
        $sitesform[] = [
-               'sitename' => ["sitename[$id]", L10n::t("Site name"), "", ""],
-               'apiurl' => ["apiurl[$id]", "Api url", "", L10n::t("Base API Path \x28remember the trailing /\x29")],
-               'secret' => ["secret[$id]", L10n::t("Consumer Secret"), "", ""],
-               'key' => ["key[$id]", L10n::t("Consumer Key"), "", ""],
-               //'applicationname' => Array("applicationname[$id]", L10n::t("Application name"), "", ""),
+               'sitename' => ["sitename[$id]", DI::l10n()->t("Site name"), "", ""],
+               'apiurl' => ["apiurl[$id]", "Api url", "", DI::l10n()->t("Base API Path \x28remember the trailing /\x29")],
+               'secret' => ["secret[$id]", DI::l10n()->t("Consumer Secret"), "", ""],
+               'key' => ["key[$id]", DI::l10n()->t("Consumer Key"), "", ""],
+               //'applicationname' => Array("applicationname[$id]", DI::l10n()->t("Application name"), "", ""),
        ];
 
        $t = Renderer::getMarkupTemplate("admin.tpl", "addon/statusnet/");
        $o = Renderer::replaceMacros($t, [
-               '$submit' => L10n::t('Save Settings'),
+               '$submit' => DI::l10n()->t('Save Settings'),
                '$sites' => $sitesform,
        ]);
 }
@@ -768,9 +765,9 @@ function statusnet_prepare_body(App $a, &$b)
 
 function statusnet_cron(App $a, $b)
 {
-       $last = Config::get('statusnet', 'last_poll');
+       $last = DI::config()->get('statusnet', 'last_poll');
 
-       $poll_interval = intval(Config::get('statusnet', 'poll_interval'));
+       $poll_interval = intval(DI::config()->get('statusnet', 'poll_interval'));
        if (!$poll_interval) {
                $poll_interval = STATUSNET_DEFAULT_POLL_INTERVAL;
        }
@@ -792,7 +789,7 @@ function statusnet_cron(App $a, $b)
                }
        }
 
-       $abandon_days = intval(Config::get('system', 'account_abandon_days'));
+       $abandon_days = intval(DI::config()->get('system', 'account_abandon_days'));
        if ($abandon_days < 1) {
                $abandon_days = 0;
        }
@@ -817,7 +814,7 @@ function statusnet_cron(App $a, $b)
 
        Logger::log('statusnet: cron_end');
 
-       Config::set('statusnet', 'last_poll', time());
+       DI::config()->set('statusnet', 'last_poll', time());
 }
 
 function statusnet_fetchtimeline(App $a, $uid)
@@ -835,7 +832,7 @@ function statusnet_fetchtimeline(App $a, $uid)
        //  hostname of the node if neither one is set.
        $application_name = DI::pConfig()->get($uid, 'statusnet', 'application_name');
        if ($application_name == "") {
-               $application_name = Config::get('statusnet', 'application_name');
+               $application_name = DI::config()->get('statusnet', 'application_name');
        }
        if ($application_name == "") {
                $application_name = DI::baseUrl()->getHostname();
@@ -925,7 +922,7 @@ function statusnet_fetchtimeline(App $a, $uid)
                        }
                }
        }
-       PConfig::set($uid, 'statusnet', 'lastid', $lastid);
+       DI::pConfig()->set($uid, 'statusnet', 'lastid', $lastid);
 }
 
 function statusnet_address($contact)
@@ -1350,7 +1347,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
                                }
                        }
                }
-               PConfig::set($uid, 'statusnet', 'lasthometimelineid', $lastid);
+               DI::pConfig()->set($uid, 'statusnet', 'lasthometimelineid', $lastid);
        }
 
        // Fetching mentions
@@ -1401,7 +1398,7 @@ function statusnet_fetchhometimeline(App $a, $uid, $mode = 1)
                }
        }
 
-       PConfig::set($uid, 'statusnet', 'lastmentionid', $lastid);
+       DI::pConfig()->set($uid, 'statusnet', 'lastmentionid', $lastid);
 }
 
 function statusnet_complete_conversation(App $a, $uid, $self, $create_user, $nick, $conversation)
@@ -1566,7 +1563,7 @@ function statusnet_fetch_own_contact(App $a, $uid)
                        return false;
                }
 
-               PConfig::set($uid, 'statusnet', 'own_url', Strings::normaliseLink($user->statusnet_profile_url));
+               DI::pConfig()->set($uid, 'statusnet', 'own_url', Strings::normaliseLink($user->statusnet_profile_url));
 
                $contact_id = statusnet_fetch_contact($uid, $user, true);
        } else {
@@ -1575,7 +1572,7 @@ function statusnet_fetch_own_contact(App $a, $uid)
                if (DBA::isResult($r)) {
                        $contact_id = $r[0]["id"];
                } else {
-                       PConfig::delete($uid, 'statusnet', 'own_url');
+                       DI::pConfig()->delete($uid, 'statusnet', 'own_url');
                }
        }
        return $contact_id;