-function mailstream_addon_settings(&$a,&$s) {
- $enabled = PConfig::get(local_user(), 'mailstream', 'enabled');
- $address = PConfig::get(local_user(), 'mailstream', 'address');
- $nolikes = PConfig::get(local_user(), 'mailstream', 'nolikes');
- $attachimg= PConfig::get(local_user(), 'mailstream', 'attachimg');
- $template = Renderer::getMarkupTemplate('settings.tpl', 'addon/mailstream/');
- $s .= Renderer::replaceMacros($template, [
- '$enabled' => [
- 'mailstream_enabled',
- L10n::t('Enabled'),
- $enabled],
- '$address' => [
- 'mailstream_address',
- L10n::t('Email Address'),
- $address,
- L10n::t("Leave blank to use your account email address")],
- '$nolikes' => [
- 'mailstream_nolikes',
- L10n::t('Exclude Likes'),
- $nolikes,
- L10n::t("Check this to omit mailing \"Like\" notifications")],
- '$attachimg' => [
- 'mailstream_attachimg',
- L10n::t('Attach Images'),
- $attachimg,
- L10n::t("Download images in posts and attach them to the email. Useful for reading email while offline.")],
- '$title' => L10n::t('Mail Stream Settings'),
- '$submit' => L10n::t('Save Settings')]);
+/**
+ * Form for configuring mailstream features for a user
+ *
+ * @param array $data Hook data array
+ * @throws \Friendica\Network\HTTPException\ServiceUnavailableException
+ */
+function mailstream_addon_settings(array &$data)
+{
+ $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'enabled');
+ $address = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'address');
+ $nolikes = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'nolikes');
+ $attachimg = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'mailstream', 'attachimg');
+
+ $template = Renderer::getMarkupTemplate('settings.tpl', 'addon/mailstream/');
+ $html = Renderer::replaceMacros($template, [
+ '$enabled' => [
+ 'mailstream_enabled',
+ DI::l10n()->t('Enabled'),
+ $enabled
+ ],
+ '$address' => [
+ 'mailstream_address',
+ DI::l10n()->t('Email Address'),
+ $address,
+ DI::l10n()->t('Leave blank to use your account email address')
+ ],
+ '$nolikes' => [
+ 'mailstream_nolikes',
+ DI::l10n()->t('Exclude Likes'),
+ $nolikes,
+ 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.')
+ ],
+ ]);
+
+ $data = [
+ 'addon' => 'mailstream',
+ 'title' => DI::l10n()->t('Mail Stream Settings'),
+ 'html' => $html,
+ ];