Added 'debugStatusMes function feature
This commit is contained in:
@@ -49,4 +49,66 @@ function resolve_page() {
|
||||
http_response_code(404);
|
||||
$GLOBALS["current_page"] = "404";
|
||||
return PAGES_FOLD . "404.php";
|
||||
}
|
||||
|
||||
/**
|
||||
* DEBUG FUNCTIONS AND ARRAY
|
||||
*/
|
||||
|
||||
$debug_messages = [
|
||||
'High' => [],
|
||||
'Medium' => [],
|
||||
'Low' => []
|
||||
];
|
||||
|
||||
// FUNCTION TO GET DEBUG STATUS MESSAGES
|
||||
function debugStatusMes( string $Message, string $intensity) {
|
||||
global $debug, $debug_messages;
|
||||
|
||||
// Controlla se il debug è attivo
|
||||
if ($debug !== "on") {
|
||||
return;
|
||||
}
|
||||
|
||||
// Normalizza l'intensità per evitare errori di battitura (es. "high" diventa "High")
|
||||
$intensity = ucfirst(strtolower($intensity));
|
||||
|
||||
// Verifica che l'intensità sia valida prima di inserire il messaggio
|
||||
if (array_key_exists($intensity, $debug_messages)) {
|
||||
$debug_messages[$intensity][] = $Message;
|
||||
} else {
|
||||
// Se l'intensità non è corretta, la salva in una categoria generica o Low
|
||||
$debug_messages['Low'][] = "[Intensità errata: $intensity] " . $Message;
|
||||
}
|
||||
}
|
||||
|
||||
// DISPLAY DEBUG ERROR FOOTER BAR
|
||||
function displayDebugFooter() {
|
||||
global $debug, $debug_messages;
|
||||
|
||||
if ($debug !== "on") {
|
||||
return;
|
||||
}
|
||||
|
||||
echo '<div id="debug-footer-container" style="background: #222; color: #fff; padding: 15px; font-family: monospace; border-top: 3px solid #ff4444; margin-top: 30px;">';
|
||||
echo '<h3>⚙️ Debug Status Messages</h3>';
|
||||
|
||||
foreach ($debug_messages as $level => $messages) {
|
||||
if (!empty($messages)) {
|
||||
// Assegna un colore diverso in base alla gravità
|
||||
$color = '#d3fcc8'; // Default Low
|
||||
if ($level === 'High') $color = '#ff4444';
|
||||
if ($level === 'Medium') $color = '#ffbb33';
|
||||
|
||||
echo "<div class='debug-group' style='margin-bottom: 10px;'>";
|
||||
echo "<strong style='color: $color;'>[" . $level . "]</strong>";
|
||||
echo "<ul style='margin: 5px 0; padding-left: 20px;'>";
|
||||
foreach ($messages as $msg) {
|
||||
echo "<li>" . htmlspecialchars($msg) . "</li>";
|
||||
}
|
||||
echo "</ul>";
|
||||
echo "</div>";
|
||||
}
|
||||
}
|
||||
echo '</div>';
|
||||
}
|
||||
Reference in New Issue
Block a user