コード例 #1
0
ファイル: entry.php プロジェクト: johnedelatorre/fusion
 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;
 }
コード例 #2
0
 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;
 }
コード例 #3
0
 function pugpig_get_search_edition($query, $edition_id = null)
 {
     $title = "Search for \"{$query}\"";
     $all_page_ids = array();
     $search_edition_ids = array();
     if (empty($edition_id)) {
         $search_edition_ids = get_all_atom_edition_ids();
     } else {
         $title .= " inside \"{$edition_id}\"";
         $search_edition_ids[] = $edition_id;
     }
     global $is_package;
     foreach ($search_edition_ids as $search_edition_id) {
         $edition = get_edition_data(pugpig_get_edition_num_from_id($search_edition_id), $is_package);
         $all_page_ids = array_merge($all_page_ids, $edition['page_ids']);
     }
     $keep_every = intval($query);
     if ($keep_every < 1) {
         $keep_every = 2;
     }
     $page_ids = array();
     for ($index = 0; $index < count($all_page_ids); $index++) {
         if ($index % $keep_every == 0) {
             $page_ids[] = 'search.page.' . $all_page_ids[$index];
         }
     }
     $edition_key = get_search_edition_id($query, $edition_id);
     return array('key' => $edition_key, 'date' => date('Y-m-d'), 'title' => $title, 'modified' => time(), 'packaged' => time(), 'ttl' => 0, 'status' => 'published', 'price' => 'FREE', 'thumbnail' => "http://lorempixel.com/600/800/abstract/0/Search/", 'newsstand_cover_art_icon_source' => "http://dummyimage.com/768x1024/000000/ffffff.png?text=Search/", 'summary' => '', 'tombstone' => FALSE, 'url_type' => 'application/atom+xml', 'url' => "edition/{$edition_key}/" . ($is_package ? 'package.xml' : 'content.xml'), 'newsstand_summary' => '', 'page_ids' => $page_ids);
 }