HttpSessionService

Type
Class
Namespace
Craft
Inherits
Craft\HttpSessionService » CHttpSession » CApplicationComponent » CComponent
Implements
ArrayAccess, Countable, IApplicationComponent, IteratorAggregate
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

Public Properties

PropertyDescription
$autoStartboolean – Whether the session should be automatically started when the session application component is initialized, defaults to true.
$behaviorsarray – The behaviors that should be attached to this component.

Public Methods

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

getIsStarted()

View source

Returns

boolean – Whether the session has started

Signature

public boolean getIsStarted ( )

init()

Initializes the application component.

View source

Returns

null

Signature

public null init ( )

isStarted()

View source

Returns

boolean – Whether the session has started

Signature

public boolean isStarted ( )

setSavePath()

Sets the path to save PHP session files.

View source

Arguments

  • $value (string) – The session save path.

Signature

public void setSavePath ( $value )

Protected Methods

MethodDescription
freeze()If session is started we cannot edit session ini settings.
unfreeze()Start session and restore data from temporary variable