summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohnathan Croom <johnathancroom@gmail.com>2012-11-25 18:36:57 +0100
committerJohnathan Croom <johnathancroom@gmail.com>2012-11-25 18:36:57 +0100
commit8d8543da992985ae61a6903a138d949f189721e9 (patch)
tree72e5e3b7ca9a35f4b3ecf6e399a31ee0166c5dbf
parent9d9849b2c459cb09ccebcdf89b2b3a15bc4fd722 (diff)
Improved array keey_flashdata + Changelog
-rw-r--r--system/libraries/Session/Session.php28
-rw-r--r--user_guide_src/source/changelog.rst1
2 files changed, 16 insertions, 13 deletions
diff --git a/system/libraries/Session/Session.php b/system/libraries/Session/Session.php
index 910b99936..9b011dea3 100644
--- a/system/libraries/Session/Session.php
+++ b/system/libraries/Session/Session.php
@@ -392,24 +392,26 @@ class CI_Session extends CI_Driver_Library {
* @param mixed Item key(s)
* @return void
*/
- public function keep_flashdata($data)
+ public function keep_flashdata($key)
{
- // Wrap item as array if singular
- if (!is_array($data))
- {
- $data = array($data);
- }
- foreach ($data as $key)
+ if (is_array($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);
+ foreach ($key as $k)
+ {
+ $this->keep_flashdata($k);
+ }
- $new_flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_NEW.$key;
- $this->set_userdata($new_flashdata_key, $value);
+ 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;
+ $value = $this->userdata($old_flashdata_key);
+
+ $new_flashdata_key = self::FLASHDATA_KEY.self::FLASHDATA_NEW.$key;
+ $this->set_userdata($new_flashdata_key, $value);
}
// ------------------------------------------------------------------------
diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst
index a20cd10f2..cfed49c6f 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 values.
- :doc:`File Uploading Library <libraries/file_uploading>` changes include:
- Added *max_filename_increment* config setting.
- Added an "index" parameter to the ``data()`` method.