Index: faq.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/faq/faq.module,v
retrieving revision 1.1.4.63.2.64
diff -u -p -r1.1.4.63.2.64 faq.module
--- faq.module	7 Oct 2008 20:33:01 -0000	1.1.4.63.2.64
+++ faq.module	25 Oct 2008 20:08:30 -0000
@@ -1125,6 +1125,7 @@ function _display_faq_by_category($faq_d
  * Recent FAQs and Random FAQs.
  */
 function faq_block($op = 'list', $delta = 0, $edit = array()) {
+  static $vocabularies, $terms;
 
   switch ($op) {
 
@@ -1139,14 +1140,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;
+                  }
                 }
               }
             }
@@ -1433,12 +1436,16 @@ function faq_site_map() {
  * Change the term links on a node to point at the appropriate faq page.
  */
 function faq_link_alter(&$node, &$links) {
+  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
