***/ use Friendica\Content\Text\BBCode; use Friendica\Core\Config; use Friendica\Core\Hook; use Friendica\Core\Logger; use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Util\Strings; function newmemberwidget_install() { Hook::register( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); Logger::log('newmemberwidget installed'); } function newmemberwidget_uninstall() { Hook::unregister( 'network_mod_init', 'addon/newmemberwidget/newmemberwidget.php', 'newmemberwidget_network_mod_init'); } function newmemberwidget_network_mod_init ($a, $b) { if (empty($_SESSION['new_member'])) { return; } $t = '
'; DI::page()['aside'] = $t . DI::page()['aside']; } function newmemberwidget_addon_admin_post(&$a) { $ft = (!empty($_POST['freetext']) ? trim($_POST['freetext']) : ""); $lsn = (!empty($_POST['localsupportname']) ? Strings::escapeTags(trim($_POST['localsupportname'])) : ""); $gs = intval($_POST['linkglobalsupport']); $ls = intval($_POST['linklocalsupport']); Config::set('newmemberwidget', 'freetext', trim($ft)); Config::set('newmemberwidget', 'linkglobalsupport', $gs); Config::set('newmemberwidget', 'linklocalsupport', $ls); Config::set('newmemberwidget', 'localsupport', trim($lsn)); } function newmemberwidget_addon_admin(&$a, &$o) { $t = Renderer::getMarkupTemplate('admin.tpl', 'addon/newmemberwidget'); $o = Renderer::replaceMacros($t, [ '$submit' => DI::l10n()->t('Save Settings'), '$freetext' => [ "freetext", DI::l10n()->t("Message"), DI::config()->get("newmemberwidget", "freetext"), DI::l10n()->t("Your message for new members. You can use bbcode here.")], '$linkglobalsupport' => [ "linkglobalsupport", DI::l10n()->t('Add a link to global support forum'), DI::config()->get('newmemberwidget', 'linkglobalsupport'), DI::l10n()->t('Should a link to the global support forum be displayed?')." (@helpers)"], '$linklocalsupport' => [ "linklocalsupport", DI::l10n()->t('Add a link to the local support forum'), DI::config()->get('newmemberwidget', 'linklocalsupport'), DI::l10n()->t('If you have a local support forum and want to have a link displayed in the widget, check this box.')], '$localsupportname' => [ "localsupportname", DI::l10n()->t('Name of the local support group'), DI::config()->get('newmemberwidget', 'localsupport'), DI::l10n()->t('If you checked the above, specify the nickname of the local support group here (i.e. helpers)')], ]); }