diff options
author | Andrey Andreev <narf@bofh.bg> | 2012-03-19 14:55:33 +0100 |
---|---|---|
committer | Andrey Andreev <narf@bofh.bg> | 2012-03-19 14:55:33 +0100 |
commit | 6c9f06ff70b1d020a9554dc1eaae796f47988d8f (patch) | |
tree | d5405ead3cdccbf115a601df0fb03b2d5e46a45e | |
parent | 7eea3064af3be5dd0b526056211a510f90a40766 (diff) | |
parent | 1ce0c424dd33d3b72ee61f5b812802ec0f073880 (diff) |
Merge pull request #1074 from mikedfunk/feature/all_flashdata
Feature/all flashdata
-rw-r--r-- | system/libraries/Session.php | 23 | ||||
-rw-r--r-- | user_guide_src/source/changelog.rst | 1 | ||||
-rw-r--r-- | user_guide_src/source/libraries/sessions.rst | 4 |
3 files changed, 28 insertions, 0 deletions
diff --git a/system/libraries/Session.php b/system/libraries/Session.php index 0c8d46591..3a80c1626 100644 --- a/system/libraries/Session.php +++ b/system/libraries/Session.php @@ -469,6 +469,29 @@ class CI_Session { { return $this->userdata; } + + // -------------------------------------------------------------------------- + + /** + * Fetch all flashdata + * + * @return array + */ + public function all_flashdata() + { + $out = array(); + + // loop through all userdata + foreach ($this->all_userdata() as $key => $val) + { + // if it contains flashdata, add it + if (strpos($key, 'flash:old:') !== FALSE) + { + $out[$key] = $val; + } + } + return $out; + } // -------------------------------------------------------------------- diff --git a/user_guide_src/source/changelog.rst b/user_guide_src/source/changelog.rst index 5dcf54dd9..6d596a4a1 100644 --- a/user_guide_src/source/changelog.rst +++ b/user_guide_src/source/changelog.rst @@ -92,6 +92,7 @@ Release Date: Not Released - Minor speed optimizations and method & property visibility declarations in the Calendar Library. - Removed SHA1 function in the :doc:`Encryption Library <libraries/encryption>`. - Added $config['csrf_regeneration'] to the CSRF protection in the :doc:`Security library <libraries/security>`, which makes token regeneration optional. + - Added all_flashdata() method to session class. Returns an associative array of only flashdata. - Allowed for setting table class defaults in a config file. - Form Validation library now allows setting of error delimiters in the config file via $config['error_prefix'] and $config['error_suffix']. - Added function error_array() to return all error messages as an array in the Form_validation class. diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index ef32f5d71..e8332ee97 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -209,6 +209,10 @@ 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 |