]> git.mxchange.org Git - friendica-addons.git/blobdiff - irc/irc.php
Some Renames:
[friendica-addons.git] / irc / irc.php
index 96f4a888b763990e6a0e960c4c45040e73dfef58..52778e557738d6b478b737ee621721d9fbdaab74 100644 (file)
@@ -7,10 +7,7 @@
 * Author: Tobias Diekershoff <https://f.diekershoff.de/u/tobias>
 */
 
-use Friendica\Core\Config;
 use Friendica\Core\Hook;
-use Friendica\Core\L10n;
-use Friendica\Core\PConfig;
 use Friendica\Core\Renderer;
 use Friendica\DI;
 
@@ -41,11 +38,11 @@ function irc_addon_settings(&$a,&$s) {
 
        $t = Renderer::getMarkupTemplate( "settings.tpl", "addon/irc/" );
        $s .= Renderer::replaceMacros($t, [
-               '$header' => L10n::t('IRC Settings'),
-               '$info' => L10n::t('Here you can change the system wide settings for the channels to automatically join and access via the side bar. Note the changes you do here, only effect the channel selection if you are logged in.'),
-               '$submit' => L10n::t('Save Settings'),
-               '$autochans' => [ 'autochans', L10n::t('Channel(s) to auto connect (comma separated)'), $autochans, L10n::t('List of channels that shall automatically connected to when the app is launched.')],
-               '$sitechats' => [ 'sitechats', L10n::t('Popular Channels (comma separated)'), $sitechats, L10n::t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ]
+               '$header' => DI::l10n()->t('IRC Settings'),
+               '$info' => DI::l10n()->t('Here you can change the system wide settings for the channels to automatically join and access via the side bar. Note the changes you do here, only effect the channel selection if you are logged in.'),
+               '$submit' => DI::l10n()->t('Save Settings'),
+               '$autochans' => [ 'autochans', DI::l10n()->t('Channel(s) to auto connect (comma separated)'), $autochans, DI::l10n()->t('List of channels that shall automatically connected to when the app is launched.')],
+               '$sitechats' => [ 'sitechats', DI::l10n()->t('Popular Channels (comma separated)'), $sitechats, DI::l10n()->t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ]
        ]);
 
 
@@ -59,18 +56,18 @@ function irc_addon_settings_post(&$a, &$b) {
 
        if(!empty($_POST['irc-submit'])) {
                if (isset($_POST['autochans'])) {
-                       PConfig::set(local_user(), 'irc', 'autochans', trim(($_POST['autochans'])));
+                       DI::pConfig()->set(local_user(), 'irc', 'autochans', trim(($_POST['autochans'])));
                }
                if (isset($_POST['sitechats'])) {
-                       PConfig::set(local_user(), 'irc', 'sitechats', trim($_POST['sitechats']));
+                       DI::pConfig()->set(local_user(), 'irc', 'sitechats', trim($_POST['sitechats']));
                }
                /* upid pop-up thing */
-               info(L10n::t('IRC settings saved.') . EOL);
+               info(DI::l10n()->t('IRC settings saved.') . EOL);
        }
 }
 
 function irc_app_menu($a,&$b) {
-       $b['app_menu'][] = '<div class="app-title"><a href="irc">' . L10n::t('IRC Chatroom') . '</a></div>';
+       $b['app_menu'][] = '<div class="app-title"><a href="irc">' . DI::l10n()->t('IRC Chatroom') . '</a></div>';
 }
 
 
@@ -88,9 +85,9 @@ function irc_content(&$a) {
        if (local_user()) {
            $sitechats = DI::pConfig()->get( local_user(), 'irc', 'sitechats');
            if (!$sitechats)
-               $sitechats = Config::get('irc', 'sitechats');
+               $sitechats = DI::config()->get('irc', 'sitechats');
        } else {
-           $sitechats = Config::get('irc','sitechats');
+           $sitechats = DI::config()->get('irc','sitechats');
        }
        if($sitechats)
                $chats = explode(',',$sitechats);
@@ -98,7 +95,7 @@ function irc_content(&$a) {
                $chats = ['friendica','chat','chatback','hottub','ircbar','dateroom','debian'];
 
 
-       DI::page()['aside'] .= '<div class="widget"><h3>' . L10n::t('Popular Channels') . '</h3><ul>';
+       DI::page()['aside'] .= '<div class="widget"><h3>' . DI::l10n()->t('Popular Channels') . '</h3><ul>';
        foreach($chats as $chat) {
                DI::page()['aside'] .= '<li><a href="' . DI::baseUrl()->get() . '/irc?channels=' . $chat . '" >' . '#' . $chat . '</a></li>';
        }
@@ -108,9 +105,9 @@ function irc_content(&$a) {
        if (local_user()) {
            $autochans = DI::pConfig()->get(local_user(), 'irc', 'autochans');
            if (!$autochans)
-               $autochans = Config::get('irc','autochans');
+               $autochans = DI::config()->get('irc','autochans');
        } else {
-           $autochans = Config::get('irc','autochans');
+           $autochans = DI::config()->get('irc','autochans');
        }
        if($autochans)
                $channels = $autochans;
@@ -133,19 +130,19 @@ function irc_addon_admin_post (&$a) {
                return;
 
        if($_POST['irc-submit']) {
-               Config::set('irc','autochans',trim($_POST['autochans']));
-               Config::set('irc','sitechats',trim($_POST['sitechats']));
+               DI::config()->set('irc','autochans',trim($_POST['autochans']));
+               DI::config()->set('irc','sitechats',trim($_POST['sitechats']));
                /* stupid pop-up thing */
-               info(L10n::t('IRC settings saved.') . EOL);
+               info(DI::l10n()->t('IRC settings saved.') . EOL);
        }
 }
 function irc_addon_admin (&$a, &$o) {
-       $sitechats = Config::get('irc','sitechats'); /* popular channels */
-       $autochans = Config::get('irc','autochans');  /* auto connect chans */
+       $sitechats = DI::config()->get('irc','sitechats'); /* popular channels */
+       $autochans = DI::config()->get('irc','autochans');  /* auto connect chans */
        $t = Renderer::getMarkupTemplate( "admin.tpl", "addon/irc/" );
        $o = Renderer::replaceMacros($t, [
-               '$submit' => L10n::t('Save Settings'),
-               '$autochans' => [ 'autochans', L10n::t('Channel(s) to auto connect (comma separated)'), $autochans, L10n::t('List of channels that shall automatically connected to when the app is launched.')],
-               '$sitechats' => [ 'sitechats', L10n::t('Popular Channels (comma separated)'), $sitechats, L10n::t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ]
+               '$submit' => DI::l10n()->t('Save Settings'),
+               '$autochans' => [ 'autochans', DI::l10n()->t('Channel(s) to auto connect (comma separated)'), $autochans, DI::l10n()->t('List of channels that shall automatically connected to when the app is launched.')],
+               '$sitechats' => [ 'sitechats', DI::l10n()->t('Popular Channels (comma separated)'), $sitechats, DI::l10n()->t('List of popular channels, will be displayed at the side and hotlinked for easy joining.') ]
        ]);
 }