Permalink
Browse files

Merge pull request #2026 from johnathancroom/keep_flash_data_array

keep_flashdata accepts array
  • Loading branch information...
2 parents 3545102 + 3892995 commit f5513d6ac0ddc3f6a37df6f370c172cd1b2bfadb @narfbg narfbg committed Nov 25, 2012
@@ -387,11 +387,22 @@ public function set_flashdata($newdata = array(), $newval = '')
/**
* 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;
@@ -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.
+First publicly released version.
@@ -191,18 +191,20 @@ 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();
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
========

0 comments on commit f5513d6

Please sign in to comment.