You are here

function _htmlpurifier_load in HTML Purifier 6

Same name and namespace in other branches
  1. 5 htmlpurifier.module \_htmlpurifier_load()
  2. 6.2 htmlpurifier.module \_htmlpurifier_load()
  3. 7 htmlpurifier.module \_htmlpurifier_load()

Loads the HTML Purifier library, and performs global initialization.

3 calls to _htmlpurifier_load()
htmlpurifier_init in ./htmlpurifier.module
Implementation of hook_init(). @note Displays any need to update the HTML Purifier library.
_htmlpurifier_process in ./htmlpurifier.module
Processes HTML according to a format and returns purified HTML. Makes a cache pass if possible.
_htmlpurifier_settings in ./htmlpurifier.module
Generates a settings form for configuring HTML Purifier.

File

./htmlpurifier.module, line 156
Implements HTML Purifier as a Drupal filter.

Code

function _htmlpurifier_load() {
  if (class_exists('HTMLPurifier')) {
    return;
  }
  $module_path = drupal_get_path('module', 'htmlpurifier');
  require_once "{$module_path}/library/HTMLPurifier.auto.php";
  require_once "{$module_path}/HTMLPurifier_DefinitionCache_Drupal.php";
  $factory = HTMLPurifier_DefinitionCacheFactory::instance();
  $factory
    ->register('Drupal', 'HTMLPurifier_DefinitionCache_Drupal');

  // Register the version as a variable:
  if (!defined('HTMLPurifier::VERSION')) {
    $purifier = new HTMLPurifier();
    $version = $purifier->version;
  }
  else {
    $version = HTMLPurifier::VERSION;
  }
  variable_set('htmlpurifier_version_ours', $version);
}