/**
  * Add a page to the pdf
  *
  * @param array $page - the content
  * @param array $page_options - numbering reset, style, suppress adding to TOC
  * @param boolean $display_footer turn on/off footer display
  * @param boolean $display_header turn on/off header display
  * @return boolean
  */
 function addPage($page, $page_options = array(), $display_footer = true, $display_header = true)
 {
     // defaults
     $defaults = array('suppress' => 'off', 'resetpagenum' => 0, 'pagenumstyle' => 1, 'margin-right' => $this->options['mpdf_right_margin'], 'margin-left' => $this->options['mpdf_left_margin'], 'sheet-size' => $this->options['mpdf_page_size']);
     $options = \wp_parse_args($page_options, $defaults);
     $class = $this->numbered ? '<div class="' . $page['post_type'] . '">' : '<div class="' . $page['post_type'] . ' numberless">';
     $toc_entry = 'chapter' == $page['post_type'] ? $page['chapter_num'] . ' ' . $page['post_title'] : $page['post_title'];
     if (!empty($page['post_content']) || 'part' == $page['post_type']) {
         $this->mpdf->SetFooter($this->getFooter($display_footer, $this->bookTitle . '| | {PAGENO}'));
         $this->mpdf->SetHeader($this->getHeader($display_header, ''));
         $this->mpdf->AddPageByArray($options);
         if (empty($page['mpdf_omit_toc'])) {
             $this->mpdf->TOC_Entry($this->getTocEntry($toc_entry), $page['mpdf_level']);
             $this->mpdf->Bookmark($this->getBookmarkEntry($page), $page['mpdf_level']);
         }
         if ('chapter' == $page['post_type']) {
             $title = '<h3 class="chapter-number">' . $page['chapter_num'] . '</h3><h2 class="entry-title">' . $page['post_title'] . '</h2>';
         } else {
             $title = '<h2 class="entry-title">' . $page['post_title'] . '</h2>';
         }
         $content .= $class . $title . $this->getFilteredContent($page['post_content']) . '</div>';
         // TODO Make this hookable.
         $this->mpdf->WriteHTML($content);
         return true;
     }
     return false;
 }
示例#2
0
 /**
  * send mail
  *
  * @param string $subject message subject
  * @param array $from sender name and adress
  * @param array $to receiver name and adress
  * @return bool
  * @author Elias Müller
  **/
 public function send($subject, $from, $to)
 {
     if ($subject == '') {
         Error::addError('Kein Mail-Versand ohne Betreff!');
         return false;
     }
     $this->mail->SetEncodedEmailHeader("To", $to['email'], $to['name']);
     $this->mail->SetEncodedEmailHeader("From", $from['email'], $from['name']);
     $this->mail->SetEncodedEmailHeader("Reply-To", '*****@*****.**', 'Jugendburg Balduinstein');
     $this->mail->SetHeader("Return-Path", '*****@*****.**');
     $this->mail->SetEncodedEmailHeader("Errors-To", '*****@*****.**', 'Elias Müller');
     $this->mail->SetEncodedHeader("Subject", $subject);
     if (($error = $this->mail->Send()) == '') {
         return true;
     }
     Error::addError("Fehler beim Mail-Versand: " . HtmlSpecialChars($error), true);
     return false;
 }