From: Valerie Pond Date: Thu, 19 Jan 2023 00:56:52 +0000 (+0000) Subject: Add some more hooks: overview X-Git-Tag: 0.9~408 X-Git-Url: https://jfr.im/git/irc/unrealircd/unrealircd-webpanel.git/commitdiff_plain/440ff671f07bf112f2371cbe7e1afb23f2f614b6?hp=7aad7c29843ca2e7a6c6a5bf648ba71ef75ab6e8 Add some more hooks: overview Added HOOKTYPE_PRE_OVERVIEW_CARD and HOOKTYPE_OVERVIEW_CARD This lets plugins use these hooks in order to add their own displays to the overview. --- diff --git a/Classes/class-hook.php b/Classes/class-hook.php index a5e1220..2e9eb86 100644 --- a/Classes/class-hook.php +++ b/Classes/class-hook.php @@ -1,7 +1,66 @@ ""]; + * + * So when you call this hook, you must refer to the + * parameter by reference. For example: + * Hook::func(HOOKTYPE_NAVBAR, 'add_navbar_item'); + * + * function add_navbar_item(&$pages) // remember the & to use by reference + * { insert_hacks_here(); } + */ +define('HOOKTYPE_NAVBAR', 100); + +/** HOOKTYPE_PRE_HEADER + * + * This doesn't receive anything, however you must still specify an + * parameter for your hook function, because it's referring to memory. Sorry =] + * + * Currently this is only used by the "sql_auth" plugin by Valware in order to + * redirect users immediately to the login page. + * + * Putting HTML in this hook is not a good idea. + */ +define('HOOKTYPE_PRE_HEADER', 101); + +/** HOOKTYPE_PRE_OVERVIEW_CARD + * + * @param object $stats + * + * This is called before the initial cards have loaded in the overview. + * This lets you add your own HTML or whatever you like on the overview, + * new cards, whatever. + * + * The parameter is an object containing stats used in the overview. + * See "index.php" to see how it's used. + * + */ + +define('HOOKTYPE_PRE_OVERVIEW_CARD', 102); +/** HOOKTYPE_OVERVIEW_CARD + * + * @param object $stats + * + * This is called after the initial cards have loaded in the overview. + * This lets you add your own HTML or whatever you like on the overview, + * new cards, whatever. + * + * The parameter is an object containing stats used in the overview. + * See "index.php" to see how it's used. + * + */ + + +define('HOOKTYPE_OVERVIEW_CARD', 102); /** * Class for "Hook" diff --git a/index.php b/index.php index 32b849d..fb2cd8e 100644 --- a/index.php +++ b/index.php @@ -7,6 +7,8 @@ $stats = $rpc->query("stats.get", []);

Network Overview

+
@@ -20,7 +22,7 @@ $stats = $rpc->query("stats.get", []);
-

user->total - $stats->user->ulined; ?>

+

user->total; ?>

@@ -75,7 +77,6 @@ $stats = $rpc->query("stats.get", []);
Opers
-
">View
@@ -217,4 +218,6 @@ $stats = $rpc->query("stats.get", []);