diff options
author | olivierm <olivier@migeot.org> | 2011-02-24 18:52:08 +0100 |
---|---|---|
committer | olivierm <olivier@migeot.org> | 2011-02-24 18:52:08 +0100 |
commit | d2c47924eb186a0839fe107b271ccbf27d15fe10 (patch) | |
tree | ad94b3b6ed5232fc388ddb3212d1f0dccb3eb893 /addon/statusnet/statusnet.php | |
parent | 42d1474ff1388f987961ba24b0218a8e6ff0f47c (diff) | |
parent | 8ed085c64e4fb097394d0cc93f8744606c15527b (diff) | |
download | volse-hubzilla-d2c47924eb186a0839fe107b271ccbf27d15fe10.tar.gz volse-hubzilla-d2c47924eb186a0839fe107b271ccbf27d15fe10.tar.bz2 volse-hubzilla-d2c47924eb186a0839fe107b271ccbf27d15fe10.zip |
Merge commit 'mike/master'
Diffstat (limited to 'addon/statusnet/statusnet.php')
-rw-r--r-- | addon/statusnet/statusnet.php | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/addon/statusnet/statusnet.php b/addon/statusnet/statusnet.php index 7928003bc..545518622 100644 --- a/addon/statusnet/statusnet.php +++ b/addon/statusnet/statusnet.php @@ -53,6 +53,8 @@ function statusnet_install() { register_hook('plugin_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings'); register_hook('plugin_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post'); register_hook('post_local_end', 'addon/statusnet/statusnet.php', 'statusnet_post_hook'); + register_hook('jot_networks', 'addon/statusnet/statusnet.php', 'statusnet_jot_nets'); + logger("installed statusnet"); } @@ -61,8 +63,25 @@ function statusnet_uninstall() { unregister_hook('plugin_settings', 'addon/statusnet/statusnet.php', 'statusnet_settings'); unregister_hook('plugin_settings_post', 'addon/statusnet/statusnet.php', 'statusnet_settings_post'); unregister_hook('post_local_end', 'addon/statusnet/statusnet.php', 'statusnet_post_hook'); + unregister_hook('jot_networks', 'addon/statusnet/statusnet.php', 'statusnet_jot_nets'); +} + +function statusnet_jot_nets(&$a,&$b) { + if(! local_user()) + return; + + $statusnet_post = get_pconfig(local_user(),'statusnet','post'); + if(intval($statusnet_post) == 1) { + $statusnet_defpost = get_pconfig(local_user(),'statusnet','post_by_default'); + $selected = ((intval($statusnet_defpost == 1)) ? ' selected="selected" ' : ''); + $b .= '<div class="profile-jot-net"><input type="checkbox" name="statusnet_enable"' . $selected . 'value="1" /> ' + . t('Post to StatusNet') . '</div>'; + } } + + + function statusnet_settings_post ($a,$post) { if(! local_user()) return; @@ -123,7 +142,8 @@ function statusnet_settings(&$a,&$s) { $osecret = get_pconfig(local_user(), 'statusnet', 'oauthsecret' ); $enabled = get_pconfig(local_user(), 'statusnet', 'post'); $checked = (($enabled) ? ' checked="checked" ' : ''); - $s .= '<h3>'.t('StatusNet Posting Settings').'</h3>'; + $s .= '<div class="settings-block">'; + $s .= '<h3>'. t('StatusNet Posting Settings').'</h3>'; if ( (!$ckey) && (!$csecret) ) { /*** @@ -185,7 +205,7 @@ function statusnet_settings(&$a,&$s) { $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>'; } } - $s .= '</div><div class="clear"></div>'; + $s .= '</div><div class="clear"></div></div>'; } @@ -210,8 +230,9 @@ function statusnet_post_hook(&$a,&$b) { if($ckey && $csecret && $otoken && $osecret) { $statusnet_post = get_pconfig(local_user(),'statusnet','post'); + $statusnet_enable = (($statusnet_post && x($_POST,'statusnet_enable')) ? intval($_POST['statusnet_enable']) : 0); - if($statusnet_post) { + if($statusnet_enable && $statusnet_post) { require_once('include/bbcode.php'); $dent = new StatusNetOAuth($api,$ckey,$csecret,$otoken,$osecret); $max_char = $dent->get_maxlength(); // max. length for a dent @@ -241,6 +262,6 @@ function statusnet_post_hook(&$a,&$b) { $dent->post('statuses/update', array('status' => $msg)); } } - } + } } |