You are here

function htmlpurifier_update_6200 in HTML Purifier 7

Same name and namespace in other branches
  1. 6.2 htmlpurifier.install \htmlpurifier_update_6200()
  2. 6 htmlpurifier.install \htmlpurifier_update_6200()
  3. 7.2 htmlpurifier.install \htmlpurifier_update_6200()

File

./htmlpurifier.install, line 204
Install, update and uninstall functions for the HTML Purifier module.

Code

function htmlpurifier_update_6200() {

  // Migrate any old-style filter variables to new style.
  $formats = filter_formats();
  foreach ($formats as $format => $info) {
    $filters = filter_list_format($format);
    if (!isset($filters['htmlpurifier/0'])) {
      continue;
    }
    $config_data = array(
      'URI.DisableExternalResources' => variable_get("htmlpurifier_externalresources_{$format}", TRUE),
      'Attr.EnableID' => variable_get("htmlpurifier_enableattrid_{$format}", FALSE),
      'AutoFormat.Linkify' => variable_get("htmlpurifier_linkify_{$format}", TRUE),
      'AutoFormat.AutoParagraph' => variable_get("htmlpurifier_autoparagraph_{$format}", TRUE),
      'Null_HTML.Allowed' => !variable_get("htmlpurifier_allowedhtml_enabled_{$format}", FALSE),
      'HTML.Allowed' => variable_get("htmlpurifier_allowedhtml_{$format}", ''),
      'Filter.YouTube' => variable_get("htmlpurifier_preserveyoutube_{$format}", FALSE),
    );
    if (defined('HTMLPurifier::VERSION') && version_compare(HTMLPurifier::VERSION, '3.1.0-dev', '>=')) {
      $config_data['HTML.ForbiddenElements'] = variable_get("htmlpurifier_forbiddenelements_{$format}", '');
      $config_data['HTML.ForbiddenAttributes'] = variable_get("htmlpurifier_forbiddenattributes_{$format}", '');
    }
    variable_set("htmlpurifier_config_{$format}", $config_data);
  }
  return array();
}