aboutsummaryrefslogtreecommitdiffhomepage
path: root/inc/poche
diff options
context:
space:
mode:
authortcit <tcit@tcit.fr>2014-05-07 12:40:09 +0200
committertcit <tcit@tcit.fr>2014-05-07 12:40:09 +0200
commit4877836b12cde621a9c6200ec460ce025384ea35 (patch)
treebead3e5b9037b40a8c40d41a0bcab44f244e1b98 /inc/poche
parent2395a3802a821667b1bdd84a848d193d0d27ad2a (diff)
downloadwallabag-4877836b12cde621a9c6200ec460ce025384ea35.tar.gz
wallabag-4877836b12cde621a9c6200ec460ce025384ea35.tar.zst
wallabag-4877836b12cde621a9c6200ec460ce025384ea35.zip
Many improvements to epub produced : better cover, better tags
Diffstat (limited to 'inc/poche')
-rwxr-xr-xinc/poche/Poche.class.php23
1 files changed, 15 insertions, 8 deletions
diff --git a/inc/poche/Poche.class.php b/inc/poche/Poche.class.php
index c476df3e..c99bfcba 100755
--- a/inc/poche/Poche.class.php
+++ b/inc/poche/Poche.class.php
@@ -1200,30 +1200,37 @@ class Poche
1200 $book->setSourceURL("http://$_SERVER[HTTP_HOST]"); 1200 $book->setSourceURL("http://$_SERVER[HTTP_HOST]");
1201 1201
1202 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP"); 1202 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "PHP");
1203 $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, "wallabag");
1203 1204
1204 $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n"; 1205 $cssData = "body {\n margin-left: .5em;\n margin-right: .5em;\n text-align: justify;\n}\n\np {\n font-family: serif;\n font-size: 10pt;\n text-align: justify;\n text-indent: 1em;\n margin-top: 0px;\n margin-bottom: 1ex;\n}\n\nh1, h2 {\n font-family: sans-serif;\n font-style: italic;\n text-align: center;\n background-color: #6b879c;\n color: white;\n width: 100%;\n}\n\nh1 {\n margin-bottom: 2px;\n}\n\nh2 {\n margin-top: -2px;\n margin-bottom: 2px;\n}\n";
1205 1206
1206 $log->logLine("Add Cover Image"); 1207 $log->logLine("Add Cover");
1207 $book->setCoverImage("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png"); 1208 if (count($entries)>1){
1209 $cover = "<h1>" . $entries[0]['title'] . " and " . count($entries) . " other articles</h1>";
1210 } else {
1211 $cover = "<h1>" . $entries[0]['title'] . "</h1>";
1212 }
1213 $book->setCover("Cover.png", file_get_contents("themes/baggy/img/apple-touch-icon-152.png"), "image/png", $cover);
1214
1208 1215
1209 $cover = $content_start . "<h1>My articles on wallabag</h1>\n<h2>As seen on : http://$_SERVER[HTTP_HOST]</h2>\n" . $bookEnd; 1216 $book->setCover($cover);
1210 $book->addChapter("Notices", "Cover.html", $cover); 1217 //$book->addChapter("Notices", "Cover.html", $cover);
1211 $book->buildTOC(NULL, "toc", "Table of Contents", TRUE, TRUE); 1218 $book->buildTOC(NULL, "toc", "Table of Contents", TRUE, TRUE);
1219 $subject = "";
1212 1220
1213 foreach ($entries as $entry) { 1221 foreach ($entries as $entry) {
1214 $tags = $this->store->retrieveTagsByEntry($entry['id']); 1222 $tags = $this->store->retrieveTagsByEntry($entry['id']);
1215 foreach ($tags as $tag) { 1223 foreach ($tags as $tag) {
1216 $book->setSubject($tag['value']); 1224 $subject =. $tag['value'] . ',';
1217 } 1225 }
1218 1226
1219 $log->logLine("Set up parameters"); 1227 $log->logLine("Set up parameters");
1220 1228
1221
1222
1223 $chapter = $content_start . $entry['content'] . $bookEnd; 1229 $chapter = $content_start . $entry['content'] . $bookEnd;
1224 $book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD); 1230 $book->addChapter($entry['title'], htmlspecialchars($entry['title']) . ".html", $chapter, true, EPub::EXTERNAL_REF_ADD);
1231 $log->logLine("Added chapter " . $entry['title']);
1225 } 1232 }
1226 1233 $book->setSubject($subject);
1227 1234
1228 if (DEBUG_POCHE) { 1235 if (DEBUG_POCHE) {
1229 $epuplog = $book->getLog(); 1236 $epuplog = $book->getLog();