X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FHelper%2FEntriesExport.php;h=e50c68a67a91f0870a97f254df0328ace7e886c8;hb=bf71a734f64a911549e188a5c69ac8e08eec896e;hp=7327631926e418a04feb37bbb260026533a43ba2;hpb=c078d18372e05b09b40c34f67b7cb81446f30c4f;p=github%2Fwallabag%2Fwallabag.git
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
index 73276319..e50c68a6 100644
--- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php
+++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
@@ -21,11 +21,10 @@ class EntriesExport
private $entries = [];
private $authors = ['wallabag'];
private $language = '';
- private $tags = [];
private $footerTemplate = '
Produced by wallabag with %EXPORT_METHOD%
Please open an issue if you have trouble with the display of this E-Book on your device.
-
';
/**
* @param Config $craueConfig CraueConfig instance to get wallabag instance url from database
@@ -53,10 +52,6 @@ class EntriesExport
$this->entries = $entries;
- foreach ($entries as $entry) {
- $this->tags[] = $entry->getTags();
- }
-
return $this;
}
@@ -159,12 +154,16 @@ class EntriesExport
// set tags as subjects
foreach ($this->entries as $entry) {
- foreach ($this->tags as $tag) {
- $book->setSubject($tag['value']);
+ foreach ($entry->getTags() as $tag) {
+ $book->setSubject($tag->getLabel());
}
+ // the reader in Kobo Devices doesn't likes special caracters
+ // in filenames, we limit to A-z/0-9
+ $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle());
+
$chapter = $content_start.$entry->getContent().$bookEnd;
- $book->addChapter($entry->getTitle(), htmlspecialchars($entry->getTitle()).'.html', $chapter, true, EPub::EXTERNAL_REF_ADD);
+ $book->addChapter($entry->getTitle(), htmlspecialchars($filename).'.html', $chapter, true, EPub::EXTERNAL_REF_ADD);
}
return Response::create(
@@ -261,8 +260,8 @@ class EntriesExport
* Adding actual entries
*/
foreach ($this->entries as $entry) {
- foreach ($this->tags as $tag) {
- $pdf->SetKeywords($tag['value']);
+ foreach ($entry->getTags() as $tag) {
+ $pdf->SetKeywords($tag->getLabel());
}
$pdf->AddPage();