X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=buffer%2Fbuffer.php;h=9bbdf21e529850b09f0524494abd1eac4c6d1eb6;hb=e34b227e614c9299326ab3ddabac3befe30da7fe;hp=ac2c8b8e77cb58db243595d9e4ae26a650219d95;hpb=ea3a9052d83f8ea99cee8438022be0b022a24cc1;p=friendica-addons.git
diff --git a/buffer/buffer.php b/buffer/buffer.php
index ac2c8b8e..9bbdf21e 100644
--- a/buffer/buffer.php
+++ b/buffer/buffer.php
@@ -9,11 +9,8 @@
require 'addon/buffer/bufferapp.php';
use Friendica\App;
-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;
@@ -32,16 +29,6 @@ function buffer_install()
Hook::register('connector_settings_post', 'addon/buffer/buffer.php', 'buffer_settings_post');
}
-function buffer_uninstall()
-{
- Hook::unregister('hook_fork', 'addon/buffer/buffer.php', 'buffer_hook_fork');
- Hook::unregister('post_local', 'addon/buffer/buffer.php', 'buffer_post_local');
- Hook::unregister('notifier_normal', 'addon/buffer/buffer.php', 'buffer_send');
- Hook::unregister('jot_networks', 'addon/buffer/buffer.php', 'buffer_jot_nets');
- Hook::unregister('connector_settings', 'addon/buffer/buffer.php', 'buffer_settings');
- Hook::unregister('connector_settings_post', 'addon/buffer/buffer.php', 'buffer_settings_post');
-}
-
function buffer_module()
{
}
@@ -49,7 +36,7 @@ function buffer_module()
function buffer_content(App $a)
{
if (! local_user()) {
- notice(L10n::t('Permission denied.') . EOL);
+ notice(DI::l10n()->t('Permission denied.') . EOL);
return '';
}
@@ -78,10 +65,10 @@ function buffer_addon_admin(App $a, &$o)
$t = Renderer::getMarkupTemplate("admin.tpl", "addon/buffer/");
$o = Renderer::replaceMacros($t, [
- '$submit' => L10n::t('Save Settings'),
+ '$submit' => DI::l10n()->t('Save Settings'),
// name, label, value, help, [extra values]
- '$client_id' => ['client_id', L10n::t('Client ID'), Config::get('buffer', 'client_id'), ''],
- '$client_secret' => ['client_secret', L10n::t('Client Secret'), Config::get('buffer', 'client_secret'), ''],
+ '$client_id' => ['client_id', DI::l10n()->t('Client ID'), DI::config()->get('buffer', 'client_id'), ''],
+ '$client_secret' => ['client_secret', DI::l10n()->t('Client Secret'), DI::config()->get('buffer', 'client_secret'), ''],
]);
}
@@ -90,16 +77,14 @@ function buffer_addon_admin_post(App $a)
$client_id = (!empty($_POST['client_id']) ? Strings::escapeTags(trim($_POST['client_id'])) : '');
$client_secret = (!empty($_POST['client_secret']) ? Strings::escapeTags(trim($_POST['client_secret'])) : '');
- Config::set('buffer', 'client_id' , $client_id);
- Config::set('buffer', 'client_secret', $client_secret);
-
- info(L10n::t('Settings updated.'). EOL);
+ DI::config()->set('buffer', 'client_id' , $client_id);
+ DI::config()->set('buffer', 'client_secret', $client_secret);
}
function buffer_connect(App $a)
{
if (isset($_REQUEST["error"])) {
- $o = L10n::t('Error when registering buffer connection:')." ".$_REQUEST["error"];
+ $o = DI::l10n()->t('Error when registering buffer connection:')." ".$_REQUEST["error"];
return $o;
}
@@ -107,8 +92,8 @@ function buffer_connect(App $a)
session_start();
// Define the needed keys
- $client_id = Config::get('buffer','client_id');
- $client_secret = Config::get('buffer','client_secret');
+ $client_id = DI::config()->get('buffer','client_id');
+ $client_secret = DI::config()->get('buffer','client_secret');
// The callback URL is the script that gets called after the user authenticates with buffer
$callback_url = DI::baseUrl()->get()."/buffer/connect";
@@ -119,9 +104,9 @@ function buffer_connect(App $a)
$o = 'Connect to Buffer!';
} else {
Logger::log("buffer_connect: authenticated");
- $o = L10n::t("You are now authenticated to buffer. ");
- $o .= '
' . L10n::t("return to the connector page") . '';
- PConfig::set(local_user(), 'buffer','access_token', $buffer->access_token);
+ $o = DI::l10n()->t("You are now authenticated to buffer. ");
+ $o .= '
' . DI::l10n()->t("return to the connector page") . '';
+ DI::pConfig()->set(local_user(), 'buffer','access_token', $buffer->access_token);
}
return $o;
@@ -138,7 +123,7 @@ function buffer_jot_nets(App $a, array &$jotnets_fields)
'type' => 'checkbox',
'field' => [
'buffer_enable',
- L10n::t('Post to Buffer'),
+ DI::l10n()->t('Post to Buffer'),
DI::pConfig()->get(local_user(), 'buffer', 'post_by_default')
]
];
@@ -167,36 +152,36 @@ function buffer_settings(App $a, &$s)
/* Add some HTML to the existing form */
$s .= '';
- $s .= ''. L10n::t('Buffer Export').'
';
+ $s .= ''. DI::l10n()->t('Buffer Export').'
';
$s .= '';
$s .= '