1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-07-30 19:00:10 +02:00

Convert to PHP 5 only codebase, adding visibility modifiers to all members and methods in the main library area (function only for test methods)

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1458 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2007-11-25 02:24:39 +00:00
parent 85a23bacb6
commit 43f01925cd
195 changed files with 1003 additions and 1064 deletions

View File

@@ -10,25 +10,21 @@ require_once 'HTMLPurifier/DefinitionCache/Decorator/Cleanup.php';
/**
* Abstract class representing Definition cache managers that implements
* useful common methods and is a factory.
* @todo Get some sort of versioning variable so the library can easily
* invalidate the cache with a new version
* @todo Make the test runner cache aware and allow the user to easily
* flush the cache
* @todo Create a separate maintenance file advanced users can use to
* cache their custom HTMLDefinition, which can be loaded
* via a configuration directive
* @todo Implement memcached
*/
class HTMLPurifier_DefinitionCache
abstract class HTMLPurifier_DefinitionCache
{
var $type;
public $type;
/**
* @param $name Type of definition objects this instance of the
* cache will handle.
*/
function HTMLPurifier_DefinitionCache($type) {
public function HTMLPurifier_DefinitionCache($type) {
$this->type = $type;
}
@@ -36,7 +32,7 @@ class HTMLPurifier_DefinitionCache
* Generates a unique identifier for a particular configuration
* @param Instance of HTMLPurifier_Config
*/
function generateKey($config) {
public function generateKey($config) {
return $config->version . '-' . // possibly replace with function calls
$config->getBatchSerial($this->type) . '-' .
$config->get($this->type, 'DefinitionRev');
@@ -48,7 +44,7 @@ class HTMLPurifier_DefinitionCache
* @param $key Key to test
* @param $config Instance of HTMLPurifier_Config to test against
*/
function isOld($key, $config) {
public function isOld($key, $config) {
if (substr_count($key, '-') < 2) return true;
list($version, $hash, $revision) = explode('-', $key, 3);
$compare = version_compare($version, $config->version);
@@ -68,7 +64,7 @@ class HTMLPurifier_DefinitionCache
* @param $def Definition object to check
* @return Boolean true if good, false if not
*/
function checkDefType($def) {
public function checkDefType($def) {
if ($def->type !== $this->type) {
trigger_error("Cannot use definition of type {$def->type} in cache for {$this->type}");
return false;
@@ -79,50 +75,37 @@ class HTMLPurifier_DefinitionCache
/**
* Adds a definition object to the cache
*/
function add($def, $config) {
trigger_error('Cannot call abstract method', E_USER_ERROR);
}
abstract public function add($def, $config);
/**
* Unconditionally saves a definition object to the cache
*/
function set($def, $config) {
trigger_error('Cannot call abstract method', E_USER_ERROR);
}
abstract public function set($def, $config);
/**
* Replace an object in the cache
*/
function replace($def, $config) {
trigger_error('Cannot call abstract method', E_USER_ERROR);
}
abstract public function replace($def, $config);
/**
* Retrieves a definition object from the cache
*/
function get($config) {
trigger_error('Cannot call abstract method', E_USER_ERROR);
}
abstract public function get($config);
/**
* Removes a definition object to the cache
*/
function remove($config) {
trigger_error('Cannot call abstract method', E_USER_ERROR);
}
abstract public function remove($config);
/**
* Clears all objects from cache
*/
function flush($config) {
trigger_error('Cannot call abstract method', E_USER_ERROR);
}
abstract public function flush($config);
/**
* Clears all expired (older version or revision) objects from cache
*/
function cleanup($config) {
trigger_error('Cannot call abstract method', E_USER_ERROR);
}
abstract public function cleanup($config);
}