ZMObject
└─ZMSession
public class ZMSession
extends ZMObject
| Constant Summary | |
|---|---|
| final static str | The default session name. |
| final static str | The default namespace prefix for session keys. |
| final static str | A magic session key used to validate forms. |
| Fields inherited from org.zenmagick.core\ZMObject | |
|---|---|
| properties_ | |
| Method Summary | |
|---|---|
| void | __construct(mixed domain, string name, boolean secure, boolean autostart) Create new instance. |
| void | close() Close session rather than wait for the end of request handling. |
| void | destroy() Destroy the current session. |
| void | getData() Get the current session data. |
| string | getId() Get the session id. |
| string | getName() Get the session name. |
| string | getToken(boolean renew) Get the session token. |
| mixed | getValue(string name, string namespace) Get a session value. |
| boolean | isNew() Check if starting this session would create a new session or if a session exists. |
| boolean | Check if we have a session yet. |
| void | Regenerate session. |
| void | registerSessionHandler(mixed handler, mixed A) Register a session handler. |
| mixed | setValue(string name, mxied value, string namespace) Set a session value. |
| boolean | start() Start session. |
| Methods inherited from org.zenmagick.core\ZMObject | |
|---|---|
| __construct, attachMethod, get, getAttachedMethods, getProperties, getPropertyNames, set, singleton | |
public final static str DEFAULT_NAME = 'zmid'
The default session name.
public final static str DEFAULT_NAMESPACE_PREFIX = '__ZM_NSP__'
The default namespace prefix for session keys.
public final static str SESSION_TOKEN_KEY = '__ZM_TOKEN__'
A magic session key used to validate forms.
public void __construct(mixed domain, string name, boolean secure, boolean autostart)
Create new instance.
If an existing session is detected (via isNew()), the session is automatically started.
ZMSession::DEFAULT_NAME.true.public void close()
Close session rather than wait for the end of request handling.
public void destroy()
Destroy the current session.
public void getData()
Get the current session data.
public string getId()
Get the session id.
null.public string getName()
Get the session name.
public string getToken(boolean renew)
Get the session token.
A new token will be created if none exists.
true a new token will be generated; default is false.public mixed getValue(string name, string namespace)
Get a session value.
null for none.null.public boolean isNew()
Check if starting this session would create a new session or if a session exists.
This will just check for a cookie with the configured session name.
true if starting this session would result in a new session.public boolean isStarted()
Check if we have a session yet.
true if the session has been already started.public void regenerate()
Regenerate session.
This will create a new session id while keeping existing session data.
public void registerSessionHandler(mixed handler, mixed A)
Register a session handler.
public mixed setValue(string name, mxied value, string namespace)
Set a session value.
null to clear all data.null to remove; default is null.null for none.null.public boolean start()
Start session.
true if a session was started, false if not.
A basic, cookies only, session class.