aboutsummaryrefslogtreecommitdiffstats
path: root/addon/twitter/twitter.php
diff options
context:
space:
mode:
authorfabrixxm <fabrix.xm@gmail.com>2011-06-18 08:29:59 +0200
committerfabrixxm <fabrix.xm@gmail.com>2011-06-18 08:29:59 +0200
commit23931ab719ca30ce0a5de4c04fd3bd83ecc9937f (patch)
tree64c9174c21ea4c6180220cfc907326bba817a74b /addon/twitter/twitter.php
parent484b248f735b22e7a28f4720c3997746f5c10ced (diff)
downloadvolse-hubzilla-23931ab719ca30ce0a5de4c04fd3bd83ecc9937f.tar.gz
volse-hubzilla-23931ab719ca30ce0a5de4c04fd3bd83ecc9937f.tar.bz2
volse-hubzilla-23931ab719ca30ce0a5de4c04fd3bd83ecc9937f.zip
Admin: add translatable strings, remove 'rino' settings, invert 'no'-setings, add "plugin_admin" hook for global plugins settings. add settings to twitter connector as example.
Diffstat (limited to 'addon/twitter/twitter.php')
-rw-r--r--addon/twitter/twitter.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/addon/twitter/twitter.php b/addon/twitter/twitter.php
index fef6583f6..3141cf0c9 100644
--- a/addon/twitter/twitter.php
+++ b/addon/twitter/twitter.php
@@ -47,6 +47,7 @@ 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('plugin_admin', 'addon/twitter/twitter.php', 'plugin_admin');
logger("installed twitter");
}
@@ -56,6 +57,7 @@ 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('plugin_admin', 'addon/twitter/twitter.php', 'plugin_admin');
}
function twitter_jot_nets(&$a,&$b) {
@@ -240,4 +242,19 @@ function twitter_post_hook(&$a,&$b) {
}
}
}
-
+function plugin_admin_post(&$a){
+ $consumerkey = ((x($_POST,'consumerkey')) ? notags(trim($_POST['consumerkey'])) : '');
+ $consumersecret = ((x($_POST,'consumersecret')) ? notags(trim($_POST['consumersecret'])): '');
+ set_config('twitter','consumerkey',$consumerkey);
+ set_config('twitter','consumersecret',$consumersecret);
+ info( t('Settings updated.'). EOL );
+}
+function plugin_admin(&$a, &$o){
+ $t = file_get_contents( dirname(__file__). "/admin.tpl" );
+ $o = replace_macros($t, array(
+ '$submit' => t('Submit'),
+ // name, label, value, help, [extra values]
+ '$consumerkey' => array('consumerkey', t('Consumer key'), get_config('twitter', 'consumerkey' ), ''),
+ '$consumersecret' => array('consumersecret', t('Consumer secret'), get_config('twitter', 'consumersecret' ), '')
+ ));
+}