Moodle  2.2.1
http://www.collinsharper.com
SimpleCookie Class Reference

Public Member Functions

 SimpleCookie ($name, $value=false, $path=false, $expiry=false, $is_secure=false)
 setHost ($host)
 getHost ()
 isValidHost ($host)
 _truncateHost ($host)
 getName ()
 getValue ()
 getPath ()
 isValidPath ($path)
 getExpiry ()
 isExpired ($now)
 agePrematurely ($interval)
 isSecure ()
 _fixPath ($path)

Data Fields

 $_host
 $_name
 $_value
 $_path
 $_expiry
 $_is_secure

Detailed Description

Definition at line 23 of file cookies.php.


Member Function Documentation

_fixPath ( path)

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

Parameters:
string$pathPath to fix. private

Definition at line 211 of file cookies.php.

Here is the caller graph for this function:

_truncateHost ( host)

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

Parameters:
string$hostHost name to truncate.
Returns:
string Domain or false on a bad host. private

Definition at line 98 of file cookies.php.

Here is the call graph for this function:

Here is the caller graph for this function:

agePrematurely ( interval)

Ages the cookie by the specified number of seconds.

Parameters:
integer$intervalIn seconds.

Definition at line 190 of file cookies.php.

getExpiry ( )

Accessor for expiry.

Returns:
string Expiry string. public

Definition at line 156 of file cookies.php.

getHost ( )

Accessor for the truncated host to which this cookie applies.

Returns:
string Truncated hostname. public

Definition at line 77 of file cookies.php.

Here is the caller graph for this function:

getName ( )

Accessor for name.

Returns:
string Cookie key. public

Definition at line 113 of file cookies.php.

getPath ( )

Accessor for path.

Returns:
string Valid cookie path. public

Definition at line 132 of file cookies.php.

Here is the caller graph for this function:

getValue ( )

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

Returns:
string Cookie value. public

Definition at line 123 of file cookies.php.

isExpired ( now)

Test to see if cookie is expired against the cookie format time or timestamp. Will give true for a session cookie.

Parameters:
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. public

Definition at line 174 of file cookies.php.

isSecure ( )

Accessor for the secure flag.

Returns:
boolean True if cookie needs SSL. public

Definition at line 201 of file cookies.php.

isValidHost ( host)

Test for a cookie being valid for a host name.

Parameters:
string$hostHost to test against.
Returns:
boolean True if the cookie would be valid here.

Definition at line 87 of file cookies.php.

Here is the call graph for this function:

isValidPath ( path)

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

Parameters:
string$pathPath to test against.
Returns:
boolean True if cookie valid here. public

Definition at line 144 of file cookies.php.

Here is the call graph for this function:

setHost ( host)

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.

Parameters:
string$hostNew hostname.
Returns:
boolean True if hostname is valid. public

Definition at line 63 of file cookies.php.

Here is the call graph for this function:

SimpleCookie ( name,
value = false,
path = false,
expiry = false,
is_secure = false 
)

Constructor. Sets the stored values.

Parameters:
string$nameCookie key.
string$valueValue of cookie.
string$pathCookie path if not host wide.
string$expiryExpiry date as string.
boolean$is_secureCurrently ignored.

Definition at line 39 of file cookies.php.

Here is the call graph for this function:


Field Documentation

$_expiry

Definition at line 28 of file cookies.php.

$_host

Definition at line 24 of file cookies.php.

$_is_secure

Definition at line 29 of file cookies.php.

$_name

Definition at line 25 of file cookies.php.

$_path

Definition at line 27 of file cookies.php.

$_value

Definition at line 26 of file cookies.php.


The documentation for this class was generated from the following file:
 All Data Structures Namespaces Files Functions Variables Enumerations