Helper class for manipulating cookies with XenForo-specific options.

package XenForo_Helper

 Methods

Clears the specified ID from the specified cookie.

clearIdFromCookie(integer | string $id, $cookieName, \Zend_Controller_Request_Http $request) : array
Static

The cookie must be a comma-separated ID list.

Parameters

$id

integerstring

$cookieName

$request

\Zend_Controller_Request_Http

Returns

arrayExploded cookie array

Deletes all cookies set by XenForo.

deleteAllCookies(array $skip, array $flags) 
Static

Parameters

$skip

array

List of cookies to skip

$flags

array

List of flags to apply to individual cookies. [cookie name] => {httpOnly: true/false, secure: true/false/null}

Deletes the named cookie.

deleteCookie(string $name, boolean $httpOnly, boolean | null $secure) : boolean
Static

The settings must match the settings when it was created.

Parameters

$name

string

Name of cookie

$httpOnly

boolean

Whether the cookie should be available via HTTP only

$secure

booleannull

Whether the cookie should be available via HTTPS only; if null, value is true if currently on HTTPS

Returns

booleanTrue if deleted

Gets the specified cookie.

getCookie(string $name, \Zend_Controller_Request_Http $request) : string | array | false
Static

This automatically adds the necessary prefix.

Parameters

$name

string

Cookie name without prefix

$request

\Zend_Controller_Request_Http

Returns

stringarrayfalseFalse if cookie isn't found

Sets a cookie with XenForo-specific options.

setCookie(string $name, string $value, integer $lifetime, boolean $httpOnly, boolean | null $secure) : boolean
Static

Parameters

$name

string

Name of the cookie

$value

string

Value of the cookie

$lifetime

integer

The number of seconds the cookie should live from now. If 0, sets a session cookie.

$httpOnly

boolean

Whether the cookie should be available via HTTP only

$secure

booleannull

Whether the cookie should be available via HTTPS only; if null, value is true if currently on HTTPS

Returns

booleanTrue if set

Internal helper to set or delete a cookie with XenForo-specific options.

_setCookieInternal(string $name, string | false $value, integer $expiration, boolean $httpOnly, boolean | null $secure) : boolean
Static

Parameters

$name

string

Name of the cookie

$value

stringfalse

Value of the cookie, false to delete

$expiration

integer

Time stamp the cookie expires

$httpOnly

boolean

Whether the cookie should be available via HTTP only

$secure

booleannull

Whether the cookie should be available via HTTPS only; if null, value is true if currently on HTTPS

Returns

booleanTrue if set

Private constructor.

__construct() 

Use statically.