Index: synonyms.module
===================================================================
RCS file: /cvs/drupal/contributions/modules/synonyms/synonyms.module,v
retrieving revision 1.4
diff -u -p -r1.4 synonyms.module
--- synonyms.module	7 Jan 2009 13:38:40 -0000	1.4
+++ synonyms.module	8 Jul 2009 04:24:19 -0000
@@ -1,36 +1,36 @@
 <?php
 /**
- * Implementattion of hook_nodeapi
+ * Implementation of hook_nodeapi().
+ *
  * This hook loads when Drupal starts updating it's search index for a node.
- * We  then get all terms from the categories associated to it, and find their synonyms.
- * The synonyms are then added to the results
+ * We then get all terms from the taxonomy associated to it, and find their synonyms.
+ * The synonyms are then added to the results.
 */
-
 function synonyms_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
   if ($op == 'update index') {
     // Check if it's a node and if there are any taxonomy terms.
     if ($node->nid > 0 && !empty($node->taxonomy)) {
-        $text = array();
-        $getTerms = $node->taxonomy;
+      $text = array();
+      $terms = $node->taxonomy;
 
-        foreach($getTerms as $nodeTerm) {
-            $childSynonyms = taxonomy_get_synonyms($nodeTerm->tid);
-            foreach($childSynonyms as $childSynonym){
-                $text[] = $childSynonym;
-            }
-            $parents = taxonomy_get_parents($nodeTerm->tid);
-            foreach($parents as $parent) {
-                $text[] = $parent->name;
-                $synonyms = taxonomy_get_synonyms($parent->tid);
-                foreach($synonyms as $synonym){
-                    $text[] = $synonym;
-                }
-            }
+      foreach($terms as $term) {
+        $term_synonyms = taxonomy_get_synonyms($term->tid);
+        foreach($term_synonyms as $term_synonym){
+          $text[] = $term_synonym;
         }
-
-        return '<strong>('. implode(', ', $text) .')</strong>';
-    } else {
-        return false;
+        $parents = taxonomy_get_parents($term->tid);
+        foreach($parents as $parent) {
+          $text[] = $parent->name;
+          $parent_synonyms = taxonomy_get_synonyms($parent->tid);
+          foreach($parent_synonyms as $parent_synonym){
+            $text[] = $parent_synonym;
+          }
+        }
+      }
+      return '<strong>('. implode(', ', $text) .')</strong>';
+    }
+    else {
+      return false;
     }
   }
 }
