21 const SESSION_KEY =
'msg';
46 $set = $this->loadRegisters();
49 foreach ($set as $prop => $values) {
50 if ($register_name === $prop || $register_name ===
'') {
51 if ($values || $register_name === $prop) {
60 if ($register_name && !isset(
$return[$register_name])) {
64 $this->saveRegisters($set);
75 public function count($register_name =
"") {
76 $set = $this->loadRegisters();
79 foreach ($set as $prop => $values) {
80 if ($register_name === $prop || $register_name ===
'') {
98 $set = $this->loadRegisters();
100 $set->success[] = $str;
102 $this->saveRegisters($set);
115 $set = $this->loadRegisters();
116 foreach ((array)
$error as $str) {
117 $set->error[] = $str;
119 $this->saveRegisters($set);
128 $registers = $this->session->get(self::SESSION_KEY, array());
130 foreach ($registers as
$key => $register) {
131 $set->{
$key} = $register;
151 return is_string($el) && $el !==
"";
155 foreach ($set as $prop => $values) {
156 if (!is_array($values)) {
159 $arr = array_filter($values,
$filter);
161 $data[$prop] = array_values($arr);
165 $this->session->set(self::SESSION_KEY,
$data);
loadRegisters()
Load the registers from the session.
if(!$owner||!($owner instanceof ElggUser)||!$owner->canEdit()) $error
saveRegisters(RegisterSet $set)
Save the registers to the session.
addErrorMessage($error)
Display an error on next page load.
if(!$vars['title']&&$vars['title']!==false) if(isset($vars['filter_override'])) if(!isset($vars['filter'])&&elgg_is_logged_in()&&$context) $filter
addSuccessMessage($message)
Display a system message on next page load.
dumpRegister($register_name= '')
Empty and return the given register or all registers.
Represents the state of system messages and errors.
http free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
__construct(\ElggSession $session)
Constructor.
count($register_name="")
Counts the number of messages, either globally or in a particular register.