PHP Class common\Cookie

Inheritance: extends SpoonCookie
Mostrar archivo Open project: forkcms/forkcms Class Usage Examples

Public Methods

Method Description
delete ( ) Deletes one or more cookies.
hasAllowedCookies ( ) : boolean Has the visitor allowed cookies?
hasHiddenCookieBar ( ) : boolean Has the cookiebar been hidden by the visitor
set ( string $key, mixed $value, integer $time = 2592000, string $path = '/', string $domain = null, boolean $secure = null, boolean $httpOnly = true ) : boolean Stores a value in a cookie, by default the cookie will expire in one day.

Method Details

delete() public static method

This overwrites the spoon cookie method and adds the same functionality as in the set method to automatically set the domain.
public static delete ( )

hasAllowedCookies() public static method

Has the visitor allowed cookies?
public static hasAllowedCookies ( ) : boolean
return boolean

hasHiddenCookieBar() public static method

Has the cookiebar been hidden by the visitor
public static hasHiddenCookieBar ( ) : boolean
return boolean

set() public static method

Stores a value in a cookie, by default the cookie will expire in one day.
public static set ( string $key, mixed $value, integer $time = 2592000, string $path = '/', string $domain = null, boolean $secure = null, boolean $httpOnly = true ) : boolean
$key string A name for the cookie.
$value mixed The value to be stored. Keep in mind that they will be serialized.
$time integer The number of seconds that this cookie will be available, 30 days is the default.
$path string The path on the server in which the cookie will be available. Use / for the entire domain, /foo if you just want it to be available in /foo.
$domain string The domain that the cookie is available on. Use .example.com to make it available on all subdomains of example.com.
$secure boolean Should the cookie be transmitted over a HTTPS-connection? If true, make sure you use a secure connection, otherwise the cookie won't be set.
$httpOnly boolean Should the cookie only be available through HTTP-protocol? If true, the cookie can't be accessed by Javascript, ...
return boolean If set with success, returns true otherwise false.