From 07b950cf659146ab6864190c5ad595fbcdaecd25 Mon Sep 17 00:00:00 2001 From: billz Date: Sat, 16 Sep 2023 11:43:40 +0200 Subject: [PATCH] Migrate includes/status_message.php to RaspAP/Messages --- src/RaspAP/Messages/StatusMessage.php | 41 +++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100755 src/RaspAP/Messages/StatusMessage.php diff --git a/src/RaspAP/Messages/StatusMessage.php b/src/RaspAP/Messages/StatusMessage.php new file mode 100755 index 00000000..680014ce --- /dev/null +++ b/src/RaspAP/Messages/StatusMessage.php @@ -0,0 +1,41 @@ + + * @license https://github.com/raspap/raspap-webgui/blob/master/LICENSE + */ + +namespace RaspAP\Messages; + +class StatusMessage +{ + public $messages = array(); + + public function addMessage($message, $level = 'success', $dismissable = true) + { + $status = '
'. _($message); + if ($dismissable) { + $status .= ''; + } + $status .= '
'; + + array_push($this->messages, $status); + } + + public function showMessages($clear = true) + { + foreach ($this->messages as $message) { + echo $message; + } + if ($clear) { + $this->messages = array(); + } + } +}