PHP 클래스 ElggSession, Elgg

This class is intended to extend the $_SESSION magic variable by providing an API hook to plug in other values. Primarily this is intended to provide a way of supplying "logged in user" details without touching the session (which can cause problems when accessed server side). If a value is present in the session then that value is returned, otherwise a plugin hook 'session:get', '$var' is called, where $var is the variable being requested. Setting values will store variables in the session in the normal way. LIMITATIONS: You can not access multidimensional arrays This is EXPERIMENTAL.
상속: implements ArrayAccess
파일 보기 프로젝트 열기: elgg/elgg 1 사용 예제들

보호된 프로퍼티들

프로퍼티 타입 설명
$ignore_access boolean
$logged_in_user ElggUser | null
$storage Symfony\Component\HttpFoundation\Session\SessionInterface

공개 메소드들

메소드 설명
__construct ( Symfony\Component\HttpFoundation\Session\SessionInterface $storage ) Constructor
get ( string $name, mixed $default = null ) : mixed Get an attribute of the session
getId ( ) : string Get the session ID
getIgnoreAccess ( ) : boolean Get current ignore access setting.
getLoggedInUser ( ) : ElggUser | null Gets the logged in user
getLoggedInUserGuid ( ) : integer Return the current logged in user by guid.
getMock ( ) : self Get an isolated ElggSession that does not persist between requests
getName ( ) : string Get the session name
has ( string $name ) : boolean Has the attribute been defined
invalidate ( ) : boolean Invalidates the session
isAdminLoggedIn ( ) : boolean Returns whether or not the viewer is currently logged in and an admin user.
isLoggedIn ( ) : boolean Returns whether or not the user is currently logged in
isStarted ( ) : boolean Has the session been started
migrate ( boolean $destroy = false ) : boolean Migrates the session to a new session id while maintaining session attributes
remove ( string $name ) : mixed Remove an attribute
removeLoggedInUser ( ) : void Remove the logged in user
set ( string $name, mixed $value ) : void Set an attribute
setId ( string $id ) : void Set the session ID
setIgnoreAccess ( boolean $ignore = true ) : boolean Set ignore access.
setLoggedInUser ( ElggUser $user ) : void Sets the logged in user
setName ( string $name ) : void Set the session name
start ( ) : boolean Start the session

보호된 메소드들

메소드 설명
generateSessionToken ( ) : void Adds a token to the session

메소드 상세

__construct() 공개 메소드

Constructor
public __construct ( Symfony\Component\HttpFoundation\Session\SessionInterface $storage )
$storage Symfony\Component\HttpFoundation\Session\SessionInterface The underlying Session implementation

generateSessionToken() 보호된 메소드

This is used in creation of CSRF token, and is passed to the client to allow validating tokens later, even if the PHP session was destroyed.
protected generateSessionToken ( ) : void
리턴 void

get() 공개 메소드

Get an attribute of the session
public get ( string $name, mixed $default = null ) : mixed
$name string Name of the attribute to get
$default mixed Value to return if attribute is not set (default is null)
리턴 mixed

getId() 공개 메소드

Get the session ID
부터: 1.9
public getId ( ) : string
리턴 string

getIgnoreAccess() 공개 메소드

Get current ignore access setting.
public getIgnoreAccess ( ) : boolean
리턴 boolean

getLoggedInUser() 공개 메소드

Gets the logged in user
부터: 1.9
public getLoggedInUser ( ) : ElggUser | null
리턴 ElggUser | null

getLoggedInUserGuid() 공개 메소드

Return the current logged in user by guid.
또한 보기: elgg_get_logged_in_user_entity()
public getLoggedInUserGuid ( ) : integer
리턴 integer

getMock() 공개 정적인 메소드

Get an isolated ElggSession that does not persist between requests
public static getMock ( ) : self
리턴 self

getName() 공개 메소드

Get the session name
부터: 1.9
public getName ( ) : string
리턴 string

has() 공개 메소드

Has the attribute been defined
부터: 1.9
public has ( string $name ) : boolean
$name string Name of the attribute
리턴 boolean

invalidate() 공개 메소드

Deletes session data and session persistence. Starts a new session.
부터: 1.9
public invalidate ( ) : boolean
리턴 boolean

isAdminLoggedIn() 공개 메소드

Returns whether or not the viewer is currently logged in and an admin user.
public isAdminLoggedIn ( ) : boolean
리턴 boolean

isLoggedIn() 공개 메소드

Returns whether or not the user is currently logged in
public isLoggedIn ( ) : boolean
리턴 boolean

isStarted() 공개 메소드

Has the session been started
부터: 1.9
public isStarted ( ) : boolean
리턴 boolean

migrate() 공개 메소드

Migrates the session to a new session id while maintaining session attributes
부터: 1.9
public migrate ( boolean $destroy = false ) : boolean
$destroy boolean Whether to delete the session or let gc handle clean up
리턴 boolean

remove() 공개 메소드

Remove an attribute
부터: 1.9
public remove ( string $name ) : mixed
$name string The name of the attribute to remove
리턴 mixed The removed attribute

removeLoggedInUser() 공개 메소드

Remove the logged in user
부터: 1.9
public removeLoggedInUser ( ) : void
리턴 void

set() 공개 메소드

Set an attribute
public set ( string $name, mixed $value ) : void
$name string Name of the attribute to set
$value mixed Value to be set
리턴 void

setId() 공개 메소드

Set the session ID
부터: 1.9
public setId ( string $id ) : void
$id string Session ID
리턴 void

setIgnoreAccess() 공개 메소드

Set ignore access.
public setIgnoreAccess ( boolean $ignore = true ) : boolean
$ignore boolean Ignore access
리턴 boolean Previous setting

setLoggedInUser() 공개 메소드

Sets the logged in user
부터: 1.9
public setLoggedInUser ( ElggUser $user ) : void
$user ElggUser The user who is logged in
리턴 void

setName() 공개 메소드

Set the session name
부터: 1.9
public setName ( string $name ) : void
$name string Session name
리턴 void

start() 공개 메소드

Start the session
부터: 1.9
public start ( ) : boolean
리턴 boolean

프로퍼티 상세

$ignore_access 보호되어 있는 프로퍼티

protected bool $ignore_access
리턴 boolean

$logged_in_user 보호되어 있는 프로퍼티

protected ElggUser|null $logged_in_user
리턴 ElggUser | null

$storage 보호되어 있는 프로퍼티

protected SessionInterface,Symfony\Component\HttpFoundation\Session $storage
리턴 Symfony\Component\HttpFoundation\Session\SessionInterface