function reply_editons_xml($atom_mode, $newsstand_mode) { header('Content-Type: application/atom+xml; charset=utf-8'); global $is_package; $is_package = !$atom_mode; $edition_ids = $atom_mode ? get_all_atom_edition_ids() : get_all_packaged_edition_ids(); $internal = FALSE; $d = pugpig_get_opds_container($edition_ids, $internal, $atom_mode, $newsstand_mode, array("Created by test script")); $d->formatOutput = TRUE; echo $d->saveXML(); exit; }
function reply_editions_xml($atom_mode, $newsstand_mode) { header('Vary: Authorization'); header('Content-Type: application/atom+xml; charset=utf-8'); global $is_package; $is_package = !$atom_mode; $edition_ids = $atom_mode ? get_all_atom_edition_ids() : get_all_packaged_edition_ids(); $internal = false; $d = pugpig_get_opds_container($edition_ids, $internal, $atom_mode, $newsstand_mode, get_opds_comments()); $d->formatOutput = true; $out = $d->saveXML(); $static_entries = get_opds_static_entries(); if (!empty($static_entries)) { $out = str_replace('</feed>', $static_entries . "\n</feed>", $out); } print $out; exit; }
$edition_ids[] = $edition->ID; $atom_timestamp = pugpig_get_page_modified($edition); if ($atom_mode) { $this_time = $atom_timestamp; } else { $package_timestamp = pugpig_get_edition_update_date(pugpig_get_edition($edition->ID), false); $this_time = max($package_timestamp, $atom_timestamp); // so cover changes etc. are picked up } if ($modified == NULL || $modified < $this_time) { $modified = $this_time; } } } pugpig_set_cache_headers($modified, $ttl); $d = pugpig_get_opds_container($edition_ids, $internal, $atom_mode, $newsstand_mode, $extra_comments); // Add any static OPDS entries to the feed $entry_xml_string = pugpig_get_extra_opds_entries(); if (!empty($entry_xml_string)) { $fragment = $d->createDocumentFragment(); $fragment->appendChild($d->createComment("Adding static entries from pugpig_static_entry_xml setting")); $ret = $fragment->appendXML($entry_xml_string); if (!$ret) { $fragment->appendChild($d->createComment("Failed to add static entries. Maybe it is not valid XML")); } $domnode = $d->getElementsByTagName('feed')->item(0); $domnode->appendChild($fragment); } $d->formatOutput = true; $opds = $d->saveXML(); echo $opds;