Class SimpleCookie

Description

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/

Located in /cookies.php (line 23)


	
			
Method Summary
 SimpleCookie __construct (string $name, [string $value = false], [string $path = false], [string $expiry = false], [boolean $is_secure = false])
 void agePrematurely (integer $interval)
 void fixPath (string $path)
 string getExpiry ()
 string getHost ()
 string getName ()
 string getPath ()
 string getValue ()
 void isExpired (integer/string $now)
 boolean isSecure ()
 boolean isValidHost (string $host)
 boolean isValidPath (string $path)
 boolean setHost (string $host)
 string truncateHost (string $host)
Methods
Constructor __construct (line 39)

Constructor. Sets the stored values.

SimpleCookie __construct (string $name, [string $value = false], [string $path = false], [string $expiry = false], [boolean $is_secure = false])
  • string $name: Cookie key.
  • string $value: Value of cookie.
  • string $path: Cookie path if not host wide.
  • string $expiry: Expiry date as string.
  • boolean $is_secure: Currently ignored.
agePrematurely (line 190)

Ages the cookie by the specified number of seconds.

  • public:
void agePrematurely (integer $interval)
  • integer $interval: In seconds.
fixPath (line 211)

Adds a trailing and leading slash to the path if missing.

  • access: protected
void fixPath (string $path)
  • string $path: Path to fix.
getExpiry (line 156)

Accessor for expiry.

  • return: Expiry string.
  • access: public
string getExpiry ()
getHost (line 77)

Accessor for the truncated host to which this cookie applies.

  • return: Truncated hostname.
  • access: public
string getHost ()
getName (line 113)

Accessor for name.

  • return: Cookie key.
  • access: public
string getName ()
getPath (line 132)

Accessor for path.

  • return: Valid cookie path.
  • access: public
string getPath ()
getValue (line 123)

Accessor for value. A deleted cookie will have an empty string for this.

  • return: Cookie value.
  • access: public
string getValue ()
isExpired (line 174)

Test to see if cookie is expired against the cookie format time or timestamp.

Will give true for a session cookie.

  • access: public
void isExpired (integer/string $now)
  • integer/string $now: Time to test against. Result will be false if this time is later than the cookie expiry. Can be either a timestamp integer or a cookie format date.
isSecure (line 201)

Accessor for the secure flag.

  • return: True if cookie needs SSL.
  • access: public
boolean isSecure ()
isValidHost (line 87)

Test for a cookie being valid for a host name.

  • return: True if the cookie would be valid here.
boolean isValidHost (string $host)
  • string $host: Host to test against.
isValidPath (line 144)

Tests a path to see if the cookie applies there. The test path must be longer or equal to the cookie path.

  • return: True if cookie valid here.
  • access: public
boolean isValidPath (string $path)
  • string $path: Path to test against.
setHost (line 63)

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.

  • return: True if hostname is valid.
  • access: public
boolean setHost (string $host)
  • string $host: New hostname.
truncateHost (line 98)

Extracts just the domain part that determines a cookie's host validity.

  • return: Domain or false on a bad host.
  • access: protected
string truncateHost (string $host)
  • string $host: Host name to truncate.

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