Class SimpleCookieJar

Description

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

Located in /cookies.php (line 228)


	
			
Method Summary
 SimpleCookieJar __construct ()
 void agePrematurely (integer $interval)
 integer findFirstMatch (SimpleCookie $cookie)
 string getCookieValue (string $host, string $path, string $name)
 boolean isMatch (SimpleTest $cookie, string $host, string $path, string $name)
 void restartSession ([ $date = false], string/integer $now)
 array selectAsPairs (SimpleUrl $url)
 void setCookie (string $name, string $value, [string $host = false], [string $path = '/'], [string $expiry = false])
Methods
Constructor __construct (line 235)

Constructor. Jar starts empty.

  • access: public
SimpleCookieJar __construct ()
agePrematurely (line 270)

Ages all cookies in the cookie jar.

  • access: public
void agePrematurely (integer $interval)
  • integer $interval: The old session is moved into the past by this number of seconds. Cookies now over age will be removed.
findFirstMatch (line 301)

Finds a matching cookie to write over or the first empty slot if none.

  • return: Available slot.
  • access: protected
integer findFirstMatch (SimpleCookie $cookie)
getCookieValue (line 326)

Reads the most specific cookie value from the browser cookies. Looks for the longest path that matches.

  • return: False if not present, else the value as a string.
  • access: public
string getCookieValue (string $host, string $path, string $name)
  • string $host: Host to search.
  • string $path: Applicable path.
  • string $name: Name of cookie to read.
isMatch (line 350)

Tests cookie for matching against search criteria.

  • return: True if matched.
  • access: protected
boolean isMatch (SimpleTest $cookie, string $host, string $path, string $name)
  • SimpleTest $cookie: Cookie to test.
  • string $host: Host must match.
  • string $path: Cookie path must be shorter than this path.
  • string $name: Name must match.
restartSession (line 245)

Removes expired and temporary cookies as if the browser was closed and re-opened.

  • access: public
void restartSession ([ $date = false], string/integer $now)
  • string/integer $now: Time to test expiry against.
  • $date
selectAsPairs (line 370)

Uses a URL to sift relevant cookies by host and path. Results are list of strings of form "name=value".

  • return: Valid name and value pairs.
  • access: public
array selectAsPairs (SimpleUrl $url)
setCookie (line 286)

Sets an additional cookie. If a cookie has the same name and path it is replaced.

  • access: public
void setCookie (string $name, string $value, [string $host = false], [string $path = '/'], [string $expiry = false])
  • string $name: Cookie key.
  • string $value: Value of cookie.
  • string $host: Host upon which the cookie is valid.
  • string $path: Cookie path if not host wide.
  • string $expiry: Expiry date.

Documentation generated on Sun, 31 Oct 2010 16:31:06 -0500 by phpDocumentor 1.4.3