function aggregator_page_opml in Drupal 4
Same name and namespace in other branches
- 5 modules/aggregator/aggregator.module \aggregator_page_opml()
- 6 modules/aggregator/aggregator.pages.inc \aggregator_page_opml()
- 7 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 1230 - Used to aggregate syndicated content (RSS, RDF, and Atom).
Code
function aggregator_page_opml($cid = NULL) {
if ($cid) {
$result = db_query('SELECT f.title, f.url FROM {aggregator_feed} f LEFT JOIN {aggregator_category_feed} c on f.fid = c.fid WHERE c.cid = %d ORDER BY title', $cid);
}
else {
$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;
}