]> git.mxchange.org Git - friendica-addons.git/commitdiff
[various] Convert addon_settings hook functions to the new data array format
authorHypolite Petovan <hypolite@mrpetovan.com>
Sat, 20 Nov 2021 09:56:55 +0000 (04:56 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 29 Nov 2021 11:55:16 +0000 (06:55 -0500)
- Add separate template files to several addons
- Remove superfluous addon settings CSS files

68 files changed:
advancedcontentfilter/advancedcontentfilter.php
birdavatar/birdavatar.php
birdavatar/templates/settings.tpl
blockem/blockem.css [deleted file]
blockem/blockem.php
blockem/templates/settings.tpl [new file with mode: 0644]
catavatar/catavatar.php
catavatar/templates/settings.tpl
curweather/curweather.php
curweather/templates/settings.tpl
fromapp/fromapp.css [deleted file]
fromapp/fromapp.php
fromapp/templates/settings.tpl [new file with mode: 0644]
geonames/geonames.css [deleted file]
geonames/geonames.php
geonames/templates/settings.tpl
gnot/gnot.css [deleted file]
gnot/gnot.php
gnot/templates/settings.tpl
group_text/group_text.css [deleted file]
group_text/group_text.php
group_text/templates/settings.tpl [new file with mode: 0644]
irc/irc.php
irc/templates/settings.tpl
krynn/krynn.css [deleted file]
krynn/krynn.php
krynn/templates/settings.tpl [new file with mode: 0644]
langfilter/langfilter.php
langfilter/templates/settings.tpl
mailstream/mailstream.php
mailstream/templates/settings.tpl
markdown/markdown.php
markdown/templates/settings.tpl
mathjax/mathjax.php
mathjax/templates/settings.tpl
notimeline/templates/settings.tpl [new file with mode: 0644]
nsfw/nsfw.css [deleted file]
nsfw/nsfw.php
nsfw/templates/settings.tpl [new file with mode: 0644]
numfriends/numfriends.css [deleted file]
numfriends/numfriends.php
numfriends/templates/settings.tpl [new file with mode: 0644]
opmlexport/opmlexport.php
opmlexport/templates/settings.tpl [deleted file]
planets/planets.css [deleted file]
planets/planets.php
planets/templates/settings.tpl [new file with mode: 0644]
qcomment/qcomment.php
qcomment/templates/settings.tpl
randplace/randplace.css [deleted file]
randplace/randplace.php
randplace/templates/settings.tpl [new file with mode: 0644]
securemail/securemail.php
securemail/templates/admin.tpl [deleted file]
securemail/templates/settings.tpl [new file with mode: 0644]
showmore/showmore.php
showmore/templates/settings.tpl [new file with mode: 0644]
showmore_dyn/showmore_dyn.php
showmore_dyn/templates/settings.tpl
startpage/startpage.css [deleted file]
startpage/startpage.php
startpage/templates/settings.tpl [new file with mode: 0644]
superblock/superblock.css [deleted file]
superblock/superblock.php
superblock/templates/settings.tpl [new file with mode: 0644]
windowsphonepush/templates/settings.tpl [new file with mode: 0644]
windowsphonepush/windowsphonepush.css [deleted file]
windowsphonepush/windowsphonepush.php

index 41ddffdb990ddfd16de4669380aba2acdfbe70fc..3fe6884eae4d16c8ec0ba81b626a107bf1d089cd 100644 (file)
@@ -159,19 +159,17 @@ function advancedcontentfilter_prepare_body_content_filter(App $a, &$hook_data)
 }
 
 
-function advancedcontentfilter_addon_settings(App $a, &$s)
+function advancedcontentfilter_addon_settings(App $a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       $advancedcontentfilter = DI::l10n()->t('Advanced Content Filter');
-
-       $s .= <<<HTML
-               <span class="settings-block fakelink" style="display: block;"><h3><a href="advancedcontentfilter">$advancedcontentfilter <i class="glyphicon glyphicon-share"></i></a></h3></span>
-HTML;
-
-       return;
+       $data = [
+               'addon' => 'advancedcontentfilter',
+               'title' => DI::l10n()->t('Advanced Content Filter'),
+               'href'  => 'advancedcontentfilter',
+       ];
 }
 
 /*
index af573bbd33ef9a9054104299ec0ff4fc820b8b6e..0981b35ddebf35a8ab503023fa266e2adc45de21 100644 (file)
@@ -24,9 +24,9 @@ define("BIRDAVATAR_SIZE", 256);
  */
 function birdavatar_install()
 {
-       Hook::register('avatar_lookup', 'addon/birdavatar/birdavatar.php', 'birdavatar_lookup');
-       Hook::register('addon_settings', 'addon/birdavatar/birdavatar.php', 'birdavatar_addon_settings');
-       Hook::register('addon_settings_post', 'addon/birdavatar/birdavatar.php', 'birdavatar_addon_settings_post');
+       Hook::register('avatar_lookup', __FILE__, 'birdavatar_lookup');
+       Hook::register('addon_settings', __FILE__, 'birdavatar_addon_settings');
+       Hook::register('addon_settings_post', __FILE__, 'birdavatar_addon_settings_post');
 
        Logger::log('registered birdavatar');
 }
@@ -34,24 +34,29 @@ function birdavatar_install()
 /**
  * Bird avatar user settings page
  */
-function birdavatar_addon_settings(App $a, &$s)
+function birdavatar_addon_settings(App $a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/birdavatar/');
-       $s .= Renderer::replaceMacros($t, [
-               '$postpost'     => !empty($_POST['birdavatar-morebird']) || !empty($_POST['birdavatar-emailbird']),
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/birdavatar/');
+       $html = Renderer::replaceMacros($t, [
                '$uncache'      => time(),
                '$uid'          => local_user(),
-               '$usebird'      => DI::l10n()->t('Use Bird as Avatar'),
-               '$morebird'     => DI::l10n()->t('More Random Bird!'),
-               '$emailbird'    => DI::l10n()->t('Reset to email Bird'),
-               '$seed'         => DI::pConfig()->get(local_user(), 'birdavatar', 'seed', false),
-               '$header'       => DI::l10n()->t('Bird Avatar Settings'),
                '$setrandomize' => DI::l10n()->t('Set default profile avatar or randomize the bird.'),
        ]);
+
+       $data = [
+               'addon'  => 'birdavar',
+               'title'  => DI::l10n()->t('Bird Avatar Settings'),
+               'html'   => $html,
+               'submit' => [
+                       'birdavatar-usebird'   => DI::l10n()->t('Use Bird as Avatar'),
+                       'birdavatar-morebird'  => DI::l10n()->t('More Random Bird!'),
+                       'birdavatar-emailbird' => DI::pConfig()->get(local_user(), 'birdavatar', 'seed', false) ? DI::l10n()->t('Reset to email Bird') : null,
+               ],
+       ];
 }
 
 /**
index a31acfdb0637d9a5882721b3050757f8f1bb1f65..13230bd104d70fa86ccfb807f2a7b1f137c060f3 100644 (file)
@@ -1,24 +1,2 @@
-<span id="settings_birdavatar_inflated" class="settings-block fakelink" 
-       style="{{if $postpost}}display: none;{{else}}display: block;{{/if}}" 
-       onclick="openClose('settings_birdavatar_expanded'); openClose('settings_birdavatar_inflated');">
-               <h3>{{$header}}</h3>
-</span>
-<div id="settings_birdavatar_expanded" class="settings-block" 
-       style="{{if $postpost}}display: block;{{else}}display: none;{{/if}}">
-       <span class="fakelink" onclick="openClose('settings_birdavatar_expanded'); openClose('settings_birdavatar_inflated');">
-               <h3>{{$header}}</h3>
-       </span>
-       <img src="{{$basepath}}/birdavatar/{{$uid}}?{{$uncache}}">
-       <p>{{$setrandomize}}</p>
-       <div class="settings-submit-wrapper" >
-               <button type="submit" name="birdavatar-usebird"
-                       class="btn btn-primary settings-submit" value="{{$usebird}}">{{$usebird}}</button>
-               
-               <div class="btn-group" role="group" aria-label="...">
-                       <button type="submit" name="birdavatar-morebird"
-                               class="btn btn-default settings-submit" value="{{$morebird}}">{{$morebird}}</button>
-                       <button type="submit" name="birdavatar-emailbird" {{if !$seed}}disabled{{/if}}
-                               class="btn btn-default settings-submit" value="{{$emailbird}}">{{$emailbird}}</button>
-               </div>
-       </div>
-</div>
+<p>{{$setrandomize}}</p>
+<p><img src="{{$basepath}}/birdavatar/{{$uid}}?{{$uncache}}"></p>
diff --git a/blockem/blockem.css b/blockem/blockem.css
deleted file mode 100644 (file)
index 265b6ba..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-
-#blockem-label {
-       float: left;
-       width: 300px;
-       margin-top: 10px;
-}
-
-#blockem-words {
-       float: left;
-       margin-top: 10px;
-       width: 400px;
-       height: 150px;
-}
-
-#blockem-submit {
-       margin-top: 15px;
-}
-
index 3183915c5aa56bb2d14184f0ff04ad744d8d167f..79e04c8b539e9d7618cfd1950d382e86a471b294 100644 (file)
@@ -9,6 +9,7 @@
 
 use Friendica\App;
 use Friendica\Core\Hook;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 use Friendica\Util\Strings;
 
@@ -25,39 +26,25 @@ function blockem_install()
        Hook::register('enotify_store'              , 'addon/blockem/blockem.php', 'blockem_enotify_store');
 }
 
-function blockem_addon_settings (App $a, &$s)
+function blockem_addon_settings(App $a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       /* Add our stylesheet to the page so we can make our settings look nice */
-       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/blockem/blockem.css' . '" media="all" />' . "\r\n";
+       $words   = DI::pConfig()->get(local_user(), 'blockem', 'words', '');
 
-       $words = DI::pConfig()->get(local_user(), 'blockem', 'words');
-
-       if (!$words) {
-               $words = '';
-       }
-
-       $s .= '<span id="settings_blockem_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_blockem_expanded\'); openClose(\'settings_blockem_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Blockem') . '</h3>';
-       $s .= '</span>';
-       $s .= '<div id="settings_blockem_expanded" class="settings-block" style="display: none;">';
-       $s .= '<span class="fakelink" onclick="openClose(\'settings_blockem_expanded\'); openClose(\'settings_blockem_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Blockem') . '</h3>';
-       $s .= '</span>';
-
-       $s .= '<div id="blockem-wrapper">';
-       $s .= '<div id="blockem-desc">'. DI::l10n()->t("Hides user's content by collapsing posts. Also replaces their avatar with generic image.") . ' </div>';
-       $s .= '<label id="blockem-label" for="blockem-words">' . DI::l10n()->t('Comma separated profile URLS:') . ' </label>';
-       $s .= '<textarea id="blockem-words" type="text" name="blockem-words" >' . htmlspecialchars($words) . '</textarea>';
-       $s .= '</div><div class="clear"></div>';
-
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="blockem-submit" name="blockem-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
-
-       return;
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/blockem/');
+       $html = Renderer::replaceMacros($t, [
+               '$info'    => DI::l10n()->t("Hides user's content by collapsing posts. Also replaces their avatar with generic image."),
+               '$words'   => ['blockem-words', DI::l10n()->t('Comma separated profile URLS:'), $words],
+       ]);
 
+       $data = [
+               'addon' => 'blockem',
+               'title' => DI::l10n()->t('Blockem'),
+               'html'  => $html,
+       ];
 }
 
 function blockem_addon_settings_post(App $a, array &$b)
diff --git a/blockem/templates/settings.tpl b/blockem/templates/settings.tpl
new file mode 100644 (file)
index 0000000..6739840
--- /dev/null
@@ -0,0 +1 @@
+{{include file="field_textarea.tpl" field=$words}}
index 181ac01636d009bdcc873e38cee22c5b5d3a2777..1304b24ddbf73bff5c735f90850c95f0b8a89d21 100644 (file)
@@ -25,9 +25,9 @@ define("CATAVATAR_SIZE", 256);
  */
 function catavatar_install()
 {
-       Hook::register('avatar_lookup', 'addon/catavatar/catavatar.php', 'catavatar_lookup');
-       Hook::register('addon_settings', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings');
-       Hook::register('addon_settings_post', 'addon/catavatar/catavatar.php', 'catavatar_addon_settings_post');
+       Hook::register('avatar_lookup', __FILE__, 'catavatar_lookup');
+       Hook::register('addon_settings', __FILE__, 'catavatar_addon_settings');
+       Hook::register('addon_settings_post', __FILE__, 'catavatar_addon_settings_post');
 
        Logger::notice('registered catavatar');
 }
@@ -35,24 +35,29 @@ function catavatar_install()
 /**
  * Cat avatar user settings page
  */
-function catavatar_addon_settings(App $a, &$s)
+function catavatar_addon_settings(App $a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/catavatar/');
-       $s .= Renderer::replaceMacros($t, [
-               '$postpost' => !empty($_POST['catavatar-morecat']) || !empty($_POST['catavatar-emailcat']),
-               '$uncache' => time(),
-               '$uid' => local_user(),
-               '$usecat' => DI::l10n()->t('Use Cat as Avatar'),
-               '$morecat' => DI::l10n()->t('More Random Cat!'),
-               '$emailcat' => DI::l10n()->t('Reset to email Cat'),
-               '$seed' => DI::pConfig()->get(local_user(), 'catavatar', 'seed', false),
-               '$header' => DI::l10n()->t('Cat Avatar Settings'),
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/catavatar/');
+       $html = Renderer::replaceMacros($t, [
+               '$uncache'      => time(),
+               '$uid'          => local_user(),
                '$setrandomize' => DI::l10n()->t('Set default profile avatar or randomize the cat.'),
        ]);
+
+       $data = [
+               'addon'  => 'catavar',
+               'title'  => DI::l10n()->t('Cat Avatar Settings'),
+               'html'   => $html,
+               'submit' => [
+                       'catavatar-usecat'   => DI::l10n()->t('Use Cat as Avatar'),
+                       'catavatar-morecat'  => DI::l10n()->t('Another random Cat!'),
+                       'catavatar-emailcat' => DI::pConfig()->get(local_user(), 'catavatar', 'seed', false) ? DI::l10n()->t('Reset to email Cat') : null,
+               ],
+       ];
 }
 
 /**
index 33563ffe6bfb08621210b6755ef790d564a54591..7659a9c8673775a56a5e45391c856ef9bdbd375d 100644 (file)
@@ -1,24 +1,2 @@
-<span id="settings_catavatar_inflated" class="settings-block fakelink" 
-       style="{{if $postpost}}display: none;{{else}}display: block;{{/if}}" 
-       onclick="openClose('settings_catavatar_expanded'); openClose('settings_catavatar_inflated');">
-               <h3>{{$header}}</h3>
-</span>
-<div id="settings_catavatar_expanded" class="settings-block" 
-       style="{{if $postpost}}display: block;{{else}}display: none;{{/if}}">
-       <span class="fakelink" onclick="openClose('settings_catavatar_expanded'); openClose('settings_catavatar_inflated');">
-               <h3>{{$header}}</h3>
-       </span>
-       <img src="{{$basepath}}/catavatar/{{$uid}}?{{$uncache}}">
-       <p>{{$setrandomize}}</p>
-       <div class="settings-submit-wrapper" >
-               <button type="submit" name="catavatar-usecat"
-                       class="btn btn-primary settings-submit" value="{{$usecat}}">{{$usecat}}</button>
-               
-               <div class="btn-group" role="group" aria-label="...">
-                       <button type="submit" name="catavatar-morecat"
-                               class="btn btn-default settings-submit" value="{{$morecat}}">{{$morecat}}</button>
-                       <button type="submit" name="catavatar-emailcat" {{if !$seed}}disabled{{/if}}
-                               class="btn btn-default settings-submit" value="{{$emailcat}}">{{$emailcat}}</button>
-               </div>
-       </div>
-</div>
+<p>{{$setrandomize}}</p>
+<p><img src="{{$basepath}}/catavatar/{{$uid}}?{{$uncache}}"></p>
index 118c4a9a550beb10b7b57f5cfb69556f164b2a41..c4b172cadb39185bc960308e7d61baed993c7bff 100644 (file)
@@ -164,40 +164,38 @@ function curweather_addon_settings_post(App $a, $post)
        DI::pConfig()->set(local_user(), 'curweather', 'curweather_units' , trim($_POST['curweather_units']));
 }
 
-function curweather_addon_settings(App $a, &$s)
+function curweather_addon_settings(App $a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       /* Get the current state of our config variable */
-       $curweather_loc = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc');
+       $curweather_loc   = DI::pConfig()->get(local_user(), 'curweather', 'curweather_loc');
        $curweather_units = DI::pConfig()->get(local_user(), 'curweather', 'curweather_units');
-       $appid = DI::config()->get('curweather', 'appid');
+       $appid            = DI::config()->get('curweather', 'appid');
 
-       if ($appid == "") {
+       if ($appid == '') {
                $noappidtext = DI::l10n()->t('No APPID found, please contact your admin to obtain one.');
        } else {
                $noappidtext = '';
        }
 
-       $enable = intval(DI::pConfig()->get(local_user(), 'curweather', 'curweather_enable'));
-       $enable_checked = (($enable) ? ' checked="checked" ' : '');
-       
-       // load template and replace the macros
-       $t = Renderer::getMarkupTemplate("settings.tpl", "addon/curweather/" );
+       $enabled = intval(DI::pConfig()->get(local_user(), 'curweather', 'curweather_enable'));
 
-       $s = Renderer::replaceMacros($t, [
-               '$submit' => DI::l10n()->t('Save Settings'),
-               '$header' => DI::l10n()->t('Current Weather').' '.DI::l10n()->t('Settings'),
-               '$noappidtext' => $noappidtext,
-               '$info' => DI::l10n()->t('Enter either the name of your location or the zip code.'),
-               '$curweather_loc' => [ 'curweather_loc', DI::l10n()->t('Your Location'), $curweather_loc, DI::l10n()->t('Identifier of your location (name or zip code), e.g. <em>Berlin,DE</em> or <em>14476,DE</em>.') ],
-               '$curweather_units' => [ 'curweather_units', DI::l10n()->t('Units'), $curweather_units, DI::l10n()->t('select if the temperature should be displayed in &deg;C or &deg;F'), ['metric'=>'°C', 'imperial'=>'°F']],
-               '$enabled' => [ 'curweather_enable', DI::l10n()->t('Show weather data'), $enable, '']
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/curweather/');
+       $html = Renderer::replaceMacros($t, [
+               '$noappidtext'      => $noappidtext,
+               '$info'             => DI::l10n()->t('Enter either the name of your location or the zip code.'),
+               '$curweather_loc'   => ['curweather_loc', DI::l10n()->t('Your Location'), $curweather_loc, DI::l10n()->t('Identifier of your location (name or zip code), e.g. <em>Berlin,DE</em> or <em>14476,DE</em>.')],
+               '$curweather_units' => ['curweather_units', DI::l10n()->t('Units'), $curweather_units, DI::l10n()->t('select if the temperature should be displayed in &deg;C or &deg;F'), ['metric' => '°C', 'imperial' => '°F']],
+               '$enabled'          => ['curweather_enable', DI::l10n()->t('Show weather data'), $enabled, ''],
        ]);
 
-       return;
+       $data = [
+               'addon' => 'curweather',
+               'title' => DI::l10n()->t('Current Weather Settings'),
+               'html'  => $html,
+       ];
 }
 
 // Config stuff for the admin panel to let the admin of the node set a APPID
index 09f6f506d0c2b14204d81876ad8a473c1fa6c31f..d250b9bbaa3e22d41f41d6690f694bd0b97a2024 100644 (file)
@@ -1,15 +1,6 @@
-<span id="settings_curweather_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_curweather_expanded'); openClose('settings_curweather_inflated');">
-       <h3>{{$header}}</h3>
-</span>
-<div id="settings_curweather_expanded" class="settings-block" style="display: none;">
-       <span class="fakelink" onclick="openClose('settings_curweather_expanded'); openClose('settings_curweather_inflated');">
-               <h3>{{$header}}</h3>
-       </span>
-       <div style="color: red; font-weight: bold;">{{$noappidtext}}</div>
-       {{include file="field_input.tpl" field=$curweather_loc}}
-       {{include file="field_select.tpl" field=$curweather_units}}
-       {{include file="field_checkbox.tpl" field=$enabled}}
-       <div class="settings-submit-wrapper" >
-               <input type="submit" id="curweather-settings-submit" name="curweather-settings-submit" class="settings-submit" value="{{$submit}}" />
-       </div>
-</div>
+{{if $noappidtext}}
+<p style="color: red; font-weight: bold;">{{$noappidtext}}</p>
+{{/if}}
+{{include file="field_input.tpl" field=$curweather_loc}}
+{{include file="field_select.tpl" field=$curweather_units}}
+{{include file="field_checkbox.tpl" field=$enabled}}
diff --git a/fromapp/fromapp.css b/fromapp/fromapp.css
deleted file mode 100644 (file)
index 422624a..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-#fromapp-label, #fromapp-force-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#fromapp-input, #fromapp-force {
-       float: left;
-}
-
-
index ab1e1518d632f1ac90820725a626d8d64bb434ba..c00ad3de5faeb888aab61187e084a8772f6ded58 100644 (file)
@@ -6,8 +6,11 @@
  * Author: Commander Zot
  *
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 
 function fromapp_install()
@@ -28,47 +31,26 @@ function fromapp_settings_post($a, $post)
        DI::pConfig()->set(local_user(), 'fromapp', 'force', intval($_POST['fromapp-force']));
 }
 
-function fromapp_settings(&$a, &$s)
+function fromapp_settings(App &$a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       /* Add our stylesheet to the page so we can make our settings look nice */
-
-       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/fromapp/fromapp.css' . '" media="all" />' . "\r\n";
-
-       /* Get the current state of our config variable */
-
        $fromapp = DI::pConfig()->get(local_user(), 'fromapp', 'app', '');
-
-       $force = intval(DI::pConfig()->get(local_user(), 'fromapp', 'force'));
-
-       $force_enabled = (($force) ? ' checked="checked" ' : '');
-
-       
-       /* Add some HTML to the existing form */
-
-       $s .= '<span id="settings_fromapp_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_fromapp_expanded\'); openClose(\'settings_fromapp_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('FromApp Settings') . '</h3>';
-       $s .= '</span>';
-       $s .= '<div id="settings_fromapp_expanded" class="settings-block" style="display: none;">';
-       $s .= '<span class="fakelink" onclick="openClose(\'settings_fromapp_expanded\'); openClose(\'settings_fromapp_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('FromApp Settings') . '</h3>';
-       $s .= '</span>';
-       $s .= '<div id="fromapp-wrapper">';
-       $s .= '<label id="fromapp-label" for="fromapp-input">' . DI::l10n()->t('The application name you would like to show your posts originating from. Separate different app names with a comma. A random one will then be selected for every posting.') . '</label>';
-       $s .= '<input id="fromapp-input" type="text" name="fromapp-input" value="' . $fromapp . '" ' . '/>';
-       $s .= '<div class="clear"></div>';
-
-       $s .= '<label id="fromapp-force-label" for="fromapp-force">' . DI::l10n()->t('Use this application name even if another application was used.') . '</label>';
-       $s .= '<input id="fromapp-force" type="checkbox" name="fromapp-force" value="1" ' . $force_enabled . '/>';
-
-       $s .= '</div><div class="clear"></div>';
-
-       /* provide a submit button */
-
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="fromapp-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
+       $force   = intval(DI::pConfig()->get(local_user(), 'fromapp', 'force'));
+
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/fromapp/');
+       $html = Renderer::replaceMacros($t, [
+               '$fromapp' => ['fromapp-input', DI::l10n()->t('The application name you would like to show your posts originating from. Separate different app names with a comma. A random one will then be selected for every posting.'), $fromapp],
+               '$force'   => ['fromapp-force', DI::l10n()->t('Use this application name even if another application was used.'), $force],
+       ]);
+
+       $data = [
+               'addon' => 'fromapp',
+               'title' => DI::l10n()->t('FromApp Settings'),
+               'html'  => $html,
+       ];
 }
 
 function fromapp_post_hook(&$a, &$item)
diff --git a/fromapp/templates/settings.tpl b/fromapp/templates/settings.tpl
new file mode 100644 (file)
index 0000000..c74e578
--- /dev/null
@@ -0,0 +1,2 @@
+{{include file="field_input.tpl" field=$fromapp}}
+{{include file="field_checkbox.tpl" field=$force}}
\ No newline at end of file
diff --git a/geonames/geonames.css b/geonames/geonames.css
deleted file mode 100644 (file)
index 0c67e7f..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-#geonames-enable-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#geonames-checkbox {
-       float: left;
-}
-
-
index 5fdf65ef5d2603859d07ea81e08067d4970fd965..a595a0f0b50cb050f32b53e195c0a3d810d3f165 100644 (file)
@@ -113,32 +113,32 @@ function geonames_addon_settings_post(App $a, array $post)
  * Called from the Addon Setting form.
  * Add our own settings info to the page.
  *
- * @param App    $a
- * @param string $s
+ * @param App   $a
+ * @param array $data
  * @throws Exception
  */
-function geonames_addon_settings(App $a, &$s)
+function geonames_addon_settings(App $a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
        $geo_account = DI::config()->get('geonames', 'username');
-
        if (!$geo_account) {
                return;
        }
 
-       DI::page()->registerStylesheet(__DIR__ . '/geonames.css');
-
-       /* Get the current state of our config variable */
        $enabled = intval(DI::pConfig()->get(local_user(), 'geonames', 'enable'));
 
-       $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/geonames/');
-       $s .= Renderer::replaceMacros($t, [
-               '$title' => DI::l10n()->t('Geonames Settings'),
-               '$description' => DI::l10n()->t('Replace numerical coordinates by the nearest populated location name in your posts.'),
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/geonames/');
+       $html = Renderer::replaceMacros($t, [
+               '$info'   => DI::l10n()->t('Replace numerical coordinates by the nearest populated location name in your posts.'),
                '$enable' => ['geonames-enable', DI::l10n()->t('Enable Geonames Addon'), $enabled],
-               '$submit' => DI::l10n()->t('Save Settings')
        ]);
+
+       $data = [
+               'addon' => 'geonames',
+               'title' => DI::l10n()->t('Geonames Settings'),
+               'html'  => $html,
+       ];
 }
index 05897b6ac44ed280b7818c3423b0ca9eb7494e00..796a544c7edfe20b96dab008ed6356cc45992a61 100644 (file)
@@ -1,14 +1,2 @@
-<span id="settings_geonames_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_geonames_expanded'); openClose('settings_geonames_inflated');">
-       <h3>{{$title}}</h3>
-</span>
-<div id="settings_geonames_expanded" class="settings-block" style="display: none;">
-       <span class="fakelink" onclick="openClose('settings_geonames_expanded'); openClose('settings_geonames_inflated');">
-               <h3>{{$title}}</h3>
-       </span>
-       <p>{{$description nofilter}}</p>
-       {{include file="field_checkbox.tpl" field=$enable}}
-       <div class="settings-submit-wrapper" >
-               <input type="submit" id="geonames-submit" name="geonames-submit" class="settings-submit" value="{{$submit}}" />
-       </div>
-</div>
-<div class="clear"></div>
\ No newline at end of file
+<p>{{$info}}</p>
+{{include file="field_checkbox.tpl" field=$enable}}
diff --git a/gnot/gnot.css b/gnot/gnot.css
deleted file mode 100644 (file)
index ccafdaf..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-
-#gnot-desc {
-       margin-bottom: 10px;
-}
-
-#gnot-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#gnot {
-       float: left;
-}
-
-
index 8b37fb1cc0f2f89ac1c592ed8a03d8c5ca8494c3..7acf8465fc852832df7d4cc9674da75385d6969f 100644 (file)
@@ -8,6 +8,7 @@
  *
  */
 
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
 use Friendica\Core\Renderer;
@@ -49,31 +50,25 @@ function gnot_settings_post($a,$post) {
 
 
 
-function gnot_settings(&$a,&$s) {
-
-       if(! local_user())
+function gnot_settings(App &$a, array &$data)
+{
+       if (!local_user()) {
                return;
+       }
 
-       /* Add our stylesheet to the page so we can make our settings look nice */
-
-       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/gnot/gnot.css' . '" media="all" />' . "\r\n";
-
-       /* Get the current state of our config variable */
+       $gnot = intval(DI::pConfig()->get(local_user(), 'gnot', 'enable'));
 
-       $gnot = intval(DI::pConfig()->get(local_user(),'gnot','enable'));
-
-       $gnot_checked = (($gnot) ? ' checked="checked" ' : '' );
-       
-       $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/');
-       /* Add some HTML to the existing form */
-
-       $s .= Renderer::replaceMacros($t, [
-               '$title' => DI::l10n()->t('Gnot Settings') ,
-               '$submit' => DI::l10n()->t('Save Settings'),
-               '$enable' => DI::l10n()->t('Enable this addon?'),
-               '$enabled' => $gnot_checked,
-               '$text' => DI::l10n()->t("Allows threading of email comment notifications on Gmail and anonymising the subject line.")
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/');
+       $html = Renderer::replaceMacros($t, [
+               '$text'    => DI::l10n()->t("Allows threading of email comment notifications on Gmail and anonymising the subject line."),
+               '$enabled' => ['gnot', DI::l10n()->t('Enable this addon?'), $gnot],
        ]);
+
+       $data = [
+               'addon' => 'gnot',
+               'title' => DI::l10n()->t('Gnot Settings'),
+               'html'  => $html,
+       ];
 }
 
 
index 1323eb4dffe39ef4ed01318af36e0eacc5ece266..b153c623806afe33a5b54e8ed6a5d047b4d22c2c 100644 (file)
@@ -1,20 +1,2 @@
-<span id="settings_gnot_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_gnot_expanded\'); openClose(\'settings_gnot_inflated\');">
-       <h3>{{$title}}</h3>
-</span>
-<div id="settings_gnot_expanded" class="settings-block" style="display: none;">
-       <span class="fakelink" onclick="openClose(\'settings_gnot_expanded\'); openClose(\'settings_gnot_inflated\');">
-               <h3>{{$title}}</h3>
-       </span>
-       <div id="gnot-wrapper">
-               <div id="gnot-desc">{{$text}}</div>
-                       <label id="gnot-label" for="gnot">{{$enable}}</label>
-                       <input id="gnot-input" type="checkbox" name="gnot" value="1" {{$enabled}} />
-               </div>
-       <div class="clear"></div>
-
-       /* provide a submit button */
-
-       <div class="settings-submit-wrapper" >
-               <input type="submit" name="gnot-submit" class="settings-submit" value="{{$submit}}" />
-       </div>
-</div>
+<p>{{$text}}</p>
+{{include file="field_checkbox.tpl" field=$enabled}}
diff --git a/group_text/group_text.css b/group_text/group_text.css
deleted file mode 100644 (file)
index 4122b67..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-#group_text-enable-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#group_text-checkbox {
-       float: left;
-}
-
-
index aa644588898abe295afc28153a708d19169bc282..cb2c5eee4c6de034beffcac256977e659f2e3744 100644 (file)
@@ -5,8 +5,11 @@
  * Version: 1.0
  * Author: Thomas Willingham <https://kakste.com/profile/beardyunixer>
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 
 function group_text_install() {
@@ -42,31 +45,22 @@ function group_text_settings_post($a,$post) {
 
 
 
-function group_text_settings(&$a,&$s) {
-
-       if(! local_user())
+function group_text_settings(App &$a, array &$data)
+{
+       if (!local_user()) {
                return;
-
-       /* Add our stylesheet to the page so we can make our settings look nice */
-
-       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/group_text/group_text.css' . '" media="all" />' . "\r\n";
-
-       /* Get the current state of our config variable */
+       }
 
        $enabled = DI::pConfig()->get(local_user(),'system','groupedit_image_limit');
-       $checked = (($enabled) ? ' checked="checked" ' : '');
-
-       /* Add some HTML to the existing form */
-
-       $s .= '<div class="settings-block">';
-       $s .= '<h3>' . DI::l10n()->t('Group Text') . '</h3>';
-       $s .= '<div id="group_text-enable-wrapper">';
-       $s .= '<label id="group_text-enable-label" for="group_text-checkbox">' . DI::l10n()->t('Use a text only (non-image) group selector in the "group edit" menu') . '</label>';
-       $s .= '<input id="group_text-checkbox" type="checkbox" name="group_text" value="1" ' . $checked . '/>';
-       $s .= '</div><div class="clear"></div>';
-
-       /* provide a submit button */
 
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="group_text-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/group_text/');
+       $html = Renderer::replaceMacros($t, [
+               '$enabled' => ['group_text', DI::l10n()->t('Use a text only (non-image) group selector in the "group edit" menu'), $enabled],
+       ]);
 
+       $data = [
+               'addon' => 'group_text',
+               'title' => DI::l10n()->t('Group Text'),
+               'html'  => $html,
+       ];
 }
diff --git a/group_text/templates/settings.tpl b/group_text/templates/settings.tpl
new file mode 100644 (file)
index 0000000..2f3f4ce
--- /dev/null
@@ -0,0 +1 @@
+{{include file="field_checkbox.tpl" field=$enabled}}
index b441cebf3078722502a4f317e6cb25885407d073..75dc89c0abab44b161604f9ad736af1614a44fe3 100644 (file)
@@ -7,6 +7,7 @@
 * Author: Tobias Diekershoff <https://f.diekershoff.de/u/tobias>
 */
 
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Renderer;
 use Friendica\DI;
@@ -17,30 +18,27 @@ function irc_install() {
        Hook::register('addon_settings_post', 'addon/irc/irc.php', 'irc_addon_settings_post');
 }
 
-function irc_addon_settings(&$a,&$s) {
-       if(! local_user())
+function irc_addon_settings(App &$a, array &$data)
+{
+       if (!local_user()) {
                return;
+       }
 
-    /* Add our stylesheet to the page so we can make our settings look nice */
-
-//     DI::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 = DI::pConfig()->get( local_user(), 'irc','sitechats'); /* popular channels */
-       $autochans = DI::pConfig()->get( local_user(), 'irc','autochans');  /* auto connect chans */
+       $sitechats = DI::pConfig()->get(local_user(), 'irc', 'sitechats'); /* popular channels */
+       $autochans = DI::pConfig()->get(local_user(), 'irc', 'autochans');  /* auto connect chans */
 
-       $t = Renderer::getMarkupTemplate( "settings.tpl", "addon/irc/" );
-       $s .= Renderer::replaceMacros($t, [
-               '$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.') ]
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/irc/');
+       $html = Renderer::replaceMacros($t, [
+               '$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.'),
+               '$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.')],
        ]);
 
-
-       return;
-
+       $data = [
+               'addon' => 'irc',
+               'title' => DI::l10n()->t('IRC Settings'),
+               'html'  => $html,
+       ];
 }
 
 function irc_addon_settings_post(&$a, &$b) {
index e463a59c47a941f13f54f4423203edd73d783d75..215b8f3f2792c6bf409781b0044801adc1cdd31b 100644 (file)
@@ -1,15 +1,3 @@
-<span id="settings_irc_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_irc_expanded'); openClose('settings_irc_inflated');">
-       <h3>{{$header}}</h3>
-</span>
-<div id="settings_irc_expanded" class="settings-block" style="display: none;">
-       <span class="fakelink" onclick="openClose('settings_irc_expanded'); openClose('settings_irc_inflated');">
-               <h3>{{$header}}</h3>
-       </span>
-       <p>{{$info}}</p>
-       {{include file="field_input.tpl" field=$autochans}}
-       {{include file="field_input.tpl" field=$sitechats}}
-
-       <div class="settings-submit-wrapper" >
-               <input type="submit" id="irc-submit" name="irc-submit" class="settings-submit" value="{{$submit}}" />
-       </div>
-</div>
+<p>{{$info}}</p>
+{{include file="field_input.tpl" field=$autochans}}
+{{include file="field_input.tpl" field=$sitechats}}
diff --git a/krynn/krynn.css b/krynn/krynn.css
deleted file mode 100644 (file)
index 466a3ec..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-#krynn-enable-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#krynn-checkbox {
-       float: left;
-}
-
-
index 66cdf57357a338e1c2aa205d1120efa18b702168..3cb7206d68ce806dd831f7f94ed1fb2070a77a10 100644 (file)
@@ -9,8 +9,11 @@
  *
  *"My body was my sacrifice... for my magic. This damage is permanent." - Raistlin Majere
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 
 function krynn_install() {
@@ -111,42 +114,24 @@ function krynn_settings_post($a,$post) {
 
 
 
-function krynn_settings(&$a,&$s) {
-
-       if(! local_user())
+function krynn_settings(App &$a, array &$data)
+{
+       if(! local_user()) {
                return;
-
-       /* Add our stylesheet to the page so we can make our settings look nice */
-
-       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/krynn/krynn.css' . '" media="all" />' . "\r\n";
-
-       /* Get the current state of our config variable */
+       }
 
        $enabled = DI::pConfig()->get(local_user(),'krynn','enable');
 
-       $checked = (($enabled) ? ' checked="checked" ' : '');
-
-       /* Add some HTML to the existing form */
-
-    $s .= '<span id="settings_krynn_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_krynn_expanded\'); openClose(\'settings_krynn_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Krynn') . '</h3>';
-       $s .= '</span>';
-       $s .= '<div id="settings_krynn_expanded" class="settings-block" style="display: none;">';
-       $s .= '<span class="fakelink" onclick="openClose(\'settings_krynn_expanded\'); openClose(\'settings_krynn_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Krynn') . '</h3>';
-       $s .= '</span>';
-
-
-    $s .= '<div class="settings-block">';
-       $s .= '<h3>' . DI::l10n()->t('Krynn Settings') . '</h3>';
-       $s .= '<div id="krynn-enable-wrapper">';
-       $s .= '<label id="krynn-enable-label" for="krynn-checkbox">' . DI::l10n()->t('Enable Krynn Addon') . '</label>';
-       $s .= '<input id="krynn-checkbox" type="checkbox" name="krynn" value="1" ' . $checked . '/>';
-        $s .= '</div><div class="clear"></div></div>';
-       /* provide a submit button */
-
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="krynn-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/krynn/');
+       $html = Renderer::replaceMacros($t, [
+               '$enabled' => ['krynn', DI::l10n()->t('Enable Krynn Addon'), $enabled],
+       ]);
 
+       $data = [
+               'addon' => 'krynn',
+               'title' => DI::l10n()->t('Krynn Settings'),
+               'html'  => $html,
+       ];
 }
 
 
diff --git a/krynn/templates/settings.tpl b/krynn/templates/settings.tpl
new file mode 100644 (file)
index 0000000..2f3f4ce
--- /dev/null
@@ -0,0 +1 @@
+{{include file="field_checkbox.tpl" field=$enabled}}
index aeb53eebde126892f39a99deca64d2ea7905bade..c75a07b507a6da337b71060acfd6c36ff9342b01 100644 (file)
@@ -31,7 +31,7 @@ function langfilter_install()
  * 3rd parse a SMARTY3 template, replacing some translateable strings for the form
  */
 
-function langfilter_addon_settings(App $a, &$s)
+function langfilter_addon_settings(App $a, array &$data)
 {
        if (!local_user()) {
                return;
@@ -40,23 +40,25 @@ function langfilter_addon_settings(App $a, &$s)
        $enabled = DI::pConfig()->get(local_user(), 'langfilter', 'enable',
                !DI::pConfig()->get(local_user(), 'langfilter', 'disable'));
 
-       $enable_checked = $enabled ? ' checked="checked"' : '';
-       $languages      = DI::pConfig()->get(local_user(), 'langfilter', 'languages');
-       $minconfidence  = DI::pConfig()->get(local_user(), 'langfilter', 'minconfidence', 0) * 100;
-       $minlength      = DI::pConfig()->get(local_user(), 'langfilter', 'minlength'    , 32);
+       $languages     = DI::pConfig()->get(local_user(), 'langfilter', 'languages');
+       $minconfidence = DI::pConfig()->get(local_user(), 'langfilter', 'minconfidence', 0) * 100;
+       $minlength     = DI::pConfig()->get(local_user(), 'langfilter', 'minlength', 32);
 
-       $t = Renderer::getMarkupTemplate("settings.tpl", "addon/langfilter/");
-       $s .= Renderer::replaceMacros($t, [
-               '$title'         => DI::l10n()->t("Language Filter"),
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/langfilter/');
+       $html = Renderer::replaceMacros($t, [
                '$intro'         => DI::l10n()->t('This addon tries to identify the language posts are written in. If it does not match any language specified below, posts will be hidden by collapsing them.'),
-               '$enabled'       => ['langfilter_enable', DI::l10n()->t('Use the language filter'), $enable_checked, ''],
+               '$enabled'       => ['langfilter_enable', DI::l10n()->t('Use the language filter'), $enabled],
                '$languages'     => ['langfilter_languages', DI::l10n()->t('Able to read'), $languages, DI::l10n()->t('List of abbreviations (ISO 639-1 codes) for languages you speak, comma separated. For example "de,it".')],
                '$minconfidence' => ['langfilter_minconfidence', DI::l10n()->t('Minimum confidence in language detection'), $minconfidence, DI::l10n()->t('Minimum confidence in language detection being correct, from 0 to 100. Posts will not be filtered when the confidence of language detection is below this percent value.')],
                '$minlength'     => ['langfilter_minlength', DI::l10n()->t('Minimum length of message body'), $minlength, DI::l10n()->t('Minimum number of characters in message body for filter to be used. Posts shorter than this will not be filtered. Note: Language detection is unreliable for short content (<200 characters).')],
-               '$submit'        => DI::l10n()->t('Save Settings'),
        ]);
 
-       return;
+       $data = [
+               'addon'  => 'langfilter',
+               'title'  => DI::l10n()->t('Language Filter'),
+               'html'   => $html,
+               'submit' => ['langfilter-settings-submit' => DI::l10n()->t('Save Settings')],
+       ];
 }
 
 /* Save the settings
index d2de7fce2d819ff793064f0d0836fbcb2f0f1369..1197e9f2b661388530323a60a2d215b21ae87427 100644 (file)
@@ -1,19 +1,5 @@
-<span id="settings_langfilter_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_langfilter_expanded'); openClose('settings_langfilter_inflated');">
-       <h3>{{$title}}</h3>
-</span>
-<div id="settings_langfilter_expanded" class="settings-block" style="display: none;">
-       <span class="fakelink" onclick="openClose('settings_langfilter_expanded'); openClose('settings_langfilter_inflated');">
-               <h3>{{$title}}</h3>
-       </span>
-
-       <div id="langfilter-wrapper">
-               <p>{{$intro}}</p>
-               {{include file="field_checkbox.tpl" field=$enabled}}
-               {{include file="field_input.tpl" field=$languages}}
-               {{include file="field/range_percent.tpl" field=$minconfidence}}
-               {{include file="field_input.tpl" field=$minlength}}
-       </div>
-       <div class="settings-submit-wrapper" >
-               <input type="submit" id="langfilter-settings-submit" name="langfilter-settings-submit" class="settings-submit" value="{{$submit}}" />
-       </div>
-</div> 
+<p>{{$intro}}</p>
+{{include file="field_checkbox.tpl" field=$enabled}}
+{{include file="field_input.tpl" field=$languages}}
+{{include file="field/range_percent.tpl" field=$minconfidence}}
+{{include file="field_input.tpl" field=$minlength}}
index 7e3f87f8c3a3c3f5ff46283745d0c96a1ff30c3c..33959e1e5e82185f2d5e9ba6f1ddd2d0672e6b2b 100644 (file)
@@ -6,6 +6,7 @@
  * Author: Matthew Exon <http://mat.exon.name>
  */
 
+use Friendica\App;
 use Friendica\Content\Text\BBCode;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
@@ -462,51 +463,58 @@ function mailstream_convert_table_entries()
 /**
  * Form for configuring mailstream features for a user
  *
- * @param Friendica\App $a App object
- * @param string        $o HTML form data
+ * @param App   $a    App object
+ * @param array $data Hook data array
+ * @throws \Friendica\Network\HTTPException\ServiceUnavailableException
  */
-function mailstream_addon_settings(&$a, &$s)
+function mailstream_addon_settings(App &$a, array &$data)
 {
-       $enabled = DI::pConfig()->get(local_user(), 'mailstream', 'enabled');
-       $address = DI::pConfig()->get(local_user(), 'mailstream', 'address');
-       $nolikes = DI::pConfig()->get(local_user(), 'mailstream', 'nolikes');
-       $attachimg= DI::pConfig()->get(local_user(), 'mailstream', 'attachimg');
-       $template = Renderer::getMarkupTemplate('settings.tpl', 'addon/mailstream/');
-       $s .= Renderer::replaceMacros($template, [
-               '$enabled' => [
+       $enabled   = DI::pConfig()->get(local_user(), 'mailstream', 'enabled');
+       $address   = DI::pConfig()->get(local_user(), 'mailstream', 'address');
+       $nolikes   = DI::pConfig()->get(local_user(), 'mailstream', 'nolikes');
+       $attachimg = DI::pConfig()->get(local_user(), 'mailstream', 'attachimg');
+
+       $template  = Renderer::getMarkupTemplate('settings.tpl', 'addon/mailstream/');
+       $html      = Renderer::replaceMacros($template, [
+               '$enabled'   => [
                        'mailstream_enabled',
                        DI::l10n()->t('Enabled'),
                        $enabled
                ],
-               '$address' => [
+               '$address'   => [
                        'mailstream_address',
                        DI::l10n()->t('Email Address'),
                        $address,
-                       DI::l10n()->t("Leave blank to use your account email address")
+                       DI::l10n()->t('Leave blank to use your account email address')
                ],
-               '$nolikes' => [
+               '$nolikes'   => [
                        'mailstream_nolikes',
                        DI::l10n()->t('Exclude Likes'),
                        $nolikes,
-                       DI::l10n()->t("Check this to omit mailing \"Like\" notifications")
+                       DI::l10n()->t('Check this to omit mailing "Like" notifications')
                ],
                '$attachimg' => [
                        'mailstream_attachimg',
                        DI::l10n()->t('Attach Images'),
                        $attachimg,
-                       DI::l10n()->t("Download images in posts and attach them to the email.  " .
-                               "Useful for reading email while offline.")
+                       DI::l10n()->t('Download images in posts and attach them to the email.  ' .
+                               'Useful for reading email while offline.')
                ],
-               '$title' => DI::l10n()->t('Mail Stream Settings'),
-               '$submit' => DI::l10n()->t('Save Settings')]);
+       ]);
+
+       $data = [
+               'addon' => 'mailstream',
+               'title' => DI::l10n()->t('Mail Stream Settings'),
+               'html'  => $html,
+       ];
 }
 
 /**
  * Process data submitted to user's mailstream features form
- * @param \Friendica\App $a
+ * @param App $a
  * @param array          $post POST data
  */
-function mailstream_addon_settings_post(\Friendica\App $a, array $post)
+function mailstream_addon_settings_post(App $a, array $post)
 {
        if (!local_user() || empty($post['mailstream-submit'])) {
                return;
index aa02b274441051b5c2b06cfd9df607faa92ebf65..6e5d17297f37f224674e1b106b1e51621fa32ab1 100644 (file)
@@ -1,13 +1,4 @@
-<span id="settings_mailstream_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_mailstream_expanded'); openClose('settings_mailstream_inflated');">
-       <h3>{{$title}}</h3>
-</span>
-<div id="settings_mailstream_expanded" class="settings-block" style="display: none;">
-       <span class="fakelink" onclick="openClose('settings_mailstream_expanded'); openClose('settings_mailstream_inflated');">
-               <h3>{{$title}}</h3>
-       </span>
-       {{include file="field_checkbox.tpl" field=$enabled}}
-       {{include file="field_input.tpl" field=$address}}
-       {{include file="field_checkbox.tpl" field=$nolikes}}
-       {{include file="field_checkbox.tpl" field=$attachimg}}
-       <input type="submit" name="mailstream-submit" value="{{$submit}}">
-</div>
+{{include file="field_checkbox.tpl" field=$enabled}}
+{{include file="field_input.tpl" field=$address}}
+{{include file="field_checkbox.tpl" field=$nolikes}}
+{{include file="field_checkbox.tpl" field=$attachimg}}
index fe533147a7e8303576dfb613d2ac62990a833861..283d8ee20754f6954b758a310130bf672e20b299 100644 (file)
@@ -17,7 +17,7 @@ function markdown_install() {
        Hook::register('addon_settings_post',   __FILE__, 'markdown_addon_settings_post');
 }
 
-function markdown_addon_settings(App $a, &$s)
+function markdown_addon_settings(App $a, array &$data)
 {
        if (!local_user()) {
                return;
@@ -25,12 +25,16 @@ function markdown_addon_settings(App $a, &$s)
 
        $enabled = intval(DI::pConfig()->get(local_user(), 'markdown', 'enabled'));
 
-       $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/markdown/');
-       $s .= Renderer::replaceMacros($t, [
-               '$title'   => DI::l10n()->t('Markdown'),
-               '$enabled' => ['enabled', DI::l10n()->t('Enable Markdown parsing'), $enabled, DI::l10n()->t('If enabled, self created items will additionally be parsed via Markdown.')],
-               '$submit'  => DI::l10n()->t('Save Settings'),
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/markdown/');
+       $html = Renderer::replaceMacros($t, [
+               '$enabled' => ['enabled', DI::l10n()->t('Enable Markdown parsing'), $enabled, DI::l10n()->t('If enabled, adds Markdown support to the Compose Post form.')],
        ]);
+
+       $data = [
+               'addon' => 'markdown',
+               'title' => DI::l10n()->t('Markdown Settings'),
+               'html'  => $html,
+       ];
 }
 
 function markdown_addon_settings_post(App $a, &$b)
index 3d013515043c3898b24a60a27a8c3a06ad0a6acf..2f3f4ce7da9f75ea765e865dc0cf8a60bbefbf25 100644 (file)
@@ -1,15 +1 @@
-<span id="settings_markdown_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_markdown_expanded'); openClose('settings_markdown_inflated');">
-       <h3>{{$title}}</h3>
-</span>
-<div id="settings_markdown_expanded" class="settings-block" style="display: none;">
-       <span class="fakelink" onclick="openClose('settings_markdown_expanded'); openClose('settings_markdown_inflated');">
-               <h3>{{$title}}</h3>
-       </span>
-
-       <div id="markdown-wrapper">
-               {{include file="field_checkbox.tpl" field=$enabled}}
-       </div>
-       <div class="settings-submit-wrapper" >
-               <input type="submit" id="markdown-submit" name="markdown-submit" class="settings-submit" value="{{$submit}}" />
-       </div>
-</div> 
+{{include file="field_checkbox.tpl" field=$enabled}}
index 9734457d616b11e4888d41c21b5fa0bee6df17d0..43b9d861294709be47bbee6f2ff154cde9770ff0 100644 (file)
@@ -29,7 +29,7 @@ function mathjax_settings_post($a)
        DI::pConfig()->set(local_user(), 'mathjax', 'use', intval($_POST['mathjax_use']));
 }
 
-function mathjax_settings(App $a, &$s)
+function mathjax_settings(App $a, array &$data)
 {
        if (!local_user()) {
                return;
@@ -38,12 +38,16 @@ function mathjax_settings(App $a, &$s)
        $use = DI::pConfig()->get(local_user(), 'mathjax', 'use', false);
 
        $tpl = Renderer::getMarkupTemplate('settings.tpl', 'addon/mathjax');
-       $s .= Renderer::replaceMacros($tpl, [
-               '$title'        => 'MathJax',
+       $html = Renderer::replaceMacros($tpl, [
                '$description'  => DI::l10n()->t('The MathJax addon renders mathematical formulae written using the LaTeX syntax surrounded by the usual $$ or an eqnarray block in the postings of your wall,network tab and private mail.'),
                '$mathjax_use'  => ['mathjax_use', DI::l10n()->t('Use the MathJax renderer'), $use, ''],
-               '$savesettings' => DI::l10n()->t('Save Settings'),
        ]);
+
+       $data = [
+               'addon' => 'mathjax',
+               'title' => 'MathJax',
+               'html'  => $html,
+       ];
 }
 
 function mathjax_footer(App $a, &$b)
index e26e5a2b9db8a1085665fa1df2e82d04b0b3fc6a..0966595f65f4fc59467ec6b688b307242283cbca 100644 (file)
@@ -1,16 +1,2 @@
-
-<span id="settings_mathjax_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_mathjax_expanded'); openClose('settings_mathjax_inflated');">
-       <h3>{{$title}}</h3>
-</span>
-<div id="settings_mathjax_expanded" class="settings-block" style="display: none;">
-       <span class="fakelink" onclick="openClose('settings_mathjax_expanded'); openClose('settings_mathjax_inflated');">
-               <h3>{{$title}}</h3>
-       </span>
-       <p>{{$description nofilter}}</p>
-       {{include file="field_checkbox.tpl" field=$mathjax_use}}
-       <div class="clear"></div>
-
-       <div class="settings-submit-wrapper">
-               <button type="submit" id="mathjax-submit" name="mathjax-submit" class="settings-submit" value="1">{{$savesettings}}</button>
-       </div>
-</div>
\ No newline at end of file
+<p>{{$description}}</p>
+{{include file="field_checkbox.tpl" field=$mathjax_use}}
diff --git a/notimeline/templates/settings.tpl b/notimeline/templates/settings.tpl
new file mode 100644 (file)
index 0000000..2f3f4ce
--- /dev/null
@@ -0,0 +1 @@
+{{include file="field_checkbox.tpl" field=$enabled}}
diff --git a/nsfw/nsfw.css b/nsfw/nsfw.css
deleted file mode 100644 (file)
index a8c1bfe..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-
-#nsfw-label, #nsfw-enable-label {
-       float: left;
-       width: 300px;
-       margin-top: 10px;
-}
-
-#nsfw-words, #nsfw-enable {
-       float: left;
-       margin-top: 10px;
-}
-
-#nsfw-submit {
-       margin-top: 15px;
-}
-
-.nsfw-desc {
-       margin-top: 10px;
-}
\ No newline at end of file
index 1cbcf7c8e19bb55ae091d6f50318fe17edb8bf27..67b4c188b63a207708f64dd182873cb26d3354bb 100644 (file)
@@ -7,7 +7,10 @@
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
  *
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 
 function nsfw_install()
@@ -48,41 +51,27 @@ function nsfw_extract_photos($body)
        return $new_body;
 }
 
-function nsfw_addon_settings(&$a, &$s)
+function nsfw_addon_settings(App &$a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       DI::page()->registerStylesheet(__DIR__ . '/nsfw.css', 'all');
-
-
-       $enable_checked = (intval(DI::pConfig()->get(local_user(), 'nsfw', 'disable')) ? '' : ' checked="checked" ');
-       $words = DI::pConfig()->get(local_user(), 'nsfw', 'words');
-       if (!$words) {
-               $words = 'nsfw,';
-       }
-
-       $s .= '<span id="settings_nsfw_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_nsfw_expanded\'); openClose(\'settings_nsfw_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Content Filter (NSFW and more)') . '</h3>';
-       $s .= '</span>';
-       $s .= '<div id="settings_nsfw_expanded" class="settings-block" style="display: none;">';
-       $s .= '<span class="fakelink" onclick="openClose(\'settings_nsfw_expanded\'); openClose(\'settings_nsfw_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Content Filter (NSFW and more)') . '</h3>';
-       $s .= '</span>';
-
-       $s .= '<div id="nsfw-wrapper">';
-       $s .= '<p>' . DI::l10n()->t('This addon searches for specified words/text in posts and collapses them. It can be used to filter content tagged with for instance #NSFW that may be deemed inappropriate at certain times or places, such as being at work. It is also useful for hiding irrelevant or annoying content from direct view.') . '</p>';
-       $s .= '<label id="nsfw-enable-label" for="nsfw-enable">' . DI::l10n()->t('Enable Content filter') . ' </label>';
-       $s .= '<input id="nsfw-enable" type="checkbox" name="nsfw-enable" value="1"' . $enable_checked . ' />';
-       $s .= '<div class="clear"></div>';
-       $s .= '<label id="nsfw-label" for="nsfw-words">' . DI::l10n()->t('Comma separated list of keywords to hide') . ' </label>';
-       $s .= '<textarea id="nsfw-words" type="text" name="nsfw-words">' . $words . '</textarea>';
-       $s .= '</div><div class="clear"></div>';
-
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="nsfw-submit" name="nsfw-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div>';
-       $s .= '<div class="nsfw-desc">' . DI::l10n()->t('Use /expression/ to provide regular expressions') . '</div></div>';
-       return;
+       $enabled = !DI::pConfig()->get(local_user(), 'nsfw', 'disable');
+       $words   = DI::pConfig()->get(local_user(), 'nsfw', 'words', 'nsfw,');
+
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/nsfw/');
+       $html = Renderer::replaceMacros($t, [
+               '$info'    => DI::l10n()->t('This addon searches for specified words/text in posts and collapses them. It can be used to filter content tagged with for instance #NSFW that may be deemed inappropriate at certain times or places, such as being at work. It is also useful for hiding irrelevant or annoying content from direct view.'),
+               '$enabled' => ['nsfw-enable', DI::l10n()->t('Enable Content filter'), $enabled],
+               '$words'   => ['nsfw-words', DI::l10n()->t('Comma separated list of keywords to hide'), $words, DI::l10n()->t('Use /expression/ to provide regular expressions')],
+       ]);
+
+       $data = [
+               'addon' => 'nsfw',
+               'title' => DI::l10n()->t('Content Filter (NSFW and more)'),
+               'html'  => $html,
+       ];
 }
 
 function nsfw_addon_settings_post(&$a, &$b)
@@ -99,7 +88,7 @@ function nsfw_addon_settings_post(&$a, &$b)
        }
 }
 
-function nsfw_prepare_body_content_filter(\Friendica\App $a, &$hook_data)
+function nsfw_prepare_body_content_filter(App $a, &$hook_data)
 {
        $words = null;
        if (DI::pConfig()->get(local_user(), 'nsfw', 'disable')) {
diff --git a/nsfw/templates/settings.tpl b/nsfw/templates/settings.tpl
new file mode 100644 (file)
index 0000000..1e3a2cb
--- /dev/null
@@ -0,0 +1,3 @@
+<p>{{$info}}</p>
+{{include file="field_checkbox.tpl" field=$enabled}}
+{{include file="field_textarea.tpl" field=$words}}
diff --git a/numfriends/numfriends.css b/numfriends/numfriends.css
deleted file mode 100644 (file)
index c92ef8d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-#numfriends-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#numfriends {
-       float: left;
-}
-
-
index 7644c62d90f10fc26b668edb20e256790d46c126..5bea844cf9b4305106c608de959984962e5b06cf 100644 (file)
@@ -5,8 +5,11 @@
  * Version: 1.0
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 
 function numfriends_install() {
@@ -39,30 +42,22 @@ function numfriends_settings_post($a,$post) {
  * Add our own settings info to the page.
  *
  */
-function numfriends_settings(&$a, &$s)
+function numfriends_settings(App &$a, array &$data)
 {
        if (! local_user()) {
                return;
        }
 
-       /* Add our stylesheet to the page so we can make our settings look nice */
-
-       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/numfriends/numfriends.css' . '" media="all" />' . "\r\n";
-
-       /* Get the current state of our config variable */
-
        $numfriends = DI::pConfig()->get(local_user(), 'system', 'display_friend_count', 24);
        
-       /* Add some HTML to the existing form */
-
-       $s .= '<div class="settings-block">';
-       $s .= '<h3>' . DI::l10n()->t('Numfriends Settings') . '</h3>';
-       $s .= '<div id="numfriends-wrapper">';
-       $s .= '<label id="numfriends-label" for="numfriends">' . DI::l10n()->t('How many contacts to display on profile sidebar') . '</label>';
-       $s .= '<input id="numfriends-input" type="text" name="numfriends" value="' . intval($numfriends) . '" ' . '/>';
-       $s .= '</div><div class="clear"></div>';
-
-       /* provide a submit button */
-
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="numfriends-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/numfriends/');
+       $html = Renderer::replaceMacros($t, [
+               '$numfriends' => ['numfriends', DI::l10n()->t('How many contacts to display on profile sidebar'), $numfriends],
+       ]);
+
+       $data = [
+               'addon' => 'numfriends',
+               'title' => DI::l10n()->t('Numfriends Settings'),
+               'html'  => $html,
+       ];
 }
diff --git a/numfriends/templates/settings.tpl b/numfriends/templates/settings.tpl
new file mode 100644 (file)
index 0000000..c8221bb
--- /dev/null
@@ -0,0 +1 @@
+{{include file="field_input.tpl" field=$numfriends}}
index 238185ed364fc5f52828b1458ea90c269ccfd805..c92b5960097ebd22613f3b5efb4534253a2c2a3a 100644 (file)
@@ -68,17 +68,17 @@ function opmlexport(App $a)
 }
 
 
-function opmlexport_addon_settings(App $a, &$s)
+function opmlexport_addon_settings(App $a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/opmlexport/');
-       $s .= Renderer::replaceMacros($t, [
-               '$title'   => DI::l10n()->t('OPML Export'),
-               '$submit'  => DI::l10n()->t('Export RSS/Atom contacts'),
-       ]);
+       $data = [
+               'addon'  => 'opmlexport',
+               'title'  => DI::l10n()->t('OPML Export'),
+               'submit' => DI::l10n()->t('Export RSS/Atom contacts'),
+       ];
 }
 
 
diff --git a/opmlexport/templates/settings.tpl b/opmlexport/templates/settings.tpl
deleted file mode 100644 (file)
index 9f26c51..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-<span id="settings_opmlexport_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_opmlexport_expanded'); openClose('settings_opmlexport_inflated');">
-       <h3>{{$title}}</h3>
-</span>
-<div id="settings_opmlexport_expanded" class="settings-block" style="display: none;">
-       <span class="fakelink" onclick="openClose('settings_opmlexport_expanded'); openClose('settings_opmlexport_inflated');">
-               <h3>{{$title}}</h3>
-       </span>
-
-       <div class="settings-submit-wrapper" >
-               <input type="submit" id="opmlexport-submit" name="opmlexport-submit" class="settings-submit" value="{{$submit}}" />
-       </div>
-</div> 
diff --git a/planets/planets.css b/planets/planets.css
deleted file mode 100644 (file)
index 668b65b..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-#planets-enable-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#planets-checkbox {
-       float: left;
-}
-
-
index 14ae0b3c3bd1015c58297a92b0576ecf6836fb90..ef88db13a181b99b1c76d28cdaf1364b82ddaf1f 100644 (file)
@@ -6,8 +6,11 @@
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
  * Author: Tony Baldwin <https://free-haven.org/profile/tony>
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 
 function planets_install() {
@@ -110,40 +113,22 @@ function planets_settings_post($a,$post) {
 
 
 
-function planets_settings(&$a,&$s) {
-
-       if(! local_user())
+function planets_settings(App &$a, array &$data)
+{
+       if(! local_user()) {
                return;
-
-       /* Add our stylesheet to the page so we can make our settings look nice */
-
-       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/planets/planets.css' . '" media="all" />' . "\r\n";
-
-       /* Get the current state of our config variable */
+       }
 
        $enabled = DI::pConfig()->get(local_user(),'planets','enable');
 
-       $checked = (($enabled) ? ' checked="checked" ' : '');
-
-       /* Add some HTML to the existing form */
-
-    $s .= '<span id="settings_planets_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_planets_expanded\'); openClose(\'settings_planets_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Planets') . '</h3>';
-       $s .= '</span>';
-       $s .= '<div id="settings_planets_expanded" class="settings-block" style="display: none;">';
-       $s .= '<span class="fakelink" onclick="openClose(\'settings_planets_expanded\'); openClose(\'settings_planets_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Planets') . '</h3>';
-       $s .= '</span>';
-
-    $s .= '<div class="settings-block">';
-       $s .= '<h3>' . DI::l10n()->t('Planets Settings') . '</h3>';
-       $s .= '<div id="planets-enable-wrapper">';
-       $s .= '<label id="planets-enable-label" for="planets-checkbox">' . DI::l10n()->t('Enable Planets Addon') . '</label>';
-       $s .= '<input id="planets-checkbox" type="checkbox" name="planets" value="1" ' . $checked . '/>';
-       $s .= '</div><div class="clear"></div></div>';
-
-       /* provide a submit button */
-
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="planets-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/planets/');
+       $html = Renderer::replaceMacros($t, [
+               '$enabled' => ['planets', DI::l10n()->t('Enable Planets Addon'), $enabled],
+       ]);
 
+       $data = [
+               'addon' => 'planets',
+               'title' => DI::l10n()->t('Planets Settings'),
+               'html'  => $html,
+       ];
 }
diff --git a/planets/templates/settings.tpl b/planets/templates/settings.tpl
new file mode 100644 (file)
index 0000000..2f3f4ce
--- /dev/null
@@ -0,0 +1 @@
+{{include file="field_checkbox.tpl" field=$enabled}}
index f662aeccc1f51bb2418efc39c5897f057ffd6317..aec4e9bfd447315836adcd5f7bff15f49f70ef94 100644 (file)
  * them to open the comment window fully and insert the qcomment. Then "Submit" will submit it.
  *
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 use Friendica\Util\XML;
 
@@ -28,27 +31,30 @@ function qcomment_install()
        Hook::register('footer'             , __FILE__, 'qcomment_footer');
 }
 
-function qcomment_footer(\Friendica\App $a, &$b)
+function qcomment_footer(App $a, &$b)
 {
        DI::page()->registerFooterScript('addon/qcomment/qcomment.js');
 }
 
-function qcomment_addon_settings(&$a, &$s)
+function qcomment_addon_settings(App &$a, array &$data)
 {
-       if (! local_user()) {
+       if (!local_user()) {
                return;
        }
 
-       $words = DI::pConfig()->get(local_user(), 'qcomment', 'words', DI::l10n()->t(':-)') . "\n" . DI::l10n()->t(':-(') . "\n" .  DI::l10n()->t('lol'));
+       $words = DI::pConfig()->get(local_user(), 'qcomment', 'words', DI::l10n()->t(':-)') . "\n" . DI::l10n()->t(':-(') . "\n" . DI::l10n()->t('lol'));
 
-       $t = \Friendica\Core\Renderer::getMarkupTemplate('settings.tpl', 'addon/qcomment/');
-       $s .= \Friendica\Core\Renderer::replaceMacros($t, [
-               '$postpost'    => isset($_POST['qcomment-words']),
-               '$header'      => DI::l10n()->t('Quick Comment Settings'),
-               '$description' => DI::l10n()->t("Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies."),
-               '$save'        => DI::l10n()->t('Save Settings'),
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/qcomment/');
+       $html = Renderer::replaceMacros($t, [
+               '$description' => DI::l10n()->t('Quick comments are found near comment boxes, sometimes hidden. Click them to provide simple replies.'),
                '$words'       => ['qcomment-words', DI::l10n()->t('Enter quick comments, one per line'), $words, null, ' rows="10"'],
        ]);
+
+       $data = [
+               'addon' => 'qcomment',
+               'title' => DI::l10n()->t('Quick Comment Settings'),
+               'html'  => $html,
+       ];
 }
 
 function qcomment_addon_settings_post(&$a, &$b)
index 31ccea86d38aeaa0791abd156cdc6439cdf4e7c2..a9bf0d2e40b719e22bbaea5670de4a3a83f37827 100644 (file)
@@ -1,21 +1,2 @@
-<span id="settings_qcomment_inflated" class="settings-block fakelink"
-      style="{{if $postpost}}display: none;{{else}}display: block;{{/if}}"
-      onclick="openClose('settings_qcomment_expanded'); openClose('settings_qcomment_inflated');">
-               <h3>{{$header}}</h3>
-</span>
-<div id="settings_qcomment_expanded" class="settings-block"
-     style="{{if $postpost}}display: block;{{else}}display: none;{{/if}}">
-       <span class="fakelink" onclick="openClose('settings_qcomment_expanded'); openClose('settings_qcomment_inflated');">
-               <h3>{{$header}}</h3>
-       </span>
-
-       <div id="qcomment-wrapper">
-               <p id="qcomment-desc">{{$description}}</p>
-
-               {{include file="field_textarea.tpl" field=$words}}
-
-               <div class="settings-submit-wrapper">
-                       <button type="submit" id="qcomment-submit" name="qcomment-submit" class="btn btn-primary settings-submit">{{$save}}</button>
-               </div>
-       </div>
-</div>
+<p>{{$description}}</p>
+{{include file="field_textarea.tpl" field=$words}}
diff --git a/randplace/randplace.css b/randplace/randplace.css
deleted file mode 100644 (file)
index bd7af6d..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-#randplace-enable-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#randplace-checkbox {
-       float: left;
-}
-
-
index d831bfe3b2d2adce660f0d222e394d79d3aac0e5..69ad4d52d8051196b64eb43cc4ab9f3256a698f8 100644 (file)
  * system will call the name_uninstall() function.
  *
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 
 function randplace_install() {
@@ -145,32 +148,22 @@ function randplace_settings_post($a,$post) {
 
 
 
-function randplace_settings(&$a,&$s) {
-
-       if(! local_user())
+function randplace_settings(App &$a, array &$data)
+{
+       if(! local_user()) {
                return;
-
-       /* Add our stylesheet to the page so we can make our settings look nice */
-
-       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/randplace/randplace.css' . '" media="all" />' . "\r\n";
-
-       /* Get the current state of our config variable */
+       }
 
        $enabled = DI::pConfig()->get(local_user(),'randplace','enable');
 
-       $checked = (($enabled) ? ' checked="checked" ' : '');
-
-       /* Add some HTML to the existing form */
-
-       $s .= '<div class="settings-block">';
-       $s .= '<h3>' . DI::l10n()->t('Randplace Settings') . '</h3>';
-       $s .= '<div id="randplace-enable-wrapper">';
-       $s .= '<label id="randplace-enable-label" for="randplace-checkbox">' . DI::l10n()->t('Enable Randplace Addon') . '</label>';
-       $s .= '<input id="randplace-checkbox" type="checkbox" name="randplace" value="1" ' . $checked . '/>';
-       $s .= '</div><div class="clear"></div>';
-
-       /* provide a submit button */
-
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="randplace-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/randplace/');
+       $html = Renderer::replaceMacros($t, [
+               '$enabled' => ['randplace', DI::l10n()->t('Enable Randplace Addon'), $enabled],
+       ]);
 
+       $data = [
+               'addon' => 'randplace',
+               'title' => DI::l10n()->t('Randplace Settings'),
+               'html'  => $html,
+       ];
 }
diff --git a/randplace/templates/settings.tpl b/randplace/templates/settings.tpl
new file mode 100644 (file)
index 0000000..2f3f4ce
--- /dev/null
@@ -0,0 +1 @@
+{{include file="field_checkbox.tpl" field=$enabled}}
index 9ab596ab163e4d60ef7e26cc0b42e08f98898d2c..62673eb190ed936346c1ddb500e393e8fcf84ccf 100644 (file)
@@ -36,24 +36,30 @@ function securemail_install()
  *
  * @see   App
  */
-function securemail_settings(App &$a, &$s)
+function securemail_settings(App &$a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       $enable = intval(DI::pConfig()->get(local_user(), 'securemail', 'enable'));
+       $enabled   = intval(DI::pConfig()->get(local_user(), 'securemail', 'enable'));
        $publickey = DI::pConfig()->get(local_user(), 'securemail', 'pkey');
 
-       $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/securemail/');
-
-       $s .= Renderer::replaceMacros($t, [
-               '$title' => DI::l10n()->t('"Secure Mail" Settings'),
-               '$submit' => DI::l10n()->t('Save Settings'),
-               '$test' => DI::l10n()->t('Save and send test'), //NOTE: update also in 'post'
-               '$enable' => ['securemail-enable', DI::l10n()->t('Enable Secure Mail'), $enable, ''],
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/securemail/');
+       $html = Renderer::replaceMacros($t, [
+               '$enabled'   => ['securemail-enable', DI::l10n()->t('Enable Secure Mail'), $enabled],
                '$publickey' => ['securemail-pkey', DI::l10n()->t('Public key'), $publickey, DI::l10n()->t('Your public PGP key, ascii armored format')]
        ]);
+
+       $data = [
+               'addon'  => 'securemail',
+               'title'  => DI::l10n()->t('"Secure Mail" Settings'),
+               'html'   => $html,
+               'submit' => [
+                       'securemail-submit' => DI::l10n()->t('Save Settings'),
+                       'securemail-test'   => DI::l10n()->t('Save and send test'),
+               ],
+       ];
 }
 
 /**
@@ -72,13 +78,12 @@ function securemail_settings_post(App &$a, array &$b)
                return;
        }
 
-       if ($_POST['securemail-submit']) {
+       if (!empty($_POST['securemail-submit']) || !empty($_POST['securemail-test'])) {
                DI::pConfig()->set(local_user(), 'securemail', 'pkey', trim($_POST['securemail-pkey']));
                $enable = (!empty($_POST['securemail-enable']) ? 1 : 0);
                DI::pConfig()->set(local_user(), 'securemail', 'enable', $enable);
 
-               if ($_POST['securemail-submit'] == 'test') {
-
+               if (!empty($_POST['securemail-test'])) {
                        $res = DI::emailer()->send(new SecureTestEmail(DI::app(), DI::config(), DI::pConfig(), DI::baseUrl()));
 
                        // revert to saved value
diff --git a/securemail/templates/admin.tpl b/securemail/templates/admin.tpl
deleted file mode 100644 (file)
index ec35e33..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-<span id="settings_securemail_inflated" class="settings-block fakelink" style="display: block" onclick="openClose('settings_securemail_expanded'); openClose('settings_securemail_inflated');">
-  <h3>{{$title}}</h3>
-</span>
-<div id="settings_securemail_expanded" class="settings-block" style="display: none">
-  <span class="fakelink" onclick="openClose('settings_securemail_expanded'); openClose('settings_securemail_inflated');"><h3>{{$title}}</h3></span>
-  <div id="securemail-wrapper">
-    {{include file="field_checkbox.tpl" field=$enable}}
-    {{include file="field_textarea.tpl" field=$publickey}}
-
-    <div class="form-group pull-right settings-submit-wrapper" >
-      <button type="submit" name="securemail-submit" class="btn btn-primary" value="submit">{{$submit}}</button>
-      <button type="submit" name="securemail-submit" class="btn btn-default" value="test">{{$test}}</button>
-    </div>
-    <div class="clear"></div>
-  </div>
-</div>
diff --git a/securemail/templates/settings.tpl b/securemail/templates/settings.tpl
new file mode 100644 (file)
index 0000000..110a3a7
--- /dev/null
@@ -0,0 +1,2 @@
+{{include file="field_checkbox.tpl" field=$enabled}}
+{{include file="field_textarea.tpl" field=$publickey}}
index 574be70faf7ebe00e2603468e1874cdb8933b9ff..945277aeb6d9a871ea192b933c3f76c852495d63 100644 (file)
@@ -7,7 +7,10 @@
  *         based upon NSFW from Mike Macgirvin <http://macgirvin.com/profile/mike>
  *
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 use Friendica\Util\Strings;
 
@@ -18,7 +21,7 @@ function showmore_install()
        Hook::register('addon_settings_post', 'addon/showmore/showmore.php', 'showmore_addon_settings_post');
 }
 
-function showmore_addon_settings(&$a, &$s)
+function showmore_addon_settings(App &$a, array &$data)
 {
        if (!local_user()) {
                return;
@@ -26,31 +29,20 @@ function showmore_addon_settings(&$a, &$s)
 
        DI::page()->registerStylesheet(__DIR__ . '/showmore.css', 'all');
 
-       $enable_checked = (intval(DI::pConfig()->get(local_user(), 'showmore', 'disable')) ? '' : ' checked="checked"');
-       $chars = DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100);
-
-       $s .= '<span id="settings_showmore_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_showmore_expanded\'); openClose(\'settings_showmore_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('"Show more" Settings').'</h3>';
-       $s .= '</span>';
-       $s .= '<div id="settings_showmore_expanded" class="settings-block" style="display: none;">';
-       $s .= '<span class="fakelink" onclick="openClose(\'settings_showmore_expanded\'); openClose(\'settings_showmore_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('"Show more" Settings').'</h3>';
-       $s .= '</span>';
-
-       $s .= '<div id="showmore-wrapper">';
-
-       $s .= '<label id="showmore-enable-label" for="showmore-enable">'.DI::l10n()->t('Enable Show More').'</label>';
-       $s .= '<input id="showmore-enable" type="checkbox" name="showmore-enable" value="1"'.$enable_checked.' />';
-       $s .= '<div class="clear"></div>';
-       $s .= '<label id="showmore-label" for="showmore-chars">'.DI::l10n()->t('Cutting posts after how much characters').' </label>';
-       $s .= '<input id="showmore-words" type="text" name="showmore-chars" value="'.$chars.'" />';
-       $s .= '</div><div class="clear"></div>';
+       $enabled = !DI::pConfig()->get(local_user(), 'showmore', 'disable');
+       $chars   = DI::pConfig()->get(local_user(), 'showmore', 'chars', 1100);
 
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="showmore-submit" name="showmore-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div>';
-//     $s .= '<div class="showmore-desc">' . DI::l10n()->t('Use /expression/ to provide regular expressions') . '</div>';
-       $s .= '</div>';
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore/');
+       $html = Renderer::replaceMacros($t, [
+               '$enabled' => ['showmore-enable', DI::l10n()->t('Enable Show More'), $enabled],
+               '$chars'   => ['showmore-chars', DI::l10n()->t('Cutting posts after how many characters'), $chars],
+       ]);
 
-       return;
+       $data = [
+               'addon' => 'showmore',
+               'title' => DI::l10n()->t('"Show more" Settings'),
+               'html'  => $html,
+       ];
 }
 
 function showmore_addon_settings_post(&$a, &$b)
@@ -101,7 +93,7 @@ function get_body_length($body)
        return strlen($string);
 }
 
-function showmore_prepare_body(\Friendica\App $a, &$hook_data)
+function showmore_prepare_body(App $a, &$hook_data)
 {
        // No combination with content filters
        if (!empty($hook_data['filter_reasons'])) {
diff --git a/showmore/templates/settings.tpl b/showmore/templates/settings.tpl
new file mode 100644 (file)
index 0000000..b1887d6
--- /dev/null
@@ -0,0 +1,3 @@
+<p>{{$info}}</p>
+{{include file="field_checkbox.tpl" field=$enabled}}
+{{include file="field_input.tpl" field=$chars}}
index bf8f5608dc1d80004c35509cdd97660568937f4b..39dfa489b3ec1e1f0ad7970eb06f351619aecc0f 100644 (file)
@@ -45,7 +45,7 @@ function showmore_dyn_settings_post()
        }
 }
 
-function showmore_dyn_settings(App &$a, &$o)
+function showmore_dyn_settings(App &$a, array &$data)
 {
        if(!local_user()) {
                return;
@@ -55,12 +55,15 @@ function showmore_dyn_settings(App &$a, &$o)
        DI::pConfig()->set(local_user(), 'showmore_dyn', 'limitHeight', $limitHeight);
 
        $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/showmore_dyn/');
-       $o .= Renderer::replaceMacros($t, [
-               '$submit' => DI::l10n()->t('Save Settings'),
-               '$header' => DI::l10n()->t('Show More Dynamic'),
+       $html = Renderer::replaceMacros($t, [
                '$limitHeight' => ['limitHeight', DI::l10n()->t('Limit Height'), $limitHeight, DI::l10n()->t('The maximal pixel height of posts before the Show More link is added, 0 to disable'), '', '', 'number'],
        ]);
 
+       $data = [
+               'addon' => 'showmore_dyn',
+               'title' => DI::l10n()->t('Show More Dynamic'),
+               'html'  => $html,
+       ];
 }
 
 function showmore_dyn_script()
index ac37e937d2d13de45ea8ff4f8cb11bcc42fe0d16..a6a283ad97ad2f5ff29b91e45d99e34701189f58 100644 (file)
@@ -1,13 +1 @@
-<span id="settings_showmore_dyn_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose('settings_showmore_dyn_expanded'); openClose('settings_showmore_dyn_inflated');">
-       <h3>{{$header}}</h3>
-</span>
-<div id="settings_showmore_dyn_expanded" class="settings-block" style="display: none;">
-       <span class="fakelink" onclick="openClose('settings_showmore_dyn_expanded'); openClose('settings_showmore_dyn_inflated');">
-               <h3>{{$header}}</h3>
-       </span>
-       {{include file="field_input.tpl" field=$limitHeight}}
-
-       <div class="settings-submit-wrapper">
-               <input type="submit" value="{{$submit}}" class="settings-submit" name="showmore_dyn-submit" />
-       </div>
-</div>
+{{include file="field_input.tpl" field=$limitHeight}}
diff --git a/startpage/startpage.css b/startpage/startpage.css
deleted file mode 100644 (file)
index e78be7e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-
-
-
-#startpage-page-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#startpage-page {
-       float: left;
-}
-
-#startpage-desc {
-       margin-bottom: 10px;
-}
index 8cdf444f1c206012dab7db900dfabed8a63ac840..d72effde22fdb032be2ce1fa8a33effb57696ec9 100644 (file)
@@ -6,7 +6,10 @@
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
  *
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 
 function startpage_install() {
@@ -54,36 +57,22 @@ function startpage_settings_post($a, $post)
  * Add our own settings info to the page.
  *
  */
-function startpage_settings(&$a, &$s)
+function startpage_settings(App &$a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       /* Add our stylesheet to the page so we can make our settings look nice */
-
-       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/startpage/startpage.css' . '" media="all" />' . "\r\n";
-
-       /* Get the current state of our config variable */
-
-       $page = DI::pConfig()->get(local_user(), 'startpage', 'startpage');
-
-       /* Add some HTML to the existing form */
-
-       $s .= '<span id="settings_startpage_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_startpage_expanded\'); openClose(\'settings_startpage_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Startpage') . '</h3>';
-       $s .= '</span>';
-       $s .= '<div id="settings_startpage_expanded" class="settings-block" style="display: none;">';
-       $s .= '<span class="fakelink" onclick="openClose(\'settings_startpage_expanded\'); openClose(\'settings_startpage_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Startpage') . '</h3>';
-       $s .= '</span>';
-       $s .= '<div id="startpage-page-wrapper">';
-       $s .= '<label id="startpage-page-label" for="startpage-page">' . DI::l10n()->t('Home page to load after login  - leave blank for profile wall') . '</label>';
-       $s .= '<input id="startpage-page" type="text" name="startpage" value="' . $page . '" />';
-       $s .= '</div><div class="clear"></div>';
-       $s .= '<div id="startpage-desc">' . DI::l10n()->t('Examples: &quot;network&quot; or &quot;notifications/system&quot;') . '</div>';
+       $startpage = DI::pConfig()->get(local_user(), 'startpage', 'startpage');
 
-       /* provide a submit button */
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/startpage/');
+       $html = Renderer::replaceMacros($t, [
+               '$startpage' => ['startpage', DI::l10n()->t('Home page to load after login  - leave blank for profile wall'), $startpage, DI::l10n()->t('Examples: "network" or "notifications/system"')],
+       ]);
 
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="startpage-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
+       $data = [
+               'addon' => 'startpage',
+               'title' => DI::l10n()->t('Startpage'),
+               'html'  => $html,
+       ];
 }
diff --git a/startpage/templates/settings.tpl b/startpage/templates/settings.tpl
new file mode 100644 (file)
index 0000000..7078a83
--- /dev/null
@@ -0,0 +1 @@
+{{include file="field_input.tpl" field=$startpage}}
diff --git a/superblock/superblock.css b/superblock/superblock.css
deleted file mode 100644 (file)
index 368355b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-
-#superblock-label {
-       float: left;
-       width: 300px;
-       margin-top: 10px;
-}
-
-#superblock-words {
-       float: left;
-       margin-top: 10px;
-       width: 400px;
-       height: 150px;
-}
-
-#superblock-submit {
-       margin-top: 15px;
-}
-
index d31860874358d59bdff0b736428e1dfcc5d86655..5c5cfcc3c1f97e01f6214448d1cb970864a822c0 100644 (file)
@@ -6,7 +6,10 @@
  * Author: Mike Macgirvin <http://macgirvin.com/profile/mike>
  *
  */
+
+use Friendica\App;
 use Friendica\Core\Hook;
+use Friendica\Core\Renderer;
 use Friendica\DI;
 use Friendica\Util\Strings;
 
@@ -19,35 +22,24 @@ function superblock_install()
        Hook::register('enotify_store', 'addon/superblock/superblock.php', 'superblock_enotify_store');
 }
 
-function superblock_addon_settings(&$a, &$s)
+function superblock_addon_settings(App &$a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       DI::page()->registerStylesheet(__DIR__ . '/superblock.css', 'all');
-
+       $blocked = DI::pConfig()->get(local_user(), 'system', 'blocked', '');
 
-       $words = DI::pConfig()->get(local_user(), 'system', 'blocked');
-       if (!$words) {
-               $words = '';
-       }
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/superblock/');
+       $html = Renderer::replaceMacros($t, [
+               '$urls' => ['superblock-words', DI::l10n()->t('Comma separated profile URLs to block'), $blocked],
+       ]);
 
-       $s .= '<span id="settings_superblock_inflated" class="settings-block fakelink" style="display: block;" onclick="openClose(\'settings_superblock_expanded\'); openClose(\'settings_superblock_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Superblock') . '</h3>';
-       $s .= '</span>';
-       $s .= '<div id="settings_superblock_expanded" class="settings-block" style="display: none;">';
-       $s .= '<span class="fakelink" onclick="openClose(\'settings_superblock_expanded\'); openClose(\'settings_superblock_inflated\');">';
-       $s .= '<h3>' . DI::l10n()->t('Superblock') . '</h3>';
-       $s .= '</span>';
-       $s .= '<div id="superblock-wrapper">';
-       $s .= '<label id="superblock-label" for="superblock-words">' . DI::l10n()->t('Comma separated profile URLS to block') . ' </label>';
-       $s .= '<textarea id="superblock-words" type="text" name="superblock-words" >' . htmlspecialchars($words) . '</textarea>';
-       $s .= '</div><div class="clear"></div>';
-
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="superblock-submit" name="superblock-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div></div>';
-
-       return;
+       $data = [
+               'addon' => 'superblock',
+               'title' => DI::l10n()->t('Superblock'),
+               'html'  => $html,
+       ];
 }
 
 function superblock_addon_settings_post(&$a, &$b)
diff --git a/superblock/templates/settings.tpl b/superblock/templates/settings.tpl
new file mode 100644 (file)
index 0000000..113588e
--- /dev/null
@@ -0,0 +1 @@
+{{include file="field_textarea.tpl" field=$urls}}
diff --git a/windowsphonepush/templates/settings.tpl b/windowsphonepush/templates/settings.tpl
new file mode 100644 (file)
index 0000000..9198225
--- /dev/null
@@ -0,0 +1,3 @@
+{{include file="field_checkbox.tpl" field=$enabled}}
+{{include file="field_checkbox.tpl" field=$senditemtext}}
+{{include file="field_input.tpl" field=$device_url}}
diff --git a/windowsphonepush/windowsphonepush.css b/windowsphonepush/windowsphonepush.css
deleted file mode 100644 (file)
index 95ba6d2..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#windowsphonepush-device_url-wrapper {
-       margin-top: 25px;
-}
-
-
-#windowsphonepush-enable-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#windowsphonepush-enable-chk {
-       float: left;
-}
-
-#windowsphonepush-device_url-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#windowsphonepush-device_url-text {
-       float: left;
-       background-color: #C0C0C0; 
-       width: 500px;
-}
-
-#windowsphonepush-senditemtext-label {
-       float: left;
-       width: 200px;
-       margin-bottom: 25px;
-}
-
-#windowsphonepush-senditemtext-chk {
-       float: left;
-}
index d2529eea842b2609ede4e56b8c12c59aac39c515..8f289d124a1a1b1a7435936bcb535f91903be84d 100644 (file)
@@ -31,6 +31,7 @@ use Friendica\Content\Text\BBCode;
 use Friendica\Content\Text\HTML;
 use Friendica\Core\Hook;
 use Friendica\Core\Logger;
+use Friendica\Core\Renderer;
 use Friendica\Database\DBA;
 use Friendica\DI;
 use Friendica\Model\Item;
@@ -86,48 +87,28 @@ function windowsphonepush_settings_post($a, $post)
 /* Called from the Addon Setting form.
  * Add our own settings info to the page.
  */
-function windowsphonepush_settings(&$a, &$s)
+function windowsphonepush_settings(App &$a, array &$data)
 {
        if (!local_user()) {
                return;
        }
 
-       /* Add our stylesheet to the page so we can make our settings look nice */
-       DI::page()['htmlhead'] .= '<link rel="stylesheet"  type="text/css" href="' . DI::baseUrl()->get() . '/addon/windowsphonepush/windowsphonepush.css' . '" media="all" />' . "\r\n";
-
-       /* Get the current state of our config variables */
        $enabled = DI::pConfig()->get(local_user(), 'windowsphonepush', 'enable');
-       $checked_enabled = (($enabled) ? ' checked="checked" ' : '');
-
        $senditemtext = DI::pConfig()->get(local_user(), 'windowsphonepush', 'senditemtext');
-       $checked_senditemtext = (($senditemtext) ? ' checked="checked" ' : '');
-
        $device_url = DI::pConfig()->get(local_user(), 'windowsphonepush', 'device_url');
 
-       /* Add some HTML to the existing form */
-       $s .= '<div class="settings-block">';
-       $s .= '<h3>' . DI::l10n()->t('WindowsPhonePush Settings') . '</h3>';
-
-       $s .= '<div id="windowsphonepush-enable-wrapper">';
-       $s .= '<label id="windowsphonepush-enable-label" for="windowsphonepush-enable-chk">' . DI::l10n()->t('Enable WindowsPhonePush Addon') . '</label>';
-       $s .= '<input id="windowsphonepush-enable-chk" type="checkbox" name="windowsphonepush" value="1" ' . $checked_enabled . '/>';
-       $s .= '</div><div class="clear"></div>';
-
-       $s .= '<div id="windowsphonepush-senditemtext-wrapper">';
-       $s .= '<label id="windowsphonepush-senditemtext-label" for="windowsphonepush-senditemtext-chk">' . DI::l10n()->t('Push text of new item') . '</label>';
-       $s .= '<input id="windowsphonepush-senditemtext-chk" type="checkbox" name="windowsphonepush-senditemtext" value="1" ' . $checked_senditemtext . '/>';
-       $s .= '</div><div class="clear"></div>';
-
-       /* provide a submit button - enable und senditemtext can be changed by the user */
-       $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="windowsphonepush-submit" name="windowsphonepush-submit" class="settings-submit" value="' . DI::l10n()->t('Save Settings') . '" /></div><div class="clear"></div>';
-
-       /* provide further read-only information concerning the addon (useful for */
-       $s .= '<div id="windowsphonepush-device_url-wrapper">';
-       $s .= '<label id="windowsphonepush-device_url-label" for="windowsphonepush-device_url-text">Device-URL</label>';
-       $s .= '<input id="windowsphonepush-device_url-text" type="text" readonly value=' . $device_url . '/>';
-       $s .= '</div><div class="clear"></div></div>';
-
-       return;
+       $t    = Renderer::getMarkupTemplate('settings.tpl', 'addon/windowsphonepush/');
+       $html = Renderer::replaceMacros($t, [
+               '$enabled'   => ['windowsphonepush', DI::l10n()->t('Enable WindowsPhonePush Addon'), $enabled],
+               '$senditemtext'   => ['windowsphonepush-senditemtext', DI::l10n()->t('Push text of new item'), $senditemtext],
+               '$device_url'   => ['', DI::l10n()->t('Device URL'), $device_url, '', false, ' readonly'],
+       ]);
+
+       $data = [
+               'addon' => 'windowsphonepush',
+               'title' => DI::l10n()->t('WindowsPhonePush Settings'),
+               'html'  => $html,
+       ];
 }
 
 /* Cron function used to regularly check all users on the server with active windowsphonepushaddon and send