', $message) : $message; $notification = new stdClass(); $notification->message = $message; $notification->date = time(); $notification->read = false; $notification->level = $type; $handledTypes = ['info', 'warning', 'error']; if ($addNotification && acym_isAdmin()) { $helperHeader = new HeaderHelper(); $notification->id = $helperHeader->addNotification($notification); } else { $handledTypes[] = 'success'; } if (in_array($type, $handledTypes)) { acym_session(); if (empty($_SESSION['acymessage'.$type]) || !in_array($message, $_SESSION['acymessage'.$type])) { if (empty($notification->id)) { $_SESSION['acymessage'.$type][] = $message; } else { $_SESSION['acymessage'.$type][$notification->id] = $message; } } } return true; } function acym_displayMessages() { $types = ['success', 'info', 'warning', 'error']; acym_session(); foreach ($types as $type) { if (empty($_SESSION['acymessage'.$type])) continue; acym_display($_SESSION['acymessage'.$type], $type); unset($_SESSION['acymessage'.$type]); } }