From cb4f60c2573d934fe717f244a2f9e4b3adf637e0 Mon Sep 17 00:00:00 2001 From: Hypolite Petovan Date: Wed, 27 Jun 2018 23:21:24 -0400 Subject: [PATCH] [twitter] Add addon config --- twitter/config/twitter.ini.php | 16 ++++++++++++++++ twitter/twitter.php | 16 ++++++++++++---- 2 files changed, 28 insertions(+), 4 deletions(-) create mode 100644 twitter/config/twitter.ini.php diff --git a/twitter/config/twitter.ini.php b/twitter/config/twitter.ini.php new file mode 100644 index 00000000..a0b3deed --- /dev/null +++ b/twitter/config/twitter.ini.php @@ -0,0 +1,16 @@ +config['twitter']['consumerkey'] = 'your consumer_key here'; - * $a->config['twitter']['consumersecret'] = 'your consumer_secret here'; + * [twitter] + * consumerkey = your consumer_key here + * consumersecret = your consumer_secret here * - * To activate the addon itself add it to the $a->config['system']['addon'] + * To activate the addon itself add it to the [system] addon * setting. After this, your user can configure their Twitter account settings * from "Settings -> Addon Settings". * @@ -94,6 +95,7 @@ define('TWITTER_DEFAULT_POLL_INTERVAL', 5); // given in minutes function twitter_install() { // we need some hooks, for the configuration and for sending tweets + Addon::registerHook('load_config', 'addon/twitter/twitter.php', 'twitter_load_config'); Addon::registerHook('connector_settings', 'addon/twitter/twitter.php', 'twitter_settings'); Addon::registerHook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post'); Addon::registerHook('post_local', 'addon/twitter/twitter.php', 'twitter_post_local'); @@ -110,6 +112,7 @@ function twitter_install() function twitter_uninstall() { + Addon::unregisterHook('load_config', 'addon/twitter/twitter.php', 'twitter_load_config'); Addon::unregisterHook('connector_settings', 'addon/twitter/twitter.php', 'twitter_settings'); Addon::unregisterHook('connector_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post'); Addon::unregisterHook('post_local', 'addon/twitter/twitter.php', 'twitter_post_local'); @@ -128,6 +131,11 @@ function twitter_uninstall() Addon::unregisterHook('addon_settings_post', 'addon/twitter/twitter.php', 'twitter_settings_post'); } +function twitter_load_config(App $a) +{ + $a->loadConfigFile(__DIR__. '/config/twitter.ini.php'); +} + function twitter_check_item_notification(App $a, &$notification_data) { $own_id = PConfig::get($notification_data["uid"], 'twitter', 'own_id'); -- 2.39.5