Newsletter - Version 3.4.8

Version Description

  • Added a javascript protection against auto confirmation from bot
  • Fixed a warning with debug active on site login
Download this release

Release Info

Developer satollo
Plugin Icon 128x128 Newsletter
Version 3.4.8
Comparing to
See all releases

Code changes from version 3.4.2 to 3.4.8

Files changed (54) hide show
  1. admin.css +24 -20
  2. do/confirm.php +25 -8
  3. do/subscribe.php +3 -1
  4. do/unsubscribe.php +26 -10
  5. emails/edit.php +21 -18
  6. emails/new.php +6 -5
  7. emails/theme.php +3 -1
  8. emails/themes/blank/screenshot.png +0 -0
  9. emails/themes/default/images/tumblr.png +0 -0
  10. emails/themes/default/images/youtube.png +0 -0
  11. emails/themes/default/screenshot.png +0 -0
  12. emails/themes/default/social-options.php +35 -0
  13. emails/themes/default/social.php +50 -0
  14. emails/themes/default/theme-options.php +1 -23
  15. emails/themes/default/theme-text.php +6 -5
  16. emails/themes/default/theme.php +1 -55
  17. emails/themes/linear/screenshot.png +0 -0
  18. emails/themes/linear/theme-options.php +6 -9
  19. emails/themes/linear/theme-text.php +8 -0
  20. emails/themes/linear/theme.php +96 -78
  21. emails/themes/pint/screenshot.png +0 -0
  22. emails/themes/pint/theme-options.php +15 -1
  23. emails/themes/pint/theme-text.php +4 -5
  24. emails/themes/pint/theme.php +16 -1
  25. emails/themes/simple/screenshot.png +0 -0
  26. emails/themes/simple/theme-options.php +1 -0
  27. emails/themes/simple/theme-text.php +8 -0
  28. emails/themes/simple/theme.php +155 -0
  29. emails/themes/theme-1/screenshot.png +0 -0
  30. emails/themes/theme-1/theme-options.php +6 -15
  31. emails/themes/theme-1/theme.php +67 -59
  32. emails/themes/theme-3/screenshot.png +0 -0
  33. emails/themes/theme-3/theme-options.php +5 -13
  34. emails/themes/theme-3/theme-text.php +46 -0
  35. emails/themes/theme-3/theme.php +82 -74
  36. emails/themes/vimeo-like/screenshot.png +0 -0
  37. emails/themes/vimeo-like/theme-options.php +4 -15
  38. emails/themes/vimeo-like/theme-text.php +5 -6
  39. emails/themes/vimeo-like/theme.php +69 -58
  40. header.php +5 -1
  41. includes/controls.php +47 -1
  42. includes/module.php +5 -3
  43. includes/store.php +14 -6
  44. main/diagnostic.php +1 -1
  45. main/languages/en_US.php +1 -0
  46. main/main.php +101 -54
  47. plugin.php +54 -21
  48. readme.txt +39 -1
  49. statistics/statistics.php +5 -2
  50. subscription/options.php +57 -65
  51. subscription/profile.php +5 -0
  52. subscription/subscription.php +19 -5
  53. todo.txt +0 -0
  54. widget.php +87 -70
admin.css CHANGED
@@ -608,16 +608,10 @@ border-radius: 0;
608
  margin-bottom: 15px;
609
  }
610
 
611
- .wrap {
612
- font-size: 14px;
613
- line-height: 150%;
614
- font-family: sans-serif;
615
-
616
- }
617
-
618
- .wrap td, .wrap th {
619
- font-size: 14px;
620
  font-family: sans-serif;
 
621
  }
622
 
623
  .main-index a {
@@ -663,6 +657,7 @@ font-family: Georgia;
663
  text-align: right;
664
  font-weight: bold;
665
  border-right: 1px solid #ddd;
 
666
  }
667
  .form-table th small {
668
  font-weight: normal;
@@ -723,7 +718,10 @@ table.clicks {
723
  margin-top: 10px;
724
  border-radius: 4px 4px;
725
  font-size: 12px;
 
726
  color: #666;
 
 
727
  }
728
 
729
  .intro {
@@ -741,30 +739,36 @@ table.clicks {
741
  list-style-position: inside;
742
  }
743
 
 
744
  .newsletter-checkbox-group, .nl-checkbox-group {
745
  float: left;
746
  margin-right: 5px;
747
  border: 1px solid #ccc;
748
  background-color: #f4f4f4;
749
- width: 200px;
750
  margin-bottom: 5px;
751
  padding: 5px;
752
  white-space: nowrap;
753
  overflow: hidden;
754
  }
755
 
 
756
  .newsletter-checkboxes-item {
757
  float: left;
758
  margin-right: 5px;
759
- border: 1px solid #ccc;
 
760
  background-color: #f4f4f4;
761
- width: 200px;
762
  margin-bottom: 5px;
763
- padding: 5px;
764
  white-space: nowrap;
765
  overflow: hidden;
766
  }
767
 
 
 
 
 
768
  .newsletter-checkboxes-item label {
769
  display: inline;
770
  }
@@ -894,19 +898,19 @@ table.clicks {
894
  }
895
 
896
  .tab-preamble {
897
- margin-bottom: 15px;
898
- border-radius: 3px;
899
- background-color: #f4f4f4;
900
- padding: 10px;
901
- background-repeat: no-repeat;
902
- background-position: left;
903
  font-size: 13px;
904
  line-height: normal;
905
  font-family: sans-serif;
 
 
 
 
 
 
906
  }
907
 
908
  .tab-preamble p {
909
- margin: 0;
910
  }
911
 
912
  .newsletter-paginator {
608
  margin-bottom: 15px;
609
  }
610
 
611
+ .wrap, .wrap td, .wrap th, .wrap input, .wrap textarea {
612
+ font-size: 13px;
 
 
 
 
 
 
 
613
  font-family: sans-serif;
614
+ line-height: 130%;
615
  }
616
 
617
  .main-index a {
657
  text-align: right;
658
  font-weight: bold;
659
  border-right: 1px solid #ddd;
660
+ max-width: 200px;
661
  }
662
  .form-table th small {
663
  font-weight: normal;
718
  margin-top: 10px;
719
  border-radius: 4px 4px;
720
  font-size: 12px;
721
+
722
  color: #666;
723
+ background-color: #fcf8e3;
724
+ border-color: #faebcc;
725
  }
726
 
727
  .intro {
739
  list-style-position: inside;
740
  }
741
 
742
+
743
  .newsletter-checkbox-group, .nl-checkbox-group {
744
  float: left;
745
  margin-right: 5px;
746
  border: 1px solid #ccc;
747
  background-color: #f4f4f4;
 
748
  margin-bottom: 5px;
749
  padding: 5px;
750
  white-space: nowrap;
751
  overflow: hidden;
752
  }
753
 
754
+ /* Checkbox group */
755
  .newsletter-checkboxes-item {
756
  float: left;
757
  margin-right: 5px;
758
+ border: 1px solid #ddd;
759
+ border-radius: 3px;
760
  background-color: #f4f4f4;
761
+ width: 150px;
762
  margin-bottom: 5px;
763
+ padding: 3px;
764
  white-space: nowrap;
765
  overflow: hidden;
766
  }
767
 
768
+ .newsletter-checkboxes-item input {
769
+ vertical-align: text-bottom;
770
+ }
771
+
772
  .newsletter-checkboxes-item label {
773
  display: inline;
774
  }
898
  }
899
 
900
  .tab-preamble {
 
 
 
 
 
 
901
  font-size: 13px;
902
  line-height: normal;
903
  font-family: sans-serif;
904
+ color: #3a87ad;
905
+ background-color: #d9edf7;
906
+ border: 1px solid #bce8f1;
907
+ padding: 15px;
908
+ margin-bottom: 20px;
909
+ border-radius: 4px;
910
  }
911
 
912
  .tab-preamble p {
913
+ margin: 0 0 5px 0;
914
  }
915
 
916
  .newsletter-paginator {
do/confirm.php CHANGED
@@ -1,16 +1,33 @@
1
  <?php
 
2
  // Patch to avoid "na" parameter to disturb the call
3
- unset($_REQUEST['na']);
4
- unset($_POST['na']);
5
- unset($_GET['na']);
6
 
7
  // This page is linked to {subscription_confirm_url} tag.
8
 
9
- include '../../../../wp-load.php';
10
 
11
- $user = NewsletterSubscription::instance()->confirm();
12
- if ($user->status == 'E') {
13
- NewsletterSubscription::instance()->show_message('error', $user->id);
 
 
 
14
  } else {
15
- NewsletterSubscription::instance()->show_message('confirmed', $user);
 
 
 
 
 
 
 
 
 
 
 
 
16
  }
 
1
  <?php
2
+ if (isset($_GET['ts']) && time() - $_GET['ts'] < 30) {
3
  // Patch to avoid "na" parameter to disturb the call
4
+ unset($_REQUEST['na']);
5
+ unset($_POST['na']);
6
+ unset($_GET['na']);
7
 
8
  // This page is linked to {subscription_confirm_url} tag.
9
 
10
+ include '../../../../wp-load.php';
11
 
12
+ $user = NewsletterSubscription::instance()->confirm();
13
+ if ($user->status == 'E') {
14
+ NewsletterSubscription::instance()->show_message('error', $user->id);
15
+ } else {
16
+ NewsletterSubscription::instance()->show_message('confirmed', $user);
17
+ }
18
  } else {
19
+ ?>
20
+ <!DOCTYPE html>
21
+ <html>
22
+ <head>
23
+ <script>
24
+ location.href = location.href + "&ts=<?php echo time(); ?>";
25
+ </script>
26
+ </head>
27
+ <body>
28
+ If you're not redirect in few seconds, <a href="<?php echo $_SERVER['REQUEST_URI']; ?>&ts=<?php echo time(); ?>">click here</a>, thank you.
29
+ </body>
30
+ </html>
31
+ <?php
32
  }
33
+ ?>
do/subscribe.php CHANGED
@@ -10,4 +10,6 @@ $user = NewsletterSubscription::instance()->subscribe();
10
  if ($user->status == 'E') NewsletterSubscription::instance()->show_message('error', $user->id);
11
  if ($user->status == 'C') NewsletterSubscription::instance()->show_message('confirmed', $user->id);
12
  if ($user->status == 'A') NewsletterSubscription::instance()->show_message('already_confirmed', $user->id);
13
- if ($user->status == 'S') NewsletterSubscription::instance()->show_message('confirmation', $user->id);
 
 
10
  if ($user->status == 'E') NewsletterSubscription::instance()->show_message('error', $user->id);
11
  if ($user->status == 'C') NewsletterSubscription::instance()->show_message('confirmed', $user->id);
12
  if ($user->status == 'A') NewsletterSubscription::instance()->show_message('already_confirmed', $user->id);
13
+ if ($user->status == 'S') NewsletterSubscription::instance()->show_message('confirmation', $user->id);
14
+ ?>
15
+ Uncorrect status: <?php echo $user->status; ?>
do/unsubscribe.php CHANGED
@@ -1,15 +1,31 @@
1
  <?php
 
 
 
 
 
2
 
3
- // Patch to avoid "na" parameter to disturb the call
4
- unset($_REQUEST['na']);
5
- unset($_POST['na']);
6
- unset($_GET['na']);
7
 
8
- require_once '../../../../wp-load.php';
9
-
10
- $user = NewsletterSubscription::instance()->unsubscribe();
11
- if ($user->status == 'E') {
12
- NewsletterSubscription::instance()->show_message('error', $user->id);
 
13
  } else {
14
- NewsletterSubscription::instance()->show_message('unsubscribed', $user);
 
 
 
 
 
 
 
 
 
 
 
 
15
  }
 
1
  <?php
2
+ if (isset($_GET['ts']) && time() - $_GET['ts'] < 30) {
3
+ // Patch to avoid "na" parameter to disturb the call
4
+ unset($_REQUEST['na']);
5
+ unset($_POST['na']);
6
+ unset($_GET['na']);
7
 
8
+ require_once '../../../../wp-load.php';
 
 
 
9
 
10
+ $user = NewsletterSubscription::instance()->unsubscribe();
11
+ if ($user->status == 'E') {
12
+ NewsletterSubscription::instance()->show_message('error', $user->id);
13
+ } else {
14
+ NewsletterSubscription::instance()->show_message('unsubscribed', $user);
15
+ }
16
  } else {
17
+ ?>
18
+ <!DOCTYPE html>
19
+ <html>
20
+ <head>
21
+ <script>
22
+ location.href = location.href + "&ts=<?php echo time(); ?>";
23
+ </script>
24
+ </head>
25
+ <body>
26
+ If you're not redirect in few seconds, <a href="<?php echo $_SERVER['REQUEST_URI']; ?>&ts=<?php echo time(); ?>">click here</a>, thank you.
27
+ </body>
28
+ </html>
29
+ <?php
30
  }
31
+ ?>
emails/edit.php CHANGED
@@ -264,10 +264,7 @@ if ($email['editor'] == 0) {
264
  <input id="upload_image_button" type="button" value="Choose or upload an image" />
265
  <?php $email['editor'] == 0 ? $controls->editor('message', 30) : $controls->textarea_fixed('message', '100%', '400'); ?>
266
  <div class="hints">
267
- Tags: <strong>{name}</strong> receiver name;
268
- <strong>{unsubscription_url}</strong> unsubscription URL;
269
- <strong>{token}</strong> the subscriber token; <strong>{profile_url}</strong> link to user subscription options page;
270
- <strong>{np_aaa}</strong> user profile data named "aaa".
271
  </div>
272
  </td>
273
  </tr>
@@ -276,15 +273,17 @@ if ($email['editor'] == 0) {
276
 
277
 
278
  <div id="tabs-b">
 
279
  <p>
280
  This is the textual version of your newsletter. If you empty it, only an HTML version will be sent but
281
  is an anti-spam best practice to include a text only version.
282
  </p>
 
283
  <table class="form-table">
284
  <tr valign="top">
285
  <th>Message</th>
286
  <td>
287
- <?php $controls->textarea_fixed('message_text', '100%', '250'); ?>
288
  </td>
289
  </tr>
290
  </table>
@@ -293,23 +292,13 @@ if ($email['editor'] == 0) {
293
 
294
  <div id="tabs-c">
295
  <table class="form-table">
 
296
  <tr valign="top">
297
- <th>Approximative number of receivers</th>
298
- <td>
299
- <?php
300
- echo $wpdb->get_var(str_replace('*', 'count(*)', $email['query']));
301
- ?>
302
- <div class="hints">
303
- If you change selections below, save the email to update this values.
304
- </div>
305
- </td>
306
- </tr>
307
- <tr valign="top">
308
- <th>Sex</th>
309
  <td>
310
  <?php $controls->checkboxes_group('sex', array('f'=>'Women', 'm'=>'Men', 'n'=>'Not specified')); ?>
311
  <div class="hints">
312
- Leaving all sex options unselected means to NOT filter by sex.
313
  </div>
314
  </td>
315
  </tr>
@@ -361,6 +350,20 @@ if ($email['editor'] == 0) {
361
  </div>
362
  </td>
363
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
364
  </table>
365
  </div>
366
 
264
  <input id="upload_image_button" type="button" value="Choose or upload an image" />
265
  <?php $email['editor'] == 0 ? $controls->editor('message', 30) : $controls->textarea_fixed('message', '100%', '400'); ?>
266
  <div class="hints">
267
+ <a href="http://www.satollo.net/plugins/newsletter/newsletter-tags" target="">See the list of all tags</a> that can be used on the email text.
 
 
 
268
  </div>
269
  </td>
270
  </tr>
273
 
274
 
275
  <div id="tabs-b">
276
+ <div class="tab-preamble">
277
  <p>
278
  This is the textual version of your newsletter. If you empty it, only an HTML version will be sent but
279
  is an anti-spam best practice to include a text only version.
280
  </p>
281
+ </div>
282
  <table class="form-table">
283
  <tr valign="top">
284
  <th>Message</th>
285
  <td>
286
+ <?php $controls->textarea_fixed('message_text', '100%', '350'); ?>
287
  </td>
288
  </tr>
289
  </table>
292
 
293
  <div id="tabs-c">
294
  <table class="form-table">
295
+
296
  <tr valign="top">
297
+ <th>Gender</th>
 
 
 
 
 
 
 
 
 
 
 
298
  <td>
299
  <?php $controls->checkboxes_group('sex', array('f'=>'Women', 'm'=>'Men', 'n'=>'Not specified')); ?>
300
  <div class="hints">
301
+ Leaving all gender options unselected disable this filter.
302
  </div>
303
  </td>
304
  </tr>
350
  </div>
351
  </td>
352
  </tr>
353
+ <tr valign="top">
354
+ <th>
355
+ Approximative number of receivers<br>
356
+ <small>Updated everytime you save</small>
357
+ </th>
358
+ <td>
359
+ <?php
360
+ echo $wpdb->get_var(str_replace('*', 'count(*)', $email['query']));
361
+ ?>
362
+ <div class="hints">
363
+ If you change selections below, save the email to update this values.
364
+ </div>
365
+ </td>
366
+ </tr>
367
  </table>
368
  </div>
369
 
emails/new.php CHANGED
@@ -10,7 +10,7 @@ if ($controls->is_action('theme')) {
10
 
11
  if ($controls->is_action('save')) {
12
  $module->save_options($controls->data);
13
- $controls->messages = 'Saved.';
14
  }
15
 
16
  if ($controls->is_action('create')) {
@@ -94,6 +94,7 @@ function newsletter_emails_get_theme_options($theme) {
94
  <?php include NEWSLETTER_DIR . '/header.php'; ?>
95
 
96
  <h2>New Newsletter</h2>
 
97
 
98
  <?php $controls->show(); ?>
99
 
@@ -103,11 +104,11 @@ function newsletter_emails_get_theme_options($theme) {
103
 
104
  <table style="width: 100%">
105
  <tr>
106
- <td><?php $controls->button_primary('save', 'Save options and refresh'); ?>
107
- To create custom theme <a href="http://www.satollo.net/plugins/newsletter/newsletter-themes" target="_blank">read here</a>
108
  </td>
109
- <td>
110
- <?php $controls->button_primary('create', 'Go to edit this message'); ?>
111
  </td>
112
  </tr>
113
  <tr>
10
 
11
  if ($controls->is_action('save')) {
12
  $module->save_options($controls->data);
13
+ //$controls->messages = 'Saved.';
14
  }
15
 
16
  if ($controls->is_action('create')) {
94
  <?php include NEWSLETTER_DIR . '/header.php'; ?>
95
 
96
  <h2>New Newsletter</h2>
97
+ <p><a href="<?php echo NewsletterEmails::instance()->get_admin_page_url('theme'); ?>">Back to the themes</a></p>
98
 
99
  <?php $controls->show(); ?>
100
 
104
 
105
  <table style="width: 100%">
106
  <tr>
107
+ <td style="text-align: center; vertical-align: top; border-bottom: 1px solid #ccc">
108
+ <?php $controls->button_primary('save', '(1) Save options and refresh the preview'); ?><br><br>
109
  </td>
110
+ <td style="text-align: center; vertical-align: top; border-bottom: 1px solid #ccc">
111
+ <?php $controls->button_primary('create', '(2) Go to edit this message'); ?><br><br>
112
  </td>
113
  </tr>
114
  <tr>
emails/theme.php CHANGED
@@ -53,6 +53,8 @@ $themes = $module->themes->get_all_with_data();
53
  <?php include NEWSLETTER_DIR . '/header.php'; ?>
54
 
55
  <h2>New Newsletter</h2>
 
 
56
 
57
  <?php $controls->show(); ?>
58
 
@@ -62,7 +64,7 @@ $themes = $module->themes->get_all_with_data();
62
  <?php foreach ($themes as $key => &$data) { ?>
63
  <div style="display: block; float: left; text-align: center; margin-right: 10px;">
64
  <?php echo $key; ?><br>
65
- <a href="#" onclick="var f = document.getElementById('newsletter-form'); f.act.value='theme'; f.elements['options[theme]'].value='<?php echo $key; ?>'; f.submit(); return false"><img src="<?php echo $data['screenshot'] ?>" width="200" height="200" style="border: 1px solid #666; padding: 5px"></a>
66
  </div>
67
  <?php } ?>
68
  </form>
53
  <?php include NEWSLETTER_DIR . '/header.php'; ?>
54
 
55
  <h2>New Newsletter</h2>
56
+
57
+ <p>To create custom themes <a href="http://www.satollo.net/plugins/newsletter/newsletter-themes" target="_blank">read here</a>.</p>
58
 
59
  <?php $controls->show(); ?>
60
 
64
  <?php foreach ($themes as $key => &$data) { ?>
65
  <div style="display: block; float: left; text-align: center; margin-right: 10px;">
66
  <?php echo $key; ?><br>
67
+ <a href="#" onclick="var f = document.getElementById('newsletter-form'); f.act.value='theme'; f.elements['options[theme]'].value='<?php echo $key; ?>'; f.submit(); return false" style="margin-right: 20px; margin-bottom: 20px"><img src="<?php echo $data['screenshot'] ?>" width="200" height="200" style="border: 5px solid #ccc; border-radius: 5px; padding: 5px"></a>
68
  </div>
69
  <?php } ?>
70
  </form>
emails/themes/blank/screenshot.png ADDED
Binary file
emails/themes/default/images/tumblr.png ADDED
Binary file
emails/themes/default/images/youtube.png ADDED
Binary file
emails/themes/default/screenshot.png CHANGED
Binary file
emails/themes/default/social-options.php ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <h3>Social icons</h3>
2
+ <table class="form-table">
3
+ <tr>
4
+ <th>Social block</th>
5
+ <td><?php $controls->checkbox('theme_social'); ?> Disable</td>
6
+ </tr>
7
+ <tr>
8
+ <th>Facebook</th>
9
+ <td><?php $controls->text_url('theme_facebook', 30); ?></td>
10
+ </tr>
11
+ <tr>
12
+ <th>Twitter</th>
13
+ <td><?php $controls->text_url('theme_twitter', 30); ?></td>
14
+ </tr>
15
+ <tr>
16
+ <th>Pinterest</th>
17
+ <td><?php $controls->text_url('theme_pinterest', 30); ?></td>
18
+ </tr>
19
+ <tr>
20
+ <th>Google+</th>
21
+ <td><?php $controls->text_url('theme_googleplus', 30); ?></td>
22
+ </tr>
23
+ <tr>
24
+ <th>LinkedIn</th>
25
+ <td><?php $controls->text_url('theme_linkedin', 30); ?></td>
26
+ </tr>
27
+ <tr>
28
+ <th>Tumblr</th>
29
+ <td><?php $controls->text_url('theme_tumblr', 30); ?></td>
30
+ </tr>
31
+ <tr>
32
+ <th>YouTube</th>
33
+ <td><?php $controls->text_url('theme_youtube', 30); ?></td>
34
+ </tr>
35
+ </table>
emails/themes/default/social.php ADDED
@@ -0,0 +1,50 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!-- Social -->
2
+ <?php
3
+ if (isset($theme_options['theme_social_disable'])) return;
4
+ $social_icon_url = plugins_url('emails/themes/default/images', 'newsletter/plugin.pnp');
5
+ ?>
6
+ <table cellpadding="5" align="center">
7
+ <tr>
8
+ <?php if (!empty($theme_options['theme_facebook'])) { ?>
9
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
10
+ <a href="<?php echo $theme_options['theme_facebook'] ?>"><img src="<?php echo $social_icon_url ?>/facebook.png"><br>Facebook</a>
11
+ </td>
12
+ <?php } ?>
13
+
14
+ <?php if (!empty($theme_options['theme_twitter'])) { ?>
15
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
16
+ <a href="<?php echo $theme_options['theme_twitter'] ?>"><img src="<?php echo $social_icon_url ?>/twitter.png"><br>Twitter</a>
17
+ </td>
18
+ <?php } ?>
19
+
20
+ <?php if (!empty($theme_options['theme_googleplus'])) { ?>
21
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
22
+ <a href="<?php echo $theme_options['theme_googleplus'] ?>"><img src="<?php echo $social_icon_url ?>/googleplus.png"><br>Google+</a>
23
+ </td>
24
+ <?php } ?>
25
+
26
+ <?php if (!empty($theme_options['theme_pinterest'])) { ?>
27
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
28
+ <a href="<?php echo $theme_options['theme_pinterest'] ?>"><img src="<?php echo $social_icon_url ?>/pinterest.png"><br>Pinterest</a>
29
+ </td>
30
+ <?php } ?>
31
+
32
+ <?php if (!empty($theme_options['theme_linkedin'])) { ?>
33
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
34
+ <a href="<?php echo $theme_options['theme_linkedin'] ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png"><br>LinkedIn</a>
35
+ </td>
36
+ <?php } ?>
37
+
38
+ <?php if (!empty($theme_options['theme_tumblr'])) { ?>
39
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
40
+ <a href="<?php echo $theme_options['theme_tumblr'] ?>"><img src="<?php echo $social_icon_url ?>/tumblr.png"><br>Tumblr</a>
41
+ </td>
42
+ <?php } ?>
43
+
44
+ <?php if (!empty($theme_options['theme_youtube'])) { ?>
45
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
46
+ <a href="<?php echo $theme_options['theme_youtube'] ?>"><img src="<?php echo $social_icon_url ?>/youtube.png"><br>Youtube</a>
47
+ </td>
48
+ <?php } ?>
49
+ </tr>
50
+ </table>
emails/themes/default/theme-options.php CHANGED
@@ -38,28 +38,6 @@
38
  <div class="hints">Leave all uncheck for a default behavior.</div>
39
  </div>
40
  <div id="tab-social">
41
- <table class="form-table">
42
- <tr>
43
- <th>Facebook</th>
44
- <td><?php $controls->text_url('theme_facebook',30); ?></td>
45
- </tr>
46
- <tr>
47
- <th>Twitter</th>
48
- <td><?php $controls->text_url('theme_twitter',30); ?></td>
49
- </tr>
50
- <tr>
51
- <th>Pinterest</th>
52
- <td><?php $controls->text_url('theme_pinterest',30); ?></td>
53
- </tr>
54
- <tr>
55
- <th>Google+</th>
56
- <td><?php $controls->text_url('theme_googleplus',30); ?></td>
57
- </tr>
58
- <tr>
59
- <th>LinkedIn</th>
60
- <td><?php $controls->text_url('theme_linkedin',30); ?></td>
61
- </tr>
62
- </table>
63
-
64
  </div>
65
  </div>
38
  <div class="hints">Leave all uncheck for a default behavior.</div>
39
  </div>
40
  <div id="tab-social">
41
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
42
  </div>
43
  </div>
emails/themes/default/theme-text.php CHANGED
@@ -1,7 +1,8 @@
1
- View this email online here: {email_url}.
2
- ---
3
 
4
- Blank newsletter!
5
 
6
- ---
7
- To change your subscription follow {profile_url}.
 
 
1
+ This email requires a modern e-mail reader but uou can view the email online here:
 
2
 
3
+ {email_url}.
4
 
5
+ Thank you, <?php echo get_option('blogname'); ?>
6
+
7
+ To change your subscription follow:
8
+ {profile_url}.
emails/themes/default/theme.php CHANGED
@@ -83,61 +83,7 @@ if (isset($theme_options['theme_posts'])) {
83
  </table>
84
  <?php } ?>
85
 
86
- <!-- Social -->
87
- <table cellpadding="5" align="center">
88
- <tr>
89
- <?php if (!empty($theme_options['theme_facebook'])) { ?>
90
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
91
- <a href="<?php echo $theme_options['theme_facebook']?>">
92
- <img src="<?php echo $theme_url?>/images/facebook.png">
93
- <br>
94
- Facebook
95
- </a>
96
- </td>
97
- <?php } ?>
98
-
99
- <?php if (!empty($theme_options['theme_twitter'])) { ?>
100
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
101
- <a href="<?php echo $theme_options['theme_twitter']?>">
102
- <img src="<?php echo $theme_url?>/images/twitter.png">
103
- <br>
104
- Twitter
105
- </a>
106
- </td>
107
- <?php } ?>
108
-
109
- <?php if (!empty($theme_options['theme_googleplus'])) { ?>
110
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
111
- <a href="<?php echo $theme_options['theme_googleplus']?>">
112
- <img src="<?php echo $theme_url?>/images/googleplus.png">
113
- <br>
114
- Google+
115
- </a>
116
- </td>
117
- <?php } ?>
118
-
119
- <?php if (!empty($theme_options['theme_pinterest'])) { ?>
120
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
121
- <a href="<?php echo $theme_options['theme_pinterest']?>">
122
- <img src="<?php echo $theme_url?>/images/pinterest.png">
123
- <br>
124
- Pinterest
125
- </a>
126
- </td>
127
- <?php } ?>
128
-
129
- <?php if (!empty($theme_options['theme_linkedin'])) { ?>
130
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
131
- <a href="<?php echo $theme_options['theme_linkedin']?>">
132
- <img src="<?php echo $theme_url?>/images/linkedin.png">
133
- <br>
134
- LinkedIn
135
- </a>
136
- </td>
137
- <?php } ?>
138
-
139
- </tr>
140
- </table>
141
 
142
  <p>To change your subscription, <a target="_blank" href="{profile_url}">click here</a>.
143
  </div>
83
  </table>
84
  <?php } ?>
85
 
86
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php'; ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
87
 
88
  <p>To change your subscription, <a target="_blank" href="{profile_url}">click here</a>.
89
  </div>
emails/themes/linear/screenshot.png ADDED
Binary file
emails/themes/linear/theme-options.php CHANGED
@@ -1,14 +1,11 @@
1
  <table class="form-table">
2
  <tr>
3
- <th>Facebook link</th>
4
- <td><?php $controls->text('theme_facebook'); ?></td>
5
  </tr>
6
  <tr>
7
- <th>Twitter link</th>
8
- <td><?php $controls->text('theme_twitter'); ?></td>
9
  </tr>
10
- <tr>
11
- <th>YouTube link</th>
12
- <td><?php $controls->text('theme_youtube'); ?></td>
13
- </tr>
14
- </table>
1
  <table class="form-table">
2
  <tr>
3
+ <th>Max posts</th>
4
+ <td><?php $controls->text('theme_max_posts', 5); ?></td>
5
  </tr>
6
  <tr>
7
+ <th>Categories</th>
8
+ <td><?php $controls->categories_group('theme_categories'); ?></td>
9
  </tr>
10
+ </table>
11
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
 
 
 
emails/themes/linear/theme-text.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ This email requires a modern e-mail reader. You can view the email online here:
2
+
3
+ {email_url}.
4
+
5
+ Thank you, <?php echo get_option('blogname'); ?>
6
+
7
+ To change your subscription follow:
8
+ {profile_url}.
emails/themes/linear/theme.php CHANGED
@@ -1,94 +1,112 @@
1
  <?php
2
- $posts = get_posts();
3
- $theme_options['theme_background'] = 'purple.png';
4
  global $post;
 
 
 
 
 
 
 
 
 
 
 
5
  ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
6
  <html>
7
- <head>
8
- <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
9
 
10
- <style type="text/css">
11
- </style>
12
- </head>
13
- <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="background-image:url(<?php echo $theme_url; ?>/images/<?php echo $theme_options['theme_background']; ?>);background-repeat: repeat-x;background-color: #efefef;">
14
 
15
- <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
16
- <tr>
17
- <td align="center" valign="top">
18
 
19
- <table border="0" cellpadding="10" cellspacing="0" width="600" style="background-color: #FAFAFA;">
20
- <tr>
21
- <td valign="top">
22
- <table border="0" cellpadding="10" cellspacing="0" width="100%">
23
- <tr>
24
- <td valign="top" align="left" style="color: #505050;font-family: Arial;font-size: 10px;">
25
- You are receiving this email because you subscribed to <?php echo get_option('blogname'); ?>. <a href="{profile_url}">Click here to change your subscription</a>.
26
- </td>
27
- <td valign="top" width="190" align="left" style="color: #505050;font-family: Arial;font-size: 10px;">
28
- Is this email not displaying correctly?<br><a href="{email_url}" style="color: #336699;font-weight: normal;text-decoration: underline;">View it online</a>.
29
- </td>
30
- </tr>
31
- </table>
32
- </td>
33
- </tr>
34
- </table>
35
 
36
- <table border="0" cellpadding="0" cellspacing="0" width="600" bgcolor="#FFFFFF">
37
- <tr>
38
- <td align="center" valign="middle" height="150" style="color: #202020;font-family: Arial;font-size: 34px;font-weight: bold;line-height: 100%;padding: 5px 0 -2px 0;border-width: 1px 0px;border-style: solid;border-color: #dddddd;">
39
- <?php echo get_option('blogname'); ?>
40
- </td>
41
- </tr>
42
- </table>
43
- <table border="0" cellpadding="0" cellspacing="0" width="600" bgcolor="#FFFFFF">
44
- <tr>
45
 
46
- <td valign="top">
47
- <table border="0" cellpadding="20" cellspacing="0" width="200">
48
- <tr>
49
- <td valign="top" align="left" style="color: #505050;font-family: Arial;font-size: 12px;line-height: 150%;">
50
- Sidebar text
51
- </td>
52
- </tr>
53
- <tr>
54
- <td valign="top" align="left">
55
- <?php foreach (array('facebook','twitter','youtube') as $social) { ?>
56
- <?php if (!empty($theme_options["theme_$social"])) { ?>
57
- <a href="<?php echo $theme_options["theme_$social"]; ?>"><img src="<?php echo $theme_url; ?>/images/<?php echo $social; ?>.png" alt="<?php echo $social; ?>"></a>
58
- <?php } ?>
59
- <?php } ?>
60
- </td>
61
- </tr>
62
- </table>
63
- </td>
 
 
 
 
 
 
 
64
 
65
- <td valign="top">
66
- <table border="0" cellpadding="20" cellspacing="0" width="100%" bgcolor="#ffffff">
67
- <tr>
68
- <td valign="top">
69
 
70
- <?php foreach ($posts as $post) { setup_postdata($post); ?>
71
- <h2 style="color: #202020;font-family: Arial;font-size: 20px;font-weight: bold;margin-top: 0;margin-bottom: 10px;border-bottom: 1px solid #efefef;">
72
- <?php the_title(); ?>
73
- </h2>
74
- <center><img src="<?php echo newsletter_get_post_image($post->ID, 'medium');?>"></center>
75
- <div style="color: #505050;font-family: Arial;font-size: 14px;line-height: 150%;">
76
- <?php the_excerpt(); ?>
77
- </div>
78
- <?php } ?>
 
 
79
 
80
- </td>
81
- </tr>
82
- </table>
83
- </td>
84
 
85
- </tr>
86
- </table>
87
- </td>
88
- </tr>
89
 
90
- </table>
91
- <br><br>
92
 
93
- </body>
94
  </html>
1
  <?php
 
 
2
  global $post;
3
+
4
+ $filters = array();
5
+ if (!empty($theme_options['theme_categories'])) {
6
+ $filters['category__in'] = $theme_options['theme_categories'];
7
+ }
8
+ if (empty($theme_options['theme_max_posts']))
9
+ $filters['showposts'] = 10;
10
+ else
11
+ $filters['showposts'] = (int) $theme_options['theme_max_posts'];
12
+
13
+ $posts = get_posts($filters);
14
  ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/loose.dtd">
15
  <html>
16
+ <head>
17
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
18
 
19
+ <style type="text/css">
20
+ </style>
21
+ </head>
22
+ <body leftmargin="0" marginwidth="0" topmargin="0" marginheight="0" offset="0" style="background-color: #efefef;">
23
 
24
+ <table align="center" border="0" cellpadding="0" cellspacing="0" width="100%">
25
+ <tr>
26
+ <td align="center" valign="top">
27
 
28
+ <table border="0" cellpadding="10" cellspacing="0" width="600" style="background-color: #FAFAFA;">
29
+ <tr>
30
+ <td valign="top">
31
+ <table border="0" cellpadding="10" cellspacing="0" width="100%">
32
+ <tr>
33
+ <td valign="top" align="left" style="color: #505050;font-family: Arial;font-size: 10px;">
34
+ You are receiving this email because you subscribed to <?php echo get_option('blogname'); ?>. <a href="{profile_url}">Click here to change your subscription</a>.
35
+ </td>
36
+ <td valign="top" width="190" align="left" style="color: #505050;font-family: Arial;font-size: 10px;">
37
+ Is this email not displaying correctly?<br><a href="{email_url}" style="color: #336699;font-weight: normal;text-decoration: underline;">View it online</a>.
38
+ </td>
39
+ </tr>
40
+ </table>
41
+ </td>
42
+ </tr>
43
+ </table>
44
 
45
+ <table border="0" cellpadding="0" cellspacing="0" width="600" bgcolor="#FFFFFF">
46
+ <tr>
47
+ <td align="center" valign="middle" height="150" style="color: #202020;font-family: Arial;font-size: 34px;font-weight: bold;line-height: 100%;padding: 5px 0 -2px 0;border-width: 1px 0px;border-style: solid;border-color: #dddddd;">
48
+ <?php echo get_option('blogname'); ?>
49
+ </td>
50
+ </tr>
51
+ </table>
52
+ <table border="0" cellpadding="0" cellspacing="0" width="600" bgcolor="#FFFFFF">
53
+ <tr>
54
 
55
+ <td valign="top">
56
+ <table border="0" cellpadding="20" cellspacing="0" width="200">
57
+ <tr>
58
+ <td valign="top" align="left" style="color: #505050;font-family: Arial;font-size: 12px;line-height: 150%;">
59
+ Sidebar text
60
+ </td>
61
+ </tr>
62
+ <?php
63
+ if (!isset($theme_options['theme_social_disable'])) {
64
+ $social_icon_url = plugins_url('emails/themes/default/images', 'newsletter/plugin.pnp');
65
+ ?>
66
+ <tr>
67
+ <td valign="top" align="left">
68
+ <?php
69
+ foreach (array('facebook', 'twitter', 'youtube', 'linkedin', 'googleplus', 'pinterest', 'tumblr') as $social) {
70
+ if (empty($theme_options["theme_$social"]))
71
+ continue;
72
+ ?>
73
+ <a href="<?php echo $theme_options["theme_$social"]; ?>"><img src="<?php echo $social_icon_url; ?>/<?php echo $social; ?>.png" alt="<?php echo $social; ?>"></a>
74
+ <?php } ?>
75
+ </td>
76
+ </tr>
77
+ <?php } ?>
78
+ </table>
79
+ </td>
80
 
81
+ <td valign="top">
82
+ <table border="0" cellpadding="20" cellspacing="0" width="100%" bgcolor="#ffffff">
83
+ <tr>
84
+ <td valign="top">
85
 
86
+ <?php foreach ($posts as $post) {
87
+ setup_postdata($post);
88
+ ?>
89
+ <h2 style="color: #202020;font-family: Arial;font-size: 20px;font-weight: bold;margin-top: 0;margin-bottom: 10px;border-bottom: 1px solid #efefef;">
90
+ <?php the_title(); ?>
91
+ </h2>
92
+ <center><img src="<?php echo newsletter_get_post_image($post->ID, 'medium'); ?>"></center>
93
+ <div style="color: #505050;font-family: Arial;font-size: 14px;line-height: 150%;">
94
+ <?php the_excerpt(); ?>
95
+ </div>
96
+ <?php } ?>
97
 
98
+ </td>
99
+ </tr>
100
+ </table>
101
+ </td>
102
 
103
+ </tr>
104
+ </table>
105
+ </td>
106
+ </tr>
107
 
108
+ </table>
109
+ <br><br>
110
 
111
+ </body>
112
  </html>
emails/themes/pint/screenshot.png CHANGED
Binary file
emails/themes/pint/theme-options.php CHANGED
@@ -1 +1,15 @@
1
- <p>This theme has no options.</p>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <p>
2
+ This theme requires posts with at least one image and a number of posts like
3
+ 3, 6, 9, ...
4
+ </p>
5
+ <table class="form-table">
6
+ <tr>
7
+ <th>Max posts</th>
8
+ <td><?php $controls->text('theme_max_posts', 5); ?></td>
9
+ </tr>
10
+ <tr>
11
+ <th>Categories</th>
12
+ <td><?php $controls->categories_group('theme_categories'); ?></td>
13
+ </tr>
14
+ </table>
15
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
emails/themes/pint/theme-text.php CHANGED
@@ -1,9 +1,8 @@
1
- This email requires a modern mail reader.
2
 
3
- To view this email online:
4
  {email_url}.
5
 
6
- To change your subscription:
7
- {profile_url}.
8
 
9
- Thank you.
 
1
+ This email requires a modern e-mail reader. You can view the email online here:
2
 
 
3
  {email_url}.
4
 
5
+ Thank you, <?php echo get_option('blogname'); ?>
 
6
 
7
+ To change your subscription follow:
8
+ {profile_url}.
emails/themes/pint/theme.php CHANGED
@@ -10,7 +10,16 @@
10
 
11
  global $newsletter, $post;
12
 
13
- $posts = get_posts(array('post_status'=>'publish', 'showposts'=>9));
 
 
 
 
 
 
 
 
 
14
 
15
  ?><!DOCTYPE html>
16
  <html>
@@ -58,6 +67,12 @@ $posts = get_posts(array('post_status'=>'publish', 'showposts'=>9));
58
  </table>
59
 
60
  <br><br>
 
 
 
 
 
 
61
 
62
  <small>To change your subscription, <a target="_tab" href="{profile_url}" style="color: #666; text-decoration: none">click here</a></small>
63
 
10
 
11
  global $newsletter, $post;
12
 
13
+ $filters = array();
14
+ if (!empty($theme_options['theme_categories'])) {
15
+ $filters['category__in'] = $theme_options['theme_categories'];
16
+ }
17
+ if (empty($theme_options['theme_max_posts']))
18
+ $filters['showposts'] = 9;
19
+ else
20
+ $filters['showposts'] = (int) $theme_options['theme_max_posts'];
21
+
22
+ $posts = get_posts($filters);
23
 
24
  ?><!DOCTYPE html>
25
  <html>
67
  </table>
68
 
69
  <br><br>
70
+
71
+ <?php
72
+ if (!isset($theme_options['theme_social_disable'])) {
73
+ include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php';
74
+ }
75
+ ?>
76
 
77
  <small>To change your subscription, <a target="_tab" href="{profile_url}" style="color: #666; text-decoration: none">click here</a></small>
78
 
emails/themes/simple/screenshot.png ADDED
Binary file
emails/themes/simple/theme-options.php ADDED
@@ -0,0 +1 @@
 
1
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
emails/themes/simple/theme-text.php ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
1
+ This email requires a modern e-mail reader but uou can view the email online here:
2
+
3
+ {email_url}.
4
+
5
+ Thank you, <?php echo get_option('blogname'); ?>
6
+
7
+ To change your subscription follow:
8
+ {profile_url}.
emails/themes/simple/theme.php ADDED
@@ -0,0 +1,155 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Some variables are already defined:
4
+ *
5
+ * - $theme_options An array with all theme options
6
+ * - $theme_url Is the absolute URL to the theme folder used to reference images
7
+ * - $theme_subject Will be the email subject if set by this theme
8
+ *
9
+ */
10
+
11
+ global $newsletter, $post;
12
+
13
+ $color = $theme_options['theme_color'];
14
+ if (empty($color))
15
+ $color = '#0088cc';
16
+
17
+ if (isset($theme_options['theme_posts'])) {
18
+ $filters = array();
19
+
20
+ if (empty($theme_options['theme_max_posts']))
21
+ $filters['showposts'] = 10;
22
+ else
23
+ $filters['showposts'] = (int) $theme_options['theme_max_posts'];
24
+
25
+ if (!empty($theme_options['theme_categories'])) {
26
+ $filters['category__in'] = $theme_options['theme_categories'];
27
+ }
28
+
29
+ if (!empty($theme_options['theme_tags'])) {
30
+ $filters['tag'] = $theme_options['theme_tags'];
31
+ }
32
+
33
+ if (!empty($theme_options['theme_post_types'])) {
34
+ $filters['post_type'] = $theme_options['theme_post_types'];
35
+ }
36
+
37
+ $posts = get_posts($filters);
38
+ }
39
+ ?><!DOCTYPE html>
40
+ <html>
41
+ <head>
42
+ <style type="text/css">
43
+ .ReadMsgBody {
44
+ width: 100%;
45
+ }
46
+ .ExternalClass {
47
+ width: 100%; background-color:#e7e8e9 !important;
48
+ }
49
+ .yshortcuts {color: #2979be;}
50
+ body {
51
+ background-color: #e7e8e9;}
52
+
53
+ </style>
54
+ </head>
55
+ <body style="background-color:#e7e8e9;">
56
+ <br>
57
+ <br>
58
+ <table border="0" cellspacing="0" cellpadding="1" width="550" align="center">
59
+ <tbody>
60
+ <tr>
61
+ <td style="background-color: #fff;" width="550" valign="top">
62
+ <table border="0" cellspacing="0" cellpadding="0" width="100%">
63
+ <tbody>
64
+ <tr>
65
+ <td valign="top" style="background-color: #333; color: #f4f4f4; font-size: 20px; padding: 7px">
66
+ <?php echo get_option('blogname') ?>
67
+ </td>
68
+ </tr>
69
+ <!-- main content here -->
70
+ <tr>
71
+ <td>
72
+ <table border="0" cellspacing="0" cellpadding="0" width="100%">
73
+ <tbody>
74
+ <tr>
75
+ <td rowspan="10" width="35"></td>
76
+ <td height="30"><br /></td>
77
+ <td rowspan="9" width="35"></td>
78
+ </tr>
79
+ <tr>
80
+ <td style="font-size: 32px; font-family: Arial; color: #217abe;">Here the title</td>
81
+ </tr>
82
+ <tr>
83
+ <td style="font-size: 22px; font-family: Arial; color: #262729;">Here the subtitle</td>
84
+ </tr>
85
+ <tr>
86
+ <td style="font-size: 14px; font-family: Arial; color: #444; text-align: left">
87
+ <p>Hi {name},</p>
88
+ <p>here a great new from me. I absoutely need to share this secret with you.</p>
89
+ <p>Here a unordered list:</p>
90
+ <ul>
91
+ <li>List item 1</li>
92
+ <li>List item 2</li>
93
+ <li>List item 3</li>
94
+ </ul>
95
+ <p>Some other words before say good bye!</p>
96
+ <p>See you soon.</p>
97
+ </td>
98
+ </tr>
99
+
100
+ <tr>
101
+ <td height="30"></td>
102
+ </tr>
103
+ </tbody>
104
+ </table>
105
+ </td>
106
+ </tr>
107
+ <!-- end main content -->
108
+ <tr>
109
+ <td>
110
+ <table border="0" cellspacing="0" cellpadding="0" width="100%">
111
+ <tbody>
112
+ <tr>
113
+ <td width="35" height="20"></td>
114
+ <td></td>
115
+ <td rowspan="3" width="35"></td>
116
+ </tr>
117
+ <tr>
118
+ <td></td>
119
+ <td>
120
+ <table border="0" cellspacing="0" cellpadding="0" width="100%">
121
+ <tbody>
122
+ <tr>
123
+ <td align="center" style="font-size: 14px; font-family: Arial;">
124
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php'; ?>
125
+ </td>
126
+ </tr>
127
+ </tbody>
128
+ </table>
129
+ </td>
130
+ </tr>
131
+ <tr>
132
+ <td height="20"></td>
133
+ <td></td>
134
+ </tr>
135
+ </tbody>
136
+ </table>
137
+ </td>
138
+ </tr>
139
+ <tr>
140
+ <td style="background-color: #000000;" height="2"></td>
141
+ </tr>
142
+ <tr>
143
+ <td style="background-color: #1b1c1e; font-size: 13px; color: #f4f4f4;" height="20" align="center">
144
+ To unsubscribe <a style="color: #ccc" href="{unsubscription_url}">click here</a>, to edit your profile
145
+ <a style="color: #ccc" href="{profile_url}">click here</a>.
146
+ </td>
147
+ </tr>
148
+ </tbody>
149
+ </table>
150
+ </td>
151
+ </tr>
152
+ </tbody>
153
+ </table>
154
+ </body>
155
+ </html>
emails/themes/theme-1/screenshot.png CHANGED
Binary file
emails/themes/theme-1/theme-options.php CHANGED
@@ -16,14 +16,13 @@
16
  */
17
  $theme_defaults = array(
18
  'theme_max_posts'=>10,
19
-
20
  'theme_categories'=>array()
21
  );
22
 
23
  // Mandatory!
24
  $controls->merge_defaults($theme_defaults);
25
  ?>
26
- <p>This theme build an email loading all new posts after the date of the last run.</p>
27
  <table class="form-table">
28
  <tr valign="top">
29
  <th>Max new posts to include</th>
@@ -32,21 +31,13 @@ $controls->merge_defaults($theme_defaults);
32
  </td>
33
  </tr>
34
  <tr valign="top">
35
- <th>Categories to include</th>
36
  <td>
37
- <?php
38
- $categories = get_categories();
39
- foreach ($categories as $c) {
40
- echo '<div class="nl-checkbox-group">';
41
- $controls->checkbox_group('theme_categories', $c->cat_ID, esc_html($c->cat_name));
42
- echo '</div>';
43
- }
44
- ?>
45
- <div style="clear: both"></div>
46
- <div class="hints">
47
- Leaving all categories unselected means to NOT filter by category.
48
- </div>
49
  </td>
50
  </tr>
51
  </table>
52
 
 
 
 
16
  */
17
  $theme_defaults = array(
18
  'theme_max_posts'=>10,
 
19
  'theme_categories'=>array()
20
  );
21
 
22
  // Mandatory!
23
  $controls->merge_defaults($theme_defaults);
24
  ?>
25
+
26
  <table class="form-table">
27
  <tr valign="top">
28
  <th>Max new posts to include</th>
31
  </td>
32
  </tr>
33
  <tr valign="top">
34
+ <th>Categories</th>
35
  <td>
36
+ <?php $controls->categories_group('theme_categories'); ?>
 
 
 
 
 
 
 
 
 
 
 
37
  </td>
38
  </tr>
39
  </table>
40
 
41
+ <h3>Social</h3>
42
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
43
+
emails/themes/theme-1/theme.php CHANGED
@@ -22,8 +22,9 @@ global $post; // Current post managed by WordPress
22
  $filters = array();
23
 
24
  // Maximum number of post to retrieve
25
- $filters['showposts'] = (int)$theme_options['theme_max_posts'];
26
- if ($filters['showposts'] == 0) $filters['showposts'] = 10;
 
27
 
28
 
29
  // Include only posts from specified categories. Do not filter per category is no
@@ -34,69 +35,76 @@ if (is_array($theme_options['theme_categories'])) {
34
 
35
  // Retrieve the posts asking them to WordPress
36
  $posts = get_posts($filters);
37
-
38
  ?>
39
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
40
  <html>
41
- <head>
42
- <title></title>
43
- </head>
44
 
45
- <body>
46
- <table bgcolor="#c0c0c0" width="100%" cellpadding="20" cellspacing="0" border="0">
47
- <tr>
48
- <td align="center">
49
- <table width="500" bgcolor="#ffffff" align="center" cellspacing="10" cellpadding="0" style="border: 1px solid #666;">
50
- <tr>
51
- <td style="font-size: 30px">
52
- <i><?php echo get_option('blogname'); ?></i>
53
- </td>
54
- </tr>
55
- <tr>
56
- <td style="border-top: 1px solid #eee; border-bottom: 1px solid #eee; font-size: 12px; color: #999">
57
- <br />NEWSLETTER<br /><br />
58
- </td>
59
- </tr>
60
- <tr>
61
- <td style="font-size: 14px; color: #666">
62
- <p>Dear {name}, here an update from <?php echo get_option('blogname'); ?>.</p>
63
- </td>
64
- </tr>
65
- <?php
66
- // Do not use &post, it leads to problems...
67
- foreach ($posts as $post) {
68
 
69
- // Setup the post (WordPress requirement)
70
- setup_postdata($post);
71
 
72
- // The theme can "suggest" a subject replacing the one configured, for example. In this case
73
- // the theme, is there is no subject, suggest the first post title.
74
- if (empty($theme_options['subject'])) $theme_options['subject'] = $post->post_title;
 
75
 
76
- // Extract a thumbnail, return null if no thumb can be found
77
- $image = nt_post_image(get_the_ID());
78
- ?>
79
- <tr>
80
- <td style="font-size: 14px; color: #666">
81
- <?php if ($image != null) { ?>
82
- <img src="<?php echo $image; ?>" alt="picture" align="left"/>
83
- <?php } ?>
84
- <p><a target="_tab" href="<?php echo get_permalink(); ?>" style="font-size: 16px; color: #000; text-decoration: none"><?php the_title(); ?></a></p>
85
 
86
- <?php the_excerpt(); ?>
87
- </td>
88
- </tr>
89
- <?php
90
- }
91
- ?>
92
- <tr>
93
- <td style="border-top: 1px solid #eee; border-bottom: 1px solid #eee; font-size: 12px; color: #999">
94
- You received this email because you subscribed for it as {email}. If you'd like, you can <a target="_tab" href="{unsubscription_url}">unsubscribe</a>.
95
- </td>
96
- </tr>
97
- </table>
98
- </td>
99
- </tr>
100
- </table>
101
- </body>
 
 
 
 
 
 
 
102
  </html>
22
  $filters = array();
23
 
24
  // Maximum number of post to retrieve
25
+ $filters['showposts'] = (int) $theme_options['theme_max_posts'];
26
+ if ($filters['showposts'] == 0)
27
+ $filters['showposts'] = 10;
28
 
29
 
30
  // Include only posts from specified categories. Do not filter per category is no
35
 
36
  // Retrieve the posts asking them to WordPress
37
  $posts = get_posts($filters);
 
38
  ?>
39
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
40
  <html>
41
+ <head>
42
+ <title></title>
43
+ </head>
44
 
45
+ <body>
46
+ <table bgcolor="#c0c0c0" width="100%" cellpadding="20" cellspacing="0" border="0">
47
+ <tr>
48
+ <td align="center">
49
+ <table width="500" bgcolor="#ffffff" align="center" cellspacing="10" cellpadding="0" style="border: 1px solid #666;">
50
+ <tr>
51
+ <td style="font-size: 30px">
52
+ <i><?php echo get_option('blogname'); ?></i>
53
+ </td>
54
+ </tr>
55
+ <tr>
56
+ <td style="border-top: 1px solid #eee; border-bottom: 1px solid #eee; font-size: 12px; color: #999">
57
+ <br />NEWSLETTER<br /><br />
58
+ </td>
59
+ </tr>
60
+ <tr>
61
+ <td style="font-size: 14px; color: #666">
62
+ <p>Dear {name}, here an update from <?php echo get_option('blogname'); ?>.</p>
63
+ </td>
64
+ </tr>
65
+ <?php
66
+ // Do not use &post, it leads to problems...
67
+ foreach ($posts as $post) {
68
 
69
+ // Setup the post (WordPress requirement)
70
+ setup_postdata($post);
71
 
72
+ // The theme can "suggest" a subject replacing the one configured, for example. In this case
73
+ // the theme, is there is no subject, suggest the first post title.
74
+ if (empty($theme_options['subject']))
75
+ $theme_options['subject'] = $post->post_title;
76
 
77
+ // Extract a thumbnail, return null if no thumb can be found
78
+ $image = nt_post_image(get_the_ID());
79
+ ?>
80
+ <tr>
81
+ <td style="font-size: 14px; color: #666">
82
+ <?php if ($image != null) { ?>
83
+ <img src="<?php echo $image; ?>" alt="picture" align="left"/>
84
+ <?php } ?>
85
+ <p><a target="_tab" href="<?php echo get_permalink(); ?>" style="font-size: 16px; color: #000; text-decoration: none"><?php the_title(); ?></a></p>
86
 
87
+ <?php the_excerpt(); ?>
88
+ </td>
89
+ </tr>
90
+ <?php
91
+ }
92
+ ?>
93
+ <?php if (!isset($theme_options['theme_social_disable'])) { ?>
94
+ <tr>
95
+ <td style="font-family: Arial; font-size: 12px">
96
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php'; ?>
97
+ </td>
98
+ </tr>
99
+ <?php } ?>
100
+ <tr>
101
+ <td style="border-top: 1px solid #eee; border-bottom: 1px solid #eee; font-size: 12px; color: #999">
102
+ You received this email because you subscribed for it as {email}. If you'd like, you can <a target="_tab" href="{unsubscription_url}">unsubscribe</a>.
103
+ </td>
104
+ </tr>
105
+ </table>
106
+ </td>
107
+ </tr>
108
+ </table>
109
+ </body>
110
  </html>
emails/themes/theme-3/screenshot.png CHANGED
Binary file
emails/themes/theme-3/theme-options.php CHANGED
@@ -32,21 +32,13 @@ $controls->merge_defaults($theme_defaults);
32
  </td>
33
  </tr>
34
  <tr valign="top">
35
- <th>Categories to include</th>
36
  <td>
37
- <?php
38
- $categories = get_categories();
39
- foreach ($categories as $c) {
40
- echo '<div class="nl-checkbox-group">';
41
- $controls->checkbox_group('theme_categories', $c->cat_ID, esc_html($c->cat_name));
42
- echo '</div>';
43
- }
44
- ?>
45
- <div style="clear: both"></div>
46
- <div class="hints">
47
- Leaving all categories unselected means to NOT filter by category.
48
- </div>
49
  </td>
50
  </tr>
51
  </table>
52
 
 
 
 
32
  </td>
33
  </tr>
34
  <tr valign="top">
35
+ <th>Categories</th>
36
  <td>
37
+ <?php $controls->categories_group('theme_categories'); ?>
 
 
 
 
 
 
 
 
 
 
 
38
  </td>
39
  </tr>
40
  </table>
41
 
42
+ <h3>Social</h3>
43
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
44
+
emails/themes/theme-3/theme-text.php ADDED
@@ -0,0 +1,46 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ global $newsletter; // Newsletter object
3
+ global $post; // Current post managed by WordPress
4
+
5
+ // This file is included inside a function so it inherit all the local variables.
6
+
7
+ // Since a theme has it's own options, it must check if there is new content to send
8
+ // out.
9
+ // Inside $theme_options['last_time'] there is the time stamps of the last run
10
+ // to be used to decide if we need to stop or not.
11
+
12
+ $filters = array();
13
+
14
+ $filters['showposts'] = (int)$theme_options['max_posts'];
15
+ if ($filters['showposts'] == 0) $filters['showposts'] = 10;
16
+
17
+ // This theme has an option with categories to be included.
18
+ if (is_array($theme_options['categories'])) {
19
+ $filters['cat'] = implode(',', $theme_options['categories']);
20
+ }
21
+
22
+ $posts = get_posts($filters);
23
+
24
+ // Retrieve the posts asking them to WordPress
25
+ $posts = get_posts($filters);
26
+
27
+ ?><?php echo $theme_options['theme_opening_text']; ?>
28
+
29
+ * <?php echo $theme_options['theme_title']; ?>
30
+
31
+
32
+ <?php
33
+ foreach ($posts as $post) {
34
+ // Setup the post (WordPress requirement)
35
+ setup_postdata($post);
36
+ ?>
37
+ <?php the_title(); ?>
38
+
39
+ <?php the_permalink(); ?>
40
+
41
+
42
+ <?php } ?>
43
+
44
+
45
+ <?php echo $theme_options['theme_footer_text']; ?>
46
+
emails/themes/theme-3/theme.php CHANGED
@@ -22,8 +22,9 @@ global $post; // Current post managed by WordPress
22
  $filters = array();
23
 
24
  // Maximum number of post to retrieve
25
- $filters['showposts'] = (int)$theme_options['theme_max_posts'];
26
- if ($filters['showposts'] == 0) $filters['showposts'] = 10;
 
27
 
28
 
29
  // Include only posts from specified categories. Do not filter per category is no
@@ -34,80 +35,87 @@ if (is_array($theme_options['theme_categories'])) {
34
 
35
  // Retrieve the posts asking them to WordPress
36
  $posts = get_posts($filters);
37
-
38
  ?>
39
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
40
  <html>
41
- <head>
42
- <title></title>
43
- </head>
44
-
45
- <body>
46
- <br />
47
-
48
- <table cellspacing="0" align="center" border="0" style="max-width:600px; width:600px; background-color: #eee;" cellpadding="0" width="600px">
49
- <!-- Header -->
50
- <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">
51
- <td height="80" width="600" style="color: #fff; font-size: 30px; font-family: Arial;" align="center" valign="middle">
52
- <?php echo get_option('blogname'); ?>
53
- </td>
54
- </tr>
55
- <tr style="background: #d0d0d0; height:20px;width:600px;">
56
- <td valign="top" height="20" width="600" bgcolor="#ffffff" align="center" style="font-family: Arial; font-size: 12px">
57
- <?php echo get_option('blogdescription'); ?>
58
- </td>
59
- </tr>
60
- <tr>
61
- <td>
62
- <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">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
63
  <tr>
64
- <td>
65
- <table cellpadding="0" cellspacing="0" border="0" bordercolor="" width="100%" bgcolor="#ffffff">
66
- <?php
67
- // Do not use &post, it leads to problems...
68
- foreach ($posts as $post) {
69
-
70
- // Setup the post (WordPress requirement)
71
- setup_postdata($post);
72
-
73
- // The theme can "suggest" a subject replacing the one configured, for example. In this case
74
- // the theme, is there is no subject, suggest the first post title.
75
- if (empty($theme_options['subject'])) $theme_options['subject'] = $post->post_title;
76
-
77
- // Extract a thumbnail, return null if no thumb can be found
78
- $image = nt_post_image(get_the_ID());
79
- ?>
80
- <tr>
81
- <td style="font-family: Arial; font-size: 12px">
82
- <?php if ($image != null) { ?>
83
- <img src="<?php echo $image; ?>" alt="picture" align="left" width="100" height="100" style="margin-right: 10px"/>
84
- <?php } ?>
85
- <a target="_tab" href="<?php echo get_permalink(); ?>" style="color: #000; text-decoration: none"><b><?php the_title(); ?></b></a><br />
86
-
87
- <?php the_excerpt(); ?>
88
- </td>
89
- </tr>
90
- <?php
91
- }
92
- ?>
93
- </table>
94
-
95
- </td>
96
- </tr>
97
- </table>
98
- </td>
99
- </tr>
100
- <tr>
101
- <td bgcolor="#ffffff" style="font-family: Arial; font-size: 12px">
102
-
103
- This email was sent to <b>{email}</b> because you opted in on <?php echo get_option('blogname'); ?> website.
104
- <br />
105
-
106
- <a target="_tab" href="{profile_url}">Manage Subscriptions</a> |
107
-
108
- <a target="_tab" href="{unsubscription_url}">Unsubscribe</a>
109
- </td>
110
- </tr>
111
- </table>
112
- </body>
113
  </html>
22
  $filters = array();
23
 
24
  // Maximum number of post to retrieve
25
+ $filters['showposts'] = (int) $theme_options['theme_max_posts'];
26
+ if ($filters['showposts'] == 0)
27
+ $filters['showposts'] = 10;
28
 
29
 
30
  // Include only posts from specified categories. Do not filter per category is no
35
 
36
  // Retrieve the posts asking them to WordPress
37
  $posts = get_posts($filters);
 
38
  ?>
39
  <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
40
  <html>
41
+ <head>
42
+ <title></title>
43
+ </head>
44
+
45
+ <body>
46
+ <br />
47
+
48
+ <table cellspacing="0" align="center" border="0" style="max-width:600px; width:600px; background-color: #eee;" cellpadding="0" width="600px">
49
+ <!-- Header -->
50
+ <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">
51
+ <td height="80" width="600" style="color: #fff; font-size: 30px; font-family: Arial;" align="center" valign="middle">
52
+ <?php echo get_option('blogname'); ?>
53
+ </td>
54
+ </tr>
55
+ <tr style="background: #d0d0d0; height:20px;width:600px;">
56
+ <td valign="top" height="20" width="600" bgcolor="#ffffff" align="center" style="font-family: Arial; font-size: 12px">
57
+ <?php echo get_option('blogdescription'); ?>
58
+ </td>
59
+ </tr>
60
+ <tr>
61
+ <td>
62
+ <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">
63
+ <tr>
64
+ <td>
65
+ <table cellpadding="0" cellspacing="0" border="0" bordercolor="" width="100%" bgcolor="#ffffff">
66
+ <?php
67
+ // Do not use &post, it leads to problems...
68
+ foreach ($posts as $post) {
69
+
70
+ // Setup the post (WordPress requirement)
71
+ setup_postdata($post);
72
+
73
+ // The theme can "suggest" a subject replacing the one configured, for example. In this case
74
+ // the theme, is there is no subject, suggest the first post title.
75
+ if (empty($theme_options['subject']))
76
+ $theme_options['subject'] = $post->post_title;
77
+
78
+ // Extract a thumbnail, return null if no thumb can be found
79
+ $image = nt_post_image(get_the_ID());
80
+ ?>
81
+ <tr>
82
+ <td style="font-family: Arial; font-size: 12px">
83
+ <?php if ($image != null) { ?>
84
+ <img src="<?php echo $image; ?>" alt="picture" align="left" width="100" height="100" style="margin-right: 10px"/>
85
+ <?php } ?>
86
+ <a target="_tab" href="<?php echo get_permalink(); ?>" style="color: #000; text-decoration: none"><b><?php the_title(); ?></b></a><br />
87
+
88
+ <?php the_excerpt(); ?>
89
+ </td>
90
+ </tr>
91
+ <?php
92
+ }
93
+ ?>
94
+ </table>
95
+
96
+ </td>
97
+ </tr>
98
+ </table>
99
+ </td>
100
+ </tr>
101
+ <?php if (!isset($theme_options['theme_social_disable'])) { ?>
102
  <tr>
103
+ <td style="font-family: Arial; font-size: 12px">
104
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php'; ?>
105
+ </td>
106
+ </tr>
107
+ <?php } ?>
108
+ <tr>
109
+ <td bgcolor="#ffffff" style="font-family: Arial; font-size: 12px">
110
+
111
+ This email was sent to <b>{email}</b> because you opted in on <?php echo get_option('blogname'); ?> website.
112
+ <br />
113
+
114
+ <a target="_tab" href="{profile_url}">Manage the subscription</a> |
115
+
116
+ <a target="_tab" href="{unsubscription_url}">Unsubscribe</a>
117
+ </td>
118
+ </tr>
119
+ </table>
120
+ </body>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
121
  </html>
emails/themes/vimeo-like/screenshot.png CHANGED
Binary file
emails/themes/vimeo-like/theme-options.php CHANGED
@@ -24,7 +24,7 @@ $theme_defaults = array(
24
  // Mandatory!
25
  $controls->merge_defaults($theme_defaults);
26
  ?>
27
- <p>This theme build an email loading all new posts after the date of the last run.</p>
28
  <table class="form-table">
29
  <tr valign="top">
30
  <th>Max new posts to include</th>
@@ -34,20 +34,7 @@ $controls->merge_defaults($theme_defaults);
34
  </tr>
35
  <tr valign="top">
36
  <th>Categories to include</th>
37
- <td>
38
- <?php
39
- $categories = get_categories();
40
- foreach ($categories as $c) {
41
- echo '<div class="nl-checkbox-group">';
42
- $controls->checkbox_group('theme_categories', $c->cat_ID, esc_html($c->cat_name));
43
- echo '</div>';
44
- }
45
- ?>
46
- <div style="clear: both"></div>
47
- <div class="hints">
48
- Leaving all categories unselected means to NOT filter by category.
49
- </div>
50
- </td>
51
  </tr>
52
  <tr valign="top">
53
  <th>Pre message</th>
@@ -62,3 +49,5 @@ $controls->merge_defaults($theme_defaults);
62
  </td>
63
  </tr>
64
  </table>
 
 
24
  // Mandatory!
25
  $controls->merge_defaults($theme_defaults);
26
  ?>
27
+
28
  <table class="form-table">
29
  <tr valign="top">
30
  <th>Max new posts to include</th>
34
  </tr>
35
  <tr valign="top">
36
  <th>Categories to include</th>
37
+ <td><?php $controls->categories_group('theme_categories'); ?></td>
 
 
 
 
 
 
 
 
 
 
 
 
 
38
  </tr>
39
  <tr valign="top">
40
  <th>Pre message</th>
49
  </td>
50
  </tr>
51
  </table>
52
+
53
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
emails/themes/vimeo-like/theme-text.php CHANGED
@@ -1,9 +1,8 @@
1
- This email can be seen only on rich text email client. To see it online visit:
2
 
3
- {email_url}
4
 
5
- To change your subscription visit:
6
 
7
- {profile_url}
8
-
9
- Thank you!
1
+ This email requires a modern e-mail reader. You can view the email online here:
2
 
3
+ {email_url}.
4
 
5
+ Thank you, <?php echo get_option('blogname'); ?>
6
 
7
+ To change your subscription follow:
8
+ {profile_url}.
 
emails/themes/vimeo-like/theme.php CHANGED
@@ -22,8 +22,9 @@ global $post; // Current post managed by WordPress
22
  $filters = array();
23
 
24
  // Maximum number of post to retrieve
25
- $filters['showposts'] = (int)$theme_options['theme_max_posts'];
26
- if ($filters['showposts'] == 0) $filters['showposts'] = 10;
 
27
 
28
 
29
  // Include only posts from specified categories. Do not filter per category is no
@@ -37,100 +38,110 @@ $posts = get_posts($filters);
37
 
38
  // Styles
39
  $color = $theme_options['theme_color'];
40
- if (empty($color)) $color = '#777';
 
41
 
42
  $font = $theme_options['theme_font'];
43
  $font_size = $theme_options['theme_font_size'];
44
-
45
  ?>
46
- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
47
  <html>
48
- <head>
49
- <title></title>
50
- <style>
51
- * {
52
- font-family: <?php echo $font; ?>;
53
- font-size: <?php echo $font_size; ?>;
54
- }
55
- </style>
56
- </head>
57
- <body>
58
-
59
- <table style="background:#ffffff" width="600" align="center" border="0" cellpadding="0" cellspacing="0">
60
-
61
- <tbody><tr><td style="color:#9ab;font:normal 11px helvetica,sans-serif;text-align:center;padding:10px 0 20px 0"><?php echo $theme_options['theme_pre_message']; ?></td></tr>
62
-
63
- <tr><td><img src="<?php echo $theme_url; ?>/bg_header_email.gif" alt=""></td></tr>
64
 
65
- <tr>
66
 
67
- <td style="border:1px dotted #e1e2e3;border-top:none;border-bottom:3px solid #e1e2e3;background:#ffffff">
 
 
68
 
 
 
 
69
 
 
70
 
71
- <table width="100%" align="center" border="0" cellpadding="20" cellspacing="0">
72
 
73
- <tbody><tr><td style="background:#ffffff">
74
 
75
 
 
76
 
77
- <p style="color:#456;font-family:arial,sans-serif;font-size:24px;line-height:1.2;margin:15px 0;padding:0"><a target="_tab" href="<?php echo get_option('home'); ?>" style="color:#28c;text-decoration:none" target="_blank"><?php echo get_option('blogname'); ?></a></p>
 
78
 
79
 
80
- <?php
81
- foreach ($posts as $post) {
82
- setup_postdata($post);
83
- $image = nt_post_image(get_the_ID());
84
- ?>
85
 
 
86
 
87
- <table style="width:100%;color:#456;font:normal 12px/1.5em helvetica,sans-serif;margin:15px 0 0 0;padding:0 0 15px 0;border-bottom:1px dotted #e1e2e3">
88
 
89
- <tbody><tr>
 
 
 
 
90
 
91
- <td style="width:100%;padding:0 10px 0 0;vertical-align:top">
92
 
93
- <p style="font-family:arial,sans-serif;color:#456;font-size:20px;line-height:22px;margin:0;padding:0"><strong><a target="_tab" href="<?php echo get_permalink(); ?>" style="color:#456;text-decoration:none" target="_blank"><?php the_title(); ?></a></strong></p>
94
 
95
- <p style="font-family:arial,sans-serif;line-height:1.5em;margin:15px 0;padding:0"><?php the_excerpt(); ?>. </p>
96
 
97
- </td>
98
 
99
- <td style="vertical-align:middle; width: 100px">
100
 
101
- <a target="_tab" href="<?php echo get_permalink(); ?>" target="_blank"><img src="<?php echo $image; ?>" alt="" width="100" border="0" height="100"></a>
102
 
103
- <p style="background:#2786c2;text-align:center;margin:10px 0 0 0;font-size:11px;line-height:14px;font-family:arial,sans-serif;padding:4px 2px;border-radius:4px"><a target="_tab" href="<?php echo get_permalink(); ?>" style="color:#fff;text-decoration:none" target="_blank"><strong><?php echo $theme_options['theme_read_more']; ?></strong></a></p>
104
 
105
- </td>
106
 
107
- </tr>
108
 
109
- </tbody></table>
110
-
111
- <br>
112
- <?php
113
- }
114
- ?>
115
 
 
116
 
 
117
 
 
118
 
119
- <br><br>
120
- <p style="color:#456;font-family:arial,sans-serif;font-size:12px;line-height:1.6em;font-style:italic;margin:0 0 15px 0;padding:0">
121
- Have a nice reading!</p>
 
122
 
123
- <p style="color:#456;font-family:arial,sans-serif;font-size:12px;line-height:1.6em;font-style:italic;margin:0 0 15px 0;padding:0">Good bye</p>
124
 
125
 
126
 
127
-
 
 
 
 
 
128
 
129
- </td></tr></tbody></table></td></tr></tbody></table>
130
-
131
-
132
-
 
 
 
 
 
 
 
 
133
 
134
- </body>
135
  </html>
136
 
22
  $filters = array();
23
 
24
  // Maximum number of post to retrieve
25
+ $filters['showposts'] = (int) $theme_options['theme_max_posts'];
26
+ if ($filters['showposts'] == 0)
27
+ $filters['showposts'] = 10;
28
 
29
 
30
  // Include only posts from specified categories. Do not filter per category is no
38
 
39
  // Styles
40
  $color = $theme_options['theme_color'];
41
+ if (empty($color))
42
+ $color = '#777';
43
 
44
  $font = $theme_options['theme_font'];
45
  $font_size = $theme_options['theme_font_size'];
 
46
  ?>
47
+ <!DOCTYPE html>
48
  <html>
49
+ <head>
50
+ <title></title>
51
+ <style>
52
+ * {
53
+ font-family: <?php echo $font; ?>;
54
+ font-size: <?php echo $font_size; ?>;
55
+ }
56
+ </style>
57
+ </head>
58
+ <body style="font:normal 11px helvetica,sans-serif;">
 
 
 
 
 
 
59
 
60
+ <table style="background:#ffffff" width="600" align="center" border="0" cellpadding="0" cellspacing="0">
61
 
62
+ <tr>
63
+ <td style="color:#9ab;font:normal 11px helvetica,sans-serif;text-align:center;padding:10px 0 20px 0"><?php echo $theme_options['theme_pre_message']; ?></td>
64
+ </tr>
65
 
66
+ <tr>
67
+ <td><img src="<?php echo $theme_url; ?>/bg_header_email.gif" alt=""></td>
68
+ </tr>
69
 
70
+ <tr>
71
 
72
+ <td style="border:1px dotted #e1e2e3;border-top:none;border-bottom:3px solid #e1e2e3;background:#ffffff">
73
 
 
74
 
75
 
76
+ <table width="100%" align="center" border="0" cellpadding="20" cellspacing="0">
77
 
78
+ <tr>
79
+ <td style="background:#ffffff">
80
 
81
 
 
 
 
 
 
82
 
83
+ <p style="color:#456;font-family:arial,sans-serif;font-size:24px;line-height:1.2;margin:15px 0;padding:0"><a target="_tab" href="<?php echo get_option('home'); ?>" style="color:#28c;text-decoration:none" target="_blank"><?php echo get_option('blogname'); ?></a></p>
84
 
 
85
 
86
+ <?php
87
+ foreach ($posts as $post) {
88
+ setup_postdata($post);
89
+ $image = nt_post_image(get_the_ID());
90
+ ?>
91
 
 
92
 
93
+ <table style="width:100%;color:#456;font:normal 12px/1.5em helvetica,sans-serif;margin:15px 0 0 0;padding:0 0 15px 0;border-bottom:1px dotted #e1e2e3">
94
 
95
+ <tbody><tr>
96
 
97
+ <td style="width:100%;padding:0 10px 0 0;vertical-align:top">
98
 
99
+ <p style="font-family:arial,sans-serif;color:#456;font-size:20px;line-height:22px;margin:0;padding:0"><strong><a target="_tab" href="<?php echo get_permalink(); ?>" style="color:#456;text-decoration:none" target="_blank"><?php the_title(); ?></a></strong></p>
100
 
101
+ <p style="font-family:arial,sans-serif;line-height:1.5em;margin:15px 0;padding:0"><?php the_excerpt(); ?>. </p>
102
 
103
+ </td>
104
 
105
+ <td style="vertical-align:middle; width: 100px">
106
 
107
+ <a target="_tab" href="<?php echo get_permalink(); ?>" target="_blank"><img src="<?php echo $image; ?>" alt="" width="100" border="0" height="100"></a>
108
 
109
+ <p style="background:#2786c2;text-align:center;margin:10px 0 0 0;font-size:11px;line-height:14px;font-family:arial,sans-serif;padding:4px 2px;border-radius:4px"><a target="_tab" href="<?php echo get_permalink(); ?>" style="color:#fff;text-decoration:none" target="_blank"><strong><?php echo $theme_options['theme_read_more']; ?></strong></a></p>
 
 
 
 
 
110
 
111
+ </td>
112
 
113
+ </tr>
114
 
115
+ </tbody></table>
116
 
117
+ <br>
118
+ <?php
119
+ }
120
+ ?>
121
 
 
122
 
123
 
124
 
125
+ <br><br>
126
+ <p style="color:#456;font-family:arial,sans-serif;font-size:12px;line-height:1.6em;font-style:italic;margin:0 0 15px 0;padding:0">
127
+ To change your subscription, <a target="_blank" href="{profile_url}">click here</a>.
128
+ </p>
129
+ </td>
130
+ </tr>
131
 
132
+ </table>
133
+ </td>
134
+ </tr>
135
+
136
+ <?php if (!isset($theme_options['theme_social_disable'])) { ?>
137
+ <tr>
138
+ <td style="font:normal 11px helvetica,sans-serif;">
139
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php'; ?>
140
+ </td>
141
+ </tr>
142
+ <?php } ?>
143
+ </table>
144
 
145
+ </body>
146
  </html>
147
 
header.php CHANGED
@@ -11,7 +11,9 @@ if (isset($_REQUEST['dismiss']) && check_admin_referer()) {
11
  <div id="newsletter-header">
12
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-documentation" target="_blank">Documentation</a>
13
  <a href="http://www.satollo.net/forums" target="_blank">Forum</a>
 
14
  <a href="http://www.satollo.net/plugins/newsletter" target="_blank">Extend it now!</a>
 
15
  <!--<a href="http://www.satollo.net/plugins/newsletter/newsletter-collaboration" target="_blank">Collaboration</a>-->
16
 
17
  <form style="display: inline; margin: 0;" action="http://www.satollo.net/wp-content/plugins/newsletter/do/subscribe.php" method="post" target="_blank">
@@ -21,8 +23,10 @@ if (isset($_REQUEST['dismiss']) && check_admin_referer()) {
21
 
22
  <a href="https://www.facebook.com/satollo.net" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/facebook.png"></a>
23
 
 
24
  <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Y6JXSA7BSU2L" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/donate.png"></a>
25
- <a href="http://www.satollo.net/donations" target="_blank">Even <b>1$</b> helps: why?</a>
 
26
  <!--
27
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-delivery-engine" target="_blank">Engine next run in <?php echo wp_next_scheduled('newsletter') - time(); ?> s</a>
28
  -->
11
  <div id="newsletter-header">
12
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-documentation" target="_blank">Documentation</a>
13
  <a href="http://www.satollo.net/forums" target="_blank">Forum</a>
14
+ <?php if (!$header_is_extension) { ?>
15
  <a href="http://www.satollo.net/plugins/newsletter" target="_blank">Extend it now!</a>
16
+ <?php } ?>
17
  <!--<a href="http://www.satollo.net/plugins/newsletter/newsletter-collaboration" target="_blank">Collaboration</a>-->
18
 
19
  <form style="display: inline; margin: 0;" action="http://www.satollo.net/wp-content/plugins/newsletter/do/subscribe.php" method="post" target="_blank">
23
 
24
  <a href="https://www.facebook.com/satollo.net" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/facebook.png"></a>
25
 
26
+ <?php if (!$header_is_extension) { ?>
27
  <a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=5Y6JXSA7BSU2L" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/donate.png"></a>
28
+ <a href="http://www.satollo.net/donations" target="_blank">Even <b>2$</b> help: why?</a>
29
+ <?php } ?>
30
  <!--
31
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-delivery-engine" target="_blank">Engine next run in <?php echo wp_next_scheduled('newsletter') - time(); ?> s</a>
32
  -->
includes/controls.php CHANGED
@@ -605,7 +605,12 @@ class NewsletterControls {
605
  jQuery("textarea.dynamic").css("height", "50px");
606
  jQuery(this).css("height", "400px");
607
  });
608
- tabs = jQuery("#tabs").tabs({ cookie: { expires: 30 } });
 
 
 
 
 
609
  });
610
  </script>
611
  ';
@@ -656,6 +661,47 @@ class NewsletterControls {
656
  function get_test_subscribers() {
657
  return NewsletterUsers::instance()->get_test_users();
658
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
659
 
660
  }
661
 
605
  jQuery("textarea.dynamic").css("height", "50px");
606
  jQuery(this).css("height", "400px");
607
  });
608
+ tabs = jQuery("#tabs").tabs({
609
+ active : jQuery.cookie("newsletter_tab"),
610
+ activate : function( event, ui ){
611
+ jQuery.cookie("newsletter_tab", ui.newTab.index(),{expires: 1});
612
+ }
613
+ });
614
  });
615
  </script>
616
  ';
661
  function get_test_subscribers() {
662
  return NewsletterUsers::instance()->get_test_users();
663
  }
664
+
665
+ function css_font_size($name) {
666
+ $value = $this->get_value($name);
667
+
668
+ echo '<select id="options-' . $name . '" name="options[' . $name . ']">';
669
+ for ($i=8; $i<50; $i++) {
670
+ echo '<option value="' . $i . '"';
671
+ if ($value == $i)
672
+ echo ' selected';
673
+ echo '>' . $i . '</option>';
674
+ }
675
+ echo '</select>&nbsp;px';
676
+ }
677
+
678
+ function css_border($name) {
679
+ $value = $this->get_value($name . '_width');
680
+
681
+ echo 'width&nbsp;<select id="options-' . $name . '-width" name="options[' . $name . '_width]">';
682
+ for ($i=0; $i<10; $i++) {
683
+ echo '<option value="' . $i . '"';
684
+ if ($value == $i)
685
+ echo ' selected';
686
+ echo '>' . $i . '</option>';
687
+ }
688
+ echo '</select>&nbsp;px&nbsp;&nbsp;';
689
+
690
+ $this->select($name . '_type', array('solid'=>'Solid', 'dashed'=>'Dashed'));
691
+
692
+ $this->color($name . '_color');
693
+
694
+ $value = $this->get_value($name . '_radius');
695
+
696
+ echo '&nbsp;&nbsp;radius&nbsp;<select id="options-' . $name . '-radius" name="options[' . $name . '_radius]">';
697
+ for ($i=0; $i<10; $i++) {
698
+ echo '<option value="' . $i . '"';
699
+ if ($value == $i)
700
+ echo ' selected';
701
+ echo '>' . $i . '</option>';
702
+ }
703
+ echo '</select>&nbsp;px';
704
+ }
705
 
706
  }
707
 
includes/module.php CHANGED
@@ -165,7 +165,7 @@ class NewsletterModule {
165
  @include WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/languages/' . $sub . 'en_US.php';
166
  @include NEWSLETTER_DIR . '/' . $this->module . '/languages/' . $sub . WPLANG . '.php';
167
  @include WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/languages/' . $sub . WPLANG . '.php';
168
- if (!is_array($options)) {
169
  return array();
170
  }
171
  return $options;
@@ -610,10 +610,12 @@ class NewsletterModule {
610
  $user = (array) $user;
611
  if (empty($user['id'])) {
612
  $existing = $this->get_user($user['email']);
613
- if ($existing != null)
614
  return false;
615
- if (empty($user['token']))
 
616
  $user['token'] = NewsletterModule::get_token();
 
617
  //if (empty($user['created'])) $user['created'] = time();
618
  // Database default
619
  //if (empty($user['status'])) $user['status'] = 'S';
165
  @include WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/languages/' . $sub . 'en_US.php';
166
  @include NEWSLETTER_DIR . '/' . $this->module . '/languages/' . $sub . WPLANG . '.php';
167
  @include WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/languages/' . $sub . WPLANG . '.php';
168
+ if (!isset($options) || !is_array($options)) {
169
  return array();
170
  }
171
  return $options;
610
  $user = (array) $user;
611
  if (empty($user['id'])) {
612
  $existing = $this->get_user($user['email']);
613
+ if ($existing != null) {
614
  return false;
615
+ }
616
+ if (empty($user['token'])) {
617
  $user['token'] = NewsletterModule::get_token();
618
+ }
619
  //if (empty($user['created'])) $user['created'] = time();
620
  // Database default
621
  //if (empty($user['status'])) $user['status'] = 'S';
includes/store.php CHANGED
@@ -103,16 +103,24 @@ class NewsletterStore {
103
  if (isset($data['id'])) {
104
  $id = $data['id'];
105
  unset($data['id']);
106
- $wpdb->update($table, $data, array('id' => $id));
 
 
 
 
107
  //$this->logger->debug('save: ' . $wpdb->last_query);
108
  } else {
109
- $wpdb->insert($table, $data);
 
 
 
 
110
  $id = $wpdb->insert_id;
111
  }
112
- if ($wpdb->last_error) {
113
- $this->logger->error('save: ' . $wpdb->last_error);
114
- return false;
115
- }
116
 
117
  return $this->get_single($table, $id, $return_format);
118
  }
103
  if (isset($data['id'])) {
104
  $id = $data['id'];
105
  unset($data['id']);
106
+ $r = $wpdb->update($table, $data, array('id' => $id));
107
+ if ($r === false) {
108
+ $this->logger->fatal($wpdb->last_error);
109
+ die('Database error.');
110
+ }
111
  //$this->logger->debug('save: ' . $wpdb->last_query);
112
  } else {
113
+ $r = $wpdb->insert($table, $data);
114
+ if ($r === false) {
115
+ $this->logger->fatal($wpdb->last_error);
116
+ die('Database error.');
117
+ }
118
  $id = $wpdb->insert_id;
119
  }
120
+ // if ($wpdb->last_error) {
121
+ // $this->logger->error('save: ' . $wpdb->last_error);
122
+ // return false;
123
+ // }
124
 
125
  return $this->get_single($table, $id, $return_format);
126
  }
main/diagnostic.php CHANGED
@@ -63,7 +63,7 @@ if ($controls->is_action('test_wp')) {
63
  if ($r) {
64
  $controls->messages .= 'Direct WordPress email sent<br />';
65
  } else {
66
- $controls->errors .= 'Direct WordPress email NOT sent: ask your provider if your web space is enabled to send emails.<br />';
67
  }
68
  }
69
 
63
  if ($r) {
64
  $controls->messages .= 'Direct WordPress email sent<br />';
65
  } else {
66
+ $controls->errors .= 'Direct WordPress email NOT sent: <strong>ask now your provider</strong> to know if you can send emails from your blog or not..<br>';
67
  }
68
  }
69
 
main/languages/en_US.php CHANGED
@@ -11,6 +11,7 @@ $options = array(
11
  'sender_email'=>'newsletter@' . $sitename,
12
  'sender_name'=>get_option('blogname'),
13
  'editor' => 0,
 
14
  'lock_message'=>'<p>This content is protected, only newsletter subscribers can access it. Subscribe now!</p>
15
  {subscription_form}'
16
  );
11
  'sender_email'=>'newsletter@' . $sitename,
12
  'sender_name'=>get_option('blogname'),
13
  'editor' => 0,
14
+ 'scheduler_max' => 100,
15
  'lock_message'=>'<p>This content is protected, only newsletter subscribers can access it. Subscribe now!</p>
16
  {subscription_form}'
17
  );
main/main.php CHANGED
@@ -32,6 +32,10 @@ if (!$controls->is_action()) {
32
  $controls->errors .= 'Return path email is not correct.<br />';
33
  }
34
 
 
 
 
 
35
  //$controls->data['test_email'] = $newsletter->normalize_email($controls->data['test_email']);
36
  //if (!$newsletter->is_email($controls->data['test_email'], true)) {
37
  // $controls->errors .= 'Test email is not correct.<br />';
@@ -61,13 +65,16 @@ if (!$controls->is_action()) {
61
  $mail->Body = $message;
62
  $mail->From = $controls->data['sender_email'];
63
  $mail->FromName = $controls->data['sender_name'];
64
- if (!empty($controls->data['return_path'])) $mail->Sender = $options['return_path'];
65
- if (!empty($controls->data['reply_to'])) $mail->AddReplyTo($controls->data['reply_to']);
 
 
66
 
67
  $mail->Subject = '[' . get_option('blogname') . '] SMTP test';
68
 
69
  $mail->Host = $controls->data['smtp_host'];
70
- if (!empty($controls->data['smtp_port'])) $mail->Port = (int) $controls->data['smtp_port'];
 
71
 
72
  $mail->SMTPSecure = $controls->data['smtp_secure'];
73
 
@@ -85,8 +92,12 @@ if (!$controls->is_action()) {
85
  $mail->SmtpClose();
86
  $debug = htmlspecialchars(ob_get_clean());
87
 
88
- if ($mail->IsError()) $controls->errors = $mail->ErrorInfo;
89
- else $controls->messages = 'Success.';
 
 
 
 
90
 
91
  $controls->messages .= '<textarea style="width:100%;height:250px;font-size:10px">';
92
  $controls->messages .= $debug;
@@ -104,34 +115,39 @@ if (!$controls->is_action()) {
104
 
105
  <?php $controls->show(); ?>
106
 
 
107
  <div class="preamble">
108
- <p>
109
- Do not be scared by all those configurations. Only <strong>basic settings</strong> are important and should be reviewed to
110
- make Newsletter plugin work correctly. If something doesn't work, run a test from
111
- <a href="admin.php?page=newsletter_main_diagnostic">diagnostic panel</a>.
112
- </p>
113
  </div>
114
-
 
115
  <form method="post" action="">
116
  <?php $controls->init(); ?>
117
 
118
  <div id="tabs">
119
 
120
  <ul>
121
- <li><a href="#tabs-1">Basic settings</a></li>
 
122
  <li><a href="#tabs-2">Advanced settings</a></li>
123
  <li><a href="#tabs-5">SMTP</a></li>
124
  <li><a href="#tabs-3">Content locking</a></li>
125
  </ul>
126
 
127
- <div id="tabs-1">
128
 
129
- <!-- Main settings -->
130
  <div class="tab-preamble">
131
- <p>
132
- </p>
 
 
 
133
  </div>
134
-
135
  <table class="form-table">
136
 
137
  <tr valign="top">
@@ -140,34 +156,25 @@ if (!$controls->is_action()) {
140
  <?php $controls->text_email('sender_email', 40); ?> (valid email address)
141
 
142
  <div class="hints">
143
- Insert here the email address from which subscribers will se your email coming. Since this setting can
144
  affect the reliability of delivery,
145
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-configuration#sender" target="_blank">read my notes here</a> (important).
146
  Generally use an address within your domain name.
147
  </div>
148
  </td>
149
  </tr>
 
150
  <th>Sender name</th>
151
  <td>
152
  <?php $controls->text('sender_name', 40); ?> (optional)
153
 
154
  <div class="hints">
155
- Insert here the name which subscribers will see as the sender of your email (for example your blog or website's name). Since this setting can affect the reliability of delivery (usually under Windows)
156
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-configuration#sender" target="_blank">read my notes here</a>.
157
  </div>
158
  </td>
159
  </tr>
160
- <tr valign="top">
161
- <th>Max emails per hour</th>
162
- <td>
163
- <?php $controls->text('scheduler_max', 5); ?>
164
- <div class="hints">
165
- Newsletter delivery engine respects this limit and it should be set to a value less than the maximum allowed by your provider
166
- (Hostgator: 500 per hour, Dreamhost: 100 per hour, Go Daddy: 1000 per day using their SMTP, Gmail: 500 per day).
167
- Read <a href="http://www.satollo.net/plugins/newsletter/newsletter-delivery-engine" target="_blank">more on delivery engine</a> (important).
168
- </div>
169
- </td>
170
- </tr>
171
  <tr valign="top">
172
  <th>Return path</th>
173
  <td>
@@ -195,14 +202,47 @@ if (!$controls->is_action()) {
195
  </table>
196
  </div>
197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
198
  <div id="tabs-2">
199
 
200
- <!-- General parameters -->
 
 
 
 
201
 
202
  <table class="form-table">
203
 
204
  <tr valign="top">
205
- <th>Enable access to editors?</th>
206
  <td>
207
  <?php $controls->yesno('editor'); ?>
208
  </td>
@@ -220,7 +260,7 @@ if (!$controls->is_action()) {
220
  </tr>
221
 
222
  <tr>
223
- <th>Styling</th>
224
  <td>
225
  <?php $controls->textarea('css'); ?>
226
  <div class="hints">
@@ -240,7 +280,16 @@ if (!$controls->is_action()) {
240
  </div>
241
  </td>
242
  </tr>
243
-
 
 
 
 
 
 
 
 
 
244
  </table>
245
 
246
  </div>
@@ -250,25 +299,23 @@ if (!$controls->is_action()) {
250
  <div class="tab-preamble">
251
  <p>
252
  <strong>These options can be overridden by modules which integrates with external
253
- SMTPs (like MailJet, SendGrid, ...) if installed and activated.</strong>
 
 
 
 
 
 
 
 
 
 
254
  </p>
255
- <p>
256
- To use an external SMTP (mail sending service), fill in the SMTP data and activate it. SMTP will be used for any
257
- messages sent by Newsletter (subscription messages and newsletters). SMTP is required to send email with Gmail or
258
- GoDaddy hosting account.
259
- Read more <a href="http://www.satollo.net/godaddy-using-smtp-external-server-on-shared-hosting" target="_blank">here</a>.
260
- The "test" button below sends an email to the first test address configured above and works even if SMTP is not enabled. If you get a "connection refused"
261
- message, check the SMTP settings if they are correct, then contact your hosting provider. If you get a "relay denied" contact your
262
- SMTP service provider.
263
- </p>
264
- <p>
265
- Consider <a href="http://www.satollo.net/affiliate/sendgrid" target="_blank">SendGrid</a> for a serious and reliable SMTP service.
266
- </p>
267
  </div>
268
 
269
  <table class="form-table">
270
  <tr>
271
- <th>Enable external SMTP?</th>
272
  <td><?php $controls->yesno('smtp_enabled'); ?></td>
273
  </tr>
274
  <tr>
@@ -296,14 +343,16 @@ if (!$controls->is_action()) {
296
  <tr>
297
  <th>Test email address</th>
298
  <td>
299
- <?php $controls->text('smtp_test_email', 30); ?>
 
300
  <div class="hints">
301
- SMTP test will be addressed to this email
 
302
  </div>
303
  </td>
304
  </tr>
305
  </table>
306
- <?php $controls->button('smtp_test', 'Test'); ?>
307
 
308
  </div>
309
 
@@ -340,10 +389,8 @@ if (!$controls->is_action()) {
340
  <tr valign="top">
341
  <th>Denied content message</th>
342
  <td>
343
- <?php $controls->textarea('lock_message'); ?>
344
- <?php wp_editor( $controls->data['lock_message'], 'lock_message', array('textarea_name'=>'options[lock_message]') ); ?>
345
 
346
- <?php //$controls->textarea('lock_message'); ?>
347
  <div class="hints">
348
  This message is shown in place of protected post or page content which is surrounded with
349
  [newsletter_lock] and [/newsletter_lock] short codes or in place of the full content if they are
32
  $controls->errors .= 'Return path email is not correct.<br />';
33
  }
34
 
35
+ $controls->data['php_time_limit'] = (int) $controls->data['php_time_limit'];
36
+ if ($controls->data['php_time_limit'] == 0)
37
+ unset($controls->data['php_time_limit']);
38
+
39
  //$controls->data['test_email'] = $newsletter->normalize_email($controls->data['test_email']);
40
  //if (!$newsletter->is_email($controls->data['test_email'], true)) {
41
  // $controls->errors .= 'Test email is not correct.<br />';
65
  $mail->Body = $message;
66
  $mail->From = $controls->data['sender_email'];
67
  $mail->FromName = $controls->data['sender_name'];
68
+ if (!empty($controls->data['return_path']))
69
+ $mail->Sender = $options['return_path'];
70
+ if (!empty($controls->data['reply_to']))
71
+ $mail->AddReplyTo($controls->data['reply_to']);
72
 
73
  $mail->Subject = '[' . get_option('blogname') . '] SMTP test';
74
 
75
  $mail->Host = $controls->data['smtp_host'];
76
+ if (!empty($controls->data['smtp_port']))
77
+ $mail->Port = (int) $controls->data['smtp_port'];
78
 
79
  $mail->SMTPSecure = $controls->data['smtp_secure'];
80
 
92
  $mail->SmtpClose();
93
  $debug = htmlspecialchars(ob_get_clean());
94
 
95
+ if ($mail->IsError()) {
96
+ $controls->errors = '<strong>Connection/email delivery failed.</strong><br>You should contact your provider reporting the SMTP parameter and asking about connection to that SMTP.<br><br>';
97
+ $controls->errors = $mail->ErrorInfo;
98
+ }
99
+ else
100
+ $controls->messages = 'Success.';
101
 
102
  $controls->messages .= '<textarea style="width:100%;height:250px;font-size:10px">';
103
  $controls->messages .= $debug;
115
 
116
  <?php $controls->show(); ?>
117
 
118
+ <!--
119
  <div class="preamble">
120
+ <p>
121
+ Do not be scared by all those configurations. Only <strong>basic settings</strong> are important and should be reviewed to
122
+ make Newsletter plugin work correctly. If something doesn't work, run a test from
123
+ <a href="admin.php?page=newsletter_main_diagnostic">diagnostic panel</a>.
124
+ </p>
125
  </div>
126
+ -->
127
+
128
  <form method="post" action="">
129
  <?php $controls->init(); ?>
130
 
131
  <div id="tabs">
132
 
133
  <ul>
134
+ <li><a href="#tabs-basic">Basic settings</a></li>
135
+ <li><a href="#tabs-speed">Delivery speed</a></li>
136
  <li><a href="#tabs-2">Advanced settings</a></li>
137
  <li><a href="#tabs-5">SMTP</a></li>
138
  <li><a href="#tabs-3">Content locking</a></li>
139
  </ul>
140
 
141
+ <div id="tabs-basic">
142
 
 
143
  <div class="tab-preamble">
144
+ <p>
145
+ <strong>Important!</strong>
146
+ <a href="http://www.satollo.net/plugins/newsletter/newsletter-configuration" target="_blank">Read the configuration page</a>
147
+ to know every details about these settings.
148
+ </p>
149
  </div>
150
+
151
  <table class="form-table">
152
 
153
  <tr valign="top">
156
  <?php $controls->text_email('sender_email', 40); ?> (valid email address)
157
 
158
  <div class="hints">
159
+ This the email address from which subscribers will se your email coming. Since this setting can
160
  affect the reliability of delivery,
161
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-configuration#sender" target="_blank">read my notes here</a> (important).
162
  Generally use an address within your domain name.
163
  </div>
164
  </td>
165
  </tr>
166
+ <tr>
167
  <th>Sender name</th>
168
  <td>
169
  <?php $controls->text('sender_name', 40); ?> (optional)
170
 
171
  <div class="hints">
172
+ Insert here the name which subscribers will see as the sender of your email (for example your blog name). Since this setting can affect the reliability of delivery (usually under Windows)
173
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-configuration#sender" target="_blank">read my notes here</a>.
174
  </div>
175
  </td>
176
  </tr>
177
+
 
 
 
 
 
 
 
 
 
 
178
  <tr valign="top">
179
  <th>Return path</th>
180
  <td>
202
  </table>
203
  </div>
204
 
205
+ <div id="tabs-speed">
206
+ <div class="tab-preamble">
207
+ <p>
208
+ You can set the speed of the email delivery as <strong>emails per hour</strong>. The delivery engine
209
+ runs every <strong>5 minutes</strong> and sends a limited number of email to keep the sending rate
210
+ below the specified limit. For example if you set 120 emails per hour the delivery engine will
211
+ send at most 10 emails per run.
212
+ </p>
213
+ <p>
214
+ <strong>Important!</strong> Read the
215
+ <a href="http://www.satollo.net/plugins/newsletter/newsletter-delivery-engine" target="_blank">delivery engine page</a>
216
+ to solve speed problems and find blog setup examples to make it work at the best.
217
+ </p>
218
+ </div>
219
+ <table class="form-table">
220
+ <tr>
221
+ <th>Max emails per hour</th>
222
+ <td>
223
+ <?php $controls->text('scheduler_max', 5); ?>
224
+ <div class="hints">
225
+ Newsletter delivery engine respects this limit and it should be set to a value less than the maximum allowed by your provider
226
+ (Hostgator: 500 per hour, Dreamhost: 100 per hour, Go Daddy: 1000 per day using their SMTP, Gmail: 500 per day).
227
+ Read <a href="http://www.satollo.net/plugins/newsletter/newsletter-delivery-engine" target="_blank">more on delivery engine</a> (important).
228
+ </div>
229
+ </td>
230
+ </tr>
231
+ </table>
232
+ </div>
233
+
234
  <div id="tabs-2">
235
 
236
+ <div class="tab-preamble">
237
+ <p>
238
+ Every setting is explained <a href="http://www.satollo.net/plugins/newsletter/newsletter-configuration#advanced" target="_blank">here</a>.
239
+ </p>
240
+ </div>
241
 
242
  <table class="form-table">
243
 
244
  <tr valign="top">
245
+ <th>Enable access to blog editors?</th>
246
  <td>
247
  <?php $controls->yesno('editor'); ?>
248
  </td>
260
  </tr>
261
 
262
  <tr>
263
+ <th>Custom CSS</th>
264
  <td>
265
  <?php $controls->textarea('css'); ?>
266
  <div class="hints">
280
  </div>
281
  </td>
282
  </tr>
283
+ <tr valign="top">
284
+ <th>PHP max execution time</th>
285
+ <td>
286
+ <?php $controls->text('php_time_limit', 10); ?>
287
+ (before write in something, <a href="http://www.satollo.net/plugins/newsletter/newsletter-configuration#advanced" target="_blank">read here</a>)
288
+ <div class="hints">
289
+ Sets the PHP max execution time in seconds, overriding the default of your server.
290
+ </div>
291
+ </td>
292
+ </tr>
293
  </table>
294
 
295
  </div>
299
  <div class="tab-preamble">
300
  <p>
301
  <strong>These options can be overridden by modules which integrates with external
302
+ SMTPs (like MailJet, SendGrid, ...) if installed and activated.</strong>
303
+ </p>
304
+ <p>
305
+
306
+ What you need to know to use and external SMTP can be found
307
+ <a href="http://www.satollo.net/plugins/newsletter/newsletter-configuration#smtp" target="_blank">here</a>.
308
+ <br>
309
+ On GoDaddy you should follow this <a href="http://www.satollo.net/godaddy-using-smtp-external-server-on-shared-hosting" target="_blank">special setup</a>.
310
+ </p>
311
+ <p>
312
+ Consider <a href="http://www.satollo.net/affiliate/sendgrid" target="_blank">SendGrid</a> for a serious and reliable SMTP service.
313
  </p>
 
 
 
 
 
 
 
 
 
 
 
 
314
  </div>
315
 
316
  <table class="form-table">
317
  <tr>
318
+ <th>Enable the SMTP?</th>
319
  <td><?php $controls->yesno('smtp_enabled'); ?></td>
320
  </tr>
321
  <tr>
343
  <tr>
344
  <th>Test email address</th>
345
  <td>
346
+ <?php $controls->text_email('smtp_test_email', 30); ?>
347
+ <?php $controls->button('smtp_test', 'Send a test email to this address'); ?>
348
  <div class="hints">
349
+ If the test reports a "connection failed", review your settings and, if correct, contact
350
+ your provider to unlock the connection (if possible).
351
  </div>
352
  </td>
353
  </tr>
354
  </table>
355
+
356
 
357
  </div>
358
 
389
  <tr valign="top">
390
  <th>Denied content message</th>
391
  <td>
392
+ <?php wp_editor($controls->data['lock_message'], 'lock_message', array('textarea_name' => 'options[lock_message]')); ?>
 
393
 
 
394
  <div class="hints">
395
  This message is shown in place of protected post or page content which is surrounded with
396
  [newsletter_lock] and [/newsletter_lock] short codes or in place of the full content if they are
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: http://www.satollo.net/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="http://www.satollo.net/plugins/newsletter#update">this page</a> to know what's changed.</strong>
7
- Version: 3.4.2
8
  Author: Stefano Lissa
9
  Author URI: http://www.satollo.net
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -13,7 +13,7 @@
13
  */
14
 
15
  // Useed as dummy parameter on css and js links
16
- define('NEWSLETTER_VERSION', '3.4.2');
17
 
18
  global $wpdb, $newsletter;
19
 
@@ -75,6 +75,7 @@ require_once NEWSLETTER_INCLUDES_DIR . '/themes.php';
75
  class Newsletter extends NewsletterModule {
76
 
77
  // Limits to respect to avoid memory, time or provider limits
 
78
  var $time_limit;
79
  var $email_limit = 10; // Per run, every 5 minutes
80
  var $limits_set = false;
@@ -108,25 +109,15 @@ class Newsletter extends NewsletterModule {
108
  }
109
 
110
  function __construct() {
111
- // Early possible
112
- if (defined('NEWSLETTER_MAX_EXECUTION_TIME')) {
113
- $max_time = NEWSLETTER_MAX_EXECUTION_TIME * 0.9;
114
- @set_time_limit(NEWSLETTER_MAX_EXECUTION_TIME);
115
- } else {
116
- $max_time = (int) (@ini_get('max_execution_time') * 0.9);
117
- }
118
-
119
- if ($max_time == 0) {
120
- $max_time = 60;
121
- }
122
-
123
- $this->time_limit = time() + $max_time;
124
 
 
 
 
125
  // Here because the upgrade is called by the parent constructor and uses the scheduler
126
  add_filter('cron_schedules', array($this, 'hook_cron_schedules'), 1000);
127
 
128
- parent::__construct('main', '1.1.8');
129
-
130
  $max = $this->options['scheduler_max'];
131
  if (!is_numeric($max))
132
  $max = 100;
@@ -157,6 +148,11 @@ class Newsletter extends NewsletterModule {
157
 
158
  if (is_admin()) {
159
  add_action('admin_head', array($this, 'hook_admin_head'));
 
 
 
 
 
160
  }
161
  }
162
 
@@ -165,8 +161,7 @@ class Newsletter extends NewsletterModule {
165
  // the every-five-minutes schedule named "newsletter" is not present.
166
  // Since the activation does not forces an upgrade, that schedule must be reactivated here. It is activated on
167
  // the upgrade method as well for the user which upgrade the plugin without deactivte it (many).
168
- $time = wp_next_scheduled('newsletter');
169
- if ($time === false) {
170
  wp_schedule_event(time() + 30, 'newsletter', 'newsletter');
171
  }
172
  }
@@ -241,8 +236,12 @@ class Newsletter extends NewsletterModule {
241
  wp_mkdir_p(WP_CONTENT_DIR . '/extensions/newsletter');
242
  wp_mkdir_p(WP_CONTENT_DIR . '/cache/newsletter');
243
 
244
- wp_clear_scheduled_hook('newsletter_updates_run');
245
  wp_clear_scheduled_hook('newsletter_statistics_version_check');
 
 
 
 
246
 
247
  return true;
248
  }
@@ -373,7 +372,7 @@ class Newsletter extends NewsletterModule {
373
  function hook_newsletter() {
374
  global $wpdb;
375
 
376
- $this->logger->debug('hook_newsletter> Starting');
377
 
378
  // Do not accept job activation before at least 4 minutes are elapsed from the last run.
379
  if (!$this->check_transient('engine', NEWSLETTER_CRON_INTERVAL))
@@ -389,6 +388,8 @@ class Newsletter extends NewsletterModule {
389
  }
390
  // Remove the semaphore so the delivery engine can be activated again
391
  $this->delete_transient('engine');
 
 
392
  }
393
 
394
  /**
@@ -437,6 +438,7 @@ class Newsletter extends NewsletterModule {
437
  return false;
438
 
439
  $headers = array('List-Unsubscribe' => '<' . NEWSLETTER_UNSUBSCRIBE_URL . '?nk=' . $user->id . '-' . $user->token . '>');
 
440
 
441
  if (!$test) {
442
  $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set sent=sent+1, last_id=" . $user->id . " where id=" . $email->id . " limit 1");
@@ -483,6 +485,7 @@ class Newsletter extends NewsletterModule {
483
 
484
  return ob_get_clean();
485
  }
 
486
 
487
  /**
488
  * This function checks is, during processing, we are getting to near to system limits and should stop any further
@@ -493,6 +496,24 @@ class Newsletter extends NewsletterModule {
493
 
494
  if (!$this->limits_set) {
495
  $this->logger->debug('limits_exceeded> Setting the limits for the first time');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
496
  $max = $this->options['scheduler_max'];
497
  if (!is_numeric($max))
498
  $max = 100;
@@ -804,6 +825,16 @@ class Newsletter extends NewsletterModule {
804
 
805
 
806
  $text = str_replace('{surname}', $user->surname, $text);
 
 
 
 
 
 
 
 
 
 
807
  $text = str_replace('{token}', $user->token, $text);
808
  $text = str_replace('%7Btoken%7D', $user->token, $text);
809
  $text = str_replace('{id}', $user->id, $text);
@@ -1059,6 +1090,8 @@ class Newsletter extends NewsletterModule {
1059
 
1060
  function set_user_status($id_or_email, $status) {
1061
  global $wpdb;
 
 
1062
 
1063
  $id_or_email = strtolower(trim($id_or_email));
1064
  if (is_numeric($id_or_email)) {
4
  Plugin Name: Newsletter
5
  Plugin URI: http://www.satollo.net/plugins/newsletter
6
  Description: Newsletter is a cool plugin to create your own subscriber list, to send newsletters, to build your business. <strong>Before update give a look to <a href="http://www.satollo.net/plugins/newsletter#update">this page</a> to know what's changed.</strong>
7
+ Version: 3.4.8
8
  Author: Stefano Lissa
9
  Author URI: http://www.satollo.net
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
13
  */
14
 
15
  // Useed as dummy parameter on css and js links
16
+ define('NEWSLETTER_VERSION', '3.4.8');
17
 
18
  global $wpdb, $newsletter;
19
 
75
  class Newsletter extends NewsletterModule {
76
 
77
  // Limits to respect to avoid memory, time or provider limits
78
+ var $time_start;
79
  var $time_limit;
80
  var $email_limit = 10; // Per run, every 5 minutes
81
  var $limits_set = false;
109
  }
110
 
111
  function __construct() {
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
+
114
+ $this->time_start = time();
115
+
116
  // Here because the upgrade is called by the parent constructor and uses the scheduler
117
  add_filter('cron_schedules', array($this, 'hook_cron_schedules'), 1000);
118
 
119
+ parent::__construct('main', '1.2.1');
120
+
121
  $max = $this->options['scheduler_max'];
122
  if (!is_numeric($max))
123
  $max = 100;
148
 
149
  if (is_admin()) {
150
  add_action('admin_head', array($this, 'hook_admin_head'));
151
+
152
+ // Protection against strange schedule removal on some installations
153
+ if (!wp_next_scheduled('newsletter') && !defined('WP_INSTALLING')) {
154
+ wp_schedule_event(time() + 30, 'newsletter', 'newsletter');
155
+ }
156
  }
157
  }
158
 
161
  // the every-five-minutes schedule named "newsletter" is not present.
162
  // Since the activation does not forces an upgrade, that schedule must be reactivated here. It is activated on
163
  // the upgrade method as well for the user which upgrade the plugin without deactivte it (many).
164
+ if (!wp_next_scheduled('newsletter')) {
 
165
  wp_schedule_event(time() + 30, 'newsletter', 'newsletter');
166
  }
167
  }
236
  wp_mkdir_p(WP_CONTENT_DIR . '/extensions/newsletter');
237
  wp_mkdir_p(WP_CONTENT_DIR . '/cache/newsletter');
238
 
239
+ //wp_clear_scheduled_hook('newsletter_updates_run');
240
  wp_clear_scheduled_hook('newsletter_statistics_version_check');
241
+ wp_clear_scheduled_hook('newsletter_reports_version_check');
242
+ wp_clear_scheduled_hook('newsletter_feed_version_check');
243
+ wp_clear_scheduled_hook('newsletter_popup_version_check');
244
+
245
 
246
  return true;
247
  }
372
  function hook_newsletter() {
373
  global $wpdb;
374
 
375
+ $this->logger->debug('hook_newsletter> Start');
376
 
377
  // Do not accept job activation before at least 4 minutes are elapsed from the last run.
378
  if (!$this->check_transient('engine', NEWSLETTER_CRON_INTERVAL))
388
  }
389
  // Remove the semaphore so the delivery engine can be activated again
390
  $this->delete_transient('engine');
391
+
392
+ $this->logger->debug('hook_newsletter> End');
393
  }
394
 
395
  /**
438
  return false;
439
 
440
  $headers = array('List-Unsubscribe' => '<' . NEWSLETTER_UNSUBSCRIBE_URL . '?nk=' . $user->id . '-' . $user->token . '>');
441
+ $headers['Precedence'] = 'bulk';
442
 
443
  if (!$test) {
444
  $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set sent=sent+1, last_id=" . $user->id . " where id=" . $email->id . " limit 1");
485
 
486
  return ob_get_clean();
487
  }
488
+
489
 
490
  /**
491
  * This function checks is, during processing, we are getting to near to system limits and should stop any further
496
 
497
  if (!$this->limits_set) {
498
  $this->logger->debug('limits_exceeded> Setting the limits for the first time');
499
+
500
+ $max_time = NEWSLETTER_CRON_INTERVAL;
501
+
502
+ // Actually it should be set on startup, anyway the scripts use as time base the startup time
503
+ if (!empty($this->options['php_time_limit'])) {
504
+ @set_time_limit((int)$this->options['php_time_limit']);
505
+ }
506
+ else if (defined('NEWSLETTER_MAX_EXECUTION_TIME')) {
507
+ @set_time_limit(NEWSLETTER_MAX_EXECUTION_TIME);
508
+ }
509
+
510
+ $max_time = (int) (@ini_get('max_execution_time') * 0.95);
511
+ if ($max_time == 0 || $max_time > NEWSLETTER_CRON_INTERVAL) $max_time = (int)(NEWSLETTER_CRON_INTERVAL*0.95);
512
+
513
+ $this->time_limit = $this->time_start + $max_time;
514
+
515
+ $this->logger->info('limits_exceeded> Max time set to ' . $max_time);
516
+
517
  $max = $this->options['scheduler_max'];
518
  if (!is_numeric($max))
519
  $max = 100;
825
 
826
 
827
  $text = str_replace('{surname}', $user->surname, $text);
828
+ $text = str_replace('{last_name}', $user->surname, $text);
829
+
830
+ $full_name = trim($user->name . ' ' . $user->surname);
831
+ if (empty($full_name)) {
832
+ $text = str_replace(' {full_name}', '', $text);
833
+ $text = str_replace('{full_name}', '', $text);
834
+ } else {
835
+ $text = str_replace('{full_name}', $full_name, $text);
836
+ }
837
+
838
  $text = str_replace('{token}', $user->token, $text);
839
  $text = str_replace('%7Btoken%7D', $user->token, $text);
840
  $text = str_replace('{id}', $user->id, $text);
1090
 
1091
  function set_user_status($id_or_email, $status) {
1092
  global $wpdb;
1093
+
1094
+ $this->logger->debug('Status change to ' . $status . ' of subscriber ' . $id_or_email . ' from ' . $_SERVER['REQUEST_URI']);
1095
 
1096
  $id_or_email = strtolower(trim($id_or_email));
1097
  if (is_numeric($id_or_email)) {
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing
3
  Requires at least: 3.3.0
4
- Tested up to: 3.6.1
5
  Stable tag: trunk
6
  Donate link: http://www.satollo.net/donations
7
 
@@ -13,6 +13,8 @@ This plug-in adds a real newsletter system to your WordPress blog. Perfect for l
13
  you can create cool emails with visual editor, send and
14
  track them.
15
 
 
 
16
  Unlimited subscribers, unlimited e-mails.
17
 
18
  Key features:
@@ -55,6 +57,42 @@ No screen shots are available at this time.
55
 
56
  == Changelog ==
57
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
58
  = 3.4.2 =
59
 
60
  * Refined the subscription for already subscribed emails
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing
3
  Requires at least: 3.3.0
4
+ Tested up to: 3.7.1
5
  Stable tag: trunk
6
  Donate link: http://www.satollo.net/donations
7
 
13
  you can create cool emails with visual editor, send and
14
  track them.
15
 
16
+ ** Let me know if the plugin is doing well: rate it, thank you!** (see the stars on the right)
17
+
18
  Unlimited subscribers, unlimited e-mails.
19
 
20
  Key features:
57
 
58
  == Changelog ==
59
 
60
+ = 3.4.8 =
61
+
62
+ * Added a javascript protection against auto confirmation from bot
63
+ * Fixed a warning with debug active on site login
64
+
65
+ = 3.4.7 =
66
+
67
+ * Fixed the subscription panel where some panels where no more visible.
68
+
69
+ = 3.4.6 =
70
+
71
+ * Added the full_name tag
72
+ * Added the "simple" theme
73
+ * Added indexes to the statistic table to improve the reports extension response time
74
+ * Fixed some noticies in debug mode
75
+
76
+ = 3.4.5 =
77
+
78
+ * Revisited the theme chooser and the theme configuration
79
+ * Fixed a double field on the locked content configuration
80
+ * Improved the delivery engine
81
+
82
+ = 3.4.4 =
83
+
84
+ * Improved error messages
85
+ * Fixed the last tab store (jquery changes)
86
+ * Added some new controls for the pop up extensions
87
+
88
+ = 3.4.3 =
89
+
90
+ * Added the precendence bulk header (https://support.google.com/mail/answer/81126)
91
+ * Added filter on messages to avoid wrong URLs when the blog change domain or folder
92
+ * Added the alt attribute to the tracking image
93
+ * New option to set the PHP max execution time
94
+ * Fixed some text on main configuration panel
95
+
96
  = 3.4.2 =
97
 
98
  * Refined the subscription for already subscribed emails
statistics/statistics.php CHANGED
@@ -17,7 +17,7 @@ class NewsletterStatistics extends NewsletterModule {
17
  }
18
 
19
  function __construct() {
20
- parent::__construct('statistics', '1.0.6');
21
  }
22
 
23
  function upgrade() {
@@ -45,6 +45,9 @@ class NewsletterStatistics extends NewsletterModule {
45
  $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column anchor varchar(200) not null default ''");
46
  $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column ip varchar(20) not null default ''");
47
  $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column country varchar(4) not null default ''");
 
 
 
48
 
49
  // Stores the link of every email to create short links
50
  // $this->upgrade_query("create table if not exists {$wpdb->prefix}newsletter_links (id int auto_increment, primary key (id)) $charset_collate");
@@ -68,7 +71,7 @@ class NewsletterStatistics extends NewsletterModule {
68
  $text = preg_replace_callback('/(<[aA][^>]+href=["\'])([^>"\']+)(["\'][^>]*>)(.*?)(<\/[Aa]>)/', array($this, 'relink_callback'), $text);
69
 
70
  // TODO: use the WP rewriting
71
- $text = str_replace('</body>', '<img src="' . plugins_url('newsletter') . '/statistics/open.php?r=' . urlencode(base64_encode($email_id . ';' . $user_id)) . '"/></body>', $text);
72
  return $text;
73
  }
74
 
17
  }
18
 
19
  function __construct() {
20
+ parent::__construct('statistics', '1.1.0');
21
  }
22
 
23
  function upgrade() {
45
  $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column anchor varchar(200) not null default ''");
46
  $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column ip varchar(20) not null default ''");
47
  $this->upgrade_query("alter table {$wpdb->prefix}newsletter_stats add column country varchar(4) not null default ''");
48
+
49
+ $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_stats` ADD INDEX `email_id` (`email_id`)");
50
+ $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_stats` ADD INDEX `user_id` (`user_id`)");
51
 
52
  // Stores the link of every email to create short links
53
  // $this->upgrade_query("create table if not exists {$wpdb->prefix}newsletter_links (id int auto_increment, primary key (id)) $charset_collate");
71
  $text = preg_replace_callback('/(<[aA][^>]+href=["\'])([^>"\']+)(["\'][^>]*>)(.*?)(<\/[Aa]>)/', array($this, 'relink_callback'), $text);
72
 
73
  // TODO: use the WP rewriting
74
+ $text = str_replace('</body>', '<img alt="newsletter" src="' . plugins_url('newsletter') . '/statistics/open.php?r=' . urlencode(base64_encode($email_id . ';' . $user_id)) . '"/></body>', $text);
75
  return $text;
76
  }
77
 
subscription/options.php CHANGED
@@ -52,7 +52,9 @@ if ($controls->is_action()) {
52
  $controls->data['confirmed_text'] = NewsletterModule::clean_url_tags($controls->data['confirmed_text']);
53
  $controls->data['confirmation_text'] = NewsletterModule::clean_url_tags($controls->data['confirmation_text']);
54
  $controls->data['confirmation_message'] = NewsletterModule::clean_url_tags($controls->data['confirmation_message']);
55
-
 
 
56
 
57
  $controls->data['confirmed_url'] = trim($controls->data['confirmed_url']);
58
  $controls->data['confirmation_url'] = trim($controls->data['confirmation_url']);
@@ -150,12 +152,11 @@ if ($controls->is_action('create')) {
150
  <li><a href="#tabs-4">Welcome</a></li>
151
  <li><a href="#tabs-9">Profile</a></li>
152
  <li><a href="#tabs-5">Unsubscription</a></li>
153
- <!--<li><a href="#tabs-8">Popup</a></li>-->
154
  <li><a href="#tabs-7">Docs</a></li>
155
  </ul>
156
 
157
  <div id="tabs-general">
158
- <p>Choose how the subscription process to your newsletter works.</p>
159
  <table class="form-table">
160
  <tr valign="top">
161
  <th>Opt In</th>
@@ -209,37 +210,7 @@ if ($controls->is_action('create')) {
209
  </tr>
210
  </table>
211
 
212
- <h3><?php _e('Integration with WordPress user registration', 'newsletter'); ?></h3>
213
- <table class="form-table">
214
- <tr valign="top">
215
- <th>Subscription on registration</th>
216
- <td>
217
- <?php $controls->select('subscribe_wp_users', array(0=>'No', 1=>'Yes, force subscription', 2=>'Yes, show the option', 3=>'Yes, show the option already checked')); ?>
218
- <?php $controls->hint('Adds a newsletter subscription option on registration.', 'http://www.satollo.net/plugins/newsletter/subscription-module#registration'); ?>
219
- </td>
220
- </tr>
221
- <tr valign="top">
222
- <th>Check box label</th>
223
- <td>
224
- <?php $controls->text('subscribe_wp_users_label', 30); ?>
225
- </td>
226
- </tr>
227
- <!--
228
- <tr valign="top">
229
- <th>Opt-in mode for WordPress registrated users</th>
230
- <td>
231
- <?php //$controls->select('optin_wp_users', array(0=>'As for regular subscriptions', 1=>'Force single opt-in')); ?>
232
- </td>
233
- </tr>
234
- -->
235
- <tr valign="top">
236
- <th>Send welcome email to registered users</th>
237
- <td>
238
- <?php $controls->yesno('wp_welcome'); ?>
239
- </td>
240
- </tr>
241
-
242
- </table>
243
  </div>
244
 
245
 
@@ -257,7 +228,7 @@ if ($controls->is_action('create')) {
257
  </td>
258
  </tr>
259
  <tr valign="top">
260
- <th>Preferences</th>
261
  <td>
262
  <?php $controls->preferences(); ?>
263
  <div class="hints">
@@ -268,13 +239,18 @@ if ($controls->is_action('create')) {
268
  </table>
269
 
270
  <h3>Special cases</h3>
271
- <p>
272
  <table class="form-table">
273
  <tr valign="top">
274
  <th>Already subscribed page content</th>
275
  <td>
276
  <?php $controls->editor('already_confirmed_text'); ?><br>
277
  <?php $controls->checkbox('resend_welcome_email_disabled', 'Do not resend the welcome email'); ?>
 
 
 
 
 
278
  </td>
279
  </tr>
280
  <tr valign="top">
@@ -291,7 +267,10 @@ if ($controls->is_action('create')) {
291
 
292
 
293
  <div id="tabs-3">
294
- <p>Only for double opt-in mode</p>
 
 
 
295
  <table class="form-table">
296
  <tr valign="top">
297
  <th>Confirmation required message</th>
@@ -327,7 +306,7 @@ if ($controls->is_action('create')) {
327
  (for double opt-in process). Do not forget to add the <strong>{subscription_confirm_url}</strong>
328
  that users must click to activate their subscription.<br />
329
  Sometime can be useful to add a <strong>{unsubscription_url}</strong> to let users to
330
- cancel if they wrongly subscribed your service.
331
  </div>
332
  </td>
333
  </tr>
@@ -394,20 +373,26 @@ if ($controls->is_action('create')) {
394
 
395
  <!-- PROFILE -->
396
  <div id="tabs-9">
 
 
 
 
 
 
397
 
398
  <table class="form-table">
399
  <tr valign="top">
400
  <th>Profile page</th>
401
  <td>
402
  <?php $controls->editor('profile_text'); ?>
403
- <?php $controls->hint('This is the ppage where subscribers can edit their data and it must contain the {profile_form} tag.',
404
  'http://www.satollo.net/plugins/newsletter/subscription-module#profile'); ?>
405
  </td>
406
  </tr>
407
  <tr>
408
  <th>Other messages</th>
409
  <td>
410
- confirmation after profile save: <?php $controls->text('profile_saved'); ?>
411
  </td>
412
  </tr>
413
  </table>
@@ -465,31 +450,7 @@ if ($controls->is_action('create')) {
465
  </div>
466
 
467
 
468
- <!-- POPUP -->
469
- <!--
470
- <div id="tabs-8">
471
- <p>
472
- Newsletter plugin does not provide a popup, but if you use a popup system (like ...) you can configure it to
473
- open the url <code><?php echo NEWSLETTER_SUBSCRIPTION_POPUP_URL; ?></code>. The message shown is the one below or,
474
- if left empty, the standard subscription text (just try, it's easy).
475
- </p>
476
- <p>
477
- The message shown after the subscription is the standard confirmation or welcome message (it depends on opt in setting).
478
- </p>
479
-
480
- <table class="form-table">
481
- <tr valign="top">
482
- <th>Popup subscription page</th>
483
- <td>
484
- <?php $controls->editor('subscription_popup_text'); ?>
485
- <div class="hints">
486
- Leave empty to use the standard subscription page text.
487
- </div>
488
- </td>
489
- </tr>
490
- </table>
491
- </div>
492
- -->
493
 
494
  <div id="tabs-7">
495
 
@@ -528,7 +489,38 @@ if ($controls->is_action('create')) {
528
  Insert the profile form with user's data. Usually it make sense only on welcome page.<br />
529
  </p>
530
  </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
531
  </div>
 
532
 
533
  <p class="submit">
534
  <?php $controls->button('save', 'Save'); ?>
52
  $controls->data['confirmed_text'] = NewsletterModule::clean_url_tags($controls->data['confirmed_text']);
53
  $controls->data['confirmation_text'] = NewsletterModule::clean_url_tags($controls->data['confirmation_text']);
54
  $controls->data['confirmation_message'] = NewsletterModule::clean_url_tags($controls->data['confirmation_message']);
55
+ $controls->data['unsubscription_text'] = NewsletterModule::clean_url_tags($controls->data['unsubscription_text']);
56
+ $controls->data['unsubscribed_text'] = NewsletterModule::clean_url_tags($controls->data['unsubscribed_text']);
57
+ $controls->data['unsubscribed_message'] = NewsletterModule::clean_url_tags($controls->data['unsubscribed_message']);
58
 
59
  $controls->data['confirmed_url'] = trim($controls->data['confirmed_url']);
60
  $controls->data['confirmation_url'] = trim($controls->data['confirmation_url']);
152
  <li><a href="#tabs-4">Welcome</a></li>
153
  <li><a href="#tabs-9">Profile</a></li>
154
  <li><a href="#tabs-5">Unsubscription</a></li>
155
+ <li><a href="#tabs-wp">WP Registration</a></li>
156
  <li><a href="#tabs-7">Docs</a></li>
157
  </ul>
158
 
159
  <div id="tabs-general">
 
160
  <table class="form-table">
161
  <tr valign="top">
162
  <th>Opt In</th>
210
  </tr>
211
  </table>
212
 
213
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
214
  </div>
215
 
216
 
228
  </td>
229
  </tr>
230
  <tr valign="top">
231
+ <th>Forced preferences</th>
232
  <td>
233
  <?php $controls->preferences(); ?>
234
  <div class="hints">
239
  </table>
240
 
241
  <h3>Special cases</h3>
242
+
243
  <table class="form-table">
244
  <tr valign="top">
245
  <th>Already subscribed page content</th>
246
  <td>
247
  <?php $controls->editor('already_confirmed_text'); ?><br>
248
  <?php $controls->checkbox('resend_welcome_email_disabled', 'Do not resend the welcome email'); ?>
249
+ <div class="hints">
250
+ Shown when the email is already subscribed and confirmed. The welcome email, is not disabled, will
251
+ be sent. Find out more on this topic on its
252
+ <a href="http://www.satollo.net/plugins/newsletter/subscription-module#repeated" target="_blank">documentation page</a>.
253
+ </div>
254
  </td>
255
  </tr>
256
  <tr valign="top">
267
 
268
 
269
  <div id="tabs-3">
270
+ <div class="tab-preamble">
271
+ <p>This configuration applies only when in double opt-in mode.</p>
272
+ </div>
273
+
274
  <table class="form-table">
275
  <tr valign="top">
276
  <th>Confirmation required message</th>
306
  (for double opt-in process). Do not forget to add the <strong>{subscription_confirm_url}</strong>
307
  that users must click to activate their subscription.<br />
308
  Sometime can be useful to add a <strong>{unsubscription_url}</strong> to let users to
309
+ cancel if they wrongly subscribed your newsletter.
310
  </div>
311
  </td>
312
  </tr>
373
 
374
  <!-- PROFILE -->
375
  <div id="tabs-9">
376
+ <div class="tab-preamble">
377
+ <p>
378
+ The page shown when the subscriber wants to edit hid profile following the link
379
+ {profile_url} you added to a newsletter.
380
+ </p>
381
+ </div>
382
 
383
  <table class="form-table">
384
  <tr valign="top">
385
  <th>Profile page</th>
386
  <td>
387
  <?php $controls->editor('profile_text'); ?>
388
+ <?php $controls->hint('This is the page where subscribers can edit their data and it must contain the {profile_form} tag.',
389
  'http://www.satollo.net/plugins/newsletter/subscription-module#profile'); ?>
390
  </td>
391
  </tr>
392
  <tr>
393
  <th>Other messages</th>
394
  <td>
395
+ confirmation after profile save: <?php $controls->text('profile_saved', 50); ?>
396
  </td>
397
  </tr>
398
  </table>
450
  </div>
451
 
452
 
453
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
454
 
455
  <div id="tabs-7">
456
 
489
  Insert the profile form with user's data. Usually it make sense only on welcome page.<br />
490
  </p>
491
  </div>
492
+
493
+
494
+ <div id="tabs-wp">
495
+ <div class="tab-preamble">
496
+ <p>Configure if and how a regular WordPress user registration can be connected to a Newsletter subscription.</p>
497
+ <p>Important! This type of subscription does not require confirmation, it's automatic on first login.
498
+ <a href="http://www.satollo.net/plugins/newsletter/subscription-module#registration" target="_blank">Read more on documentation page</a>.
499
+ </p>
500
+ </div>
501
+ <table class="form-table">
502
+ <tr valign="top">
503
+ <th>Subscription on registration</th>
504
+ <td>
505
+ <?php $controls->select('subscribe_wp_users', array(0=>'No', 1=>'Yes, force subscription', 2=>'Yes, show the option', 3=>'Yes, show the option already checked')); ?>
506
+ <?php $controls->hint('Adds a newsletter subscription option on registration.', 'http://www.satollo.net/plugins/newsletter/subscription-module#registration'); ?>
507
+ </td>
508
+ </tr>
509
+ <tr valign="top">
510
+ <th>Check box label</th>
511
+ <td>
512
+ <?php $controls->text('subscribe_wp_users_label', 30); ?>
513
+ </td>
514
+ </tr>
515
+ <tr valign="top">
516
+ <th>Send welcome email to registered users</th>
517
+ <td>
518
+ <?php $controls->yesno('wp_welcome'); ?>
519
+ </td>
520
+ </tr>
521
+ </table>
522
  </div>
523
+ </div>
524
 
525
  <p class="submit">
526
  <?php $controls->button('save', 'Save'); ?>
subscription/profile.php CHANGED
@@ -244,7 +244,12 @@ $rules = array(0=>'Optional', 1=>'Required');
244
  <p>This panel shows the form HTML code generated by Newsletter if you want to copy it as starting point for a custom form.</p>
245
  </div>
246
 
 
247
  <textarea readonly style="width: 100%; height: 500px; font-family: monospace"><?php echo htmlspecialchars(NewsletterSubscription::instance()->get_subscription_form()); ?></textarea>
 
 
 
 
248
  </div>
249
 
250
  <div id="tabs-6">
244
  <p>This panel shows the form HTML code generated by Newsletter if you want to copy it as starting point for a custom form.</p>
245
  </div>
246
 
247
+ <h3>Standard form code</h3>
248
  <textarea readonly style="width: 100%; height: 500px; font-family: monospace"><?php echo htmlspecialchars(NewsletterSubscription::instance()->get_subscription_form()); ?></textarea>
249
+
250
+ <h3>Widget form code</h3>
251
+ <textarea readonly style="width: 100%; height: 500px; font-family: monospace"><?php echo htmlspecialchars(NewsletterSubscription::instance()->get_subscription_form()); ?></textarea>
252
+
253
  </div>
254
 
255
  <div id="tabs-6">
subscription/subscription.php CHANGED
@@ -164,17 +164,17 @@ class NewsletterSubscription extends NewsletterModule {
164
  function hook_wp_login($user_login) {
165
  global $newsletter;
166
 
167
- $this->logger->info(__METHOD__ . '> Start with ' . $user_login);
168
  $wp_user = get_user_by('login', $user_login);
169
  if (!empty($wp_user)) {
170
- $this->logger->info($wp_user);
171
  // We have a user able to login, so his subscription can be confirmed if not confirmed
172
  $user = $newsletter->get_user($wp_user->user_email);
173
- if (!empty($user)) {
174
  $this->confirm($user->id, $this->options['wp_welcome'] == 1);
175
  }
176
  }
177
- $this->logger->info(__METHOD__ . '> End');
178
  }
179
 
180
  /**
@@ -340,10 +340,17 @@ class NewsletterSubscription extends NewsletterModule {
340
  } else {
341
  $user = $newsletter->get_user($user_id);
342
  }
 
 
 
 
343
 
344
- if ($user == null)
 
345
  die('No subscriber found.');
 
346
  if ($user->status != 'S') {
 
347
  $user->status = 'E';
348
  return $user;
349
  }
@@ -376,11 +383,17 @@ class NewsletterSubscription extends NewsletterModule {
376
  function unsubscribe() {
377
  global $newsletter;
378
  $user = $this->get_user_from_request();
 
 
 
 
379
  setcookie('newsletter', '', time() - 3600);
380
  if ($user == null) {
 
381
  die('Subscriber not found');
382
  }
383
  if ($user->status != 'C') {
 
384
  $user->status = 'E';
385
  return $user;
386
  }
@@ -732,6 +745,7 @@ class NewsletterSubscription extends NewsletterModule {
732
  $buffer .= "</table>\n</form>\n</div>";
733
  return $buffer;
734
  }
 
735
 
736
  /**
737
  * Generate the profile editing form.
164
  function hook_wp_login($user_login) {
165
  global $newsletter;
166
 
167
+ //$this->logger->info(__METHOD__ . '> Start with ' . $user_login);
168
  $wp_user = get_user_by('login', $user_login);
169
  if (!empty($wp_user)) {
170
+ //$this->logger->info($wp_user);
171
  // We have a user able to login, so his subscription can be confirmed if not confirmed
172
  $user = $newsletter->get_user($wp_user->user_email);
173
+ if (!empty($user) && isset($this->options['wp_welcome'])) {
174
  $this->confirm($user->id, $this->options['wp_welcome'] == 1);
175
  }
176
  }
177
+ //$this->logger->info(__METHOD__ . '> End');
178
  }
179
 
180
  /**
340
  } else {
341
  $user = $newsletter->get_user($user_id);
342
  }
343
+
344
+ $this->logger->debug('Confirmation for:');
345
+ $this->logger->debug($user);
346
+
347
 
348
+ if ($user == null) {
349
+ $this->logger->debug('Not found');
350
  die('No subscriber found.');
351
+ }
352
  if ($user->status != 'S') {
353
+ $this->logger->debug('Was not in status S');
354
  $user->status = 'E';
355
  return $user;
356
  }
383
  function unsubscribe() {
384
  global $newsletter;
385
  $user = $this->get_user_from_request();
386
+
387
+ $this->logger->debug('Unsubscription for:');
388
+ $this->logger->debug($user);
389
+
390
  setcookie('newsletter', '', time() - 3600);
391
  if ($user == null) {
392
+ $this->logger->debug('Not found');
393
  die('Subscriber not found');
394
  }
395
  if ($user->status != 'C') {
396
+ $this->logger->debug('Was not in status C');
397
  $user->status = 'E';
398
  return $user;
399
  }
745
  $buffer .= "</table>\n</form>\n</div>";
746
  return $buffer;
747
  }
748
+
749
 
750
  /**
751
  * Generate the profile editing form.
todo.txt ADDED
File without changes
widget.php CHANGED
@@ -9,6 +9,86 @@ class NewsletterWidget extends WP_Widget {
9
  parent::WP_Widget(false, $name = 'Newsletter', array('description' => 'Newsletter widget to add subscription forms on sidebars'), array('width' => '350px'));
10
  }
11
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
12
  function widget($args, $instance) {
13
  global $newsletter;
14
  extract($args);
@@ -27,84 +107,21 @@ class NewsletterWidget extends WP_Widget {
27
  $form = NewsletterSubscription::instance()->get_form_javascript();
28
 
29
  $form .= '<div class="newsletter newsletter-widget">';
30
- $form .= '<form action="' . plugins_url('newsletter/do/subscribe.php') . '" onsubmit="return newsletter_check(this)" method="post">';
31
- // Referrer
32
- $form .= '<input type="hidden" name="nr" value="widget"/>';
33
-
34
- if ($options_profile['name_status'] == 2) $form .= '<p><input class="newsletter-firstname" type="text" name="nn" value="' . $options_profile['name'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
35
-
36
- if ($options_profile['surname_status'] == 2) $form .= '<p><input class="newsletter-lastname" type="text" name="ns" value="' . $options_profile['surname'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
37
-
38
- $form .= '<p><input class="newsletter-email" type="email" required name="ne" value="' . $options_profile['email'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
39
-
40
- if ($options_profile['sex_status'] == 2) {
41
- $form .= '<p><select name="nx" class="newsletter-sex">';
42
- $form .= '<option value="m">' . $options_profile['sex_male'] . '</option>';
43
- $form .= '<option value="f">' . $options_profile['sex_female'] . '</option>';
44
- $form .= '</select></p>';
45
- }
46
-
47
- // Extra profile fields
48
- for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i++) {
49
- if ($options_profile['profile_' . $i . '_status'] != 2) continue;
50
- if ($options_profile['profile_' . $i . '_type'] == 'text') {
51
- $form .= '<p><input class="newsletter-profile newsletter-profile-' . $i . '" type="text" name="np' . $i . '" value="' . $options_profile['profile_' . $i] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
52
- }
53
- if ($options_profile['profile_' . $i . '_type'] == 'select') {
54
- $form .= '<p>' . $options_profile['profile_' . $i] . '<br /><select class="newsletter-profile newsletter-profile-' . $i . '" name="np' . $i . '">';
55
- $opts = explode(',', $options_profile['profile_' . $i . '_options']);
56
- for ($t = 0; $t < count($opts); $t++) {
57
- $form .= '<option>' . trim($opts[$t]) . '</option>';
58
- }
59
- $form .= '</select></p>';
60
- }
61
- }
62
-
63
- $lists = '';
64
- for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
65
- if ($options_profile['list_' . $i . '_status'] != 2) continue;
66
- $lists .= '<input type="checkbox" name="nl[]" value="' . $i . '"';
67
- if ($options_profile['list_' . $i . '_checked'] == 1) $lists .= ' checked';
68
- $lists .= '/>&nbsp;' . $options_profile['list_' . $i] . '<br />';
69
- }
70
- if (!empty($lists)) $form .= '<p>' . $lists . '</p>';
71
-
72
-
73
- $extra = apply_filters('newsletter_subscription_extra', array());
74
- foreach ($extra as &$x) {
75
- $form .= "<p>";
76
- if (!empty($x['label'])) $form .= $x['label'] . "<br/>";
77
- $form .= $x['field'] . "</p>";
78
- }
79
-
80
- if ($options_profile['privacy_status'] == 1) {
81
- if (!empty($options_profile['privacy_url'])) {
82
- $form .= '<p><input type="checkbox" name="ny"/>&nbsp;<a target="_blank" href="' . $options_profile['privacy_url'] . '">' . $options_profile['privacy'] . '</a></p>';
83
- }
84
- else $form .= '<p><input type="checkbox" name="ny"/>&nbsp;' . $options_profile['privacy'] . '</p>';
85
- }
86
-
87
- if (strpos($options_profile['subscribe'], 'http://') !== false) {
88
- $form .= '<p><input class="newsletter-submit" type="image" src="' . $options_profile['subscribe'] . '"/></p>';
89
- } else {
90
- $form .= '<p><input class="newsletter-submit" type="submit" value="' . $options_profile['subscribe'] . '"/></p>';
91
- }
92
-
93
- $form .= '</form></div>';
94
 
95
  // Canot user directly the replace, since the form is different on the widget...
96
- if (strpos($buffer, '{subscription_form}') !== false) $buffer = str_replace('{subscription_form}', $form, $buffer);
 
97
  else {
98
  if (strpos($buffer, '{subscription_form_') !== false) {
99
  // TODO: Optimize with a method to replace only the custom forms
100
  $buffer = $newsletter->replace($buffer);
101
- }
102
- else {
103
  $buffer .= $form;
104
  }
105
  }
106
- }
107
- else {
108
  $buffer = str_ireplace('<form', '<form method="post" action="' . plugins_url('newsletter/do/subscribe.php') . '" onsubmit="return newsletter_check(this)"', $buffer);
109
  $buffer = str_ireplace('</form>', '<input type="hidden" name="nr" value="widget"/></form>', $buffer);
110
  }
@@ -136,7 +153,7 @@ class NewsletterWidget extends WP_Widget {
136
  Introduction:
137
  <textarea class="widefat" rows="10" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_html($instance['text']); ?></textarea>
138
  </label>
139
- <p>Use the tag {subscription_form} to place the subscription form within your personal text.
140
  </p>
141
  <?php
142
  }
9
  parent::WP_Widget(false, $name = 'Newsletter', array('description' => 'Newsletter widget to add subscription forms on sidebars'), array('width' => '350px'));
10
  }
11
 
12
+ static function get_widget_form() {
13
+ $options_profile = get_option('newsletter_profile');
14
+ $form = NewsletterSubscription::instance()->get_form_javascript();
15
+
16
+ $form .= '<form action="' . plugins_url('newsletter/do/subscribe.php') . '" onsubmit="return newsletter_check(this)" method="post">';
17
+ // Referrer
18
+ $form .= '<input type="hidden" name="nr" value="widget"/>';
19
+
20
+ if ($options_profile['name_status'] == 2)
21
+ $form .= '<p><input class="newsletter-firstname" type="text" name="nn" value="' . $options_profile['name'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
22
+
23
+ if ($options_profile['surname_status'] == 2)
24
+ $form .= '<p><input class="newsletter-lastname" type="text" name="ns" value="' . $options_profile['surname'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
25
+
26
+ $form .= '<p><input class="newsletter-email" type="email" required name="ne" value="' . $options_profile['email'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
27
+
28
+ if ($options_profile['sex_status'] == 2) {
29
+ $form .= '<p><select name="nx" class="newsletter-sex">';
30
+ $form .= '<option value="m">' . $options_profile['sex_male'] . '</option>';
31
+ $form .= '<option value="f">' . $options_profile['sex_female'] . '</option>';
32
+ $form .= '</select></p>';
33
+ }
34
+
35
+ // Extra profile fields
36
+ for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i++) {
37
+ if ($options_profile['profile_' . $i . '_status'] != 2)
38
+ continue;
39
+ if ($options_profile['profile_' . $i . '_type'] == 'text') {
40
+ $form .= '<p><input class="newsletter-profile newsletter-profile-' . $i . '" type="text" name="np' . $i . '" value="' . $options_profile['profile_' . $i] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
41
+ }
42
+ if ($options_profile['profile_' . $i . '_type'] == 'select') {
43
+ $form .= '<p>' . $options_profile['profile_' . $i] . '<br /><select class="newsletter-profile newsletter-profile-' . $i . '" name="np' . $i . '">';
44
+ $opts = explode(',', $options_profile['profile_' . $i . '_options']);
45
+ for ($t = 0; $t < count($opts); $t++) {
46
+ $form .= '<option>' . trim($opts[$t]) . '</option>';
47
+ }
48
+ $form .= '</select></p>';
49
+ }
50
+ }
51
+
52
+ $lists = '';
53
+ for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
54
+ if ($options_profile['list_' . $i . '_status'] != 2)
55
+ continue;
56
+ $lists .= '<input type="checkbox" name="nl[]" value="' . $i . '"';
57
+ if ($options_profile['list_' . $i . '_checked'] == 1)
58
+ $lists .= ' checked';
59
+ $lists .= '/>&nbsp;' . $options_profile['list_' . $i] . '<br />';
60
+ }
61
+ if (!empty($lists))
62
+ $form .= '<p>' . $lists . '</p>';
63
+
64
+
65
+ $extra = apply_filters('newsletter_subscription_extra', array());
66
+ foreach ($extra as &$x) {
67
+ $form .= "<p>";
68
+ if (!empty($x['label']))
69
+ $form .= $x['label'] . "<br/>";
70
+ $form .= $x['field'] . "</p>";
71
+ }
72
+
73
+ if ($options_profile['privacy_status'] == 1) {
74
+ if (!empty($options_profile['privacy_url'])) {
75
+ $form .= '<p><input type="checkbox" name="ny"/>&nbsp;<a target="_blank" href="' . $options_profile['privacy_url'] . '">' . $options_profile['privacy'] . '</a></p>';
76
+ }
77
+ else
78
+ $form .= '<p><input type="checkbox" name="ny"/>&nbsp;' . $options_profile['privacy'] . '</p>';
79
+ }
80
+
81
+ if (strpos($options_profile['subscribe'], 'http://') !== false) {
82
+ $form .= '<p><input class="newsletter-submit" type="image" src="' . $options_profile['subscribe'] . '"/></p>';
83
+ } else {
84
+ $form .= '<p><input class="newsletter-submit" type="submit" value="' . $options_profile['subscribe'] . '"/></p>';
85
+ }
86
+
87
+ $form .= '</form>';
88
+
89
+ return $form;
90
+ }
91
+
92
  function widget($args, $instance) {
93
  global $newsletter;
94
  extract($args);
107
  $form = NewsletterSubscription::instance()->get_form_javascript();
108
 
109
  $form .= '<div class="newsletter newsletter-widget">';
110
+ $form .= NewsletterWidget::get_widget_form();
111
+ $form .= '</div>';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
 
113
  // Canot user directly the replace, since the form is different on the widget...
114
+ if (strpos($buffer, '{subscription_form}') !== false)
115
+ $buffer = str_replace('{subscription_form}', $form, $buffer);
116
  else {
117
  if (strpos($buffer, '{subscription_form_') !== false) {
118
  // TODO: Optimize with a method to replace only the custom forms
119
  $buffer = $newsletter->replace($buffer);
120
+ } else {
 
121
  $buffer .= $form;
122
  }
123
  }
124
+ } else {
 
125
  $buffer = str_ireplace('<form', '<form method="post" action="' . plugins_url('newsletter/do/subscribe.php') . '" onsubmit="return newsletter_check(this)"', $buffer);
126
  $buffer = str_ireplace('</form>', '<input type="hidden" name="nr" value="widget"/></form>', $buffer);
127
  }
153
  Introduction:
154
  <textarea class="widefat" rows="10" cols="20" id="<?php echo $this->get_field_id('text'); ?>" name="<?php echo $this->get_field_name('text'); ?>"><?php echo esc_html($instance['text']); ?></textarea>
155
  </label>
156
+ <p>Use the tag {subscription_form} to place the subscription form within your personal text.
157
  </p>
158
  <?php
159
  }