PATH:
home
/
letacommog
/
letaweb
/
admin
/
classes
/
htmlpurifier
/
library
/
HTMLPurifier
<?php /** * Abstract class representing Definition cache managers that implements * useful common methods and is a factory. * * @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 */ abstract class HTMLPurifier_DefinitionCache { public $type; /** * @param $name Type of definition objects this instance of the * cache will handle. */ public function __construct($type) { $this->type = $type; } /** * Generates a unique identifier for a particular configuration. * * @param Instance of HTMLPurifier_Config */ public function generateKey($config) { return $config->version.','.// possibly replace with function calls $config->getBatchSerial($this->type).','. $config->get($this->type.'.DefinitionRev'); } /** * Tests whether or not a key is old with respect to the configuration's * version and revision number. * * @param $key Key to test * @param $config Instance of HTMLPurifier_Config to test against */ 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); // version mismatch, is always old if ($compare != 0) { return true; } // versions match, ids match, check revision number if ( $hash == $config->getBatchSerial($this->type) && $revision < $config->get($this->type.'.DefinitionRev') ) { return true; } return false; } /** * Checks if a definition's type jives with the cache's type. * * @note Throws an error on failure * * @param $def Definition object to check * * @return Boolean true if good, false if not */ 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; } return true; } /** * Adds a definition object to the cache. */ abstract public function add($def, $config); /** * Unconditionally saves a definition object to the cache. */ abstract public function set($def, $config); /** * Replace an object in the cache. */ abstract public function replace($def, $config); /** * Retrieves a definition object from the cache. */ abstract public function get($config); /** * Removes a definition object to the cache. */ abstract public function remove($config); /** * Clears all objects from cache. */ abstract public function flush($config); /** * Clears all expired (older version or revision) objects from cache. * * @note Be carefuly implementing this method as flush. Flush must * not interfere with other Definition types, and cleanup() * should not be repeatedly called by userland code. */ abstract public function cleanup($config); } // vim: et sw=4 sts=4
[+]
..
[+]
ConfigSchema
[-] CSSDefinition.php
[edit]
[-] Generator.php
[edit]
[-] ElementDef.php
[edit]
[-] AttrTypes.php
[edit]
[+]
ChildDef
[+]
AttrDef
[-] ChildDef.php
[edit]
[+]
Printer
[-] Exception.php
[edit]
[-] PercentEncoder.php
[edit]
[+]
Lexer
[-] IDAccumulator.php
[edit]
[-] Token.php
[edit]
[+]
TagTransform
[-] AttrTransform.php
[edit]
[-] Language.php
[edit]
[-] Filter.php
[edit]
[-] Printer.php
[edit]
[-] DefinitionCache.php
[edit]
[-] Injector.php
[edit]
[-] TokenFactory.php
[edit]
[-] URISchemeRegistry.php
[edit]
[-] Length.php
[edit]
[-] URIParser.php
[edit]
[-] AttrCollections.php
[edit]
[-] Lexer.php
[edit]
[-] HTMLDefinition.php
[edit]
[-] Context.php
[edit]
[-] DefinitionCacheFactory.php
[edit]
[-] Doctype.php
[edit]
[+]
Strategy
[-] LanguageFactory.php
[edit]
[+]
Token
[-] TagTransform.php
[edit]
[-] AttrValidator.php
[edit]
[+]
Filter
[-] ErrorCollector.php
[edit]
[-] DoctypeRegistry.php
[edit]
[-] UnitConverter.php
[edit]
[-] EntityParser.php
[edit]
[-] URIScheme.php
[edit]
[-] Bootstrap.php
[edit]
[-] StringHashParser.php
[edit]
[+]
VarParser
[-] VarParserException.php
[edit]
[-] EntityLookup.php
[edit]
[-] ErrorStruct.php
[edit]
[-] HTMLModule.php
[edit]
[-] Definition.php
[edit]
[-] PropertyList.php
[edit]
[+]
URIFilter
[-] Strategy.php
[edit]
[-] AttrDef.php
[edit]
[+]
HTMLModule
[+]
URIScheme
[-] Config.php
[edit]
[-] HTMLModuleManager.php
[edit]
[-] Encoder.php
[edit]
[+]
AttrTransform
[-] URI.php
[edit]
[-] ContentSets.php
[edit]
[-] ConfigSchema.php
[edit]
[+]
EntityLookup
[-] VarParser.php
[edit]
[+]
Language
[-] PropertyListIterator.php
[edit]
[+]
DefinitionCache
[-] StringHash.php
[edit]
[+]
Injector
[-] URIDefinition.php
[edit]
[-] URIFilter.php
[edit]