37 lines
664 B
PHP
37 lines
664 B
PHP
<?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;
|
|
case "success":
|
|
$NTFY_NoticesStack[] = "<div class=\"notification_success\"><p>$text</p></div>";
|
|
break;
|
|
default:
|
|
die("invalid notification type: $type");
|
|
}
|
|
}
|
|
|
|
// Echo all notifications
|
|
function NTFY_EchoAllNotices () {
|
|
global $NTFY_NoticesStack;
|
|
foreach ($NTFY_NoticesStack as $notice) {
|
|
echo "$notice\n";
|
|
}
|
|
}
|
|
|
|
|
|
|
|
?>
|