Exemple #1
0
 /**
  * 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'] && true === $this->numbered ? $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>';
         }
         $citations = \CandelaCitation::renderCitation($page['ID']);
         if (!empty($citations)) {
             $content .= $class . $title . $this->getFilteredContent($page['post_content']) . '</div>' . '<div><h6 class="bcc-box bcc-info citations">' . $citations . '</h6></div>';
         }
         if (empty($citations)) {
             $content = $class . $title . $this->getFilteredContent($page['post_content']) . '</div>';
         }
         // TODO Make this hookable.
         $this->mpdf->WriteHTML($content);
         return true;
     }
     return false;
 }
?>
>
		<div class="entry-content">

			<?php 
the_content();
if (get_post_type($post->ID) === 'part') {
    echo get_post_meta($post->ID, 'pb_part_content', true);
}
?>

		</div>
	</div>

	<?php 
if ($citation = CandelaCitation::renderCitation($post->ID)) {
    ?>
		<!-- CITATIONS AND ATTRIBUTIONS -->
		<section role="contentinfo">
			<div class="post-citations sidebar">
				<div role="button" aria-pressed="false" id="citation-header-<?php 
    print $post->ID;
    ?>
" class="collapsed license-attribution-dropdown"><?php 
    _e('Licenses and Attributions');
    ?>
</div>
				<div id="citation-list-<?php 
    print $post->ID;
    ?>
" style="display:none;">
 /**
  * Return post content w/ appended citations content
  */
 public static function add_citations($content, $post_id)
 {
     return $content .= \CandelaCitation::renderCitation($post_id);
 }