Index: modules/php/php.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/php/php.install,v
retrieving revision 1.10
diff -u -r1.10 php.install
--- modules/php/php.install	21 Aug 2009 17:28:26 -0000	1.10
+++ modules/php/php.install	26 Aug 2009 18:20:53 -0000
@@ -15,26 +15,15 @@
   // first install (or if the format has been manually deleted) as there is no
   // reliable method to identify the format in an uninstall hook or in
   // subsequent clean installs.
-  if (!$format_exists) {
-    $format = db_insert('filter_format')
-      ->fields(array(
-        'name' => 'PHP code',
-        'roles' => '',
-        'cache' => 0,
-      ))
-      ->execute();
 
-    // Enable the PHP evaluator filter.
-    db_insert('filter')
-      ->fields(array(
-        'format' => $format,
-        'module' => 'php',
-        'name' => 'php_code',
-        'weight' => 0,
-      ))
-      ->execute();
+  if (!$format_exists) {
+    $php_format = new stdClass();
+    $php_format->name = 'PHP code';
+    $php_format->roles = array();
+    $php_format->filters = array('php_code' => 1);
+    filter_format_save($php_format);
 
-    drupal_set_message(t('A !php-code text format has been created.', array('!php-code' => l('PHP code', 'admin/settings/formats/' . $format))));
+    drupal_set_message(t('A !php-code text format has been created.', array('!php-code' => l('PHP code', 'admin/settings/formats/' . $php_format->format))));
   }
 }
 
Index: modules/php/php.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/php/php.test,v
retrieving revision 1.15
diff -u -r1.15 php.test
--- modules/php/php.test	22 Aug 2009 00:58:54 -0000	1.15
+++ modules/php/php.test	26 Aug 2009 18:20:55 -0000
@@ -5,6 +5,8 @@
  * Base PHP test case class.
  */
 class PHPTestCase extends DrupalWebTestCase {
+  protected $php_format;
+  
   function setUp() {
     parent::setUp('php');
 
@@ -12,8 +14,9 @@
     $admin_user = $this->drupalCreateUser(array('administer filters'));
     $this->drupalLogin($admin_user);
 
-    // Confirm that the PHP filter is #3.
-    $this->drupalGet('admin/settings/formats/3');
+    // We can not assume PHP format is #3, get the ID.
+    $this->php_format = db_query("SELECT format FROM {filter_format} WHERE name = 'PHP Code'")->fetchField();
+    $this->drupalGet('admin/settings/formats/' . $this->php_format);
     $this->assertText('PHP code', t('On PHP code filter page.'));
   }
 
@@ -45,8 +48,8 @@
   function testPHPFilter() {
     // Setup PHP filter.
     $edit = array();
-    $edit['roles[2]'] = TRUE; // Set authenticated users to have permission to use filter.
-    $this->drupalPost(NULL, $edit, 'Save configuration');
+    $edit['roles[2]'] = 1; // Set authenticated users to have permission to use filter.
+    $this->drupalPost('admin/settings/formats/' . $this->php_format, $edit, 'Save configuration');
     $this->assertText(t('The text format settings have been updated.'), t('PHP format available to authenticated users.'));
 
     // Create node with PHP filter enabled.
@@ -61,7 +64,8 @@
     // Change filter to PHP filter and see that PHP code is evaluated.
     $edit = array();
     $langcode = FIELD_LANGUAGE_NONE;
-    $edit["body[$langcode][0][value_format]"] = 3;
+    $edit["body[$langcode][0][value_format]"] = $this->php_format;
+    
     $this->drupalPost('node/' . $node->nid . '/edit', $edit, t('Save'));
     $this->assertRaw(t('Page %title has been updated.', array('%title' => $node->title)), t('PHP code filter turned on.'));
 
@@ -98,6 +102,6 @@
 
     // Make sure that user doesn't have access to filter.
     $this->drupalGet('node/' . $node->nid . '/edit');
-    $this->assertNoFieldByName('body_format', '3', t('Format not available.'));
+    $this->assertNoFieldByName('body_format', $this->php_format, t('Format not available.'));
   }
 }
Index: modules/php/php.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/php/php.module,v
retrieving revision 1.19
diff -u -r1.19 php.module
--- modules/php/php.module	26 Aug 2009 10:17:54 -0000	1.19
+++ modules/php/php.module	26 Aug 2009 18:20:55 -0000
@@ -79,7 +79,7 @@
 /**
  * Tips callback for php filter.
  */
-function _php_filter_tips($format, $long = FALSE) {
+function _php_filter_tips($filter, $format, $long = FALSE) {
   global $base_url;
   if ($long) {
     $output = '<h4>' . t('Using custom PHP code') . '</h4>';
Index: profiles/default/default.install
===================================================================
RCS file: /cvs/drupal/drupal/profiles/default/default.install,v
retrieving revision 1.1
diff -u -r1.1 default.install
--- profiles/default/default.install	21 Aug 2009 07:50:08 -0000	1.1
+++ profiles/default/default.install	26 Aug 2009 18:21:12 -0000
@@ -213,4 +213,35 @@
     ->execute();
   variable_set('admin_theme', 'seven');
   variable_set('node_admin_theme', '1');
+
+  // Add text formats.
+  $filtered_html = new stdClass();
+  $filtered_html->name = 'Filtered HTML';
+  $filtered_html->roles = array(DRUPAL_ANONYMOUS_RID => 1, DRUPAL_AUTHENTICATED_RID => 1);
+  $filtered_html->filters = array('filter_url' => 1, 'filter_html'  => 1, 'filter_autop'  => 1, 'filter_htmlcorrector'  => 1);
+  $filtered_html->settings = array(
+    'filter_url' => array(
+      'filter_url_length' => 72,
+    ),
+    'filter_html' => array(
+       'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>',
+       'filter_html_help' => 1,
+       'filter_html_nofollow' => 0,
+     ),
+  );
+  filter_format_save($filtered_html);
+
+  $full_html = new stdClass();
+  $full_html->name = 'Full HTML';
+  $full_html->roles = array();
+  $full_html->filters = array('filter_url'  => 1, 'filter_autop'  => 1, 'filter_htmlcorrector'  => 1);
+  $full_html->settings = array(
+    'filter_url' => array(
+      'filter_url_length' => 72,
+    ),
+  );
+  filter_format_save($full_html);
+
+  // Set the default text format to Filtered HTML.
+  variable_set('filter_default_format', $filtered_html->format);
 }
Index: modules/filter/filter.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.install,v
retrieving revision 1.18
diff -u -r1.18 filter.install
--- modules/filter/filter.install	26 Aug 2009 10:17:54 -0000	1.18
+++ modules/filter/filter.install	26 Aug 2009 18:20:37 -0000
@@ -13,11 +13,6 @@
   $schema['filter'] = array(
     'description' => 'Table that maps filters (HTML corrector) to text formats (Filtered HTML).',
     'fields' => array(
-      'fid' => array(
-        'type' => 'serial',
-        'not null' => TRUE,
-        'description' => 'Primary Key: Auto-incrementing filter ID.',
-      ),
       'format' => array(
         'type' => 'int',
         'not null' => TRUE,
@@ -44,9 +39,22 @@
         'default' => 0,
         'size' => 'tiny',
         'description' => 'Weight of filter within format.',
-      )
+      ),
+      'status' => array(
+        'type' => 'int',
+        'not null' => TRUE,
+        'default' => 0,
+        'description' => 'Filter enabled status. (1 = enabled, 0 = disabled)',
+      ),
+      'settings' => array(
+        'type' => 'text',
+        'not null' => FALSE,
+        'size' => 'big',
+        'serialize' => TRUE,
+        'description' => 'A serialized array of name value pairs that store the filter settings for the specific format.',
+      ),
     ),
-    'primary key' => array('fid'),
+    'primary key' => array('format', 'name'),
     'unique keys' => array(
       'fmn' => array('format', 'module', 'name'),
     ),
@@ -187,3 +195,44 @@
   return $ret;
 }
 
+/**
+ * Structure Filter module database structure.
+ *
+ * - Remove {filter}.fid.
+ * - Add {filter}.status.
+ * - Add {filter}.settings.
+ * - Add (format, name) as primary key for {filter}.
+ */
+function filter_update_7004() {
+  $ret = array();
+  db_drop_field($ret, 'filter', 'fid');
+  db_add_field($ret, 'filter', 'status',
+    array(
+      'type' => 'int',
+      'not null' => TRUE,
+      'default' => 0,
+      'description' => 'Filter enabled status. (1 = enabled, 0 = disabled)',
+    )
+  );
+  db_add_field($ret, 'filter', 'settings',
+    array(
+      'type' => 'text',
+      'not null' => FALSE,
+      'size' => 'big',
+      'serialize' => TRUE,
+      'description' => 'A serialized array of name value pairs that store the filter settings for the specific format.',
+    )
+  );
+  db_add_primary_key($ret, 'filter', array('format', 'name'));
+
+  // Enable all the existing filters.
+  // @todo
+  $ret[] = update_sql("UPDATE {filter} SET status = 1");
+
+  // Move filter settings from system variables into
+  // {filter}.settings.
+  // @todo
+
+  return $ret;
+}
+
Index: modules/filter/filter.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.test,v
retrieving revision 1.35
diff -u -r1.35 filter.test
--- modules/filter/filter.test	26 Aug 2009 10:28:45 -0000	1.35
+++ modules/filter/filter.test	26 Aug 2009 18:20:52 -0000
@@ -17,7 +17,7 @@
     // URL filter.
     $first_filter = 'filter_url';
     // Line filter.
-    $second_filter =  'filter_autop';
+    $second_filter = 'filter_autop';
 
     // Create users.
     $admin_user = $this->drupalCreateUser(array('administer filters'));
@@ -36,11 +36,11 @@
 
     // Add an additional tag.
     $edit = array();
-    $edit['allowed_html_1'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <quote>';
+    $edit['settings[filter_html][allowed_html]'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <quote>';
     $this->drupalPost('admin/settings/formats/' . $filtered . '/configure', $edit, t('Save configuration'));
     $this->assertText(t('The configuration options have been saved.'), t('Allowed HTML tag added.'));
 
-    $this->assertRaw(htmlentities($edit['allowed_html_1']), t('Tag displayed.'));
+    $this->assertRaw(htmlentities($edit['settings[filter_html][allowed_html]']), t('Tag displayed.'));
 
     $result = db_query('SELECT * FROM {cache_filter}')->fetchObject();
     $this->assertFalse($result, t('Cache cleared.'));
@@ -64,7 +64,7 @@
     // Add filter.
     $edit = array();
     $edit['name'] = $this->randomName();
-    $edit['roles[2]'] = TRUE;
+    $edit['roles[2]'] = 1;
     $edit['filters[' . $second_filter . ']'] = TRUE;
     $edit['filters[' . $first_filter . ']'] = TRUE;
     $this->drupalPost('admin/settings/formats/add', $edit, t('Save configuration'));
@@ -93,7 +93,8 @@
 
     // Allow authenticated users on full HTML.
     $edit = array();
-    $edit['roles[2]'] = TRUE;
+    $edit['roles[1]'] = 0;
+    $edit['roles[2]'] = 1;
     $this->drupalPost('admin/settings/formats/' . $full, $edit, t('Save configuration'));
     $this->assertText(t('The text format settings have been updated.'), t('Full HTML format successfully updated.'));
 
@@ -129,7 +130,7 @@
     // Clean up.
     // Allowed tags.
     $edit = array();
-    $edit['allowed_html_1'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>';
+    $edit['settings[filter_html][allowed_html]'] = '<a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>';
     $this->drupalPost('admin/settings/formats/' . $filtered . '/configure', $edit, t('Save configuration'));
     $this->assertText(t('The configuration options have been saved.'), t('Changes reverted.'));
 
@@ -187,7 +188,7 @@
  * Unit tests for core filters.
  */
 class FilterUnitTest extends DrupalWebTestCase {
-  protected $format;
+  protected $filter;
 
   public static function getInfo() {
     return array(
@@ -197,30 +198,38 @@
     );
   }
 
+  function setUp() {
+    parent::setUp();
+
+    // Setup dummy filter object for tests.
+    $this->filter = new stdClass;
+    $this->filter->settings = array();
+  }
+
   /**
    * Test the line break filter.
    */
   function testLineBreakFilter() {
     // Single line breaks should be changed to <br /> tags, while paragraphs
     // separated with double line breaks should be enclosed with <p></p> tags.
-    $f = _filter_autop("aaa\nbbb\n\nccc");
+    $f = _filter_autop("aaa\nbbb\n\nccc", $this->filter);
     $this->assertEqual(str_replace("\n", '', $f), "<p>aaa<br />bbb</p><p>ccc</p>", t('Line breaking basic case.'));
 
     // Text within some contexts should not be processed.
-    $f = _filter_autop("<script>aaa\nbbb\n\nccc</script>");
+    $f = _filter_autop("<script>aaa\nbbb\n\nccc</script>", $this->filter);
     $this->assertEqual($f, "<script>aaa\nbbb\n\nccc</script>", t('Line breaking -- do not break scripts.'));
 
-    $f = _filter_autop('<p><div>  </div></p>');
+    $f = _filter_autop('<p><div>  </div></p>', $this->filter);
     $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), t('Make sure line breaking produces matching paragraph tags.'));
 
-    $f = _filter_autop('<div><p>  </p></div>');
+    $f = _filter_autop('<div><p>  </p></div>', $this->filter);
     $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), t('Make sure line breaking produces matching paragraph tags.'));
 
-    $f = _filter_autop('<blockquote><pre>aaa</pre></blockquote>');
+    $f = _filter_autop('<blockquote><pre>aaa</pre></blockquote>', $this->filter);
     $this->assertEqual(substr_count($f, '<p>'), substr_count($f, '</p>'), t('Make sure line breaking produces matching paragraph tags.'));
 
     $limit = max(ini_get('pcre.backtrack_limit'), ini_get('pcre.recursion_limit'));
-    $f = _filter_autop($this->randomName($limit));
+    $f = _filter_autop($this->randomName($limit), $this->filter);
     $this->assertNotEqual($f, '', t('Make sure line breaking can process long strings.'));
   }
 
@@ -422,35 +431,33 @@
    *   or better a whitelist approach should be used for that too.
    */
   function testFilter() {
-    $format = 'fake_format';
-
     // HTML filter is not able to secure some tags, these should never be
     // allowed.
-    $f = _filter_html('<script />', $format);
+    $f = _filter_html('<script />', $this->filter);
     $this->assertNoNormalized($f, 'script', t('HTML filter should always remove script tags.'));
 
-    $f = _filter_html('<iframe />', $format);
+    $f = _filter_html('<iframe />', $this->filter);
     $this->assertNoNormalized($f, 'iframe', t('HTML filter should always remove iframe tags.'));
 
-    $f = _filter_html('<object />', $format);
+    $f = _filter_html('<object />', $this->filter);
     $this->assertNoNormalized($f, 'object', t('HTML filter should always remove object tags.'));
 
-    $f = _filter_html('<style />', $format);
+    $f = _filter_html('<style />', $this->filter);
     $this->assertNoNormalized($f, 'style', t('HTML filter should always remove style tags.'));
 
     // Some tags make CSRF attacks easier, let the user take the risk herself.
-    $f = _filter_html('<img />', $format);
+    $f = _filter_html('<img />', $this->filter);
     $this->assertNoNormalized($f, 'img', t('HTML filter should remove img tags on default.'));
 
-    $f = _filter_html('<input />', $format);
+    $f = _filter_html('<input />', $this->filter);
     $this->assertNoNormalized($f, 'img', t('HTML filter should remove input tags on default.'));
 
     // Filtering content of some attributes is infeasible, these shouldn't be
     // allowed too.
-    $f = _filter_html('<p style="display: none;" />', $format);
+    $f = _filter_html('<p style="display: none;" />', $this->filter);
     $this->assertNoNormalized($f, 'style', t('HTML filter should remove style attribute on default.'));
 
-    $f = _filter_html('<p onerror="alert(0);" />', $format);
+    $f = _filter_html('<p onerror="alert(0);" />', $this->filter);
     $this->assertNoNormalized($f, 'onerror', t('HTML filter should remove on* attributes on default.'));
   }
 
@@ -458,26 +465,27 @@
    * Test the spam deterrent.
    */
   function testNoFollowFilter() {
-    variable_set('filter_html_nofollow_f', TRUE);
+    $filter = $this->filter;
+    $filter->settings['filter_html_nofollow'] = 1;
 
     // Test if the rel="nofollow" attribute is added, even if we try to prevent
     // it.
-    $f = _filter_html('<a href="http://www.example.com/">text</a>', 'f');
+    $f = _filter_html('<a href="http://www.example.com/">text</a>', $filter);
     $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent -- no evasion.'));
 
-    $f = _filter_html('<A href="http://www.example.com/">text</a>', 'f');
+    $f = _filter_html('<A href="http://www.example.com/">text</a>', $filter);
     $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- capital A.'));
 
-    $f = _filter_html("<a/href=\"http://www.example.com/\">text</a>", 'f');
+    $f = _filter_html("<a/href=\"http://www.example.com/\">text</a>", $filter);
     $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- non whitespace character after tag name.'));
 
-    $f = _filter_html("<\0a\0 href=\"http://www.example.com/\">text</a>", 'f');
+    $f = _filter_html("<\0a\0 href=\"http://www.example.com/\">text</a>", $filter);
     $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- some nulls.'));
 
-    $f = _filter_html('<!--[if true]><a href="http://www.example.com/">text</a><![endif]-->', 'f');
+    $f = _filter_html('<!--[if true]><a href="http://www.example.com/">text</a><![endif]-->', $filter);
     $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- link within a comment.'));
 
-    $f = _filter_html('<a href="http://www.example.com/" rel="follow">text</a>', 'f');
+    $f = _filter_html('<a href="http://www.example.com/" rel="follow">text</a>', $filter);
     $this->assertNoNormalized($f, 'rel="follow"', t('Spam deterrent evasion -- with rel set - rel="follow" removed.'));
     $this->assertNormalized($f, 'rel="nofollow"', t('Spam deterrent evasion -- with rel set - rel="nofollow" added.'));
   }
@@ -521,76 +529,77 @@
    * Test the URL filter.
    */
   function testUrlFilter() {
-    variable_set('filter_url_length_f', 496);
+    $filter = $this->filter;
+    $filter->settings['filter_url_length'] = 496;
 
     // Converting URLs.
-    $f = _filter_url('http://www.example.com/', 'f');
+    $f = _filter_url('http://www.example.com/', $filter);
     $this->assertEqual($f, '<a href="http://www.example.com/" title="http://www.example.com/">http://www.example.com/</a>', t('Converting URLs.'));
 
-    $f = _filter_url('http://www.example.com/?a=1&b=2', 'f');
+    $f = _filter_url('http://www.example.com/?a=1&b=2', $filter);
     $this->assertEqual($f, '<a href="http://www.example.com/?a=1&amp;b=2" title="http://www.example.com/?a=1&amp;b=2">http://www.example.com/?a=1&amp;b=2</a>', t('Converting URLs -- ampersands.'));
 
-    $f = _filter_url('ftp://user:pass@ftp.example.com/dir1/dir2', 'f');
+    $f = _filter_url('ftp://user:pass@ftp.example.com/dir1/dir2', $filter);
     $this->assertEqual($f, '<a href="ftp://user:pass@ftp.example.com/dir1/dir2" title="ftp://user:pass@ftp.example.com/dir1/dir2">ftp://user:pass@ftp.example.com/dir1/dir2</a>', t('Converting URLs -- FTP scheme.'));
 
     // Converting domain names.
-    $f = _filter_url('www.example.com', 'f');
+    $f = _filter_url('www.example.com', $filter);
     $this->assertEqual($f, '<a href="http://www.example.com" title="www.example.com">www.example.com</a>', t('Converting domain names.'));
 
-    $f = _filter_url('<li>www.example.com</li>', 'f');
+    $f = _filter_url('<li>www.example.com</li>', $filter);
     $this->assertEqual($f, '<li><a href="http://www.example.com" title="www.example.com">www.example.com</a></li>', t('Converting domain names -- domain in a list.'));
 
-    $f = _filter_url('(www.example.com/dir?a=1&b=2#a)', 'f');
+    $f = _filter_url('(www.example.com/dir?a=1&b=2#a)', $filter);
     $this->assertEqual($f, '(<a href="http://www.example.com/dir?a=1&amp;b=2#a" title="www.example.com/dir?a=1&amp;b=2#a">www.example.com/dir?a=1&amp;b=2#a</a>)', t('Converting domain names --  domain in parentheses.'));
 
     // Converting e-mail addresses.
-    $f = _filter_url('johndoe@example.com', 'f');
+    $f = _filter_url('johndoe@example.com', $filter);
     $this->assertEqual($f, '<a href="mailto:johndoe@example.com">johndoe@example.com</a>', t('Converting e-mail addresses.'));
 
-    $f = _filter_url('aaa@sub.tv', 'f');
+    $f = _filter_url('aaa@sub.tv', $filter);
     $this->assertEqual($f, '<a href="mailto:aaa@sub.tv">aaa@sub.tv</a>', t('Converting e-mail addresses -- a short e-mail from Tuvalu.'));
 
     // URL trimming.
-    variable_set('filter_url_length_f', 28);
+    $filter->settings['filter_url_length'] = 28;
 
-    $f = _filter_url('http://www.example.com/d/ff.ext?a=1&b=2#a1', 'f');
+    $f = _filter_url('http://www.example.com/d/ff.ext?a=1&b=2#a1', $filter);
     $this->assertNormalized($f, 'http://www.example.com/d/ff....', t('URL trimming.'));
 
     // Not breaking existing links.
-    $f = _filter_url('<a href="http://www.example.com">www.example.com</a>', 'f');
+    $f = _filter_url('<a href="http://www.example.com">www.example.com</a>', $filter);
     $this->assertEqual($f, '<a href="http://www.example.com">www.example.com</a>', t('Converting URLs -- do not break existing links.'));
 
-    $f = _filter_url('<a href="foo">http://www.example.com</a>', 'f');
+    $f = _filter_url('<a href="foo">http://www.example.com</a>', $filter);
     $this->assertEqual($f, '<a href="foo">http://www.example.com</a>', t('Converting URLs -- do not break existing, relative links.'));
 
     // Addresses within some tags such as code or script should not be converted.
-    $f = _filter_url('<code>http://www.example.com</code>', 'f');
+    $f = _filter_url('<code>http://www.example.com</code>', $filter);
     $this->assertEqual($f, '<code>http://www.example.com</code>', t('Converting URLs -- skip code contents.'));
 
-    $f = _filter_url('<code><em>http://www.example.com</em></code>', 'f');
+    $f = _filter_url('<code><em>http://www.example.com</em></code>', $filter);
     $this->assertEqual($f, '<code><em>http://www.example.com</em></code>', t('Converting URLs -- really skip code contents.'));
 
-    $f = _filter_url('<script>http://www.example.com</script>', 'f');
+    $f = _filter_url('<script>http://www.example.com</script>', $filter);
     $this->assertEqual($f, '<script>http://www.example.com</script>', t('Converting URLs -- do not process scripts.'));
 
     // Addresses in attributes should not be converted.
-    $f = _filter_url('<p xmlns="http://www.example.com" />', 'f');
+    $f = _filter_url('<p xmlns="http://www.example.com" />', $filter);
     $this->assertEqual($f, '<p xmlns="http://www.example.com" />', t('Converting URLs -- do not convert addresses in attributes.'));
 
-    $f = _filter_url('<a title="Go to www.example.com" href="http://www.example.com">text</a>', 'f');
+    $f = _filter_url('<a title="Go to www.example.com" href="http://www.example.com">text</a>', $filter);
     $this->assertEqual($f, '<a title="Go to www.example.com" href="http://www.example.com">text</a>', t('Converting URLs -- do not break existing links with custom title attribute.'));
 
     // Even though a dot at the end of a URL can indicate a fully qualified
     // domain name, such usage is rare compared to using a link at the end
     // of a sentence, so remove the dot from the link.
     // @todo It can also be used at the end of a filename or a query string.
-    $f = _filter_url('www.example.com.', 'f');
+    $f = _filter_url('www.example.com.', $filter);
     $this->assertEqual($f, '<a href="http://www.example.com" title="www.example.com">www.example.com</a>.', t('Converting URLs -- do not recognize a dot at the end of a domain name (FQDNs).'));
 
-    $f = _filter_url('http://www.example.com.', 'f');
+    $f = _filter_url('http://www.example.com.', $filter);
     $this->assertEqual($f, '<a href="http://www.example.com" title="http://www.example.com">http://www.example.com</a>.', t('Converting URLs -- do not recognize a dot at the end of an URL (FQDNs).'));
 
-    $f = _filter_url('www.example.com/index.php?a=.', 'f');
+    $f = _filter_url('www.example.com/index.php?a=.', $filter);
     $this->assertEqual($f, '<a href="http://www.example.com/index.php?a=" title="www.example.com/index.php?a=">www.example.com/index.php?a=</a>.', t('Converting URLs -- do forget about a dot at the end of a query string.'));
   }
 
@@ -751,7 +760,7 @@
  * Tests for filter hook invocation.
  */
 class FilterHooksTestCase extends DrupalWebTestCase {
-  function getInfo() {
+  public static function getInfo() {
     return array(
       'name' => 'Filter format hooks',
       'description' => 'Test hooks for text formats insert/update/delete.',
@@ -776,7 +785,7 @@
     $edit['roles[1]'] = 1;
     $this->drupalPost('admin/settings/formats/add', $edit, t('Save configuration'));
     $this->assertRaw(t('Added text format %format.', array('%format' => $name)), t('New format created.'));
-    $this->assertText(t('hook_filter_format_insert invoked.'), t('hook_filter_format_insert invoked.'));
+    $this->assertText('hook_filter_format_insert invoked.', t('hook_filter_format_insert was invoked.'));
 
     $format = db_query("SELECT format FROM {filter_format} WHERE name = :name", array(':name' => $name))->fetchField();
 
@@ -785,7 +794,7 @@
     $edit['roles[2]'] = 1;
     $this->drupalPost('admin/settings/formats/' . $format, $edit, t('Save configuration'));
     $this->assertRaw(t('The text format settings have been updated.'), t('Full HTML format successfully updated.'));
-    $this->assertText(t('hook_filter_format_update invoked.'), t('hook_filter_format_update() was invoked.'));
+    $this->assertText('hook_filter_format_update invoked.', t('hook_filter_format_update() was invoked.'));
 
     // Add a new custom block.
     $box = array();
@@ -804,7 +813,7 @@
     // Delete the text format.
     $this->drupalPost('admin/settings/formats/' . $format . '/delete', array(), t('Delete'));
     $this->assertRaw(t('Deleted text format %format.', array('%format' => $name)), t('Format successfully deleted.'));
-    $this->assertText(t('hook_filter_format_delete invoked.'), t('hook_filter_format_delete() was invoked.'));
+    $this->assertText('hook_filter_format_delete invoked.', t('hook_filter_format_delete() was invoked.'));
 
     // Verify that the deleted format was replaced with the default format.
     $current_format = db_select('box', 'b')
Index: modules/filter/filter.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.api.php,v
retrieving revision 1.12
diff -u -r1.12 filter.api.php
--- modules/filter/filter.api.php	26 Aug 2009 10:28:45 -0000	1.12
+++ modules/filter/filter.api.php	26 Aug 2009 18:20:33 -0000
@@ -43,8 +43,11 @@
  *
  * An important aspect of the filtering system is 'text formats'. Every text
  * format is an entire filter setup: which filters to enable, in what order
- * and with what settings. Filters that provide settings should usually store
- * these settings per format.
+ * and with what settings.
+ * 
+ * Filters that require settings, should provide the form controls to configure
+ * the settings in a form builder function, specified in 'callback settings'.
+ * The filter system store the settings in the databse, per format.
  *
  * If the filter's behavior depends on an extensive list and/or external data
  * (e.g. a list of smileys, a list of glossary terms) then filters are allowed
@@ -52,6 +55,44 @@
  * per format. In that case, there should be a link from the format-specific
  * settings to the separate settings page.
  *
+ * The $filter object with the current settings is passed to the settings
+ * callback function. Each filter should merge it's default settings with the
+ * current settings provided and access the settings through $filter->settings.
+ * Example:
+ * @code
+ *   function _filter_url_settings($filter) {
+ *     $filter->settings += array(
+ *       'filter_url_length' => 72,
+ *     );
+ *     $form['filter_url_length'] = array(
+ *       '#type' => 'textfield',
+ *       '#title' => t('Maximum link text length'),
+ *       '#default_value' => $filter->settings['filter_url_length'],
+ *     );
+ *     return $form;
+ *   } 
+ * @encode
+ *
+ * In a similar way, 'prepare callbacks' and 'process callback' invoked with
+ * the following arguments:
+ *
+ * - $text: The text to be filtered.
+ * - $filter: The filter object with the filter settings for the given format.
+ * - $format: The format of the text to be filtered. 
+ * - $langcode: Optional: the language code of the text to be filtered
+ * - $cache_id: The cache ID that should be used to store/retrieve data to/from
+ *   cache.
+ * @see check_markup() for details.
+ *
+ * 'prepare callback' and 'process callback' functions may access the filter settings
+ * through $filter->settings['setting_name'].
+ *
+ * The 'tips callback'is invoked with the following parameters:
+ * - $filter: The filter object with the filter settings for the given format.
+ * - $format: The format ID.
+ * - $long: Boolenan indicatin whether to return the  long or short version of
+ *   the tips.
+ *
  * For performance reasons content is only filtered once; the result is stored
  * in the cache table and retrieved the next time the piece of content is
  * displayed. If a filter's output is dynamic it can override the cache
@@ -145,7 +186,7 @@
  */
 function hook_filter_format_update($format) {
   mymodule_cache_rebuild();
-} 
+}
 
 /**
  * Perform actions when a text format has been deleted.
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.282
diff -u -r1.282 filter.module
--- modules/filter/filter.module	26 Aug 2009 10:28:45 -0000	1.282
+++ modules/filter/filter.module	26 Aug 2009 18:20:46 -0000
@@ -140,8 +140,8 @@
   return $items;
 }
 
-function filter_format_load($arg) {
-  return filter_formats($arg);
+function filter_format_load($format) {
+  return filter_formats($format);
 }
 
 /**
@@ -155,45 +155,47 @@
   // We should always set all roles to TRUE when saving the default format.
   // We use leading and trailing comma's to allow easy substring matching.
   $roles = array_filter($format->roles);
-  if ($format->format == variable_get('filter_default_format', 1)) {
+  if (!empty($format->format) && $format->format == variable_get('filter_default_format', 1)) {
     $roles = ',' . implode(',', array_keys(user_roles())) . ',';
   }
   else {
-    $roles = ',' . implode(',',array_keys($roles)) . ',';
+    $roles = ',' . implode(',', array_keys($roles)) . ',';
   }
   $format->roles = $roles;
   $format->name = trim($format->name);
 
   // Add a new text format.
   if (empty($format->format)) {
-    $status = drupal_write_record('filter_format', $format);
+    $return = drupal_write_record('filter_format', $format);
   }
   else {
-    $status = drupal_write_record('filter_format', $format, 'format');
+    $return = drupal_write_record('filter_format', $format, 'format');
   }
 
-  db_delete('filter')
-    ->condition('format', $format->format)
-    ->execute();
-
   // Get the filters currently active in the format, to add new filters
   // to the bottom.
   $current = filter_list_format($format->format);
-  $query = db_insert('filter')->fields(array('format', 'name', 'weight'));
   $filters = $format->filters;
 
-  foreach (array_keys(array_filter($filters)) as $name) {
+  foreach ($filters as $name => $status) {
+    $fields = array();
     // Add new filters to the bottom.
-    $weight = isset($current[$name]->weight) ? $current[$name]->weight : 10;
-    $query->values(array(
-      'format' => $format->format,
-      'name'  => $name,
-      'weight' => $weight,
-    ));
+    $fields['weight'] = isset($current[$name]->weight) ? $current[$name]->weight : 10; 
+    $fields['status'] = $status;
+    // Only update settings if there are any.
+    if (isset($format->settings[$name])) {
+      $fields['settings'] = serialize($format->settings[$name]);
+    }
+    db_merge('filter')
+      ->key(array(
+        'format' => $format->format,
+        'name' => $name,
+      ))
+      ->fields($fields)
+      ->execute();
   }
-  $query->execute();
 
-  if ($status == SAVED_NEW) {
+  if ($return == SAVED_NEW) {
     module_invoke_all('filter_format_insert', $format);
   }
   else {
@@ -202,7 +204,7 @@
 
   cache_clear_all($format->format . ':', 'cache_filter', TRUE);
 
-  return $status;
+  return $return;
 }
 
 /**
@@ -259,12 +261,12 @@
  * @{
  * Filters implemented by the filter.module.
  */
-function _filter_html_tips($format, $long = FALSE) {
+function _filter_html_tips($filter, $format, $long = FALSE) {
   global $base_url;
-  if ($allowed_html = variable_get("allowed_html_$format", '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>')) {
+  if ($allowed_html = $filter->settings['allowed_html']) {
     if ($long) {
       $output = '<p>' . t('Allowed HTML tags: @tags', array('@tags' => $allowed_html)) . '</p>';
-      if (!variable_get("filter_html_help_$format", 1)) {
+      if (!$filter->settings['filter_html_help']) {
         return $output;
       }
 
@@ -355,7 +357,7 @@
   }
 }
 
-function _filter_autop_tips($format, $long = FALSE) {
+function _filter_autop_tips($filter, $format, $long = FALSE) {
   if ($long) {
     return t('Lines and paragraphs are automatically recognized. The &lt;br /&gt; line break, &lt;p&gt; paragraph and &lt;/p&gt; close paragraph tags are inserted automatically. If paragraphs are not recognized simply add a couple blank lines.');
   }
@@ -364,11 +366,11 @@
   }
 }
 
-function _filter_url_tips() {
+function _filter_url_tips($filter, $format, $long = FALSE) {
   return t('Web page addresses and e-mail addresses turn into links automatically.');
 }
 
-function _filter_html_escape_tips() {
+function _filter_html_escape_tips($filter, $format, $long = FALSE) {
   return t('No HTML tags allowed.');
 }
 
@@ -462,6 +464,11 @@
 
 /**
  * Retrieve a list of filters for a certain format.
+ * 
+ * @param $format
+ *   The format ID.
+ * @return
+ *   An array of filter objects assosiated to the given format.
  */
 function filter_list_format($format) {
   static $filters = array();
@@ -469,10 +476,20 @@
 
   if (!isset($filters[$format])) {
     $filters[$format] = array();
-    $result = db_query("SELECT * FROM {filter} WHERE format = :format ORDER BY weight, module, name", array(':format' => (int) $format));
+    $result = db_select('filter', 'filter')
+      ->fields('filter')
+      ->condition('format', $format)
+      ->condition('status', 1)
+      ->orderBy('weight')
+      ->orderBy('module')
+      ->orderBy('name')
+      ->execute();
     foreach ($result as $filter) {
       if (isset($filter_info[$filter->name])) {
         $filter->title = $filter_info[$filter->name]['title'];
+        if (isset($filter->settings)) {
+          $filter->settings = unserialize($filter->settings);
+        }
         $filters[$format][$filter->name] = $filter;
       }
     }
@@ -533,14 +550,14 @@
   // Give filters the chance to escape HTML-like data such as code or formulas.
   foreach ($filters as $name => $filter) {
     if (isset($filter_info[$name]['prepare callback']) && function_exists($filter_info[$name]['prepare callback'])) {
-      $text = call_user_func($filter_info[$name]['prepare callback'], $text, $format, $langcode, $cache_id);
+      $text = $filter_info[$name]['prepare callback']($text, $filter, $format, $langcode, $cache_id);
     }
   }
 
   // Perform filtering.
   foreach ($filters as $name => $filter) {
     if (isset($filter_info[$name]['process callback']) && function_exists($filter_info[$name]['process callback'])) {
-      $text = call_user_func($filter_info[$name]['process callback'], $text, $format, $langcode, $cache_id);
+      $text = $filter_info[$name]['process callback']($text, $filter, $format, $langcode, $cache_id);
     }
   }
 
@@ -647,8 +664,8 @@
     $tips[$format->name] = array();
     foreach ($filters as $name => $filter) {
       if (isset($filter_info[$name]['tips callback']) && function_exists($filter_info[$name]['tips callback'])) {
-        $tip = call_user_func($filter_info[$name]['tips callback'],$format->format, $long);
-        $tips[$format->name][] = array('tip' => $tip, 'id' => $name);
+        $tip = $filter_info[$name]['tips callback']($filter, $format, $long);
+        $tips[$format->name][$name] = array('tip' => $tip, 'id' => $name);
       }
     }
   }
@@ -767,30 +784,30 @@
 /**
  * Settings callback for the HTML filter.
  */
-function _filter_html_settings($format) {
-  $form['filter_html'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('HTML filter'),
-    '#collapsible' => TRUE,
+function _filter_html_settings($filter) {
+  $filter->settings += array(
+    'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>',
+    'filter_html_help' => 1,
+    'filter_html_nofollow' => 0,
   );
-  $form['filter_html']["allowed_html_$format"] = array(
+  $form['allowed_html'] = array(
     '#type' => 'textfield',
     '#title' => t('Allowed HTML tags'),
-    '#default_value' => variable_get("allowed_html_$format", '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>'),
+    '#default_value' => $filter->settings['allowed_html'],
     '#size' => 64,
     '#maxlength' => 1024,
     '#description' => t('Specify a list of tags which should not be stripped. (Note that JavaScript event attributes are always stripped.)'),
   );
-  $form['filter_html']["filter_html_help_$format"] = array(
+  $form['filter_html_help'] = array(
     '#type' => 'checkbox',
     '#title' => t('Display HTML help'),
-    '#default_value' => variable_get("filter_html_help_$format", 1),
+    '#default_value' => $filter->settings['filter_html_help'],
     '#description' => t('If enabled, Drupal will display some basic HTML help in the long filter tips.'),
   );
-  $form['filter_html']["filter_html_nofollow_$format"] = array(
+  $form['filter_html_nofollow'] = array(
     '#type' => 'checkbox',
     '#title' => t('Spam link deterrent'),
-    '#default_value' => variable_get("filter_html_nofollow_$format", FALSE),
+    '#default_value' => $filter->settings['filter_html_nofollow'],
     '#description' => t('If enabled, Drupal will add rel="nofollow" to all links, as a measure to reduce the effectiveness of spam links. Note: this will also prevent valid links from being followed by search engines, therefore it is likely most effective when enabled for anonymous users.'),
   );
   return $form;
@@ -799,11 +816,16 @@
 /**
  * HTML filter. Provides filtering of input into accepted HTML.
  */
-function _filter_html($text, $format) {
-  $allowed_tags = preg_split('/\s+|<|>/', variable_get("allowed_html_$format", '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>'), -1, PREG_SPLIT_NO_EMPTY);
+function _filter_html($text, $filter) {
+  $filter->settings += array(
+    'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>',
+    'filter_html_help' => 1,
+    'filter_html_nofollow' => 0,
+  );
+  $allowed_tags = preg_split('/\s+|<|>/', $filter->settings['allowed_html'], -1, PREG_SPLIT_NO_EMPTY);
   $text = filter_xss($text, $allowed_tags);
 
-  if (variable_get("filter_html_nofollow_$format", FALSE)) {
+  if ($filter->settings['filter_html_nofollow']) {
     $html_dom = filter_dom_load($text);
     $links = $html_dom->getElementsByTagName('a');
     foreach($links as $link) {
@@ -818,16 +840,14 @@
 /**
  * Settings callback for URL filter.
  */
-function _filter_url_settings($format) {
-  $form['filter_urlfilter'] = array(
-    '#type' => 'fieldset',
-    '#title' => t('URL filter'),
-    '#collapsible' => TRUE,
+function _filter_url_settings($filter) {
+  $filter->settings += array(
+    'filter_url_length' => 72,
   );
-  $form['filter_urlfilter']['filter_url_length_' . $format] = array(
+  $form['filter_url_length'] = array(
     '#type' => 'textfield',
     '#title' => t('Maximum link text length'),
-    '#default_value' => variable_get('filter_url_length_' . $format, 72),
+    '#default_value' => $filter->settings['filter_url_length'],
     '#maxlength' => 4,
     '#description' => t('URLs longer than this number of characters will be truncated to prevent long strings that break formatting. The link itself will be retained; just the text portion of the link will be truncated.'),
   );
@@ -838,9 +858,12 @@
  * URL filter. Automatically converts text web addresses (URLs, e-mail addresses,
  * ftp links, etc.) into hyperlinks.
  */
-function _filter_url($text, $format) {
+function _filter_url($text, $filter) {
+  $filter->settings += array(
+    'filter_url_length' => 72,
+  );
   // Pass length to regexp callback
-  _filter_url_trim(NULL, variable_get('filter_url_length_' . $format, 72));
+  _filter_url_trim(NULL, $filter->settings['filter_url_length']);
 
   $text = ' ' . $text . ' ';
 
Index: modules/filter/filter.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v
retrieving revision 1.40
diff -u -r1.40 filter.admin.inc
--- modules/filter/filter.admin.inc	26 Aug 2009 10:28:45 -0000	1.40
+++ modules/filter/filter.admin.inc	26 Aug 2009 18:20:32 -0000
@@ -144,7 +144,7 @@
   }
   // Table with filters
   $filter_info = filter_get_filters();
-  $enabled = filter_list_format($format->format);
+  $filters = filter_list_format($format->format);
 
   $form['filters'] = array('#type' => 'fieldset',
     '#title' => t('Filters'),
@@ -155,7 +155,7 @@
     $form['filters'][$name] = array(
       '#type' => 'checkbox',
       '#title' => $filter['title'],
-      '#default_value' => isset($enabled[$name]),
+      '#default_value' => isset($filters[$name]),
       '#description' => $filter['description'],
     );
   }
@@ -210,13 +210,13 @@
       drupal_set_message(t('Added text format %format.', array('%format' => $format->name)));
       $return .= '/' . $format->format;
       break;
+
     case SAVED_UPDATED:
       drupal_set_message(t('The text format settings have been updated.'));
       break;
   }
 
   $form_state['redirect'] = $return;
-  return;
 }
 
 /**
@@ -270,38 +270,62 @@
 
 /**
  * Build a form to change the settings for a format's filters.
+ * 
+ * The form is built by merging the results of 'settings callback' for each
+ * enabled filter in the given format.
  *
  * @ingroup forms
  */
 function filter_admin_configure(&$form_state, $format) {
-  $list = filter_list_format($format->format);
+  $filters = filter_list_format($format->format);
   $filter_info = filter_get_filters();
-  $form = array();
-  foreach ($list as $name => $filter) {
+
+  $form['#format'] = $format;
+  foreach ($filters as $name => $filter) {
     if (isset($filter_info[$name]['settings callback']) && function_exists($filter_info[$name]['settings callback'])) {
-      $form_module = call_user_func($filter_info[$name]['settings callback'], $format->format);
-    }
-    if (isset($form_module) && is_array($form_module)) {
-      $form = array_merge($form, $form_module);
+      $settings_form = $filter_info[$name]['settings callback']($filters[$name]);
+      if (isset($settings_form) && is_array($settings_form)) {
+        $form['settings'][$name] = array(
+          '#type' => 'fieldset',
+          '#title' => check_plain($filter->title),
+        );
+        $form['settings'][$name] += $settings_form;
+      }
     }
   }
 
-  if (!empty($form)) {
-    $form = system_settings_form($form, TRUE);
-  }
-  else {
+  if (empty($form['settings'])) {
     $form['error'] = array('#markup' => t('No settings are available.'));
+    return $form;
   }
-  $form['format'] = array('#type' => 'hidden', '#value' => $format->format);
-  $form['#submit'][] = 'filter_admin_configure_submit';
+  $form['settings']['#tree'] = TRUE;
+  $form['submit'] = array('#type' => 'submit', '#value' => t('Save configuration'));
+
   return $form;
 }
 
 /**
- * Clear the filter's cache when configuration settings are saved.
+ * Form submit handler for text format filter configuration form.
+ *
+ * @see filter_admin_configure()
  */
 function filter_admin_configure_submit($form, &$form_state) {
-  cache_clear_all($form_state['values']['format'] . ':', 'cache_filter', TRUE);
+  $format = $form['#format'];
+
+  foreach ($form_state['values']['settings'] as $name => $settings) {
+    db_update('filter')
+      ->fields(array(
+        'settings' => serialize($settings),
+      ))
+      ->condition('format', $format->format)
+      ->condition('name', $name)
+      ->execute();
+  }
+
+  // Clear the filter's cache when configuration settings are saved.
+  cache_clear_all($format->format . ':', 'cache_filter', TRUE);
+
+  drupal_set_message(t('The configuration options have been saved.'));
 }
 
 /**
@@ -366,10 +390,14 @@
  */
 function filter_admin_order_submit($form, &$form_state) {
   foreach ($form_state['values']['weights'] as $name => $weight) {
-    db_update('filter')
-      ->fields(array('weight' => $weight))
-      ->condition('format', $form_state['values']['format'])
-      ->condition('name', $name)
+    db_merge('filter')
+      ->key(array(
+        'format' => $form_state['values']['format'],
+        'name' => $name,
+      ))
+      ->fields(array(
+        'weight' => $weight,
+      ))
       ->execute();
   }
   drupal_set_message(t('The filter ordering has been saved.'));
Index: profiles/expert/expert.install
===================================================================
RCS file: /cvs/drupal/drupal/profiles/expert/expert.install,v
retrieving revision 1.1
diff -u -r1.1 expert.install
--- profiles/expert/expert.install	21 Aug 2009 07:50:08 -0000	1.1
+++ profiles/expert/expert.install	26 Aug 2009 18:21:12 -0000
@@ -66,6 +66,25 @@
     $query->values($record);
   }
   $query->execute();  
-}
 
+  // Add text formats.
+  $filtered_html = new stdClass();
+  $filtered_html->name = 'Filtered HTML';
+  $filtered_html->roles = array(DRUPAL_ANONYMOUS_RID => 1, DRUPAL_AUTHENTICATED_RID => 1);
+  $filtered_html->filters = array('filter_url' => 1, 'filter_html'  => 1, 'filter_autop'  => 1, 'filter_htmlcorrector'  => 1);
+  $filtered_html->settings = array(
+    'filter_url' => array(
+      'filter_url_length' => 72,
+    ),
+    'filter_html' => array(
+       'allowed_html' => '<a> <em> <strong> <cite> <blockquote> <code> <ul> <ol> <li> <dl> <dt> <dd>',
+       'filter_html_help' => 1,
+       'filter_html_nofollow' => 0,
+     ),
+  );
+  filter_format_save($filtered_html);
+
+  // Set the default text format to Filtered HTML.
+  variable_set('filter_default_format', $filtered_html->format);
+}
 
Index: modules/simpletest/tests/filter_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/simpletest/tests/filter_test.module,v
retrieving revision 1.1
diff -u -r1.1 filter_test.module
--- modules/simpletest/tests/filter_test.module	26 Aug 2009 10:29:26 -0000	1.1
+++ modules/simpletest/tests/filter_test.module	26 Aug 2009 18:20:55 -0000
@@ -10,20 +10,20 @@
  * Implement hook_filter_format_insert().
  */
 function filter_test_filter_format_insert($format) {
-  drupal_set_message(t('hook_filter_format_insert invoked.'));
+  drupal_set_message('hook_filter_format_insert invoked.');
 }
 
 /**
  * Implement hook_filter_format_update().
  */
 function filter_test_filter_format_update($format) {
-  drupal_set_message(t('hook_filter_format_update invoked.'));
+  drupal_set_message('hook_filter_format_update invoked.');
 }
 
 /**
  * Implement hook_filter_format_delete().
  */
 function filter_test_filter_format_delete($format, $default) {
-  drupal_set_message(t('hook_filter_format_delete invoked.'));
+  drupal_set_message('hook_filter_format_delete invoked.');
 }
 
Index: modules/system/system.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.install,v
retrieving revision 1.379
diff -u -r1.379 system.install
--- modules/system/system.install	24 Aug 2009 00:14:22 -0000	1.379
+++ modules/system/system.install	26 Aug 2009 18:21:11 -0000
@@ -420,82 +420,6 @@
     ))
     ->execute();
 
-  // Add text formats.
-  $filtered_html_format = db_insert('filter_format')
-    ->fields(array(
-      'name' => 'Filtered HTML',
-      'roles' => ',' . DRUPAL_ANONYMOUS_RID . ',' . DRUPAL_AUTHENTICATED_RID . ',',
-      'cache' => 1,
-    ))
-    ->execute();
-  $full_html_format = db_insert('filter_format')
-    ->fields(array(
-      'name' => 'Full HTML',
-      'roles' => '',
-      'cache' => 1,
-    ))
-    ->execute();
-
-  // Enable filters for each text format.
-
-  // Filtered HTML:
-  db_insert('filter')
-    ->fields(array('format', 'module', 'name', 'weight'))
-    // URL filter.
-    ->values(array(
-      'format' => $filtered_html_format,
-      'module' => 'filter',
-      'name' => 'filter_url',
-      'weight' => 0,
-    ))
-    // HTML filter.
-    ->values(array(
-      'format' => $filtered_html_format,
-      'module' => 'filter',
-      'name' => 'filter_html',
-      'weight' => 1,
-    ))
-    // Line break filter.
-    ->values(array(
-      'format' => $filtered_html_format,
-      'module' => 'filter',
-      'name' => 'filter_autop',
-      'weight' => 2,
-    ))
-    // HTML corrector filter.
-    ->values(array(
-      'format' => $filtered_html_format,
-      'module' => 'filter',
-      'name' => 'filter_htmlcorrector',
-      'weight' => 10,
-    ))
-  // Full HTML:
-    // URL filter.
-    ->values(array(
-      'format' => $full_html_format,
-      'module' => 'filter',
-      'name' => 'filter_url',
-       'weight' => 0,
-    ))
-    // Line break filter.
-    ->values(array(
-      'format' => $full_html_format,
-      'module' => 'filter',
-      'name' => 'filter_autop',
-      'weight' => 1,
-    ))
-    // HTML corrector filter.
-    ->values(array(
-      'format' => $full_html_format,
-      'module' => 'filter',
-      'name' => 'filter_htmlcorrector',
-      'weight' => 10,
-    ))
-    ->execute();
-
-  // Set the default input format to Filtered HTML.
-  variable_set('filter_default_format', $filtered_html_format);
-
   $cron_key = md5(mt_rand());
 
   variable_set('cron_key', $cron_key);
