2007-06-29 20:34:19 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Initializes the appropriate configuration from either a PHP file
|
|
|
|
* or a module configuration value
|
|
|
|
* @return Instance of HTMLPurifier_Config
|
|
|
|
*/
|
2009-01-30 22:41:28 +00:00
|
|
|
function phorum_htmlpurifier_get_config($default = false) {
|
2007-06-29 20:34:19 +00:00
|
|
|
global $PHORUM;
|
|
|
|
$config_exists = phorum_htmlpurifier_config_file_exists();
|
2009-01-30 22:41:28 +00:00
|
|
|
if ($default || $config_exists || !isset($PHORUM['mod_htmlpurifier']['config'])) {
|
2007-06-29 20:34:19 +00:00
|
|
|
$config = HTMLPurifier_Config::createDefault();
|
|
|
|
include(dirname(__FILE__) . '/config.default.php');
|
|
|
|
if ($config_exists) {
|
|
|
|
include(dirname(__FILE__) . '/config.php');
|
|
|
|
}
|
|
|
|
unset($PHORUM['mod_htmlpurifier']['config']); // unnecessary
|
|
|
|
} else {
|
|
|
|
$config = HTMLPurifier_Config::create($PHORUM['mod_htmlpurifier']['config']);
|
|
|
|
}
|
|
|
|
return $config;
|
|
|
|
}
|
|
|
|
|
|
|
|
function phorum_htmlpurifier_config_file_exists() {
|
|
|
|
return file_exists(dirname(__FILE__) . '/config.php');
|
|
|
|
}
|
|
|
|
|
2008-12-06 09:24:59 +00:00
|
|
|
// vim: et sw=4 sts=4
|