1 <?php
defined('IN_CMS') or die('No direct access allowed.');
4 Handle error, notice and success messages in the admin
8 public static function set($type, $message) {
9 $data = Session
::get('notifications', array());
11 if(!isset($data[$type])) {
12 $data[$type] = array();
15 if(!is_array($message)) {
16 $message = array($message);
19 $data[$type] = array_merge($data[$type], $message);
21 Session
::set('notifications', $data);
24 public static function read() {
25 $data = Session
::get('notifications', array());
28 foreach($data as $type => $messages) {
29 $html .= '<p class="notification ' . $type . '">' . implode('<br>', $messages) . '</p>';
32 Session
::forget('notifications');