summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Bilbie <alex.bilbie@gmail.com>2011-08-21 16:44:10 +0200
committerAlex Bilbie <alex.bilbie@gmail.com>2011-08-21 16:44:10 +0200
commita1a8ef711ec179a183a32f6cf4502ddc48782a84 (patch)
treed722bd706ec2a26aa5cb0ead0d1646c94b86e0dd
parent95311be467faa2e744bbd9e932900a7cf96b081f (diff)
-rw-r--r--system/libraries/Cart.php10
-rw-r--r--system/libraries/Session.php59
2 files changed, 19 insertions, 50 deletions
diff --git a/system/libraries/Cart.php b/system/libraries/Cart.php
index 1caef49cd..b2eaa9ad7 100644
--- a/system/libraries/Cart.php
+++ b/system/libraries/Cart.php
@@ -59,9 +59,9 @@ class CI_Cart {
$this->CI->load->library('session', $config);
// Grab the shopping cart array from the session table, if it exists
- if ($this->CI->session->get('cart_contents') !== FALSE)
+ if ($this->CI->session->userdata('cart_contents') !== FALSE)
{
- $this->_cart_contents = $this->CI->session->get('cart_contents');
+ $this->_cart_contents = $this->CI->session->userdata('cart_contents');
}
else
{
@@ -397,7 +397,7 @@ class CI_Cart {
// Is our cart empty? If so we delete it from the session
if (count($this->_cart_contents) <= 2)
{
- $this->CI->session->rm('cart_contents');
+ $this->CI->session->unset_userdata('cart_contents');
// Nothing more to do... coffee time!
return FALSE;
@@ -405,7 +405,7 @@ class CI_Cart {
// If we made it this far it means that our cart has data.
// Let's pass it to the Session class so it can be stored
- $this->CI->session->set(array('cart_contents' => $this->_cart_contents));
+ $this->CI->session->set_userdata(array('cart_contents' => $this->_cart_contents));
// Woot!
return TRUE;
@@ -541,7 +541,7 @@ class CI_Cart {
$this->_cart_contents['cart_total'] = 0;
$this->_cart_contents['total_items'] = 0;
- $this->CI->session->rm('cart_contents');
+ $this->CI->session->unset_userdata('cart_contents');
}
diff --git a/system/libraries/Session.php b/system/libraries/Session.php
index 3203468b2..2c8a80163 100644
--- a/system/libraries/Session.php
+++ b/system/libraries/Session.php
@@ -395,7 +395,7 @@ class CI_Session {
* @access public
* @return void
*/
- function destroy()
+ function sess_destroy()
{
// Kill the session DB row
if ($this->sess_use_database === TRUE AND isset($this->userdata['session_id']))
@@ -424,7 +424,7 @@ class CI_Session {
* @param string
* @return string
*/
- function get($item)
+ function userdata($item)
{
return ( ! isset($this->userdata[$item])) ? FALSE : $this->userdata[$item];
}
@@ -437,7 +437,7 @@ class CI_Session {
* @access public
* @return array
*/
- function get_all()
+ function all_userdata()
{
return $this->userdata;
}
@@ -452,7 +452,7 @@ class CI_Session {
* @param string
* @return void
*/
- function set($newdata = array(), $newval = '')
+ function set_userdata($newdata = array(), $newval = '')
{
if (is_string($newdata))
{
@@ -478,7 +478,7 @@ class CI_Session {
* @access array
* @return void
*/
- function rm($newdata = array())
+ function unset_userdata($newdata = array())
{
if (is_string($newdata))
{
@@ -519,7 +519,7 @@ class CI_Session {
foreach ($newdata as $key => $val)
{
$flashdata_key = $this->flashdata_key.':new:'.$key;
- $this->set($flashdata_key, $val);
+ $this->set_userdata($flashdata_key, $val);
}
}
}
@@ -540,10 +540,10 @@ class CI_Session {
// Note the function will return FALSE if the $key
// provided cannot be found
$old_flashdata_key = $this->flashdata_key.':old:'.$key;
- $value = $this->get($old_flashdata_key);
+ $value = $this->userdata($old_flashdata_key);
$new_flashdata_key = $this->flashdata_key.':new:'.$key;
- $this->set($new_flashdata_key, $value);
+ $this->set_userdata($new_flashdata_key, $value);
}
// ------------------------------------------------------------------------
@@ -558,7 +558,7 @@ class CI_Session {
function flashdata($key)
{
$flashdata_key = $this->flashdata_key.':old:'.$key;
- return $this->get($flashdata_key);
+ return $this->userdata($flashdata_key);
}
// ------------------------------------------------------------------------
@@ -572,15 +572,15 @@ class CI_Session {
*/
function _flashdata_mark()
{
- $userdata = $this->get_all();
+ $userdata = $this->all_userdata();
foreach ($userdata as $name => $value)
{
$parts = explode(':new:', $name);
if (is_array($parts) && count($parts) === 2)
{
$new_name = $this->flashdata_key.':old:'.$parts[1];
- $this->set($new_name, $value);
- $this->unset($name);
+ $this->set_userdata($new_name, $value);
+ $this->unset_userdata($name);
}
}
}
@@ -596,12 +596,12 @@ class CI_Session {
function _flashdata_sweep()
{
- $userdata = $this->get_all();
+ $userdata = $this->all_userdata();
foreach ($userdata as $key => $value)
{
if (strpos($key, ':old:'))
{
- $this->unset($key);
+ $this->unset_userdata($key);
}
}
@@ -767,37 +767,6 @@ class CI_Session {
log_message('debug', 'Session garbage collection performed.');
}
}
-
- // --------------------------------------------------------------------
-
- /**
- * Backwards compatible functions
- */
-
- function userdata($item)
- {
- return $this->get($item);
- }
-
- function all_userdata()
- {
- return $this->get_all();
- }
-
- function set_userdata($newdata)
- {
- $this->set($newdata);
- }
-
- function unset_userdata($newdata)
- {
- $this->rm($newdata);
- }
-
- function sess_destroy()
- {
- $this->destroy();
- }
}