Index: weblinks.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/weblinks/weblinks.module,v
retrieving revision 1.46
diff -u -r1.46 weblinks.module
--- weblinks.module	13 Jul 2008 22:58:00 -0000	1.46
+++ weblinks.module	14 Jul 2008 15:21:39 -0000
@@ -975,28 +975,37 @@
 
 /**
  * Prepare links content.
+ *
+ * @param $tid
+ *   term id (int) to process links.
+ * @param $admin
+ *   (bool) whether or not to produce admin links.
+ *
+ * @return 
+ *   list of links for the given term (HTML).
  */
 function _weblinks_links($tid, $admin = FALSE) {
-  // Get the max number of posts to display.
-  // @@@ NancyDru, oops, something's missing here...
-  $description = variable_get('weblinks_linkdesc', TRUE);
-  $info = variable_get('weblinks_linkinfo', TRUE);
-  $urlnode = variable_get('weblinks_urlnode', 'url');
-  $admin_weblinks = user_access('administer weblinks');
-  $edit_group = user_access('edit group weblinks');
-  $options = array();
-  $page_content = null;
+  // Making these static means we only need to set them the first time we come here.
+  static $description, $info, $urlnode, $admin_weblinks, $edit_group, $options;
+  if (!isset($description)) {
+    $description = variable_get('weblinks_linkdesc', TRUE);
+    $info = variable_get('weblinks_linkinfo', TRUE);
+    $urlnode = variable_get('weblinks_urlnode', 'url');
+    $admin_weblinks = user_access('administer weblinks');
+    $edit_group = user_access('edit group weblinks');
+
+    $options = array();
+    if (variable_get('weblinks_external', true)) {
+      $options['attributes']['target'] = '_blank';
+    }
 
-  if (variable_get('weblinks_external', true)) {
-    $options['attributes']['target'] = '_blank';
+    if (variable_get('weblinks_nofollow', false)) {
+      $options['attributes']['rel'] = 'nofollow';
+    }
   }
 
-  if (variable_get('weblinks_nofollow', false)) {
-    $options['attributes']['rel'] = 'nofollow';
-  }
-  if ($edit_group) {
-    $include = _weblinks_get_access();
-  }
+  $page_content = null;
+
   // @TODO: does query need to return as much as it does?
   $result = _weblinks_get_query($tid, variable_get('weblinks_page_sort', 'title'));
 
