[ Index ]

PHP Cross Reference of moodle-2.8

title

Body

[close]

/lib/zend/Zend/Http/ -> CookieJar.php (summary)

Zend Framework LICENSE

Copyright: Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
License: http://framework.zend.com/license/new-bsd New BSD License
Version: $Id$
File Size: 403 lines (13 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

Zend_Http_CookieJar:: (14 methods):
  __construct()
  addCookie()
  addCookiesFromResponse()
  getAllCookies()
  getMatchingCookies()
  getCookie()
  _flattenCookiesArray()
  _matchDomain()
  _matchPath()
  fromResponse()
  count()
  getIterator()
  isEmpty()
  reset()


Class: Zend_Http_CookieJar  - X-Ref

A Zend_Http_CookieJar object is designed to contain and maintain HTTP cookies, and should
be used along with Zend_Http_Client in order to manage cookies across HTTP requests and
responses.

The class contains an array of Zend_Http_Cookie objects. Cookies can be added to the jar
automatically from a request or manually. Then, the jar can find and return the cookies
needed for a specific HTTP request.

A special parameter can be passed to all methods of this class that return cookies: Cookies
can be returned either in their native form (as Zend_Http_Cookie objects) or as strings -
the later is suitable for sending as the value of the "Cookie" header in an HTTP request.
You can also choose, when returning more than one cookie, whether to get an array of strings
(by passing Zend_Http_CookieJar::COOKIE_STRING_ARRAY) or one unified string for all cookies
(by passing Zend_Http_CookieJar::COOKIE_STRING_CONCAT).

__construct()   X-Ref
Construct a new CookieJar object


addCookie($cookie, $ref_uri = null)   X-Ref
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.

param: Zend_Http_Cookie|string $cookie
param: Zend_Uri_Http|string    $ref_uri Optional reference URI (for domain, path, secure)

addCookiesFromResponse($response, $ref_uri)   X-Ref
Parse an HTTP response, adding all the cookies set in that response
to the cookie jar.

param: Zend_Http_Response $response
param: Zend_Uri_Http|string $ref_uri Requested URI

getAllCookies($ret_as = self::COOKIE_OBJECT)   X-Ref
Get all cookies in the cookie jar as an array

param: int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings
return: array|string

getMatchingCookies($uri, $matchSessionCookies = true,$ret_as = self::COOKIE_OBJECT, $now = null)   X-Ref
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.

param: string|Zend_Uri_Http $uri URI to check against (secure, domain, path)
param: boolean $matchSessionCookies Whether to send session cookies
param: int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings
param: int $now Override the current time when checking for expiry time
return: array|string

getCookie($uri, $cookie_name, $ret_as = self::COOKIE_OBJECT)   X-Ref
Get a specific cookie according to a URI and name

param: Zend_Uri_Http|string $uri The uri (domain and path) to match
param: string $cookie_name The cookie's name
param: int $ret_as Whether to return cookies as objects of Zend_Http_Cookie or as strings
return: Zend_Http_Cookie|string

_flattenCookiesArray($ptr, $ret_as = self::COOKIE_OBJECT)   X-Ref
Helper function to recursivly flatten an array. Shoud be used when exporting the
cookies array (or parts of it)

param: Zend_Http_Cookie|array $ptr
param: int $ret_as What value to return
return: array|string

_matchDomain($domain)   X-Ref
Return a subset of the cookies array matching a specific domain

param: string $domain
return: array

_matchPath($domains, $path)   X-Ref
Return a subset of a domain-matching cookies that also match a specified path

param: array $dom_array
param: string $path
return: array

fromResponse(Zend_Http_Response $response, $ref_uri)   X-Ref
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.

param: Zend_Http_Response $response HTTP Response object
param: Zend_Uri_Http|string $uri The requested URI
return: Zend_Http_CookieJar

count()   X-Ref
Required by Countable interface

return: int

getIterator()   X-Ref
Required by IteratorAggregate interface

return: ArrayIterator

isEmpty()   X-Ref
Tells if the jar is empty of any cookie

return: bool

reset()   X-Ref
Empties the cookieJar of any cookie

return: Zend_Http_CookieJar



Generated: Fri Nov 28 20:29:05 2014 Cross-referenced by PHPXref 0.7.1