Moodle  2.2.1
http://www.collinsharper.com
Zend_Http_CookieJar Class Reference

Public Member Functions

 __construct ()
 addCookie ($cookie, $ref_uri=null)
 addCookiesFromResponse ($response, $ref_uri)
 getAllCookies ($ret_as=self::COOKIE_OBJECT)
 getMatchingCookies ($uri, $matchSessionCookies=true, $ret_as=self::COOKIE_OBJECT, $now=null)
 getCookie ($uri, $cookie_name, $ret_as=self::COOKIE_OBJECT)
 count ()
 getIterator ()
 isEmpty ()
 reset ()

Static Public Member Functions

static fromResponse (Zend_Http_Response $response, $ref_uri)

Data Fields

const COOKIE_OBJECT = 0
const COOKIE_STRING_ARRAY = 1
const COOKIE_STRING_CONCAT = 2

Protected Member Functions

 _flattenCookiesArray ($ptr, $ret_as=self::COOKIE_OBJECT)
 _matchDomain ($domain)
 _matchPath ($domains, $path)

Protected Attributes

 $cookies = array()
 $_rawCookies = array()

Detailed Description

Definition at line 60 of file CookieJar.php.


Constructor & Destructor Documentation

Construct a new CookieJar object

Definition at line 110 of file CookieJar.php.


Member Function Documentation

_flattenCookiesArray ( ptr,
ret_as = self::COOKIE_OBJECT 
) [protected]

Helper function to recursivly flatten an array. Shoud be used when exporting the cookies array (or parts of it)

Parameters:
Zend_Http_Cookie | array$ptr
int$ret_asWhat value to return
Returns:
array|string

Definition at line 269 of file CookieJar.php.

Here is the caller graph for this function:

_matchDomain ( domain) [protected]

Return a subset of the cookies array matching a specific domain

Parameters:
string$domain
Returns:
array

Definition at line 306 of file CookieJar.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_matchPath ( domains,
path 
) [protected]

Return a subset of a domain-matching cookies that also match a specified path

Parameters:
array$dom_array
string$path
Returns:
array

Definition at line 326 of file CookieJar.php.

Here is the call graph for this function:

Here is the caller graph for this function:

addCookie ( cookie,
ref_uri = null 
)

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.

Parameters:
Zend_Http_Cookie | string$cookie
Zend_Uri_Http | string$ref_uriOptional reference URI (for domain, path, secure)

Definition at line 120 of file CookieJar.php.

Here is the call graph for this function:

Here is the caller graph for this function:

addCookiesFromResponse ( response,
ref_uri 
)

Parse an HTTP response, adding all the cookies set in that response to the cookie jar.

Parameters:
Zend_Http_Response$response
Zend_Uri_Http | string$ref_uriRequested URI

Definition at line 146 of file CookieJar.php.

Here is the call graph for this function:

count ( )

Required by Countable interface

Returns:
int

Definition at line 368 of file CookieJar.php.

Here is the caller graph for this function:

static fromResponse ( Zend_Http_Response response,
ref_uri 
) [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.

Parameters:
Zend_Http_Response$responseHTTP Response object
Zend_Uri_Http | string$uriThe requested URI
Returns:
Zend_Http_CookieJar
Todo:
Add the $uri functionality.

Definition at line 356 of file CookieJar.php.

getAllCookies ( ret_as = self::COOKIE_OBJECT)

Get all cookies in the cookie jar as an array

Parameters:
int$ret_asWhether to return cookies as objects of Zend_Http_Cookie or as strings
Returns:
array|string

Definition at line 171 of file CookieJar.php.

Here is the call graph for this function:

getCookie ( uri,
cookie_name,
ret_as = self::COOKIE_OBJECT 
)

Get a specific cookie according to a URI and name

Parameters:
Zend_Uri_Http | string$uriThe uri (domain and path) to match
string$cookie_nameThe cookie's name
int$ret_asWhether to return cookies as objects of Zend_Http_Cookie or as strings
Returns:
Zend_Http_Cookie|string

Definition at line 222 of file CookieJar.php.

Here is the call graph for this function:

Required by IteratorAggregate interface

Returns:
ArrayIterator

Definition at line 378 of file CookieJar.php.

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.

Parameters:
string | Zend_Uri_Http$uriURI to check against (secure, domain, path)
boolean$matchSessionCookiesWhether to send session cookies
int$ret_asWhether to return cookies as objects of Zend_Http_Cookie or as strings
int$nowOverride the current time when checking for expiry time
Returns:
array|string

Definition at line 188 of file CookieJar.php.

Here is the call graph for this function:

isEmpty ( )

Tells if the jar is empty of any cookie

Returns:
bool

Definition at line 388 of file CookieJar.php.

Here is the call graph for this function:

reset ( )

Empties the cookieJar of any cookie

Returns:
Zend_Http_CookieJar

Definition at line 398 of file CookieJar.php.


Field Documentation

$_rawCookies = array() [protected]

Definition at line 104 of file CookieJar.php.

$cookies = array() [protected]

Definition at line 97 of file CookieJar.php.

const COOKIE_OBJECT = 0

Return cookie(s) as a Zend_Http_Cookie object

Definition at line 66 of file CookieJar.php.

Return cookie(s) as a string (suitable for sending in an HTTP request)

Definition at line 72 of file CookieJar.php.

Return all cookies as one long string (suitable for sending in an HTTP request)

Definition at line 78 of file CookieJar.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations