From 30ee2ab542723c0bf4ac40d13a91300590145dfb Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Tue, 7 Oct 2014 20:15:56 +0200 Subject: [PATCH 1/2] statistics.json: it now contains the connectors as well. --- statistics_json/statistics_json.php | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/statistics_json/statistics_json.php b/statistics_json/statistics_json.php index 494904ba..09e7f07b 100644 --- a/statistics_json/statistics_json.php +++ b/statistics_json/statistics_json.php @@ -18,6 +18,11 @@ function statistics_json_uninstall() { function statistics_json_module() {} +function statistics_json_plugin_enabled($plugin) { + $r = q("SELECT * FROM `addon` WHERE `installed` = 1 AND `name` = '%s'", $plugin); + return((bool)(count($r) > 0)); +} + function statistics_json_init() { global $a; @@ -32,6 +37,18 @@ function statistics_json_init() { "local_posts" => get_config('statistics_json','local_posts') ); + $statistics["facebook"] = statistics_json_plugin_enabled("fbpost"); + $statistics["twitter"] = statistics_json_plugin_enabled("twitter"); + $statistics["tumblr"] = statistics_json_plugin_enabled("tumblr"); + $statistics["wordpress"] = statistics_json_plugin_enabled("wppost"); + $statistics["appnet"] = statistics_json_plugin_enabled("appnet"); + $statistics["blogger"] = statistics_json_plugin_enabled("blogger"); + $statistics["buffer"] = statistics_json_plugin_enabled("buffer"); + $statistics["googleplus"] = statistics_json_plugin_enabled("gpluspost"); + $statistics["libertree"] = statistics_json_plugin_enabled("libertree"); + $statistics["pumpio"] = statistics_json_plugin_enabled("pumpio"); + $statistics["gnusocial"] = statistics_json_plugin_enabled("statusnet"); + header("Content-Type: application/json"); echo json_encode($statistics); logger("statistics_init: printed ".print_r($statistics, true)); From 250ad4528cadd47713a2a73fce44f1af5a82ed11 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Mon, 13 Oct 2014 20:06:28 +0200 Subject: [PATCH 2/2] Added some more services to the statistics, support of new structure for update service. --- statistics_json/statistics_json.php | 39 +++++++++++++++++++++-------- 1 file changed, 28 insertions(+), 11 deletions(-) diff --git a/statistics_json/statistics_json.php b/statistics_json/statistics_json.php index 09e7f07b..8ce6a35f 100644 --- a/statistics_json/statistics_json.php +++ b/statistics_json/statistics_json.php @@ -37,17 +37,34 @@ function statistics_json_init() { "local_posts" => get_config('statistics_json','local_posts') ); - $statistics["facebook"] = statistics_json_plugin_enabled("fbpost"); - $statistics["twitter"] = statistics_json_plugin_enabled("twitter"); - $statistics["tumblr"] = statistics_json_plugin_enabled("tumblr"); - $statistics["wordpress"] = statistics_json_plugin_enabled("wppost"); - $statistics["appnet"] = statistics_json_plugin_enabled("appnet"); - $statistics["blogger"] = statistics_json_plugin_enabled("blogger"); - $statistics["buffer"] = statistics_json_plugin_enabled("buffer"); - $statistics["googleplus"] = statistics_json_plugin_enabled("gpluspost"); - $statistics["libertree"] = statistics_json_plugin_enabled("libertree"); - $statistics["pumpio"] = statistics_json_plugin_enabled("pumpio"); - $statistics["gnusocial"] = statistics_json_plugin_enabled("statusnet"); + $statistics["services"] = array(); + $statistics["services"]["appnet"] = statistics_json_plugin_enabled("appnet"); + $statistics["services"]["blogger"] = statistics_json_plugin_enabled("blogger"); + $statistics["services"]["buffer"] = statistics_json_plugin_enabled("buffer"); + $statistics["services"]["dreamwidth"] = statistics_json_plugin_enabled("dwpost"); + $statistics["services"]["facebook"] = statistics_json_plugin_enabled("fbpost"); + $statistics["services"]["gnusocial"] = statistics_json_plugin_enabled("statusnet"); + $statistics["services"]["googleplus"] = statistics_json_plugin_enabled("gpluspost"); + $statistics["services"]["libertree"] = statistics_json_plugin_enabled("libertree"); + $statistics["services"]["livejournal"] = statistics_json_plugin_enabled("ljpost"); + $statistics["services"]["pumpio"] = statistics_json_plugin_enabled("pumpio"); + $statistics["services"]["twitter"] = statistics_json_plugin_enabled("twitter"); + $statistics["services"]["tumblr"] = statistics_json_plugin_enabled("tumblr"); + $statistics["services"]["wordpress"] = statistics_json_plugin_enabled("wppost"); + + $statistics["appnet"] = $statistics["services"]["appnet"]; + $statistics["blogger"] = $statistics["services"]["blogger"]; + $statistics["buffer"] = $statistics["services"]["buffer"]; + $statistics["dreamwidth"] = $statistics["services"]["dreamwidth"]; + $statistics["facebook"] = $statistics["services"]["facebook"]; + $statistics["gnusocial"] = $statistics["services"]["gnusocial"]; + $statistics["googleplus"] = $statistics["services"]["googleplus"]; + $statistics["libertree"] = $statistics["services"]["libertree"]; + $statistics["livejournal"] = $statistics["services"]["livejournal"]; + $statistics["pumpio"] = $statistics["services"]["pumpio"]; + $statistics["twitter"] = $statistics["services"]["twitter"]; + $statistics["tumblr"] = $statistics["services"]["tumblr"]; + $statistics["wordpress"] = $statistics["services"]["wordpress"]; header("Content-Type: application/json"); echo json_encode($statistics);