From e0a631c3353ea26483e3958306fb2b53d7558a21 Mon Sep 17 00:00:00 2001 From: Michael Date: Sun, 20 Oct 2013 10:40:51 +0300 Subject: refactored the class reference in session.rst to properly reflect the session class Signed-off-by: Michael --- user_guide_src/source/libraries/sessions.rst | 145 +++++++++++---------------- 1 file changed, 61 insertions(+), 84 deletions(-) (limited to 'user_guide_src/source/libraries') diff --git a/user_guide_src/source/libraries/sessions.rst b/user_guide_src/source/libraries/sessions.rst index 3dc067a70..cab7669ae 100644 --- a/user_guide_src/source/libraries/sessions.rst +++ b/user_guide_src/source/libraries/sessions.rst @@ -495,22 +495,32 @@ Class Reference .. class:: CI_Session -Userdata --------- + .. method:: load_driver($driver) - .. method:: set_userdata($newdata = array(), $newval) + :param string $driver: Driver name + :returns: object Loaded driver object - :param mixed $newdata: Item name or array of items - :param mixed $newval: Item value or empty string (not required if $newdata is array) + Loads a session storage driver + + .. method:: select_driver($driver) + + :param string $driver: Driver name :returns: void - Sets items into session example usages:: + Selects default session storage driver. - $this->session->set_userdata('user', 'example@example.com'); - // adds item user with value example@example.com to the session + .. method:: sess_destroy() - $this->session->set_userdata(array('user'=>'example@example.com')); - // does the same as the above example - adds item user with value example@example.com to the session + Destroys current session + .. note:: This function should be the last one called, and even flash variables will no longer be available. + If you only want some items destroyed and not all, use ``unset_userdata()``. + + .. method:: sess_regenerate($destroy) + + :param bool $destroy: Destroy session data flag (default: false) + :returns: void + + Regenerate the current session data .. method:: userdata($item) @@ -522,6 +532,32 @@ Userdata $this->session->userdata('user'); //returns example@example.com considering the set_userdata example. + .. method:: all_userdata() + + :returns: array + + Retruns array of userdata session items + + .. method:: all_flashdata() + + :returns: array + + Retruns array of flashdata session items + + .. method:: set_userdata($newdata = array(), $newval) + + :param mixed $newdata: Item name or array of items + :param mixed $newval: Item value or empty string (not required if $newdata is array) + :returns: void + + Sets items into session example usages:: + + $this->session->set_userdata('user', 'example@example.com'); + // adds item user with value example@example.com to the session + + $this->session->set_userdata(array('user'=>'example@example.com')); + // does the same as the above example - adds item user with value example@example.com to the session + .. method:: unset_userdata($item) :param mixed $item: name of item or array of items @@ -533,7 +569,7 @@ Userdata //unsets 'user' from session data. $this->session->unset_userdata(array('user', 'useremail')); - //unsets both 'user' nad 'useremail' from the session data. + //unsets both 'user' and 'useremail' from the session data. .. method:: has_userdata($item) @@ -542,18 +578,6 @@ Userdata Checks if an item exists in the session. - .. method:: all_userdata() - - :returns: array - - Retruns array of userdata session items - - - -Flashdata ---------- -.. note:: the flashdata items are available only one server request - .. method:: set_flashdata($newdata = array(), $newval) :param mixed $newdata: Item name or array of items @@ -569,6 +593,13 @@ Flashdata // does the same as the above example - adds item 'message' with value 'Test message.' to the session flashdata + .. method:: keep_flashdata($item) + + :param mixed $item: name of item or array of flashdata items + :returns: void + + Keeps items into flashdata for one more request + .. method:: flashdata($item) :param string $item: name of session item @@ -579,30 +610,6 @@ Flashdata $this->session->flashdata('message'); //returns 'Test message.' considering the set_flashdata example. - .. method:: has_flashdata($item) - - :param string $item: name of item - :returns: bool - - Checks if an item exists in the session flashdata. - - .. method:: all_flashdata() - - :returns: array - - Retruns array of flashdata session items - - .. method:: keep_flashdata($item) - - :param mixed $item: name of item or array of flashdata items - :returns: void - - Keeps items into flashdata for one more request - - -Tempdata --------- - .. method:: set_tempdata($newdata = array(), $newval, $expires) :param mixed $newdata: Item name or array of items @@ -619,16 +626,6 @@ Tempdata // does the same as the above example - adds item 'message' with value 'Test message.' to the session tempdata for the default value of - .. method:: tempdata($item) - - :param string $item: name of tempdata item - :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. - .. method:: unset_tempdata($item) :param mixed $item: name of item or array of items @@ -640,34 +637,14 @@ Tempdata //unsets 'user' from tempdata. $this->session->unset_tempdata(array('user', 'useremail')); - //unsets both 'user' nad 'useremail' from the tempdata. - -Session -------- - - .. method:: sess_destroy() - - Destroys current session - .. note:: This function should be the last one called, and even flash variables will no longer be available. - If you only want some items destroyed and not all, use ``unset_userdata()``. - - .. method:: sess_regenerate($destroy) - - :param bool $destroy: Destroy session data flag (default: false) - :returns: void - - Regenerate the current session data + //unsets both 'user' and 'useremail' from the tempdata. - .. method:: load_driver($driver) - - :param string $driver: Driver name - :returns: object Loaded driver object - - Loads a session storage driver + .. method:: tempdata($item) - .. method:: select_driver($driver) + :param string $item: name of tempdata item + :returns: string - :param string $driver: Driver name - :returns: void + Returns a string containing the value of the passed item or NULL if the item is not found. Example:: - Selects default session storage driver. + $this->session->tempdata('message'); + //returns 'Test message.' considering the set_tempdata example. -- cgit v1.2.3-24-g4f1b