get_error_messages() as $m) { self::add('error', $m); } } else { self::add('error', $message); } } public static function getErrors() { if (isset(self::$notices['error'])) { $errors = self::$notices['error']; unset(self::$notices['error']); self::set(); return $errors; } return false; } public static function addSuccess($message) { self::add('success', $message); } public static function displayNotices() { $html = self::getHTML(); if (!empty($html)) { echo '
' . $html . '
'; } } public function admin_notices() { echo self::getHTML(); } /** * Displays the non-displayed notices in lightbox as a fallback */ public function notices_fallback() { $html = self::getHTML(); if (!empty($html)) { ?>

' . $message . '

'; } } if (isset(self::$notices['error'])) { foreach (self::$notices['error'] AS $message) { $html .= '

' . $message . '

'; } } self::clear(); return $html; } private static function get() { return Persistent::get('notices'); } private static function set() { Persistent::set('notices', self::$notices); } public static function clear() { Persistent::delete('notices'); self::$notices = array(); } }