aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
-rw-r--r--src/Wallabag/CoreBundle/Helper/EntriesExport.php48
1 files changed, 24 insertions, 24 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
index 5d2fca31..bd11b4b8 100644
--- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php
+++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php
@@ -64,7 +64,7 @@ class EntriesExport
64 */ 64 */
65 public function updateTitle($method) 65 public function updateTitle($method)
66 { 66 {
67 $this->title = $method . ' articles'; 67 $this->title = $method.' articles';
68 68
69 if ('entry' === $method) { 69 if ('entry' === $method) {
70 $this->title = $this->entries[0]->getTitle(); 70 $this->title = $this->entries[0]->getTitle();
@@ -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 = $method.' authors';
89 89
90 return $this; 90 return $this;
91 } 91 }
@@ -109,7 +109,7 @@ class EntriesExport
109 */ 109 */
110 public function exportAs($format) 110 public function exportAs($format)
111 { 111 {
112 $functionName = 'produce' . ucfirst($format); 112 $functionName = 'produce'.ucfirst($format);
113 if (method_exists($this, $functionName)) { 113 if (method_exists($this, $functionName)) {
114 return $this->$functionName(); 114 return $this->$functionName();
115 } 115 }
@@ -134,12 +134,12 @@ class EntriesExport
134 */ 134 */
135 $content_start = 135 $content_start =
136 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" 136 "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"
137 . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n" 137 ."<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n"
138 . '<head>' 138 .'<head>'
139 . "<meta http-equiv=\"Default-Style\" content=\"text/html; charset=utf-8\" />\n" 139 ."<meta http-equiv=\"Default-Style\" content=\"text/html; charset=utf-8\" />\n"
140 . "<title>wallabag articles book</title>\n" 140 ."<title>wallabag articles book</title>\n"
141 . "</head>\n" 141 ."</head>\n"
142 . "<body>\n"; 142 ."<body>\n";
143 143
144 $bookEnd = "</body>\n</html>\n"; 144 $bookEnd = "</body>\n</html>\n";
145 145
@@ -188,10 +188,10 @@ class EntriesExport
188 // in filenames, we limit to A-z/0-9 188 // in filenames, we limit to A-z/0-9
189 $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle()); 189 $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle());
190 190
191 $titlepage = $content_start . "<h1>".$entry->getTitle()."</h1>" . $this->getExportInformation('PHPePub') . $bookEnd; 191 $titlepage = $content_start.'<h1>'.$entry->getTitle().'</h1>'.$this->getExportInformation('PHPePub').$bookEnd;
192 $book->addChapter("Title", 'Title.html', $titlepage, true, EPub::EXTERNAL_REF_ADD); 192 $book->addChapter('Title', 'Title.html', $titlepage, true, EPub::EXTERNAL_REF_ADD);
193 $chapter = $content_start . $entry->getContent() . $bookEnd; 193 $chapter = $content_start.$entry->getContent().$bookEnd;
194 $book->addChapter($entry->getTitle(), htmlspecialchars($filename) . '.html', $chapter, true, EPub::EXTERNAL_REF_ADD); 194 $book->addChapter($entry->getTitle(), htmlspecialchars($filename).'.html', $chapter, true, EPub::EXTERNAL_REF_ADD);
195 } 195 }
196 196
197 $book->buildTOC(); 197 $book->buildTOC();
@@ -202,7 +202,7 @@ class EntriesExport
202 [ 202 [
203 'Content-Description' => 'File Transfer', 203 'Content-Description' => 'File Transfer',
204 'Content-type' => 'application/epub+zip', 204 'Content-type' => 'application/epub+zip',
205 'Content-Disposition' => 'attachment; filename="' . $this->title . '.epub"', 205 'Content-Disposition' => 'attachment; filename="'.$this->title.'.epub"',
206 'Content-Transfer-Encoding' => 'binary', 206 'Content-Transfer-Encoding' => 'binary',
207 ] 207 ]
208 ); 208 );
@@ -254,7 +254,7 @@ class EntriesExport
254 'Accept-Ranges' => 'bytes', 254 'Accept-Ranges' => 'bytes',
255 'Content-Description' => 'File Transfer', 255 'Content-Description' => 'File Transfer',
256 'Content-type' => 'application/x-mobipocket-ebook', 256 'Content-type' => 'application/x-mobipocket-ebook',
257 'Content-Disposition' => 'attachment; filename="' . $this->title . '.mobi"', 257 'Content-Disposition' => 'attachment; filename="'.$this->title.'.mobi"',
258 'Content-Transfer-Encoding' => 'binary', 258 'Content-Transfer-Encoding' => 'binary',
259 ] 259 ]
260 ); 260 );
@@ -282,7 +282,7 @@ class EntriesExport
282 * Front page 282 * Front page
283 */ 283 */
284 $pdf->AddPage(); 284 $pdf->AddPage();
285 $intro = '<h1>' . $this->title . '</h1>' . $this->getExportInformation('tcpdf'); 285 $intro = '<h1>'.$this->title.'</h1>'.$this->getExportInformation('tcpdf');
286 286
287 $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true); 287 $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true);
288 288
@@ -295,7 +295,7 @@ class EntriesExport
295 } 295 }
296 296
297 $pdf->AddPage(); 297 $pdf->AddPage();
298 $html = '<h1>' . $entry->getTitle() . '</h1>'; 298 $html = '<h1>'.$entry->getTitle().'</h1>';
299 $html .= $entry->getContent(); 299 $html .= $entry->getContent();
300 300
301 $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); 301 $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
@@ -310,7 +310,7 @@ class EntriesExport
310 [ 310 [
311 'Content-Description' => 'File Transfer', 311 'Content-Description' => 'File Transfer',
312 'Content-type' => 'application/pdf', 312 'Content-type' => 'application/pdf',
313 'Content-Disposition' => 'attachment; filename="' . $this->title . '.pdf"', 313 'Content-Disposition' => 'attachment; filename="'.$this->title.'.pdf"',
314 'Content-Transfer-Encoding' => 'binary', 314 'Content-Transfer-Encoding' => 'binary',
315 ] 315 ]
316 ); 316 );
@@ -356,7 +356,7 @@ class EntriesExport
356 200, 356 200,
357 [ 357 [
358 'Content-type' => 'application/csv', 358 'Content-type' => 'application/csv',
359 'Content-Disposition' => 'attachment; filename="' . $this->title . '.csv"', 359 'Content-Disposition' => 'attachment; filename="'.$this->title.'.csv"',
360 'Content-Transfer-Encoding' => 'UTF-8', 360 'Content-Transfer-Encoding' => 'UTF-8',
361 ] 361 ]
362 ); 362 );
@@ -374,7 +374,7 @@ class EntriesExport
374 200, 374 200,
375 [ 375 [
376 'Content-type' => 'application/json', 376 'Content-type' => 'application/json',
377 'Content-Disposition' => 'attachment; filename="' . $this->title . '.json"', 377 'Content-Disposition' => 'attachment; filename="'.$this->title.'.json"',
378 'Content-Transfer-Encoding' => 'UTF-8', 378 'Content-Transfer-Encoding' => 'UTF-8',
379 ] 379 ]
380 ); 380 );
@@ -392,7 +392,7 @@ class EntriesExport
392 200, 392 200,
393 [ 393 [
394 'Content-type' => 'application/xml', 394 'Content-type' => 'application/xml',
395 'Content-Disposition' => 'attachment; filename="' . $this->title . '.xml"', 395 'Content-Disposition' => 'attachment; filename="'.$this->title.'.xml"',
396 'Content-Transfer-Encoding' => 'UTF-8', 396 'Content-Transfer-Encoding' => 'UTF-8',
397 ] 397 ]
398 ); 398 );
@@ -408,7 +408,7 @@ class EntriesExport
408 $content = ''; 408 $content = '';
409 $bar = str_repeat('=', 100); 409 $bar = str_repeat('=', 100);
410 foreach ($this->entries as $entry) { 410 foreach ($this->entries as $entry) {
411 $content .= "\n\n" . $bar . "\n\n" . $entry->getTitle() . "\n\n" . $bar . "\n\n"; 411 $content .= "\n\n".$bar."\n\n".$entry->getTitle()."\n\n".$bar."\n\n";
412 $html = new Html2Text($entry->getContent(), ['do_links' => 'none', 'width' => 100]); 412 $html = new Html2Text($entry->getContent(), ['do_links' => 'none', 'width' => 100]);
413 $content .= $html->getText(); 413 $content .= $html->getText();
414 } 414 }
@@ -418,7 +418,7 @@ class EntriesExport
418 200, 418 200,
419 [ 419 [
420 'Content-type' => 'text/plain', 420 'Content-type' => 'text/plain',
421 'Content-Disposition' => 'attachment; filename="' . $this->title . '.txt"', 421 'Content-Disposition' => 'attachment; filename="'.$this->title.'.txt"',
422 'Content-Transfer-Encoding' => 'UTF-8', 422 'Content-Transfer-Encoding' => 'UTF-8',
423 ] 423 ]
424 ); 424 );
@@ -456,7 +456,7 @@ class EntriesExport
456 ]); 456 ]);
457 457
458 if ('tcpdf' === $type) { 458 if ('tcpdf' === $type) {
459 return str_replace('%IMAGE%', '<img src="' . $this->logoPath . '" />', $info); 459 return str_replace('%IMAGE%', '<img src="'.$this->logoPath.'" />', $info);
460 } 460 }
461 461
462 return str_replace('%IMAGE%', '', $info); 462 return str_replace('%IMAGE%', '', $info);