PHP Класс WP_Session, wp-session-manager

С версии: 3.6.0
Наследование: implements ArrayAccess, implements Iterator, implements Countable
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$session_id string ID of the current session.

Защищенные свойства (Protected)

Свойство Тип Описание
$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