X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=blogger%2Fblogger.php;h=5cf0d27b3f22397a717bd42437ed5c1fd5192e76;hb=05d2707d501b7b1cdd98b0802121e69a6df7d05d;hp=0458415e6fd508b51ef4758b848b4e57c8f9e947;hpb=ea3a9052d83f8ea99cee8438022be0b022a24cc1;p=friendica-addons.git
diff --git a/blogger/blogger.php b/blogger/blogger.php
index 0458415e..5cf0d27b 100644
--- a/blogger/blogger.php
+++ b/blogger/blogger.php
@@ -9,11 +9,8 @@
use Friendica\App;
use Friendica\Content\Text\BBCode;
use Friendica\Core\Hook;
-use Friendica\Core\L10n;
use Friendica\Core\Logger;
-use Friendica\Core\PConfig;
use Friendica\DI;
-use Friendica\Util\Network;
use Friendica\Util\XML;
function blogger_install()
@@ -26,22 +23,6 @@ function blogger_install()
Hook::register('connector_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
}
-function blogger_uninstall()
-{
- Hook::unregister('hook_fork', 'addon/blogger/blogger.php', 'blogger_hook_fork');
- Hook::unregister('post_local', 'addon/blogger/blogger.php', 'blogger_post_local');
- Hook::unregister('notifier_normal', 'addon/blogger/blogger.php', 'blogger_send');
- Hook::unregister('jot_networks', 'addon/blogger/blogger.php', 'blogger_jot_nets');
- Hook::unregister('connector_settings', 'addon/blogger/blogger.php', 'blogger_settings');
- Hook::unregister('connector_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
-
- // obsolete - remove
- Hook::unregister('post_local_end', 'addon/blogger/blogger.php', 'blogger_send');
- Hook::unregister('addon_settings', 'addon/blogger/blogger.php', 'blogger_settings');
- Hook::unregister('addon_settings_post', 'addon/blogger/blogger.php', 'blogger_settings_post');
-}
-
-
function blogger_jot_nets(App $a, array &$jotnets_fields)
{
if (!local_user()) {
@@ -53,7 +34,7 @@ function blogger_jot_nets(App $a, array &$jotnets_fields)
'type' => 'checkbox',
'field' => [
'blogger_enable',
- L10n::t('Post to blogger'),
+ DI::l10n()->t('Post to blogger'),
DI::pConfig()->get(local_user(), 'blogger', 'post_by_default')
]
];
@@ -87,51 +68,51 @@ function blogger_settings(App $a, &$s)
/* Add some HTML to the existing form */
$s .= '';
- $s .= '![](images/blogger.png)
'. L10n::t('Blogger Export').'
';
+ $s .= '![](images/blogger.png)
'. DI::l10n()->t('Blogger Export').'
';
$s .= '';
$s .= '
';
$s .= '
';
- $s .= '![](images/blogger.png)
'. L10n::t('Blogger Export').'
';
+ $s .= '![](images/blogger.png)
'. DI::l10n()->t('Blogger Export').'
';
$s .= '';
$s .= '
';
- $s .= '';
+ $s .= '';
$s .= '';
$s .= '
';
$s .= '
';
- $s .= '';
+ $s .= '';
$s .= '';
$s .= '
';
$s .= '
';
- $s .= '';
+ $s .= '';
$s .= '';
$s .= '
';
$s .= '
';
- $s .= '';
+ $s .= '';
$s .= '';
$s .= '
';
$s .= '
';
- $s .= '';
+ $s .= '';
$s .= '';
$s .= '
';
/* provide a submit button */
- $s .= '
';
+ $s .= '';
}
function blogger_settings_post(App $a, array &$b)
{
if (!empty($_POST['blogger-submit'])) {
- PConfig::set(local_user(), 'blogger', 'post', $_POST['blogger'] ?? false);
- PConfig::set(local_user(), 'blogger', 'post_by_default', $_POST['bl_bydefault'] ?? false);
- PConfig::set(local_user(), 'blogger', 'bl_username', trim($_POST['bl_username']));
- PConfig::set(local_user(), 'blogger', 'bl_password', trim($_POST['bl_password']));
- PConfig::set(local_user(), 'blogger', 'bl_blog', trim($_POST['bl_blog']));
+ DI::pConfig()->set(local_user(), 'blogger', 'post', $_POST['blogger'] ?? false);
+ DI::pConfig()->set(local_user(), 'blogger', 'post_by_default', $_POST['bl_bydefault'] ?? false);
+ DI::pConfig()->set(local_user(), 'blogger', 'bl_username', trim($_POST['bl_username']));
+ DI::pConfig()->set(local_user(), 'blogger', 'bl_password', trim($_POST['bl_password']));
+ DI::pConfig()->set(local_user(), 'blogger', 'bl_blog', trim($_POST['bl_blog']));
}
}
@@ -204,7 +185,7 @@ function blogger_send(App $a, array &$b)
$bl_blog = DI::pConfig()->get($b['uid'], 'blogger', 'bl_blog');
if ($bl_username && $bl_password && $bl_blog) {
- $title = '' . (($b['title']) ? $b['title'] : L10n::t('Post from Friendica')) . '';
+ $title = '' . (($b['title']) ? $b['title'] : DI::l10n()->t('Post from Friendica')) . '';
$post = $title . BBCode::convert($b['body']);
$post = XML::escape($post);
@@ -227,7 +208,7 @@ EOT;
Logger::log('blogger: data: ' . $xml, Logger::DATA);
if ($bl_blog !== 'test') {
- $x = Network::post($bl_blog, $xml)->getBody();
+ $x = DI::httpRequest()->post($bl_blog, $xml)->getBody();
}
Logger::log('posted to blogger: ' . (($x) ? $x : ''), Logger::DEBUG);