Index: menutrails.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/menutrails/menutrails.module,v
retrieving revision 1.6
diff -u -p -r1.6 menutrails.module
--- menutrails.module	25 Oct 2008 18:00:36 -0000	1.6
+++ menutrails.module	29 Oct 2008 16:11:30 -0000
@@ -110,12 +110,12 @@ function menutrails_comment($comment, $o
  */
 function menutrails_settings_form() {
   $options = array('' => '<none>');
-  $limit   = _menu_parent_depth_limit($item);
+  $limit   = MENU_MAX_DEPTH - 1;
   $menus   = menu_get_menus();
   foreach ($menus as $menu_name => $title) {
     $tree = menu_tree_all_data($menu_name, NULL);
     $options[$menu_name .':0'] = '<'. $title .'>';
-    _menutrails_parents_recurse($tree, $menu_name, '--', $options, $item['mlid'], $limit);
+    _menutrails_parents_recurse($tree, $menu_name, '--', $options, 0, $limit);
   }
   $form['description'] = array(
     '#type' => 'markup',
@@ -131,10 +131,7 @@ function menutrails_settings_form() {
     '#prefix' => '<p>',
     '#suffix' => '</p>',
   );
-
-  $extra = module_invoke_all('menutrails_settings', $options);
-
-  $form = array_merge($form, $extra);
+  $form = array_merge($form, module_invoke_all('menutrails_settings', $options));
 
   return system_settings_form($form);
 }
@@ -157,7 +154,7 @@ function menutrails_menutrails_settings(
   $form = array();
   $node_types = node_get_types('names');
   $node_trails = variable_get('menutrails_node_types', array());
-  $vocabs = taxonomy_get_vocabularies();
+  $vocabs = module_exists('taxonomy') ? taxonomy_get_vocabularies() : array();
   $term_trails = variable_get('menutrails_terms', array());
   $form['menutrails_node_types'] = array(
     '#tree' => TRUE,
@@ -169,7 +166,7 @@ function menutrails_menutrails_settings(
   foreach ($node_types as $key => $value) {
     $form['menutrails_node_types'][$key] = array('#type' => 'select',
       '#title' => t('Parent item for') ." $value",
-      '#default_value' => $node_trails[$key],
+      '#default_value' => isset($node_trails[$key]) ? $node_trails[$key] : NULL,
       '#options' => $options,
     );
   }
@@ -258,28 +255,6 @@ function _menutrails_parents_recurse($tr
 }
 
 /**
- * This is an example _phptemplate_variables() implementation.
- *
- * You need to add this code (or something like it) to your template.php file
- * for this module to do anything useful. Obviously in template.php you don't
- * want the code commented out.
- */
-
-/*
-function _phptemplate_variables($hook, $vars = array()) {
-  switch ($hook) {
-    case 'page': // page is where menu comes into play
-      // set the primary links
-      $vars['primary_links'] = menutrails_primary_links(1);
-      // you may want to also override secondary_links
-      $vars['secondary_links'] = menutrails_primary_links(2);
-      break;
-  }
-}
-*/
-
-
-/**
  * Theme override for theme_links().
  *
  * The important difference is that we use the in_active_trail bit here to set
@@ -312,7 +287,7 @@ function phptemplate_links($links, $attr
 
       if (isset($link['href'])) {
         // add active class for containing <li> and <a> if active-trail is set on the link itself
-        if (strpos($link['attributes']['class'], 'active-trail') !== FALSE && strpos($class, 'active') === FALSE) {
+        if (isset($link['attributes']['class']) && strpos($link['attributes']['class'], 'active-trail') !== FALSE && strpos($class, 'active') === FALSE) {
           $class .= ' active';
           $link['attributes']['class'] .= ' active';
         }
