Index: faq.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/faq/faq.module,v
retrieving revision 1.1.4.52.2.80
diff -u -p -r1.1.4.52.2.80 faq.module
--- faq.module	25 Oct 2008 19:43:40 -0000	1.1.4.52.2.80
+++ faq.module	25 Oct 2008 20:07:15 -0000
@@ -326,10 +326,10 @@ function faq_page($tid = 0) {
     $tid = 0;
   }
 
-  // Configure the breadcrumb trail.
+  // configure the breadcrumb trail.
   if (!empty($tid) && $current_term = taxonomy_get_term($tid)) {
     if (!drupal_lookup_path('alias', arg(0) .'/'. arg(1)) && module_exists('pathauto')) {
-      $placeholders = pathauto_get_placeholders('taxonomy', $current_term);
+      $placeholders = pathauto_get_placeholders('taxonomy', taxonomy_get_term($tid));
       if ($alias = pathauto_create_alias('faq', 'insert', $placeholders, arg(0) .'/'. arg(1), arg(1))) {
         drupal_goto($alias);
       }
@@ -636,6 +636,7 @@ function faq_theme() {
  * Recent FAQs and Random FAQs.
  */
 function faq_block($op = 'list', $delta = 0, $edit = array()) {
+  static $vocabularies, $terms;
 
   switch ($op) {
 
@@ -651,14 +652,16 @@ function faq_block($op = 'list', $delta 
         case 0:
           // FAQ Categories.
           if (module_exists("taxonomy")) {
-            $terms = array();
-            $vocabularies = taxonomy_get_vocabularies('faq');
-            $vocab_omit = variable_get('faq_omit_vocabulary', array());
-            $vocabularies = array_diff_key($vocabularies, $vocab_omit);
-            foreach ($vocabularies as $vocab) {
-              foreach (taxonomy_get_tree($vocab->vid) as $term) {
-                if (taxonomy_term_count_nodes($term->tid, 'faq')) {
-                  $terms[$term->name] = $term->tid;
+            if (!isset($terms)) {
+              $terms = array();
+              $vocabularies = taxonomy_get_vocabularies('faq');
+              $vocab_omit = variable_get('faq_omit_vocabulary', array());
+              $vocabularies = array_diff_key($vocabularies, $vocab_omit);
+              foreach ($vocabularies as $vocab) {
+                foreach (taxonomy_get_tree($vocab->vid) as $term) {
+                  if (taxonomy_term_count_nodes($term->tid, 'faq')) {
+                    $terms[$term->name] = $term->tid;
+                  }
                 }
               }
             }
@@ -948,12 +951,16 @@ function faq_site_map() {
  * Change the term links on a node to point at the appropriate faq page.
  */
 function faq_link_alter(&$links, $node) {
+  static $vocabularies;
+
   if ($node->type != 'faq' || !variable_get('faq_use_categories', FALSE) || !module_exists("taxonomy") || !variable_get('faq_enable_term_links', 1)) {
     return;
   }
-  $vocabularies = taxonomy_get_vocabularies('faq');
-  $vocab_omit = variable_get('faq_omit_vocabulary', array());
-  $vocabularies = array_diff_key($vocabularies, $vocab_omit);
+  if (!isset($vocabularies)) {
+    $vocabularies = taxonomy_get_vocabularies('faq');
+    $vocab_omit = variable_get('faq_omit_vocabulary', array());
+    $vocabularies = array_diff_key($vocabularies, $vocab_omit);
+  }
   foreach ($links as $module => $link) {
     if (strpos($module, 'taxonomy_term') !== FALSE) {
       // Link back to the faq and not the taxonomy term page. We'll only
