PHP Class Give_Session, Give

This is a wrapper class for WP_Session / PHP $_SESSION and handles the storage of Give sessions.
Since: 1.0
ファイルを表示 Open project: wordimpress/give

Public Methods

Method Description
__construct ( ) : void Class Constructor
get ( string $key ) : string Get Session
get_id ( ) : string Get Session ID
get_session_expiration ( ) : string Get Session Expiration
init ( ) : array Session Init
maybe_start_session ( ) : void Maybe Start Session
set ( string $key, string $value ) : mixed Set Session
set_expiration_time ( ) : integer Set Cookie Expiration
set_expiration_variant_time ( ) : integer Set Cookie Variant Time
set_session_cookies ( ) Set Session Cookies
should_start_session ( ) : boolean Should Start Session
use_php_sessions ( ) : boolean Starts a new session if one has not started yet.

Method Details

__construct() public method

Defines our session constants, includes the necessary libraries and retrieves the session instance.
Since: 1.0
public __construct ( ) : void
return void

get() public method

Retrieve session variable for a given session key.
Since: 1.0
public get ( string $key ) : string
$key string Session key.
return string Session variable.

get_id() public method

Retrieve session ID.
Since: 1.0
public get_id ( ) : string
return string Session ID.

get_session_expiration() public method

Looks at the session cookies and returns the expiration date for this session if applicable
public get_session_expiration ( ) : string
return string Formatted expiration date string.

init() public method

Setup the Session instance.
Since: 1.0
public init ( ) : array
return array Session instance

maybe_start_session() public method

Starts a new session if one hasn't started yet.
See also: http://php.net/manual/en/function.session-set-cookie-params.php
public maybe_start_session ( ) : void
return void

set() public method

Create a new session.
Since: 1.0
public set ( string $key, string $value ) : mixed
$key string Session key.
$value string Session variable.
return mixed Session variable.

set_expiration_time() public method

Force the cookie expiration time if set, default to 24 hours.
Since: 1.0
public set_expiration_time ( ) : integer
return integer

set_expiration_variant_time() public method

Force the cookie expiration variant time to custom expiration option, less and hour. defaults to 23 hours (set_expiration_variant_time used in WP_Session).
Since: 1.0

set_session_cookies() public method

Cookies are used to increase the session lifetime using the give setting. This is helpful for when a user closes their browser after making a donation and comes back to the site.
Since: 1.4
public set_session_cookies ( )

should_start_session() public method

Determines if we should start sessions.
Since: 1.4
public should_start_session ( ) : boolean
return boolean

use_php_sessions() public method

Checks to see if the server supports PHP sessions or if the GIVE_USE_PHP_SESSIONS constant is defined.
Since: 1.0
public use_php_sessions ( ) : boolean
return boolean $ret True if we are using PHP sessions, false otherwise.