[various] Replace HTML string by structured array in jot_networks hook

This commit is contained in:
Hypolite Petovan 2019-03-24 22:44:50 -04:00
parent d29d356362
commit c2970ad6d5
12 changed files with 128 additions and 96 deletions

View file

@ -37,20 +37,21 @@ function dwpost_uninstall()
Hook::unregister('connector_settings_post', 'addon/dwpost/dwpost.php', 'dwpost_settings_post');
}
function dwpost_jot_nets(App $a, &$b)
function dwpost_jot_nets(App $a, array &$jotnets_fields)
{
if (!local_user()) {
return;
}
$dw_post = PConfig::get(local_user(), 'dwpost', 'post');
if (intval($dw_post) == 1) {
$dw_defpost = PConfig::get(local_user(), 'dwpost', 'post_by_default');
$selected = ((intval($dw_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="dwpost_enable" ' . $selected . ' value="1" /> '
. L10n::t('Post to Dreamwidth') . '</div>';
if (PConfig::get(local_user(), 'dwpost', 'post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'dwpost_enable',
L10n::t('Post to Dreamwidth'),
PConfig::get(local_user(), 'dwpost', 'post_by_default')
]
];
}
}