theme.php 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. <?php
  2. global $newsletter; // Newsletter object
  3. global $post; // Current post managed by WordPress
  4. if (!defined('ABSPATH'))
  5. exit;
  6. /*
  7. * Some variabled are prepared by Newsletter Plus and are available inside the theme,
  8. * for example the theme options used to build the email body as configured by blog
  9. * owner.
  10. *
  11. * $theme_options - is an associative array with theme options: every option starts
  12. * with "theme_" as required. See the theme-options.php file for details.
  13. * Inside that array there are the autmated email options as well, if needed.
  14. * A special value can be present in theme_options and is the "last_run" which indicates
  15. * when th automated email has been composed last time. Is should be used to find if
  16. * there are now posts or not.
  17. *
  18. * $is_test - if true it means we are composing an email for test purpose.
  19. */
  20. // This array will be passed to WordPress to extract the posts
  21. $filters = array();
  22. // Maximum number of post to retrieve
  23. $filters['posts_per_page'] = (int) $theme_options['theme_max_posts'];
  24. if ($filters['posts_per_page'] == 0)
  25. $filters['posts_per_page'] = 10;
  26. // Include only posts from specified categories. Do not filter per category is no
  27. // one category has been selected.
  28. if (isset($theme_options['theme_categories']) && is_array($theme_options['theme_categories'])) {
  29. $filters['cat'] = implode(',', $theme_options['theme_categories']);
  30. }
  31. // Retrieve the posts asking them to WordPress
  32. $posts = get_posts($filters);
  33. ?>
  34. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
  35. <html>
  36. <head>
  37. <title></title>
  38. </head>
  39. <body>
  40. <br />
  41. <table cellspacing="0" align="center" border="0" style="max-width:600px; width:600px; background-color: #eee;" cellpadding="0" width="600px">
  42. <!-- Header -->
  43. <tr style="background: #455560; background-image: url(<?php echo plugins_url('header.jpg', __FILE__); ?>); height:80px;width:600px;" cellspacing="0" border="0" align="center" cellpadding="0" width="600" height="80">
  44. <td height="80" width="600" style="color: #fff; font-size: 30px; font-family: Arial;" align="center" valign="middle">
  45. <?php echo get_option('blogname'); ?>
  46. </td>
  47. </tr>
  48. <tr style="background: #d0d0d0; height:20px;width:600px;">
  49. <td valign="top" height="20" width="600" bgcolor="#ffffff" align="center" style="font-family: Arial; font-size: 12px">
  50. <?php echo get_option('blogdescription'); ?>
  51. </td>
  52. </tr>
  53. <tr>
  54. <td>
  55. <table cellspacing="0" border="0" style="max-width:600px; width:600px; background-color: #eee;font-family:helvetica,arial,sans-serif;color:#555;font-size:13px;line-height:15px;" align="center" cellpadding="20" width="600px">
  56. <tr>
  57. <td>
  58. <table cellpadding="0" cellspacing="0" border="0" bordercolor="" width="100%" bgcolor="#ffffff">
  59. <?php
  60. // Do not use &post, it leads to problems...
  61. foreach ($posts as $post) {
  62. // Setup the post (WordPress requirement)
  63. setup_postdata($post);
  64. // The theme can "suggest" a subject replacing the one configured, for example. In this case
  65. // the theme, is there is no subject, suggest the first post title.
  66. if (empty($theme_options['subject']))
  67. $theme_options['subject'] = $post->post_title;
  68. // Extract a thumbnail, return null if no thumb can be found
  69. $image = nt_post_image(get_the_ID());
  70. ?>
  71. <tr>
  72. <td style="font-family: Arial; font-size: 12px">
  73. <?php if ($image != null) { ?>
  74. <img src="<?php echo $image; ?>" alt="picture" align="left" width="100" height="100" style="margin-right: 10px"/>
  75. <?php } ?>
  76. <a target="_tab" href="<?php echo get_permalink(); ?>" style="color: #000; text-decoration: none"><b><?php the_title(); ?></b></a><br />
  77. <?php the_excerpt(); ?>
  78. </td>
  79. </tr>
  80. <?php
  81. }
  82. ?>
  83. </table>
  84. </td>
  85. </tr>
  86. </table>
  87. </td>
  88. </tr>
  89. <?php if (!isset($theme_options['theme_social_disable'])) { ?>
  90. <tr>
  91. <td style="font-family: Arial; font-size: 12px">
  92. <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php'; ?>
  93. </td>
  94. </tr>
  95. <?php } ?>
  96. <tr>
  97. <td bgcolor="#ffffff" style="font-family: Arial; font-size: 12px">
  98. This email was sent to <b>{email}</b> because you opted in on <?php echo get_option('blogname'); ?> website.
  99. <br />
  100. <a target="_tab" href="{profile_url}">Manage the subscription</a> |
  101. <a target="_tab" href="{unsubscription_url}">Unsubscribe</a>
  102. </td>
  103. </tr>
  104. </table>
  105. </body>
  106. </html>