? sites/all/modules
Index: includes/common.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/common.inc,v
retrieving revision 1.852
diff -u -p -r1.852 common.inc
--- includes/common.inc	20 Jan 2009 03:18:40 -0000	1.852
+++ includes/common.inc	22 Jan 2009 02:48:54 -0000
@@ -1652,10 +1652,12 @@ function url($path = NULL, array $option
     $options['external'] = ($colonpos !== FALSE && !preg_match('![/?#]!', substr($path, 0, $colonpos)) && filter_xss_bad_protocol($path, FALSE) == check_plain($path));
   }
 
-  // May need language dependent rewriting if language.inc is present.
-  if (function_exists('language_url_rewrite')) {
-    language_url_rewrite($path, $options);
+  // Allow other modules to alter the outbound URL and options.
+  foreach (module_implements('url_alter_outbound') as $module) {
+    $function = $module . '_url_alter_outbound';
+    $function($path, $options);
   }
+
   if ($options['fragment']) {
     $options['fragment'] = '#' . $options['fragment'];
   }
@@ -1705,11 +1707,6 @@ function url($path = NULL, array $option
     $path = drupal_get_path_alias($path, isset($options['language']) ? $options['language']->language : '');
   }
 
-  if (function_exists('custom_url_rewrite_outbound')) {
-    // Modules may alter outbound links by reference.
-    custom_url_rewrite_outbound($path, $options, $original_path);
-  }
-
   $base = $options['absolute'] ? $options['base_url'] . '/' : base_path();
   $prefix = empty($path) ? rtrim($options['prefix'], '/') : $options['prefix'];
   $path = drupal_urlencode($prefix . $path);
Index: includes/language.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/language.inc,v
retrieving revision 1.18
diff -u -p -r1.18 language.inc
--- includes/language.inc	2 Jan 2009 23:37:32 -0000	1.18
+++ includes/language.inc	22 Jan 2009 02:48:54 -0000
@@ -97,48 +97,3 @@ function language_from_browser() {
     }
   }
 }
-
-/**
- * Rewrite URLs with language based prefix. Parameters are the same
- * as those of the url() function.
- */
-function language_url_rewrite(&$path, &$options) {
-  global $language;
-
-  // Only modify relative (insite) URLs.
-  if (!$options['external']) {
-
-    // Language can be passed as an option, or we go for current language.
-    if (!isset($options['language'])) {
-      $options['language'] = $language;
-    }
-
-    switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
-      case LANGUAGE_NEGOTIATION_NONE:
-        // No language dependent path allowed in this mode.
-        unset($options['language']);
-        break;
-
-      case LANGUAGE_NEGOTIATION_DOMAIN:
-        if ($options['language']->domain) {
-          // Ask for an absolute URL with our modified base_url.
-          $options['absolute'] = TRUE;
-          $options['base_url'] = $options['language']->domain;
-        }
-        break;
-
-      case LANGUAGE_NEGOTIATION_PATH_DEFAULT:
-        $default = language_default();
-        if ($options['language']->language == $default->language) {
-          break;
-        }
-        // Intentionally no break here.
-
-      case LANGUAGE_NEGOTIATION_PATH:
-        if (!empty($options['language']->prefix)) {
-          $options['prefix'] = $options['language']->prefix . '/';
-        }
-        break;
-    }
-  }
-}
Index: includes/path.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/path.inc,v
retrieving revision 1.32
diff -u -p -r1.32 path.inc
--- includes/path.inc	4 Jan 2009 20:04:32 -0000	1.32
+++ includes/path.inc	22 Jan 2009 02:48:55 -0000
@@ -137,10 +137,13 @@ function drupal_get_normal_path($path, $
   if ($src = drupal_lookup_path('source', $path, $path_language)) {
     $result = $src;
   }
-  if (function_exists('custom_url_rewrite_inbound')) {
-    // Modules may alter the inbound request path by reference.
-    custom_url_rewrite_inbound($result, $path, $path_language);
+
+  // Allow other modules to alter the inbound URL request.
+  foreach (module_implements('url_alter_inbound') as $module) {
+    $function = $module . '_url_alter_inbound';
+    $function($result, $path, $path_language);
   }
+
   return $result;
 }
 
Index: modules/locale/locale.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/locale/locale.module,v
retrieving revision 1.235
diff -u -p -r1.235 locale.module
--- modules/locale/locale.module	20 Jan 2009 03:18:40 -0000	1.235
+++ modules/locale/locale.module	22 Jan 2009 02:48:56 -0000
@@ -597,3 +597,49 @@ function locale_block_view($delta = '') 
     return $block;
   }
 }
+
+/**
+ * Implementation of hook_url_alter().
+ *
+ * Rewrite outbound URLs with language based prefix.
+ */
+function locale_url_alter_outbound(&$path, &$options) {
+  global $language;
+
+  // Only modify relative (insite) URLs.
+  if (!$options['external']) {
+
+    // Language can be passed as an option, or we go for current language.
+    if (!isset($options['language'])) {
+      $options['language'] = $language;
+    }
+
+    switch (variable_get('language_negotiation', LANGUAGE_NEGOTIATION_NONE)) {
+      case LANGUAGE_NEGOTIATION_NONE:
+        // No language dependent path allowed in this mode.
+        unset($options['language']);
+        break;
+
+      case LANGUAGE_NEGOTIATION_DOMAIN:
+        if ($options['language']->domain) {
+          // Ask for an absolute URL with our modified base_url.
+          $options['absolute'] = TRUE;
+          $options['base_url'] = $options['language']->domain;
+        }
+        break;
+
+      case LANGUAGE_NEGOTIATION_PATH_DEFAULT:
+        $default = language_default();
+        if ($options['language']->language == $default->language) {
+          break;
+        }
+        // Intentionally no break here.
+
+      case LANGUAGE_NEGOTIATION_PATH:
+        if (!empty($options['language']->prefix)) {
+          $options['prefix'] = $options['language']->prefix . '/';
+        }
+        break;
+    }
+  }
+}
Index: modules/system/system.api.php
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.api.php,v
retrieving revision 1.13
diff -u -p -r1.13 system.api.php
--- modules/system/system.api.php	17 Jan 2009 20:28:46 -0000	1.13
+++ modules/system/system.api.php	22 Jan 2009 02:48:58 -0000
@@ -1577,5 +1577,26 @@ function hook_disable() {
 }
 
 /**
+ * Perform alterations to inbound URL requests.
+ *
+ * @see drupal_get_normal_path()
+ */
+function hook_url_alter_inbound(&$path, $original_path, $path_language) {
+  //@todo Example code!
+}
+
+/**
+ * Perform alterations to outbound URLs.
+ *
+ * @see url()
+ */
+function hook_url_alter_outbound(&$path, &$options) {
+  if ($path == 'rss.xml') {
+    $path = 'http://example.com/rss.xml';
+    $options['external'] = TRUE;
+  }
+}
+
+/**
  * @} End of "addtogroup hooks".
  */
