function feedapi_export_opml in FeedAPI 5
Same name and namespace in other branches
- 6 feedapi.opml.inc \feedapi_export_opml()
Generates an OPML representation of all feeds.
1 string reference to 'feedapi_export_opml'
- feedapi_menu in ./
feedapi.module - Implementation of hook_menu().
File
- ./
feedapi.module, line 1398 - Handle the submodules (for feed and item processing) Provide a basic management of feeds
Code
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";
while ($feed = db_fetch_object($result)) {
$output .= '<outline text="' . check_plain($feed->title) . '" xmlUrl="' . check_plain($feed->url) . '" />' . "\n";
}
$output .= "</body>\n";
$output .= "</opml>\n";
drupal_set_header('Content-Type: text/xml; charset=utf-8');
drupal_set_header('Content-Disposition: attachment; filename="' . variable_get('site_name', 'drupal') . '.opml"');
print $output;
exit(0);
}