]> git.mxchange.org Git - friendica-addons.git/blobdiff - irc/irc.php
Updated transifex config
[friendica-addons.git] / irc / irc.php
index 6aeacbe65ce4c90d59ef3f7b262eb09607461b2e..eab755c8ee5fbdc2b35e64a4fd79d2a35f7fc627 100644 (file)
@@ -6,20 +6,21 @@
 * Author: tony baldwin <https://free-haven.org/profile/tony>
 * Author: Tobias Diekershoff <https://f.diekershoff.de/u/tobias>
 */
-use Friendica\Core\Addon;
 use Friendica\Core\Config;
+use Friendica\Core\Hook;
 use Friendica\Core\L10n;
 use Friendica\Core\PConfig;
+use Friendica\Core\Renderer;
 
 function irc_install() {
-       Addon::registerHook('app_menu', 'addon/irc/irc.php', 'irc_app_menu');
-       Addon::registerHook('addon_settings', 'addon/irc/irc.php', 'irc_addon_settings');
-       Addon::registerHook('addon_settings_post', 'addon/irc/irc.php', 'irc_addon_settings_post');
+       Hook::register('app_menu', 'addon/irc/irc.php', 'irc_app_menu');
+       Hook::register('addon_settings', 'addon/irc/irc.php', 'irc_addon_settings');
+       Hook::register('addon_settings_post', 'addon/irc/irc.php', 'irc_addon_settings_post');
 }
 
 function irc_uninstall() {
-       Addon::unregisterHook('app_menu', 'addon/irc/irc.php', 'irc_app_menu');
-       Addon::unregisterHook('addon_settings', 'addon/irc/irc.php', 'irc_addon_settings');
+       Hook::unregister('app_menu', 'addon/irc/irc.php', 'irc_app_menu');
+       Hook::unregister('addon_settings', 'addon/irc/irc.php', 'irc_addon_settings');
 
 }
 
@@ -30,14 +31,14 @@ function irc_addon_settings(&$a,&$s) {
 
     /* Add our stylesheet to the page so we can make our settings look nice */
 
-//     $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->get_baseurl() . '/addon/irc/irc.css' . '" media="all" />' . "\r\n";
+//     $a->page['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . $a->getBaseURL() . '/addon/irc/irc.css' . '" media="all" />' . "\r\n";
 
     /* setting popular channels, auto connect channels */
        $sitechats = PConfig::get( local_user(), 'irc','sitechats'); /* popular channels */
        $autochans = PConfig::get( local_user(), 'irc','autochans');  /* auto connect chans */
 
-       $t = get_markup_template( "settings.tpl", "addon/irc/" );
-       $s .= replace_macros($t, [
+       $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'),
@@ -74,7 +75,7 @@ function irc_module() {
 
 function irc_content(&$a) {
 
-       $baseurl = $a->get_baseurl() . '/addon/irc';
+       $baseurl = $a->getBaseURL() . '/addon/irc';
        $o = '';
 
        /* set the list of popular channels */
@@ -93,7 +94,7 @@ function irc_content(&$a) {
 
        $a->page['aside'] .= '<div class="widget"><h3>' . L10n::t('Popular Channels') . '</h3><ul>';
        foreach($chats as $chat) {
-               $a->page['aside'] .= '<li><a href="' . $a->get_baseurl() . '/irc?channels=' . $chat . '" >' . '#' . $chat . '</a></li>';
+               $a->page['aside'] .= '<li><a href="' . $a->getBaseURL() . '/irc?channels=' . $chat . '" >' . '#' . $chat . '</a></li>';
        }
        $a->page['aside'] .= '</ul></div>';
 
@@ -108,7 +109,7 @@ function irc_content(&$a) {
        if($autochans)
                $channels = $autochans;
        else
-               $channels = ((x($_GET,'channels')) ? $_GET['channels'] : 'friendica');
+               $channels = defaults($_GET, 'channels', 'friendica');
 
 /* add the chatroom frame and some html */
   $o .= <<< EOT
@@ -135,8 +136,8 @@ function irc_addon_admin_post (&$a) {
 function irc_addon_admin (&$a, &$o) {
        $sitechats = Config::get('irc','sitechats'); /* popular channels */
        $autochans = Config::get('irc','autochans');  /* auto connect chans */
-       $t = get_markup_template( "admin.tpl", "addon/irc/" );
-       $o = replace_macros($t, [
+       $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.') ]