2024-01-13 05:54:42 +05:30
|
|
|
<?php
|
|
|
|
// Notifications
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Notices stack
|
|
|
|
$NTFY_NoticesStack = array();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Add new notice with selected type
|
|
|
|
function NTFY_AddNotice (string $text, string $type = "fail") {
|
|
|
|
global $NTFY_NoticesStack;
|
|
|
|
switch ($type) {
|
|
|
|
case "fail":
|
|
|
|
$NTFY_NoticesStack[] = "<div class=\"notification_fail\"><p>$text</p></div>";
|
|
|
|
break;
|
2024-01-15 07:28:29 +05:30
|
|
|
case "success":
|
|
|
|
$NTFY_NoticesStack[] = "<div class=\"notification_success\"><p>$text</p></div>";
|
|
|
|
break;
|
2024-01-13 05:54:42 +05:30
|
|
|
default:
|
|
|
|
die("invalid notification type: $type");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// Echo all notifications
|
|
|
|
function NTFY_EchoAllNotices () {
|
|
|
|
global $NTFY_NoticesStack;
|
|
|
|
foreach ($NTFY_NoticesStack as $notice) {
|
|
|
|
echo "$notice\n";
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
?>
|