]> jfr.im git - irc/unrealircd/unrealircd-webpanel.git/commitdiff
Allow passing and modification of the stats from plugins
authorValerie Pond <redacted>
Thu, 19 Jan 2023 01:05:00 +0000 (01:05 +0000)
committerValerie Pond <redacted>
Thu, 19 Jan 2023 01:05:00 +0000 (01:05 +0000)
index.php

index 11bcd2729f7b8e0b0e30302cb28d352501895b2d..511bd4643434dc4d7541b41671767e6d803fc26b 100644 (file)
--- a/index.php
+++ b/index.php
@@ -3,11 +3,24 @@ require_once "common.php";
 require_once "header.php";
 
 $stats = $rpc->query("stats.get", []);
+var_dump($stats);
 ?>
 
 <h2>Network Overview</h2>
 
-<?php Hook::run(HOOKTYPE_PRE_OVERVIEW_CARD, $stats); ?>
+<?php
+$array_of_stats = (array)$stats;
+
+/* What if someone wants to add their own stats... */
+Hook::run(HOOKTYPE_PRE_OVERVIEW_CARD, $array_of_stats);
+
+/* This makes sure that a plugin which called the parameter
+ * by reference can add/update the stats for display here.
+*/
+$stats = (object) $array_of_stats;
+
+
+?>
 
 <div class="container mt-5">