diff options
author | Friendika <info@friendika.com> | 2011-02-23 18:24:29 -0800 |
---|---|---|
committer | Friendika <info@friendika.com> | 2011-02-23 18:24:29 -0800 |
commit | 834439b7300584350ac1676f3f43f5511a4b509b (patch) | |
tree | 07eee6cd1f2e078d7f37e9fe7ce6fe7128255fbc /addon | |
parent | 352fef6208184d0609d3305010c5d74dd5e4c720 (diff) | |
download | volse-hubzilla-834439b7300584350ac1676f3f43f5511a4b509b.tar.gz volse-hubzilla-834439b7300584350ac1676f3f43f5511a4b509b.tar.bz2 volse-hubzilla-834439b7300584350ac1676f3f43f5511a4b509b.zip |
cleanup plugin and post settings
Diffstat (limited to 'addon')
-rw-r--r-- | addon/facebook/facebook.css | 8 | ||||
-rw-r--r-- | addon/facebook/facebook.php | 12 | ||||
-rw-r--r-- | addon/randplace/randplace.php | 3 | ||||
-rw-r--r-- | addon/statusnet/statusnet.php | 26 | ||||
-rw-r--r-- | addon/twitter/twitter.php | 29 |
5 files changed, 48 insertions, 30 deletions
diff --git a/addon/facebook/facebook.css b/addon/facebook/facebook.css new file mode 100644 index 000000000..3df65706f --- /dev/null +++ b/addon/facebook/facebook.css @@ -0,0 +1,8 @@ + +#facebook-enable-wrapper { + margin-top: 20px; +} + +#facebook-disable-wrapper { + margin-top: 20px; +} diff --git a/addon/facebook/facebook.php b/addon/facebook/facebook.php index e989c90ea..876a9740b 100644 --- a/addon/facebook/facebook.php +++ b/addon/facebook/facebook.php @@ -114,14 +114,18 @@ function facebook_content(&$a) { return ''; } + $a->page['htmlhead'] .= '<link rel="stylesheet" type="text/css" href="' + . $a->get_baseurl() . '/addon/facebook/facebook.css' . '" media="all" />' . "\r\n"; + $o .= '<h3>' . t('Facebook Connect') . '</h3>'; - $o .= '<br />'; + $o .= '<div id="facebook-enable-wrapper">'; $o .= '<a href="https://www.facebook.com/dialog/oauth?client_id=' . $appid . '&redirect_uri=' - . $a->get_baseurl() . '/facebook/' . $a->user['nickname'] . '&scope=publish_stream,read_stream,offline_access">' . t('Install Facebook post connector') . '</a><br /><br />'; + . $a->get_baseurl() . '/facebook/' . $a->user['nickname'] . '&scope=publish_stream,read_stream,offline_access">' . t('Install Facebook post connector') . '</a>'; + $o .= '</div><div id="facebook-disable-wrapper">'; - $o .= '<a href="' . $a->get_baseurl() . '/facebook/remove' . '">' . t('Remove Facebook post connector') . '</a><br />'; + $o .= '<a href="' . $a->get_baseurl() . '/facebook/remove' . '">' . t('Remove Facebook post connector') . '</a></div>'; return $o; @@ -143,8 +147,10 @@ function facebook_uninstall() { function facebook_plugin_settings(&$a,&$b) { + $b .= '<div class="settings-block">'; $b .= '<h3>' . t('Facebook') . '</h3>'; $b .= '<a href="facebook">' . t('Facebook Connector Settings') . '</a><br />'; + $b .= '</div>'; } diff --git a/addon/randplace/randplace.php b/addon/randplace/randplace.php index d7ea65c9d..fa38de377 100644 --- a/addon/randplace/randplace.php +++ b/addon/randplace/randplace.php @@ -167,6 +167,7 @@ function randplace_settings(&$a,&$s) { /* Add some HTML to the existing form */ + $s .= '<div class="settings-block">'; $s .= '<h3>' . t('Randplace Settings') . '</h3>'; $s .= '<div id="randplace-enable-wrapper">'; $s .= '<label id="randplace-enable-label" for="randplace-checkbox">' . t('Enable Randplace Plugin') . '</label>'; @@ -175,6 +176,6 @@ function randplace_settings(&$a,&$s) { /* provide a submit button */ - $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>'; + $s .= '<div class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div></div>'; }
\ No newline at end of file diff --git a/addon/statusnet/statusnet.php b/addon/statusnet/statusnet.php index 7928003bc..e595ad7b5 100644 --- a/addon/statusnet/statusnet.php +++ b/addon/statusnet/statusnet.php @@ -63,6 +63,22 @@ function statusnet_uninstall() { unregister_hook('post_local_end', 'addon/statusnet/statusnet.php', 'statusnet_post_hook'); } +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 +139,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 +202,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 +227,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 +259,6 @@ function statusnet_post_hook(&$a,&$b) { $dent->post('statuses/update', array('status' => $msg)); } } - } + } } diff --git a/addon/twitter/twitter.php b/addon/twitter/twitter.php index 509297d4e..0fd891d20 100644 --- a/addon/twitter/twitter.php +++ b/addon/twitter/twitter.php @@ -41,7 +41,6 @@ function twitter_install() { register_hook('plugin_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post'); register_hook('post_local_end', 'addon/twitter/twitter.php', 'twitter_post_hook'); register_hook('jot_networks', 'addon/twitter/twitter.php', 'twitter_jot_nets'); - register_hook('post_local_start', 'addon/twitter/twitter.php', 'twitter_post_start'); logger("installed twitter"); } @@ -51,8 +50,6 @@ function twitter_uninstall() { unregister_hook('plugin_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post'); unregister_hook('post_local_end', 'addon/twitter/twitter.php', 'twitter_post_hook'); unregister_hook('jot_networks', 'addon/twitter/twitter.php', 'twitter_jot_nets'); - unregister_hook('post_local_start', 'addon/twitter/twitter.php', 'twitter_post_start'); - } function twitter_jot_nets(&$a,&$b) { @@ -70,19 +67,6 @@ function twitter_jot_nets(&$a,&$b) { } -function twitter_post_start(&$a,&$b) { - if(! local_user()) - return; - - if((x($b,'twitter_enable')) && (intval($b['twitter_enable']))) - set_pconfig(local_user(),'twitter','enable','1'); - else - del_pconfig(local_user(),'twitter','enable'); - - -} - - function twitter_settings_post ($a,$post) { if(! local_user()) return; @@ -134,6 +118,7 @@ function twitter_settings(&$a,&$s) { $osecret = get_pconfig(local_user(), 'twitter', 'oauthsecret' ); $enabled = get_pconfig(local_user(), 'twitter', 'post'); $checked = (($enabled) ? ' checked="checked" ' : ''); + $s .= '<div class="settings-block">'; $s .= '<h3>'. t('Twitter Posting Settings') .'</h3>'; if ( (!$ckey) && (!$csecret) ) { @@ -167,8 +152,8 @@ function twitter_settings(&$a,&$s) { $s .= '<input id="twitter-pin" type="text" name="twitter-pin" />'; $s .= '<input id="twitter-token" type="hidden" name="twitter-token" value="'.$token.'" />'; $s .= '<input id="twitter-token2" type="hidden" name="twitter-token2" value="'.$request_token['oauth_token_secret'].'" />'; - $s .= '</div><div class="clear"></div>'; - $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 class="settings-submit-wrapper" ><input type="submit" name="submit" class="settings-submit" value="' . t('Submit') . '" /></div>'; } else { /*** * we have an OAuth key / secret pair for the user @@ -190,7 +175,7 @@ function twitter_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>'; } @@ -213,11 +198,11 @@ function twitter_post_hook(&$a,&$b) { if($ckey && $csecret && $otoken && $osecret) { - $twitter_post = get_pconfig(local_user(),'twitter','post'); - $twitter_enable = intval(get_pconfig(local_user(),'twitter','enable')); + $twitter_post = intval(get_pconfig(local_user(),'twitter','post')); + $twitter_enable = (($twitter_post && x($_POST,'twitter_enable')) ? intval($_POST['twitter_enable']) : 0); if($twitter_post && $twitter_enable) { - require_once('addon/twitter/twitteroauth.php'); + require_once('library/twitteroauth.php'); require_once('include/bbcode.php'); $tweet = new TwitterOAuth($ckey,$csecret,$otoken,$osecret); $max_char = 140; // max. length for a tweet |