? 241288_token_coding_standards_5x.patch
? 241288_token_coding_standards_6.patch
Index: token.install
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.install,v
retrieving revision 1.1.2.2
diff -u -p -r1.1.2.2 token.install
--- token.install	24 Apr 2007 21:24:26 -0000	1.1.2.2
+++ token.install	21 Jun 2008 14:56:43 -0000
@@ -1,5 +1,12 @@
 <?php
-// $Id $
+// $Id$
+
+/**
+ * @file
+ * The install and update code for the token module.
+ *
+ * @ingroup token
+ */
 
 function token_install() {
   db_query("UPDATE {system} SET weight = 10 WHERE name = 'token'");
Index: token.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.module,v
retrieving revision 1.5.2.12
diff -u -p -r1.5.2.12 token.module
--- token.module	17 Jan 2008 10:46:16 -0000	1.5.2.12
+++ token.module	21 Jun 2008 14:56:43 -0000
@@ -2,6 +2,17 @@
 // $Id: token.module,v 1.5.2.12 2008/01/17 10:46:16 greggles Exp $
 
 /**
+ * @file
+ * The Token API module.
+ *
+ * The Token module provides an API for providing tokens to other modules.
+ * Tokens are small bits of text that can be placed into larger documents
+ * via simple placeholders, like %site-name or [user].
+ *
+ * @ingroup token
+ */
+
+/**
  * For a given context, builds a formatted list of tokens and descriptions
  * of their replacement values.
  *
@@ -12,7 +23,7 @@
  * @param suffix
  *    The suffix your module will use when parsing tokens. Defaults to ']'
  * @return An HTML table containing the formatting docs.
- **/
+ */
 function theme_token_help($type = 'all', $prefix = '[', $suffix = ']') {
   token_include();
   $full_list = token_get_list($type);
@@ -20,7 +31,7 @@ function theme_token_help($type = 'all',
   $headers = array(t('Token'), t('Replacement value'));
   $rows = array();
   foreach ($full_list as $key => $category) {
-    $rows[] = array(array('data' => drupal_ucfirst($key) . ' ' . t('tokens'), 'class' => 'region', 'colspan' => 2));
+    $rows[] = array(array('data' => drupal_ucfirst($key) .' '. t('tokens'), 'class' => 'region', 'colspan' => 2));
     foreach ($category as $token => $description) {
       $row = array();
       $row[] = $prefix . $token . $suffix;
@@ -99,7 +110,7 @@ function token_token_list($type = 'all')
 /**
  * General function to include the files that token relies on for the real work.
  *
- **/
+ */
 function token_include() {
   $path = drupal_get_path('module', 'token');
   require_once("$path/token_node.inc");
@@ -141,7 +152,7 @@ function token_include() {
  *    matches. Defaults to a close-bracket.
  * @return The modified version of $original, with all substitutions
  *   made.
- **/
+ */
 function token_replace($original, $type = 'global', $object = NULL, $leading = '[', $trailing = ']', $options = array()) {
   $full = token_get_values($type, $object, FALSE, $options);
   return _token_replace_tokens($original, $full->tokens, $full->values, $leading, $trailing);
@@ -159,7 +170,7 @@ function token_replace($original, $type 
  *   An array of substitution classes and optional objects. The key is
  *   a flag indicating the class of substitution tokens to use.
  *   If an object is passed as value, the key should contain the
- *   object's type. For example, 'node', 'comment', or 'user'. The 
+ *   object's type. For example, 'node', 'comment', or 'user'. The
  *   object will be used for building substitution values. If no type
  *   is specified, only 'global' site-wide substitution tokens are built.
  * @param leading
@@ -170,7 +181,7 @@ function token_replace($original, $type 
  *    matches. Defaults to a close-bracket.
  * @return The modified version of $original, with all substitutions
  *   made.
- **/
+ */
 function token_replace_multiple($original, $types = array('global' => NULL), $leading = '[', $trailing = ']', $options = array()) {
   $full = new stdClass();
   $full->tokens = $full->values = array();
Index: token_cck.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token_cck.inc,v
retrieving revision 1.1.2.10
diff -u -p -r1.1.2.10 token_cck.inc
--- token_cck.inc	23 Feb 2008 12:12:39 -0000	1.1.2.10
+++ token_cck.inc	21 Jun 2008 14:56:43 -0000
@@ -15,10 +15,10 @@ function content_token_values($type, $ob
       
       $items = $node->$field['field_name'];
       if (!empty($items)) {
-        $function = $field_types[$field['type']]['module'] . '_token_values';
+        $function = $field_types[$field['type']]['module'] .'_token_values';
         if (function_exists($function)) {
           $sub_list = $function('field', $items);
-          foreach($sub_list as $token => $value) {
+          foreach ($sub_list as $token => $value) {
             $tokens[$field['field_name'] .'-'. $token] = $value;
           }
         }
@@ -35,7 +35,7 @@ function content_token_list($type = 'all
 
     foreach (content_fields() as $field) {
       $sub_list = array();
-      $function = $field_types[$field['type']]['module'] . '_token_list';
+      $function = $field_types[$field['type']]['module'] .'_token_list';
       if (function_exists($function)) {
         $sub_list = $function('field');
         foreach ($sub_list as $category => $token_list) {
Index: token_comment.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token_comment.inc,v
retrieving revision 1.1.2.3
diff -u -p -r1.1.2.3 token_comment.inc
--- token_comment.inc	16 Oct 2007 14:37:59 -0000	1.1.2.3
+++ token_comment.inc	21 Jun 2008 14:56:43 -0000
@@ -2,13 +2,25 @@
 // $Id: token_comment.inc,v 1.1.2.3 2007/10/16 14:37:59 greggles Exp $
 
 /**
- * Implementation of hook_token_values()
+ * @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
+ */
+
+/**
+ * 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;
 
@@ -40,12 +52,12 @@ function comment_token_values($type, $ob
       $values['comment-d']               = date('j', $comment->timestamp);
       break;
   }
-  
+
   return $values;
 }
 
 /**
- * Implementation of hook_token_list()
+ * Implementation of hook_token_list().
  */
 function comment_token_list($type = 'all') {
   if ($type == 'comment' || $type == 'all') {
Index: token_node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token_node.inc,v
retrieving revision 1.3.2.22
diff -u -p -r1.3.2.22 token_node.inc
--- token_node.inc	9 Apr 2008 02:17:55 -0000	1.3.2.22
+++ token_node.inc	21 Jun 2008 14:56:43 -0000
@@ -2,7 +2,20 @@
 // $Id: token_node.inc,v 1.3.2.22 2008/04/09 02:17:55 greggles Exp $
 
 /**
- * Implementation of hook_token_values()
+ * @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
+ */
+
+/**
+ * Implementation of hook_token_values().
  */
 function node_token_values($type, $object = NULL, $options = array()) {
   $values = array();
@@ -54,7 +67,7 @@ function node_token_values($type, $objec
       global $_menu;
       $trail = array();
       $trail_raw = array();
-      $original_mid = token_menu_get_mid('node/'.$node->nid);
+      $original_mid = token_menu_get_mid('node/'. $node->nid);
       
       $mid = $original_mid;
       while ($mid && $_menu['visible'][$mid] && $_menu['visible'][$mid]['pid'] != 0) {
@@ -90,20 +103,20 @@ function node_token_values($type, $objec
           if ((object)$term) {
             // With freetagging 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 
+            // 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("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 LIMIT 1", $object->nid));
+              $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("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.nid = %d ORDER BY weight LIMIT 1", $vid, $object->nid));
+              $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.nid = %d ORDER BY weight", $vid, $object->nid, 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)) {
+            if (!isset($term->name) && is_array($original_term)) {
               $tid = array_shift($original_term);
               if (is_numeric($tid)) {
                 $term = taxonomy_get_term($tid);
@@ -114,7 +127,7 @@ function node_token_values($type, $objec
             $values['term-id'] = $term->tid;
             $vid = $term->vid;
 
-            if(!empty($vid)) {
+            if (!empty($vid)) {
               $vocabulary = taxonomy_get_vocabulary($vid);
               $values['vocab'] = check_plain($vocabulary->name);
               $values['vocab-raw'] = $vocabulary->name;
@@ -131,8 +144,8 @@ function node_token_values($type, $objec
             break;
           }
         }
-      } 
-      // It's possible to leave that block and still not have good data.  
+      }
+      // 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'] = '';
@@ -150,7 +163,7 @@ function node_token_values($type, $objec
 }
 
 /**
- * Implementation of hook_token_list()
+ * Implementation of hook_token_list().
  */
 function node_token_list($type = 'all') {
   if ($type == 'node' || $type == 'all') {
@@ -215,10 +228,10 @@ function book_token_values($type, $objec
         if ($bookpath == '') {
           $bookpath = check_plain($bookelement->title);
           $bookpath_raw = $bookelement->title;
-        } 
+        }
         else {
-          $bookpath = $bookpath . '/' . check_plain($bookelement->title);
-          $bookpath_raw = $bookpath_raw . '/' . $bookelement->title;
+          $bookpath = $bookpath .'/'. check_plain($bookelement->title);
+          $bookpath_raw = $bookpath_raw .'/'. $bookelement->title;
         }
       }
       $tokens['bookpath'] = $bookpath;
Index: token_taxonomy.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token_taxonomy.inc,v
retrieving revision 1.1.2.4
diff -u -p -r1.1.2.4 token_taxonomy.inc
--- token_taxonomy.inc	16 Oct 2007 14:37:59 -0000	1.1.2.4
+++ token_taxonomy.inc	21 Jun 2008 14:56:43 -0000
@@ -2,16 +2,29 @@
 // $Id: token_taxonomy.inc,v 1.1.2.4 2007/10/16 14:37:59 greggles Exp $
 
 /**
- * Implementation of hook_token_values()
+ * @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
+ */
+
+/**
+ * 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_get_vocabulary($vid);
+
       $values['vid'] = $vid;
       $values['vocab'] = check_plain($vocabulary->name);
       $values['cat'] = check_plain($category->name);
@@ -25,7 +38,7 @@ function taxonomy_token_values($type, $o
 }
 
 /**
- * Implementation of hook_token_list()
+ * Implementation of hook_token_list().
  */
 function taxonomy_token_list($type = 'all') {
   if ($type == 'taxonomy' || $type == 'all') {
Index: token_user.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token_user.inc,v
retrieving revision 1.1.2.8
diff -u -p -r1.1.2.8 token_user.inc
--- token_user.inc	16 Oct 2007 14:37:59 -0000	1.1.2.8
+++ token_user.inc	21 Jun 2008 14:56:43 -0000
@@ -2,7 +2,20 @@
 // $Id: token_user.inc,v 1.1.2.8 2007/10/16 14:37:59 greggles Exp $
 
 /**
- * Implementation of hook_token_values()
+ * @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
+ */
+
+/**
+ * Implementation of hook_token_values().
  */
 function user_token_values($type, $object = NULL, $options = array()) {
   $values = array();
@@ -34,7 +47,7 @@ function user_token_values($type, $objec
 }
 
 /**
- * Implementation of hook_token_list()
+ * Implementation of hook_token_list().
  */
 function user_token_list($type = 'all') {
   if ($type == 'user' || $type == 'all') {
@@ -43,7 +56,7 @@ function user_token_list($type = 'all') 
 
     $tokens['user']['uid']            = t("User's ID");
     $tokens['user']['mail']           = t("User's email address");
- 
+
     $tokens['user']['reg-date']       = t("User's registration date");
     $tokens['user']['reg-since']      = t("Days since the user registered");
     $tokens['user']['log-date']       = t("User's last login date");
