X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=xmpp%2Fxmpp.php;h=d80abb64cf1e7309adaf23c7414adc8facfb57cb;hb=7f1fda43aea76a01dfaffba565af94cd2eb28ead;hp=ba8c27c7f80d39d8072e27486db4c425937d7944;hpb=461b3db9f449fdb1ce780a337cf2f1bb7aa35ac5;p=friendica-addons.git
diff --git a/xmpp/xmpp.php b/xmpp/xmpp.php
index ba8c27c7..d80abb64 100644
--- a/xmpp/xmpp.php
+++ b/xmpp/xmpp.php
@@ -1,44 +1,48 @@
*/
+
use Friendica\App;
+use Friendica\Core\Addon;
use Friendica\Core\Config;
+use Friendica\Core\L10n;
use Friendica\Core\PConfig;
+use Friendica\Core\Renderer;
function xmpp_install()
{
- register_hook('plugin_settings', 'addon/xmpp/xmpp.php', 'xmpp_plugin_settings');
- register_hook('plugin_settings_post', 'addon/xmpp/xmpp.php', 'xmpp_plugin_settings_post');
- register_hook('page_end', 'addon/xmpp/xmpp.php', 'xmpp_script');
- register_hook('logged_in', 'addon/xmpp/xmpp.php', 'xmpp_login');
+ Addon::registerHook('addon_settings', 'addon/xmpp/xmpp.php', 'xmpp_addon_settings');
+ Addon::registerHook('addon_settings_post', 'addon/xmpp/xmpp.php', 'xmpp_addon_settings_post');
+ Addon::registerHook('page_end', 'addon/xmpp/xmpp.php', 'xmpp_script');
+ Addon::registerHook('logged_in', 'addon/xmpp/xmpp.php', 'xmpp_login');
}
function xmpp_uninstall()
{
- unregister_hook('plugin_settings', 'addon/xmpp/xmpp.php', 'xmpp_plugin_settings');
- unregister_hook('plugin_settings_post', 'addon/xmpp/xmpp.php', 'xmpp_plugin_settings_post');
- unregister_hook('page_end', 'addon/xmpp/xmpp.php', 'xmpp_script');
- unregister_hook('logged_in', 'addon/xmpp/xmpp.php', 'xmpp_login');
+ Addon::unregisterHook('addon_settings', 'addon/xmpp/xmpp.php', 'xmpp_addon_settings');
+ Addon::unregisterHook('addon_settings_post', 'addon/xmpp/xmpp.php', 'xmpp_addon_settings_post');
+ Addon::unregisterHook('page_end', 'addon/xmpp/xmpp.php', 'xmpp_script');
+ Addon::unregisterHook('logged_in', 'addon/xmpp/xmpp.php', 'xmpp_login');
}
-function xmpp_plugin_settings_post()
+function xmpp_addon_settings_post()
{
- if (!local_user() || (!x($_POST, 'xmpp-settings-submit'))) {
+ if (!local_user() || empty($_POST['xmpp-settings-submit'])) {
return;
}
- PConfig::set(local_user(), 'xmpp', 'enabled', intval($_POST['xmpp_enabled']));
- PConfig::set(local_user(), 'xmpp', 'individual', intval($_POST['xmpp_individual']));
- PConfig::set(local_user(), 'xmpp', 'bosh_proxy', $_POST['xmpp_bosh_proxy']);
- info(t('XMPP settings updated.') . EOL);
+ PConfig::set(local_user(), 'xmpp', 'enabled', defaults($_POST, 'xmpp_enabled', false));
+ PConfig::set(local_user(), 'xmpp', 'individual', defaults($_POST, 'xmpp_individual', false));
+ PConfig::set(local_user(), 'xmpp', 'bosh_proxy', defaults($_POST, 'xmpp_bosh_proxy', ''));
+
+ info(L10n::t('XMPP settings updated.') . EOL);
}
-function xmpp_plugin_settings(App $a, &$s)
+function xmpp_addon_settings(App $a, &$s)
{
if (!local_user()) {
return;
@@ -46,7 +50,7 @@ function xmpp_plugin_settings(App $a, &$s)
/* Add our stylesheet to the xmpp so we can make our settings look nice */
- $a->page['htmlhead'] .= '' . "\r\n";
+ $a->page['htmlhead'] .= '' . "\r\n";
/* Get the current state of our config variable */
@@ -60,26 +64,26 @@ function xmpp_plugin_settings(App $a, &$s)
/* Add some HTML to the existing form */
$s .= '';
- $s .= '' . t('XMPP-Chat (Jabber)') . '
';
+ $s .= '' . L10n::t('XMPP-Chat (Jabber)') . '
';
$s .= '';
$s .= '