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

Public Member Functions

 SimpleCookieJar ()
 restartSession ($date=false)
 agePrematurely ($interval)
 setCookie ($name, $value, $host=false, $path= '/', $expiry=false)
 _findFirstMatch ($cookie)
 getCookieValue ($host, $path, $name)
 _isMatch ($cookie, $host, $path, $name)
 selectAsPairs ($url)

Data Fields

 $_cookies

Detailed Description

Definition at line 228 of file cookies.php.


Member Function Documentation

_findFirstMatch ( cookie)

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

Parameters:
SimpleCookie$cookieCookie to write into jar.
Returns:
integer Available slot. private

Definition at line 301 of file cookies.php.

Here is the call graph for this function:

Here is the caller graph for this function:

_isMatch ( cookie,
host,
path,
name 
)

Tests cookie for matching against search criteria.

Parameters:
SimpleTest$cookieCookie to test.
string$hostHost must match.
string$pathCookie path must be shorter than this path.
string$nameName must match.
Returns:
boolean True if matched. private

Definition at line 350 of file cookies.php.

Here is the caller graph for this function:

agePrematurely ( interval)

Ages all cookies in the cookie jar.

Parameters:
integer$intervalThe old session is moved into the past by this number of seconds. Cookies now over age will be removed. public

Definition at line 270 of file cookies.php.

getCookieValue ( host,
path,
name 
)

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

Parameters:
string$hostHost to search.
string$pathApplicable path.
string$nameName of cookie to read.
Returns:
string False if not present, else the value as a string. public

Definition at line 326 of file cookies.php.

Here is the call graph for this function:

restartSession ( date = false)

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

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

Definition at line 245 of file cookies.php.

selectAsPairs ( url)

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

Parameters:
SimpleUrl$urlUrl to select by.
Returns:
array Valid name and value pairs. public

Definition at line 370 of file cookies.php.

Here is the call graph for this function:

setCookie ( name,
value,
host = false,
path = '/',
expiry = false 
)

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

Parameters:
string$nameCookie key.
string$valueValue of cookie.
string$hostHost upon which the cookie is valid.
string$pathCookie path if not host wide.
string$expiryExpiry date. public

Definition at line 286 of file cookies.php.

Here is the call graph for this function:

Constructor. Jar starts empty. public

Definition at line 235 of file cookies.php.


Field Documentation

$_cookies

Definition at line 229 of file cookies.php.


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