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

Public Member Functions

 __construct (array $options=array(), Elgg_Http_SessionHandler $handler=null)
 Constructor. More...
 
 start ()
 {Starts the session.
Returns
boolean True if started.
Exceptions
RuntimeExceptionIf something goes wrong starting the session.
} More...
 
 regenerate ($destroy=false, $lifetime=null)
 {Regenerates id that represents this storage.This method must invoke session_regenerate_id($destroy) unless this interface is used for a storage object designed for unit or functional testing where a real PHP session would interfere with testing.Note regenerate+destroy should not clear the session data in memory only delete the session data from persistent storage.
Parameters
boolean$destroyDestroy session when regenerating?
integer$lifetimeSets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.
Returns
boolean True if session regenerated, false if error
Exceptions
RuntimeExceptionIf an error occurs while regenerating this storage
} More...
 
 save ()
 {Force the session to be saved and closed.This method must invoke session_write_close() unless this interface is used for a storage object design for unit or functional testing where a real PHP session would interfere with testing, in which case it it should actually persist the session data if required.
Returns
void
Exceptions
RuntimeExceptionIf the session is saved without being started, or if the session is already closed.
} More...
 
 isStarted ()
 {Checks if the session is started.
Returns
boolean True if started, false otherwise.
} More...
 
 getId ()
 {Returns the session ID.
Returns
string The session ID or empty.
} More...
 
 setId ($id)
 {Sets the session ID.
Parameters
string$idSession string
Returns
void
} More...
 
 getName ()
 {Returns the session name.
Returns
string The session name.
} More...
 
 setName ($name)
 {Sets the session name.
Parameters
string$nameSession name.
Returns
void
} More...
 
 has ($name)
 {Checks if an attribute is defined.
Parameters
string$nameThe attribute name
Returns
boolean
} More...
 
 get ($name, $default=null)
 {Returns an attribute.
Parameters
string$nameThe attribute name
mixed$defaultThe default value if not found.
Returns
mixed
} More...
 
 set ($name, $value)
 {Sets an attribute.
Parameters
string$nameAttribute name
mixed$valueAttribute value
Returns
void
} More...
 
 all ()
 {Returns all attributes.
Returns
array Attributes
} More...
 
 replace (array $attributes)
 {Replaces all attributes.
Parameters
array$attributesAttributes
Returns
void
} More...
 
 remove ($name)
 {Removes an attribute.
Parameters
string$nameAttribute name
Returns
mixed The removed value
} More...
 
 clear ()
 {Clears all attributes.
Returns
void
} More...
 

Protected Member Functions

 setOptions (array $options)
 Sets session. More...
 
 setHandler ($handler)
 Set the session handler class with PHP. More...
 

Protected Attributes

 $started = false
 
 $closed = false
 

Detailed Description

Definition at line 35 of file NativeSessionStorage.php.

Constructor & Destructor Documentation

Elgg_Http_NativeSessionStorage::__construct ( array  $options = array(),
Elgg_Http_SessionHandler  $handler = null 
)

Constructor.

List of options for $options array with their defaults.

See also
http://php.net/session.configuration for options but we omit 'session.' from the beginning of the keys for convenience.

("auto_start", is not supported as it tells PHP to start a session before PHP starts to execute user-land code. Setting during runtime has no effect).

cache_limiter, "nocache" (use "0" to prevent headers from being sent entirely). cookie_domain, "" cookie_httponly, "" cookie_lifetime, "0" cookie_path, "/" cookie_secure, "" entropy_file, "" entropy_length, "0" gc_divisor, "100" gc_maxlifetime, "1440" gc_probability, "1" hash_bits_per_character, "4" hash_function, "0" referer_check, "" serialize_handler, "php" use_cookies, "1" use_only_cookies, "1" use_trans_sid, "0" upload_progress.enabled, "1" upload_progress.cleanup, "1" upload_progress.prefix, "upload_progress_" upload_progress.name, "PHP_SESSION_UPLOAD_PROGRESS" upload_progress.freq, "1%" upload_progress.min-freq, "1"

Parameters
array$optionsSession config options
Elgg_Http_SessionHandler$handlerSession handler

Definition at line 81 of file NativeSessionStorage.php.

Member Function Documentation

Elgg_Http_NativeSessionStorage::all ( )

{Returns all attributes.

Returns
array Attributes
}

Implements Elgg_Http_SessionStorage.

Definition at line 201 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::clear ( )

{Clears all attributes.

Returns
void
}

Implements Elgg_Http_SessionStorage.

Definition at line 240 of file NativeSessionStorage.php.

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

{Returns an attribute.

Parameters
string$nameThe attribute name
mixed$defaultThe default value if not found.
Returns
mixed
}

Implements Elgg_Http_SessionStorage.

Definition at line 181 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::getId ( )

{Returns the session ID.

Returns
string The session ID or empty.
}

Implements Elgg_Http_SessionStorage.

Definition at line 134 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::getName ( )

{Returns the session name.

Returns
string The session name.
}

Implements Elgg_Http_SessionStorage.

Definition at line 156 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::has (   $name)

{Checks if an attribute is defined.

Parameters
string$nameThe attribute name
Returns
boolean
}

Implements Elgg_Http_SessionStorage.

Definition at line 170 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::isStarted ( )

{Checks if the session is started.

Returns
boolean True if started, false otherwise.
}

Implements Elgg_Http_SessionStorage.

Definition at line 127 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::regenerate (   $destroy = false,
  $lifetime = null 
)

{Regenerates id that represents this storage.This method must invoke session_regenerate_id($destroy) unless this interface is used for a storage object designed for unit or functional testing where a real PHP session would interfere with testing.Note regenerate+destroy should not clear the session data in memory only delete the session data from persistent storage.

Parameters
boolean$destroyDestroy session when regenerating?
integer$lifetimeSets the cookie lifetime for the session cookie. A null value will leave the system settings unchanged, 0 sets the cookie to expire with browser session. Time is in seconds, and is not a Unix timestamp.
Returns
boolean True if session regenerated, false if error
Exceptions
RuntimeExceptionIf an error occurs while regenerating this storage
}

Implements Elgg_Http_SessionStorage.

Definition at line 107 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::remove (   $name)

{Removes an attribute.

Parameters
string$nameAttribute name
Returns
mixed The removed value
}

Implements Elgg_Http_SessionStorage.

Definition at line 224 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::replace ( array  $attributes)

{Replaces all attributes.

Parameters
array$attributesAttributes
Returns
void
}

Implements Elgg_Http_SessionStorage.

Definition at line 211 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::save ( )

{Force the session to be saved and closed.This method must invoke session_write_close() unless this interface is used for a storage object design for unit or functional testing where a real PHP session would interfere with testing, in which case it it should actually persist the session data if required.

Returns
void
Exceptions
RuntimeExceptionIf the session is saved without being started, or if the session is already closed.
}

Implements Elgg_Http_SessionStorage.

Definition at line 118 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::set (   $name,
  $value 
)

{Sets an attribute.

Parameters
string$nameAttribute name
mixed$valueAttribute value
Returns
void
}

Implements Elgg_Http_SessionStorage.

Definition at line 191 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::setHandler (   $handler)
protected

Set the session handler class with PHP.

Parameters
Elgg_Http_SessionHandler$handlerHandler object
Returns
void

Definition at line 283 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::setId (   $id)

{Sets the session ID.

Parameters
string$idSession string
Returns
void
}

Implements Elgg_Http_SessionStorage.

Definition at line 145 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::setName (   $name)

{Sets the session name.

Parameters
string$nameSession name.
Returns
void
}

Implements Elgg_Http_SessionStorage.

Definition at line 163 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::setOptions ( array  $options)
protected

Sets session.

  • ini variables.

For convenience we omit 'session.' from the beginning of the keys. Explicitly ignores other ini keys.

Parameters
array$optionsSession ini directives array(key => value).
Returns
void
See also
http://php.net/session.configuration

Definition at line 257 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::start ( )

{Starts the session.

Returns
boolean True if started.
Exceptions
RuntimeExceptionIf something goes wrong starting the session.
}

Implements Elgg_Http_SessionStorage.

Definition at line 89 of file NativeSessionStorage.php.

Member Data Documentation

Elgg_Http_NativeSessionStorage::$closed = false
protected

Definition at line 41 of file NativeSessionStorage.php.

Elgg_Http_NativeSessionStorage::$started = false
protected

Definition at line 38 of file NativeSessionStorage.php.


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