aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Wallabag/CoreBundle/Controller/ExportController.php5
-rw-r--r--src/Wallabag/CoreBundle/Helper/EntriesExport.php92
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.da.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.de.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.en.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.es.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.it.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml8
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml9
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.th.yml6
-rw-r--r--src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml6
-rw-r--r--tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php11
17 files changed, 165 insertions, 32 deletions
diff --git a/src/Wallabag/CoreBundle/Controller/ExportController.php b/src/Wallabag/CoreBundle/Controller/ExportController.php
index 7ca89239..9e9dbe49 100644
--- a/src/Wallabag/CoreBundle/Controller/ExportController.php
+++ b/src/Wallabag/CoreBundle/Controller/ExportController.php
@@ -58,6 +58,7 @@ class ExportController extends Controller
58 $method = ucfirst($category); 58 $method = ucfirst($category);
59 $methodBuilder = 'getBuilderFor' . $method . 'ByUser'; 59 $methodBuilder = 'getBuilderFor' . $method . 'ByUser';
60 $repository = $this->get('wallabag_core.entry_repository'); 60 $repository = $this->get('wallabag_core.entry_repository');
61 $title = $method;
61 62
62 if ('tag_entries' === $category) { 63 if ('tag_entries' === $category) {
63 $tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag')); 64 $tag = $this->get('wallabag_core.tag_repository')->findOneBySlug($request->query->get('tag'));
@@ -66,6 +67,8 @@ class ExportController extends Controller
66 $this->getUser()->getId(), 67 $this->getUser()->getId(),
67 $tag->getId() 68 $tag->getId()
68 ); 69 );
70
71 $title = 'Tag ' . $tag->getLabel();
69 } else { 72 } else {
70 $entries = $repository 73 $entries = $repository
71 ->$methodBuilder($this->getUser()->getId()) 74 ->$methodBuilder($this->getUser()->getId())
@@ -76,7 +79,7 @@ class ExportController extends Controller
76 try { 79 try {
77 return $this->get('wallabag_core.helper.entries_export') 80 return $this->get('wallabag_core.helper.entries_export')
78 ->setEntries($entries) 81 ->setEntries($entries)
79 ->updateTitle($method) 82 ->updateTitle($title)
80 ->updateAuthor($method) 83 ->updateAuthor($method)
81 ->exportAs($format); 84 ->exportAs($format);
82 } catch (\InvalidArgumentException $e) { 85 } catch (\InvalidArgumentException $e) {
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
index 6082f6b9..64591687 100644
--- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php
+++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
@@ -85,7 +85,7 @@ class EntriesExport
85 public function updateAuthor($method) 85 public function updateAuthor($method)
86 { 86 {
87 if ('entry' !== $method) { 87 if ('entry' !== $method) {
88 $this->author = $method . ' authors'; 88 $this->author = 'Various authors';
89 89
90 return $this; 90 return $this;
91 } 91 }
@@ -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,35 +182,47 @@ 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 }
189 $filename = sha1($entry->getTitle());
186 190
187 // the reader in Kobo Devices doesn't likes special caracters 191 $publishedBy = $entry->getPublishedBy();
188 // in filenames, we limit to A-z/0-9 192 $authors = $this->translator->trans('export.unknown');
189 $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle()); 193 if (!empty($publishedBy)) {
194 $authors = implode(',', $publishedBy);
195 }
190 196
191 $titlepage = $content_start . '<h1>' . $entry->getTitle() . '</h1>' . $this->getExportInformation('PHPePub') . $bookEnd; 197 $titlepage = $content_start .
192 $book->addChapter('Title', 'Title.html', $titlepage, true, EPub::EXTERNAL_REF_ADD); 198 '<h1>' . $entry->getTitle() . '</h1>' .
199 '<dl>' .
200 '<dt>' . $this->translator->trans('entry.view.published_by') . '</dt><dd>' . $authors . '</dd>' .
201 '<dt>' . $this->translator->trans('entry.metadata.reading_time') . '</dt><dd>' . $this->translator->trans('entry.metadata.reading_time_minutes_short', ['%readingTime%' => $entry->getReadingTime()]) . '</dd>' .
202 '<dt>' . $this->translator->trans('entry.metadata.added_on') . '</dt><dd>' . $entry->getCreatedAt()->format('Y-m-d') . '</dd>' .
203 '<dt>' . $this->translator->trans('entry.metadata.address') . '</dt><dd><a href="' . $entry->getUrl() . '">' . $entry->getUrl() . '</a></dd>' .
204 '</dl>' .
205 $bookEnd;
206 $book->addChapter("Entry {$i} of {$entryCount}", "{$filename}_cover.html", $titlepage, true, EPub::EXTERNAL_REF_ADD);
193 $chapter = $content_start . $entry->getContent() . $bookEnd; 207 $chapter = $content_start . $entry->getContent() . $bookEnd;
194 $book->addChapter($entry->getTitle(), htmlspecialchars($filename) . '.html', $chapter, true, EPub::EXTERNAL_REF_ADD);
195 208
196 $entryIds[] = $entry->getId(); 209 $entryIds[] = $entry->getId();
210 $book->addChapter($entry->getTitle(), "{$filename}.html", $chapter, true, EPub::EXTERNAL_REF_ADD);
197 } 211 }
198 212
213 $book->addChapter('Notices', 'Cover2.html', $content_start . $this->getExportInformation('PHPePub') . $bookEnd);
214
199 // Could also be the ISBN number, prefered for published books, or a UUID. 215 // Could also be the ISBN number, prefered for published books, or a UUID.
200 $hash = sha1(sprintf('%s:%s', $this->wallabagUrl, implode(',', $entryIds))); 216 $hash = sha1(sprintf('%s:%s', $this->wallabagUrl, implode(',', $entryIds)));
201 $book->setIdentifier(sprintf('urn:wallabag:%s', $hash), EPub::IDENTIFIER_URI); 217 $book->setIdentifier(sprintf('urn:wallabag:%s', $hash), EPub::IDENTIFIER_URI);
202 218
203 $book->buildTOC();
204
205 return Response::create( 219 return Response::create(
206 $book->getBook(), 220 $book->getBook(),
207 200, 221 200,
208 [ 222 [
209 'Content-Description' => 'File Transfer', 223 'Content-Description' => 'File Transfer',
210 'Content-type' => 'application/epub+zip', 224 'Content-type' => 'application/epub+zip',
211 'Content-Disposition' => 'attachment; filename="' . $this->title . '.epub"', 225 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.epub"',
212 'Content-Transfer-Encoding' => 'binary', 226 'Content-Transfer-Encoding' => 'binary',
213 ] 227 ]
214 ); 228 );
@@ -250,9 +264,6 @@ class EntriesExport
250 } 264 }
251 $mobi->setContentProvider($content); 265 $mobi->setContentProvider($content);
252 266
253 // the browser inside Kindle Devices doesn't likes special caracters either, we limit to A-z/0-9
254 $this->title = preg_replace('/[^A-Za-z0-9\-]/', '', $this->title);
255
256 return Response::create( 267 return Response::create(
257 $mobi->toString(), 268 $mobi->toString(),
258 200, 269 200,
@@ -260,7 +271,7 @@ class EntriesExport
260 'Accept-Ranges' => 'bytes', 271 'Accept-Ranges' => 'bytes',
261 'Content-Description' => 'File Transfer', 272 'Content-Description' => 'File Transfer',
262 'Content-type' => 'application/x-mobipocket-ebook', 273 'Content-type' => 'application/x-mobipocket-ebook',
263 'Content-Disposition' => 'attachment; filename="' . $this->title . '.mobi"', 274 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.mobi"',
264 'Content-Transfer-Encoding' => 'binary', 275 'Content-Transfer-Encoding' => 'binary',
265 ] 276 ]
266 ); 277 );
@@ -285,14 +296,6 @@ class EntriesExport
285 $pdf->SetKeywords('wallabag'); 296 $pdf->SetKeywords('wallabag');
286 297
287 /* 298 /*
288 * Front page
289 */
290 $pdf->AddPage();
291 $intro = '<h1>' . $this->title . '</h1>' . $this->getExportInformation('tcpdf');
292
293 $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true);
294
295 /*
296 * Adding actual entries 299 * Adding actual entries
297 */ 300 */
298 foreach ($this->entries as $entry) { 301 foreach ($this->entries as $entry) {
@@ -300,6 +303,22 @@ class EntriesExport
300 $pdf->SetKeywords($tag->getLabel()); 303 $pdf->SetKeywords($tag->getLabel());
301 } 304 }
302 305
306 $publishedBy = $entry->getPublishedBy();
307 $authors = $this->translator->trans('export.unknown');
308 if (!empty($publishedBy)) {
309 $authors = implode(',', $publishedBy);
310 }
311
312 $pdf->addPage();
313 $html = '<h1>' . $entry->getTitle() . '</h1>' .
314 '<dl>' .
315 '<dt>' . $this->translator->trans('entry.view.published_by') . '</dt><dd>' . $authors . '</dd>' .
316 '<dt>' . $this->translator->trans('entry.metadata.reading_time') . '</dt><dd>' . $this->translator->trans('entry.metadata.reading_time_minutes_short', ['%readingTime%' => $entry->getReadingTime()]) . '</dd>' .
317 '<dt>' . $this->translator->trans('entry.metadata.added_on') . '</dt><dd>' . $entry->getCreatedAt()->format('Y-m-d') . '</dd>' .
318 '<dt>' . $this->translator->trans('entry.metadata.address') . '</dt><dd><a href="' . $entry->getUrl() . '">' . $entry->getUrl() . '</a></dd>' .
319 '</dl>';
320 $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
321
303 $pdf->AddPage(); 322 $pdf->AddPage();
304 $html = '<h1>' . $entry->getTitle() . '</h1>'; 323 $html = '<h1>' . $entry->getTitle() . '</h1>';
305 $html .= $entry->getContent(); 324 $html .= $entry->getContent();
@@ -307,6 +326,14 @@ class EntriesExport
307 $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); 326 $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
308 } 327 }
309 328
329 /*
330 * Last page
331 */
332 $pdf->AddPage();
333 $html = $this->getExportInformation('tcpdf');
334
335 $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
336
310 // set image scale factor 337 // set image scale factor
311 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); 338 $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
312 339
@@ -316,7 +343,7 @@ class EntriesExport
316 [ 343 [
317 'Content-Description' => 'File Transfer', 344 'Content-Description' => 'File Transfer',
318 'Content-type' => 'application/pdf', 345 'Content-type' => 'application/pdf',
319 'Content-Disposition' => 'attachment; filename="' . $this->title . '.pdf"', 346 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.pdf"',
320 'Content-Transfer-Encoding' => 'binary', 347 'Content-Transfer-Encoding' => 'binary',
321 ] 348 ]
322 ); 349 );
@@ -362,7 +389,7 @@ class EntriesExport
362 200, 389 200,
363 [ 390 [
364 'Content-type' => 'application/csv', 391 'Content-type' => 'application/csv',
365 'Content-Disposition' => 'attachment; filename="' . $this->title . '.csv"', 392 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.csv"',
366 'Content-Transfer-Encoding' => 'UTF-8', 393 'Content-Transfer-Encoding' => 'UTF-8',
367 ] 394 ]
368 ); 395 );
@@ -380,7 +407,7 @@ class EntriesExport
380 200, 407 200,
381 [ 408 [
382 'Content-type' => 'application/json', 409 'Content-type' => 'application/json',
383 'Content-Disposition' => 'attachment; filename="' . $this->title . '.json"', 410 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.json"',
384 'Content-Transfer-Encoding' => 'UTF-8', 411 'Content-Transfer-Encoding' => 'UTF-8',
385 ] 412 ]
386 ); 413 );
@@ -398,7 +425,7 @@ class EntriesExport
398 200, 425 200,
399 [ 426 [
400 'Content-type' => 'application/xml', 427 'Content-type' => 'application/xml',
401 'Content-Disposition' => 'attachment; filename="' . $this->title . '.xml"', 428 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.xml"',
402 'Content-Transfer-Encoding' => 'UTF-8', 429 'Content-Transfer-Encoding' => 'UTF-8',
403 ] 430 ]
404 ); 431 );
@@ -424,7 +451,7 @@ class EntriesExport
424 200, 451 200,
425 [ 452 [
426 'Content-type' => 'text/plain', 453 'Content-type' => 'text/plain',
427 'Content-Disposition' => 'attachment; filename="' . $this->title . '.txt"', 454 'Content-Disposition' => 'attachment; filename="' . $this->getSanitizedFilename() . '.txt"',
428 'Content-Transfer-Encoding' => 'UTF-8', 455 'Content-Transfer-Encoding' => 'UTF-8',
429 ] 456 ]
430 ); 457 );
@@ -467,4 +494,15 @@ class EntriesExport
467 494
468 return str_replace('%IMAGE%', '', $info); 495 return str_replace('%IMAGE%', '', $info);
469 } 496 }
497
498 /**
499 * Return a sanitized version of the title by applying translit iconv
500 * and removing non alphanumeric characters, - and space.
501 *
502 * @return string Sanitized filename
503 */
504 private function getSanitizedFilename()
505 {
506 return preg_replace('/[^A-Za-z0-9\- \']/', '', iconv('utf-8', 'us-ascii//TRANSLIT', $this->title));
507 }
470} 508}
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
index e3ff21f1..97eb874d 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.da.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 # delete: "Are you sure you want to remove that article?" 254 # delete: "Are you sure you want to remove that article?"
255 # delete_tag: "Are you sure you want to remove that tag from that article?" 255 # delete_tag: "Are you sure you want to remove that tag from that article?"
256 metadata:
257 # reading_time: "Estimated reading time"
258 # reading_time_minutes_short: "%readingTime% min"
259 # address: "Address"
260 # added_on: "Added on"
256 261
257about: 262about:
258 page_title: 'Om' 263 page_title: 'Om'
@@ -402,6 +407,7 @@ tag:
402 407
403# export: 408# export:
404# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' 409# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
410# unknown: 'Unknown'
405 411
406import: 412import:
407 # page_title: 'Import' 413 # page_title: 'Import'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
index c297ffb5..0cf3b138 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.de.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 delete: 'Bist du sicher, dass du diesen Artikel löschen möchtest?' 254 delete: 'Bist du sicher, dass du diesen Artikel löschen möchtest?'
255 delete_tag: 'Bist du sicher, dass du diesen Tag vom Artikel entfernen möchtest?' 255 delete_tag: 'Bist du sicher, dass du diesen Tag vom Artikel entfernen möchtest?'
256 metadata:
257 # reading_time: "Estimated reading time"
258 # reading_time_minutes_short: "%readingTime% min"
259 # address: "Address"
260 # added_on: "Added on"
256 261
257about: 262about:
258 page_title: 'Über' 263 page_title: 'Über'
@@ -402,6 +407,7 @@ tag:
402 407
403export: 408export:
404 footer_template: '<div style="text-align:center;"><p>Generiert von wallabag mit Hilfe von %method%</p><p>Bitte öffne <a href="https://github.com/wallabag/wallabag/issues">ein Ticket</a> wenn du ein Problem mit der Darstellung von diesem E-Book auf deinem Gerät hast.</p></div>' 409 footer_template: '<div style="text-align:center;"><p>Generiert von wallabag mit Hilfe von %method%</p><p>Bitte öffne <a href="https://github.com/wallabag/wallabag/issues">ein Ticket</a> wenn du ein Problem mit der Darstellung von diesem E-Book auf deinem Gerät hast.</p></div>'
410 # unknown: 'Unknown'
405 411
406import: 412import:
407 page_title: 'Importieren' 413 page_title: 'Importieren'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
index 169ae728..6085be14 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.en.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 delete: "Are you sure you want to remove that article?" 254 delete: "Are you sure you want to remove that article?"
255 delete_tag: "Are you sure you want to remove that tag from that article?" 255 delete_tag: "Are you sure you want to remove that tag from that article?"
256 metadata:
257 reading_time: "Estimated reading time"
258 reading_time_minutes_short: "%readingTime% min"
259 address: "Address"
260 added_on: "Added on"
256 261
257about: 262about:
258 page_title: 'About' 263 page_title: 'About'
@@ -402,6 +407,7 @@ tag:
402 407
403export: 408export:
404 footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' 409 footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
410 unknown: 'Unknown'
405 411
406import: 412import:
407 page_title: 'Import' 413 page_title: 'Import'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
index 039a1867..f2a8fb89 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.es.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 # delete: "Are you sure you want to remove that article?" 254 # delete: "Are you sure you want to remove that article?"
255 # delete_tag: "Are you sure you want to remove that tag from that article?" 255 # delete_tag: "Are you sure you want to remove that tag from that article?"
256 metadata:
257 # reading_time: "Estimated reading time"
258 # reading_time_minutes_short: "%readingTime% min"
259 # address: "Address"
260 # added_on: "Added on"
256 261
257about: 262about:
258 page_title: 'Acerca de' 263 page_title: 'Acerca de'
@@ -402,6 +407,7 @@ tag:
402 407
403# export: 408# export:
404# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' 409# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
410# unknown: 'Unknown'
405 411
406import: 412import:
407 page_title: 'Importar' 413 page_title: 'Importar'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
index b3f2eb58..a5cbd7ec 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fa.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 # delete: "Are you sure you want to remove that article?" 254 # delete: "Are you sure you want to remove that article?"
255 # delete_tag: "Are you sure you want to remove that tag from that article?" 255 # delete_tag: "Are you sure you want to remove that tag from that article?"
256 metadata:
257 # reading_time: "Estimated reading time"
258 # reading_time_minutes_short: "%readingTime% min"
259 # address: "Address"
260 # added_on: "Added on"
256 261
257about: 262about:
258 page_title: 'درباره' 263 page_title: 'درباره'
@@ -402,6 +407,7 @@ tag:
402 407
403# export: 408# export:
404# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' 409# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
410# unknown: 'Unknown'
405 411
406import: 412import:
407 page_title: 'درون‌ریزی' 413 page_title: 'درون‌ریزی'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
index 5cdd836e..a36d84ae 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.fr.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 delete: "Voulez-vous vraiment supprimer cet article ?" 254 delete: "Voulez-vous vraiment supprimer cet article ?"
255 delete_tag: "Voulez-vous vraiment supprimer ce tag de cet article ?" 255 delete_tag: "Voulez-vous vraiment supprimer ce tag de cet article ?"
256 metadata:
257 reading_time: "Durée de lecture estimée"
258 reading_time_minutes_short: "%readingTime% min"
259 address: "Adresse"
260 added_on: "Ajouté le"
256 261
257about: 262about:
258 page_title: "À propos" 263 page_title: "À propos"
@@ -402,6 +407,7 @@ tag:
402 407
403export: 408export:
404 footer_template: '<div style="text-align:center;"><p>Généré par wallabag with %method%</p><p>Merci d''ouvrir <a href="https://github.com/wallabag/wallabag/issues">un ticket</a> si vous rencontrez des soucis d''affichage avec ce document sur votre support.</p></div>' 409 footer_template: '<div style="text-align:center;"><p>Généré par wallabag with %method%</p><p>Merci d''ouvrir <a href="https://github.com/wallabag/wallabag/issues">un ticket</a> si vous rencontrez des soucis d''affichage avec ce document sur votre support.</p></div>'
410 unknown: 'Inconnu'
405 411
406import: 412import:
407 page_title: "Importer" 413 page_title: "Importer"
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
index 83b3edcd..1649c0e4 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.it.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 delete: "Vuoi veramente rimuovere quell'articolo?" 254 delete: "Vuoi veramente rimuovere quell'articolo?"
255 delete_tag: "Vuoi veramente rimuovere quell'etichetta da quell'articolo?" 255 delete_tag: "Vuoi veramente rimuovere quell'etichetta da quell'articolo?"
256 metadata:
257 # reading_time: "Estimated reading time"
258 # reading_time_minutes_short: "%readingTime% min"
259 # address: "Address"
260 # added_on: "Added on"
256 261
257about: 262about:
258 page_title: 'A proposito' 263 page_title: 'A proposito'
@@ -402,6 +407,7 @@ tag:
402 407
403# export: 408# export:
404# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' 409# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
410# unknown: 'Unknown'
405 411
406import: 412import:
407 page_title: 'Importa' 413 page_title: 'Importa'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
index 95bc9560..e2298f1f 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.oc.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 delete: "Sètz segur de voler suprimir aqueste article ?" 254 delete: "Sètz segur de voler suprimir aqueste article ?"
255 delete_tag: "Sètz segur de voler levar aquesta etiqueta de l'article ?" 255 delete_tag: "Sètz segur de voler levar aquesta etiqueta de l'article ?"
256 metadata:
257 # reading_time: "Estimated reading time"
258 # reading_time_minutes_short: "%readingTime% min"
259 # address: "Address"
260 # added_on: "Added on"
256 261
257about: 262about:
258 page_title: 'A prepaus' 263 page_title: 'A prepaus'
@@ -402,6 +407,7 @@ tag:
402 407
403export: 408export:
404 footer_template: '<div style="text-align:center;"><p>Produch per wallabag amb %method%</p><p>Mercés de dobrir <a href="https://github.com/wallabag/wallabag/issues">una sollicitacion</a> s’avètz de problèmas amb l’afichatge d’aqueste E-Book sus vòstre periferic.</p></div>' 409 footer_template: '<div style="text-align:center;"><p>Produch per wallabag amb %method%</p><p>Mercés de dobrir <a href="https://github.com/wallabag/wallabag/issues">una sollicitacion</a> s’avètz de problèmas amb l’afichatge d’aqueste E-Book sus vòstre periferic.</p></div>'
410 # unknown: 'Unknown'
405 411
406import: 412import:
407 page_title: 'Importar' 413 page_title: 'Importar'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
index a64e60b0..a5712733 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pl.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 delete: "Czy jesteś pewien, że chcesz usunąć ten artykuł?" 254 delete: "Czy jesteś pewien, że chcesz usunąć ten artykuł?"
255 delete_tag: "Czy jesteś pewien, że chcesz usunąć ten tag, z tego artykułu?" 255 delete_tag: "Czy jesteś pewien, że chcesz usunąć ten tag, z tego artykułu?"
256 metadata:
257 # reading_time: "Estimated reading time"
258 # reading_time_minutes_short: "%readingTime% min"
259 # address: "Address"
260 # added_on: "Added on"
256 261
257about: 262about:
258 page_title: 'O nas' 263 page_title: 'O nas'
@@ -401,7 +406,8 @@ tag:
401 placeholder: 'Możesz dodać kilka tagów, oddzielając je przecinkami.' 406 placeholder: 'Możesz dodać kilka tagów, oddzielając je przecinkami.'
402 407
403export: 408export:
404 footer_template: '<div style="text-align:center;"><p>Stworzone przez wallabag z %method%</p><p>Proszę zgłoś <a href="https://github.com/wallabag/wallabag/issues">sprawę</a>, jeżeli masz problem z wyświetleniem tego e-booka na swoim urządzeniu.</p></div>' 409 footer_template: '<div style="text-align:center;"><p>Stworzone przez wallabag z %method%</p><p>Proszę zgłoś <a href="https://github.com/wallabag/wallabag/issues">sprawę</a>, jeżeli masz problem z wyświetleniem tego e-booka na swoim urządzeniu.</p></div>'
410 # unknown: 'Unknown'
405 411
406import: 412import:
407 page_title: 'Import' 413 page_title: 'Import'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
index 58d2d058..1ccf49e1 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.pt.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 # delete: "Are you sure you want to remove that article?" 254 # delete: "Are you sure you want to remove that article?"
255 # delete_tag: "Are you sure you want to remove that tag from that article?" 255 # delete_tag: "Are you sure you want to remove that tag from that article?"
256 metadata:
257 # reading_time: "Estimated reading time"
258 # reading_time_minutes_short: "%readingTime% min"
259 # address: "Address"
260 # added_on: "Added on"
256 261
257about: 262about:
258 page_title: 'Sobre' 263 page_title: 'Sobre'
@@ -402,6 +407,7 @@ tag:
402 407
403# export: 408# export:
404# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' 409# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
410# unknown: 'Unknown'
405 411
406import: 412import:
407 page_title: 'Importar' 413 page_title: 'Importar'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
index 564fed94..6c0e18e1 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ro.yml
@@ -253,6 +253,11 @@ entry:
253 confirm: 253 confirm:
254 # delete: "Are you sure you want to remove that article?" 254 # delete: "Are you sure you want to remove that article?"
255 # delete_tag: "Are you sure you want to remove that tag from that article?" 255 # delete_tag: "Are you sure you want to remove that tag from that article?"
256 metadata:
257 # reading_time: "Estimated reading time"
258 # reading_time_minutes_short: "%readingTime% min"
259 # address: "Address"
260 # added_on: "Added on"
256 261
257about: 262about:
258 page_title: 'Despre' 263 page_title: 'Despre'
@@ -402,6 +407,7 @@ tag:
402 407
403# export: 408# export:
404# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' 409# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
410# unknown: 'Unknown'
405 411
406import: 412import:
407 # page_title: 'Import' 413 # page_title: 'Import'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
index 5f210c93..48753b55 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.ru.yml
@@ -241,6 +241,11 @@ entry:
241 save_label: 'Сохранить' 241 save_label: 'Сохранить'
242 public: 242 public:
243 shared_by_wallabag: "Запись была опубликована <a href='%wallabag_instance%'>wallabag</a>" 243 shared_by_wallabag: "Запись была опубликована <a href='%wallabag_instance%'>wallabag</a>"
244 metadata:
245 # reading_time: "Estimated reading time"
246 # reading_time_minutes_short: "%readingTime% min"
247 # address: "Address"
248 # added_on: "Added on"
244 249
245about: 250about:
246 page_title: 'О' 251 page_title: 'О'
@@ -388,6 +393,10 @@ tag:
388 add: 'Добавить' 393 add: 'Добавить'
389 placeholder: 'Вы можете добавить несколько тегов, разделенных запятой.' 394 placeholder: 'Вы можете добавить несколько тегов, разделенных запятой.'
390 395
396# export:
397# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
398# unknown: 'Unknown'
399
391import: 400import:
392 page_title: 'Импорт' 401 page_title: 'Импорт'
393 page_description: 'Добро пожаловать в импортер wallabag. Выберите сервис, из которого вы хотите перенести данные.' 402 page_description: 'Добро пожаловать в импортер wallabag. Выберите сервис, из которого вы хотите перенести данные.'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
index 9d22f90d..5524b1f1 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.th.yml
@@ -251,6 +251,11 @@ entry:
251 confirm: 251 confirm:
252 delete: "คุณแน่ใจหรือไม่ว่าคุณต้องการลบบทความนี้?" 252 delete: "คุณแน่ใจหรือไม่ว่าคุณต้องการลบบทความนี้?"
253 delete_tag: "คุณแน่ใจหรือไม่ว่าคุณต้องการลบแท็กจากบทความนี้?" 253 delete_tag: "คุณแน่ใจหรือไม่ว่าคุณต้องการลบแท็กจากบทความนี้?"
254 metadata:
255 # reading_time: "Estimated reading time"
256 # reading_time_minutes_short: "%readingTime% min"
257 # address: "Address"
258 # added_on: "Added on"
254 259
255about: 260about:
256 page_title: 'เกี่ยวกับ' 261 page_title: 'เกี่ยวกับ'
@@ -400,6 +405,7 @@ tag:
400 405
401export: 406export:
402 footer_template: '<div style="text-align:center;"><p>ผลิตโดย wallabag กับ %method%</p><p>ให้ทำการเปิด <a href="https://github.com/wallabag/wallabag/issues">ฉบับนี้</a> ถ้าคุณมีข้อบกพร่องif you have trouble with the display of this E-Book on your device.</p></div>' 407 footer_template: '<div style="text-align:center;"><p>ผลิตโดย wallabag กับ %method%</p><p>ให้ทำการเปิด <a href="https://github.com/wallabag/wallabag/issues">ฉบับนี้</a> ถ้าคุณมีข้อบกพร่องif you have trouble with the display of this E-Book on your device.</p></div>'
408 # unknown: 'Unknown'
403 409
404import: 410import:
405 page_title: 'นำข้อมูลเช้า' 411 page_title: 'นำข้อมูลเช้า'
diff --git a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
index 4c71f0b9..e2156d47 100644
--- a/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
+++ b/src/Wallabag/CoreBundle/Resources/translations/messages.tr.yml
@@ -251,6 +251,11 @@ entry:
251 confirm: 251 confirm:
252 # delete: "Are you sure you want to remove that article?" 252 # delete: "Are you sure you want to remove that article?"
253 # delete_tag: "Are you sure you want to remove that tag from that article?" 253 # delete_tag: "Are you sure you want to remove that tag from that article?"
254 metadata:
255 # reading_time: "Estimated reading time"
256 # reading_time_minutes_short: "%readingTime% min"
257 # address: "Address"
258 # added_on: "Added on"
254 259
255about: 260about:
256 page_title: 'Hakkımızda' 261 page_title: 'Hakkımızda'
@@ -400,6 +405,7 @@ tag:
400 405
401# export: 406# export:
402# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>' 407# footer_template: '<div style="text-align:center;"><p>Produced by wallabag with %method%</p><p>Please open <a href="https://github.com/wallabag/wallabag/issues">an issue</a> if you have trouble with the display of this E-Book on your device.</p></div>'
408# unknown: 'Unknown'
403 409
404import: 410import:
405 page_title: 'İçe Aktar' 411 page_title: 'İçe Aktar'
diff --git a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
index 6f3308e5..0c3d4c83 100644
--- a/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
+++ b/tests/Wallabag/CoreBundle/Controller/ExportControllerTest.php
@@ -98,7 +98,7 @@ class ExportControllerTest extends WallabagCoreTestCase
98 98
99 $headers = $client->getResponse()->headers; 99 $headers = $client->getResponse()->headers;
100 $this->assertSame('application/x-mobipocket-ebook', $headers->get('content-type')); 100 $this->assertSame('application/x-mobipocket-ebook', $headers->get('content-type'));
101 $this->assertSame('attachment; filename="' . preg_replace('/[^A-Za-z0-9\-]/', '', $content->getTitle()) . '.mobi"', $headers->get('content-disposition')); 101 $this->assertSame('attachment; filename="' . $this->getSanitizedFilename($content->getTitle()) . '.mobi"', $headers->get('content-disposition'));
102 $this->assertSame('binary', $headers->get('content-transfer-encoding')); 102 $this->assertSame('binary', $headers->get('content-transfer-encoding'));
103 } 103 }
104 104
@@ -126,7 +126,7 @@ class ExportControllerTest extends WallabagCoreTestCase
126 126
127 $headers = $client->getResponse()->headers; 127 $headers = $client->getResponse()->headers;
128 $this->assertSame('application/pdf', $headers->get('content-type')); 128 $this->assertSame('application/pdf', $headers->get('content-type'));
129 $this->assertSame('attachment; filename="Tag_entries articles.pdf"', $headers->get('content-disposition')); 129 $this->assertSame('attachment; filename="Tag foo bar articles.pdf"', $headers->get('content-disposition'));
130 $this->assertSame('binary', $headers->get('content-transfer-encoding')); 130 $this->assertSame('binary', $headers->get('content-transfer-encoding'));
131 } 131 }
132 132
@@ -212,7 +212,7 @@ class ExportControllerTest extends WallabagCoreTestCase
212 212
213 $headers = $client->getResponse()->headers; 213 $headers = $client->getResponse()->headers;
214 $this->assertSame('application/json', $headers->get('content-type')); 214 $this->assertSame('application/json', $headers->get('content-type'));
215 $this->assertSame('attachment; filename="' . $contentInDB->getTitle() . '.json"', $headers->get('content-disposition')); 215 $this->assertSame('attachment; filename="' . $this->getSanitizedFilename($contentInDB->getTitle()) . '.json"', $headers->get('content-disposition'));
216 $this->assertSame('UTF-8', $headers->get('content-transfer-encoding')); 216 $this->assertSame('UTF-8', $headers->get('content-transfer-encoding'));
217 217
218 $content = json_decode($client->getResponse()->getContent(), true); 218 $content = json_decode($client->getResponse()->getContent(), true);
@@ -281,4 +281,9 @@ class ExportControllerTest extends WallabagCoreTestCase
281 $this->assertNotEmpty('created_at', (string) $content->entry[0]->created_at); 281 $this->assertNotEmpty('created_at', (string) $content->entry[0]->created_at);
282 $this->assertNotEmpty('updated_at', (string) $content->entry[0]->updated_at); 282 $this->assertNotEmpty('updated_at', (string) $content->entry[0]->updated_at);
283 } 283 }
284
285 private function getSanitizedFilename($title)
286 {
287 return preg_replace('/[^A-Za-z0-9\- \']/', '', iconv('utf-8', 'us-ascii//TRANSLIT', $title));
288 }
284} 289}