X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=src%2FWallabag%2FCoreBundle%2FHelper%2FEntriesExport.php;h=1318602e2723ff0df40288ebedb51f1acedb3119;hb=HEAD;hp=64591687d58e66a42eb129bb021f5fcfe5dbed79;hpb=5e1f27767bc2dcf0760bc3061544ecbb833ad5e7;p=github%2Fwallabag%2Fwallabag.git diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 64591687..1318602e 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php @@ -165,13 +165,6 @@ class EntriesExport $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, 'PHP'); $book->addDublinCoreMetadata(DublinCore::CONTRIBUTOR, 'wallabag'); - /* - * Front page - */ - if (file_exists($this->logoPath)) { - $book->setCoverImage('Cover.png', file_get_contents($this->logoPath), 'image/png'); - } - $entryIds = []; $entryCount = \count($this->entries); $i = 0; @@ -183,10 +176,19 @@ class EntriesExport // set tags as subjects foreach ($this->entries as $entry) { ++$i; + + /* + * Front page + * Set if there's only one entry in the given set + */ + if (1 === $entryCount && null !== $entry->getPreviewPicture()) { + $book->setCoverImage($entry->getPreviewPicture()); + } + foreach ($entry->getTags() as $tag) { $book->setSubject($tag->getLabel()); } - $filename = sha1($entry->getTitle()); + $filename = sha1(sprintf('%s:%s', $entry->getUrl(), $entry->getTitle())); $publishedBy = $entry->getPublishedBy(); $authors = $this->translator->trans('export.unknown'); @@ -194,10 +196,17 @@ class EntriesExport $authors = implode(',', $publishedBy); } + $publishedAt = $entry->getPublishedAt(); + $publishedDate = $this->translator->trans('export.unknown'); + if (!empty($publishedAt)) { + $publishedDate = $entry->getPublishedAt()->format('Y-m-d'); + } + $titlepage = $content_start . '

' . $entry->getTitle() . '

' . '
' . '
' . $this->translator->trans('entry.view.published_by') . '
' . $authors . '
' . + '
' . $this->translator->trans('entry.metadata.published_on') . '
' . $publishedDate . '
' . '
' . $this->translator->trans('entry.metadata.reading_time') . '
' . $this->translator->trans('entry.metadata.reading_time_minutes_short', ['%readingTime%' => $entry->getReadingTime()]) . '
' . '
' . $this->translator->trans('entry.metadata.added_on') . '
' . $entry->getCreatedAt()->format('Y-m-d') . '
' . '
' . $this->translator->trans('entry.metadata.address') . '
' . $entry->getUrl() . '
' .