Zend Framework
1.12
|
Public Member Functions | |
__construct () | |
Construct a new CookieJar object. | |
addCookie ($cookie, $ref_uri=null, $encodeValue=true) | |
Add a cookie to the jar. | |
addCookiesFromResponse ($response, $ref_uri, $encodeValue=true) | |
Parse an HTTP response, adding all the cookies set in that response to the cookie jar. | |
getAllCookies ($ret_as=self::COOKIE_OBJECT) | |
Get all cookies in the cookie jar as an array. | |
getMatchingCookies ($uri, $matchSessionCookies=true, $ret_as=self::COOKIE_OBJECT, $now=null) | |
Return an array of all cookies matching a specific request according to the request URI, whether session cookies should be sent or not, and the time to consider as "now" when checking cookie expiry time. | |
getCookie ($uri, $cookie_name, $ret_as=self::COOKIE_OBJECT) | |
Get a specific cookie according to a URI and name. | |
count () | |
Required by Countable interface. | |
getIterator () | |
Required by IteratorAggregate interface. | |
isEmpty () | |
Tells if the jar is empty of any cookie. | |
reset () | |
Empties the cookieJar of any cookie. | |
Static Public Member Functions | |
static | fromResponse (Zend_Http_Response $response, $ref_uri) |
Create a new CookieJar object and automatically load into it all the cookies set in an Http_Response object. | |
Public Attributes | |
const | COOKIE_OBJECT = 0 |
Return cookie(s) as a Zend_Http_Cookie object. | |
const | COOKIE_STRING_ARRAY = 1 |
Return cookie(s) as a string (suitable for sending in an HTTP request) | |
const | COOKIE_STRING_CONCAT = 2 |
Return all cookies as one long string (suitable for sending in an HTTP request) | |
const | COOKIE_STRING_CONCAT_STRICT = 3 |
Return all cookies as one long string (strict mode) | |
Protected Member Functions | |
_flattenCookiesArray ($ptr, $ret_as=self::COOKIE_OBJECT) | |
Helper function to recursivly flatten an array. | |
_matchDomain ($domain) | |
Return a subset of the cookies array matching a specific domain. | |
_matchPath ($domains, $path) | |
Return a subset of a domain-matching cookies that also match a specified path. | |
Protected Attributes | |
$cookies = array() | |
$_rawCookies = array() | |
__construct | ( | ) |
Construct a new CookieJar object.
|
protected |
Helper function to recursivly flatten an array.
Shoud be used when exporting the cookies array (or parts of it)
Zend_Http_Cookie | array | $ptr | |
int | $ret_as | What value to return |
|
protected |
Return a subset of the cookies array matching a specific domain.
string | $domain |
|
protected |
Return a subset of a domain-matching cookies that also match a specified path.
array | $dom_array | |
string | $path |
addCookie | ( | $cookie, | |
$ref_uri = null , |
|||
$encodeValue = true |
|||
) |
Add a cookie to the jar.
Cookie should be passed either as a Zend_Http_Cookie object or as a string - in which case an object is created from the string.
Zend_Http_Cookie | string | $cookie | |
Zend_Uri_Http | string | $ref_uri | Optional reference URI (for domain, path, secure) |
boolean | $encodeValue |
addCookiesFromResponse | ( | $response, | |
$ref_uri, | |||
$encodeValue = true |
|||
) |
Parse an HTTP response, adding all the cookies set in that response to the cookie jar.
Zend_Http_Response | $response | |
Zend_Uri_Http | string | $ref_uri | Requested URI |
boolean | $encodeValue |
count | ( | ) |
Required by Countable interface.
|
static |
Create a new CookieJar object and automatically load into it all the cookies set in an Http_Response object.
If $uri is set, it will be considered as the requested URI for setting default domain and path of the cookie.
Zend_Http_Response | $response | HTTP Response object |
Zend_Uri_Http | string | $uri | The requested URI |
getAllCookies | ( | $ret_as = self::COOKIE_OBJECT | ) |
Get all cookies in the cookie jar as an array.
int | $ret_as | Whether to return cookies as objects of Zend_Http_Cookie or as strings |
getCookie | ( | $uri, | |
$cookie_name, | |||
$ret_as = self::COOKIE_OBJECT |
|||
) |
Get a specific cookie according to a URI and name.
Zend_Uri_Http | string | $uri | The uri (domain and path) to match |
string | $cookie_name | The cookie's name |
int | $ret_as | Whether to return cookies as objects of Zend_Http_Cookie or as strings |
getIterator | ( | ) |
Required by IteratorAggregate interface.
getMatchingCookies | ( | $uri, | |
$matchSessionCookies = true , |
|||
$ret_as = self::COOKIE_OBJECT , |
|||
$now = null |
|||
) |
Return an array of all cookies matching a specific request according to the request URI, whether session cookies should be sent or not, and the time to consider as "now" when checking cookie expiry time.
string | Zend_Uri_Http | $uri | URI to check against (secure, domain, path) |
boolean | $matchSessionCookies | Whether to send session cookies |
int | $ret_as | Whether to return cookies as objects of Zend_Http_Cookie or as strings |
int | $now | Override the current time when checking for expiry time |
isEmpty | ( | ) |
Tells if the jar is empty of any cookie.
reset | ( | ) |
Empties the cookieJar of any cookie.
|
protected |
|
protected |
const COOKIE_OBJECT = 0 |
Return cookie(s) as a Zend_Http_Cookie object.
const COOKIE_STRING_ARRAY = 1 |
Return cookie(s) as a string (suitable for sending in an HTTP request)
const COOKIE_STRING_CONCAT = 2 |
Return all cookies as one long string (suitable for sending in an HTTP request)
const COOKIE_STRING_CONCAT_STRICT = 3 |
Return all cookies as one long string (strict mode)