*
*
*/
-use Friendica\Core\Addon;
+use Friendica\Core\Hook;
use Friendica\Core\L10n;
use Friendica\Core\Logger;
use Friendica\Core\PConfig;
+use Friendica\Core\Renderer;
function gnot_install() {
- Addon::registerHook('addon_settings', 'addon/gnot/gnot.php', 'gnot_settings');
- Addon::registerHook('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post');
- Addon::registerHook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail');
+ Hook::register('addon_settings', 'addon/gnot/gnot.php', 'gnot_settings');
+ Hook::register('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post');
+ Hook::register('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail');
Logger::log("installed gnot");
}
function gnot_uninstall() {
- Addon::unregisterHook('addon_settings', 'addon/gnot/gnot.php', 'gnot_settings');
- Addon::unregisterHook('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post');
- Addon::unregisterHook('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail');
+ Hook::unregister('addon_settings', 'addon/gnot/gnot.php', 'gnot_settings');
+ Hook::unregister('addon_settings_post', 'addon/gnot/gnot.php', 'gnot_settings_post');
+ Hook::unregister('enotify_mail', 'addon/gnot/gnot.php', 'gnot_enotify_mail');
Logger::log("removed gnot");
*/
function gnot_settings_post($a,$post) {
- if(! local_user() || (! x($_POST,'gnot-submit')))
+ if(! local_user() || empty($_POST['gnot-submit']))
return;
PConfig::set(local_user(),'gnot','enable',intval($_POST['gnot']));
$gnot_checked = (($gnot) ? ' checked="checked" ' : '' );
+ $t = Renderer::getMarkupTemplate('settings.tpl', 'addon/gnot/');
/* Add some HTML to the existing form */
- $s .= '<div class="settings-block">';
- $s .= '<h3>' . L10n::t('Gnot Settings') . '</h3>';
- $s .= '<div id="gnot-wrapper">';
- $s .= '<div id="gnot-desc">' . L10n::t("Allows threading of email comment notifications on Gmail and anonymising the subject line.") . '</div>';
- $s .= '<label id="gnot-label" for="gnot">' . L10n::t('Enable this addon?') . '</label>';
- $s .= '<input id="gnot-input" type="checkbox" name="gnot" value="1"'. $gnot_checked . '/>';
- $s .= '</div><div class="clear"></div>';
-
- /* provide a submit button */
-
- $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="gnot-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
-
+ $s .= Renderer::replaceMacros($t, [
+ '$title' => L10n::t('Gnot Settings') ,
+ '$submit' => L10n::t('Save Settings'),
+ '$enable' => L10n::t('Enable this addon?'),
+ '$enabled' => $gnot_checked,
+ '$text' => L10n::t("Allows threading of email comment notifications on Gmail and anonymising the subject line.")
+ ]);
}