API Documentation

Http/Cookie.php

Includes Classes 
category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Http
subpackage
Cookie
version
$Id: Cookie.php 21020 2010-02-11 17:27:23Z shahar $
Classes
Zend_Http_Cookie

Description

Zend Framework

LICENSE

This source file is subject to the new BSD license that is bundled with this package in the file LICENSE.txt. It is also available through the world-wide-web at this URL: http://framework.zend.com/license/new-bsd If you did not receive a copy of the license and are unable to obtain it through the world-wide-web, please send an email to license@zend.com so we can send you a copy immediately.

Zend_Http_Cookie

category
Zend
copyright
Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
license
http://framework.zend.com/license/new-bsd New BSD License
package
Zend_Http
Properties
$name
$value
$expires
$domain
$path
$secure
$encodeValue
Methods
__construct
getName
getValue
getDomain
getPath
getExpiryTime
isSecure
isExpired
isSessionCookie
match
__toString
fromString
matchCookieDomain
matchCookiePath

Description

Zend_Http_Cookie is a class describing an HTTP cookie and all it's parameters.

Zend_Http_Cookie is a class describing an HTTP cookie and all it's parameters. The class also enables validating whether the cookie should be sent to the server in a specified scenario according to the request URI, the expiry time and whether session cookies should be used or not. Generally speaking cookies should be contained in a Cookiejar object, or instantiated manually and added to an HTTP request.

See http://wp.netscape.com/newsref/std/cookie_spec.html for some specs.

Properties

$domain

string $domain = ''

Cookie domain

Details

$domain
string
visibility
protected
default
final
false
static
false

$encodeValue

boolean $encodeValue = ''

Whether the cookie value has been encoded/decoded

Details

$encodeValue
boolean
visibility
protected
default
final
false
static
false

$expires

int $expires = ''

Cookie expiry date

Details

$expires
int
visibility
protected
default
final
false
static
false

$name

string $name = ''

Cookie name

Details

$name
string
visibility
protected
default
final
false
static
false

$path

string $path = ''

Cookie path

Details

$path
string
visibility
protected
default
final
false
static
false

$secure

boolean $secure = ''

Whether the cookie is secure or not

Details

$secure
boolean
visibility
protected
default
final
false
static
false

$value

string $value = ''

Cookie value

Details

$value
string
visibility
protected
default
final
false
static
false

Methods

__construct

__construct( string $name, string $value, string $domain, int $expires = null, string $path = null, bool $secure = false ) :

Cookie object constructor

Arguments
$name
string
$value
string
$domain
string
$expires
int
$path
string
$secure
bool
Details
visibility
public
final
false
static
false
todo
Add validation of each one of the parameters (legal domain, etc.)

__toString

__toString( ) : string

Get the cookie as a string, suitable for sending as a "Cookie" header in an HTTP request

Output
string
Details
visibility
public
final
false
static
false

fromString

fromString( string $cookieStr, Zend_Uri_Http|string $refUri = null, boolean $encodeValue = true ) : Zend_Http_Cookie

Generate a new Cookie object from a cookie string (for example the value of the Set-Cookie HTTP header)

Arguments
$cookieStr
string
$refUri
Zend_Uri_Httpstring
Reference URI for default values (domain, path)
$encodeValue
boolean
Weither or not the cookie's value should be passed through urlencode/urldecode
Output
Zend_Http_Cookie
A new Zend_Http_Cookie object or false on failure.
Details
visibility
public
final
false
static
true

getDomain

getDomain( ) : string

Get cookie domain

Output
string
Details
visibility
public
final
false
static
false

getExpiryTime

getExpiryTime( ) : int|null

Get the expiry time of the cookie, or null if no expiry time is set

Output
int|null
Details
visibility
public
final
false
static
false

getName

getName( ) : string

Get Cookie name

Output
string
Details
visibility
public
final
false
static
false

getPath

getPath( ) : string

Get the cookie path

Output
string
Details
visibility
public
final
false
static
false

getValue

getValue( ) : string

Get cookie value

Output
string
Details
visibility
public
final
false
static
false

isExpired

isExpired( int $now = null ) : boolean

Check whether the cookie has expired

Always returns false if the cookie is a session cookie (has no expiry time)

Arguments
$now
int
Timestamp to consider as "now"
Output
boolean
Details
visibility
public
final
false
static
false

isSecure

isSecure( ) : boolean

Check whether the cookie should only be sent over secure connections

Output
boolean
Details
visibility
public
final
false
static
false

isSessionCookie

isSessionCookie( ) : boolean

Check whether the cookie is a session cookie (has no expiry time set)

Output
boolean
Details
visibility
public
final
false
static
false

match

match( string|Zend_Uri_Http $uri, boolean $matchSessionCookies = true, int $now = null ) : boolean

Checks whether the cookie should be sent or not in a specific scenario

Arguments
$uri
stringZend_Uri_Http
URI to check against (secure, domain, path)
$matchSessionCookies
boolean
Whether to send session cookies
$now
int
Override the current time when checking for expiry time
Output
boolean
Details
visibility
public
final
false
static
false

matchCookieDomain

matchCookieDomain( string $cookieDomain, string $host ) : boolean

Check if a cookie's domain matches a host name.

Used by Zend_Http_Cookie and Zend_Http_CookieJar for cookie matching

Arguments
$cookieDomain
string
$host
string
Output
boolean
Details
visibility
public
final
false
static
true

matchCookiePath

matchCookiePath( string $cookiePath, string $path ) : boolean

Check if a cookie's path matches a URL path

Used by Zend_Http_Cookie and Zend_Http_CookieJar for cookie matching

Arguments
$cookiePath
string
$path
string
Output
boolean
Details
visibility
public
final
false
static
true
Documentation was generated by DocBlox.