-function ljpost_settings(&$a,&$s) {
-
- if(! local_user())
- return;
-
- /* Add our stylesheet to the page so we can make our settings look nice */
-
- $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' . $a->getBaseURL() . '/addon/ljpost/ljpost.css' . '" media="all" />' . "\r\n";
-
- /* Get the current state of our config variables */
-
- $enabled = PConfig::get(local_user(),'ljpost','post');
-
- $checked = (($enabled) ? ' checked="checked" ' : '');
-
- $def_enabled = PConfig::get(local_user(),'ljpost','post_by_default');
-
- $def_checked = (($def_enabled) ? ' checked="checked" ' : '');
-
- $lj_username = PConfig::get(local_user(), 'ljpost', 'lj_username');
- $lj_password = PConfig::get(local_user(), 'ljpost', 'lj_password');
-
-
- /* Add some HTML to the existing form */
-
- $s .= '<div class="settings-block">';
- $s .= '<h3>' . L10n::t('LiveJournal Post Settings') . '</h3>';
- $s .= '<div id="ljpost-enable-wrapper">';
- $s .= '<label id="ljpost-enable-label" for="ljpost-checkbox">' . L10n::t('Enable LiveJournal Post Addon') . '</label>';
- $s .= '<input id="ljpost-checkbox" type="checkbox" name="ljpost" value="1" ' . $checked . '/>';
- $s .= '</div><div class="clear"></div>';
-
- $s .= '<div id="ljpost-username-wrapper">';
- $s .= '<label id="ljpost-username-label" for="ljpost-username">' . L10n::t('LiveJournal username') . '</label>';
- $s .= '<input id="ljpost-username" type="text" name="lj_username" value="' . $lj_username . '" />';
- $s .= '</div><div class="clear"></div>';
-
- $s .= '<div id="ljpost-password-wrapper">';
- $s .= '<label id="ljpost-password-label" for="ljpost-password">' . L10n::t('LiveJournal password') . '</label>';
- $s .= '<input id="ljpost-password" type="password" name="lj_password" value="' . $lj_password . '" />';
- $s .= '</div><div class="clear"></div>';
-
- $s .= '<div id="ljpost-bydefault-wrapper">';
- $s .= '<label id="ljpost-bydefault-label" for="ljpost-bydefault">' . L10n::t('Post to LiveJournal by default') . '</label>';
- $s .= '<input id="ljpost-bydefault" type="checkbox" name="lj_bydefault" value="1" ' . $def_checked . '/>';
- $s .= '</div><div class="clear"></div>';
-
- /* provide a submit button */
-
- $s .= '<div class="settings-submit-wrapper" ><input type="submit" id="ljpost-submit" name="ljpost-submit" class="settings-submit" value="' . L10n::t('Save Settings') . '" /></div></div>';
-
+ $enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'post', false);
+ $ij_username = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'ij_username');
+ $def_enabled = DI::pConfig()->get(DI::userSession()->getLocalUserId(), 'ljpost', 'post_by_default');
+
+ $t= Renderer::getMarkupTemplate('connector_settings.tpl', 'addon/ljpost/');
+ $html = Renderer::replaceMacros($t, [
+ '$enabled' => ['ljpost', DI::l10n()->t('Enable LiveJournal Post Addon'), $enabled],
+ '$username' => ['ij_username', DI::l10n()->t('LiveJournal username'), $ij_username],
+ '$password' => ['ij_password', DI::l10n()->t('LiveJournal password')],
+ '$bydefault' => ['ij_bydefault', DI::l10n()->t('Post to LiveJournal by default'), $def_enabled],
+ ]);
+
+ $data = [
+ 'connector' => 'ljpost',
+ 'title' => DI::l10n()->t('LiveJournal Export'),
+ 'image' => 'addon/ljpost/livejournal.png',
+ 'enabled' => $enabled,
+ 'html' => $html,
+ ];