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