? patches
? token_profile.inc
Index: token.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.module,v
retrieving revision 1.7.4.43
diff -u -p -r1.7.4.43 token.module
--- token.module	1 Nov 2010 03:51:41 -0000	1.7.4.43
+++ token.module	1 Nov 2010 04:25:06 -0000
@@ -39,7 +39,7 @@ function token_help($path, $arg) {
  * Return an array of the core modules supported by token.module.
  */
 function _token_core_supported_modules() {
-  return array('node', 'user', 'taxonomy', 'comment');
+  return array('book', 'comment', 'node', 'system', 'taxonomy', 'user');
 }
 
 /**
@@ -90,93 +90,126 @@ function token_theme() {
 }
 
 /**
- * Implements hook_token_values().
+ * Implements hook_token_list() on behalf of book module.
  */
-function token_token_values($type, $object = NULL) {
-  global $user;
-  $values = array();
+function book_token_list($type = 'all') {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _book_token_list($type);
+}
 
-  switch ($type) {
-    case 'global':
-      // Current user tokens.
-      $values['user-name']    = $user->uid ? $user->name : variable_get('anonymous', t('Anonymous'));
-      $values['user-id']      = $user->uid ? $user->uid : 0;
-      $values['user-mail']    = $user->uid ? $user->mail : '';
-
-      // Site information tokens.
-      $values['site-url']     = url('<front>', array('absolute' => TRUE));
-      $values['site-name']    = check_plain(variable_get('site_name', t('Drupal')));
-      $values['site-slogan']  = check_plain(variable_get('site_slogan', ''));
-      $values['site-mission'] = filter_xss_admin(variable_get('site_mission', ''));
-      $values['site-mail']    = variable_get('site_mail', '');
-      $values += token_get_date_token_values(NULL, 'site-date-');
-
-      // Current page tokens.
-      $values['current-page-title'] = drupal_get_title();
-      $alias = drupal_get_path_alias($_GET['q']);
-      $values['current-page-path-raw'] = $alias;
-      $values['current-page-path'] = check_plain($alias);
-      $values['current-page-url'] = url($_GET['q'], array('absolute' => TRUE));
-
-      $page = isset($_GET['page']) ? $_GET['page'] : '';
-      $pager_page_array = explode(',', $page);
-      $page = $pager_page_array[0];
-      $values['current-page-number'] = (int) $page + 1;
-
-      // Backwards compatability for renamed tokens.
-      $values['site-date'] = $values['site-date-small'];
-      $values['page-number'] = $values['current-page-number'];
+/**
+ * Implements hook_token_values() on behalf of book module.
+ */
+function book_token_values($type, $object = NULL, $options = array()) {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _book_token_values($type, $object, $options);
+}
 
-      break;
-  }
-  return $values;
+/**
+ * Implements hook_token_list() on behalf of comment module.
+ */
+function comment_token_list($type = 'all') {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _comment_token_list($type);
+}
+
+/**
+ * Implements hook_token_values() on behalf of comment module.
+ */
+function comment_token_values($type, $object = NULL, $options = array()) {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _comment_token_values($type, $object, $options);
+}
+
+/**
+ * Implements hook_token_list() on behalf of node module.
+ */
+function node_token_list($type = 'all') {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _node_token_list($type);
+}
+
+/**
+ * Implements hook_token_values() on behalf of node module.
+ */
+function node_token_values($type, $object = NULL, $options = array()) {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _node_token_values($type, $object, $options);
+}
+
+/**
+ * Implements hook_token_list() on behalf of system module.
+ */
+function system_token_list($type = 'all') {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _system_token_list($type);
+}
+
+/**
+ * Implements hook_token_values() on behalf of system module.
+ */
+function system_token_values($type, $object = NULL, $options = array()) {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _system_token_values($type, $object, $options);
+}
+
+/**
+ * Implements hook_token_list() on behalf of taxonomy.module.
+ */
+function taxonomy_token_list($type = 'all') {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _taxonomy_token_list($type);
+}
+
+/**
+ * Implements hook_token_values() on behalf of taxonomy.module.
+ */
+function taxonomy_token_values($type, $object = NULL, $options = array()) {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _taxonomy_token_values($type, $object, $options);
 }
 
 /**
  * Implements hook_token_list().
  */
 function token_token_list($type = 'all') {
-  $tokens = array();
+  module_load_include('inc', 'token', 'token.tokens');
+  return _token_token_list($type);
+}
 
-  if ($type == 'global' || $type == 'all') {
-    // Current user tokens.
-    $tokens['global']['user-name']    = t('The name of the currently logged in user.');
-    $tokens['global']['user-id']      = t('The user ID of the currently logged in user.');
-    $tokens['global']['user-mail']    = t('The email address of the currently logged in user.');
-
-    // Site information tokens.
-    $tokens['global']['site-url']     = t("The URL of the site's front page.");
-    $tokens['global']['site-name']    = t('The name of the site.');
-    $tokens['global']['site-slogan']  = t('The slogan of the site.');
-    $tokens['global']['site-mission'] = t("The optional 'mission' of the site.");
-    $tokens['global']['site-mail']    = t('The administrative email address for the site.');
-    $tokens['global'] += token_get_date_token_info(t('The current'), 'site-date-');
-
-    // Current page tokens.
-    $tokens['global']['current-page-title']    = t('The title of the current page.');
-    $tokens['global']['current-page-path']     = t('The URL alias of the current page.');
-    $tokens['global']['current-page-path-raw'] = t('The URL alias of the current page.');
-    $tokens['global']['current-page-url']      = t('The URL of the current page.');
-    $tokens['global']['current-page-number']   = t('The page number of the current page when viewing paged lists.');
-  }
+/**
+ * Implements hook_token_values().
+ */
+function token_token_values($type, $object = NULL, $options = array()) {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _token_token_values($type, $object, $options);
+}
 
-  return $tokens;
+/**
+ * Implements hook_token_list() on behalf of user.module.
+ */
+function user_token_list($type = 'all') {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _token_token_list($type);
 }
 
 /**
- * General function to include the files that token relies on for the real work.
+ * Implements hook_token_values() on behalf of user.module.
  */
-function token_include() {
-  static $run = FALSE;
+function user_token_values($type, $object = NULL, $options = array()) {
+  module_load_include('inc', 'token', 'token.tokens');
+  return _user_token_values($type, $object, $options);
+}
 
-  if (!$run) {
-    $run = TRUE;
-    $modules_enabled = array_keys(module_list());
-    $modules = array_intersect(_token_core_supported_modules(), $modules_enabled);
-    foreach ($modules as $module) {
-      module_load_include('inc', 'token', "token_$module");
-    }
-  }
+/**
+ * Deprecated function that is no longer necessary.
+ *
+ * This function only exists for backwards-compatability.
+ *
+ * @deprecated
+ */
+function token_include() {
+  return;
 }
 
 /**
@@ -340,8 +373,6 @@ function token_get_values($type = 'globa
 
   $running = TRUE;
 
-  token_include();
-
   $id = _token_get_id($type, $object);
   if ($id && isset($tokens[$type][$id])) {
     $tmp_tokens = $tokens[$type][$id];
@@ -388,7 +419,6 @@ function token_get_values($type = 'globa
  *   token type.
  */
 function token_get_list($types = 'all') {
-  token_include();
   $return = array();
   settype($types, 'array');
   foreach (module_implements('token_list') as $module) {
@@ -667,7 +697,6 @@ function token_element_validate_token_co
  * Find tokens that have been declared twice by different modules.
  */
 function token_find_duplicate_tokens() {
-  token_include();
   $all_tokens = array();
 
   foreach (module_implements('token_list') as $module) {
Index: token.pages.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.pages.inc,v
retrieving revision 1.7.2.8
diff -u -p -r1.7.2.8 token.pages.inc
--- token.pages.inc	18 Oct 2010 16:17:38 -0000	1.7.2.8
+++ token.pages.inc	1 Nov 2010 04:25:06 -0000
@@ -22,7 +22,6 @@
  * @ingroup themeable
  */
 function theme_token_help($types = 'all', $prefix = TOKEN_PREFIX, $suffix = TOKEN_SUFFIX) {
-  token_include();
   $full_list = token_get_list($types);
 
   $headers = array(t('Token'), t('Replacement value'));
Index: token.tokens.inc
===================================================================
RCS file: token.tokens.inc
diff -N token.tokens.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ token.tokens.inc	1 Nov 2010 04:25:06 -0000
@@ -0,0 +1,619 @@
+<?php
+// $Id$
+
+/**
+ * Implements hook_token_list().
+ */
+function _book_token_list($type) {
+  $tokens = array();
+
+  if ($type == 'node' || $type == 'all') {
+    $tokens['book']['book']         = t("The title of the node's book parent.");
+    $tokens['book']['book_id']      = t("The id of the node's book parent.");
+    $tokens['book']['bookpath']     = t("The titles of all parents in the node's book hierarchy.");
+    $tokens['book']['book-raw']     = t("The unfiltered title of the node's book parent.");
+    $tokens['book']['bookpath-raw'] = t("The unfiltered titles of all parents in the node's book hierarchy.");
+  }
+
+  return $tokens;
+}
+
+/**
+ * Implements hook_token_values().
+ */
+function _book_token_values($type, $object = NULL, $options = array()) {
+  if ($type == 'node' && !empty($object)) {
+    $node = $object;
+
+    // Initialize some variables to empty.
+    $tokens['book'] = '';
+    $tokens['book-raw'] = '';
+    $tokens['book_id'] = '';
+    $tokens['bookpath'] = '';
+    $tokens['bookpath-raw'] = '';
+
+    if (!empty($node->book['menu_name'])) {
+      $menus = menu_get_menus();
+      $trail_raw = _menu_titles($node->book, $node->nid);
+      $book_raw = $trail_raw[0];
+      $book = check_plain($book_raw);
+      // For book paths, we don't include the current node's title (last in
+      // the array) in the trail.
+      array_pop($trail_raw);
+      $trail = array();
+      foreach ($trail_raw as $title) {
+        $trail[] = check_plain($title);
+      }
+      $tokens = array();
+      $tokens['book'] = $book;
+      $tokens['book-raw'] = $book_raw;
+      $tokens['book_id'] = $node->book['bid'];
+      $tokens['bookpath'] = !empty($options['pathauto']) ? $trail : implode('/', $trail);
+      $tokens['bookpath-raw'] = !empty($options['pathauto']) ? $trail_raw : implode('/', $trail_raw);
+    }
+
+    return $tokens;
+  }
+}
+
+/**
+ * Implements hook_token_list().
+ */
+function _comment_token_list($type = 'all') {
+  $tokens = array();
+
+  if ($type == 'comment' || $type == 'all') {
+    $tokens['comment']['comment-cid']             = t('The unique ID of the comment.');
+    $tokens['comment']['comment-nid']             = t('The unique ID of the node the comment was posted to.');
+    $tokens['comment']['comment-title']           = t('The title of the comment.');
+    $tokens['comment']['comment-title-raw']       = t('The title of the comment.');
+    $tokens['comment']['comment-body']            = t('The formatted content of the comment itself.');
+    $tokens['comment']['comment-body-raw']        = t('The formatted content of the comment itself.');
+
+    $tokens['comment']['comment-author-uid']      = t('The unique ID of the author of the comment.');
+    $tokens['comment']['comment-author-name']     = t('The name left by the comment author.');
+    $tokens['comment']['comment-author-name-raw'] = t('The name left by the comment author.');
+    $tokens['comment']['comment-author-homepage'] = t('The home page URL left by the comment author.');
+    $tokens['comment']['comment-author-mail']     = t('The email address left by the comment author.');
+    $tokens['comment']['comment-author-mail-raw'] = t('The email address left by the comment author.');
+
+    $tokens['comment'] += token_get_date_token_info(t('Comment creation'), 'comment-');
+
+    $tokens['comment']['comment-node-title']      = t('The title of the node the comment was posted to.');
+    $tokens['comment']['comment-node-title-raw']  = t('The title of the node the comment was posted to.');
+  }
+
+  if ($type == 'node' || $type == 'all') {
+    $tokens['node']['node_comment_count']   = t("The number of comments posted on a node.");
+    $tokens['node']['unread_comment_count'] = t("The number of comments posted on a node since the reader last viewed it.");
+  }
+
+  return $tokens;
+}
+
+/**
+ * Implements hook_token_values().
+ */
+function _comment_token_values($type, $object = NULL, $options = array()) {
+  $values = array();
+
+  if ($type == 'comment' && !empty($object)) {
+    // Drupal sometimes provides comments as arrays, so explicitly cast this
+    // to an object.
+    $comment = (object) $object;
+
+    $values['comment-cid']             = $comment->cid;
+    $values['comment-nid']             = $comment->nid;
+    $values['comment-title']           = check_plain($comment->subject);
+    $values['comment-body']            = check_markup($comment->comment, $comment->format, FALSE);
+    $values['comment-author-name']     = check_plain($comment->name);
+    $values['comment-author-uid']      = $comment->uid;
+    $values['comment-author-homepage'] = check_url($comment->homepage);
+
+    // Raw counterparts of user supplied data.
+    $values['comment-title-raw']       = $comment->subject;
+    $values['comment-body-raw']        = $comment->comment;
+    $values['comment-author-name-raw'] = $comment->name;
+
+    if (!empty($comment->mail)) {
+      $account_mail = $comment->mail;
+    }
+    elseif (!empty($comment->uid)) {
+      $account_mail = db_result(db_query("SELECT mail FROM {users} WHERE uid = %d", $comment->uid));
+    }
+    else {
+      $account_mail = '';
+    }
+    $values['comment-author-mail']     = check_plain($account_mail);
+    $values['comment-author-mail-raw'] = $account_mail;
+
+    // Included in case a consuming module wants to format the body
+    $values['comment-body-format']     = $comment->format;
+
+    $values += token_get_date_token_values($comment->timestamp, 'comment-');
+
+    $values['comment-node-title-raw']  = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $comment->nid));
+    $values['comment-node-title']      = check_plain($values['comment-node-title-raw']);
+  }
+
+  if ($type == 'node' && !empty($object)) {
+    $node = $object;
+
+    $values['node_comment_count'] = isset($node->comment_count) ? $node->comment_count : 0;
+    $values['unread_comment_count'] = comment_num_new($node->nid);
+  }
+
+  return $values;
+}
+
+/**
+ * Implements hook_token_list().
+ */
+function _node_token_list($type = 'all') {
+  $tokens = array();
+
+  if ($type == 'node' || $type == 'all') {
+    $tokens['node']['nid']             = t('The unique ID of the content item, or "node".');
+    $tokens['node']['type']            = t('The type of the node.');
+    $tokens['node']['type-name']       = t('The human-readable name of the node type.');
+    $tokens['node']['language']        = t('The language the node is written in.');
+    $tokens['node']['title']           = t('The title of the node.');
+    $tokens['node']['title-raw']       = t('The title of the node.');
+    $tokens['node']['node-path']       = t('The URL alias of the node.');
+    $tokens['node']['node-path-raw']   = t('The URL alias of the node.');
+    $tokens['node']['node-url']        = t('The URL of the node.');
+
+    $tokens['node']['author-uid']      = t("The unique ID of the author of the node.");
+    $tokens['node']['author-name']     = t("The login name of the author of the node.");
+    $tokens['node']['author-name-raw'] = t("The login name of the author of the node.");
+    $tokens['node']['author-mail']     = t("The email address of the author of the node.");
+    $tokens['node']['author-mail-raw'] = t("The email address of the author of the node.");
+
+    $tokens['node']['log']     = t('The explanation of the most recent changes made to the node.');
+    $tokens['node']['log-raw'] = t('The explanation of the most recent changes made to the node.');
+
+    $tokens['node'] += token_get_date_token_info(t('Node creation'));
+    $tokens['node'] += token_get_date_token_info(t('Node modification'), 'mod-');
+
+    if (module_exists('taxonomy')) {
+      $tokens['node']['term']            = t("Name of top taxonomy term");
+      $tokens['node']['term-raw']        = t("Unfiltered name of top taxonomy term.");
+      $tokens['node']['term-id']         = t("ID of top taxonomy term");
+      $tokens['node']['vocab']           = t("Name of top term's vocabulary");
+      $tokens['node']['vocab-raw']       = t("Unfiltered name of top term's vocabulary.");
+      $tokens['node']['vocab-id']        = t("ID of top term's vocabulary");
+      // Temporarily disabled -- see notes in node_token_values.
+      // $tokens['node']['catpath']        = t("Full taxonomy tree for the topmost term");
+    }
+
+    if (module_exists('menu')) {
+      $tokens['node']['menu']                = t("The name of the menu the node belongs to.");
+      $tokens['node']['menu-raw']            = t("The name of the menu the node belongs to.");
+      $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 /.");
+      $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.");
+      $tokens['node']['menu-link-mlid']      = t("The unique ID of the node's menu link.");
+      $tokens['node']['menu-link-plid']      = t("The unique ID of the node's menu link parent.");
+    }
+  }
+
+  return $tokens;
+}
+
+/**
+ * Implements hook_token_values().
+ */
+function _node_token_values($type, $object = NULL, $options = array()) {
+  $values = array();
+
+  if ($type == 'node' && !empty($object)) {
+    $node = $object;
+    $account = user_load(array('uid' => $node->uid));
+
+    // Adjust for the anonymous user name.
+    if (!$node->uid && !$account->name) {
+      $account->name = variable_get('anonymous', t('Anonymous'));
+    }
+
+    $values['nid']                = $node->nid;
+    $values['type']               = $node->type;
+    $values['type-name']          = node_get_types('name', $node->type);
+    $values['language']           = filter_xss_admin($node->language);
+    $values['title']              = check_plain($node->title);
+    $values['title-raw']          = $node->title;
+    $values['node-path-raw']      = drupal_get_path_alias('node/'. $node->nid);
+    $values['node-path']          = check_plain($values['node-path-raw']);
+    $values['node-url']           = url('node/' . $node->nid, array('absolute' => TRUE));
+    $values['author-uid']         = $node->uid;
+    $values['author-name']        = check_plain($account->name);
+    $values['author-name-raw']    = $account->name;
+    $values['author-mail']        = check_plain($account->mail);
+    $values['author-mail-raw']    = $account->mail;
+
+    $values['log-raw']            = isset($node->log) ? $node->log : '';
+    $values['log']                = filter_xss($values['log-raw']);
+
+    if (isset($node->created)) {
+      $values += token_get_date_token_values($node->created);
+    }
+
+    if (isset($node->changed)) {
+      $values += token_get_date_token_values($node->changed, 'mod-');
+    }
+
+    // Try to get the menu data.
+    $mlid = db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s'", 'node/'. $node->nid));
+
+    // Now get the menu related information.
+    if (!empty($mlid) || !empty($node->menu['mlid']) || !empty($node->menu['plid'])) {
+      $menu_link = menu_link_load($mlid);
+      $menus = menu_get_menus();
+      $menu = isset($menus[$menu_link['menu_name']]) ? $menus[$menu_link['menu_name']] : '';
+      $trail_raw = _menu_titles($menu_link, $node->nid);
+
+      $trail = array();
+      foreach ($trail_raw as $title) {
+        $trail[] = check_plain($title);
+      }
+
+      $values['menupath']            = !empty($options['pathauto']) ? $trail : implode('/', $trail);
+      $values['menupath-raw']        = !empty($options['pathauto']) ? $trail_raw : implode('/', $trail_raw);
+      $values['menu']                = check_plain($menu);
+      $values['menu-raw']            = $menu;
+      $values['menu-link-title']     = check_plain($menu_link['title']);
+      $values['menu-link-title-raw'] = $menu_link['link_title'];
+      $values['menu-link-mlid']      = $menu_link['mlid'];
+      $values['menu-link-plid']      = $menu_link['plid'];
+    }
+    else {
+      $values['menu']                = '';
+      $values['menu-raw']            = '';
+      $values['menupath']            = '';
+      $values['menupath-raw']        = '';
+      $values['menu-link-title']     = '';
+      $values['menu-link-title-raw'] = '';
+      $values['menu-link-mlid']      = '';
+      $values['menu-link-plid']      = '';
+    }
+
+    // And now taxonomy, which is a bit more work. This code is adapted from
+    // pathauto's handling code; it's intended for compatibility with it.
+    if (module_exists('taxonomy') && !empty($node->taxonomy) && is_array($node->taxonomy)) {
+      foreach ($node->taxonomy as $term) {
+        $original_term = $term;
+        if ((object)$term) {
+          // With free-tagging it's somewhat hard to get the tid, vid, name values
+          // Rather than duplicating taxonomy.module code here you should make sure your calling module
+          // has a weight of at least 1 which will run after taxonomy has saved the data which allows us to
+          // pull it out of the db here.
+          if (!isset($term->name) || !isset($term->tid)) {
+            $vid = db_result(db_query_range("SELECT t.vid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name", $object->nid, 0, 1));
+            if (!$vid) {
+              continue;
+            }
+            $term = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.vid = %d ORDER BY t.weight", $vid, $object->vid, 0, 1));
+            $term->vid = $vid;
+          }
+
+          // Ok, if we still don't have a term name maybe this is a pre-taxonomy submit node
+          // So if it's a number we can get data from it
+          if (!isset($term->name) && is_array($original_term)) {
+            $tid = array_shift($original_term);
+            if (is_numeric($tid)) {
+              $term = taxonomy_get_term($tid);
+            }
+          }
+          $values['term'] = check_plain($term->name);
+          $values['term-raw'] = $term->name;
+          $values['term-id'] = $term->tid;
+          $vid = $term->vid;
+
+          if (!empty($vid)) {
+            $vocabulary = taxonomy_vocabulary_load($vid);
+            $values['vocab'] = check_plain($vocabulary->name);
+            $values['vocab-raw'] = $vocabulary->name;
+            $values['vocab-id'] = $vocabulary->vid;
+          }
+
+          // The 'catpath' (and 'cat') tokens have been removed, as they caused quite a bit of confusion,
+          // and the catpath was a relatively expensive query when the taxonomy tree was deep.
+          //
+          // It existed only to provide forward-compatability with pathauto module, and
+          // for most uses of token.module, it was a relatively useless token -- it exposed
+          // a list of term names formatted as a URL/path string. Once pathauto supports
+          // tokens, *it* should handle this catpath alias as it's the primary consumer.
+          break;
+        }
+      }
+    }
+    // It's possible to leave that block and still not have good data.
+    // So, we test for these and if not set, set them.
+    if (!isset($values['term'])) {
+      $values['term'] = '';
+      $values['term-raw'] = '';
+      $values['term-id'] = '';
+      $values['vocab'] = '';
+      $values['vocab-raw'] = '';
+      $values['vocab-id'] = '';
+    }
+  }
+
+  return $values;
+}
+
+/**
+ * Implements hook_token_list().
+ */
+function _system_token_list($type = 'all') {
+  $tokens = array();
+
+  if ($type == 'global' || $type == 'all') {
+    // Site information tokens.
+    $tokens['global']['site-url']     = t("The URL of the site's front page.");
+    $tokens['global']['site-name']    = t('The name of the site.');
+    $tokens['global']['site-slogan']  = t('The slogan of the site.');
+    $tokens['global']['site-mission'] = t("The optional 'mission' of the site.");
+    $tokens['global']['site-mail']    = t('The administrative email address for the site.');
+    $tokens['global'] += token_get_date_token_info(t('The current'), 'site-date-');
+  }
+
+  return $tokens;
+}
+
+/**
+ * Implements hook_token_values().
+ */
+function _system_token_values($type, $object = NULL, $options = array()) {
+  $values = array();
+
+  if ($type == 'global') {
+    // Site information tokens.
+    $values['site-url']     = url('<front>', array('absolute' => TRUE));
+    $values['site-name']    = check_plain(variable_get('site_name', t('Drupal')));
+    $values['site-slogan']  = check_plain(variable_get('site_slogan', ''));
+    $values['site-mission'] = filter_xss_admin(variable_get('site_mission', ''));
+    $values['site-mail']    = variable_get('site_mail', '');
+    $values += token_get_date_token_values(NULL, 'site-date-');
+
+    // Backwards compatability for renamed tokens.
+    $values['site-date'] = $values['site-date-small'];
+  }
+
+  return $values;
+}
+
+/**
+ * Implements hook_token_list().
+ */
+function _taxonomy_token_list($type = 'all') {
+  $tokens = array();
+
+  if ($type == 'taxonomy' || $type == 'all') {
+    $tokens['taxonomy']['tid'] = t('The id number of the category.');
+    $tokens['taxonomy']['cat'] = t('The name of the category.');
+    $tokens['taxonomy']['cat-raw'] = t('The unfiltered name of the category.');
+    $tokens['taxonomy']['cat-description'] = t('The optional description of the taxonomy term.');
+    $tokens['taxonomy']['vid'] = t("The id number of the category's parent vocabulary.");
+    $tokens['taxonomy']['vocab'] = t("The vocabulary that the page's first category belongs to.");
+    $tokens['taxonomy']['vocab-raw'] = t("The unfiltered vocabulary that the page's first category belongs to.");
+    $tokens['taxonomy']['vocab-description'] = t('The optional description of the taxonomy vocabulary.');
+  }
+
+  return $tokens;
+}
+
+/**
+ * Implements hook_token_values().
+ */
+function _taxonomy_token_values($type, $object = NULL, $options = array()) {
+  $values = array();
+
+  if ($type == 'taxonomy' && !empty($object)) {
+    // Drupal sometimes provides taxonomy terms as arrays, so explicitly cast
+    // this to an object.
+    $term = (object) $object;
+    $vocabulary = taxonomy_vocabulary_load($term->vid);
+
+    $values['tid'] = $term->tid;
+    $values['cat'] = check_plain($term->name);
+    $values['cat-raw'] = $term->name;
+    $values['cat-description'] = filter_xss($term->description);
+    $values['vid'] = $term->vid;
+    $values['vocab'] = check_plain($vocabulary->name);
+    $values['vocab-raw'] = $vocabulary->name;
+    $values['vocab-description'] = filter_xss($vocabulary->description);
+  }
+
+  return $values;
+}
+
+/**
+ * Implements hook_token_list().
+ */
+function _token_token_list($type = 'all') {
+  $tokens = array();
+
+  if ($type == 'global' || $type == 'all') {
+    // Current page tokens.
+    $tokens['global']['current-page-title']    = t('The title of the current page.');
+    $tokens['global']['current-page-path']     = t('The URL alias of the current page.');
+    $tokens['global']['current-page-path-raw'] = t('The URL alias of the current page.');
+    $tokens['global']['current-page-url']      = t('The URL of the current page.');
+    $tokens['global']['current-page-number']   = t('The page number of the current page when viewing paged lists.');
+  }
+
+  return $tokens;
+}
+
+/**
+ * Implements hook_token_values().
+ */
+function _token_token_values($type, $object = NULL, $options = array()) {
+  global $user;
+  $values = array();
+
+  if ($type == 'global') {
+    // Current page tokens.
+    $values['current-page-title'] = drupal_get_title();
+    $alias = drupal_get_path_alias($_GET['q']);
+    $values['current-page-path-raw'] = $alias;
+    $values['current-page-path'] = check_plain($alias);
+    $values['current-page-url'] = url($_GET['q'], array('absolute' => TRUE));
+
+    $page = isset($_GET['page']) ? $_GET['page'] : '';
+    $pager_page_array = explode(',', $page);
+    $page = $pager_page_array[0];
+    $values['current-page-number'] = (int) $page + 1;
+
+    // Backwards compatability for renamed tokens.
+    $values['page-number'] = $values['current-page-number'];
+  }
+
+  return $values;
+}
+
+/**
+ * Implements hook_token_list().
+ */
+function _user_token_list($type = 'all') {
+  $tokens = array();
+
+  if ($type == 'global' || $type == 'all') {
+    // Current user tokens.
+    $tokens['global']['user-name'] = t('The name of the currently logged in user.');
+    $tokens['global']['user-id']   = t('The user ID of the currently logged in user.');
+    $tokens['global']['user-mail'] = t('The email address of the currently logged in user.');
+  }
+
+  if ($type == 'user' || $type == 'all') {
+    $tokens['user']['user']     = t("The login name of the user account.");
+    $tokens['user']['user-raw'] = t("The login name of the user account.");
+    $tokens['user']['uid']      = t("The unique ID of the user account.");
+    $tokens['user']['mail']     = t("The email address of the user account.");
+
+    $tokens['user'] += token_get_date_token_info(t("User's registration"), 'user-created-');
+    $tokens['user'] += token_get_date_token_info(t("User's last login"), 'user-last-login-');
+    $tokens['user']['date-in-tz'] = t("The current date in the user's timezone.");
+
+    $tokens['user']['account-url']      = t("The URL of the account profile page.");
+    $tokens['user']['account-edit-url'] = t("The URL of the account edit page.");
+  }
+
+  return $tokens;
+}
+
+/**
+ * Implements hook_token_values().
+ */
+function _user_token_values($type, $object = NULL, $options = array()) {
+  global $user;
+  $values = array();
+
+  if ($type == 'global') {
+    // Current user tokens.
+    $values['user-name'] = $user->uid ? $user->name : variable_get('anonymous', t('Anonymous'));
+    $values['user-id']   = $user->uid ? $user->uid : 0;
+    $values['user-mail'] = $user->uid ? $user->mail : '';
+  }
+
+  if ($type == 'user') {
+    $account = !empty($object) ? $object : user_load(array('uid' => $user->uid));
+
+    // Adjust for the anonymous user name.
+    if (!$account->uid && !isset($account->name)) {
+      $account->name = variable_get('anonymous', 'Anonymous');
+    }
+
+    $values['user']     = check_plain($account->name);
+    $values['user-raw'] = $account->name;
+    $values['uid']      = $account->uid;
+    $values['mail']     = $account->uid ? $account->mail : '';
+
+    if ($account->uid) {
+      $values += token_get_date_token_values($account->created, 'user-created-');
+      $values += token_get_date_token_values($account->access, 'user-last-login-');
+      $values['reg-date'] = $values['user-created-small'];
+      $values['reg-since'] = $values['user-created-since'];
+      $values['log-date'] = $values['user-last-login-small'];
+      $values['log-since'] = $values['user-last-login-since'];
+      $values['date-in-tz'] = $account->uid ? format_date(time(), 'small', '', $account->timezone) : '';
+    }
+
+    $values['account-url']      = $account->uid ? url("user/$account->uid", array('absolute' => TRUE)) : '';
+    $values['account-edit-url'] = $account->uid ? url("user/$account->uid/edit", array('absolute' => TRUE)) : '';
+    $values['account-edit']     = $values['account-edit-url'];
+  }
+
+  return $values;
+}
+
+/**
+ * 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 $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"];
+    }
+  }
+
+  // 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;
+  }
+  return $titles;
+}
+
+/**
+ * Check if mid/path is present in the menu.
+ *
+ * @param $in
+ *   Numeric input is treated as a menu-id, strings as src-paths.
+ * @return
+ *   An existing mid, or 0 if none found.
+ */
+function token_menu_get_mid($in) {
+  global $_menu;
+
+  if (!is_numeric($in)) {
+    if (isset($_menu['path index'][$in])) {
+      $mid = $_menu['path index'][$in];
+    }
+    else {
+      $mid = 0;
+    }
+  }
+  else if (!isset($_menu['visible'][$in])) {
+    $mid = 0;
+  }
+
+  // Temporary paths would break much of this module.
+  if ($mid < 0) {
+    $mid = 0;
+  }
+
+  return $mid;
+}
Index: token_comment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/Attic/token_comment.inc,v
retrieving revision 1.3.4.11
diff -u -p -r1.3.4.11 token_comment.inc
--- token_comment.inc	8 Jul 2010 00:41:19 -0000	1.3.4.11
+++ token_comment.inc	1 Nov 2010 04:25:06 -0000
@@ -3,90 +3,5 @@
 
 /**
  * @file
- * Implementations of token module hooks for the core comment module.
- *
- * The token module requires specific hooks to be added to modules
- * so that those modules can return data about their objects to the
- * token API.  Until and unless token becomes a part of core, the
- * implementations of the token hooks for core modules are provided
- * in the token module itself.
- * @ingroup token
+ * The comment tokens have been moved to token.tokens.inc.
  */
-
-/**
- * Implementation of hook_token_values().
- */
-function comment_token_values($type, $object = NULL, $options = array()) {
-  $values = array();
-  switch ($type) {
-    case 'comment':
-
-      // Cast to an object just in case fussy Drupal gave us an array
-      $comment = (object)$object;
-
-      $values['comment-cid']             = $comment->cid;
-      $values['comment-nid']             = $comment->nid;
-      $values['comment-title']           = check_plain($comment->subject);
-      $values['comment-body']            = check_markup($comment->comment, $comment->format, FALSE);
-      $values['comment-author-name']     = check_plain($comment->name);
-      $values['comment-author-uid']      = $comment->uid;
-      $values['comment-author-homepage'] = check_url($comment->homepage);
-
-      // Raw counterparts of user supplied data.
-      $values['comment-title-raw']       = $comment->subject;
-      $values['comment-body-raw']        = $comment->comment;
-      $values['comment-author-name-raw'] = $comment->name;
-
-      if (!empty($comment->mail)) {
-        $account_mail = $comment->mail;
-      }
-      elseif (!empty($comment->uid)) {
-        $account_mail = db_result(db_query("SELECT mail FROM {users} WHERE uid = %d", $comment->uid));
-      }
-      else {
-        $account_mail = '';
-      }
-      $values['comment-author-mail']     = check_plain($account_mail);
-      $values['comment-author-mail-raw'] = $account_mail;
-
-      // Included in case a consuming module wants to format the body
-      $values['comment-body-format']     = $comment->format;
-
-      $values += token_get_date_token_values($comment->timestamp, 'comment-');
-
-      $values['comment-node-title-raw']  = db_result(db_query("SELECT title FROM {node} WHERE nid = %d", $comment->nid));
-      $values['comment-node-title']      = check_plain($values['comment-node-title-raw']);
-      break;
-  }
-
-  return $values;
-}
-
-/**
- * Implementation of hook_token_list().
- */
-function comment_token_list($type = 'all') {
-  if ($type == 'comment' || $type == 'all') {
-    $tokens['comment']['comment-cid']             = t('The unique ID of the comment.');
-    $tokens['comment']['comment-nid']             = t('The unique ID of the node the comment was posted to.');
-    $tokens['comment']['comment-title']           = t('The title of the comment.');
-    $tokens['comment']['comment-title-raw']       = t('The title of the comment.');
-    $tokens['comment']['comment-body']            = t('The formatted content of the comment itself.');
-    $tokens['comment']['comment-body-raw']        = t('The formatted content of the comment itself.');
-
-    $tokens['comment']['comment-author-uid']      = t('The unique ID of the author of the comment.');
-    $tokens['comment']['comment-author-name']     = t('The name left by the comment author.');
-    $tokens['comment']['comment-author-name-raw'] = t('The name left by the comment author.');
-    $tokens['comment']['comment-author-homepage'] = t('The home page URL left by the comment author.');
-
-    $tokens['comment']['comment-author-mail']     = t('The email address left by the comment author.');
-    $tokens['comment']['comment-author-mail-raw'] = t('The email address left by the comment author.');
-
-    $tokens['comment'] += token_get_date_token_info(t('Comment creation'), 'comment-');
-
-    $tokens['comment']['comment-node-title']      = t('The title of the node the comment was posted to.');
-    $tokens['comment']['comment-node-title-raw']  = t('The title of the node the comment was posted to.');
-
-    return $tokens;
-  }
-}
Index: token_node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/Attic/token_node.inc,v
retrieving revision 1.5.4.32
diff -u -p -r1.5.4.32 token_node.inc
--- token_node.inc	31 Oct 2010 20:09:14 -0000	1.5.4.32
+++ token_node.inc	1 Nov 2010 04:25:06 -0000
@@ -3,344 +3,5 @@
 
 /**
  * @file
- * Implementations of token module hooks for the core node and book modules.
- *
- * The token module requires specific hooks to be added to modules
- * so that those modules can return data about their objects to the
- * token API.  Until and unless token becomes a part of core, the
- * implementations of the token hooks for core modules are provided
- * in the token module itself.
- *
- * @ingroup token
+ * The node tokens have been moved to token.tokens.inc.
  */
-
-/**
- * Implementation of hook_token_values().
- */
-function node_token_values($type, $object = NULL, $options = array()) {
-  $values = array();
-  switch ($type) {
-    case 'node':
-      $node = $object;
-      $account = db_fetch_object(db_query("SELECT name, mail FROM {users} WHERE uid = %d", $node->uid));
-
-      // Adjust for the anonymous user name.
-      if (!$node->uid && !$account->name) {
-        $account->name = variable_get('anonymous', t('Anonymous'));
-      }
-
-      $values['nid']                = $node->nid;
-      $values['type']               = $node->type;
-      $values['type-name']          = node_get_types('name', $node->type);
-      $values['language']           = filter_xss_admin($node->language);
-      $values['title']              = check_plain($node->title);
-      $values['title-raw']          = $node->title;
-      $values['node-path-raw']      = drupal_get_path_alias('node/'. $node->nid);
-      $values['node-path']          = check_plain($values['node-path-raw']);
-      $values['node-url']           = url('node/' . $node->nid, array('absolute' => TRUE));
-      $values['author-uid']         = $node->uid;
-      $values['author-name']        = check_plain($account->name);
-      $values['author-name-raw']    = $account->name;
-      $values['author-mail']        = check_plain($account->mail);
-      $values['author-mail-raw']    = $account->mail;
-
-      $values['log-raw']            = isset($node->log) ? $node->log : '';
-      $values['log']                = filter_xss($values['log-raw']);
-
-      if (module_exists('comment')) {
-        $values['node_comment_count'] = isset($node->comment_count) ? $node->comment_count : 0;
-        $values['unread_comment_count'] = comment_num_new($node->nid);
-      }
-      else {
-        $values['node_comment_count'] = 0;
-        $values['unread_comment_count'] = 0;
-      }
-
-      if (isset($node->created)) {
-        $values += token_get_date_token_values($node->created);
-      }
-
-      if (isset($node->changed)) {
-        $values += token_get_date_token_values($node->changed, 'mod-');
-      }
-
-      // Try to get the menu data.
-      $mlid = db_result(db_query("SELECT mlid FROM {menu_links} WHERE link_path = '%s'", 'node/'. $node->nid));
-
-      // Now get the menu related information.
-      if (!empty($mlid) || !empty($node->menu['mlid']) || !empty($node->menu['plid'])) {
-        $menu_link = menu_link_load($mlid);
-        $menus = menu_get_menus();
-        $menu = isset($menus[$menu_link['menu_name']]) ? $menus[$menu_link['menu_name']] : '';
-        $trail_raw = _menu_titles($menu_link, $node->nid);
-
-        $trail = array();
-        foreach ($trail_raw as $title) {
-          $trail[] = check_plain($title);
-        }
-
-        $values['menupath']            = !empty($options['pathauto']) ? $trail : implode('/', $trail);
-        $values['menupath-raw']        = !empty($options['pathauto']) ? $trail_raw : implode('/', $trail_raw);
-        $values['menu']                = check_plain($menu);
-        $values['menu-raw']            = $menu;
-        $values['menu-link-title']     = check_plain($menu_link['title']);
-        $values['menu-link-title-raw'] = $menu_link['link_title'];
-        $values['menu-link-mlid']      = $menu_link['mlid'];
-        $values['menu-link-plid']      = $menu_link['plid'];
-      }
-      else {
-        $values['menu']                = '';
-        $values['menu-raw']            = '';
-        $values['menupath']            = '';
-        $values['menupath-raw']        = '';
-        $values['menu-link-title']     = '';
-        $values['menu-link-title-raw'] = '';
-        $values['menu-link-mlid']      = '';
-        $values['menu-link-plid']      = '';
-      }
-
-      // And now taxonomy, which is a bit more work. This code is adapted from
-      // pathauto's handling code; it's intended for compatibility with it.
-      if (module_exists('taxonomy') && !empty($node->taxonomy) && is_array($node->taxonomy)) {
-        foreach ($node->taxonomy as $term) {
-          $original_term = $term;
-          if ((object)$term) {
-            // With free-tagging it's somewhat hard to get the tid, vid, name values
-            // Rather than duplicating taxonomy.module code here you should make sure your calling module
-            // has a weight of at least 1 which will run after taxonomy has saved the data which allows us to
-            // pull it out of the db here.
-            if (!isset($term->name) || !isset($term->tid)) {
-              $vid = db_result(db_query_range("SELECT t.vid FROM {term_node} r INNER JOIN {term_data} t ON r.tid = t.tid INNER JOIN {vocabulary} v ON t.vid = v.vid WHERE r.nid = %d ORDER BY v.weight, t.weight, t.name", $object->nid, 0, 1));
-              if (!$vid) {
-                continue;
-              }
-              $term = db_fetch_object(db_query_range("SELECT t.tid, t.name FROM {term_data} t INNER JOIN {term_node} r ON r.tid = t.tid WHERE t.vid = %d AND r.vid = %d ORDER BY t.weight", $vid, $object->vid, 0, 1));
-              $term->vid = $vid;
-            }
-
-            // Ok, if we still don't have a term name maybe this is a pre-taxonomy submit node
-            // So if it's a number we can get data from it
-            if (!isset($term->name) && is_array($original_term)) {
-              $tid = array_shift($original_term);
-              if (is_numeric($tid)) {
-                $term = taxonomy_get_term($tid);
-              }
-            }
-            $values['term'] = check_plain($term->name);
-            $values['term-raw'] = $term->name;
-            $values['term-id'] = $term->tid;
-            $vid = $term->vid;
-
-            if (!empty($vid)) {
-              $vocabulary = taxonomy_vocabulary_load($vid);
-              $values['vocab'] = check_plain($vocabulary->name);
-              $values['vocab-raw'] = $vocabulary->name;
-              $values['vocab-id'] = $vocabulary->vid;
-            }
-
-            // The 'catpath' (and 'cat') tokens have been removed, as they caused quite a bit of confusion,
-            // and the catpath was a relatively expensive query when the taxonomy tree was deep.
-            //
-            // It existed only to provide forward-compatability with pathauto module, and
-            // for most uses of token.module, it was a relatively useless token -- it exposed
-            // a list of term names formatted as a URL/path string. Once pathauto supports
-            // tokens, *it* should handle this catpath alias as it's the primary consumer.
-            break;
-          }
-        }
-      }
-      // It's possible to leave that block and still not have good data.
-      // So, we test for these and if not set, set them.
-      if (!isset($values['term'])) {
-        $values['term'] = '';
-        $values['term-raw'] = '';
-        $values['term-id'] = '';
-        $values['vocab'] = '';
-        $values['vocab-raw'] = '';
-        $values['vocab-id'] = '';
-      }
-
-      break;
-  }
-
-  return $values;
-}
-
-/**
- * Implementation of hook_token_list().
- */
-function node_token_list($type = 'all') {
-  if ($type == 'node' || $type == 'all') {
-    $tokens['node']['nid']             = t('The unique ID of the content item, or "node".');
-    $tokens['node']['type']            = t('The type of the node.');
-    $tokens['node']['type-name']       = t('The human-readable name of the node type.');
-    $tokens['node']['language']        = t('The language the node is written in.');
-    $tokens['node']['title']           = t('The title of the node.');
-    $tokens['node']['title-raw']       = t('The title of the node.');
-    $tokens['node']['node-path']       = t('The URL alias of the node.');
-    $tokens['node']['node-path-raw']   = t('The URL alias of the node.');
-    $tokens['node']['node-url']        = t('The URL of the node.');
-
-    $tokens['node']['author-uid']      = t("The unique ID of the author of the node.");
-    $tokens['node']['author-name']     = t("The login name of the author of the node.");
-    $tokens['node']['author-name-raw'] = t("The login name of the author of the node.");
-    $tokens['node']['author-mail']     = t("The email address of the author of the node.");
-    $tokens['node']['author-mail-raw'] = t("The email address of the author of the node.");
-
-    $tokens['node']['log']     = t('The explanation of the most recent changes made to the node.');
-    $tokens['node']['log-raw'] = t('The explanation of the most recent changes made to the node.');
-
-    $tokens['node'] += token_get_date_token_info(t('Node creation'));
-    $tokens['node'] += token_get_date_token_info(t('Node modification'), 'mod-');
-
-    if (module_exists('comment')) {
-      $tokens['node']['node_comment_count']   = t("The number of comments posted on a node.");
-      $tokens['node']['unread_comment_count'] = t("The number of comments posted on a node since the reader last viewed it.");
-    }
-
-    if (module_exists('taxonomy')) {
-      $tokens['node']['term']            = t("Name of top taxonomy term");
-      $tokens['node']['term-raw']        = t("Unfiltered name of top taxonomy term.");
-      $tokens['node']['term-id']         = t("ID of top taxonomy term");
-      $tokens['node']['vocab']           = t("Name of top term's vocabulary");
-      $tokens['node']['vocab-raw']       = t("Unfiltered name of top term's vocabulary.");
-      $tokens['node']['vocab-id']        = t("ID of top term's vocabulary");
-      // Temporarily disabled -- see notes in node_token_values.
-      // $tokens['node']['catpath']        = t("Full taxonomy tree for the topmost term");
-    }
-
-    if (module_exists('menu')) {
-      $tokens['node']['menu']                = t("The name of the menu the node belongs to.");
-      $tokens['node']['menu-raw']            = t("The name of the menu the node belongs to.");
-      $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 /.");
-      $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.");
-      $tokens['node']['menu-link-mlid']      = t("The unique ID of the node's menu link.");
-      $tokens['node']['menu-link-plid']      = t("The unique ID of the node's menu link parent.");
-    }
-
-    return $tokens;
-  }
-}
-
-/**
- * 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 $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"];
-    }
-  }
-
-  // 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;
-  }
-  return $titles;
-}
-
-/**
- * Implementation of hook_token_values() for book nodes
- */
-function book_token_values($type, $object = NULL, $options = array()) {
-  if ($type == 'node') {
-    $node = $object;
-
-    // Initialize some variables to empty.
-    $tokens['book'] = '';
-    $tokens['book-raw'] = '';
-    $tokens['book_id'] = '';
-    $tokens['bookpath'] = '';
-    $tokens['bookpath-raw'] = '';
-
-    if (!empty($node->book['menu_name'])) {
-      $menus = menu_get_menus();
-      $trail_raw = _menu_titles($node->book, $node->nid);
-      $book_raw = $trail_raw[0];
-      $book = check_plain($book_raw);
-      // For book paths, we don't include the current node's title (last in
-      // the array) in the trail.
-      array_pop($trail_raw);
-      $trail = array();
-      foreach ($trail_raw as $title) {
-        $trail[] = check_plain($title);
-      }
-      $tokens = array();
-      $tokens['book'] = $book;
-      $tokens['book-raw'] = $book_raw;
-      $tokens['book_id'] = $node->book['bid'];
-      $tokens['bookpath'] = !empty($options['pathauto']) ? $trail : implode('/', $trail);
-      $tokens['bookpath-raw'] = !empty($options['pathauto']) ? $trail_raw : implode('/', $trail_raw);
-    }
-
-    return $tokens;
-  }
-}
-
-function book_token_list($type) {
-  if ($type == 'node' || $type == 'all') {
-    $list['book']['book']           = t("The title of the node's book parent.");
-    $list['book']['book_id']        = t("The id of the node's book parent.");
-    $list['book']['bookpath']       = t("The titles of all parents in the node's book hierarchy.");
-
-    $list['book']['book-raw']       = t("The unfiltered title of the node's book parent.");
-    $list['book']['bookpath-raw']   = t("The unfiltered titles of all parents in the node's book hierarchy.");
-
-    return $list;
-  }
-}
-
-/**
- * Check if mid/path is present in the menu.
- *
- * @param $in
- *   Numeric input is treated as a menu-id, strings as src-paths.
- * @return
- *   An existing mid, or 0 if none found.
- */
-function token_menu_get_mid($in) {
-  global $_menu;
-
-  if (!is_numeric($in)) {
-    if (isset($_menu['path index'][$in])) {
-      $mid = $_menu['path index'][$in];
-    }
-    else {
-      $mid = 0;
-    }
-  }
-  else if (!isset($_menu['visible'][$in])) {
-    $mid = 0;
-  }
-
-  // Temporary paths would break much of this module.
-  if ($mid < 0) {
-    $mid = 0;
-  }
-
-  return $mid;
-}
Index: token_taxonomy.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/Attic/token_taxonomy.inc,v
retrieving revision 1.3.4.5
diff -u -p -r1.3.4.5 token_taxonomy.inc
--- token_taxonomy.inc	5 Jun 2010 16:45:58 -0000	1.3.4.5
+++ token_taxonomy.inc	1 Nov 2010 04:25:06 -0000
@@ -3,56 +3,5 @@
 
 /**
  * @file
- * Implementations of token module hooks for the core taxonomy module.
- *
- * The token module requires specific hooks to be added to modules
- * so that those modules can return data about their objects to the
- * token API.  Until and unless token becomes a part of core, the
- * implementations of the token hooks for core modules are provided
- * in the token module itself.
- *
- * @ingroup token
+ * The taxonomy tokens have been moved to token.tokens.inc.
  */
-
-/**
- * Implementation of hook_token_values().
- */
-function taxonomy_token_values($type, $object = NULL, $options = array()) {
-  $values = array();
-  switch ($type) {
-    case 'taxonomy':
-      $category = $object;
-      $vid = $category->vid;
-      $vocabulary = taxonomy_vocabulary_load($vid);
-
-      $values['tid'] = $category->tid;
-      $values['cat'] = check_plain($category->name);
-      $values['cat-raw'] = $category->name;
-      $values['cat-description'] = filter_xss($category->description);
-      $values['vid'] = $vid;
-      $values['vocab'] = check_plain($vocabulary->name);
-      $values['vocab-raw'] = $vocabulary->name;
-      $values['vocab-description'] = filter_xss($vocabulary->description);
-
-      break;
-  }
-  return $values;
-}
-
-/**
- * Implementation of hook_token_list().
- */
-function taxonomy_token_list($type = 'all') {
-  if ($type == 'taxonomy' || $type == 'all') {
-    $tokens['taxonomy']['tid'] = t('The id number of the category.');
-    $tokens['taxonomy']['cat'] = t('The name of the category.');
-    $tokens['taxonomy']['cat-raw'] = t('The unfiltered name of the category.');
-    $tokens['taxonomy']['cat-description'] = t('The optional description of the taxonomy term.');
-    $tokens['taxonomy']['vid'] = t("The id number of the category's parent vocabulary.");
-    $tokens['taxonomy']['vocab'] = t("The vocabulary that the page's first category belongs to.");
-    $tokens['taxonomy']['vocab-raw'] = t("The unfiltered vocabulary that the page's first category belongs to.");
-    $tokens['taxonomy']['vocab-description'] = t('The optional description of the taxonomy vocabulary.');
-
-    return $tokens;
-  }
-}
Index: token_user.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/Attic/token_user.inc,v
retrieving revision 1.3.4.11
diff -u -p -r1.3.4.11 token_user.inc
--- token_user.inc	19 Sep 2010 21:39:14 -0000	1.3.4.11
+++ token_user.inc	1 Nov 2010 04:25:06 -0000
@@ -3,78 +3,5 @@
 
 /**
  * @file
- * Implementations of token module hooks for the core user module.
- *
- * The token module requires specific hooks to be added to modules
- * so that those modules can return data about their objects to the
- * token API.  Until and unless token becomes a part of core, the
- * implementations of the token hooks for core modules are provided
- * in the token module itself.
- *
- * @ingroup token
+ * The user tokens have been moved to token.tokens.inc.
  */
-
-/**
- * Implementation of hook_token_list().
- */
-function user_token_list($type = 'all') {
-  if ($type == 'user' || $type == 'all') {
-    $tokens['user']['user']     = t("The login name of the user account.");
-    $tokens['user']['user-raw'] = t("The login name of the user account.");
-    $tokens['user']['uid']      = t("The unique ID of the user account.");
-    $tokens['user']['mail']     = t("The email address of the user account.");
-
-    $tokens['user'] += token_get_date_token_info(t("User's registration"), 'user-created-');
-    $tokens['user'] += token_get_date_token_info(t("User's last login"), 'user-last-login-');
-    $tokens['user']['date-in-tz'] = t("The current date in the user's timezone.");
-
-    $tokens['user']['account-url']      = t("The URL of the account profile page.");
-    $tokens['user']['account-edit-url'] = t("The URL of the account edit page.");
-
-    return $tokens;
-  }
-}
-
-/**
- * Implementation of hook_token_values().
- */
-function user_token_values($type, $object = NULL, $options = array()) {
-  $values = array();
-  switch ($type) {
-    case 'user':
-      if (isset($object)) {
-        $account = $object;
-      }
-      else {
-        global $user;
-        $account = user_load(array('uid' => $user->uid));
-      }
-
-      // Adjust for the anonymous user name.
-      if (!$account->uid && !$account->name) {
-        $account->name = variable_get('anonymous', 'Anonymous');
-      }
-
-      $values['user']     = check_plain($account->name);
-      $values['user-raw'] = $account->name;
-      $values['uid']      = $account->uid;
-      $values['mail']     = $account->uid ? $account->mail : '';
-
-      if ($account->uid) {
-        $values += token_get_date_token_values($account->created, 'user-created-');
-        $values += token_get_date_token_values($account->access, 'user-last-login-');
-        $values['reg-date'] = $values['user-created-small'];
-        $values['reg-since'] = $values['user-created-since'];
-        $values['log-date'] = $values['user-last-login-small'];
-        $values['log-since'] = $values['user-last-login-since'];
-        $values['date-in-tz'] = $account->uid ? format_date(time(), 'small', '', $account->timezone) : '';
-      }
-
-      $values['account-url']      = $account->uid ? url("user/$account->uid", array('absolute' => TRUE)) : '';
-      $values['account-edit-url'] = $account->uid ? url("user/$account->uid/edit", array('absolute' => TRUE)) : '';
-      $values['account-edit']     = $values['account-edit-url'];
-
-      break;
-  }
-  return $values;
-}
