mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-18 02:39:56 +09:00
HTMLPurifier update
약간 커스텀 된 부분 모두 반영. File lock 부분과 htmlspecialchars 부분.
This commit is contained in:
parent
ae7cbf51c0
commit
2957f8cebe
242 changed files with 11737 additions and 5915 deletions
|
|
@ -5,22 +5,36 @@
|
|||
*/
|
||||
class HTMLPurifier_DefinitionCacheFactory
|
||||
{
|
||||
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
protected $caches = array('Serializer' => array());
|
||||
|
||||
/**
|
||||
* @type array
|
||||
*/
|
||||
protected $implementations = array();
|
||||
|
||||
/**
|
||||
* @type HTMLPurifier_DefinitionCache_Decorator[]
|
||||
*/
|
||||
protected $decorators = array();
|
||||
|
||||
/**
|
||||
* Initialize default decorators
|
||||
*/
|
||||
public function setup() {
|
||||
public function setup()
|
||||
{
|
||||
$this->addDecorator('Cleanup');
|
||||
}
|
||||
|
||||
/**
|
||||
* Retrieves an instance of global definition cache factory.
|
||||
* @param HTMLPurifier_DefinitionCacheFactory $prototype
|
||||
* @return HTMLPurifier_DefinitionCacheFactory
|
||||
*/
|
||||
public static function instance($prototype = null) {
|
||||
public static function instance($prototype = null)
|
||||
{
|
||||
static $instance;
|
||||
if ($prototype !== null) {
|
||||
$instance = $prototype;
|
||||
|
|
@ -33,19 +47,22 @@ class HTMLPurifier_DefinitionCacheFactory
|
|||
|
||||
/**
|
||||
* Registers a new definition cache object
|
||||
* @param $short Short name of cache object, for reference
|
||||
* @param $long Full class name of cache object, for construction
|
||||
* @param string $short Short name of cache object, for reference
|
||||
* @param string $long Full class name of cache object, for construction
|
||||
*/
|
||||
public function register($short, $long) {
|
||||
public function register($short, $long)
|
||||
{
|
||||
$this->implementations[$short] = $long;
|
||||
}
|
||||
|
||||
/**
|
||||
* Factory method that creates a cache object based on configuration
|
||||
* @param $name Name of definitions handled by cache
|
||||
* @param $config Instance of HTMLPurifier_Config
|
||||
* @param string $type Name of definitions handled by cache
|
||||
* @param HTMLPurifier_Config $config Config instance
|
||||
* @return mixed
|
||||
*/
|
||||
public function create($type, $config) {
|
||||
public function create($type, $config)
|
||||
{
|
||||
$method = $config->get('Cache.DefinitionImpl');
|
||||
if ($method === null) {
|
||||
return new HTMLPurifier_DefinitionCache_Null($type);
|
||||
|
|
@ -53,10 +70,8 @@ class HTMLPurifier_DefinitionCacheFactory
|
|||
if (!empty($this->caches[$method][$type])) {
|
||||
return $this->caches[$method][$type];
|
||||
}
|
||||
if (
|
||||
isset($this->implementations[$method]) &&
|
||||
class_exists($class = $this->implementations[$method], false)
|
||||
) {
|
||||
if (isset($this->implementations[$method]) &&
|
||||
class_exists($class = $this->implementations[$method], false)) {
|
||||
$cache = new $class($type);
|
||||
} else {
|
||||
if ($method != 'Serializer') {
|
||||
|
|
@ -76,16 +91,16 @@ class HTMLPurifier_DefinitionCacheFactory
|
|||
|
||||
/**
|
||||
* Registers a decorator to add to all new cache objects
|
||||
* @param
|
||||
* @param HTMLPurifier_DefinitionCache_Decorator|string $decorator An instance or the name of a decorator
|
||||
*/
|
||||
public function addDecorator($decorator) {
|
||||
public function addDecorator($decorator)
|
||||
{
|
||||
if (is_string($decorator)) {
|
||||
$class = "HTMLPurifier_DefinitionCache_Decorator_$decorator";
|
||||
$decorator = new $class;
|
||||
}
|
||||
$this->decorators[$decorator->name] = $decorator;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// vim: et sw=4 sts=4
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue