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_item($url, $mime_type) { $item_num = epub_itemid(); if (strpos($url, 'cover.png') !== false) { $item = '<item href="' . $url . '" id="cover-image" media-type="' . $mime_type . '" />'; } else { $item = '<item href="' . $url . '" id="' . $item_num . '" media-type="' . $mime_type . '" />'; } epub_opf_write($item); epub_write_zip($url); return $item_num; }