You are here

function _htmlpurifier_load in HTML Purifier 5

Same name and namespace in other branches
  1. 6.2 htmlpurifier.module \_htmlpurifier_load()
  2. 6 htmlpurifier.module \_htmlpurifier_load()
  3. 7 htmlpurifier.module \_htmlpurifier_load()
1 call to _htmlpurifier_load()
htmlpurifier_filter in ./htmlpurifier.module
Implementation of hook_filter().

File

./htmlpurifier.module, line 58

Code

function _htmlpurifier_load() {

  // Load HTML Purifier library
  $module_path = drupal_get_path('module', 'htmlpurifier');
  require_once "{$module_path}/library/HTMLPurifier.auto.php";

  // Overload HTML Purifiers default cache handler with our own so that
  // Drupals built-in cache is used
  require_once "{$module_path}/HTMLPurifier_DefinitionCache_Drupal.php";

  // This will complain under E_STRICT with 3.1.0+, but really don't care.
  $factory =& HTMLPurifier_DefinitionCacheFactory::instance();
  if (method_exists($factory, 'register')) {
    $factory
      ->register('Drupal', 'HTMLPurifier_DefinitionCache_Drupal');
  }
  else {

    // Brittle, used for previous HTML Purifier version compatibility
    $factory->caches['Drupal']['HTML'] = new HTMLPurifier_DefinitionCache_Drupal('HTML');
    $factory->caches['Drupal']['CSS'] = new HTMLPurifier_DefinitionCache_Drupal('CSS');
    $factory->caches['Drupal']['URI'] = new HTMLPurifier_DefinitionCache_Drupal('URI');
  }
}