3 * @file mod/statistics_json.php
6 require_once("include/plugin.php");
8 function statistics_json_init(App &$a) {
10 if (!get_config("system", "nodeinfo")) {
11 http_status_exit(404);
16 "name" => $a->config["sitename"],
17 "network" => FRIENDICA_PLATFORM,
18 "version" => FRIENDICA_VERSION."-".DB_UPDATE_VERSION,
19 "registrations_open" => ($a->config['register_policy'] != 0),
20 "total_users" => get_config('nodeinfo','total_users'),
21 "active_users_halfyear" => get_config('nodeinfo','active_users_halfyear'),
22 "active_users_monthly" => get_config('nodeinfo','active_users_monthly'),
23 "local_posts" => get_config('nodeinfo','local_posts')
26 $statistics["services"] = array();
27 $statistics["services"]["appnet"] = plugin_enabled("appnet");
28 $statistics["services"]["blogger"] = plugin_enabled("blogger");
29 $statistics["services"]["buffer"] = plugin_enabled("buffer");
30 $statistics["services"]["dreamwidth"] = plugin_enabled("dwpost");
31 $statistics["services"]["facebook"] = plugin_enabled("fbpost");
32 $statistics["services"]["gnusocial"] = plugin_enabled("statusnet");
33 $statistics["services"]["googleplus"] = plugin_enabled("gpluspost");
34 $statistics["services"]["libertree"] = plugin_enabled("libertree");
35 $statistics["services"]["livejournal"] = plugin_enabled("ljpost");
36 $statistics["services"]["pumpio"] = plugin_enabled("pumpio");
37 $statistics["services"]["twitter"] = plugin_enabled("twitter");
38 $statistics["services"]["tumblr"] = plugin_enabled("tumblr");
39 $statistics["services"]["wordpress"] = plugin_enabled("wppost");
41 $statistics["appnet"] = $statistics["services"]["appnet"];
42 $statistics["blogger"] = $statistics["services"]["blogger"];
43 $statistics["buffer"] = $statistics["services"]["buffer"];
44 $statistics["dreamwidth"] = $statistics["services"]["dreamwidth"];
45 $statistics["facebook"] = $statistics["services"]["facebook"];
46 $statistics["gnusocial"] = $statistics["services"]["gnusocial"];
47 $statistics["googleplus"] = $statistics["services"]["googleplus"];
48 $statistics["libertree"] = $statistics["services"]["libertree"];
49 $statistics["livejournal"] = $statistics["services"]["livejournal"];
50 $statistics["pumpio"] = $statistics["services"]["pumpio"];
51 $statistics["twitter"] = $statistics["services"]["twitter"];
52 $statistics["tumblr"] = $statistics["services"]["tumblr"];
53 $statistics["wordpress"] = $statistics["services"]["wordpress"];
55 header("Content-Type: application/json");
56 echo json_encode($statistics, JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
57 logger("statistics_init: printed ".print_r($statistics, true), LOGGER_DATA);