Same name and namespace in other branches
  1. 4.7.x modules/aggregator.module \aggregator_page_opml()
  2. 5.x modules/aggregator/aggregator.module \aggregator_page_opml()
  3. 6.x modules/aggregator/aggregator.pages.inc \aggregator_page_opml()
  4. 7.x modules/aggregator/aggregator.pages.inc \aggregator_page_opml()

Menu callback; generates an OPML representation of all feeds.

1 string reference to 'aggregator_page_opml'
aggregator_menu in modules/aggregator.module
Implementation of hook_menu().

File

modules/aggregator.module, line 974
Used to aggregate syndicated content (RSS and RDF).

Code

function aggregator_page_opml() {
  $result = db_query('SELECT * FROM {aggregator_feed} ORDER BY title');
  $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";
  while ($feed = db_fetch_object($result)) {
    $output .= '<outline text="' . check_plain($feed->title) . '" xmlUrl="' . check_url($feed->url) . "\" />\n";
  }
  $output .= "</body>\n";
  $output .= "</opml>\n";
  drupal_set_header('Content-Type: text/xml; charset=utf-8');
  print $output;
}