=== modified file 'modules/filter/filter.module'
--- modules/filter/filter.module	2009-03-08 21:25:17 +0000
+++ modules/filter/filter.module	2009-03-14 17:10:04 +0000
@@ -281,7 +281,8 @@ function filter_filter_tips($delta, $for
     case 4:
       return t('No HTML tags allowed');
       break;
-
+    case 5:
+      return t('Enter [internal:foo/bar] to get @path', array('@path' => url('foo/bar')));
   }
 }
 
@@ -605,7 +606,14 @@ function theme_filter_guidelines($format
 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'));
+      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'),
+        5 => t('Create internal URLs'),
+      );
 
     case 'description':
       switch ($delta) {
@@ -619,6 +627,8 @@ function filter_filter($op, $delta = 0, 
           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.');
+        case 5:
+          return t('Turns [internal:node/1234] into its real, site specific URL equivalent.');
         default:
           return;
       }
@@ -635,6 +645,8 @@ function filter_filter($op, $delta = 0, 
           return _filter_htmlcorrector($text);
         case 4:
           return trim(check_plain($text));
+        case 5:
+          return _filter_internal($text);
         default:
           return $text;
       }
@@ -854,6 +866,16 @@ function _filter_url_trim($text, $length
 }
 
 /**
+ * Turns [internal:foo] into url(foo).
+ */
+function _filter_internal($text) {
+  // Change '[url:X]' to the URL to the site. The str_replace is necessary
+  // because url() translates $ into %24 but we need to change it back for
+  // the regex replacement.
+  return preg_replace('/\[internal:([^"]+)\]/', str_replace('%24', '$', url('$1')), $text);
+}
+
+/**
  * Convert line breaks into <p> and <br> in an intelligent fashion.
  * Based on: http://photomatt.net/scripts/autop
  */

=== modified file 'modules/filter/filter.test'
--- modules/filter/filter.test	2009-03-08 01:43:57 +0000
+++ modules/filter/filter.test	2009-03-14 17:03:49 +0000
@@ -184,7 +184,7 @@ class FilterTestCase extends DrupalWebTe
   function getInfo() {
     return array(
       'name' => t('Core filters'),
-      'description' => t('Filter each filter individually: Convert URLs into links, Convert line breaks, Correct broken HTML, Escape all HTML, Limit allowed HTML tags.'),
+      'description' => t('Filter each filter individually: Convert URLs into links, Convert line breaks, Correct broken HTML, Escape all HTML, Limit allowed HTML tags, check the internal filter.'),
       'group' => t('Filter'),
     );
   }
@@ -233,4 +233,9 @@ class FilterTestCase extends DrupalWebTe
       $this->drupalPost('admin/settings/filter/delete/' . $format->format, array(), t('Delete'));
     }
   }
+
+  function testInternalFilter() {
+    $f = _filter_internal('[internal:foo/bar]');
+    $this->assertEqual($f, url('foo/bar'), t('The internal filter works'));
+  }
 }

