use JMS\Serializer\SerializationContext;
use JMS\Serializer\SerializerBuilder;
use PHPePub\Core\EPub;
+use Html2Text\Html2Text;
use PHPePub\Core\Structure\OPF\DublinCore;
use Symfony\Component\HttpFoundation\Response;
use Craue\ConfigBundle\Util\Config;
case 'xml':
return $this->produceXML();
+ case 'txt':
+ return $this->produceTXT();
}
throw new \InvalidArgumentException(sprintf('The format "%s" is not yet supported.', $format));
)->send();
}
+ private function produceTXT()
+ {
+ $content = '';
+ foreach ($this->entries as $entry) {
+ $content .= $entry->getTitle();
+ $content .= strip_tags($entry->getContent());
+ }
+ return Response::create(
+ $content,
+ 200,
+ array(
+ 'Content-type' => 'text/plain',
+ 'Content-Disposition' => 'attachment; filename="'.$this->title.'.txt"',
+ 'Content-Transfer-Encoding' => 'UTF-8',
+ )
+ )->send();
+ }
+
+
/**
* Return a Serializer object for producing processes that need it (JSON & XML).
*
{% if craue_setting('export_pdf') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'pdf' }) }}" title="Generate PDF file">PDF</a></li>{% endif %}
{% if craue_setting('export_csv') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'csv' }) }}" title="Generate CSV file">CSV</a></li>{% endif %}
{% if craue_setting('export_json') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'json' }) }}" title="Generate JSON file">JSON</a></li>{% endif %}
- {% 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 %}
+ {% if craue_setting('export_txt') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'txt' }) }}" title="Generate TXT file">TXT</a></li>{% endif %}
{% if craue_setting('export_xml') %}<li><a href="{{ path('export_entry', { 'id': entry.id, 'format': 'xml' }) }}" title="Generate XML file">XML</a></li>{% endif %}
</ul>
</div>