abstract class FlagCookieStorage in Flag 6.2
Same name and namespace in other branches
- 7.3 includes/flag.cookie_storage.inc \FlagCookieStorage
- 7.2 flag.inc \FlagCookieStorage
Utility class to handle cookies.
Cookies are used to record flaggings for anonymous users on cached pages.
This class contains only two instance methods. Usage example:
$storage = FlagCookieStorage::factory($flag);
$storage
->flag(145);
$storage
->unflag(17);
You may delete all the cookies with <code>FlagCookieStorage::drop()</code>.
Hierarchy
- class \FlagCookieStorage
Expanded class hierarchy of FlagCookieStorage
File
- ./
flag.inc, line 1786 - Implements various flags. Uses object oriented style inspired by that of Views 2.
View source
abstract class FlagCookieStorage {
/**
* Returns the actual storage object compatible with the flag.
*/
static function factory($flag) {
if ($flag->global) {
return new FlagGlobalCookieStorage($flag);
}
else {
return new FlagNonGlobalCookieStorage($flag);
}
}
function __construct($flag) {
$this->flag = $flag;
}
/**
* "Flags" an item.
*
* It just records this fact in a cookie.
*/
abstract function flag($content_id);
/**
* "Unflags" an item.
*
* It just records this fact in a cookie.
*/
abstract function unflag($content_id);
/**
* Deletes all the cookies.
*
* (Etymology: "drop" as in "drop database".)
*/
static function drop() {
FlagGlobalCookieStorage::drop();
FlagNonGlobalCookieStorage::drop();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FlagCookieStorage:: |
static | function | Deletes all the cookies. | 2 |
FlagCookieStorage:: |
static | function | Returns the actual storage object compatible with the flag. | |
FlagCookieStorage:: |
abstract | function | "Flags" an item. | 2 |
FlagCookieStorage:: |
abstract | function | "Unflags" an item. | 2 |
FlagCookieStorage:: |
function | 1 |