\JSession
Class for managing HTTP sessions
Provides access to session-state values as well as session-level
settings and lifetime management methods.
Based on the standard PHP session handling mechanism it provides
more advanced features such as expire timeouts.
Synopsis
class JSession
implements
IteratorAggregate
{
- // members
- protected $_state;
- protected $_expire;
- protected JSessionStorage $_store;
- protected $_security;
- protected $_force_ssl;
- protected JSession $instance;
- protected $storeName;
- private JInput $_input;
- private JEventDispatcher $_dispatcher;
- // methods
- public void __construct()
- public mixed __get()
- public static JSession getInstance()
- public string getState()
- public integer getExpire()
- public string getToken()
- public boolean hasToken()
- public static string getFormToken()
- public ArrayIterator getIterator()
- public static boolean checkToken()
- public string getName()
- public string getId()
- public static array getStores()
- public boolean isActive()
- public boolean isNew()
- public void. initialise()
- public mixed get()
- public mixed set()
- public boolean has()
- public mixed clear()
- public void start()
- protected boolean _start()
- public boolean destroy()
- public boolean restart()
- public boolean fork()
- public void close()
- protected void _setCookieParams()
- protected string _createToken()
- protected boolean _setCounter()
- protected boolean _setTimers()
- protected boolean _setOptions()
- protected boolean _validate()
Hierarchy
Implements
Tasks
Tasks
Line | Task |
---|---|
280 | Decouple from legacy JApplication class. |
352 | : raise error |
369 | : raise error |
479 | :: generated error here |
509 | :: generated error here |
544 | :: generated error here |
568 | :: generated error here |
717 | :: generated error here |
748 | :: generated error here |
Members
private
- $_dispatcher
—
JEventDispatcher
Holds the event dispatcher object - $_input
—
JInput
Holds the JInput object
protected
- $_expire
—
string
Maximum age of unused session in minutes - $_force_ssl
—
boolean
Force cookies to be SSL only Default false - $_security
—
array
Security policy. - $_state
—
string
Internal state. - $_store
—
JSessionStorage
The session store object. - $instance
—
JSession
JSession instances container. - $storeName
—
string
The type of storage for the session.
Methods
protected
- _createToken() — Create a token-string
- _setCookieParams() — Set session cookie parameters
- _setCounter() — Set counter of session usage
- _setOptions() — Set additional session options
- _setTimers() — Set the session timers
- _start() — Start a session.
- _validate() — Do some checks for security reason
public
- __construct() — Constructor
- __get() — Magic method to get read-only access to properties.
- checkToken() — Checks for a form token in the request.
- clear() — Unset data from the session store
- close() — Writes session data and ends session
- destroy() — Frees all session variables and destroys all data registered to a session
- fork() — Create a new session and copy variables from the old one
- get() — Get data from the session store
- getExpire() — Get expiration time in minutes
- getFormToken() — Method to determine a hash for anti-spoofing variable names
- getId() — Get session id
- getInstance() — Returns the global Session object, only creating it if it doesn't already exist.
- getIterator() — Retrieve an external iterator.
- getName() — Get session name
- getState() — Get current state of session
- getStores() — Get the session handlers
- getToken() — Get a session token, if a token isn't set yet one will be generated.
- has() — Check whether data exists in the session store
- hasToken() — Method to determine if a token exists in the session. If not the session will be set to expired
- initialise() — Check whether this session is currently created
- isActive() — Shorthand to check if the session is active
- isNew() — Check whether this session is currently created
- restart() — Restart an expired or locked session.
- set() — Set data into the session store.
- start() — Start a session.