From deab6280d3cbe3f8d001ff5214d36399653e3027 Mon Sep 17 00:00:00 2001 From: tcit Date: Fri, 25 Jul 2014 00:33:19 +0200 Subject: [PATCH] mobi (not tested on actual device) and pdf working --- inc/poche/WallabagEBooks.class.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/inc/poche/WallabagEBooks.class.php b/inc/poche/WallabagEBooks.class.php index deaf57e21..2b18b718c 100644 --- a/inc/poche/WallabagEBooks.class.php +++ b/inc/poche/WallabagEBooks.class.php @@ -36,7 +36,7 @@ class WallabagEBooks break; case 'all': $this->entries = $this->wallabag->store->retrieveAll($this->wallabag->user->getId()); - $this->bookTitle = sprintf(_('All my articles on '), date(_('d.m.y'))); #translatable because each country has it's own date format system + $this->bookTitle = sprintf(_('All my articles on %s'), date(_('d.m.y'))); #translatable because each country has it's own date format system $this->bookFileName = _('Allarticles') . date(_('dmY')); break; case 'tag': @@ -154,17 +154,17 @@ class WallabagMobi extends WallabagEBooks public function produceMobi($send = FALSE) { - # Good try $mobi = new MOBI(); $content = new MOBIFile(); $content->set("title", $this->bookTitle); $content->set("author", "wallabag"); + $content->set("subject", $this->bookTitle); # introduction //$content->appendChapterTitle("Cover"); - $content->appendParagraph('

' . _('Produced by wallabag with PHPMobi') . '

'. _('Please open an issue if you have trouble with the display of this E-Book on your device.') . '

'); + $content->appendParagraph('

' . _('Produced by wallabag with PHPMobi') . '

'. _('Please open an issue if you have trouble with the display of this E-Book on your device.') . '

'); $content->appendImage(imagecreatefrompng("themes/baggy/img/apple-touch-icon-152.png")); $content->appendPageBreak(); @@ -183,20 +183,25 @@ class WallabagPDF extends WallabagEbooks { public function producePDF() { - //$this->prepareData(); $mpdf = new mPDF('c'); # intro - $html = '

' . $this->bookTitle . '

'; + $html = '

' . $this->bookTitle . '

+

' . _('Produced by wallabag with mPDF') . '

+

'. _('Please open an issue if you have trouble with the display of this E-Book on your device.') . '

+
'; + $html .= ''; + $i = 1; foreach ($this->entries as $item) { - $html .= '

' . $item['title'] . '

'; + $html .= '

' . $item['title'] . '

'; $html .= ''; $html .= $item['content']; + $html .= ''; + $i = $i+1; } - //$mpdf->h2toc = array('H1'=>0); # headers $mpdf->SetHeader('{DATE j-m-Y}|{PAGENO}/{nb}|Produced with wallabag'); @@ -207,6 +212,13 @@ class WallabagPDF extends WallabagEbooks # remove characters that make mpdf bug $char_in = array('/', '.', ',', ':', '|'); $pdfExportName = preg_replace('/\s+/', '-', str_replace($char_in, '-', $this->bookFileName . '.pdf')); + + # index + $html = '

Index

+ + '; + + $mpdf->WriteHTML($html); $mpdf->Output('cache/' . $pdfExportName);