diff options
author | Jérémy Benoist <j0k3r@users.noreply.github.com> | 2017-07-03 13:39:54 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-03 13:39:54 +0200 |
commit | 71e1cbc8eb5928d393b0772055d6b711e90a09b3 (patch) | |
tree | 71795eadcf13fda9198b8cd9a3da26d51826bbd9 /src/Wallabag/CoreBundle/Helper/EntriesExport.php | |
parent | 822c877949aff8ae57677671115f8f4fc69588d5 (diff) | |
parent | 38520658addc217f127b0627ea28dcf8d6e6178c (diff) | |
download | wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.tar.gz wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.tar.zst wallabag-71e1cbc8eb5928d393b0772055d6b711e90a09b3.zip |
Merge pull request #3258 from wallabag/cs-fixer
Add a real configuration for CS-Fixer
Diffstat (limited to 'src/Wallabag/CoreBundle/Helper/EntriesExport.php')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/EntriesExport.php | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 3d36a4c8..cd74cc4f 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php | |||
@@ -63,7 +63,7 @@ class EntriesExport | |||
63 | */ | 63 | */ |
64 | public function updateTitle($method) | 64 | public function updateTitle($method) |
65 | { | 65 | { |
66 | $this->title = $method.' articles'; | 66 | $this->title = $method . ' articles'; |
67 | 67 | ||
68 | if ('entry' === $method) { | 68 | if ('entry' === $method) { |
69 | $this->title = $this->entries[0]->getTitle(); | 69 | $this->title = $this->entries[0]->getTitle(); |
@@ -81,7 +81,7 @@ class EntriesExport | |||
81 | */ | 81 | */ |
82 | public function exportAs($format) | 82 | public function exportAs($format) |
83 | { | 83 | { |
84 | $functionName = 'produce'.ucfirst($format); | 84 | $functionName = 'produce' . ucfirst($format); |
85 | if (method_exists($this, $functionName)) { | 85 | if (method_exists($this, $functionName)) { |
86 | return $this->$functionName(); | 86 | return $this->$functionName(); |
87 | } | 87 | } |
@@ -106,12 +106,12 @@ class EntriesExport | |||
106 | */ | 106 | */ |
107 | $content_start = | 107 | $content_start = |
108 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" | 108 | "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" |
109 | ."<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n" | 109 | . "<html xmlns=\"http://www.w3.org/1999/xhtml\" xmlns:epub=\"http://www.idpf.org/2007/ops\">\n" |
110 | .'<head>' | 110 | . '<head>' |
111 | ."<meta http-equiv=\"Default-Style\" content=\"text/html; charset=utf-8\" />\n" | 111 | . "<meta http-equiv=\"Default-Style\" content=\"text/html; charset=utf-8\" />\n" |
112 | ."<title>wallabag articles book</title>\n" | 112 | . "<title>wallabag articles book</title>\n" |
113 | ."</head>\n" | 113 | . "</head>\n" |
114 | ."<body>\n"; | 114 | . "<body>\n"; |
115 | 115 | ||
116 | $bookEnd = "</body>\n</html>\n"; | 116 | $bookEnd = "</body>\n</html>\n"; |
117 | 117 | ||
@@ -164,11 +164,11 @@ class EntriesExport | |||
164 | // in filenames, we limit to A-z/0-9 | 164 | // in filenames, we limit to A-z/0-9 |
165 | $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle()); | 165 | $filename = preg_replace('/[^A-Za-z0-9\-]/', '', $entry->getTitle()); |
166 | 166 | ||
167 | $chapter = $content_start.$entry->getContent().$bookEnd; | 167 | $chapter = $content_start . $entry->getContent() . $bookEnd; |
168 | $book->addChapter($entry->getTitle(), htmlspecialchars($filename).'.html', $chapter, true, EPub::EXTERNAL_REF_ADD); | 168 | $book->addChapter($entry->getTitle(), htmlspecialchars($filename) . '.html', $chapter, true, EPub::EXTERNAL_REF_ADD); |
169 | } | 169 | } |
170 | 170 | ||
171 | $book->addChapter('Notices', 'Cover2.html', $content_start.$this->getExportInformation('PHPePub').$bookEnd); | 171 | $book->addChapter('Notices', 'Cover2.html', $content_start . $this->getExportInformation('PHPePub') . $bookEnd); |
172 | 172 | ||
173 | return Response::create( | 173 | return Response::create( |
174 | $book->getBook(), | 174 | $book->getBook(), |
@@ -176,7 +176,7 @@ class EntriesExport | |||
176 | [ | 176 | [ |
177 | 'Content-Description' => 'File Transfer', | 177 | 'Content-Description' => 'File Transfer', |
178 | 'Content-type' => 'application/epub+zip', | 178 | 'Content-type' => 'application/epub+zip', |
179 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.epub"', | 179 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.epub"', |
180 | 'Content-Transfer-Encoding' => 'binary', | 180 | 'Content-Transfer-Encoding' => 'binary', |
181 | ] | 181 | ] |
182 | ); | 182 | ); |
@@ -228,7 +228,7 @@ class EntriesExport | |||
228 | 'Accept-Ranges' => 'bytes', | 228 | 'Accept-Ranges' => 'bytes', |
229 | 'Content-Description' => 'File Transfer', | 229 | 'Content-Description' => 'File Transfer', |
230 | 'Content-type' => 'application/x-mobipocket-ebook', | 230 | 'Content-type' => 'application/x-mobipocket-ebook', |
231 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.mobi"', | 231 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.mobi"', |
232 | 'Content-Transfer-Encoding' => 'binary', | 232 | 'Content-Transfer-Encoding' => 'binary', |
233 | ] | 233 | ] |
234 | ); | 234 | ); |
@@ -256,7 +256,7 @@ class EntriesExport | |||
256 | * Front page | 256 | * Front page |
257 | */ | 257 | */ |
258 | $pdf->AddPage(); | 258 | $pdf->AddPage(); |
259 | $intro = '<h1>'.$this->title.'</h1>'.$this->getExportInformation('tcpdf'); | 259 | $intro = '<h1>' . $this->title . '</h1>' . $this->getExportInformation('tcpdf'); |
260 | 260 | ||
261 | $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true); | 261 | $pdf->writeHTMLCell(0, 0, '', '', $intro, 0, 1, 0, true, '', true); |
262 | 262 | ||
@@ -269,7 +269,7 @@ class EntriesExport | |||
269 | } | 269 | } |
270 | 270 | ||
271 | $pdf->AddPage(); | 271 | $pdf->AddPage(); |
272 | $html = '<h1>'.$entry->getTitle().'</h1>'; | 272 | $html = '<h1>' . $entry->getTitle() . '</h1>'; |
273 | $html .= $entry->getContent(); | 273 | $html .= $entry->getContent(); |
274 | 274 | ||
275 | $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); | 275 | $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true); |
@@ -284,7 +284,7 @@ class EntriesExport | |||
284 | [ | 284 | [ |
285 | 'Content-Description' => 'File Transfer', | 285 | 'Content-Description' => 'File Transfer', |
286 | 'Content-type' => 'application/pdf', | 286 | 'Content-type' => 'application/pdf', |
287 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.pdf"', | 287 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.pdf"', |
288 | 'Content-Transfer-Encoding' => 'binary', | 288 | 'Content-Transfer-Encoding' => 'binary', |
289 | ] | 289 | ] |
290 | ); | 290 | ); |
@@ -330,7 +330,7 @@ class EntriesExport | |||
330 | 200, | 330 | 200, |
331 | [ | 331 | [ |
332 | 'Content-type' => 'application/csv', | 332 | 'Content-type' => 'application/csv', |
333 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.csv"', | 333 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.csv"', |
334 | 'Content-Transfer-Encoding' => 'UTF-8', | 334 | 'Content-Transfer-Encoding' => 'UTF-8', |
335 | ] | 335 | ] |
336 | ); | 336 | ); |
@@ -348,7 +348,7 @@ class EntriesExport | |||
348 | 200, | 348 | 200, |
349 | [ | 349 | [ |
350 | 'Content-type' => 'application/json', | 350 | 'Content-type' => 'application/json', |
351 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.json"', | 351 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.json"', |
352 | 'Content-Transfer-Encoding' => 'UTF-8', | 352 | 'Content-Transfer-Encoding' => 'UTF-8', |
353 | ] | 353 | ] |
354 | ); | 354 | ); |
@@ -366,7 +366,7 @@ class EntriesExport | |||
366 | 200, | 366 | 200, |
367 | [ | 367 | [ |
368 | 'Content-type' => 'application/xml', | 368 | 'Content-type' => 'application/xml', |
369 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.xml"', | 369 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.xml"', |
370 | 'Content-Transfer-Encoding' => 'UTF-8', | 370 | 'Content-Transfer-Encoding' => 'UTF-8', |
371 | ] | 371 | ] |
372 | ); | 372 | ); |
@@ -382,8 +382,8 @@ class EntriesExport | |||
382 | $content = ''; | 382 | $content = ''; |
383 | $bar = str_repeat('=', 100); | 383 | $bar = str_repeat('=', 100); |
384 | foreach ($this->entries as $entry) { | 384 | foreach ($this->entries as $entry) { |
385 | $content .= "\n\n".$bar."\n\n".$entry->getTitle()."\n\n".$bar."\n\n"; | 385 | $content .= "\n\n" . $bar . "\n\n" . $entry->getTitle() . "\n\n" . $bar . "\n\n"; |
386 | $content .= trim(preg_replace('/\s+/S', ' ', strip_tags($entry->getContent())))."\n\n"; | 386 | $content .= trim(preg_replace('/\s+/S', ' ', strip_tags($entry->getContent()))) . "\n\n"; |
387 | } | 387 | } |
388 | 388 | ||
389 | return Response::create( | 389 | return Response::create( |
@@ -391,7 +391,7 @@ class EntriesExport | |||
391 | 200, | 391 | 200, |
392 | [ | 392 | [ |
393 | 'Content-type' => 'text/plain', | 393 | 'Content-type' => 'text/plain', |
394 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.txt"', | 394 | 'Content-Disposition' => 'attachment; filename="' . $this->title . '.txt"', |
395 | 'Content-Transfer-Encoding' => 'UTF-8', | 395 | 'Content-Transfer-Encoding' => 'UTF-8', |
396 | ] | 396 | ] |
397 | ); | 397 | ); |
@@ -427,7 +427,7 @@ class EntriesExport | |||
427 | $info = str_replace('%EXPORT_METHOD%', $type, $this->footerTemplate); | 427 | $info = str_replace('%EXPORT_METHOD%', $type, $this->footerTemplate); |
428 | 428 | ||
429 | if ('tcpdf' === $type) { | 429 | if ('tcpdf' === $type) { |
430 | return str_replace('%IMAGE%', '<img src="'.$this->logoPath.'" />', $info); | 430 | return str_replace('%IMAGE%', '<img src="' . $this->logoPath . '" />', $info); |
431 | } | 431 | } |
432 | 432 | ||
433 | return str_replace('%IMAGE%', '', $info); | 433 | return str_replace('%IMAGE%', '', $info); |