HTMLPurifier_DefinitionCache_Serializer
Abstract class representing Definition cache managers that implements useful common methods and is a factory.
- Full name:
\HTMLPurifier_DefinitionCache_Serializer
- Parent class:
\HTMLPurifier_DefinitionCache
Methods
add
Adds a definition object to the cache
Parameters:
Parameter | Type | Description |
---|---|---|
$def |
\HTMLPurifier_Definition | |
$config |
\HTMLPurifier_Config |
set
Unconditionally saves a definition object to the cache
Parameters:
Parameter | Type | Description |
---|---|---|
$def |
\HTMLPurifier_Definition | |
$config |
\HTMLPurifier_Config |
replace
Replace an object in the cache
Parameters:
Parameter | Type | Description |
---|---|---|
$def |
\HTMLPurifier_Definition | |
$config |
\HTMLPurifier_Config |
get
Retrieves a definition object from the cache
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
remove
Removes a definition object to the cache
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
flush
Clears all objects from cache
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
cleanup
Clears all expired (older version or revision) objects from cache
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
generateFilePath
Generates the file path to the serial file corresponding to the configuration and definition name
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
generateDirectoryPath
Generates the path to the directory contain this cache's serial files
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
generateBaseDirectoryPath
Generates path to base directory that contains all definition type serials
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
_write
Convenience wrapper function for file_put_contents
Parameters:
Parameter | Type | Description |
---|---|---|
$file |
string | File name to write to |
$data |
string | Data to write into file |
$config |
\HTMLPurifier_Config |
Return Value:
Number of bytes written if success, or false if failure.
_prepareDir
Prepares the directory that this type stores the serials in
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
Return Value:
True if successful
_testPermissions
Tests permissions on a directory and throws out friendly error messages and attempts to chmod it itself if possible
Parameters:
Parameter | Type | Description |
---|---|---|
$dir |
string | Directory path |
$chmod |
int | Permissions |
Return Value:
True if directory is writable
Inherited methods
__construct
Parameters:
Parameter | Type | Description |
---|---|---|
$type |
string | Type of definition objects this instance of the cache will handle. |
generateKey
Generates a unique identifier for a particular configuration
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config | Instance of HTMLPurifier_Config |
isOld
Tests whether or not a key is old with respect to the configuration's version and revision number.
Parameters:
Parameter | Type | Description |
---|---|---|
$key |
string | Key to test |
$config |
\HTMLPurifier_Config | Instance of HTMLPurifier_Config to test against |
checkDefType
Checks if a definition's type jives with the cache's type
Parameters:
Parameter | Type | Description |
---|---|---|
$def |
\HTMLPurifier_Definition | Definition object to check |
Return Value:
true if good, false if not
add
Adds a definition object to the cache
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$def |
\HTMLPurifier_Definition | |
$config |
\HTMLPurifier_Config |
set
Unconditionally saves a definition object to the cache
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$def |
\HTMLPurifier_Definition | |
$config |
\HTMLPurifier_Config |
replace
Replace an object in the cache
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$def |
\HTMLPurifier_Definition | |
$config |
\HTMLPurifier_Config |
get
Retrieves a definition object from the cache
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
remove
Removes a definition object to the cache
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
flush
Clears all objects from cache
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
cleanup
Clears all expired (older version or revision) objects from cache
- This method is abstract.
Parameters:
Parameter | Type | Description |
---|---|---|
$config |
\HTMLPurifier_Config |
Automatically generated on 2025-03-18