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

pull/833/head
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

@ -41,19 +41,21 @@ function blogger_uninstall()
} }
function blogger_jot_nets(App $a, &$b) function blogger_jot_nets(App $a, array &$jotnets_fields)
{ {
if (!local_user()) { if (!local_user()) {
return; return;
} }
$bl_post = PConfig::get(local_user(), 'blogger', 'post'); if (PConfig::get(local_user(), 'blogger', 'post')) {
$jotnets_fields[] = [
if (intval($bl_post) == 1) { 'type' => 'checkbox',
$bl_defpost = PConfig::get(local_user(), 'blogger', 'post_by_default'); 'field' => [
$selected = ((intval($bl_defpost) == 1) ? ' checked="checked" ' : ''); 'blogger_enable',
$b .= '<div class="profile-jot-net"><input type="checkbox" name="blogger_enable" ' . $selected . ' value="1" /> ' L10n::t('Post to blogger'),
. L10n::t('Post to blogger') . '</div>'; PConfig::get(local_user(), 'blogger', 'post_by_default')
]
];
} }
} }

View File

@ -125,19 +125,21 @@ function buffer_connect(App $a)
return $o; return $o;
} }
function buffer_jot_nets(App $a, &$b) function buffer_jot_nets(App $a, array &$jotnets_fields)
{ {
if (!local_user()) { if (!local_user()) {
return; return;
} }
$buffer_post = PConfig::get(local_user(), 'buffer', 'post'); if (PConfig::get(local_user(), 'buffer', 'post')) {
$jotnets_fields[] = [
if (intval($buffer_post) == 1) { 'type' => 'checkbox',
$buffer_defpost = PConfig::get(local_user(), 'buffer', 'post_by_default'); 'field' => [
$selected = ((intval($buffer_defpost) == 1) ? ' checked="checked" ' : ''); 'buffer_enable',
$b .= '<div class="profile-jot-net"><input type="checkbox" name="buffer_enable"' . $selected . ' value="1" /> ' L10n::t('Post to Buffer'),
. L10n::t('Post to Buffer') . '</div>'; PConfig::get(local_user(), 'buffer', 'post_by_default')
]
];
} }
} }

View File

@ -41,21 +41,21 @@ function diaspora_uninstall()
Hook::unregister('queue_predeliver', 'addon/diaspora/diaspora.php', 'diaspora_queue_hook'); Hook::unregister('queue_predeliver', 'addon/diaspora/diaspora.php', 'diaspora_queue_hook');
} }
function diaspora_jot_nets(App $a, &$b) function diaspora_jot_nets(App $a, array &$jotnets_fields)
{ {
if (!local_user()) { if (!local_user()) {
return; return;
} }
$diaspora_post = PConfig::get(local_user(), 'diaspora', 'post'); if (PConfig::get(local_user(), 'diaspora', 'post')) {
$jotnets_fields[] = [
if (intval($diaspora_post) == 1) { 'type' => 'checkbox',
$diaspora_defpost = PConfig::get(local_user(), 'diaspora', 'post_by_default'); 'field' => [
'diaspora_enable',
$selected = ((intval($diaspora_defpost) == 1) ? ' checked="checked" ' : ''); L10n::t('Post to Diaspora'),
PConfig::get(local_user(), 'diaspora', 'post_by_default')
$b .= '<div class="profile-jot-net"><input type="checkbox" name="diaspora_enable"' . $selected . ' value="1" /> ' ]
. L10n::t('Post to Diaspora') . '</div>'; ];
} }
} }

View File

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

View File

@ -35,18 +35,21 @@ function ijpost_uninstall()
Hook::unregister('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post'); Hook::unregister('connector_settings_post', 'addon/ijpost/ijpost.php', 'ijpost_settings_post');
} }
function ijpost_jot_nets(&$a, &$b) function ijpost_jot_nets(\Friendica\App &$a, array &$jotnets_fields)
{ {
if (!local_user()) { if (!local_user()) {
return; return;
} }
$ij_post = PConfig::get(local_user(), 'ijpost', 'post'); if (PConfig::get(local_user(), 'ijpost', 'post')) {
if (intval($ij_post) == 1) { $jotnets_fields[] = [
$ij_defpost = PConfig::get(local_user(), 'ijpost', 'post_by_default'); 'type' => 'checkbox',
$selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : ''); 'field' => [
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ijpost_enable" ' . $selected . ' value="1" /> ' 'ijpost_enable',
. L10n::t('Post to Insanejournal') . '</div>'; L10n::t('Post to Insanejournal'),
PConfig::get(local_user(), 'ijpost', 'post_by_default')
]
];
} }
} }

View File

@ -35,17 +35,22 @@ function libertree_uninstall()
Hook::unregister('connector_settings_post', 'addon/libertree/libertree.php', 'libertree_settings_post'); Hook::unregister('connector_settings_post', 'addon/libertree/libertree.php', 'libertree_settings_post');
} }
function libertree_jot_nets(&$a,&$b) { function libertree_jot_nets(App &$a, array &$jotnets_fields)
if(! local_user()) {
if(! local_user()) {
return; return;
$ltree_post = PConfig::get(local_user(),'libertree','post');
if(intval($ltree_post) == 1) {
$ltree_defpost = PConfig::get(local_user(),'libertree','post_by_default');
$selected = ((intval($ltree_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="libertree_enable"' . $selected . ' value="1" /> '
. L10n::t('Post to libertree') . '</div>';
} }
if (PConfig::get(local_user(), 'libertree', 'post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'libertree_enable',
L10n::t('Post to libertree'),
PConfig::get(local_user(), 'libertree', 'post_by_default')
]
];
}
} }

View File

@ -35,16 +35,21 @@ function ljpost_uninstall() {
} }
function ljpost_jot_nets(&$a,&$b) { function ljpost_jot_nets(\Friendica\App &$a, array &$jotnets_fields)
if(! local_user()) {
if(! local_user()) {
return; return;
}
$lj_post = PConfig::get(local_user(),'ljpost','post'); if (PConfig::get(local_user(),'ljpost','post')) {
if(intval($lj_post) == 1) { $jotnets_fields[] = [
$lj_defpost = PConfig::get(local_user(),'ljpost','post_by_default'); 'type' => 'checkbox',
$selected = ((intval($lj_defpost) == 1) ? ' checked="checked" ' : ''); 'field' => [
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ljpost_enable" ' . $selected . ' value="1" /> ' 'ljpost_enable',
. L10n::t('Post to LiveJournal') . '</div>'; L10n::t('Post to LiveJournal'),
PConfig::get(local_user(),'ljpost','post_by_default')
]
];
} }
} }

View File

@ -214,19 +214,21 @@ function pumpio_connect(App $a)
return $o; return $o;
} }
function pumpio_jot_nets(App $a, &$b) function pumpio_jot_nets(App $a, array &$jotnets_fields)
{ {
if (! local_user()) { if (! local_user()) {
return; return;
} }
$pumpio_post = PConfig::get(local_user(), 'pumpio', 'post'); if (PConfig::get(local_user(), 'pumpio', 'post')) {
$jotnets_fields[] = [
if (intval($pumpio_post) == 1) { 'type' => 'checkbox',
$pumpio_defpost = PConfig::get(local_user(), 'pumpio', 'post_by_default'); 'field' => [
$selected = ((intval($pumpio_defpost) == 1) ? ' checked="checked" ' : ''); 'pumpio_enable',
$b .= '<div class="profile-jot-net"><input type="checkbox" name="pumpio_enable"' . $selected . ' value="1" /> ' L10n::t('Post to pumpio'),
. L10n::t('Post to pumpio') . '</div>'; PConfig::get(local_user(), 'pumpio', 'post_by_default')
]
];
} }
} }

View File

@ -101,18 +101,21 @@ function statusnet_check_item_notification(App $a, &$notification_data)
} }
} }
function statusnet_jot_nets(App $a, &$b) function statusnet_jot_nets(App $a, array &$jotnets_fields)
{ {
if (!local_user()) { if (!local_user()) {
return; return;
} }
$statusnet_post = PConfig::get(local_user(), 'statusnet', 'post'); if (PConfig::get(local_user(), 'statusnet', 'post')) {
if (intval($statusnet_post) == 1) { $jotnets_fields[] = [
$statusnet_defpost = PConfig::get(local_user(), 'statusnet', 'post_by_default'); 'type' => 'checkbox',
$selected = ((intval($statusnet_defpost) == 1) ? ' checked="checked" ' : ''); 'field' => [
$b .= '<div class="profile-jot-net"><input type="checkbox" name="statusnet_enable"' . $selected . ' value="1" /> ' 'statusnet_enable',
. L10n::t('Post to GNU Social') . '</div>'; L10n::t('Post to GNU Social'),
PConfig::get(local_user(), 'statusnet', 'post_by_default')
]
];
} }
} }

View File

@ -193,19 +193,21 @@ function tumblr_callback(App $a)
return $o; return $o;
} }
function tumblr_jot_nets(App $a, &$b) function tumblr_jot_nets(App $a, array &$jotnets_fields)
{ {
if (! local_user()) { if (! local_user()) {
return; return;
} }
$tmbl_post = PConfig::get(local_user(), 'tumblr', 'post'); if (PConfig::get(local_user(),'tumblr','post')) {
$jotnets_fields[] = [
if (intval($tmbl_post) == 1) { 'type' => 'checkbox',
$tmbl_defpost = PConfig::get(local_user(), 'tumblr', 'post_by_default'); 'field' => [
$selected = ((intval($tmbl_defpost) == 1) ? ' checked="checked" ' : ''); 'tumblr_enable',
$b .= '<div class="profile-jot-net"><input type="checkbox" name="tumblr_enable"' . $selected . ' value="1" /> ' L10n::t('Post to Tumblr'),
. L10n::t('Post to Tumblr') . '</div>'; PConfig::get(local_user(),'tumblr','post_by_default')
]
];
} }
} }

View File

@ -194,21 +194,25 @@ function twitter_follow(App $a, array &$contact)
} }
} }
function twitter_jot_nets(App $a, &$b) function twitter_jot_nets(App $a, array &$jotnets_fields)
{ {
if (!local_user()) { if (!local_user()) {
return; return;
} }
$tw_post = PConfig::get(local_user(), 'twitter', 'post'); if (PConfig::get(local_user(), 'twitter', 'post')) {
if (intval($tw_post) == 1) { $jotnets_fields[] = [
$tw_defpost = PConfig::get(local_user(), 'twitter', 'post_by_default'); 'type' => 'checkbox',
$selected = ((intval($tw_defpost) == 1) ? ' checked="checked" ' : ''); 'field' => [
$b .= '<div class="profile-jot-net"><input type="checkbox" name="twitter_enable"' . $selected . ' value="1" /> ' 'twitter_enable',
. L10n::t('Post to Twitter') . '</div>'; L10n::t('Post to Twitter'),
PConfig::get(local_user(), 'twitter', 'post_by_default')
]
];
} }
} }
function twitter_settings_post(App $a) function twitter_settings_post(App $a)
{ {
if (!local_user()) { if (!local_user()) {

View File

@ -43,18 +43,21 @@ function wppost_uninstall()
} }
function wppost_jot_nets(&$a, &$b) function wppost_jot_nets(\Friendica\App &$a, array &$jotnets_fields)
{ {
if (!local_user()) { if (!local_user()) {
return; return;
} }
$wp_post = PConfig::get(local_user(), 'wppost', 'post'); if (PConfig::get(local_user(),'wppost','post')) {
if (intval($wp_post) == 1) { $jotnets_fields[] = [
$wp_defpost = PConfig::get(local_user(),'wppost','post_by_default'); 'type' => 'checkbox',
$selected = ((intval($wp_defpost) == 1) ? ' checked="checked" ' : ''); 'field' => [
$b .= '<div class="profile-jot-net"><input type="checkbox" name="wppost_enable" ' . $selected . ' value="1" /> ' 'wppost_enable',
. L10n::t('Post to Wordpress') . '</div>'; L10n::t('Post to Wordpress'),
PConfig::get(local_user(),'wppost','post_by_default')
]
];
} }
} }