- Description: Module to create and download .ePub versions of stories.
- efiction 3.x
- PHP – 5.3.2 because of functions used in the ePub Class
- I use don’t use any specialized MySQL functions. I use MySQL5 for testing and development, but again, have no specific requirements other than that.
- PHP needs to be compiled with TIDY in order to use the TIDY option.
- Apache Mod_Rewrite is needed for Search/Stanza friendly URL’s
- PHP needs to be compiled with CURL support to enable CURL as an option for image retrieval.
- PHP needs to have URL_FOPEN enabled to enable URL_FOPEN/get_file_contents() as an option for image retrieval.
- I make GREAT use of preg_match/preg_replace so your webhost needs to have perl regular expressions (regexp) enabled in PHP.
- v0.7 initial release. Broken Installer, No Image Support, Hardcoded formatting.
- v0.8 Added small configuration section at the top of epubversion.php that can be used to configure $sitename, $siteurl, and $sitetagline which are used for the OPF File’s publisher line, and the “Brought to you by” line on the cover-page.
- v0.8 Added ‘exit();’ right after the epub is sent to the user inorder to stop erroneous/extra data being sent and causing some ebook readers to detect a bad ebpu/zip container.
- v0.9 – copied formatstory() and nblr2() functions from corefunctions.php to epubversion.php to remove errors caused by stories with content warnings.
- v0.9 – Removed includes for TemplatePower, corefunctions.php. pagesetup.php
- v0.9 – more general code cleanup.
- v1.0 – Added Image Support
- v1.0 – Added Admin Configure/Options PaneL
- v1.0 – Added Author Configure/Manage Panel
- v1.0 – Added ePub Browse Panel
- v1.0 – Added Update script
- v1.0 – Added Tidy support
- v1.0 – Added ability to turn off ePub Creations for non logged in users
- v1.0 – Fixed double header error on Cover page (caused crash in Stanza)
- v1.0 – Added Title Sanitation (Caused crash in Stanza)
- v1.0 – Cleaned up code where needed. Compacted some bits
- v1.0u1 – Fixed INSTALL Script
- v1.0u1 – Fixed UPDATE Script
- v1.0u1 – Added MASTER Uninstall script that keeps removing ePub related info from the database even after errors ( modules/epubversion/dropall.php )
- v1.1 – Added choice of URL_FOPEN/get_file_contents() support for those whom don’t have CURL for image retrieval.
- v1.1 – Added choice of NONE which filters all IMG tags from the source material, and creates a image-less ePub eBook.
- v1.2 – Added Dynamic Banner option to banners list.
- v.1.2 – Incorporated changes to browse pages to fix errors as reported by Calash (THX!)
- v1.2 – Added ePub Download Counter
- v1.2 – Added pre-processing preg_replace filter for pre-processing conversion of <b><i><u><em><s><strong> into span tags.
- v1.2 – Added routine for a Combined TIDY+PURE. This option creates the largest resource hit on your server, as it essentially processes each page 4 times. (once for images, once for pre-processing, and then once each to filter through TIDY and HTMLPurifier). Each step improves the output book for better compatibility on more readers).
- v1.2 – Added support for HTMLPurifier (PURE). HTMLPurifier outputs pretty XHTML compliant source pages that make for optimally redered ePub eBooks.
- v1.3 – Added {printepub} {epubcount} {cover} {printthumb} tags to available TPL coding tags.
- v1.3 - Added support for changing the ePub "Language" identifier.
- v1.3 – Added support for site wide "Cover" images for stories.
- v1.3 – Added support for author uploaded/custom "Cover" images for stores.
- v1.3 – Upgraded EPub.php to current released version.
- v1.3 – Upgraded HTML Purifier to current released version.
- v1.3 – Added the ability to use "Cover" images on your eFiction Front page and Stories pages...
- v1.3 – Improved handling of extraneous character sets.
- v1.3 – Fixed several reported errors.
- v1.3 – Fixed Dynamic Banner code.
- v1.3u1 – Fixed installer and update.php errors present in version 1.3 and referenced in comments and the eFiction.org/de forums.
- All Formatting is currently hardcoded into ePubVersion (I will work on putting the Template.Power template support back in in a later release, but I was having issues mixing the EPub class and the Template.Power class).
Current Version: v1.3 Update 1 – (v1.3u1 Fixes installer.php and update.php errors present in version 1.3 and referenced in comments and the eFiction.org/de forums)
Demo: http://www.tgfiction.net (visit any story, and look for the ePub icon under DisplayWord and Printer friendly)
Requirements:
.
Mod History:
Download: http://storyportal.net/software/epub/
Current Issues:

Basic Documentation:
To install this module:
1. Upload the entire epubversion folder to the the modules folder within your
eFiction installation.2. Go to http://yoursite.com/admin.php?action=modules or
http://www.yoursite.com/modules/epubversion/install.php where
www.yoursite.com is your eFiction site's address.3. Goto the main default_tpls folder. Open up viewstory.tpl and
storyindex.tpl and add {printepub} where you want the ePub icon/options
to appear.4. Do the same for any skins with their own viewstory.tpl and/or storyindex.tpl
You can define $epubicon in your skin's variables.php to override the
default ePub icon if you so desire.There is one language definition in the en.php file in the languages folder
that provides the alt text for the ePub icon as well as the various text bits
for the rest of the expanded modules..The configuration variables that used to be set at the top of epubversion.php
are now set via the modules admin options panel. You can access this by
visiting http://yoursite.com/admin.php?action=modules&module=epubversion&admin=true
or by goting to the "Admin" page, clicking on "Modules" and then clicking on the
"Options" link next to ePubVersion.These variables are used to configure you "Brought to you by" line on the cover
page, and the OPF's publisher information lineThis module now has the ability for Authors to turn on/off ePub editions for
each of their stories. This is done via the User/Account menu, by clicking on
"Manage ePub Stories". By default, the ePub bit is set to "0" or "Off" for
all authors. They must "Opt In"5) We have added several new tags to ePubVersion that can be added to your templates.
{printepub} -- Displays a direct Download link for ePub version of a Story.
{printthumb} -- Displays a thumbnail Image of the epub/Book Cover is one has been
set in "Manage ePub Stories". Cover image is dynamicaly resized so that max width
or height is no larger than 100px. Original Aspect ratios are kept.
Requires PHP Compiled with GD, and GD compiled with PNG/JPG/GIF support.{cover} -- Displays an Image of the epub/Book Cover is one has been set in "Manage
ePub Stories". Cover image is dynamicaly resized so that max width
or height is no larger than 250px. Original Aspect ratios are kept.
Requires PHP Compiled with GD, and GD compiled with PNG/JPG/GIF support.{epubcount} -- Returns the number of times a Story has been downloaded as "epub"
in numerical form.Below you will find sample usage of the new skin tags as found in my index.tpl (recentblock)
and listings.tpl (storyblock). I have made use of CSS to make the various "boxes" size
properly around the images.
<!-- START BLOCK : recentblock -->
<div style="min-height:100px; height:auto!important; height:100px;">
<span style="font-weight: bold; font-size: 1.2em; border-bottom: 1px dashed #999; margin-bottom: 5px;">
{printthumb}{title} by {author} {printepub}</span><br />
<span class="label">Summary: </span>{summary}<br />
<span class="label">Rated:</span> {rating} {score} <span class="label">Categories:</span> {category} {classes}</span>
<br />
</div>
<hr>
<!-- END BLOCK : recentblock -->
<!-- START BLOCK : storyblock -->
<div class="listbox {oddeven}">
<div class="title"><span class="t2">{title}</span> by {author} <span class="label">Rated:</span> {rating} {roundrobin} {score} [{reviews} - {numreviews}] {new} </div>
<div style="min-height:250px; height:auto!important; height:250px;">
{cover}
<div class="content"><span class="label">Summary: </span>{featuredstory}{summary}<br />
<span class="label">Categories:</span> {category} <br />
<span class="label">Characters: </span> {characters}<br />
{classifications}
<span class="label">Series:</span> {serieslinks}<br />
<span class="label">Chapters: </span> {numchapters} {toc}<br />
<span class="label">Completed:</span> {completed}
<span class="label">Word count:</span> {wordcount} <span class="label">Read Count:</span> {count} <span class="label">ePub Downloads:</span> {epubcount}
{adminlinks}</div></div>
<div class="tail"><span class="label">{printepub} {addtofaves} {reportthis} Published: </span>{published} <span class="label">Updated:</span> {updated}</div>
</div>
{comment}
<!-- END BLOCK : storyblock -->
Please leave my info in any derivative works, as I have left Tammy’s. This module is released under GPL and is free to use. Use it to your hearts content.
You can post comments/complaints here or @ my wordpress site, but the wordpress site (storyportal.net) will probably get replies first.
-HuGgLeS-
-P/KAF/PT
StoryPortal Fiction Network -
TG Fiction dot NET | T* Fiction Archive -
LG Tales | TG Style Fiction for LG's -
Your download links don't work.
Yeah, that's what I get for trusting that the download monitor plugin for WordPress to actually put the files where it thought it put them...
Download links have been fixed.
-HuGgLeS-
-P/KAF/PT
StoryPortal Fiction Network -
TG Fiction dot NET | T* Fiction Archive -
LG Tales | TG Style Fiction for LG's -
Just fixed a bit of code on the multi chapter epub creation, and cleaned up some of the headers in general. I'm also working at adding subroutines for php's "tidy" class so that the content can be made more conforming.
Will release updated code shortly.
-HuGgLeS-
-P/KAF/PT
StoryPortal Fiction Network -
TG Fiction dot NET | T* Fiction Archive -
LG Tales | TG Style Fiction for LG's -
Initial Post updated, Updated code released. Download URL's checked 😉
On a separate but related note, what's the correct etiquette for posting updates, just update the initial post, or should I edit the initial post, and then also post a notice of the update to the thread like this?
-P/KAF/PT
StoryPortal Fiction Network -
TG Fiction dot NET | T* Fiction Archive -
LG Tales | TG Style Fiction for LG's -
Most people update the OP so that people who don't read don't download an old version on accident, but also leave a post saying there's an update so that people will notice. (ie I always check "show unread posts since last visit")
Piper this is going to be awesome! I get so many requests for an epub option on my site but I don't have the programming skills required to make it happen. I appreciate your efforts very much.
Just trying to install now but when I get to step 2, I get the following when trying to run /modules/epubversion/install.php (I'm currently running eFiction version 3.5.1).
Parse error: syntax error, unexpected '"' in /XXX/fictioning.net/modules/epubversion/version.php on line 11
Actually, I get this message when I try to access "Modules" from the admin menu too.
(cross posted to your wordpress site)
Original posting updated. New code released to fix reported errors.
Changelog:
v0.9 – copied formatstory() and nblr2() functions from corefunctions.php to epubversion.php to remove errors caused by stories with content warnings.
v0.9 – Removed includes for TemplatePower, corefunctions.php. pagesetup.php
v0.9 – more general code cleanup.
We are on track to add image support in either the 1.0 or 1.1 version.Tidy and Regexp/DomXML formatting of the ebooks is on track for 1.0 release.
StoryPortal Fiction Network -
TG Fiction dot NET | T* Fiction Archive -
LG Tales | TG Style Fiction for LG's -
Piper, again - thank you so much for this module.
I've installed 0.9 and all errors etc are gone and have successfully downloaded stories. Let me say it again - brilliant!
This looks really interesting.
One question: I don't own an eReader, but I'm still thinking of installing this on my site. Is there a program with which I can open Epub files to test whether the downloading/converting works?
Calibre does: http://calibre-ebook.com/ So does the Nook app, I believe.
Thanks! I'll give it a shot then:)
Adobe also offers "Adobe Digital Editions" free for the PC. http://www.adobe.com/products/digitaleditions/ .
Adobe Digital Editions is the DRM/Renderer used by many commercial eBook readers (such as the Barnes and Noble Nook) license to read DRM encoded eBooks, so if you purchase say eBooks or electronic textbooks from Barnes and Noble to read on Adobe Digital Editions, they will be fully transferable to be read on your Nook or other similar eBook readers should you ever get one. (Kindle does NOT support ePub natively).
There are also various readers for iPhone, iPad, BlackBerry, Windows Mobile, Android, and Windows Phone 7... Usually just searching for ePub or eBook Reader in the various marketplaces is the best way to go.
-HuGgLeS- and I hope this helps.
-P/KAF/PT
StoryPortal Fiction Network -
TG Fiction dot NET | T* Fiction Archive -
LG Tales | TG Style Fiction for LG's -
Ah, yeah, forgot about that one. It's for Mac too. I have it, lol. It's how I load ebooks from the library onto my Nook.
Well, as I just released the 0.9 code last night to fix several small errors, I'm not reay to release a new version quite yet... But I thought I would let everyone know, that I have successfully integrated Tidy support and Images support into the latest version of the code, that can be seen running @ TGFiction.Net.
I have tested the eBooks using Adobe Digital Editions, my Nook, Calibre's eBook Reader, and the most picky eReader I could find, Aldiko for Android.
The eBooks that ePubVersion is outputting are not quite perfect, and still don't validate properly using ePub Validators, but they seem to read fine now (without errors) in every eReader I can find to try them out in.
I'm currently working on making the script VERY configurable since this will be a 1.0 release and I want to have code I can truely be proud of, and I hope to do a lot of code cleanup and reorganization too.
If you have any comments or suggestions that would be good for my 1.0 release please send them in! I can't do too much more to improve this script without everyone's ideas!
-HuGgLES-
-P/KAF/PT
StoryPortal Fiction Network -
TG Fiction dot NET | T* Fiction Archive -
LG Tales | TG Style Fiction for LG's -
