Index: feedapi.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/feedapi/feedapi.module,v
retrieving revision 1.23.2.119.2.11
diff -u -r1.23.2.119.2.11 feedapi.module
--- feedapi.module	29 Apr 2008 10:20:42 -0000	1.23.2.119.2.11
+++ feedapi.module	29 Apr 2008 13:36:37 -0000
@@ -61,7 +61,7 @@
   $items['admin/content/feed/export_opml'] = array(
     'title' => 'Export all feeds as OPML',
     'access arguments' => array('administer feedapi'),
-    'page callback' => '_feedapi_export_opml',
+    'page callback' => 'feedapi_export_opml',
   );
   $items['admin/settings/feedapi'] = array(
     'title' => 'FeedAPI settings',
@@ -1381,24 +1381,46 @@
 }
 
 /**
- * Generates an OPML representation of all feeds.
+ * Menu callback; generates an OPML representation of all feeds.
+ * 
+ * @return
+ *   The output XML.
  */
-function _feedapi_export_opml() {
+function feedapi_export_opml() {
   $result = db_query(db_rewrite_sql('SELECT n.title, f.url FROM {feedapi} f INNER JOIN {node} n ON f.nid = n.nid ORDER BY n.title ASC'));
-  $output = "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
-  $output .= "<opml version=\"1.1\">\n";
-  $output .= "<head>\n";
-  $output .= '<title>'. variable_get('site_name', 'drupal') .' - '. variable_get('site_slogan', '') ."</title>\n";
-  $output .= '<dateModified>'. gmdate('r') ."</dateModified>\n";
-  $output .= "</head>\n";
-  $output .= "<body>\n";
+  
+  $feeds = array();
   while ($feed = db_fetch_object($result)) {
-    $output .= '<outline text="'. check_plain($feed->title) .'" xmlUrl="'. check_plain($feed->url) .'" />'."\n";
+    $feeds[] = $feed;
   }
-  $output .= "</body>\n";
-  $output .= "</opml>\n";
+  
+  return theme('feedapi_export_opml', $feeds);
+}
+
+/**
+ * Theme the OPML feed output.
+ *
+ * @param $feeds
+ *   An array of the feeds to theme.
+ * @ingroup themeable
+ */
+function theme_feedapi_export_opml($feeds) {
+
   drupal_set_header('Content-Type: text/xml; charset=utf-8');
-  drupal_set_header('Content-Disposition: attachment; filename="'. variable_get('site_name', 'drupal') .'.opml"');
+
+  $output = '<?xml version="1.0" encoding="utf-8"?>\n';
+  $output .= '<opml version="1.1">\n';
+  $output .= '<head>\n';
+  $output .= '<title>'. check_plain(variable_get('site_name', 'Drupal')) .'</title>\n';
+  $output .= '<dateModified>'. gmdate('r') .'</dateModified>\n';
+  $output .= '</head>\n';
+  $output .= '<body>\n';
+  foreach ($feeds as $feed) {
+    $output .= '<outline text="'. check_plain($feed->title) .'" xmlUrl="'. check_url($feed->url) .'" />\n';
+  }
+  $output .= '</body>\n';
+  $output .= '</opml>\n';
+
   print $output;
 }
 
