Advertisement
marjwyatt

wp-mdf-wsg-intro-template

Jun 9th, 2014
258
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 11.29 KB | None | 0 0
  1. <?php
  2.     //Standard Plan Template
  3.    
  4.     global $post;
  5.     global $pdf_output;
  6.     global $pdf_header;
  7.     global $pdf_footer;
  8.  
  9.     global $pdf_template_pdfpage;
  10.     global $pdf_template_pdfpage_page;
  11.     global $pdf_template_pdfdoc;
  12.  
  13.     global $pdf_html_header;
  14.     global $pdf_html_footer;
  15.  
  16.     //Set a pdf template. if both are set the pdfdoc is used. (You didn't need a pdf template)
  17.     $pdf_template_pdfpage       = ''; //The filename off the pdf file (you need this for a page template)
  18.     $pdf_template_pdfpage_page  = 1;  //The page off this page (you need this for a page template)
  19.  
  20.     $pdf_template_pdfdoc        = ''; //The filename off the complete pdf document (you need only this for a document template)
  21.    
  22.     $pdf_html_header            = true; //If this is true you can write instead of the array a html string on the var $pdf_header
  23.     $pdf_html_footer            = false; //If this is true you can write instead of the array a html string on the var $pdf_footer
  24.  
  25.     //Set the Footer and the Header
  26.     $pdf_header = array (
  27.         'odd' =>
  28.             array (
  29.                 'R' =>
  30.                     array (
  31.                         'content' => '{PAGENO}',
  32.                         'font-size' => 12,
  33.                         'font-style' => 'B',
  34.                         'font-family' => 'Gudea',
  35.                     ),
  36.                     'line' => 1,
  37.                 ),
  38.         'even' =>
  39.             array (
  40.                 'R' =>
  41.                     array (
  42.                         'content' => '{PAGENO}',
  43.                         'font-size' => 12,
  44.                         'font-style' => 'B',
  45.                         'font-family' => 'Gudea',
  46.                     ),
  47.                     'line' => 1,
  48.             ),
  49.     );
  50.     $pdf_footer = array (
  51.         'odd' =>
  52.             array (
  53.                 'R' =>
  54.                     array (
  55.                         'content' => '{DATE m.d.Y}',
  56.                         'font-size' => 12,
  57.                         'font-style' => 'B',
  58.                         'font-family' => 'Gudea',
  59.                     ),
  60.                 'C' =>
  61.                     array (
  62.                         'content' => '- {PAGENO} / {nb} -',
  63.                         'font-size' => 12,
  64.                         'font-style' => 'B',
  65.                         'font-family' => 'Gudea',
  66.                     ),
  67.                 'L' =>
  68.                     array (
  69.                         'content' => get_bloginfo('name'),
  70.                         'font-size' => 12,
  71.                         'font-style' => 'B',
  72.                         'font-family' => 'Gudea',
  73.                     ),
  74.                 'line' => 1,
  75.             ),
  76.         'even' =>
  77.             array (
  78.                 'R' =>
  79.                     array (
  80.                         'content' => '{DATE d.m.Y}',
  81.                         'font-size' => 12,
  82.                         'font-style' => 'B',
  83.                         'font-family' => 'Gudea',
  84.                     ),
  85.                 'C' =>
  86.                     array (
  87.                         'content' => '- {PAGENO} / {nb} -',
  88.                         'font-size' => 12,
  89.                         'font-style' => 'B',
  90.                         'font-family' => 'Gudea',
  91.                     ),
  92.                 'L' =>
  93.                     array (
  94.                         'content' => get_bloginfo('name'),
  95.                         'font-size' => 12,
  96.                         'font-style' => 'B',
  97.                         'font-family' => 'Gudea',
  98.                     ),
  99.                 'line' => 1,
  100.             ),
  101.     );
  102.  
  103.     $pdf_output = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
  104.         <html xml:lang="en">
  105.        
  106.         <head>
  107.             <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  108.             <title>' . get_bloginfo() . '</title>
  109.         </head>
  110.         <body xml:lang="en">
  111.             <bookmark content="'.htmlspecialchars(get_bloginfo('name'), ENT_QUOTES).'" level="0" /><tocentry content="'.htmlspecialchars(get_bloginfo('name'), ENT_QUOTES).'" level="0" />
  112.             <div id="header">
  113.            <div id="headerimg">
  114.                 <h1 style="margin-top: -40pt" class="header-logo"><a href="' . get_option('home') . '/">' .  get_bloginfo('name') . '</a></h1>
  115.                 <div class="description">' .  get_bloginfo('description') . '</div>
  116.             </div>
  117.             </div>
  118.             <div id="content" class="widecolumn">';
  119.            
  120.             if(have_posts()) :
  121.             while (have_posts()) : the_post();
  122.                 $pdf_output .= '<bookmark content="'.the_title('','', false).'" level="1" /><tocentry content="'.the_title('','', false).'" level="1" />';
  123.                 $pdf_output .= '<div class="post">
  124.                 <h2 style="margin-top: -20pt" class="center">
  125.                <a href="' . get_permalink() . '" rel="bookmark" title="Permanent Link to ' . the_title('','', false) . '">' . the_title('','', false) . '</a></h2>';
  126.                 // the following is output for wst-intros CPT Single
  127.                 if ((is_single()) && ( 'wsg-intros' == get_post_type() ) ) {
  128.                     $pdf_output .= '<table style="width: 800px; border-size: 0px; float: none; border-collapse: collapse">';
  129.                     $pdf_output .= '<tr><td align="center" colspan="2">' . get_the_post_thumbnail( $post->ID, medium) . '</td></tr>';
  130.                     $pdf_output .= '</table>';
  131.                     $pdf_output .= '<div style="font-family: Gudea" class="intro-data">';
  132.                     $pdf_output .= '<table style="font-family: Gudea; font-size: 12pt; margin-top: 10pt; width: 850px; border-size: 0px; float: none; border-collapse: collapse">';
  133.                     if ( get_post_meta($post->ID, 'date_joined', true) ) {
  134.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 25%; vertical-align: top"><span class="intro-label">Date I Joined WSG: </span></td>';
  135.                         $pdf_output .= '<td style="width: 75%">' . (get_post_meta($post->ID, 'date_joined', true)) . '</td></tr>';
  136.                     }
  137.                     if ( get_post_meta($post->ID, 'date_birth', true) ) {
  138.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 25%; vertical-align: top"><span class="intro-label">I was born on: </span></td>';
  139.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . (get_post_meta($post->ID, 'date_birth', true)) . '</td></tr>';
  140.                     }
  141.                     if ( get_post_meta($post->ID, 'grew_up', true) ) {
  142.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 25%; vertical-align: top"><span class="intro-label">I grew up in: </span></td>';
  143.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . (get_post_meta($post->ID, 'grew_up', true)) . '</td></tr>';
  144.                     }
  145.                     if ( get_post_meta($post->ID, 'schools_majors', true) ) {
  146.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 25%; vertical-align: top"><span class="intro-label">My schools and majors: </span></td>';
  147.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'schools_majors', true)) ) . '</td></tr>';
  148.                     }
  149.                     if ( get_post_meta($post->ID, 'family_info', true) ) {
  150.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 25%; vertical-align: top"><span class="intro-label">My family information: </span></td>';
  151.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'family_info', true)) ) . '</td></tr>';
  152.                     }
  153.                     if ( get_post_meta($post->ID, 'professions_activities', true) ) {
  154.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 35%; vertical-align: top"><span class="intro-label">My past professions and activities: </span></td>';
  155.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'professions_activities', true)) ) . '</td></tr>';
  156.                     }
  157.                     if ( get_post_meta($post->ID, 'doing_now', true) ) {
  158.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 35%; vertical-align: top"><span class="intro-label">What I\'m doing now: </span></td>';
  159.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'doing_now', true)) ) . '</td></tr>';
  160.                     }
  161.                     if ( get_post_meta($post->ID, 'fundraising_charities', true) ) {
  162.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 35%; vertical-align: top"><span class="intro-label">Other fundraising activities and charities: </span></td>';
  163.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'fundraising_charities', true)) ) . '</td></tr>';
  164.                     }
  165.                     if ( get_post_meta($post->ID, 'something_unknown', true) ) {
  166.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 35%; vertical-align: top"><span class="intro-label">Something you don\'t know about me: </span></td>';
  167.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'something_unknown', true)) ) . '</td></tr>';
  168.                     }
  169.                     if ( get_post_meta($post->ID, 'fav_travel', true) ) {
  170.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 35%; vertical-align: top"><span class="intro-label">My favorite travel destination: </span></td>';
  171.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'fav_travel', true)) ) . '</td></tr>';
  172.                     }
  173.                     if ( get_post_meta($post->ID, 'fav_restaurant', true) ) {
  174.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 35%; vertical-align: top"><span class="intro-label">My favorite restaurant: </span></td>';
  175.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'fav_restaurant', true)) ) . '</td></tr>';
  176.                     }
  177.                     if ( get_post_meta($post->ID, 'fav_lunch', true) ) {
  178.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 35%; vertical-align: top"><span class="intro-label">My Favorite lunch spot: </span></td>';
  179.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'fav_lunch', true)) ) . '</td></tr>';
  180.                     }
  181.                     if ( get_post_meta($post->ID, 'night_out', true) ) {
  182.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 35%; vertical-align: top"><span class="intro-label">Place to meet friends for a night out: </span></td>';
  183.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'night_out', true)) ) . '</td></tr>';
  184.                     }
  185.                     if ( get_post_meta($post->ID, 'book_movie', true) ) {
  186.                         $pdf_output .= '<tr class="spaceUnder"><td style="width: 35%; vertical-align: top"><span class="intro-label">My favorite book, movie or play: </span></td>';
  187.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'book_movie', true)) ) . '</td></tr>';
  188.                     }
  189.                     if ( get_post_meta($post->ID, 'out_of_towners', true) ) {
  190.                         $pdf_output .= '<tr style="margin:20pt 0"><td style="width: 35%; vertical-align: top"><span class="intro-label">My favorite place to take out of towners: </span></td>';
  191.                         $pdf_output .= '<td style="width: 75%; vertical-align: top">' . ( wpautop (get_post_meta($post->ID, 'out_of_towners', true)) ) . '</td></tr>';
  192.  
  193.                     }
  194.                     $pdf_output .= '</table>';
  195.                     $pdf_output .= '</div>';
  196.                 }
  197.                 $pdf_output .= '</div>';
  198.             endwhile;
  199.            
  200.         else :
  201.             $pdf_output .= '<h2 class="center">Not Found</h2>
  202.                 <p class="center">Sorry, but you are looking for something that isn\'t here.</p>';
  203.         endif;
  204.  
  205.         $pdf_output .= '</div>';
  206.  
  207.        
  208.     $pdf_output .= '
  209.         </body>
  210.         </html>';
  211. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement