init-config.php 936 B

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Initializes the appropriate configuration from either a PHP file
  4. * or a module configuration value
  5. * @return Instance of HTMLPurifier_Config
  6. */
  7. function phorum_htmlpurifier_get_config($default = false) {
  8. global $PHORUM;
  9. $config_exists = phorum_htmlpurifier_config_file_exists();
  10. if ($default || $config_exists || !isset($PHORUM['mod_htmlpurifier']['config'])) {
  11. $config = HTMLPurifier_Config::createDefault();
  12. include(dirname(__FILE__) . '/config.default.php');
  13. if ($config_exists) {
  14. include(dirname(__FILE__) . '/config.php');
  15. }
  16. unset($PHORUM['mod_htmlpurifier']['config']); // unnecessary
  17. } else {
  18. $config = HTMLPurifier_Config::create($PHORUM['mod_htmlpurifier']['config']);
  19. }
  20. return $config;
  21. }
  22. function phorum_htmlpurifier_config_file_exists() {
  23. return file_exists(dirname(__FILE__) . '/config.php');
  24. }
  25. // vim: et sw=4 sts=4