[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

@ -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()) {
return;
}
$bl_post = PConfig::get(local_user(), 'blogger', 'post');
if (intval($bl_post) == 1) {
$bl_defpost = PConfig::get(local_user(), 'blogger', 'post_by_default');
$selected = ((intval($bl_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="blogger_enable" ' . $selected . ' value="1" /> '
. L10n::t('Post to blogger') . '</div>';
if (PConfig::get(local_user(), 'blogger', 'post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'blogger_enable',
L10n::t('Post to blogger'),
PConfig::get(local_user(), 'blogger', 'post_by_default')
]
];
}
}

View file

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

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')
]
];
}
}

View file

@ -35,18 +35,21 @@ function ijpost_uninstall()
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()) {
return;
}
$ij_post = PConfig::get(local_user(), 'ijpost', 'post');
if (intval($ij_post) == 1) {
$ij_defpost = PConfig::get(local_user(), 'ijpost', 'post_by_default');
$selected = ((intval($ij_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ijpost_enable" ' . $selected . ' value="1" /> '
. L10n::t('Post to Insanejournal') . '</div>';
if (PConfig::get(local_user(), 'ijpost', 'post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'ijpost_enable',
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');
}
function libertree_jot_nets(&$a,&$b) {
if(! local_user())
function libertree_jot_nets(App &$a, array &$jotnets_fields)
{
if(! local_user()) {
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) {
if(! local_user())
function ljpost_jot_nets(\Friendica\App &$a, array &$jotnets_fields)
{
if(! local_user()) {
return;
}
$lj_post = PConfig::get(local_user(),'ljpost','post');
if(intval($lj_post) == 1) {
$lj_defpost = PConfig::get(local_user(),'ljpost','post_by_default');
$selected = ((intval($lj_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="ljpost_enable" ' . $selected . ' value="1" /> '
. L10n::t('Post to LiveJournal') . '</div>';
if (PConfig::get(local_user(),'ljpost','post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'ljpost_enable',
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;
}
function pumpio_jot_nets(App $a, &$b)
function pumpio_jot_nets(App $a, array &$jotnets_fields)
{
if (! local_user()) {
return;
}
$pumpio_post = PConfig::get(local_user(), 'pumpio', 'post');
if (intval($pumpio_post) == 1) {
$pumpio_defpost = PConfig::get(local_user(), 'pumpio', 'post_by_default');
$selected = ((intval($pumpio_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="pumpio_enable"' . $selected . ' value="1" /> '
. L10n::t('Post to pumpio') . '</div>';
if (PConfig::get(local_user(), 'pumpio', 'post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'pumpio_enable',
L10n::t('Post to pumpio'),
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()) {
return;
}
$statusnet_post = PConfig::get(local_user(), 'statusnet', 'post');
if (intval($statusnet_post) == 1) {
$statusnet_defpost = PConfig::get(local_user(), 'statusnet', 'post_by_default');
$selected = ((intval($statusnet_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="statusnet_enable"' . $selected . ' value="1" /> '
. L10n::t('Post to GNU Social') . '</div>';
if (PConfig::get(local_user(), 'statusnet', 'post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'statusnet_enable',
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;
}
function tumblr_jot_nets(App $a, &$b)
function tumblr_jot_nets(App $a, array &$jotnets_fields)
{
if (! local_user()) {
return;
}
$tmbl_post = PConfig::get(local_user(), 'tumblr', 'post');
if (intval($tmbl_post) == 1) {
$tmbl_defpost = PConfig::get(local_user(), 'tumblr', 'post_by_default');
$selected = ((intval($tmbl_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="tumblr_enable"' . $selected . ' value="1" /> '
. L10n::t('Post to Tumblr') . '</div>';
if (PConfig::get(local_user(),'tumblr','post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'tumblr_enable',
L10n::t('Post to Tumblr'),
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()) {
return;
}
$tw_post = PConfig::get(local_user(), 'twitter', 'post');
if (intval($tw_post) == 1) {
$tw_defpost = PConfig::get(local_user(), 'twitter', 'post_by_default');
$selected = ((intval($tw_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="twitter_enable"' . $selected . ' value="1" /> '
. L10n::t('Post to Twitter') . '</div>';
if (PConfig::get(local_user(), 'twitter', 'post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'twitter_enable',
L10n::t('Post to Twitter'),
PConfig::get(local_user(), 'twitter', 'post_by_default')
]
];
}
}
function twitter_settings_post(App $a)
{
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()) {
return;
}
$wp_post = PConfig::get(local_user(), 'wppost', 'post');
if (intval($wp_post) == 1) {
$wp_defpost = PConfig::get(local_user(),'wppost','post_by_default');
$selected = ((intval($wp_defpost) == 1) ? ' checked="checked" ' : '');
$b .= '<div class="profile-jot-net"><input type="checkbox" name="wppost_enable" ' . $selected . ' value="1" /> '
. L10n::t('Post to Wordpress') . '</div>';
if (PConfig::get(local_user(),'wppost','post')) {
$jotnets_fields[] = [
'type' => 'checkbox',
'field' => [
'wppost_enable',
L10n::t('Post to Wordpress'),
PConfig::get(local_user(),'wppost','post_by_default')
]
];
}
}