summaryrefslogtreecommitdiffstats
path: root/system/libraries
diff options
context:
space:
mode:
authorJohnathan Croom <johnathancroom@gmail.com>2012-11-24 02:32:46 +0100
committerJohnathan Croom <johnathancroom@gmail.com>2012-11-24 02:32:46 +0100
commit4beca5c9b64ba7bd1622e5c01666491f02cfa6db (patch)
treef6ffddaf5b69e265b4b0279cca67c866d30de011 /system/libraries
parenta815dbf595397743dacf4aef2bfbab5d19448797 (diff)
keep_flashdata accepts array
Diffstat (limited to 'system/libraries')
-rw-r--r--system/libraries/Session/Session.php26
1 files changed, 18 insertions, 8 deletions
diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php
index 96e65f154..81d63c304 100644
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -389,18 +389,28 @@ class CI_Session extends CI_Driver_Library {
/**
* Keeps existing flashdata available to next request.
*
- * @param string Item key
+ * @param mixed Item key
* @return void
*/
- public function keep_flashdata($key)
+ public function keep_flashdata($data)
{
- // '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;
- $value = $this->userdata($old_flashdata_key);
+ // Wrap item as array if singular
+ if (is_string($data))
+ {
+ $data = array($data);
+ }
+
+ foreach($data as $key)
+ {
+ // '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;
+ $value = $this->userdata($old_flashdata_key);
+
+ $new_flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_NEW.$key;
+ $this->set_userdata($new_flashdata_key, $value);
+ }
- $new_flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_NEW.$key;
- $this->set_userdata($new_flashdata_key, $value);
}
// ------------------------------------------------------------------------