Index: views.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/views/views.module,v
retrieving revision 1.166.2.47
diff -u -r1.166.2.47 views.module
--- views.module	31 Oct 2008 23:48:58 -0000	1.166.2.47
+++ views.module	15 Jul 2009 17:23:38 -0000
@@ -710,13 +710,22 @@
 function views_get_url($view, $args) {
   $url = $view->url;
 
+  $tokens = array_keys(module_invoke_all('views_url_tokens'));
   if (!empty($url)) {
     $where = 1;
     foreach ($args as $arg) {
       // This odd construct prevents us from strposing once there is no
       // longer an $arg to replace.
-      if ($where && $where = strpos($url, '$arg')) {
-        $url = substr_replace($url, $arg, $where, 4);
+      $where = 0;
+      foreach ($tokens as $token) {
+        if ($where = strpos($url, $token)) {
+          $to = strpos($url,"/",$where);
+          $to = ($to)?$to-$where:strlen($url)-$where;
+          break;
+        }
+      }
+      if ($where) {
+        $url = substr_replace($url, $arg, $where, $to);
       }
       else {
         $url .= "/$arg";
@@ -1484,17 +1493,22 @@
     // Add a breadcrumb trail for each level of argument we're at.
     $url = $view->url;
     $args = array();
+    $tokens = array_keys(module_invoke_all('views_url_tokens'));
     $where = 1;
     foreach ($view->args as $level => $arg) {
+      $internal = FALSE;
+      foreach ($tokens as $token) {
+        if ($where = strpos($url, $token)) {
+          $url = substr_replace($url, $arg, $where, strlen($token));
+          $internal = TRUE;
+        }
+      }
       if ($view->argument[$level]['argdefault'] != 1) {
         $breadcrumb[] = l(filter_xss_admin(views_get_title($view, 'page', $args)), $url, NULL, NULL, NULL, NULL, TRUE);
         // For next round.
       }
       $args[] = $arg;
-      if ($where && $where = strpos($url, '$arg')) {
-        $url = substr_replace($url, $arg, $where, 4);
-      }
-      else {
+      if (!$internal) {
         $url .= "/$arg";
       }
     }
