Index: hint.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/hint/hint.module,v
retrieving revision 1.1
diff -u -r1.1 hint.module
--- hint.module	18 Sep 2009 02:32:15 -0000	1.1
+++ hint.module	6 Nov 2009 20:49:40 -0000
@@ -62,10 +62,7 @@
  * Implementation of hook_form_alter().
  */
 function hint_form_alter(&$form, $form_state, $form_id) {
-  static $enabled_forms;
-
-  $enabled_forms = isset($enabled_forms) ? $enabled_forms : hint_enabled_forms();
-  if (isset($enabled_forms[$form_id]) && $enabled_forms[$form_id]['enabled']) {
+  if (hint_enabled_forms($form_id)) {
     switch ($form_id) {
       case 'search_theme_form':
       case 'search_block_form':
@@ -104,7 +101,7 @@
     $form['hint_forms'][$form_id]['enabled'] = array(
       '#type' => 'checkbox',
       '#title' => $form_name,
-      '#default_value' => $settings[$form_id]['enabled'],
+      '#default_value' => isset($settings[$form_id]['enabled']) ? $settings[$form_id]['enabled'] : FALSE,
     );
   }
 
@@ -124,8 +121,26 @@
 
 /**
  * Get a list of enabled forms that have default hints enabled.
+ *
+ * @param $form_id
+ *   (optional) When provided, will determine whether the given form should have
+ *   the hints enabled.
+ * @return
+ *   An array of form IDs with an "enabled" flag determining whether the forms
+ *   should have the hints enabled. When the $form_id parameter is passed, will
+ *   return a boolean determining whether or not the given form should have the
+ *   hints enabled.
  */
-function hint_enabled_forms() {
-  $default = array('search_theme_form' => array('enabled' => '1'));
-  return variable_get('hint_forms', $default);
+function hint_enabled_forms($form_id = NULL) {
+  static $hints = NULL;
+  if (!isset($hints)) {
+    $default = array('search_theme_form' => array('enabled' => '1'));
+    $hints = variable_get('hint_forms', $default);
+  }
+  if (isset($form_id)) {
+    return isset($hints[$form_id]['enabled']) ? $hints[$form_id]['enabled'] : FALSE;
+  }
+  else {
+    return $hints;
+  }
 }
