? .advanced_help.module.swp
Index: advanced_help.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/advanced_help/advanced_help.module,v
retrieving revision 1.41
diff -u -p -r1.41 advanced_help.module
--- advanced_help.module	28 Oct 2008 17:33:47 -0000	1.41
+++ advanced_help.module	3 Apr 2009 20:27:31 -0000
@@ -506,12 +506,16 @@ function advanced_help_get_topic_file_in
     path_to_theme() . '/help', // Allow theme override.
     drupal_get_path('module', $module) . "/translations/help/$language->language", // Translations.
     $info['path'], // In same directory as .inc file.
+    url($info['path'], array('absolute'=>TRUE)),
   );
 
   foreach ($paths as $path) {
     if (file_exists("./$path/$info[file]")) {
       return array('path' => $path, 'file' => $info['file']);
     }
+    if((valid_url($path,true)) && ($headers = get_headers($path)) && (strpos($headers[0],'200')!==FALSE)) {
+      return array('path' => $path, 'file' => $info['file'], 'absolute'=>TRUE);
+    }
   }
 }
 
@@ -522,7 +526,12 @@ function advanced_help_view_topic($modul
   $file_info = advanced_help_get_topic_file_info($module, $topic);
   if ($file_info) {
     $info = advanced_help_get_topic($module, $topic);
-    $file = "./$file_info[path]/$file_info[file]";
+    if ($file_info['absolute']) {
+      $file = "$file_info[path]";
+    }
+    else {
+      $file = "./$file_info[path]/$file_info[file]";
+    }
 
     // @todo is this trusted output?
     $output = file_get_contents($file);
@@ -702,6 +711,7 @@ function _advanced_help_parse_ini() {
 
         }
 
+
         foreach ($info as $name => $topic) {
           // Each topic should have a name, a title, a file and of course the path.
           $file = !empty($topic['file']) ? $topic['file'] : $name;
@@ -720,12 +730,41 @@ function _advanced_help_parse_ini() {
           );
         }
       }
+      if ($hook_topics = _advanced_help_get_topics_from_hook($module)) {
+        foreach($hook_topics as $name => $topic) {
+          $cache['topics'][$module][$name] = $topic;
+          $cache['settings'][$module] = isset($cache['settings'][$module]) ? $cache['settings'][$module] : array();
+        }
+      }
     }
     drupal_alter('advanced_help_topic_info', $cache);
   }
   return $cache;
 }
 
+/*
+ * Get arrays from hook_advanced_help_topics and add defaults
+ */
+function _advanced_help_get_topics_from_hook($module) {
+  if($hook_topics = module_invoke($module, 'advanced_help_topics')) {
+    foreach ($hook_topics as $name => $topic) {
+      $hook_topics[$name] = array(
+        'title'       => $topic['title'],
+        'path'        => $topic['path'],
+        'name'        => isset($topic['name'])        ? $topic['name']        : $name,
+        'weight'      => isset($topic['weight'])      ? $topic['weight']      : 0    ,
+        'parent'      => isset($topic['parent'])      ? $topic['parent']      : 0    ,
+        'popup width' => isset($topic['popup width']) ? $topic['popup width'] : 500  ,
+        'line break'  => isset($topic['line break'])  ? $topic['line break']  : 500  ,
+        'navigation'  => isset($topic['navigation'])  ? $topic['navigation']  : TRUE ,
+        'css'         => isset($topic['css'])         ? $topic['css']         : NULL ,
+      );
+    }
+    return $hook_topics;
+  }
+  return FALSE;
+
+}
 /**
  * Implementation of hook_search()
  */
