diff --git a/stats.php b/stats.php index 457f321..1586b0c 100644 --- a/stats.php +++ b/stats.php @@ -15,12 +15,15 @@ License: LGPLv2.1 */ function stats_shortcode() { - $stats = json_decode(file_get_contents("https://stats.newnet.net/stats.json")); + $stats = fetch_stats(); + if (!$stats) { + return '
Unable to fetch statistics at this time. Please try again later.
'; + } ob_start(); ?> -there are =htmlspecialchars($stats->usercount)?> users across =htmlspecialchars($stats->channelcount)?> channels.
-if the channel is set with chanmode +s it will be omitted from this list.
-the table is sortable by clicking on the column headers
+There are =htmlspecialchars($stats->usercount)?> users across =htmlspecialchars($stats->channelcount)?> channels.
+If the channel is set with chanmode +s it will be omitted from this list.
+The table is sortable by clicking on the column headers.
=htmlspecialchars($channel->name)?> | +=htmlspecialchars($channel->name)?> | =htmlspecialchars($channel->usercount)?> | =htmlspecialchars($channel->topic)?> |
also available as json.
+Also available as JSON.