Exemple #1
0
epub_checkfor_ns($epub_pages[0], $epub_pages, $epub_titles);
array_push($epub_titles, "Footnotes");
epub_titlesStack($epub_titles);
$page_num = 0;
$creator = false;
foreach ($epub_pages as $page) {
    epub_update_progress("processing: {$page}");
    $creator = new epub_creator();
    if ($creator->create($page)) {
        if (isset($_POST['epub_ids'])) {
            echo rawurlencode("processed: {$page} \n");
        } else {
            echo "processed: {$page} \n";
        }
    }
}
if (epub_footnote_handle(true)) {
    epub_close_footnotes();
}
epub_css($creator);
epub_write_item('Styles/style.css', "text/css");
epub_opf_write('</manifest>');
epub_write_spine();
epub_write_footer();
epub_write_ncx();
epub_finalize_zip();
epub_update_progress("packing  ebook");
epub_pack_book();
epub_update_progress();
// deletes progress file
exit;
function epub_write_footnote($fn_id, $page, $url)
{
    static $handle;
    static $current_page = "";
    if (!$handle) {
        $handle = epub_footnote_handle();
        epub_write_fn_header($handle);
    }
    if ($current_page != $page) {
        fwrite($handle, "<br/><h1><a name='{$page}' id='{$page}'>{$page}</a></h1>\n");
    }
    $footnote = "<a href='{$page}#backto_{$fn_id}' class='wikilink1' title='{$page}'>[{$fn_id}]</a> <a href='{$url}'>{$url}</a><br />\n";
    fwrite($handle, $footnote);
    $current_page = $page;
}