mirror of
https://github.com/ezyang/htmlpurifier.git
synced 2025-08-06 14:16:32 +02:00
[1.7.0] Implement HTMLDefinition cache (very hacked together, but long unit test times were driving me crazy!)
- Add extra protection in AttrDef_URI against phantom Schemes - Doctype moved from config to HTMLDefinition - AttrDef_URITest mocks have more generic object parameters to deal with PHP4's copy-happy behavior git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@1089 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
@@ -53,11 +53,6 @@ class HTMLPurifier_Config
|
||||
*/
|
||||
var $autoFinalize = true;
|
||||
|
||||
/**
|
||||
* Instance of HTMLPurifier_Doctype, representing current doctype
|
||||
*/
|
||||
var $doctype;
|
||||
|
||||
/**
|
||||
* @param $definition HTMLPurifier_ConfigSchema that defines what directives
|
||||
* are allowed.
|
||||
@@ -201,10 +196,17 @@ class HTMLPurifier_Config
|
||||
empty($this->html_definition) || // hasn't ever been setup
|
||||
($raw && $this->html_definition->setup) // requesting new one
|
||||
) {
|
||||
if (!$raw) {
|
||||
$this->html_definition = HTMLPurifier_HTMLDefinition::getCache($this);
|
||||
if ($this->html_definition) return $this->html_definition;
|
||||
}
|
||||
$this->html_definition = new HTMLPurifier_HTMLDefinition($this);
|
||||
if ($raw) return $this->html_definition; // no setup!
|
||||
}
|
||||
if (!$this->html_definition->setup) $this->html_definition->setup();
|
||||
if (!$this->html_definition->setup) {
|
||||
$this->html_definition->setup();
|
||||
$this->html_definition->saveCache($this);
|
||||
}
|
||||
return $this->html_definition;
|
||||
}
|
||||
|
||||
@@ -243,16 +245,6 @@ class HTMLPurifier_Config
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the current doctype object
|
||||
*/
|
||||
function getDoctype() {
|
||||
if (!$this->doctype) {
|
||||
$this->getHTMLDefinition();
|
||||
}
|
||||
return $this->doctype;
|
||||
}
|
||||
|
||||
/**
|
||||
* Loads configuration values from an ini file
|
||||
* @param $filename Name of ini file
|
||||
|
Reference in New Issue
Block a user