diff options
author | Étienne Gilli <etienne.gilli@gmail.com> | 2017-07-08 17:55:58 +0200 |
---|---|---|
committer | Étienne Gilli <etienne.gilli@gmail.com> | 2017-07-08 19:53:43 +0200 |
commit | 07320a2bd25c6ace1f9b1aa06b1b08e8dbf4f4fa (patch) | |
tree | 61d8992d8511c324208b8ad9fc9e2c6a8952492d /src/Wallabag/CoreBundle/Helper/EntriesExport.php | |
parent | b5d7eb148c4cd62ff187b08765f0c13c7d330fcf (diff) | |
download | wallabag-07320a2bd25c6ace1f9b1aa06b1b08e8dbf4f4fa.tar.gz wallabag-07320a2bd25c6ace1f9b1aa06b1b08e8dbf4f4fa.tar.zst wallabag-07320a2bd25c6ace1f9b1aa06b1b08e8dbf4f4fa.zip |
Use the article domain as author for export files
When exporting an entry, use the domain name as author name for epub,
mobi and pdf formats, instead of 'wallabag'.
Change the author from array to string, because for now, there is always
only one author.
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/EntriesExport.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/EntriesExport.php | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index cd74cc4f..d749dcf9 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php | |||
@@ -18,7 +18,7 @@ class EntriesExport | |||
18 | private $logoPath; | 18 | private $logoPath; |
19 | private $title = ''; | 19 | private $title = ''; |
20 | private $entries = []; | 20 | private $entries = []; |
21 | private $authors = ['wallabag']; | 21 | private $author = 'wallabag'; |
22 | private $language = ''; | 22 | private $language = ''; |
23 | private $footerTemplate = '<div style="text-align:center;"> | 23 | private $footerTemplate = '<div style="text-align:center;"> |
24 | <p>Produced by wallabag with %EXPORT_METHOD%</p> | 24 | <p>Produced by wallabag with %EXPORT_METHOD%</p> |
@@ -73,6 +73,24 @@ class EntriesExport | |||
73 | } | 73 | } |
74 | 74 | ||
75 | /** | 75 | /** |
76 | * Sets the author for just one entry. | ||
77 | * | ||
78 | * @param string $method Method to get articles | ||
79 | * | ||
80 | * @return EntriesExport | ||
81 | */ | ||
82 | public function updateAuthor($method) | ||
83 | { | ||
84 | $this->author = $method.' authors'; | ||
85 | |||
86 | if ('entry' === $method) { | ||
87 | $this->author = $this->entries[0]->getDomainName(); | ||
88 | } | ||
89 | |||
90 | return $this; | ||
91 | } | ||
92 | |||
93 | /** | ||
76 | * Sets the output format. | 94 | * Sets the output format. |
77 | * | 95 | * |
78 | * @param string $format | 96 | * @param string $format |
@@ -128,9 +146,7 @@ class EntriesExport | |||
128 | $book->setLanguage($this->language); | 146 | $book->setLanguage($this->language); |
129 | $book->setDescription('Some articles saved on my wallabag'); | 147 | $book->setDescription('Some articles saved on my wallabag'); |
130 | 148 | ||
131 | foreach ($this->authors as $author) { | 149 | $book->setAuthor($this->author, $this->author); |
132 | $book->setAuthor($author, $author); | ||
133 | } | ||
134 | 150 | ||
135 | // I hope this is a non existant address :) | 151 | // I hope this is a non existant address :) |
136 | $book->setPublisher('wallabag', 'wallabag'); | 152 | $book->setPublisher('wallabag', 'wallabag'); |
@@ -196,7 +212,7 @@ class EntriesExport | |||
196 | * Book metadata | 212 | * Book metadata |
197 | */ | 213 | */ |
198 | $content->set('title', $this->title); | 214 | $content->set('title', $this->title); |
199 | $content->set('author', implode($this->authors)); | 215 | $content->set('author', $this->author); |
200 | $content->set('subject', $this->title); | 216 | $content->set('subject', $this->title); |
201 | 217 | ||
202 | /* | 218 | /* |
@@ -247,7 +263,7 @@ class EntriesExport | |||
247 | * Book metadata | 263 | * Book metadata |
248 | */ | 264 | */ |
249 | $pdf->SetCreator(PDF_CREATOR); | 265 | $pdf->SetCreator(PDF_CREATOR); |
250 | $pdf->SetAuthor('wallabag'); | 266 | $pdf->SetAuthor($this->author); |
251 | $pdf->SetTitle($this->title); | 267 | $pdf->SetTitle($this->title); |
252 | $pdf->SetSubject('Articles via wallabag'); | 268 | $pdf->SetSubject('Articles via wallabag'); |
253 | $pdf->SetKeywords('wallabag'); | 269 | $pdf->SetKeywords('wallabag'); |