You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

31 lines
936B

  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. {
  9. global $PHORUM;
  10. $config_exists = phorum_htmlpurifier_config_file_exists();
  11. if ($default || $config_exists || !isset($PHORUM['mod_htmlpurifier']['config'])) {
  12. $config = HTMLPurifier_Config::createDefault();
  13. include(dirname(__FILE__) . '/config.default.php');
  14. if ($config_exists) {
  15. include(dirname(__FILE__) . '/config.php');
  16. }
  17. unset($PHORUM['mod_htmlpurifier']['config']); // unnecessary
  18. } else {
  19. $config = HTMLPurifier_Config::create($PHORUM['mod_htmlpurifier']['config']);
  20. }
  21. return $config;
  22. }
  23. function phorum_htmlpurifier_config_file_exists()
  24. {
  25. return file_exists(dirname(__FILE__) . '/config.php');
  26. }
  27. // vim: et sw=4 sts=4