aboutsummaryrefslogtreecommitdiffhomepage
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/Wallabag/CoreBundle/Helper/EntriesExport.php12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
index 5658a7d3..ea5a03cf 100644
--- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php
+++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
@@ -173,6 +173,8 @@ class EntriesExport
173 } 173 }
174 174
175 $entryIds = []; 175 $entryIds = [];
176 $entryCount = \count($this->entries);
177 $i = 0;
176 178
177 /* 179 /*
178 * Adding actual entries 180 * Adding actual entries
@@ -180,20 +182,18 @@ class EntriesExport
180 182
181 // set tags as subjects 183 // set tags as subjects
182 foreach ($this->entries as $entry) { 184 foreach ($this->entries as $entry) {
185 ++$i;
183 foreach ($entry->getTags() as $tag) { 186 foreach ($entry->getTags() as $tag) {
184 $book->setSubject($tag->getLabel()); 187 $book->setSubject($tag->getLabel());
185 } 188 }
186 189 $filename = sha1($entry->getTitle());
187 // the reader in Kobo Devices doesn't likes special caracters
188 // in filenames, we limit to A-z/0-9
189 $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle());
190 190
191 $titlepage = $content_start . '<h1>' . $entry->getTitle() . '</h1>' . $this->getExportInformation('PHPePub') . $bookEnd; 191 $titlepage = $content_start . '<h1>' . $entry->getTitle() . '</h1>' . $this->getExportInformation('PHPePub') . $bookEnd;
192 $book->addChapter('Title', 'Title.html', $titlepage, true, EPub::EXTERNAL_REF_ADD); 192 $book->addChapter("Entry {$i} of {$entryCount}", "{$filename}_cover.html", $titlepage, true, EPub::EXTERNAL_REF_ADD);
193 $chapter = $content_start . $entry->getContent() . $bookEnd; 193 $chapter = $content_start . $entry->getContent() . $bookEnd;
194 $book->addChapter($entry->getTitle(), htmlspecialchars($filename) . '.html', $chapter, true, EPub::EXTERNAL_REF_ADD);
195 194
196 $entryIds[] = $entry->getId(); 195 $entryIds[] = $entry->getId();
196 $book->addChapter($entry->getTitle(), "{$filename}.html", $chapter, true, EPub::EXTERNAL_REF_ADD);
197 } 197 }
198 198
199 // Could also be the ISBN number, prefered for published books, or a UUID. 199 // Could also be the ISBN number, prefered for published books, or a UUID.