Check for plugin to handle request, fallback to core page actions

This commit is contained in:
billz 2024-11-05 18:24:41 -08:00
parent 3af68ca9a9
commit 3a19ed9c3d

View file

@ -1,7 +1,26 @@
<?php <?php
$pluginManager = \RaspAP\Plugins\PluginManager::getInstance();
// Get the requested page
$extraFooterScripts = array(); $extraFooterScripts = array();
$page = $_SERVER['PATH_INFO']; $page = $_SERVER['PATH_INFO'];
// handle page actions
// Check if any plugin wants to handle the request
if (!$pluginManager->handlePageAction($page)) {
// If no plugin is available fall back to core page action handlers
handleCorePageAction($page, $extraFooterScripts);
}
/**
* Core application page handling
*
* @param string $page
* @param array $extraFooterScripts
* @return void
*/
function handleCorePageAction(string $page, array &$extraFooterScripts): void
{
switch ($page) { switch ($page) {
case "/wlan0_info": case "/wlan0_info":
DisplayDashboard($extraFooterScripts); DisplayDashboard($extraFooterScripts);
@ -54,5 +73,5 @@
default: default:
DisplayDashboard($extraFooterScripts); DisplayDashboard($extraFooterScripts);
} }
?> }