X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=xmpp%2Fxmpp.php;h=81adec8486b0848f74b7a3fa208c998e6d55ddcc;hb=1030498c0980ebed11147c939837cb930802a0c4;hp=552f5f9e5cdf37935c6bb31560729eb6503c2da1;hpb=a26bfe79e97813ebe4c27fa3cb65c32669a9f2e5;p=friendica-addons.git diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php index 552f5f9e..81adec84 100644 --- a/xmpp/xmpp.php +++ b/xmpp/xmpp.php @@ -8,9 +8,7 @@ */ use Friendica\App; -use Friendica\Core\Config; use Friendica\Core\Hook; -use Friendica\Core\L10n; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Util\Strings; @@ -23,14 +21,6 @@ function xmpp_install() Hook::register('logged_in', 'addon/xmpp/xmpp.php', 'xmpp_login'); } -function xmpp_uninstall() -{ - Hook::unregister('addon_settings', 'addon/xmpp/xmpp.php', 'xmpp_addon_settings'); - Hook::unregister('addon_settings_post', 'addon/xmpp/xmpp.php', 'xmpp_addon_settings_post'); - Hook::unregister('page_end', 'addon/xmpp/xmpp.php', 'xmpp_script'); - Hook::unregister('logged_in', 'addon/xmpp/xmpp.php', 'xmpp_login'); -} - function xmpp_addon_settings_post() { if (!local_user() || empty($_POST['xmpp-settings-submit'])) { @@ -40,8 +30,6 @@ function xmpp_addon_settings_post() DI::pConfig()->set(local_user(), 'xmpp', 'enabled', $_POST['xmpp_enabled'] ?? false); DI::pConfig()->set(local_user(), 'xmpp', 'individual', $_POST['xmpp_individual'] ?? false); DI::pConfig()->set(local_user(), 'xmpp', 'bosh_proxy', $_POST['xmpp_bosh_proxy'] ?? ''); - - info(L10n::t('XMPP settings updated.') . EOL); } function xmpp_addon_settings(App $a, &$s) @@ -66,26 +54,26 @@ function xmpp_addon_settings(App $a, &$s) /* Add some HTML to the existing form */ $s .= ''; - $s .= '

' . L10n::t('XMPP-Chat (Jabber)') . '

'; + $s .= '

' . DI::l10n()->t('XMPP-Chat (Jabber)') . '

'; $s .= '
'; $s .= ''; } function xmpp_login() @@ -110,9 +98,9 @@ function xmpp_addon_admin(App $a, &$o) $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/xmpp/'); $o = Renderer::replaceMacros($t, [ - '$submit' => L10n::t('Save Settings'), - '$bosh_proxy' => ['bosh_proxy', L10n::t('Jabber BOSH host'), Config::get('xmpp', 'bosh_proxy'), ''], - '$central_userbase' => ['central_userbase', L10n::t('Use central userbase'), Config::get('xmpp', 'central_userbase'), L10n::t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')], + '$submit' => DI::l10n()->t('Save Settings'), + '$bosh_proxy' => ['bosh_proxy', DI::l10n()->t('Jabber BOSH host'), DI::config()->get('xmpp', 'bosh_proxy'), ''], + '$central_userbase' => ['central_userbase', DI::l10n()->t('Use central userbase'), DI::config()->get('xmpp', 'central_userbase'), DI::l10n()->t('If enabled, users will automatically login to an ejabberd server that has to be installed on this machine with synchronized credentials via the "auth_ejabberd.php" script.')], ]); } @@ -121,10 +109,8 @@ function xmpp_addon_admin_post() $bosh_proxy = (!empty($_POST['bosh_proxy']) ? trim($_POST['bosh_proxy']) : ''); $central_userbase = (!empty($_POST['central_userbase']) ? intval($_POST['central_userbase']) : false); - Config::set('xmpp', 'bosh_proxy', $bosh_proxy); - Config::set('xmpp', 'central_userbase', $central_userbase); - - info(L10n::t('Settings updated.') . EOL); + DI::config()->set('xmpp', 'bosh_proxy', $bosh_proxy); + DI::config()->set('xmpp', 'central_userbase', $central_userbase); } function xmpp_script(App $a) @@ -157,8 +143,8 @@ function xmpp_converse(App $a) DI::page()['htmlhead'] .= '' . "\n"; DI::page()['htmlhead'] .= '' . "\n"; - if (Config::get("xmpp", "central_userbase") && !DI::pConfig()->get(local_user(), "xmpp", "individual")) { - $bosh_proxy = Config::get("xmpp", "bosh_proxy"); + if (DI::config()->get("xmpp", "central_userbase") && !DI::pConfig()->get(local_user(), "xmpp", "individual")) { + $bosh_proxy = DI::config()->get("xmpp", "bosh_proxy"); $password = DI::pConfig()->get(local_user(), "xmpp", "password", '', true);