HttpSessionService

Type
Class
Namespace
Craft
Inherits
Craft\HttpSessionService » CHttpSession (opens new window) » CApplicationComponent (opens new window) » CComponent (opens new window)
Implements
ArrayAccess (opens new window), Countable (opens new window), IApplicationComponent, IteratorAggregate (opens new window)
Since
1.0

Extends CHttpSession to add support for setting the session folder and creating it if it doesn't exist.

See also http://craftcms.com

View source (opens new window)

# Public Properties

Property Description
$autoStart (opens new window) boolean (opens new window) – Whether the session should be automatically started when the session application component is initialized, defaults to true.
$behaviors (opens new window) array (opens new window) – The behaviors that should be attached to this component.

# Public Methods

Method Description
__call() (opens new window) Calls the named method which is not a class method.
__get() (opens new window) Returns a property value, an event handler list or a behavior based on its name.
__isset() (opens new window) Checks if a property value is null.
__set() (opens new window) Sets value of a component property.
__unset() (opens new window) Sets a component property to be null.
add() (opens new window) Adds a session variable.
asa() (opens new window) Returns the named behavior object.
attachBehavior() (opens new window) Attaches a behavior to this component.
attachBehaviors() (opens new window) Attaches a list of behaviors to the component.
attachEventHandler() (opens new window) Attaches an event handler to an event.
canGetProperty() (opens new window) Determines whether a property can be read.
canSetProperty() (opens new window) Determines whether a property can be set.
clear() (opens new window) Removes all session variables
close() (opens new window) Ends the current session and store session data.
closeSession() (opens new window) Session close handler.
contains() (opens new window)
count() (opens new window) Returns the number of items in the session.
destroy() (opens new window) Frees all session variables and destroys all data registered to a session.
destroySession() (opens new window) Session destroy handler.
detachBehavior() (opens new window) Detaches a behavior from the component.
detachBehaviors() (opens new window) Detaches all behaviors from the component.
detachEventHandler() (opens new window) Detaches an existing event handler.
disableBehavior() (opens new window) Disables an attached behavior.
disableBehaviors() (opens new window) Disables all behaviors attached to this component.
enableBehavior() (opens new window) Enables an attached behavior.
enableBehaviors() (opens new window) Enables all behaviors attached to this component.
evaluateExpression() (opens new window) Evaluates a PHP expression or callback under the context of this component.
gcSession() (opens new window) Session GC (garbage collection) handler.
get() (opens new window) Returns the session variable value with the session variable name.
getCookieMode() (opens new window)
getCookieParams() (opens new window)
getCount() (opens new window) Returns the number of items in the session.
getEventHandlers() (opens new window) Returns the list of attached event handlers for an event.
getGCProbability() (opens new window)
getIsInitialized() (opens new window) Checks if this application component has been initialized.
getIsStarted()
getIterator() (opens new window) Returns an iterator for traversing the session variables.
getKeys() (opens new window)
getSavePath() (opens new window)
getSessionID() (opens new window)
getSessionName() (opens new window)
getTimeout() (opens new window)
getUseCustomStorage() (opens new window) Returns a value indicating whether to use custom session storage.
getUseTransparentSessionID() (opens new window)
hasEvent() (opens new window) Determines whether an event is defined.
hasEventHandler() (opens new window) Checks whether the named event has attached handlers.
hasProperty() (opens new window) Determines whether a property is defined.
init() Initializes the application component.
isStarted()
itemAt() (opens new window) Returns the session variable value with the session variable name.
offsetExists() (opens new window) This method is required by the interface ArrayAccess.
offsetGet() (opens new window) This method is required by the interface ArrayAccess.
offsetSet() (opens new window) This method is required by the interface ArrayAccess.
offsetUnset() (opens new window) This method is required by the interface ArrayAccess.
open() (opens new window) Starts the session if it has not started yet.
openSession() (opens new window) Session open handler.
raiseEvent() (opens new window) Raises an event.
readSession() (opens new window) Session read handler.
regenerateID() (opens new window) Updates the current session id with a newly generated one .
remove() (opens new window) Removes a session variable.
setCacheLimiter() (opens new window) Set cache limiter
setCookieMode() (opens new window)
setCookieParams() (opens new window) Sets the session cookie parameters.
setGCProbability() (opens new window)
setSavePath() Sets the path to save PHP session files.
setSessionID() (opens new window)
setSessionName() (opens new window)
setTimeout() (opens new window)
setUseTransparentSessionID() (opens new window)
toArray() (opens new window)
writeSession() (opens new window) Session write handler.

# getIsStarted()

View source (opens new window)

Returns

boolean (opens new window) – Whether the session has started

Signature

public boolean getIsStarted ( )

# init()

Initializes the application component.

View source (opens new window)

Returns

null (opens new window)

Signature

public null init ( )

# isStarted()

View source (opens new window)

Returns

boolean (opens new window) – Whether the session has started

Signature

public boolean isStarted ( )

# setSavePath()

Sets the path to save PHP session files.

View source (opens new window)

Arguments

Signature

public void setSavePath ( $value )

# Protected Methods

Method Description
freeze() (opens new window) If session is started we cannot edit session ini settings.
unfreeze() (opens new window) Start session and restore data from temporary variable