--- token/token_node.inc	2008-06-28 17:10:22.000000000 +0200
+++ token/token_node.inc.patched	2008-07-08 11:07:21.000000000 +0200
@@ -65,25 +65,34 @@
       }
 
       // Now get the menu related information.
-      if (!empty($node->menu['mlid'])) {
+      if (!empty($node->menu['mlid']) or !empty($node->menu['plid'])) {
         $menus = menu_get_menus();
         $menu_name = $node->menu['menu_name'];
         $menu_title = $menus[$menu_name];
-        $trail_raw = _menu_titles($node->menu, $node->nid);
+        $trail_raw = _menu_titles($menu_name, $node->nid);
         $trail = array();
         foreach ($trail_raw as $title) {
           $trail[] = check_plain($title);
         }
-        $values['menupath']     = implode('/', $trail);
-        $values['menupath-raw'] = implode('/', $trail_raw);
-        $values['menu']         = check_plain($menu_title);
-        $values['menu-raw']     = $menu_title;
+
+        // Pop the link title off the end.
+        $link_title = array_pop($trail);
+        $link_title_raw = array_pop($trail_raw);
+
+        $values['menupath']            = implode('/', $trail);
+        $values['menupath-raw']        = implode('/', $trail_raw);
+        $values['menu']                = check_plain($menu_title);
+        $values['menu-raw']            = $menu_title;
+        $values['menu-link-title']     = $link_title;
+        $values['menu-link-title-raw'] = $link_title_raw;
       }
       else {
-        $values['menu']         = '';
-        $values['menu-raw']     = '';
-        $values['menupath']     = '';
-        $values['menupath-raw'] = '';
+        $values['menu']                = '';
+        $values['menu-raw']            = '';
+        $values['menupath']            = '';
+        $values['menupath-raw']        = '';
+        $values['menu-link-title']     = '';
+        $values['menu-link-title-raw'] = '';
       }
 
       // And now taxonomy, which is a bit more work. This code is adapted from
@@ -197,6 +206,8 @@
     $tokens['node']['menu-raw']       = t("The name of the menu the node belongs to. WARNING - raw user input.");
     $tokens['node']['menupath']       = t("The menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /.");
     $tokens['node']['menupath-raw']   = t("The unfiltered menu path (as reflected in the breadcrumb), not including Home or [menu]. Separated by /. WARNING - raw user input.");
+    $tokens['node']['menu-link-title']     = t("The text used in the menu as link text for this item.");
+    $tokens['node']['menu-link-title-raw'] = t("The unfiltered text used in the menu as link text for this item. WARNING - raw user input.");
     return $tokens;
   }
 }
@@ -204,39 +215,33 @@
 /**
  * Return an array of titles for a menu, from the top down to the specified node
  *
- * @param $menu_link
- *   Fully loaded menu link, of node to which a path is desired.
+ * @param $menu_name
+ *   Name of the nodes menu.
  * @param $nid
  *   Id of node.
  * @return
  *   An array of titles through the specified node
  */
-function _menu_titles($menu_link, $nid) {
-  $tree = menu_tree_all_data($menu_link['menu_name'], $menu_link);
-
-  // Get mlid of all nodes in path - top-most parent to leaf node.
-  $parents = array();
-  for ($i = 1; $i < MENU_MAX_DEPTH; $i++) {
-    if ($menu_link["p$i"]) {
-      $parents[] = $menu_link["p$i"];
-    }
+function _menu_titles($menu_name, $nid) {
+  // Get the plid of our target node.
+  $item = db_fetch_array(db_query("SELECT mlid, plid, link_title, menu_name FROM {menu_links} WHERE menu_name = '%s' AND link_path = '%s'", $menu_name, 'node/'. $nid));
+
+  // Not in this menu, or the item was just dissasociated.
+  if (!(bool)$item['mlid']) {
+    return array();
   }
 
-  // Build the titles in this hierarchy.
   $titles = array();
-  $current = array_shift($tree);
-  while ($current) {
-    if (in_array($current['link']['mlid'], $parents)) {
-      $titles[] = $current['link']['title'];
-      if ($current['link']['href'] == "node/". $nid) {
-        break;
-      }
-      // Go deeper in tree hierarchy.
-      $tree = $current['below'];
-    }
-    // Go to next sibling at same level in tree hierarchy.
-    $current = $tree ? array_shift($tree) : NULL;
+  // Include the node link title as well.
+  $titles[] = $item['link_title'];
+  while ($item['plid']) {
+    $item = db_fetch_array(db_query("SELECT mlid, plid, link_title FROM {menu_links} WHERE mlid = %d", $item['plid']));
+    $titles[] = $item['link_title'];
   }
+
+  // Invert the array to return it to path order.
+  $titles = array_reverse($titles);
+
   return $titles;
 }
 
