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.
return $this->get('wallabag_core.helper.entries_export')
->setEntries($entry)
->updateTitle('entry')
return $this->get('wallabag_core.helper.entries_export')
->setEntries($entry)
->updateTitle('entry')
+ ->updateAuthor('entry')
->exportAs($request->attributes->get('_format'));
}
->exportAs($request->attributes->get('_format'));
}
$data = $this->getContainer()->get('wallabag_core.helper.entries_export')
->setEntries($entries)
->updateTitle('All')
$data = $this->getContainer()->get('wallabag_core.helper.entries_export')
->setEntries($entries)
->updateTitle('All')
->exportJsonData();
file_put_contents($filePath, $data);
} catch (\InvalidArgumentException $e) {
->exportJsonData();
file_put_contents($filePath, $data);
} catch (\InvalidArgumentException $e) {
return $this->get('wallabag_core.helper.entries_export')
->setEntries($entry)
->updateTitle('entry')
return $this->get('wallabag_core.helper.entries_export')
->setEntries($entry)
->updateTitle('entry')
+ ->updateAuthor('entry')
->exportAs($format);
} catch (\InvalidArgumentException $e) {
throw new NotFoundHttpException($e->getMessage());
->exportAs($format);
} catch (\InvalidArgumentException $e) {
throw new NotFoundHttpException($e->getMessage());
return $this->get('wallabag_core.helper.entries_export')
->setEntries($entries)
->updateTitle($method)
return $this->get('wallabag_core.helper.entries_export')
->setEntries($entries)
->updateTitle($method)
+ ->updateAuthor($method)
->exportAs($format);
} catch (\InvalidArgumentException $e) {
throw new NotFoundHttpException($e->getMessage());
->exportAs($format);
} catch (\InvalidArgumentException $e) {
throw new NotFoundHttpException($e->getMessage());
private $logoPath;
private $title = '';
private $entries = [];
private $logoPath;
private $title = '';
private $entries = [];
- private $authors = ['wallabag'];
+ private $author = 'wallabag';
private $language = '';
private $footerTemplate = '<div style="text-align:center;">
<p>Produced by wallabag with %EXPORT_METHOD%</p>
private $language = '';
private $footerTemplate = '<div style="text-align:center;">
<p>Produced by wallabag with %EXPORT_METHOD%</p>
+ /**
+ * Sets the author for just one entry.
+ *
+ * @param string $method Method to get articles
+ *
+ * @return EntriesExport
+ */
+ public function updateAuthor($method)
+ {
+ $this->author = $method.' authors';
+
+ if ('entry' === $method) {
+ $this->author = $this->entries[0]->getDomainName();
+ }
+
+ return $this;
+ }
+
/**
* Sets the output format.
*
/**
* Sets the output format.
*
$book->setLanguage($this->language);
$book->setDescription('Some articles saved on my wallabag');
$book->setLanguage($this->language);
$book->setDescription('Some articles saved on my wallabag');
- foreach ($this->authors as $author) {
- $book->setAuthor($author, $author);
- }
+ $book->setAuthor($this->author, $this->author);
// I hope this is a non existant address :)
$book->setPublisher('wallabag', 'wallabag');
// I hope this is a non existant address :)
$book->setPublisher('wallabag', 'wallabag');
* Book metadata
*/
$content->set('title', $this->title);
* Book metadata
*/
$content->set('title', $this->title);
- $content->set('author', implode($this->authors));
+ $content->set('author', $this->author);
$content->set('subject', $this->title);
/*
$content->set('subject', $this->title);
/*
* Book metadata
*/
$pdf->SetCreator(PDF_CREATOR);
* Book metadata
*/
$pdf->SetCreator(PDF_CREATOR);
- $pdf->SetAuthor('wallabag');
+ $pdf->SetAuthor($this->author);
$pdf->SetTitle($this->title);
$pdf->SetSubject('Articles via wallabag');
$pdf->SetKeywords('wallabag');
$pdf->SetTitle($this->title);
$pdf->SetSubject('Articles via wallabag');
$pdf->SetKeywords('wallabag');