summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--user_guide_src/source/helpers/date_helper.rst2
-rw-r--r--user_guide_src/source/libraries/sessions.rst94
2 files changed, 54 insertions, 42 deletions
diff --git a/user_guide_src/source/helpers/date_helper.rst b/user_guide_src/source/helpers/date_helper.rst
index e9e122f1c..e7598df14 100644
--- a/user_guide_src/source/helpers/date_helper.rst
+++ b/user_guide_src/source/helpers/date_helper.rst
@@ -82,7 +82,7 @@ The following functions are available:
$time = time();
echo standard_date($format, $time);
- .. note:: This function is DEPRECATED.Use the native ``date()`` combined with
+ .. note:: This function is DEPRECATED. Use the native ``date()`` combined with
`DateTime's format constants
<http://www.php.net/manual/en/class.datetime.php#datetime.constants.types>`_
instead::
diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst
index f63f584a6..9e23e9b60 100644
--- a/user_guide_src/source/libraries/sessions.rst
+++ b/user_guide_src/source/libraries/sessions.rst
@@ -103,6 +103,23 @@ fetch. For example, to fetch the session ID you will do this::
.. note:: The function returns NULL if the item you are
trying to access does not exist.
+If you want to retrieve all of the existing userdata, you can simply
+omit the item key parameter::
+
+ $this->session->userdata();
+
+ /**
+ * Produces something similar to:
+ *
+ * Array
+ * (
+ * [session_id] => 4a5a5dca22728fb0a84364eeb405b601
+ * [ip_address] => 127.0.0.1
+ * [user_agent] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7;
+ * [last_activity] => 1303142623
+ * )
+ */
+
Adding Custom Session Data
==========================
@@ -144,23 +161,6 @@ If you want to verify that a userdata value exists, call ``has_userdata()``.
$this->session->has_userdata('some_name');
-Retrieving All Session Data
-===========================
-
-An array of all userdata can be retrieved as follows::
-
- $this->session->userdata()
-
-And returns an associative array like the following::
-
- Array
- (
- [session_id] => 4a5a5dca22728fb0a84364eeb405b601
- [ip_address] => 127.0.0.1
- [user_agent] => Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10_6_7;
- [last_activity] => 1303142623
- )
-
Removing Session Data
=====================
@@ -246,6 +246,10 @@ To read a tempdata variable::
$this->session->tempdata('item');
+And of course, if you want to retrieve all existing tempdata::
+
+ $this->session->tempdata();
+
If you need to remove a tempdata value before it expires,
use ``unset_tempdata()``::
@@ -550,12 +554,14 @@ Class Reference
Regenerate the current session data.
- .. method:: userdata($item)
+ .. method:: userdata([$item = NULL])
:param string $item: Session item name
- :returns: string
+ :returns: mixed
+
+ If no parameter is passed, it will return an associative array of all existing userdata.
- Returns a string containing the value of the passed item or NULL if the item is not found.
+ Otherwise returns a string containing the value of the passed item or NULL if the item is not found.
Example::
$this->session->userdata('user');
@@ -565,13 +571,15 @@ Class Reference
:returns: array
- Retruns an array with all of the session userdata items.
+ Returns an array with all of the session userdata items.
+
+ .. note:: This method is DEPRECATED. Use ``userdata()`` with no parameters instead.
- .. method:: all_flashdata()
+ .. method:: &get_userdata()
:returns: array
- Retruns an array with all of the session flashdata items.
+ Returns a reference to the userdata array.
.. method:: set_userdata($newdata[, $newval = ''])
@@ -607,6 +615,19 @@ Class Reference
Checks if an item exists in the session.
+ .. method:: flashdata([$item = NULL])
+
+ :param string $item: Flashdata item name
+ :returns: mixed
+
+ If no parameter is passed, it will return an associative array of all existing flashdata.
+
+ Otherwise returns a string containing the value of the passed item or NULL if the item is not found.
+ Example::
+
+ $this->session->flashdata('message');
+ //returns 'Test message.' considering the set_flashdata example.
+
.. method:: set_flashdata($newdata[, $newval = ''])
:param mixed $newdata: Item name or an array of items
@@ -629,16 +650,18 @@ Class Reference
Keeps items into flashdata for one more request.
- .. method:: flashdata($item)
+ .. method:: tempdata([$item = NULL])
- :param string $item: Flashdata item name
- :returns: string
+ :param string $item: Tempdata item name
+ :returns: mixed
- Returns a string containing the value of the passed item or NULL if the item is not found.
+ If no parameter is passed, it will return an associative array of all existing tempdata.
+
+ Otherwise returns a string containing the value of the passed item or NULL if the item is not found.
Example::
- $this->session->flashdata('message');
- //returns 'Test message.' considering the set_flashdata example.
+ $this->session->tempdata('message');
+ //returns 'Test message.' considering the set_tempdata example.
.. method:: set_tempdata($newdata[, $newval = ''[, $expire = 0]])
@@ -667,15 +690,4 @@ Class Reference
//unsets 'user' from tempdata.
$this->session->unset_tempdata(array('user', 'useremail'));
- //unsets both 'user' and 'useremail' from the tempdata.
-
- .. method:: tempdata($item)
-
- :param string $item: Tempdata item name
- :returns: string
-
- Returns a string containing the value of the passed item or NULL if the item is not found.
- Example::
-
- $this->session->tempdata('message');
- //returns 'Test message.' considering the set_tempdata example.
+ //unsets both 'user' and 'useremail' from the tempdata. \ No newline at end of file