? token-coding-standards-SP20080401-unified.patch
Index: token.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token.module,v
retrieving revision 1.7.4.6
diff -u -p -r1.7.4.6 token.module
--- token.module	22 Mar 2008 13:20:35 -0000	1.7.4.6
+++ token.module	8 Apr 2008 23:26:35 -0000
@@ -28,7 +28,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;
Index: token_cck.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token_cck.inc,v
retrieving revision 1.2
diff -u -p -r1.2 token_cck.inc
--- token_cck.inc	31 Jul 2007 12:41:07 -0000	1.2
+++ token_cck.inc	8 Apr 2008 23:26:35 -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_node.inc
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/token/token_node.inc,v
retrieving revision 1.5.4.2
diff -u -p -r1.5.4.2 token_node.inc
--- token_node.inc	8 Nov 2007 14:48:00 -0000	1.5.4.2
+++ token_node.inc	8 Apr 2008 23:26:35 -0000
@@ -54,7 +54,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,17 +90,17 @@ 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));
-              $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));
+              $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", 0, 1, $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", 0, 1, $vid, $object->nid));
               $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);
@@ -111,7 +111,7 @@ function node_token_values($type, $objec
             $values['term-id'] = $term->tid;
             $vid = $term->vid;
 
-            if(!empty($vid)) {
+            if (!empty($vid)) {
               $vocabulary = taxonomy_vocabulary_load($vid);
               $values['vocab'] = check_plain($vocabulary->name);
               $values['vocab-raw'] = $vocabulary->name;
@@ -128,8 +128,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'] = '';
@@ -212,15 +212,15 @@ 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;
       $tokens['bookpath-raw'] = $bookpath_raw;
-    } 
+    }
     else {
       $tokens['book'] = '';
       $tokens['book_id'] = '';
