filter_update_7001

Versions
7
filter_update_7001()

Break out "escape HTML filter" option to its own filter.

Related topics

Code

modules/filter/filter.install, line 126

<?php
function filter_update_7001() {
  $result = db_query("SELECT format FROM {filter_formats}")->fetchCol();
  $insert = db_insert('filters')->fields(array('format', 'module', 'delta', 'weight'));

  foreach ($result as $format_id) {
    // Deprecated constants FILTER_HTML_STRIP = 1 and FILTER_HTML_ESCAPE = 2.
    if (variable_get('filter_html_' . $format_id, 1) == 2) {
      $insert->values(array(
        'format' => $format_id,
        'filter' => 'filter',
        'delta' => 4,
        'weight' => 0,
      ));
    }
    variable_del('filter_html_' . $format_id);
  }

  $insert->execute();
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.