summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--system/libraries/Session/Session.php13
-rw-r--r--user_guide_src/source/changelog.rst3
-rw-r--r--user_guide_src/source/libraries/sessions.rst4
3 files changed, 17 insertions, 3 deletions
diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php
index b6c862dae..85a483592 100644
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -387,11 +387,22 @@ class CI_Session extends CI_Driver_Library {
/**
* Keeps existing flashdata available to next request.
*
- * @param string Item key
+ * @param mixed Item key(s)
* @return void
*/
public function keep_flashdata($key)
{
+
+ if (is_array($key))
+ {
+ foreach ($key as $k)
+ {
+ $this->keep_flashdata($k);
+ }
+
+ return;
+ }
+
// 'old' flashdata gets removed. Here we mark all flashdata as 'new' to preserve it from _flashdata_sweep()
// Note the function will return NULL if the $key provided cannot be found
$old_flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_OLD.$key;
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index 252ef926f..92989af75 100644
--- a/user_guide_src/source/changelog.rst
+++ b/user_guide_src/source/changelog.rst
@@ -198,6 +198,7 @@ Release Date: Not Released
- Added ``all_flashdata()`` method to session class. Returns an associative array of only flashdata.
- Added ``has_userdata()`` method to verify existence of userdata item.
- Added ``tempdata()``, ``set_tempdata()``, and ``unset_tempdata()`` methods for manipulating tempdata.
+ - ``keep_flashdata()`` now accepts an array of keys.
- :doc:`File Uploading Library <libraries/file_uploading>` changes include:
- Added *max_filename_increment* config setting.
- Added an "index" parameter to the ``data()`` method.
@@ -2671,4 +2672,4 @@ Version Beta 1.0
Release Date: February 28, 2006
-First publicly released version. \ No newline at end of file
+First publicly released version.
diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst
index df1049f82..36c7c1d32 100644
--- a/user_guide_src/source/libraries/sessions.rst
+++ b/user_guide_src/source/libraries/sessions.rst
@@ -191,7 +191,7 @@ set_userdata().
To read a flashdata variable::
$this->session->flashdata('item');
-
+
An array of all flashdata can be retrieved as follows::
$this->session->all_flashdata();
@@ -199,10 +199,12 @@ An array of all flashdata can be retrieved as follows::
If you find that you need to preserve a flashdata variable through an
additional request, you can do so using the keep_flashdata() function.
+You can either pass a single item or an array of flashdata items to keep.
::
$this->session->keep_flashdata('item');
+ $this->session->keep_flashdata(array('item1', 'item2', 'item3'));
Tempdata
========