Added flash storage

This commit is contained in:
Andy Miller
2016-05-20 16:53:00 -06:00
parent 18a8483522
commit 10d301a179
2 changed files with 17 additions and 0 deletions

View File

@@ -4,6 +4,7 @@
1. [](#improved)
* Updated jQuery from 2.2.0 to 2.2.3
* Set `Uri::ip()` to static by default so it can be used in form fields
* Improved `Session` class with flash storage
1. [](#bugfix)
* Fixed "Invalid slug set in YAML frontmatter" when setting `Page::slug()` with empty string [#580](https://github.com/getgrav/grav-plugin-admin/issues/580)
* Only `.gitignore` Grav's vendor folder

View File

@@ -65,4 +65,20 @@ class Session extends BaseSession
setcookie(session_name(), session_id(), time() + $session_timeout, $session_path, $domain, $secure, $httponly);
}
}
// Store something in session temporarily
public function setFlashObject($name, $object)
{
$this->$name = serialize($object);
}
// Return object and remove it from session
public function getFlashObject($name)
{
$object = unserialize($this->$name);
$this->$name = null;
return $object;
}
}