LLMS_Session::init_cookie()
Initialize the session cookie
Description Description
Retrieves and validates the cookie, when there’s a valid cookie it will initialize the object with data from the cookie. Otherwise it sets up and saves a new session and cookie.
Return Return
(void)
Source Source
File: includes/class.llms.session.php
protected function init_cookie() { $cookie = $this->get_cookie(); $set_cookie = false; if ( $cookie ) { $this->id = $cookie[0]; $this->expires = $cookie[1]; $this->expiring = $cookie[2]; $this->data = $this->read( $this->id ); // If the user has logged in, update the session data. $update_id = $this->maybe_update_id(); // If the session is nearing expiration, update the session. $extend_expiration = $this->maybe_extend_expiration(); // If either of these two items are true, the cookie needs to be updated. $set_cookie = $update_id || $extend_expiration; } else { $this->id = $this->generate_id(); $this->data = array(); $this->is_clean = false; $set_cookie = true; $this->set_expiration(); } if ( $set_cookie ) { $this->set_cookie(); } }
Expand full source code Collapse full source code View on GitHub
Changelog Changelog
Version | Description |
---|---|
4.0.0 | Introduced. |