Elgg  Version 1.9
Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
ElggSession Class Reference
Inheritance diagram for ElggSession:

Public Member Functions

 __construct (Elgg_Http_SessionStorage $storage)
 Constructor. More...
 
 start ()
 Start the session. More...
 
 migrate ($destroy=false)
 Migrates the session to a new session id while maintaining session attributes. More...
 
 invalidate ()
 Invalidates the session. More...
 
 isStarted ()
 Has the session been started. More...
 
 getId ()
 Get the session ID. More...
 
 setId ($id)
 Set the session ID. More...
 
 getName ()
 Get the session name. More...
 
 setName ($name)
 Set the session name. More...
 
 get ($name, $default=null)
 Get an attribute of the session. More...
 
 set ($name, $value)
 Set an attribute. More...
 
 remove ($name)
 Remove an attribute. More...
 
 del ($key)
 Alias to offsetUnset() More...
 
 has ($name)
 Has the attribute been defined. More...
 
 setLoggedInUser (ElggUser $user)
 Sets the logged in user. More...
 
 getLoggedInUser ()
 Gets the logged in user. More...
 
 removeLoggedInUser ()
 Remove the logged in user. More...
 
 __isset ($key)
 Test if property is set either as an attribute or metadata. More...
 
 offsetSet ($key, $value)
 Set a value, go straight to session. More...
 
 offsetGet ($key)
 Get a variable from either the session, or if its not in the session attempt to get it from an api call. More...
 
 offsetUnset ($key)
 Unset a value from the cache and the session. More...
 
 offsetExists ($offset)
 Return whether the value is set in either the session or the cache. More...
 

Protected Member Functions

 generateSessionToken ()
 Adds a token to the session. More...
 

Protected Attributes

 $storage
 
 $loggedInUser
 

Detailed Description

Definition at line 18 of file ElggSession.php.

Constructor & Destructor Documentation

ElggSession::__construct ( Elgg_Http_SessionStorage  $storage)

Constructor.

Parameters
Elgg_Http_SessionStorage$storageThe storage engine private Use elgg_get_session()

Definition at line 32 of file ElggSession.php.

Member Function Documentation

ElggSession::__isset (   $key)

Test if property is set either as an attribute or metadata.

Parameters
string$keyThe name of the attribute or metadata.
Returns
bool

Definition at line 240 of file ElggSession.php.

ElggSession::del (   $key)

Alias to offsetUnset()

Parameters
string$keyName
Returns
void

Definition at line 169 of file ElggSession.php.

ElggSession::generateSessionToken ( )
protected

Adds a token to the session.

This is used in creation of CSRF token

Returns
void

Definition at line 225 of file ElggSession.php.

ElggSession::get (   $name,
  $default = null 
)

Get an attribute of the session.

Parameters
string$nameName of the attribute to get
mixed$defaultValue to return if attribute is not set (default is null)
Returns
mixed

Definition at line 136 of file ElggSession.php.

ElggSession::getId ( )

Get the session ID.

Returns
string
Since
1.9

Definition at line 93 of file ElggSession.php.

ElggSession::getLoggedInUser ( )

Gets the logged in user.

Returns
ElggUser
Since
1.9

Definition at line 203 of file ElggSession.php.

ElggSession::getName ( )

Get the session name.

Returns
string
Since
1.9

Definition at line 114 of file ElggSession.php.

ElggSession::has (   $name)

Has the attribute been defined.

Parameters
string$nameName of the attribute
Returns
bool
Since
1.9

Definition at line 181 of file ElggSession.php.

ElggSession::invalidate ( )

Invalidates the session.

Deletes session data and session persistence. Starts a new session.

Returns
boolean
Since
1.9

Definition at line 69 of file ElggSession.php.

ElggSession::isStarted ( )

Has the session been started.

Returns
boolean
Since
1.9

Definition at line 83 of file ElggSession.php.

ElggSession::migrate (   $destroy = false)

Migrates the session to a new session id while maintaining session attributes.

Parameters
boolean$destroyWhether to delete the session or let gc handle clean up
Returns
boolean
Since
1.9

Definition at line 57 of file ElggSession.php.

ElggSession::offsetExists (   $offset)

Return whether the value is set in either the session or the cache.

See also
ArrayAccess::offsetExists()
Parameters
int$offsetOffset
Returns
bool

Definition at line 333 of file ElggSession.php.

ElggSession::offsetGet (   $key)

Get a variable from either the session, or if its not in the session attempt to get it from an api call.

See also
ArrayAccess::offsetGet()
Parameters
mixed$keyName
Returns
mixed

Definition at line 271 of file ElggSession.php.

ElggSession::offsetSet (   $key,
  $value 
)

Set a value, go straight to session.

Parameters
string$keyName
mixed$valueValue
Returns
void

Definition at line 255 of file ElggSession.php.

ElggSession::offsetUnset (   $key)

Unset a value from the cache and the session.

See also
ArrayAccess::offsetUnset()
Parameters
mixed$keyName
Returns
void

Definition at line 318 of file ElggSession.php.

ElggSession::remove (   $name)

Remove an attribute.

Parameters
string$nameThe name of the attribute to remove
Returns
mixed The removed attribute
Since
1.9

Definition at line 158 of file ElggSession.php.

ElggSession::removeLoggedInUser ( )

Remove the logged in user.

Returns
void
Since
1.9

Definition at line 213 of file ElggSession.php.

ElggSession::set (   $name,
  $value 
)

Set an attribute.

Parameters
string$nameName of the attribute to set
mixed$valueValue to be set
Returns
void

Definition at line 147 of file ElggSession.php.

ElggSession::setId (   $id)

Set the session ID.

Parameters
string$idSession ID
Returns
void
Since
1.9

Definition at line 104 of file ElggSession.php.

ElggSession::setLoggedInUser ( ElggUser  $user)

Sets the logged in user.

Parameters
ElggUser$userThe user who is logged in
Returns
void
Since
1.9

Definition at line 192 of file ElggSession.php.

ElggSession::setName (   $name)

Set the session name.

Parameters
string$nameSession name
Returns
void
Since
1.9

Definition at line 125 of file ElggSession.php.

ElggSession::start ( )

Start the session.

Returns
boolean
Exceptions
RuntimeExceptionIf session fails to start.
Since
1.9

Definition at line 44 of file ElggSession.php.

Member Data Documentation

ElggSession::$loggedInUser
protected

Definition at line 24 of file ElggSession.php.

ElggSession::$storage
protected

Definition at line 21 of file ElggSession.php.


The documentation for this class was generated from the following file: