Provides a consistent cookie API, HTTPOnly compatibility with older PHP versions and default parameters
1.0.0b3 | Added the delete() method 9/30/09 |
---|---|
1.0.0b2 | Updated for new fCore API 2/16/09 |
1.0.0b | The initial implementation 9/1/08 |
Deletes a cookie - uses default parameters set by the other set methods of this class
void delete( string $name, string $path=NULL, string $domain=NULL, boolean $secure=NULL )
string | $name | The cookie name to delete |
string | $path | The path of the cookie to delete |
string | $domain | The domain of the cookie to delete |
boolean | $secure | If the cookie is a secure-only cookie |
Gets a cookie value from $_COOKIE, while allowing a default value to be provided
mixed get( string $name, mixed $default_value=NULL )
string | $name | The name of the cookie to retrieve |
mixed | $default_value | If there is no cookie with the name provided, return this value instead |
The value
Please note: this method is public, however it is primarily intended for internal use by Flourish and will normally not be useful in site/application code
Resets the configuration of the class
void reset( )
Sets a cookie to be sent back to the browser - uses default parameters set by the other set methods of this class
The following methods allow for setting default parameters for this method:
void set( string $name, mixed $value, string|integer $expires=NULL, string $path=NULL, string $domain=NULL, boolean $secure=NULL, boolean $httponly=NULL )
string | $name | The name of the cookie to set |
mixed | $value | The value of the cookie to set |
string|integer | $expires | A relative string to be interpreted by strtotime() or an integer unix timestamp |
string | $path | The path this cookie applies to |
string | $domain | The domain this cookie applies to |
boolean | $secure | If the cookie should only be transmitted over a secure connection |
boolean | $httponly | If the cookie should only be readable by HTTP connection, not javascript |
Sets the default domain to use for cookies
This value will be used when the $domain parameter of the set() method is not specified or is set to NULL.
void setDefaultDomain( string $domain )
string | $domain | The default domain to use for cookies |
Sets the default expiration date to use for cookies
This value will be used when the $expires parameter of the set() method is not specified or is set to NULL.
void setDefaultExpires( string|integer $expires )
string|integer | $expires | The default expiration date to use for cookies |
Sets the default httponly flag to use for cookies
This value will be used when the $httponly parameter of the set() method is not specified or is set to NULL.
void setDefaultHTTPOnly( boolean $httponly )
boolean | $httponly | The default httponly flag to use for cookies |
Sets the default path to use for cookies
This value will be used when the $path parameter of the set() method is not specified or is set to NULL.
void setDefaultPath( string $path )
string | $path | The default path to use for cookies |
Sets the default secure flag to use for cookies
This value will be used when the $secure parameter of the set() method is not specified or is set to NULL.
void setDefaultSecure( boolean $secure )
boolean | $secure | The default secure flag to use for cookies |