Index: views.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/views/views.module,v
retrieving revision 1.166.2.46
diff -u -r1.166.2.46 views.module
--- views.module	10 May 2008 19:35:25 -0000	1.166.2.46
+++ views.module	5 Jul 2008 16:00:15 -0000
@@ -709,17 +709,24 @@
  */
 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;
+          }
       }
-      else {
-        $url .= "/$arg";
+      if ($where){
+          $url = substr_replace($url, $arg, $where, $to);
+      } else {
+          $url .= "/$arg";
       }
     }
   }
@@ -1484,17 +1491,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";
       }
     }
