Add lots of documentation.
[htmlpurifier.git] / library / HTMLPurifier / Config.php
blobe27978cd99556dde50682f77ac7157f112f20cb0
1 <?php
3 /**
4 *
5 *
6 * @note Many classes that could (although many times don't) use the
7 * configuration object make it a mandatory parameter. This is
8 * because a configuration object should always be forwarded,
9 * otherwise, you run the risk of missing a parameter and then
10 * being stumped when a configuration directive doesn't work.
12 class HTMLPurifier_Config
15 var $conf;
17 function HTMLPurifier_Config(&$definition) {
18 $this->conf = $definition->info; // set up the defaults
21 function createDefault() {
22 $definition =& HTMLPurifier_ConfigDef::instance();
23 $config = new HTMLPurifier_Config($definition);
24 return $config;
27 function get($namespace, $key) {
28 if (!isset($this->conf[$namespace][$key])) {
29 trigger_error('Cannot retrieve value of undefined directive',
30 E_USER_ERROR);
31 return;
33 return $this->conf[$namespace][$key];
36 function set($namespace, $key, $value) {
37 if (!isset($this->conf[$namespace][$key])) {
38 trigger_error('Cannot set undefined directive to value',
39 E_USER_ERROR);
40 return;
42 $this->conf[$namespace][$key] = $value;