Index: token.api.php
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/Attic/token.api.php,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 token.api.php
--- token.api.php	23 Sep 2010 01:04:12 -0000	1.1.2.2
+++ token.api.php	30 Oct 2010 21:54:33 -0000
@@ -52,6 +52,7 @@ function hook_token_list($type = 'all') 
  *   An associative array of replacement values, keyed by the original 'raw'
  *   tokens that were found in the source text. For example:
  *   $values['title-raw'] = 'My new node';
+ *   $values['title'] = check_plain($values['title-raw']);
  */
 function hook_token_values($type, $object = NULL, $options = array()) {
   $values = array();
Index: token.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.module,v
retrieving revision 1.7.4.40
diff -u -p -r1.7.4.40 token.module
--- token.module	26 Oct 2010 21:08:20 -0000	1.7.4.40
+++ token.module	30 Oct 2010 21:54:33 -0000
@@ -115,8 +115,8 @@ function token_token_values($type, $obje
       // Current page tokens.
       $values['current-page-title'] = drupal_get_title();
       $alias = drupal_get_path_alias($_GET['q']);
-      $values['current-page-path'] = $alias;
-      $values['current-page-path-raw'] = check_plain($alias);
+      $values['current-page-path-raw'] = $alias;
+      $values['current-page-path'] = check_plain($values['current-page-path-raw']);
       $values['current-page-url'] = url($_GET['q'], array('absolute' => TRUE));
 
       $page = isset($_GET['page']) ? $_GET['page'] : '';
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	30 Oct 2010 21:54:33 -0000
@@ -26,16 +26,14 @@ function comment_token_values($type, $ob
 
       $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-title']           = check_plain($values['comment-title-raw']);
       $values['comment-body-raw']        = $comment->comment;
+      $values['comment-body']            = check_markup($values['comment-body-raw'], $comment->format, FALSE);
       $values['comment-author-name-raw'] = $comment->name;
+      $values['comment-author-name']     = check_plain($values['comment-author-name-raw']);
+      $values['comment-author-uid']      = $comment->uid;
+      $values['comment-author-homepage'] = check_url($comment->homepage);
 
       if (!empty($comment->mail)) {
         $account_mail = $comment->mail;
@@ -46,8 +44,8 @@ function comment_token_values($type, $ob
       else {
         $account_mail = '';
       }
-      $values['comment-author-mail']     = check_plain($account_mail);
       $values['comment-author-mail-raw'] = $account_mail;
+      $values['comment-author-mail']     = check_plain($values['comment-author-mail-raw']);
 
       // Included in case a consuming module wants to format the body
       $values['comment-body-format']     = $comment->format;
Index: token_node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/Attic/token_node.inc,v
retrieving revision 1.5.4.31
diff -u -p -r1.5.4.31 token_node.inc
--- token_node.inc	24 Sep 2010 22:47:29 -0000	1.5.4.31
+++ token_node.inc	30 Oct 2010 21:54:33 -0000
@@ -33,16 +33,16 @@ function node_token_values($type, $objec
       $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['title']              = check_plain($values['title-raw']);
       $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-name']        = check_plain($values['author-name-raw']);
       $values['author-mail-raw']    = $account->mail;
+      $values['author-mail']        = check_plain($values['author-mail-raw']);
 
       $values['log-raw']            = isset($node->log) ? $node->log : '';
       $values['log']                = filter_xss($values['log-raw']);
@@ -78,13 +78,13 @@ function node_token_values($type, $objec
         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']                = check_plain($values['menu-raw']);
         $values['menu-link-title-raw'] = $menu_link['link_title'];
+        $values['menu-link-title']     = check_plain($values['menu-link-title-raw']);
         $values['menu-link-mlid']      = $menu_link['mlid'];
         $values['menu-link-plid']      = $menu_link['plid'];
       }
@@ -126,15 +126,15 @@ function node_token_values($type, $objec
                 $term = taxonomy_get_term($tid);
               }
             }
-            $values['term'] = check_plain($term->name);
             $values['term-raw'] = $term->name;
+            $values['term'] = check_plain($values['term-raw']);
             $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'] = check_plain($values['vocab-raw']);
               $values['vocab-id'] = $vocabulary->vid;
             }
 
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	30 Oct 2010 21:54:33 -0000
@@ -26,12 +26,12 @@ function taxonomy_token_values($type, $o
       $vocabulary = taxonomy_vocabulary_load($vid);
 
       $values['tid'] = $category->tid;
-      $values['cat'] = check_plain($category->name);
       $values['cat-raw'] = $category->name;
+      $values['cat'] = check_plain($values['cat-raw']);
       $values['cat-description'] = filter_xss($category->description);
       $values['vid'] = $vid;
-      $values['vocab'] = check_plain($vocabulary->name);
       $values['vocab-raw'] = $vocabulary->name;
+      $values['vocab'] = check_plain($values['vocab-raw']);
       $values['vocab-description'] = filter_xss($vocabulary->description);
 
       break;
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	30 Oct 2010 21:54:33 -0000
@@ -55,8 +55,8 @@ function user_token_values($type, $objec
         $account->name = variable_get('anonymous', 'Anonymous');
       }
 
-      $values['user']     = check_plain($account->name);
       $values['user-raw'] = $account->name;
+      $values['user']     = check_plain($values['user-raw']);
       $values['uid']      = $account->uid;
       $values['mail']     = $account->uid ? $account->mail : '';
 
