diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/Wallabag/CoreBundle/Helper/EntriesExport.php | 22 | ||||
-rw-r--r-- | src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig | 2 |
2 files changed, 23 insertions, 1 deletions
diff --git a/src/Wallabag/CoreBundle/Helper/EntriesExport.php b/src/Wallabag/CoreBundle/Helper/EntriesExport.php index 965a40b6..79fe6eaa 100644 --- a/src/Wallabag/CoreBundle/Helper/EntriesExport.php +++ b/src/Wallabag/CoreBundle/Helper/EntriesExport.php | |||
@@ -6,6 +6,7 @@ use JMS\Serializer; | |||
6 | use JMS\Serializer\SerializationContext; | 6 | use JMS\Serializer\SerializationContext; |
7 | use JMS\Serializer\SerializerBuilder; | 7 | use JMS\Serializer\SerializerBuilder; |
8 | use PHPePub\Core\EPub; | 8 | use PHPePub\Core\EPub; |
9 | use Html2Text\Html2Text; | ||
9 | use PHPePub\Core\Structure\OPF\DublinCore; | 10 | use PHPePub\Core\Structure\OPF\DublinCore; |
10 | use Symfony\Component\HttpFoundation\Response; | 11 | use Symfony\Component\HttpFoundation\Response; |
11 | use Craue\ConfigBundle\Util\Config; | 12 | use Craue\ConfigBundle\Util\Config; |
@@ -99,6 +100,8 @@ class EntriesExport | |||
99 | 100 | ||
100 | case 'xml': | 101 | case 'xml': |
101 | return $this->produceXML(); | 102 | return $this->produceXML(); |
103 | case 'txt': | ||
104 | return $this->produceTXT(); | ||
102 | } | 105 | } |
103 | 106 | ||
104 | throw new \InvalidArgumentException(sprintf('The format "%s" is not yet supported.', $format)); | 107 | throw new \InvalidArgumentException(sprintf('The format "%s" is not yet supported.', $format)); |
@@ -359,6 +362,25 @@ class EntriesExport | |||
359 | )->send(); | 362 | )->send(); |
360 | } | 363 | } |
361 | 364 | ||
365 | private function produceTXT() | ||
366 | { | ||
367 | $content = ''; | ||
368 | foreach ($this->entries as $entry) { | ||
369 | $content .= $entry->getTitle(); | ||
370 | $content .= strip_tags($entry->getContent()); | ||
371 | } | ||
372 | return Response::create( | ||
373 | $content, | ||
374 | 200, | ||
375 | array( | ||
376 | 'Content-type' => 'text/plain', | ||
377 | 'Content-Disposition' => 'attachment; filename="'.$this->title.'.txt"', | ||
378 | 'Content-Transfer-Encoding' => 'UTF-8', | ||
379 | ) | ||
380 | )->send(); | ||
381 | } | ||
382 | |||
383 | |||
362 | /** | 384 | /** |
363 | * Return a Serializer object for producing processes that need it (JSON & XML). | 385 | * Return a Serializer object for producing processes that need it (JSON & XML). |
364 | * | 386 | * |
diff --git a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig index dad96187..2d3fd516 100644 --- a/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig +++ b/src/Wallabag/CoreBundle/Resources/views/themes/material/Entry/entry.html.twig | |||
@@ -118,7 +118,7 @@ | |||
118 | {% if craue_setting('export_pdf') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %} | 118 | {% if craue_setting('export_pdf') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %} |
119 | {% if craue_setting('export_csv') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'csv' }) }}" title="Generate CSV file">CSV</a></li>{% endif %} | 119 | {% if craue_setting('export_csv') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'csv' }) }}" title="Generate CSV file">CSV</a></li>{% endif %} |
120 | {% if craue_setting('export_json') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'json' }) }}" title="Generate JSON file">JSON</a></li>{% endif %} | 120 | {% if craue_setting('export_json') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'json' }) }}" title="Generate JSON file">JSON</a></li>{% endif %} |
121 | {% if craue_setting('export_txt') %}<li><del><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'txt' }) }}" title="Generate TXT file">TXT</a></del></li>{% endif %} | 121 | {% if craue_setting('export_txt') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'txt' }) }}" title="Generate TXT file">TXT</a></li>{% endif %} |
122 | {% if craue_setting('export_xml') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'xml' }) }}" title="Generate XML file">XML</a></li>{% endif %} | 122 | {% if craue_setting('export_xml') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'xml' }) }}" title="Generate XML file">XML</a></li>{% endif %} |
123 | </ul> | 123 | </ul> |
124 | </div> | 124 | </div> |