PHP 클래스 WP_Session, wp-session-manager

부터: 3.6.0
상속: implements ArrayAccess, implements Iterator, implements Countable
파일 보기 프로젝트 열기: ericmann/wp-session-manager 1 사용 예제들

공개 프로퍼티들

프로퍼티 타입 설명
$session_id string ID of the current session.

보호된 프로퍼티들

프로퍼티 타입 설명
$exp_variant integer Unix timestamp indicating when the expiration time needs to be reset.
$expires integer Unix timestamp when session expires.

공개 메소드들

메소드 설명
cache_expiration ( ) : integer Return the read-only cache expiration value.
get_instance ( ) : boolean | WP_Session Retrieve the current session instance.
json_in ( string $data ) : boolean Decodes a JSON string and, if the object is an array, overwrites the session container with its contents.
json_out ( ) : string Output the current container contents as a JSON-encoded string.
regenerate_id ( boolean $delete_old = false ) Regenerate the current session's ID.
reset ( ) Flushes all session variables.
session_started ( ) : boolean Check if a session has been initialized.
write_data ( ) Write the data from the current session to the data storage system.

보호된 메소드들

메소드 설명
__construct ( ) Default constructor.
read_data ( ) : array Read data from a transient for the current session.
set_cookie ( ) Set the session cookie
set_expiration ( ) Set both the expiration time and the expiration variant.

메소드 상세

__construct() 보호된 메소드

Will rebuild the session collection from the given session ID if it exists. Otherwise, will create a new session with that ID.
protected __construct ( )

cache_expiration() 공개 메소드

Return the read-only cache expiration value.
public cache_expiration ( ) : integer
리턴 integer

get_instance() 공개 정적인 메소드

Retrieve the current session instance.
public static get_instance ( ) : boolean | WP_Session
리턴 boolean | WP_Session

json_in() 공개 메소드

Decodes a JSON string and, if the object is an array, overwrites the session container with its contents.
public json_in ( string $data ) : boolean
$data string
리턴 boolean

json_out() 공개 메소드

Output the current container contents as a JSON-encoded string.
public json_out ( ) : string
리턴 string

read_data() 보호된 메소드

Automatically resets the expiration time for the session transient to some time in the future.
protected read_data ( ) : array
리턴 array

regenerate_id() 공개 메소드

Regenerate the current session's ID.
public regenerate_id ( boolean $delete_old = false )
$delete_old boolean Flag whether or not to delete the old session data from the server.

reset() 공개 메소드

Flushes all session variables.
public reset ( )

session_started() 공개 메소드

Check if a session has been initialized.
public session_started ( ) : boolean
리턴 boolean

set_expiration() 보호된 메소드

If the current time is below the variant, we don't update the session's expiration time. If it's greater than the variant, then we update the expiration time in the database. This prevents writing to the database on every page load for active sessions and only updates the expiration time if we're nearing when the session actually expires. By default, the expiration time is set to 30 minutes. By default, the expiration variant is set to 24 minutes. As a result, the session expiration time - at a maximum - will only be written to the database once every 24 minutes. After 30 minutes, the session will have been expired. No cookie will be sent by the browser, and the old session will be queued for deletion by the garbage collector.
protected set_expiration ( )

write_data() 공개 메소드

Write the data from the current session to the data storage system.
public write_data ( )

프로퍼티 상세

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

Unix timestamp indicating when the expiration time needs to be reset.
protected int $exp_variant
리턴 integer

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

Unix timestamp when session expires.
protected int $expires
리턴 integer

$session_id 공개적으로 프로퍼티

ID of the current session.
public string $session_id
리턴 string