Index: modules/filter/filter.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.test,v
retrieving revision 1.28
diff -u -r1.28 filter.test
--- modules/filter/filter.test	27 Jul 2009 20:15:35 -0000	1.28
+++ modules/filter/filter.test	12 Aug 2009 23:43:36 -0000
@@ -421,35 +421,35 @@
    *   or better a whitelist approach should be used for that too.
    */
   function testFilter() {
-    // Check that access restriction really works.
+    $format = "fake format";
 
     // HTML filter is not able to secure some tags, these should never be
     // allowed.
-    $f = filter_filter('process', 0, 'no_such_format', '<script />');
+    $f = _filter_html('<script />', $format);
     $this->assertNoNormalized($f, 'script', t('HTML filter should always remove script tags.'));
 
-    $f = filter_filter('process', 0, 'no_such_format', '<iframe />');
+    $f = _filter_html('<iframe />', $format);
     $this->assertNoNormalized($f, 'iframe', t('HTML filter should always remove iframe tags.'));
 
-    $f = filter_filter('process', 0, 'no_such_format', '<object />');
+    $f = _filter_html('<object />', $format);
     $this->assertNoNormalized($f, 'object', t('HTML filter should always remove object tags.'));
 
-    $f = filter_filter('process', 0, 'no_such_format', '<style />');
+    $f = _filter_html('<style />', $format);
     $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_filter('process', 0, 'no_such_format', '<img />');
+    $f = _filter_html('<img />', $format);
     $this->assertNoNormalized($f, 'img', t('HTML filter should remove img tags on default.'));
 
-    $f = filter_filter('process', 0, 'no_such_format', '<input />');
+    $f = _filter_html('<input />', $format);
     $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_filter('process', 0, 'no_such_format', '<p style="display: none;" />');
+    $f = _filter_html('<p style="display: none;" />', $format);
     $this->assertNoNormalized($f, 'style', t('HTML filter should remove style attribute on default.'));
 
-    $f = filter_filter('process', 0, 'no_such_format', '<p onerror="alert(0);" />');
+    $f = _filter_html('<p onerror="alert(0);" />', $format);
     $this->assertNoNormalized($f, 'onerror', t('HTML filter should remove on* attributes on default.'));
   }
 
Index: modules/filter/filter.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.module,v
retrieving revision 1.266
diff -u -r1.266 filter.module
--- modules/filter/filter.module	11 Aug 2009 12:00:19 -0000	1.266
+++ modules/filter/filter.module	12 Aug 2009 23:43:21 -0000
@@ -329,12 +329,15 @@
 function filter_list_all() {
   $filters = array();
 
-  foreach (module_implements('filter') as $module) {
-    $function = $module . '_filter';
-    $list = $function('list');
-    if (isset($list) && is_array($list)) {
-      foreach ($list as $delta => $name) {
-        $filters[$module . '/' . $delta] = (object)array('module' => $module, 'delta' => $delta, 'name' => $name);
+  foreach (module_implements('filter_info') as $module) {
+    $function = $module . '_filter_info';
+    $info = $function('list');
+    if (isset($info) && is_array($info)) {
+      foreach ($info as $delta => $filter) {
+        $filters[$module . '/' . $delta] = (object)($filter + array(
+          'module' => $module,
+          'delta' => $delta,
+        ));
       }
     }
   }
@@ -379,9 +382,9 @@
     $filters[$format] = array();
     $result = db_query("SELECT * FROM {filter} WHERE format = :format ORDER BY weight, module, delta", array(':format' => (int) $format));
     foreach ($result as $filter) {
-      $list = module_invoke($filter->module, 'filter', 'list');
-      if (isset($list) && is_array($list) && isset($list[$filter->delta])) {
-        $filter->name = $list[$filter->delta];
+      $info = module_invoke($filter->module, 'filter_info');
+      if (isset($info) && is_array($info) && isset($info[$filter->delta])) {
+        $filter->name = $info[$filter->delta]['name'];
         $filters[$format][$filter->module . '/' . $filter->delta] = $filter;
       }
     }
@@ -448,12 +451,18 @@
 
     // Give filters the chance to escape HTML-like data such as code or formulas.
     foreach ($filters as $filter) {
-      $text = module_invoke($filter->module, 'filter', 'prepare', $filter->delta, $format, $text, $langcode, $cache_id);
+      $filter_info = module_invoke($filter->module, 'filter_info');
+      if (isset($filter_info[$filter->delta]['prepare callback']) && drupal_function_exists($filter_info[$filter->delta]['prepare callback'])) {
+        $text = call_user_func($filter_info[$filter->delta]['prepare callback'], $text, $format, $langcode, $cache_id);
+      }
     }
 
     // Perform filtering.
     foreach ($filters as $filter) {
-      $text = module_invoke($filter->module, 'filter', 'process', $filter->delta, $format, $text, $langcode, $cache_id);
+      $filter_info = module_invoke($filter->module, 'filter_info');
+      if (isset($filter_info[$filter->delta]['process callback']) && drupal_function_exists($filter_info[$filter->delta]['process callback'])) {
+        $text = call_user_func($filter_info[$filter->delta]['process callback'], $text, $format, $langcode, $cache_id);
+      }
     }
 
     // Store in cache with a minimum expiration time of 1 day.
@@ -578,7 +587,7 @@
  * and returns a full DOMDocument object that represents this document.
  * You can use filter_dom_serialize() to serialize this DOMDocument
  * back to a XHTML snippet.
- * 
+ *
  * @param $text
  *   The partial (X)HTML snippet to load. Invalid mark-up
  *   will be corrected on import.
@@ -600,7 +609,7 @@
  *
  * The resulting XHTML snippet will be properly formatted
  * to be compatible with HTML user agents.
- * 
+ *
  * @param $dom_document
  *   A DOMDocument object to serialize, only the tags below
  *   the first <body> node will be converted.
@@ -641,72 +650,39 @@
  * Filters implemented by the filter.module.
  */
 
-/**
- * Implement hook_filter().
- *  
- * Set up a basic set of essential filters:
- * - Limit allowed HTML tags:
- *     Restricts user-supplied HTML to certain tags, and removes dangerous
- *     components in allowed tags.
- * - Convert line breaks:
- *     Converts newlines into paragraph and break tags.
- * - Convert URLs into links:
- *     Converts URLs and e-mail addresses into links.
- * - Correct broken HTML:
- *     Fixes faulty HTML.
- * - Escape all HTML:
- *     Converts all HTML tags into visible text.
- */
-function filter_filter($op, $delta = 0, $format = -1, $text = '') {
-  switch ($op) {
-    case 'list':
-      return array(0 => t('Limit allowed HTML tags'), 1 => t('Convert line breaks'), 2 => t('Convert URLs into links'), 3 => t('Correct broken HTML'), 4 => t('Escape all HTML'));
-
-    case 'description':
-      switch ($delta) {
-        case 0:
-          return t('Allows you to restrict the HTML tags the user can use. It will also remove harmful content such as JavaScript events, JavaScript URLs and CSS styles from those tags that are not removed.');
-        case 1:
-          return t('Converts line breaks into HTML (i.e. &lt;br&gt; and &lt;p&gt;) tags.');
-        case 2:
-          return t('Turns web and e-mail addresses into clickable links.');
-        case 3:
-          return t('Corrects faulty and chopped off HTML in postings.');
-        case 4:
-          return t('Escapes all HTML tags, so they will be visible instead of being effective.');
-        default:
-          return;
-      }
-
-    case 'process':
-      switch ($delta) {
-        case 0:
-          return _filter_html($text, $format);
-        case 1:
-          return _filter_autop($text);
-        case 2:
-          return _filter_url($text, $format);
-        case 3:
-          return _filter_htmlcorrector($text);
-        case 4:
-          return trim(check_plain($text));
-        default:
-          return $text;
-      }
-
-    case 'settings':
-      switch ($delta) {
-        case 0:
-          return _filter_html_settings($format);
-        case 2:
-          return _filter_url_settings($format);
-        default:
-          return;
-      }
-
-    default:
-      return $text;
-  }
+function filter_filter_info() {
+  $filters[0] = array(
+    'name' => t('Limit allowed HTML tags'),
+    'description' => t('Allows you to restrict the HTML tags the user can use. It will also remove harmful content such as JavaScript events, JavaScript URLs and CSS styles from those tags that are not removed.'),
+    'process callback' => '_filter_html',
+    'settings callback' => '_filter_html_settings',
+    'tips callback'  => '_filter_html_tips'
+  );
+  $filters[1] = array(
+    'name' => t('Convert line breaks'),
+    'description' => t('Converts line breaks into HTML (i.e. &lt;br&gt; and &lt;p&gt;) tags.'),
+    'process callback' => '_filter_autop',
+    'tips callback' => '_filter_autop_tips'
+  );
+  $filters[2] = array(
+    'name' => t('Convert URLs into links'),
+    'description' => t('Turns web and e-mail addresses into clickable links.'),
+    'process callback' => '_filter_url',
+    'settings callback' => '_filter_url_settings',
+    'tips callback' => '_filter_url_tips'
+  );
+  $filters[3] = array(
+    'name' =>  t('Correct broken HTML'),
+    'description' => t('Corrects faulty and chopped off HTML in postings.'),
+    'process callback' => '_filter_htmlcorrector',
+  );
+  $filters[4] = array(
+    'name' => t('Escape all HTML'),
+    'description' => t('Escapes all HTML tags, so they will be visible instead of being effective.'),
+    'process callback' => '_filter_html_escape',
+    'tips callback' => '_filter_html_escape_tips'
+  );
+  return $filters;
 }
 
 /**
Index: modules/filter/filter.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/filter/filter.admin.inc,v
retrieving revision 1.30
diff -u -r1.30 filter.admin.inc
--- modules/filter/filter.admin.inc	12 Jun 2009 08:39:37 -0000	1.30
+++ modules/filter/filter.admin.inc	12 Aug 2009 23:43:03 -0000
@@ -151,10 +151,11 @@
     '#tree' => TRUE,
   );
   foreach ($all as $id => $filter) {
+    $filter_info = module_invoke($filter->module, 'filter_info');
     $form['filters'][$id] = array('#type' => 'checkbox',
       '#title' => $filter->name,
       '#default_value' => isset($enabled[$id]),
-      '#description' => module_invoke($filter->module, 'filter', 'description', $filter->delta),
+      '#description' => $filter_info[$filter->delta]['description'],
     );
   }
   if (!empty($format->format)) {
@@ -349,7 +350,10 @@
   $list = filter_list_format($format->format);
   $form = array();
   foreach ($list as $filter) {
-    $form_module = module_invoke($filter->module, 'filter', 'settings', $filter->delta, $format->format);
+    $filter_info = module_invoke($filter->module, 'filter_info');
+    if (isset($filter_info[$filter->delta]['settings callback']) && drupal_function_exists($filter_info[$filter->delta]['settings callback'])) {
+      $form_module = call_user_func($filter_info[$filter->delta]['settings callback'], $format->format);
+    }
     if (isset($form_module) && is_array($form_module)) {
       $form = array_merge($form, $form_module);
     }
Index: modules/php/php.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/php/php.module,v
retrieving revision 1.15
diff -u -r1.15 php.module
--- modules/php/php.module	5 Jul 2009 18:00:09 -0000	1.15
+++ modules/php/php.module	12 Aug 2009 23:43:44 -0000
@@ -121,24 +121,21 @@
 }
 
 /**
- * Implement hook_filter(). Contains a basic PHP evaluator.
+ * Implement hook_filter_info().
+ * 
+ * Contains a basic PHP evaluator.
  *
  * Executes PHP code. Use with care.
  */
-function php_filter($op, $delta = 0, $format = -1, $text = '') {
-  switch ($op) {
-    case 'list':
-      return array(0 => t('PHP evaluator'));
-    case 'no cache':
-      // No caching for the PHP evaluator.
-      return $delta == 0;
-    case 'description':
-      return t('Executes a piece of PHP code. The usage of this filter should be restricted to administrators only!');
-    case 'process':
-      return php_eval($text);
-    default:
-      return $text;
-  }
+function php_filter_info() {
+  return array(
+    array(
+      'name' => t('PHP evaluator'),
+      'description' => t('Executes a piece of PHP code. The usage of this filter should be restricted to administrators only!'), 
+      'cache' => FALSE,
+      'process callback' => 'php_eval'
+    )
+  );
 }
 
 
