Internal representation of a single cookie.

Returned cookies are represented using this class, and when cookies are set, if they are not already a WP_Http_Cookie() object, then they are turned into one.

todo The WordPress convention is to use underscores instead of camelCase for function and method names. Need to switch to use underscores instead for the methods.
package WordPress
subpackage HTTP
since 2.8.0
author Beau Lebens

 Methods

Sets up this cookie object.

__construct(string|array $data) 

The parameter $data should be either an associative array containing the indices names below or a header string detailing it.

If it's an array, it should include the following elements:

  1. Name
  2. Value - should NOT be urlencoded already.
  3. Expires - (optional) String or int (UNIX timestamp).
  4. Path (optional)
  5. Domain (optional)
access public
since 2.8.0

Parameters

$data

stringarray

Raw cookie data.

Retrieve cookie header for usage in the rest of the WordPress HTTP API.

getFullHeader() : string
access public
since 2.8.0

Returns

string

Convert cookie name and value back to header string.

getHeaderValue() : string
access public
since 2.8.0

Returns

stringHeader encoded cookie name and value.

Confirms that it's OK to send this cookie to the URL checked against.

test(string $url) : boolean

Decision is based on RFC 2109/2965, so look there for details on validity.

access public
since 2.8.0

Parameters

$url

string

URL you intend to send this cookie to

Returns

booleanTRUE if allowed, FALSE otherwise.

 Properties

 

Cookie Domain.

$domain : string

Default

since 2.8.0
 

When the cookie expires.

$expires : string

Default

since 2.8.0
 

Cookie name.

$name : string

Default

since 2.8.0
 

Cookie URL path.

$path : string

Default

since 2.8.0
 

Cookie value.

$value : string

Default

since 2.8.0