1
0
mirror of https://github.com/ezyang/htmlpurifier.git synced 2025-08-05 05:37:49 +02:00

De-singleton-ized (HTML|CSS)Definition, tying them to the configuration and making them more amenable to changes.

git-svn-id: http://htmlpurifier.org/svnroot/htmlpurifier/trunk@350 48356398-32a2-884e-a903-53898d9a118a
This commit is contained in:
Edward Z. Yang
2006-08-31 20:33:07 +00:00
parent 90279eaee2
commit 14aeafcf22
17 changed files with 88 additions and 110 deletions

View File

@@ -25,6 +25,16 @@ class HTMLPurifier_Config
*/
var $def;
/**
* Instance of HTMLPurifier_HTMLDefinition
*/
var $html_definition;
/**
* Instance of HTMLPurifier_CSSDefinition
*/
var $css_definition;
/**
* @param $definition HTMLPurifier_ConfigDef that defines what directives
* are allowed.
@@ -92,6 +102,28 @@ class HTMLPurifier_Config
$this->conf[$namespace][$key] = $value;
}
/**
* Retrieves a copy of the HTML definition.
*/
function getHTMLDefinition() {
if ($this->html_definition === null) {
$this->html_definition = new HTMLPurifier_HTMLDefinition();
$this->html_definition->setup($this);
}
return $this->html_definition;
}
/**
* Retrieves a copy of the CSS definition
*/
function getCSSDefinition() {
if ($this->css_definition === null) {
$this->css_definition = new HTMLPurifier_CSSDefinition();
$this->css_definition->setup($this);
}
return $this->css_definition;
}
}
?>