[ Index ]

PHP Cross Reference of Limb3

title

Body

[close]

/tests_runner/lib/simpletest/ -> cookies.php (summary)

Base include file for SimpleTest

Version: $Id: cookies.php 5999 2007-06-18 13:13:08Z pachanga $
File Size: 380 lines (14 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 2 classes

SimpleCookie:: (14 methods):
  SimpleCookie()
  setHost()
  getHost()
  isValidHost()
  _truncateHost()
  getName()
  getValue()
  getPath()
  isValidPath()
  getExpiry()
  isExpired()
  agePrematurely()
  isSecure()
  _fixPath()

SimpleCookieJar:: (8 methods):
  SimpleCookieJar()
  restartSession()
  agePrematurely()
  setCookie()
  _findFirstMatch()
  getCookieValue()
  _isMatch()
  selectAsPairs()


Class: SimpleCookie  - X-Ref

Cookie data holder. Cookie rules are full of pretty
arbitary stuff. I have used...
http://wp.netscape.com/newsref/std/cookie_spec.html
http://www.cookiecentral.com/faq/

SimpleCookie($name, $value = false, $path = false, $expiry = false, $is_secure = false)   X-Ref
Constructor. Sets the stored values.

param: string $name            Cookie key.
param: string $value           Value of cookie.
param: string $path            Cookie path if not host wide.
param: string $expiry          Expiry date as string.
param: boolean $is_secure      Currently ignored.

setHost($host)   X-Ref
Sets the host. The cookie rules determine
that the first two parts are taken for
certain TLDs and three for others. If the
new host does not match these rules then the
call will fail.

param: string $host       New hostname.
return: boolean           True if hostname is valid.

getHost()   X-Ref
Accessor for the truncated host to which this
cookie applies.

return: string       Truncated hostname.

isValidHost($host)   X-Ref
Test for a cookie being valid for a host name.

param: string $host    Host to test against.
return: boolean        True if the cookie would be valid

_truncateHost($host)   X-Ref
Extracts just the domain part that determines a
cookie's host validity.

param: string $host    Host name to truncate.
return: string        Domain or false on a bad host.

getName()   X-Ref
Accessor for name.

return: string       Cookie key.

getValue()   X-Ref
Accessor for value. A deleted cookie will
have an empty string for this.

return: string       Cookie value.

getPath()   X-Ref
Accessor for path.

return: string       Valid cookie path.

isValidPath($path)   X-Ref
Tests a path to see if the cookie applies
there. The test path must be longer or
equal to the cookie path.

param: string $path       Path to test against.
return: boolean           True if cookie valid here.

getExpiry()   X-Ref
Accessor for expiry.

return: string       Expiry string.

isExpired($now)   X-Ref
Test to see if cookie is expired against
the cookie format time or timestamp.
Will give true for a session cookie.

param: integer/string $now  Time to test against. Result

agePrematurely($interval)   X-Ref
Ages the cookie by the specified number of
seconds.

param: integer $interval   In seconds.

isSecure()   X-Ref
Accessor for the secure flag.

return: boolean       True if cookie needs SSL.

_fixPath($path)   X-Ref
Adds a trailing and leading slash to the path
if missing.

param: string $path            Path to fix.

Class: SimpleCookieJar  - X-Ref

Repository for cookies. This stuff is a
tiny bit browser dependent.

SimpleCookieJar()   X-Ref
Constructor. Jar starts empty.


restartSession($date = false)   X-Ref
Removes expired and temporary cookies as if
the browser was closed and re-opened.

param: string/integer $now   Time to test expiry against.

agePrematurely($interval)   X-Ref
Ages all cookies in the cookie jar.

param: integer $interval     The old session is moved

setCookie($name, $value, $host = false, $path = '/', $expiry = false)   X-Ref
Sets an additional cookie. If a cookie has
the same name and path it is replaced.

param: string $name       Cookie key.
param: string $value      Value of cookie.
param: string $host       Host upon which the cookie is valid.
param: string $path       Cookie path if not host wide.
param: string $expiry     Expiry date.

_findFirstMatch($cookie)   X-Ref
Finds a matching cookie to write over or the
first empty slot if none.

param: SimpleCookie $cookie    Cookie to write into jar.
return: integer                Available slot.

getCookieValue($host, $path, $name)   X-Ref
Reads the most specific cookie value from the
browser cookies. Looks for the longest path that
matches.

param: string $host        Host to search.
param: string $path        Applicable path.
param: string $name        Name of cookie to read.
return: string             False if not present, else the

_isMatch($cookie, $host, $path, $name)   X-Ref
Tests cookie for matching against search
criteria.

param: SimpleTest $cookie    Cookie to test.
param: string $host          Host must match.
param: string $path          Cookie path must be shorter than
param: string $name          Name must match.
return: boolean              True if matched.

selectAsPairs($url)   X-Ref
Uses a URL to sift relevant cookies by host and
path. Results are list of strings of form "name=value".

param: SimpleUrl $url       Url to select by.
return: array               Valid name and value pairs.



Generated: Sat Nov 22 03:48:54 2008 Cross-referenced by PHPXref 0.7