Newsletter - Version 3.5.0

Version Description

  • Fixed the subscriber list panel
  • Interface reviewed
  • Fixed the image chooser for WP 3.8.1
  • Fixed the export for editors
  • Patch for anonymous users create by woocommerce
  • Madrill API adapter
  • Header separation between this plugin and the extensions
  • Default to base 64 encoding of outgoing email to solve the long lines problem
Download this release

Release Info

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

Code changes from version 3.4.9 to 3.5.0

admin.css CHANGED
@@ -573,19 +573,17 @@ button.ui-button::-moz-focus-inner { border: 0; padding: 0; } /* reset extra pad
573
 
574
 
575
  .ui-tabs {
576
- border-color: #ddd;
577
  }
578
 
579
  .ui-tabs-nav {
580
- background-image: none;
581
- background-color: #fff;
582
- border: 0;
583
- border-bottom: 1px solid #ddd;
584
- border-radius: 0;
585
  }
586
 
587
-
588
- /* Admin header */
589
  #newsletter-header {
590
  text-align: left;
591
  background-color: #f4f4f4;
@@ -600,6 +598,26 @@ border-radius: 0;
600
  margin-right: 15px;
601
  }
602
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
603
  #newsletter-path {
604
 
605
  }
@@ -608,26 +626,39 @@ border-radius: 0;
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 {
618
  font-weight: bold;
619
  }
620
 
621
  .wrap h2 {
622
- color: #21759B;
623
- font-size: 20px;
624
- margin: 10px 0;
625
- padding: 0;
626
- font-family: Georgia;
627
  }
628
 
629
  .wrap h3 {
630
- font-family: Georgia;
631
  }
632
 
633
  .wrap h4 {
@@ -712,16 +743,16 @@ table.clicks {
712
  }
713
 
714
  .hints {
715
- border: 1px solid #e4e4ee;
716
- background-color: #f4f4ff;
717
- padding: 5px;
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,6 +770,12 @@ border-color: #faebcc;
739
  list-style-position: inside;
740
  }
741
 
 
 
 
 
 
 
742
 
743
  .newsletter-checkbox-group, .nl-checkbox-group {
744
  float: left;
@@ -880,6 +917,7 @@ border-color: #faebcc;
880
  }
881
 
882
  /* Text under the panel title to explain the panel purpose. */
 
883
  .preamble {
884
  margin-bottom: 15px;
885
  border-radius: 3px;
@@ -896,17 +934,35 @@ border-color: #faebcc;
896
  .preamble p {
897
  margin: 0;
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 {
573
 
574
 
575
  .ui-tabs {
576
+ border-color: #ddd;
577
  }
578
 
579
  .ui-tabs-nav {
580
+ background-image: none;
581
+ background-color: #fff;
582
+ border: 0;
583
+ border-bottom: 1px solid #ddd;
584
+ border-radius: 0;
585
  }
586
 
 
 
587
  #newsletter-header {
588
  text-align: left;
589
  background-color: #f4f4f4;
598
  margin-right: 15px;
599
  }
600
 
601
+ /* Admin header */
602
+ #newsletter-header-new {
603
+ text-align: left;
604
+ background-color: #fff;
605
+ padding: 10px;
606
+ xpadding-left: 15px;
607
+ xborder-radius: 3px;
608
+ xtext-transform: uppercase;
609
+ font-size: 12px;
610
+ border: 1px solid #ccc;
611
+ float: right;
612
+ width: 300px;
613
+ xmargin-bottom: 10px;
614
+ }
615
+
616
+ #newsletter-header-new a {
617
+ margin-right: 10px;
618
+ text-decoration: none;
619
+ }
620
+
621
  #newsletter-path {
622
 
623
  }
626
  margin-bottom: 15px;
627
  }
628
 
629
+ #newsletter-title {
630
+ xfloat: left;
631
+ }
632
+
633
+ .newsletter-separator {
634
+ clear: both;
635
+ height: 5px;
636
+ }
637
+
638
  .wrap, .wrap td, .wrap th, .wrap input, .wrap textarea {
639
  font-size: 13px;
640
  font-family: sans-serif;
641
  line-height: 130%;
642
  }
643
 
644
+ .wrap td a {
645
+ text-decoration: underline;
646
+ }
647
+
648
  .main-index a {
649
  font-weight: bold;
650
  }
651
 
652
  .wrap h2 {
653
+ xcolor: #21759B;
654
+ xfont-size: 20px;
655
+ xmargin: 10px 0;
656
+ xpadding: 0;
657
+ xfont-family: Georgia;
658
  }
659
 
660
  .wrap h3 {
661
+ font-family: Georgia;
662
  }
663
 
664
  .wrap h4 {
743
  }
744
 
745
  .hints {
746
+ xborder: 1px solid #e4e4ee;
747
+ xbackground-color: #f4f4ff;
748
+ xpadding: 5px;
749
  margin-top: 10px;
750
+ xborder-radius: 4px 4px;
751
+ font-size: 13px;
 
752
  color: #666;
753
+ font-style: italic;
754
+ xbackground-color: #fcf8e3;
755
+ xborder-color: #faebcc;
756
  }
757
 
758
  .intro {
770
  list-style-position: inside;
771
  }
772
 
773
+ .newsletter-badge {
774
+ color: #fff;
775
+ background-color: #666;
776
+ border-radius: 5px;
777
+ padding: 1px 5px;
778
+ }
779
 
780
  .newsletter-checkbox-group, .nl-checkbox-group {
781
  float: left;
917
  }
918
 
919
  /* Text under the panel title to explain the panel purpose. */
920
+ /*
921
  .preamble {
922
  margin-bottom: 15px;
923
  border-radius: 3px;
934
  .preamble p {
935
  margin: 0;
936
  }
937
+ */
938
+
939
+ .newsletter-preamble {
940
+ margin-bottom: 15px;
941
+ xborder-radius: 3px;
942
+ xbackground-color: #f4f4f4;
943
+ xpadding: 10px;
944
+ xbackground-image: url("images/preamble.png");
945
+ xbackground-repeat: no-repeat;
946
+ xbackground-position: left;
947
+ xpadding-left: 65px;
948
+ font-size: 13px;
949
+ xfont-family: sans-serif;
950
+ }
951
+
952
+ .newsletter-preamble p {
953
+ margin: 0;
954
+ }
955
 
956
  .tab-preamble {
957
  font-size: 13px;
958
  line-height: normal;
959
+ xfont-family: sans-serif;
960
+ xcolor: #3a87ad;
961
+ xbackground-color: #d9edf7;
962
+ xborder: 1px solid #bce8f1;
963
+ xpadding: 15px;
964
+ xmargin-bottom: 20px;
965
+ xborder-radius: 4px;
966
  }
967
 
968
  .tab-preamble p {
emails/edit.php CHANGED
@@ -159,6 +159,7 @@ if ($controls->is_action('test')) {
159
  Newsletter::instance()->send(Newsletter::instance()->get_email($email_id), $users);
160
  $controls->messages .= 'Test emails sent to ' . count($users) . ' test subscribers. Read more about test subscribers <a href="http://www.satollo.net/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
161
  }
 
162
  }
163
 
164
 
@@ -211,12 +212,14 @@ if ($email['editor'] == 0) {
211
 
212
  <div class="wrap">
213
 
214
- <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletters-module'; ?>
215
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
216
-
217
- <h5>Newsletters Module</h5>
218
 
 
219
  <h2>Edit Newsletter</h2>
 
 
 
220
  <?php
221
  if ($controls->data['status'] == 'S') {
222
  echo '<div class="newsletter-message">Warning! This email is configured to be sent to NOT CONFIRMED subscribers.</div>';
@@ -244,7 +247,7 @@ if ($email['editor'] == 0) {
244
  <li><a href="#tabs-a">Message</a></li>
245
  <li><a href="#tabs-b">Message (textual)</a></li>
246
  <li><a href="#tabs-c">Who will receive it</a></li>
247
- <li><a href="#tabs-d">Status</a></li>
248
  <!--<li><a href="#tabs-5">Documentation</a></li>-->
249
  </ul>
250
 
@@ -294,7 +297,7 @@ if ($email['editor'] == 0) {
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">
@@ -303,7 +306,7 @@ if ($email['editor'] == 0) {
303
  </td>
304
  </tr>
305
  <tr valign="top">
306
- <th>Preferences</th>
307
  <td>
308
  Subscribers with at least one preference
309
  <?php $controls->select('preferences_status', array(0=>'ACTIVE', 1=>'NOT ACTIVE')); ?>
@@ -317,18 +320,9 @@ if ($email['editor'] == 0) {
317
  </div>
318
  </td>
319
  </tr>
 
320
  <tr valign="top">
321
- <th>Track clicks and opening?</th>
322
- <td>
323
- <?php $controls->yesno('track'); ?>
324
- <div class="hints">
325
- When this option is enabled, each link in the email text will be rewritten and clicks
326
- on them intercepted.
327
- </div>
328
- </td>
329
- </tr>
330
- <tr valign="top">
331
- <th>Status</th>
332
  <td>
333
  <?php $controls->select('status', array('C'=>'Confirmed', 'S'=>'Not confirmed')); ?>
334
 
@@ -341,7 +335,7 @@ if ($email['editor'] == 0) {
341
  </td>
342
  </tr>
343
  <tr valign="top">
344
- <th>Registered users?</th>
345
  <td>
346
  <?php $controls->yesno('wp_users'); ?>
347
 
@@ -370,10 +364,24 @@ if ($email['editor'] == 0) {
370
 
371
  <div id="tabs-d">
372
  <table class="form-table">
 
 
 
 
 
 
 
 
 
 
373
  <tr valign="top">
374
  <th>Send on</th>
375
  <td>
376
  <?php $controls->datetime('send_on'); ?> (<?php echo date_i18n(get_option('date_format') . ' ' . get_option('time_format')); ?> )
 
 
 
 
377
  </td>
378
  </tr>
379
  <tr valign="top">
@@ -381,11 +389,11 @@ if ($email['editor'] == 0) {
381
  <td><?php echo $email['status']; ?></td>
382
  </tr>
383
  <tr valign="top">
384
- <th>Email sent</th>
385
  <td><?php echo $email['sent']; ?> of <?php echo $email['total']; ?></td>
386
  </tr>
387
  <tr valign="top">
388
- <th>Query</th>
389
  <td><?php echo $email['query']; ?></td>
390
  </tr>
391
  </table>
159
  Newsletter::instance()->send(Newsletter::instance()->get_email($email_id), $users);
160
  $controls->messages .= 'Test emails sent to ' . count($users) . ' test subscribers. Read more about test subscribers <a href="http://www.satollo.net/plugins/newsletter/subscribers-module#test" target="_blank">here</a>.';
161
  }
162
+ $controls->messages .= '<br>If diagnostic emails are delivered but test emails are not, try to change the encoding to "base 64" on main configuration panel';
163
  }
164
 
165
 
212
 
213
  <div class="wrap">
214
 
215
+ <?php //$help_url = 'http://www.satollo.net/plugins/newsletter/newsletters-module'; ?>
216
+ <?php //include NEWSLETTER_DIR . '/header-new.php'; ?>
 
 
217
 
218
+ <div id="newsletter-title">
219
  <h2>Edit Newsletter</h2>
220
+ </div>
221
+ <div class="newsletter-separator"></div>
222
+
223
  <?php
224
  if ($controls->data['status'] == 'S') {
225
  echo '<div class="newsletter-message">Warning! This email is configured to be sent to NOT CONFIRMED subscribers.</div>';
247
  <li><a href="#tabs-a">Message</a></li>
248
  <li><a href="#tabs-b">Message (textual)</a></li>
249
  <li><a href="#tabs-c">Who will receive it</a></li>
250
+ <li><a href="#tabs-d">Other options</a></li>
251
  <!--<li><a href="#tabs-5">Documentation</a></li>-->
252
  </ul>
253
 
297
  <table class="form-table">
298
 
299
  <tr valign="top">
300
+ <th><?php _e('Gender', 'newsletter'); ?></th>
301
  <td>
302
  <?php $controls->checkboxes_group('sex', array('f'=>'Women', 'm'=>'Men', 'n'=>'Not specified')); ?>
303
  <div class="hints">
306
  </td>
307
  </tr>
308
  <tr valign="top">
309
+ <th><?php _e('Subscriber preferences', 'newsletter'); ?></th>
310
  <td>
311
  Subscribers with at least one preference
312
  <?php $controls->select('preferences_status', array(0=>'ACTIVE', 1=>'NOT ACTIVE')); ?>
320
  </div>
321
  </td>
322
  </tr>
323
+
324
  <tr valign="top">
325
+ <th>Subscriber status</th>
 
 
 
 
 
 
 
 
 
 
326
  <td>
327
  <?php $controls->select('status', array('C'=>'Confirmed', 'S'=>'Not confirmed')); ?>
328
 
335
  </td>
336
  </tr>
337
  <tr valign="top">
338
+ <th>Only to WordPress users?</th>
339
  <td>
340
  <?php $controls->yesno('wp_users'); ?>
341
 
364
 
365
  <div id="tabs-d">
366
  <table class="form-table">
367
+ <tr valign="top">
368
+ <th>Track clicks and message opening?</th>
369
+ <td>
370
+ <?php $controls->yesno('track'); ?>
371
+ <div class="hints">
372
+ When this option is enabled, each link in the email text will be rewritten and clicks
373
+ on them intercepted.
374
+ </div>
375
+ </td>
376
+ </tr>
377
  <tr valign="top">
378
  <th>Send on</th>
379
  <td>
380
  <?php $controls->datetime('send_on'); ?> (<?php echo date_i18n(get_option('date_format') . ' ' . get_option('time_format')); ?> )
381
+
382
+ <div class="hints">
383
+ Change this date to schedule this newsletter.
384
+ </div>
385
  </td>
386
  </tr>
387
  <tr valign="top">
389
  <td><?php echo $email['status']; ?></td>
390
  </tr>
391
  <tr valign="top">
392
+ <th>Messages sent</th>
393
  <td><?php echo $email['sent']; ?> of <?php echo $email['total']; ?></td>
394
  </tr>
395
  <tr valign="top">
396
+ <th>Query (tech)</th>
397
  <td><?php echo $email['query']; ?></td>
398
  </tr>
399
  </table>
emails/index.php CHANGED
@@ -49,16 +49,15 @@ $emails = Newsletter::instance()->get_emails('message');
49
  <div class="wrap">
50
 
51
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletters-module'; ?>
52
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
53
-
54
- <h5>Newsletters Module</h5>
55
 
 
56
  <h2>Newsletter List</h2>
57
 
58
- <div class="preamble">
59
  <p>Here you can manage your messages: compose, deliver, monitor.</p>
60
- </div>
61
 
 
 
62
  <?php $controls->show(); ?>
63
 
64
  <form method="post" action="">
49
  <div class="wrap">
50
 
51
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletters-module'; ?>
52
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
 
 
53
 
54
+ <div id="newsletter-title">
55
  <h2>Newsletter List</h2>
56
 
 
57
  <p>Here you can manage your messages: compose, deliver, monitor.</p>
 
58
 
59
+ </div>
60
+ <div class="newsletter-separator"></div>
61
  <?php $controls->show(); ?>
62
 
63
  <form method="post" action="">
emails/new.php CHANGED
@@ -90,12 +90,15 @@ function newsletter_emails_get_theme_options($theme) {
90
 
91
  <div class="wrap">
92
 
93
- <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletters-module'; ?>
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
 
101
  <form method="post" action="<?php echo $module->get_admin_page_url('new'); ?>">
90
 
91
  <div class="wrap">
92
 
93
+ <?php //$help_url = 'http://www.satollo.net/plugins/newsletter/newsletters-module'; ?>
94
+ <?php //include NEWSLETTER_DIR . '/header-new.php'; ?>
95
 
96
+ <div id="newsletter-title">
97
  <h2>New Newsletter</h2>
98
  <p><a href="<?php echo NewsletterEmails::instance()->get_admin_page_url('theme'); ?>">Back to the themes</a></p>
99
+ </div>
100
+ <div class="newsletter-separator"></div>
101
+
102
  <?php $controls->show(); ?>
103
 
104
  <form method="post" action="<?php echo $module->get_admin_page_url('new'); ?>">
emails/theme.php CHANGED
@@ -50,12 +50,16 @@ $themes = $module->themes->get_all_with_data();
50
  <div class="wrap">
51
 
52
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletters-module'; ?>
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
 
61
  <form method="post" id="newsletter-form" action="<?php echo $module->get_admin_page_url('new'); ?>">
50
  <div class="wrap">
51
 
52
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletters-module'; ?>
53
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
54
 
55
+ <div id="newsletter-title">
56
+ <h2>New Newsletter: Theme Selection</h2>
57
 
58
  <p>To create custom themes <a href="http://www.satollo.net/plugins/newsletter/newsletter-themes" target="_blank">read here</a>.</p>
59
+ </div>
60
+
61
+ <div class="newsletter-separator"></div>
62
+
63
  <?php $controls->show(); ?>
64
 
65
  <form method="post" id="newsletter-form" action="<?php echo $module->get_admin_page_url('new'); ?>">
feed/index.php CHANGED
@@ -73,7 +73,7 @@ else {
73
 
74
  <div class="wrap">
75
 
76
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
77
 
78
  <h5>Feed by Mail (Demo)</h5>
79
 
73
 
74
  <div class="wrap">
75
 
76
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
77
 
78
  <h5>Feed by Mail (Demo)</h5>
79
 
header-extension.php ADDED
@@ -0,0 +1,29 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Header file for the extensions administrative panels.
4
+ *
5
+ * - no top noticies
6
+ * - no donation link
7
+ */
8
+ ?>
9
+ <?php if (NEWSLETTER_HEADER) { ?>
10
+ <div id="newsletter-header">
11
+ <a href="http://www.satollo.net/plugins/newsletter/newsletter-documentation" target="_blank">Documentation</a>
12
+ <a href="http://www.satollo.net/forums" target="_blank">Forum</a>
13
+
14
+ <!--<a href="http://www.satollo.net/plugins/newsletter/newsletter-collaboration" target="_blank">Collaboration</a>-->
15
+
16
+ <form style="display: inline; margin: 0;" action="http://www.satollo.net/wp-content/plugins/newsletter/do/subscribe.php" method="post" target="_blank">
17
+ Subscribe<!-- to satollo.net--> <input type="email" name="ne" required placeholder="Your email">
18
+ <input type="submit" value="Go">
19
+ </form>
20
+
21
+ <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>
22
+
23
+ <!--
24
+ <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>
25
+ -->
26
+ </div>
27
+ <?php } ?>
28
+
29
+ <?php $newsletter->warnings(); ?>
header-new.php ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $dismissed = get_option('newsletter_dismissed', array());
3
+
4
+ if (isset($_REQUEST['dismiss']) && check_admin_referer()) {
5
+ $dismissed[$_REQUEST['dismiss']] = 1;
6
+ update_option('newsletter_dismissed', $dismissed);
7
+ }
8
+
9
+ ?>
10
+
11
+ <?php if (isset($dismissed['rate']) && $dismissed['rate'] != 1) { ?>
12
+ <div class="newsletter-notice">
13
+ I never asked before and I'm curious: <a href="http://wordpress.org/extend/plugins/newsletter/" target="_blank">would you rate this plugin</a>?
14
+ (few seconds required). (account on WordPress.org required, every blog owner should have one...). <strong>Really appreciated, Stefano</strong>.
15
+ <div class="newsletter-dismiss"><a href="<?php echo wp_nonce_url($_SERVER['REQUEST_URI'] . '&dismiss=rate')?>">Dismiss</a></div>
16
+ <div style="clear: both"></div>
17
+ </div>
18
+ <?php } ?>
19
+
20
+ <?php if (isset($dismissed['newsletter-page']) && $dismissed['newsletter-page'] != 1 && empty(NewsletterSubscription::instance()->options['url'])) { ?>
21
+ <div class="newsletter-notice">
22
+ Create a page with your blog style to show the subscription form and the subscription messages. Go to the
23
+ <a href="?page=newsletter_subscription_options">subscription panel</a> to
24
+ configure it.
25
+ <div class="newsletter-dismiss"><a href="<?php echo wp_nonce_url($_SERVER['REQUEST_URI'] . '&dismiss=newsletter-page')?>">Dismiss</a></div>
26
+ <div style="clear: both"></div>
27
+ </div>
28
+ <?php } ?>
29
+
30
+
31
+ <?php $newsletter->warnings(); ?>
32
+
33
+
34
+ <?php if (NEWSLETTER_HEADER) { ?>
35
+ <div id="newsletter-header-new">
36
+ <div style="text-align: center">
37
+ <a href="http://www.satollo.net/plugins/newsletter" target="_blank" style="font-weight: bold; font-size: 13px; text-transform: uppercase">Get the Professional Extensions!</a>
38
+ </div>
39
+
40
+ <div style="text-align: center; margin-top: 5px;">
41
+ <a href="http://www.satollo.net/plugins/newsletter/newsletter-documentation" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/header/documentation.png"> Documentation</a>
42
+ <a href="http://www.satollo.net/forums" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/header/forum.png"> Forum</a>
43
+ <a href="https://www.facebook.com/satollo.net" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/header/facebook.png"> Facebook</a>
44
+
45
+ <!--<a href="http://www.satollo.net/plugins/newsletter/newsletter-collaboration" target="_blank">Collaboration</a>-->
46
+ </div>
47
+
48
+ <div style="text-align: center; margin-top: 5px;">
49
+ <form style="margin: 0;" action="http://www.satollo.net/wp-content/plugins/newsletter/do/subscribe.php" method="post" target="_blank">
50
+ My Newsletter<!-- to satollo.net--> <input type="email" name="ne" required placeholder="Your email" style="padding: 2px">
51
+ <input type="submit" value="Go" style="padding: 2px">
52
+ </form>
53
+ </div>
54
+
55
+ <div style="text-align: center; margin-top: 5px;">
56
+ <table style="margin: 0 auto">
57
+ <tr>
58
+ <td style="padding: 2px; border: 0; margin: 0; vertical-align: middle">
59
+ <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>
60
+ </td>
61
+ <td style="padding: 2px; border: 0; margin: 0; vertical-align: middle">
62
+ <a href="http://www.satollo.net/donations" target="_blank">Even <b>2$</b> really help: why?</a> </td>
63
+ </tr>
64
+ </table>
65
+
66
+
67
+ </div>
68
+ <!--
69
+ <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>
70
+ -->
71
+ </div>
72
+ <?php } ?>
73
+
74
+
header.php CHANGED
@@ -11,9 +11,7 @@ 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
- <?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,10 +21,6 @@ if (isset($_REQUEST['dismiss']) && check_admin_referer()) {
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
  -->
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
+
 
 
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
 
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
  <!--
25
  <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>
26
  -->
images/header/documentation.png ADDED
Binary file
images/header/facebook.png ADDED
Binary file
images/header/forum.png ADDED
Binary file
includes/controls.php CHANGED
@@ -443,13 +443,16 @@ class NewsletterControls {
443
  if (empty($options_profile['list_' . $i]))
444
  continue;
445
  echo '<div class="newsletter-preferences-item">';
446
- $this->checkbox($name . '_' . $i, '(' . $i . ') ' . htmlspecialchars($options_profile['list_' . $i]));
447
  echo '</div>';
448
  }
449
  echo '<div style="clear: both"></div>';
450
- echo '<a href="http://www.satollo.net/plugins/newsletter/newsletter-preferences" target="_blank">Click here know more about preferences.</a> They can be configured on Subscription/Form field panel.';
451
  echo '</div>';
452
- }
 
 
 
 
453
 
454
  /**
455
  * Creates a set of checkboxes all names $name[] and the preference number as value
443
  if (empty($options_profile['list_' . $i]))
444
  continue;
445
  echo '<div class="newsletter-preferences-item">';
446
+ $this->checkbox($name . '_' . $i, '<span class="newsletter-badge">' . $i . '</span> ' . htmlspecialchars($options_profile['list_' . $i]));
447
  echo '</div>';
448
  }
449
  echo '<div style="clear: both"></div>';
 
450
  echo '</div>';
451
+ echo '<div class="hints">';
452
+ echo 'User\'s preferences can be activated from the "Subscription Form" panel. They can be used to simulate lists or create private groups. The number is the "preference number". ';
453
+ echo '<a href="http://www.satollo.net/plugins/newsletter/newsletter-preferences" target="_blank">Read more about preferences</a>.';
454
+ echo '</div>';
455
+ }
456
 
457
  /**
458
  * Creates a set of checkboxes all names $name[] and the preference number as value
includes/module.php CHANGED
@@ -514,6 +514,7 @@ class NewsletterModule {
514
  if (!is_file($file)) {
515
  $file = NEWSLETTER_DIR . '/' . $this->module . '/' . $page . '.php';
516
  }
 
517
  $name = 'newsletter_' . $this->module . '_' . $page;
518
  eval('function ' . $name . '(){global $newsletter, $wpdb;require \'' . $file . '\';}');
519
  // Rather stupid system to enable a menu voice... it would suffice to say "to editors"
@@ -526,7 +527,7 @@ class NewsletterModule {
526
  if (!is_file($file)) {
527
  $file = NEWSLETTER_DIR . '/' . $this->module . '/' . $page . '.php';
528
  }
529
-
530
  $name = 'newsletter_' . $this->module . '_' . $page;
531
  eval('function ' . $name . '(){global $newsletter, $wpdb;require \'' . $file . '\';}');
532
  add_submenu_page(null, $title, $title, ($newsletter->options['editor'] == 1) ? 'manage_categories' : 'manage_options', $name, $name);
514
  if (!is_file($file)) {
515
  $file = NEWSLETTER_DIR . '/' . $this->module . '/' . $page . '.php';
516
  }
517
+ $file = str_replace('\\', '\\\\', $file);
518
  $name = 'newsletter_' . $this->module . '_' . $page;
519
  eval('function ' . $name . '(){global $newsletter, $wpdb;require \'' . $file . '\';}');
520
  // Rather stupid system to enable a menu voice... it would suffice to say "to editors"
527
  if (!is_file($file)) {
528
  $file = NEWSLETTER_DIR . '/' . $this->module . '/' . $page . '.php';
529
  }
530
+ $file = str_replace('\\', '\\\\', $file);
531
  $name = 'newsletter_' . $this->module . '_' . $page;
532
  eval('function ' . $name . '(){global $newsletter, $wpdb;require \'' . $file . '\';}');
533
  add_submenu_page(null, $title, $title, ($newsletter->options['editor'] == 1) ? 'manage_categories' : 'manage_options', $name, $name);
main/diagnostic.php CHANGED
@@ -78,47 +78,54 @@ if ($controls->is_action('send_test')) {
78
  $r = $newsletter->mail($controls->data['test_email'], 'Newsletter: pure text email', array('text' => $text));
79
 
80
 
81
- if ($r) $controls->messages .= 'Newsletter TEXT test email sent.<br />';
82
- else $controls->errors .= 'Newsletter TEXT test email NOT sent: try to change the sender data, remove the return path and the reply to settings.<br />';
 
 
83
 
84
  $text = '<p>This is a <strong>html</strong> email sent using the <i>sender data</i> set on Newsletter main setting.</p>';
85
  $text .= '<p>You should see some "mark up", like bold and italic characters.</p>';
86
  $text .= '<p>You should see it to come from the email address you set on basic Newsletter plugin setting.</p>';
87
  $r = $newsletter->mail($controls->data['test_email'], 'Newsletter: pure html email', $text);
88
- if ($r) $controls->messages .= 'Newsletter HTML test email sent.<br />';
89
- else $controls->errors .= 'Newsletter HTML test email NOT sent: try to change the sender data, remove the return path and the reply to settings.<br />';
 
 
90
 
91
 
92
  $text = array();
93
  $text['html'] = '<p>This is an <b>HTML</b> test email part sent using the sender data set on Newsletter main setting.</p>';
94
  $text['text'] = 'This is a textual test email part sent using the sender data set on Newsletter main setting.';
95
  $r = $newsletter->mail($controls->data['test_email'], 'Newsletter: both textual and html email', $text);
96
- if ($r) $controls->messages .= 'Newsletter: both textual and html test email sent.<br />';
97
- else $controls->errors .= 'Newsletter both TEXT and HTML test email NOT sent: try to change the sender data, remove the return path and the reply to settings.<br />';
 
 
98
  }
99
 
100
- if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic');
 
101
  ?>
102
  <div class="wrap">
103
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletter-diagnostic'; ?>
104
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
105
 
106
- <h2>Diagnostic</h2>
107
-
108
- <?php $controls->show(); ?>
109
-
110
- <div class="preamble">
111
- <p>
112
- If something is not working, here are some test procedures and diagnostics. But before you try these,
113
- write down any configuration changes that you may have made.
114
- For example: Did you use sender email or name? What was the return path? What was the reply to?
115
- </p>
116
  </div>
 
 
117
 
 
118
  <form method="post" action="">
119
  <?php $controls->init(); ?>
120
 
121
- <h3>Test</h3>
122
  Email: <?php $controls->text('test_email'); ?>
123
  <?php $controls->button('test_wp', 'Send an email with WordPress'); ?>
124
  <?php $controls->button('send_test', 'Send few emails with Newsletter'); ?>
@@ -214,8 +221,10 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
214
  <td>
215
  <?php
216
  $value = get_transient('newsletter_main_engine');
217
- if ($value) echo (time() - $value) . ' seconds';
218
- else echo 'Not set';
 
 
219
  ?>
220
  <?php $controls->button('delete_transient', 'Delete', null, 'newsletter_main_engine'); ?>
221
  </td>
@@ -239,8 +248,10 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
239
  </td>
240
  <td>
241
  <?php
242
- if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON) echo 'DISABLED. (really bad, see <a href="http://www.satollo.net/?p=2015" target="_tab">this page)</a>';
243
- else echo "ENABLED. (it's ok)";
 
 
244
  ?>
245
  </td>
246
  </tr>
@@ -257,15 +268,15 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
257
  } else {
258
  $found = false;
259
 
260
- foreach ($schedules as $key=>&$data) {
261
- if ($key == 'newsletter') $found = true;
 
262
  echo $key . ' - ' . $data['interval'] . ' s<br>';
 
263
 
264
- }
265
-
266
- if (!$found) {
267
- echo 'The "newsletter" schedule was not found, email delivery won\'t work.';
268
- }
269
  }
270
  ?>
271
  </td>
@@ -302,7 +313,7 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
302
  <?php echo NewsletterModule::format_scheduler_time('newsletter_followup'); ?>
303
  <br>
304
  Indicates when the Follow Up system runs again (usually every hour) to check for new follow up to send out.
305
- <?php //$controls->button('trigger_followup', 'Trigger now'); ?>
306
  </td>
307
  </tr>
308
  <tr>
@@ -353,7 +364,8 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
353
  <tr>
354
  <td>NEWSLETTER_MAX_EXECUTION_TIME</td>
355
  <td>
356
- <?php if (defined('NEWSLETTER_MAX_EXECUTION_TIME')) {
 
357
  echo NEWSLETTER_MAX_EXECUTION_TIME . 'seconds';
358
  } else {
359
  echo 'Not set';
@@ -382,7 +394,7 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
382
  <tr>
383
  <td>WP_DEBUG</td>
384
  <td>
385
- <?php echo WP_DEBUG?'true':'false'; ?>
386
  </td>
387
  </tr>
388
  <tr>
@@ -409,12 +421,15 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
409
  Obsolete.<br>
410
  <?php
411
  $filters = $wp_filter['phpmailer_init'];
412
- if (!is_array($filters)) echo 'No actions attached';
 
413
  else {
414
  foreach ($filters as &$filter) {
415
  foreach ($filter as &$entry) {
416
- if (is_array($entry['function'])) echo get_class($entry['function'][0]) . '->' . $entry['function'][1];
417
- else echo $entry['function'];
 
 
418
  echo '<br />';
419
  }
420
  }
78
  $r = $newsletter->mail($controls->data['test_email'], 'Newsletter: pure text email', array('text' => $text));
79
 
80
 
81
+ if ($r)
82
+ $controls->messages .= 'Newsletter TEXT test email sent.<br />';
83
+ else
84
+ $controls->errors .= 'Newsletter TEXT test email NOT sent: try to change the sender data, remove the return path and the reply to settings.<br />';
85
 
86
  $text = '<p>This is a <strong>html</strong> email sent using the <i>sender data</i> set on Newsletter main setting.</p>';
87
  $text .= '<p>You should see some "mark up", like bold and italic characters.</p>';
88
  $text .= '<p>You should see it to come from the email address you set on basic Newsletter plugin setting.</p>';
89
  $r = $newsletter->mail($controls->data['test_email'], 'Newsletter: pure html email', $text);
90
+ if ($r)
91
+ $controls->messages .= 'Newsletter HTML test email sent.<br />';
92
+ else
93
+ $controls->errors .= 'Newsletter HTML test email NOT sent: try to change the sender data, remove the return path and the reply to settings.<br />';
94
 
95
 
96
  $text = array();
97
  $text['html'] = '<p>This is an <b>HTML</b> test email part sent using the sender data set on Newsletter main setting.</p>';
98
  $text['text'] = 'This is a textual test email part sent using the sender data set on Newsletter main setting.';
99
  $r = $newsletter->mail($controls->data['test_email'], 'Newsletter: both textual and html email', $text);
100
+ if ($r)
101
+ $controls->messages .= 'Newsletter: both textual and html test email sent.<br />';
102
+ else
103
+ $controls->errors .= 'Newsletter both TEXT and HTML test email NOT sent: try to change the sender data, remove the return path and the reply to settings.<br />';
104
  }
105
 
106
+ if (empty($controls->data))
107
+ $controls->data = get_option('newsletter_diagnostic');
108
  ?>
109
  <div class="wrap">
110
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletter-diagnostic'; ?>
111
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
112
 
113
+ <div id="newsletter-title">
114
+ <h2>Newsletter Diagnostic</h2>
115
+ <p>
116
+ If something is not working, here are some test procedures and diagnostics. But before you try these,
117
+ write down any configuration changes that you may have made.
118
+ For example: Did you use sender email or name? What was the return path? What was the reply to?
119
+ </p>
 
 
 
120
  </div>
121
+ <div class="newsletter-separator"></div>
122
+
123
 
124
+ <?php $controls->show(); ?>
125
  <form method="post" action="">
126
  <?php $controls->init(); ?>
127
 
128
+ <h3>Test your mail system</h3>
129
  Email: <?php $controls->text('test_email'); ?>
130
  <?php $controls->button('test_wp', 'Send an email with WordPress'); ?>
131
  <?php $controls->button('send_test', 'Send few emails with Newsletter'); ?>
221
  <td>
222
  <?php
223
  $value = get_transient('newsletter_main_engine');
224
+ if ($value)
225
+ echo (time() - $value) . ' seconds';
226
+ else
227
+ echo 'Not set';
228
  ?>
229
  <?php $controls->button('delete_transient', 'Delete', null, 'newsletter_main_engine'); ?>
230
  </td>
248
  </td>
249
  <td>
250
  <?php
251
+ if (defined('DISABLE_WP_CRON') && DISABLE_WP_CRON)
252
+ echo 'DISABLED. (can be a problem, see the <a href="http://www.satollo.net/plugins/newsletter/newsletter-delivery-engine" target="_tab">delivery engine documentation</a>)';
253
+ else
254
+ echo "ENABLED. (it's ok)";
255
  ?>
256
  </td>
257
  </tr>
268
  } else {
269
  $found = false;
270
 
271
+ foreach ($schedules as $key => &$data) {
272
+ if ($key == 'newsletter')
273
+ $found = true;
274
  echo $key . ' - ' . $data['interval'] . ' s<br>';
275
+ }
276
 
277
+ if (!$found) {
278
+ echo 'The "newsletter" schedule was not found, email delivery won\'t work.';
279
+ }
 
 
280
  }
281
  ?>
282
  </td>
313
  <?php echo NewsletterModule::format_scheduler_time('newsletter_followup'); ?>
314
  <br>
315
  Indicates when the Follow Up system runs again (usually every hour) to check for new follow up to send out.
316
+ <?php //$controls->button('trigger_followup', 'Trigger now'); ?>
317
  </td>
318
  </tr>
319
  <tr>
364
  <tr>
365
  <td>NEWSLETTER_MAX_EXECUTION_TIME</td>
366
  <td>
367
+ <?php
368
+ if (defined('NEWSLETTER_MAX_EXECUTION_TIME')) {
369
  echo NEWSLETTER_MAX_EXECUTION_TIME . 'seconds';
370
  } else {
371
  echo 'Not set';
394
  <tr>
395
  <td>WP_DEBUG</td>
396
  <td>
397
+ <?php echo WP_DEBUG ? 'true' : 'false'; ?>
398
  </td>
399
  </tr>
400
  <tr>
421
  Obsolete.<br>
422
  <?php
423
  $filters = $wp_filter['phpmailer_init'];
424
+ if (!is_array($filters))
425
+ echo 'No actions attached';
426
  else {
427
  foreach ($filters as &$filter) {
428
  foreach ($filter as &$entry) {
429
+ if (is_array($entry['function']))
430
+ echo get_class($entry['function'][0]) . '->' . $entry['function'][1];
431
+ else
432
+ echo $entry['function'];
433
  echo '<br />';
434
  }
435
  }
main/index.php CHANGED
@@ -22,23 +22,23 @@ if ($controls->is_action('check_versions')) {
22
 
23
 
24
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter'; ?>
25
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
26
 
27
- <h2>Welcome and Support</h2>
 
 
 
 
 
 
 
28
 
29
- <?php $controls->show(); ?>
30
 
 
31
  <form method="post" action="">
32
  <?php $controls->init(); ?>
33
 
34
- <h3>Documentation?</h3>
35
-
36
- <p>
37
- With my horrible English, everything can be found starting from <a href="http://www.satollo.net/plugins/newsletter" target="_blank">Newsletter Official page</a>
38
- and every configuration panel has some included documentation just to avoid the most common mistakes.
39
- </p>
40
-
41
- <h3>A few minutes to get the most from Newsletter</h3>
42
 
43
  <ol>
44
  <li>
@@ -99,7 +99,7 @@ if ($controls->is_action('check_versions')) {
99
  <li>
100
  <em>The newsletter is going out too slowly.</em> The <a href="http://www.satollo.net/plugins/newsletter/newsletter-delivery-engine" target="_blank">delivery engine</a> sends
101
  emails as quickly as configured, see the <a href="admin.php?page=newsletter_main_main">main
102
- configuration panel</a>. Look at your provider documentation as well, since it surely has a hourly limit.
103
  </li>
104
  </ol>
105
 
@@ -163,12 +163,12 @@ if ($controls->is_action('check_versions')) {
163
  <a href="http://www.satollo.net/plugins/newsletter/follow-up-module" target="_blank">Follow Up</a>
164
  <br><small>Sends email series after a subscriber signs up</small>
165
  </td>
166
- <?php if (NewsletterModule::extension_exists('followup') && class_exists('NewsletterFollowup')) { ?>
167
  <td><?php echo NewsletterFollowup::instance()->version; ?></td>
168
  <?php } else { ?>
169
  <td>Not installed</td>
170
  <?php } ?>
171
- <td><?php echo get_option('newsletter_followup_available_version'); ?></td>
172
  </tr>
173
  <tr>
174
  <td>
@@ -232,8 +232,8 @@ if ($controls->is_action('check_versions')) {
232
  </tr>
233
  </tbody>
234
  </table>
235
-
236
- <?php $controls->button('check_versions', 'Check for new versions'); ?>
237
 
238
  <h3>Support</h3>
239
  <p>
22
 
23
 
24
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter'; ?>
25
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
26
 
27
+ <div id="newsletter-title">
28
+ <h2>Welcome and Support</h2>
29
+ <p>
30
+ With my horrible English, everything can be found starting from <a href="http://www.satollo.net/plugins/newsletter" target="_blank">Newsletter Official page</a>
31
+ and every configuration panel has some included documentation just to avoid the most common mistakes.
32
+ </p>
33
+ </div>
34
+ <div class="newsletter-separator"></div>
35
 
 
36
 
37
+ <?php $controls->show(); ?>
38
  <form method="post" action="">
39
  <?php $controls->init(); ?>
40
 
41
+ <h3>Few minutes to get the most out of Newsletter</h3>
 
 
 
 
 
 
 
42
 
43
  <ol>
44
  <li>
99
  <li>
100
  <em>The newsletter is going out too slowly.</em> The <a href="http://www.satollo.net/plugins/newsletter/newsletter-delivery-engine" target="_blank">delivery engine</a> sends
101
  emails as quickly as configured, see the <a href="admin.php?page=newsletter_main_main">main
102
+ configuration panel</a>. Look at your provider documentation as well, since it surely has a hourly limit.
103
  </li>
104
  </ol>
105
 
163
  <a href="http://www.satollo.net/plugins/newsletter/follow-up-module" target="_blank">Follow Up</a>
164
  <br><small>Sends email series after a subscriber signs up</small>
165
  </td>
166
+ <?php if (NewsletterModule::extension_exists('followup') && class_exists('NewsletterFollowup')) { ?>
167
  <td><?php echo NewsletterFollowup::instance()->version; ?></td>
168
  <?php } else { ?>
169
  <td>Not installed</td>
170
  <?php } ?>
171
+ <td><?php echo get_option('newsletter_followup_available_version'); ?></td>
172
  </tr>
173
  <tr>
174
  <td>
232
  </tr>
233
  </tbody>
234
  </table>
235
+
236
+ <?php $controls->button('check_versions', 'Check for new versions'); ?>
237
 
238
  <h3>Support</h3>
239
  <p>
main/main.php CHANGED
@@ -95,8 +95,7 @@ if (!$controls->is_action()) {
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">';
@@ -109,10 +108,18 @@ if (!$controls->is_action()) {
109
  <div class="wrap">
110
 
111
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletter-configuration'; ?>
112
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
113
-
114
- <h2>Newsletter Main Configuration</h2>
 
 
 
 
 
 
 
115
 
 
116
  <?php $controls->show(); ?>
117
 
118
  <!--
@@ -124,7 +131,7 @@ if (!$controls->is_action()) {
124
  </p>
125
  </div>
126
  -->
127
-
128
  <form method="post" action="">
129
  <?php $controls->init(); ?>
130
 
@@ -147,7 +154,7 @@ if (!$controls->is_action()) {
147
  to know every details about these settings.
148
  </p>
149
  </div>
150
-
151
  <table class="form-table">
152
 
153
  <tr valign="top">
@@ -344,7 +351,7 @@ if (!$controls->is_action()) {
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).
@@ -352,7 +359,7 @@ if (!$controls->is_action()) {
352
  </td>
353
  </tr>
354
  </table>
355
-
356
 
357
  </div>
358
 
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
+ } else
 
99
  $controls->messages = 'Success.';
100
 
101
  $controls->messages .= '<textarea style="width:100%;height:250px;font-size:10px">';
108
  <div class="wrap">
109
 
110
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletter-configuration'; ?>
111
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
112
+
113
+ <div id="newsletter-title">
114
+ <h2>Newsletter Main Configuration</h2>
115
+ <div class="newsletter-preamble">
116
+ <p>
117
+ The general Newsletter configuration: sender name and email, delivery speed, SMTP and others.
118
+ </p>
119
+ </div>
120
+ </div>
121
 
122
+ <div class="newsletter-separator"></div>
123
  <?php $controls->show(); ?>
124
 
125
  <!--
131
  </p>
132
  </div>
133
  -->
134
+
135
  <form method="post" action="">
136
  <?php $controls->init(); ?>
137
 
154
  to know every details about these settings.
155
  </p>
156
  </div>
157
+
158
  <table class="form-table">
159
 
160
  <tr valign="top">
351
  <th>Test email address</th>
352
  <td>
353
  <?php $controls->text_email('smtp_test_email', 30); ?>
354
+ <?php $controls->button('smtp_test', 'Send a test email to this address'); ?>
355
  <div class="hints">
356
  If the test reports a "connection failed", review your settings and, if correct, contact
357
  your provider to unlock the connection (if possible).
359
  </td>
360
  </tr>
361
  </table>
362
+
363
 
364
  </div>
365
 
plugin.php CHANGED
@@ -4,16 +4,16 @@
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.9
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.
11
 
12
- Copyright 2009-2013 Stefano Lissa (email: stefano@satollo.net, web: http://www.satollo.net)
13
  */
14
 
15
  // Useed as dummy parameter on css and js links
16
- define('NEWSLETTER_VERSION', '3.4.9');
17
 
18
  global $wpdb, $newsletter;
19
 
@@ -110,14 +110,14 @@ class Newsletter extends NewsletterModule {
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,7 +148,7 @@ class Newsletter extends NewsletterModule {
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');
@@ -235,13 +235,13 @@ class Newsletter extends NewsletterModule {
235
 
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
  }
@@ -353,10 +353,16 @@ class Newsletter extends NewsletterModule {
353
  }
354
 
355
  function hook_check_versions() {
356
- $this->logger->info('Checking for new versions');
357
  $url = 'http://www.satollo.net/wp-content/plugins/file-commerce-pro/version.php?f=';
358
- $modules = array('reports' => 34, 'feed' => 35, 'followup' => 37,
359
- 'facebook' => 41, 'sendgrid' => 40, 'popup' => 43, 'mandrill' => 44);
 
 
 
 
 
 
360
 
361
  foreach ($modules as $name => $id) {
362
  $version = @file_get_contents($url . $id);
@@ -388,7 +394,7 @@ class Newsletter extends NewsletterModule {
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
 
@@ -455,6 +461,7 @@ class Newsletter extends NewsletterModule {
455
 
456
  if (isset($user->wp_user_id) && $user->wp_user_id != 0) {
457
  $this->logger->debug('Have wp_user_id: ' . $user->wp_user_id);
 
458
  $wp_user_email = $wpdb->get_var($wpdb->prepare("select user_email from $wpdb->users where id=%d limit 1", $user->wp_user_id));
459
  if (!empty($wp_user_email)) {
460
  $user->email = $wp_user_email;
@@ -472,6 +479,9 @@ class Newsletter extends NewsletterModule {
472
  return true;
473
  }
474
 
 
 
 
475
  function execute($text, $user = null) {
476
  global $wpdb;
477
  ob_start();
@@ -485,7 +495,6 @@ class Newsletter extends NewsletterModule {
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,24 +505,24 @@ class Newsletter extends NewsletterModule {
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;
@@ -549,6 +558,12 @@ class Newsletter extends NewsletterModule {
549
  * @param type $headers
550
  * @return boolean
551
  */
 
 
 
 
 
 
552
  function mail($to, $subject, $message, $headers = null) {
553
 
554
  $this->logger->debug('mail> To: ' . $to);
@@ -558,43 +573,48 @@ class Newsletter extends NewsletterModule {
558
  return true;
559
  }
560
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
561
  if ($this->mailer == null)
562
  $this->mailer_init();
563
 
564
  // Simple message is asumed to be html
565
  if (!is_array($message)) {
566
  $this->mailer->IsHTML(true);
567
- $message = str_replace("\r\n", "\n", $message);
568
- $message = str_replace("\r", "\n", $message);
569
- $message = str_replace("\n", "\r\n", $message);
570
  $this->mailer->Body = $message;
571
  } else {
572
  // Only html is present?
573
  if (empty($message['text'])) {
574
  $this->mailer->IsHTML(true);
575
- $message['html'] = str_replace("\r\n", "\n", $message['html']);
576
- $message['html'] = str_replace("\r", "\n", $message['html']);
577
- $message['html'] = str_replace("\n", "\r\n", $message['html']);
578
  $this->mailer->Body = $message['html'];
579
  }
580
  // Only text is present?
581
  else if (empty($message['html'])) {
582
  $this->mailer->IsHTML(false);
583
- $message['text'] = str_replace("\r\n", "\n", $message['text']);
584
- $message['text'] = str_replace("\r", "\n", $message['text']);
585
- $message['text'] = str_replace("\n", "\r\n", $message['text']);
586
  $this->mailer->Body = $message['text'];
587
  } else {
588
  $this->mailer->IsHTML(true);
589
-
590
- $message['text'] = str_replace("\r\n", "\n", $message['text']);
591
- $message['text'] = str_replace("\r", "\n", $message['text']);
592
- $message['text'] = str_replace("\n", "\r\n", $message['text']);
593
-
594
- $message['html'] = str_replace("\r\n", "\n", $message['html']);
595
- $message['html'] = str_replace("\r", "\n", $message['html']);
596
- $message['html'] = str_replace("\n", "\r\n", $message['html']);
597
-
598
  $this->mailer->Body = $message['html'];
599
  $this->mailer->AltBody = $message['text'];
600
  }
@@ -658,10 +678,13 @@ class Newsletter extends NewsletterModule {
658
  if (!empty($this->options['content_transfer_encoding'])) {
659
  $this->mailer->Encoding = $this->options['content_transfer_encoding'];
660
  }
 
 
 
661
 
662
  $this->mailer->CharSet = 'UTF-8';
663
  $this->mailer->From = $this->options['sender_email'];
664
-
665
  $return_path = $this->options['return_path'];
666
  if (!empty($return_path)) {
667
  $this->mailer->Sender = $return_path;
@@ -684,7 +707,7 @@ class Newsletter extends NewsletterModule {
684
  'display' => 'Newsletter'
685
  );
686
  $schedules['newsletter_weekly'] = array(
687
- 'interval' => 86400*7, // seconds
688
  'display' => 'Newsletter Weekly'
689
  );
690
  return $schedules;
@@ -843,7 +866,7 @@ class Newsletter extends NewsletterModule {
843
 
844
  $text = str_replace('{surname}', $user->surname, $text);
845
  $text = str_replace('{last_name}', $user->surname, $text);
846
-
847
  $full_name = trim($user->name . ' ' . $user->surname);
848
  if (empty($full_name)) {
849
  $text = str_replace(' {full_name}', '', $text);
@@ -851,7 +874,7 @@ class Newsletter extends NewsletterModule {
851
  } else {
852
  $text = str_replace('{full_name}', $full_name, $text);
853
  }
854
-
855
  $text = str_replace('{token}', $user->token, $text);
856
  $text = str_replace('%7Btoken%7D', $user->token, $text);
857
  $text = str_replace('{id}', $user->id, $text);
@@ -1107,7 +1130,7 @@ class Newsletter extends NewsletterModule {
1107
 
1108
  function set_user_status($id_or_email, $status) {
1109
  global $wpdb;
1110
-
1111
  $this->logger->debug('Status change to ' . $status . ' of subscriber ' . $id_or_email . ' from ' . $_SERVER['REQUEST_URI']);
1112
 
1113
  $id_or_email = strtolower(trim($id_or_email));
@@ -1193,4 +1216,3 @@ register_activation_hook(__FILE__, 'newsletter_deactivate');
1193
  function newsletter_deactivate() {
1194
 
1195
  }
1196
-
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.5.0
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.
11
 
12
+ Copyright 2009-2014 Stefano Lissa (email: stefano@satollo.net, web: http://www.satollo.net)
13
  */
14
 
15
  // Useed as dummy parameter on css and js links
16
+ define('NEWSLETTER_VERSION', '3.5.0');
17
 
18
  global $wpdb, $newsletter;
19
 
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');
235
 
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
  }
353
  }
354
 
355
  function hook_check_versions() {
356
+ //$this->logger->info('Checking for new versions');
357
  $url = 'http://www.satollo.net/wp-content/plugins/file-commerce-pro/version.php?f=';
358
+ $modules = array(
359
+ 'reports' => 34,
360
+ 'feed' => 35,
361
+ 'followup' => 37,
362
+ 'facebook' => 41,
363
+ 'sendgrid' => 40,
364
+ 'popup' => 43,
365
+ 'mandrill' => 44);
366
 
367
  foreach ($modules as $name => $id) {
368
  $version = @file_get_contents($url . $id);
394
  }
395
  // Remove the semaphore so the delivery engine can be activated again
396
  $this->delete_transient('engine');
397
+
398
  $this->logger->debug('hook_newsletter> End');
399
  }
400
 
461
 
462
  if (isset($user->wp_user_id) && $user->wp_user_id != 0) {
463
  $this->logger->debug('Have wp_user_id: ' . $user->wp_user_id);
464
+ // TODO: possibly name extraction
465
  $wp_user_email = $wpdb->get_var($wpdb->prepare("select user_email from $wpdb->users where id=%d limit 1", $user->wp_user_id));
466
  if (!empty($wp_user_email)) {
467
  $user->email = $wp_user_email;
479
  return true;
480
  }
481
 
482
+ /**
483
+ * Probably obsolete.
484
+ */
485
  function execute($text, $user = null) {
486
  global $wpdb;
487
  ob_start();
495
 
496
  return ob_get_clean();
497
  }
 
498
 
499
  /**
500
  * This function checks is, during processing, we are getting to near to system limits and should stop any further
505
 
506
  if (!$this->limits_set) {
507
  $this->logger->debug('limits_exceeded> Setting the limits for the first time');
508
+
509
  $max_time = NEWSLETTER_CRON_INTERVAL;
510
+
511
  // Actually it should be set on startup, anyway the scripts use as time base the startup time
512
  if (!empty($this->options['php_time_limit'])) {
513
+ @set_time_limit((int) $this->options['php_time_limit']);
514
+ } else if (defined('NEWSLETTER_MAX_EXECUTION_TIME')) {
 
515
  @set_time_limit(NEWSLETTER_MAX_EXECUTION_TIME);
516
+ }
517
+
518
  $max_time = (int) (@ini_get('max_execution_time') * 0.95);
519
+ if ($max_time == 0 || $max_time > NEWSLETTER_CRON_INTERVAL)
520
+ $max_time = (int) (NEWSLETTER_CRON_INTERVAL * 0.95);
521
+
522
  $this->time_limit = $this->time_start + $max_time;
523
+
524
  $this->logger->info('limits_exceeded> Max time set to ' . $max_time);
525
+
526
  $max = $this->options['scheduler_max'];
527
  if (!is_numeric($max))
528
  $max = 100;
558
  * @param type $headers
559
  * @return boolean
560
  */
561
+ var $mail_method = null;
562
+
563
+ function register_mail_method($callable) {
564
+ $this->mail_method = $callable;
565
+ }
566
+
567
  function mail($to, $subject, $message, $headers = null) {
568
 
569
  $this->logger->debug('mail> To: ' . $to);
573
  return true;
574
  }
575
 
576
+ // Message carrige returns and line feeds clean up
577
+ if (!is_array($message)) {
578
+ $message = str_replace("\r\n", "\n", $message);
579
+ $message = str_replace("\r", "\n", $message);
580
+ $message = str_replace("\n", "\r\n", $message);
581
+ } else {
582
+ if (!empty($message['text'])) {
583
+ $message['text'] = str_replace("\r\n", "\n", $message['text']);
584
+ $message['text'] = str_replace("\r", "\n", $message['text']);
585
+ $message['text'] = str_replace("\n", "\r\n", $message['text']);
586
+ }
587
+
588
+ if (!empty($message['html'])) {
589
+ $message['html'] = str_replace("\r\n", "\n", $message['html']);
590
+ $message['html'] = str_replace("\r", "\n", $message['html']);
591
+ $message['html'] = str_replace("\n", "\r\n", $message['html']);
592
+ }
593
+ }
594
+
595
+ if ($this->mail_method != null) {
596
+ return call_user_func($this->mail_method, $to, $subject, $message, $headers);
597
+ }
598
+
599
  if ($this->mailer == null)
600
  $this->mailer_init();
601
 
602
  // Simple message is asumed to be html
603
  if (!is_array($message)) {
604
  $this->mailer->IsHTML(true);
 
 
 
605
  $this->mailer->Body = $message;
606
  } else {
607
  // Only html is present?
608
  if (empty($message['text'])) {
609
  $this->mailer->IsHTML(true);
 
 
 
610
  $this->mailer->Body = $message['html'];
611
  }
612
  // Only text is present?
613
  else if (empty($message['html'])) {
614
  $this->mailer->IsHTML(false);
 
 
 
615
  $this->mailer->Body = $message['text'];
616
  } else {
617
  $this->mailer->IsHTML(true);
 
 
 
 
 
 
 
 
 
618
  $this->mailer->Body = $message['html'];
619
  $this->mailer->AltBody = $message['text'];
620
  }
678
  if (!empty($this->options['content_transfer_encoding'])) {
679
  $this->mailer->Encoding = $this->options['content_transfer_encoding'];
680
  }
681
+ else {
682
+ $this->mailer->Encoding = 'base64';
683
+ }
684
 
685
  $this->mailer->CharSet = 'UTF-8';
686
  $this->mailer->From = $this->options['sender_email'];
687
+
688
  $return_path = $this->options['return_path'];
689
  if (!empty($return_path)) {
690
  $this->mailer->Sender = $return_path;
707
  'display' => 'Newsletter'
708
  );
709
  $schedules['newsletter_weekly'] = array(
710
+ 'interval' => 86400 * 7, // seconds
711
  'display' => 'Newsletter Weekly'
712
  );
713
  return $schedules;
866
 
867
  $text = str_replace('{surname}', $user->surname, $text);
868
  $text = str_replace('{last_name}', $user->surname, $text);
869
+
870
  $full_name = trim($user->name . ' ' . $user->surname);
871
  if (empty($full_name)) {
872
  $text = str_replace(' {full_name}', '', $text);
874
  } else {
875
  $text = str_replace('{full_name}', $full_name, $text);
876
  }
877
+
878
  $text = str_replace('{token}', $user->token, $text);
879
  $text = str_replace('%7Btoken%7D', $user->token, $text);
880
  $text = str_replace('{id}', $user->id, $text);
1130
 
1131
  function set_user_status($id_or_email, $status) {
1132
  global $wpdb;
1133
+
1134
  $this->logger->debug('Status change to ' . $status . ' of subscriber ' . $id_or_email . ' from ' . $_SERVER['REQUEST_URI']);
1135
 
1136
  $id_or_email = strtolower(trim($id_or_email));
1216
  function newsletter_deactivate() {
1217
 
1218
  }
 
readme.txt CHANGED
@@ -57,6 +57,17 @@ No screen shots are available at this time.
57
 
58
  == Changelog ==
59
 
 
 
 
 
 
 
 
 
 
 
 
60
  = 3.4.9 =
61
 
62
  * Fixed some warnings in debug mode
57
 
58
  == Changelog ==
59
 
60
+ = 3.5.0 =
61
+
62
+ * Fixed the subscriber list panel
63
+ * Interface reviewed
64
+ * Fixed the image chooser for WP 3.8.1
65
+ * Fixed the export for editors
66
+ * Patch for anonymous users create by woocommerce
67
+ * Madrill API adapter
68
+ * Header separation between this plugin and the extensions
69
+ * Default to base 64 encoding of outgoing email to solve the long lines problem
70
+
71
  = 3.4.9 =
72
 
73
  * Fixed some warnings in debug mode
statistics/index.php CHANGED
@@ -13,25 +13,26 @@ if ($controls->is_action('save')) {
13
  <div class="wrap">
14
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/statistics-module'; ?>
15
 
16
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
17
 
18
- <h5>Statistics Module</h5>
 
19
 
20
- <h2>Configuration and Email List</h2>
21
-
22
- <p>
23
- This module is a core part of Newsletter that collects statistics about sent emails: how many have
24
- been read, how many have been clicked and so on.
25
- </p>
26
- <p>
27
- To see the statistics of each single email, you should click the "statistics" button
28
- you will find near each message where they are listed (like on Newsletters panel). For your
29
- convenience, below there is a list of each email sent by Newsletter till now.
30
- </p>
31
- <p>
32
- A more advanced report for each email can be generated installing the Reports Extension
33
- from <a href="http://www.satollo.net/downloads" target="_blank">this page</a>.
34
- </p>
35
 
36
  <table class="widefat" style="width: auto">
37
  <thead>
@@ -73,5 +74,5 @@ if ($controls->is_action('save')) {
73
  </tr>
74
  <?php } ?>
75
  </tbody>
76
- </table>
77
  </div>
13
  <div class="wrap">
14
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/statistics-module'; ?>
15
 
16
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
17
 
18
+ <div id="newsletter-title">
19
+ <h2>Configuration and Email List</h2>
20
 
21
+ <p>
22
+ This module is a core part of Newsletter that collects statistics about sent emails: how many have
23
+ been read, how many have been clicked and so on.
24
+ </p>
25
+ <p>
26
+ To see the statistics of each single email, you should click the "statistics" button
27
+ you will find near each message where they are listed (like on Newsletters panel). For your
28
+ convenience, below there is a list of each email sent by Newsletter till now.
29
+ </p>
30
+ <p>
31
+ A more advanced report for each email can be generated installing the Reports Extension
32
+ from <a href="http://www.satollo.net/downloads" target="_blank">this page</a>.
33
+ </p>
34
+ </div>
35
+ <div class="newsletter-separator"></div>
36
 
37
  <table class="widefat" style="width: auto">
38
  <thead>
74
  </tr>
75
  <?php } ?>
76
  </tbody>
77
+ </table>
78
  </div>
statistics/view.php CHANGED
@@ -4,18 +4,17 @@ $email = $module->get_email($_GET['id']);
4
  ?>
5
  <div class="wrap">
6
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/statistics-module'; ?>
7
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
8
 
9
- <h5>Statistics</h5>
 
10
 
11
- <h2>Statistics for "<?php echo esc_html($email->subject); ?>"</h2>
12
-
13
- <div class="preamble">
14
  <p>
15
  Complete statistics for this email are available with
16
  <a href="http://www.satollo.net/plugins/newsletter/reports-module" target="_blank">Reports for Newsletter</a>.
17
  </p>
18
  </div>
 
19
 
20
  <table class="widefat" style="width: auto">
21
  <thead>
4
  ?>
5
  <div class="wrap">
6
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/statistics-module'; ?>
7
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
8
 
9
+ <div id="newsletter-title">
10
+ <h2>Statistics for "<?php echo esc_html($email->subject); ?>"</h2>
11
 
 
 
 
12
  <p>
13
  Complete statistics for this email are available with
14
  <a href="http://www.satollo.net/plugins/newsletter/reports-module" target="_blank">Reports for Newsletter</a>.
15
  </p>
16
  </div>
17
+ <div class="newsletter-separator"></div>
18
 
19
  <table class="widefat" style="width: auto">
20
  <thead>
subscription/forms.php CHANGED
@@ -15,31 +15,30 @@ if ($controls->is_action('save')) {
15
 
16
  <div class="wrap">
17
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletter-forms'; ?>
18
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
19
 
20
- <?php include NEWSLETTER_DIR . '/subscription/menu.inc.php'; ?>
21
-
22
- <h2>Alternative Hand-Coded Forms</h2>
23
 
24
- <?php $controls->show(); ?>
25
-
26
- <div class="preamble">
27
  <p>
28
  Here you can store your hand coded forms to recall them from short codes.
29
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-forms" target="_blank">Read more about forms</a>.
30
  </p>
31
  </div>
 
32
 
 
33
  <form method="post" action="">
34
  <?php $controls->init(); ?>
35
 
36
  <div id="tabs">
37
 
38
  <ul>
39
- <li><a href="#tabs-1">Forms</a></li>
40
  </ul>
41
 
42
- <div id="tabs-1">
43
  <table class="form-table">
44
  <?php for ($i = 1; $i <= 10; $i++) { ?>
45
  <tr valign="top">
15
 
16
  <div class="wrap">
17
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/newsletter-forms'; ?>
18
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
19
 
20
+ <div id="newsletter-title">
21
+ <?php include NEWSLETTER_DIR . '/subscription/menu.inc.php'; ?>
 
22
 
23
+ <h2>Alternative Hand-Coded Forms</h2>
 
 
24
  <p>
25
  Here you can store your hand coded forms to recall them from short codes.
26
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-forms" target="_blank">Read more about forms</a>.
27
  </p>
28
  </div>
29
+ <div class="newsletter-separator"></div>
30
 
31
+ <?php $controls->show(); ?>
32
  <form method="post" action="">
33
  <?php $controls->init(); ?>
34
 
35
  <div id="tabs">
36
 
37
  <ul>
38
+ <li><a href="#tabs-forms">Forms</a></li>
39
  </ul>
40
 
41
+ <div id="tabs-forms">
42
  <table class="form-table">
43
  <?php for ($i = 1; $i <= 10; $i++) { ?>
44
  <tr valign="top">
subscription/menu.inc.php CHANGED
@@ -1,4 +1,4 @@
1
- <h5>Subscription Module</h5>
2
  <div id="newsletter-nav">
3
  <a class="button" href="<?php echo $module->get_admin_page_url('options'); ?>">Subscription steps</a>
4
  <a class="button" href="<?php echo $module->get_admin_page_url('profile'); ?>">Form fields and translation</a>
1
+ <!--<h5>Subscription Module</h5>-->
2
  <div id="newsletter-nav">
3
  <a class="button" href="<?php echo $module->get_admin_page_url('options'); ?>">Subscription steps</a>
4
  <a class="button" href="<?php echo $module->get_admin_page_url('profile'); ?>">Form fields and translation</a>
subscription/options.php CHANGED
@@ -47,7 +47,7 @@ if ($controls->is_action()) {
47
  if (empty($controls->data['unsubscribed_text'])) {
48
  $controls->data['unsubscribed_text'] = $defaults['unsubscribed_text'];
49
  }
50
-
51
  $controls->data['confirmed_message'] = NewsletterModule::clean_url_tags($controls->data['confirmed_message']);
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']);
@@ -119,29 +119,30 @@ if ($controls->is_action('create')) {
119
 
120
  <div class="wrap">
121
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscription-module'; ?>
122
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
123
 
124
- <?php include NEWSLETTER_DIR . '/subscription/menu.inc.php'; ?>
 
125
 
126
- <h2>Subscription, Unsubscription, Profile Page Configuration</h2>
127
 
128
- <?php $controls->show(); ?>
129
 
130
- <div class="preamble">
131
- <p>
132
- In this panel you can configure the subscription and cancellation process, set up every message, the single or double opt in and
133
- even a customized subscription form.
134
- </p>
135
- <p>
136
- Emails sent during subscription process are themed with the file subscription/email.php. Open that file to learn how to customize it.
137
- </p>
138
- <p>
139
- Page layout where messages are shown is managed by subscription/page.php file which contains instruction on how to
140
- customize it OR use a WordPress page for messages as described on subscription configuration.
141
- </p>
142
- </div>
143
 
144
 
 
145
  <form method="post" action="">
146
  <?php $controls->init(); ?>
147
  <div id="tabs">
@@ -209,8 +210,8 @@ if ($controls->is_action('create')) {
209
  </td>
210
  </tr>
211
  </table>
212
-
213
-
214
  </div>
215
 
216
 
@@ -237,9 +238,9 @@ if ($controls->is_action('create')) {
237
  </td>
238
  </tr>
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>
@@ -248,7 +249,7 @@ if ($controls->is_action('create')) {
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>
@@ -270,7 +271,7 @@ if ($controls->is_action('create')) {
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>
@@ -450,7 +451,7 @@ if ($controls->is_action('create')) {
450
  </div>
451
 
452
 
453
-
454
 
455
  <div id="tabs-7">
456
 
@@ -489,12 +490,12 @@ if ($controls->is_action('create')) {
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>
47
  if (empty($controls->data['unsubscribed_text'])) {
48
  $controls->data['unsubscribed_text'] = $defaults['unsubscribed_text'];
49
  }
50
+
51
  $controls->data['confirmed_message'] = NewsletterModule::clean_url_tags($controls->data['confirmed_message']);
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']);
119
 
120
  <div class="wrap">
121
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscription-module'; ?>
122
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
123
 
124
+ <div id="newsletter-title">
125
+ <?php include NEWSLETTER_DIR . '/subscription/menu.inc.php'; ?>
126
 
127
+ <h2>Subscription, Unsubscription, Profile Page Configuration</h2>
128
 
 
129
 
130
+ <p>
131
+ In this panel you can configure the subscription and cancellation process, set up every message, the single or double opt in and
132
+ even a customized subscription form.
133
+ </p>
134
+ <p>
135
+ Emails sent during subscription process are themed with the file subscription/email.php. Open that file to learn how to customize it.
136
+ </p>
137
+ <p>
138
+ Page layout where messages are shown is managed by subscription/page.php file which contains instruction on how to
139
+ customize it OR use a WordPress page for messages as described on subscription configuration.
140
+ </p>
141
+ </div>
142
+ <div class="newsletter-separator"></div>
143
 
144
 
145
+ <?php $controls->show(); ?>
146
  <form method="post" action="">
147
  <?php $controls->init(); ?>
148
  <div id="tabs">
210
  </td>
211
  </tr>
212
  </table>
213
+
214
+
215
  </div>
216
 
217
 
238
  </td>
239
  </tr>
240
  </table>
241
+
242
  <h3>Special cases</h3>
243
+
244
  <table class="form-table">
245
  <tr valign="top">
246
  <th>Already subscribed page content</th>
249
  <?php $controls->checkbox('resend_welcome_email_disabled', 'Do not resend the welcome email'); ?>
250
  <div class="hints">
251
  Shown when the email is already subscribed and confirmed. The welcome email, is not disabled, will
252
+ be sent. Find out more on this topic on its
253
  <a href="http://www.satollo.net/plugins/newsletter/subscription-module#repeated" target="_blank">documentation page</a>.
254
  </div>
255
  </td>
271
  <div class="tab-preamble">
272
  <p>This configuration applies only when in double opt-in mode.</p>
273
  </div>
274
+
275
  <table class="form-table">
276
  <tr valign="top">
277
  <th>Confirmation required message</th>
451
  </div>
452
 
453
 
454
+
455
 
456
  <div id="tabs-7">
457
 
490
  Insert the profile form with user's data. Usually it make sense only on welcome page.<br />
491
  </p>
492
  </div>
493
+
494
+
495
  <div id="tabs-wp">
496
  <div class="tab-preamble">
497
  <p>Configure if and how a regular WordPress user registration can be connected to a Newsletter subscription.</p>
498
+ <p>Important! This type of subscription does not require confirmation, it's automatic on first login.
499
  <a href="http://www.satollo.net/plugins/newsletter/subscription-module#registration" target="_blank">Read more on documentation page</a>.
500
  </p>
501
  </div>
subscription/profile.php CHANGED
@@ -5,8 +5,7 @@ $module = NewsletterSubscription::instance();
5
 
6
  if (!$controls->is_action()) {
7
  $controls->data = get_option('newsletter_profile');
8
- }
9
- else {
10
  if ($controls->is_action('save')) {
11
  update_option('newsletter_profile', $controls->data);
12
  }
@@ -20,186 +19,187 @@ else {
20
  }
21
  }
22
 
23
- $status = array(0=>'Disabled/Private use', 1=>'Only on profile page', 2=>'Even on subscription forms');
24
- $rules = array(0=>'Optional', 1=>'Required');
25
  ?>
26
  <script type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-content/plugins/newsletter/tiny_mce/tiny_mce.js"></script>
27
  <script type="text/javascript">
28
  tinyMCE.init({
29
- mode : "specific_textareas",
30
- editor_selector : "visual",
31
- theme : "advanced",
32
- theme_advanced_disable : "styleselect",
33
- relative_urls : false,
34
- remove_script_host : false,
35
  theme_advanced_buttons3: "",
36
- theme_advanced_toolbar_location : "top",
37
- theme_advanced_resizing : true,
38
  theme_advanced_statusbar_location: "bottom",
39
- document_base_url : "<?php echo get_option('home'); ?>/",
40
- content_css : "<?php echo get_option('blogurl'); ?>/wp-content/plugins/newsletter/editor.css?" + new Date().getTime()
41
  });
42
  </script>
43
 
44
  <div class="wrap">
45
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscription-module'; ?>
46
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
47
 
48
- <?php include NEWSLETTER_DIR . '/subscription/menu.inc.php'; ?>
 
49
 
50
- <h2>Subscription Form Fields and Layout</h2>
 
 
 
 
 
51
 
52
- <div class="preamble">
53
- <p>
54
- This panel contains the configuration of the subscription and profile editing forms which collect the subscriber data you want to have.<br>
55
- And let you to <strong>translate</strong> every single button and label.<br>
56
- <strong>Preferences</strong> can be an important setting for your newsletter: <a href="http://www.satollo.net/plugins/newsletter/newsletter-preferences" target="_blank">here you can read more about them</a>.
57
- </p>
58
  </div>
 
59
 
60
- <?php $controls->show(); ?>
61
 
 
62
  <form action="" method="post">
63
- <?php $controls->init(); ?>
64
 
65
  <div id="tabs">
66
 
67
- <ul>
68
- <li><a href="#tabs-2">Main profile fields</a></li>
69
- <li><a href="#tabs-3">Extra profile fields</a></li>
70
- <li><a href="#tabs-4">Preferences</a></li>
71
- <li><a href="#tabs-5">Form code</a></li>
72
- <li><a href="#tabs-6">Form style</a></li>
73
- </ul>
74
 
75
- <div id="tabs-2">
76
- <div class="tab-preamble">
77
- <p>The main subscriber fields. Only the email field is, of course, mandatory.</p>
78
  </div>
79
- <table class="form-table">
80
- <tr>
81
- <th>Email</th>
82
- <td>
83
- <table class="newsletter-option-grid">
84
- <tr><th>Field label</th><td><?php $controls->text('email', 50); ?></td></tr>
85
- <tr><th>Error message</th><td><?php $controls->text('email_error', 50); ?></td></tr>
86
- </table>
87
- </td>
88
- </tr>
89
- <tr>
90
- <th>Name or first name</th>
91
- <td>
92
- <table class="newsletter-option-grid">
93
- <tr><th>Field label</th><td><?php $controls->text('name', 50); ?></td></tr>
94
- <tr><th>When to show</th><td><?php $controls->select('name_status', $status); ?></td></tr>
95
- <tr><th>Rules</th><td><?php $controls->select('name_rules', $rules); ?></td></tr>
96
- <tr><th>Error message</th><td><?php $controls->text('name_error', 50); ?></td></tr>
97
- </table>
98
- <div class="hints">
99
- If you want to collect only a generic "name", use only this field and not the
100
- last name field.
101
- </div>
102
- </td>
103
- </tr>
104
- <tr>
105
- <th>Last name</th>
106
- <td>
107
- <table class="newsletter-option-grid">
108
- <tr><th>Field label</th><td><?php $controls->text('surname', 50); ?></td></tr>
109
- <tr><th>When to show</th><td><?php $controls->select('surname_status', $status); ?></td></tr>
110
- <tr><th>Rules</th><td><?php $controls->select('surname_rules', $rules); ?></td></tr>
111
- <tr><th>Error message</th><td><?php $controls->text('surname_error', 50); ?></td></tr>
112
- </table>
113
- </td>
114
- </tr>
115
- <tr>
116
- <th>Sex/Gender</th>
117
- <td>
118
- <table class="newsletter-option-grid">
119
- <tr><th>Field label</th><td><?php $controls->text('sex', 50); ?></td></tr>
120
- <tr><th>When to show</th><td><?php $controls->select('sex_status', $status); ?></td></tr>
121
- <tr><th>Value labels</th><td>
122
- female: <?php $controls->text('sex_female'); ?>
123
- male: <?php $controls->text('sex_male'); ?>
124
- not specified: <?php $controls->text('sex_none'); ?>
125
- </td></tr>
126
-
127
- <tr><th>Salutation titles</th><td>
128
-
129
- for males: <?php $controls->text('title_male'); ?> (ex. "Mr")<br>
130
- for females: <?php $controls->text('title_female'); ?> (ex. "Mrs")<br>
131
- for others: <?php $controls->text('title_none'); ?>
132
- </td></tr>
133
- </table>
134
- <div class="hints">
135
- Salutation titles are inserted in emails message when the tag {title} is used. For example
136
- "Good morning {title} {surname} {name}".
137
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
138
  </td>
139
  </tr>
140
-
141
- <tr>
142
- <th>Button labels</th>
143
- <td>
144
- <table class="newsletter-option-grid">
145
- <tr><th>Subscribe button</th><td><?php $controls->text('subscribe'); ?></td></tr>
146
- <tr><th>Save button</th><td><?php $controls->text('save'); ?> (on profile page)</td></tr>
147
- </table>
148
- <div class="hints">
149
- For "subscribe" insert an URL to an image (http://...) to use it as a graphical button.
150
- </div>
151
- </td>
152
- </tr>
153
- <tr>
154
- <th>Privacy check box</th>
155
- <td>
156
- <table class="newsletter-option-grid">
157
- <tr><th>Enabled?</th><?php $controls->yesno('privacy_status'); ?></td></tr>
158
- <tr><th>Label</th><td><?php $controls->text('privacy', 50); ?></td></tr>
159
- <tr><th>Error message</th><td><?php $controls->text('privacy_error', 50); ?></td></tr>
160
- <tr><th>Privacy URL</th><td><?php $controls->text('privacy_url', 50); ?></td></tr>
161
- </table>
162
- </td>
163
  </tr>
164
-
165
 
166
- </table>
167
- </div>
168
 
 
 
169
 
170
- <div id="tabs-3">
171
- <table class="form-table">
172
- <tr>
173
- <th>Generic profile fields</th>
174
- <td>
175
- <div class="hints">Fields of type "list" must be configured with a set of options, comma separated
176
- like: "first option, second option, third option".
177
- </div>
178
- <table class="widefat">
179
- <thead>
180
  <tr>
181
- <th>Field</th><th>Label</th><th>When/Where</th><th>Type</th><th>Configuration</th>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
182
  </tr>
183
- </thead>
184
- <?php for ($i=1; $i<=NEWSLETTER_PROFILE_MAX; $i++) { ?>
185
- <tr>
186
- <td>Profile <?php echo $i; ?></td>
187
- <td><?php $controls->text('profile_' . $i); ?></td>
188
- <td><?php $controls->select('profile_' . $i . '_status', $status); ?></td>
189
- <td><?php $controls->select('profile_' . $i . '_type', array('text'=>'Text', 'select'=>'List')); ?></td>
190
- <td>
191
- <?php $controls->textarea_fixed('profile_' . $i . '_options', '300px', '50px'); ?>
192
- </td>
193
- </tr>
194
- <?php } ?>
195
- </table>
196
- <div class="hints">
197
- Those fields are collected as texts, Newsletter Pro does not give meaning to them, it just stores them.
198
- </div>
199
- </td>
200
- </tr>
201
- </table>
202
- </div>
203
 
204
 
205
  <div id="tabs-4">
@@ -225,7 +225,7 @@ $rules = array(0=>'Optional', 1=>'Required');
225
  <td>Preference <?php echo $i; ?></td>
226
  <td><?php $controls->select('list_' . $i . '_status', $status); ?></td>
227
  <td><?php $controls->text('list_' . $i); ?></td>
228
- <td><?php $controls->select('list_' . $i . '_checked', array(0=>'Uncheked', 1=>'Checked')); ?></td>
229
  </tr>
230
  <?php } ?>
231
  </table>
@@ -241,35 +241,35 @@ $rules = array(0=>'Optional', 1=>'Required');
241
 
242
  <div id="tabs-5">
243
  <div class="tab-preamble">
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">
256
  <div class="tab-preamble">
257
- <p></p>
258
  </div>
259
- <table class="form-table">
260
  <tr>
261
  <th>Subscription form style</th>
262
  <td>
263
- <?php $controls->select('style', $module->get_styles()); ?>
264
  </td>
265
  </tr>
266
  <tr>
267
  <th>Widget style</th>
268
  <td>
269
- <?php $controls->select('widget_style', $module->get_styles()); ?>
270
  </td>
271
  </tr>
272
- </table>
273
  </div>
274
 
275
  </div>
5
 
6
  if (!$controls->is_action()) {
7
  $controls->data = get_option('newsletter_profile');
8
+ } else {
 
9
  if ($controls->is_action('save')) {
10
  update_option('newsletter_profile', $controls->data);
11
  }
19
  }
20
  }
21
 
22
+ $status = array(0 => 'Disabled/Private use', 1 => 'Only on profile page', 2 => 'Even on subscription forms');
23
+ $rules = array(0 => 'Optional', 1 => 'Required');
24
  ?>
25
  <script type="text/javascript" src="<?php echo get_option('siteurl'); ?>/wp-content/plugins/newsletter/tiny_mce/tiny_mce.js"></script>
26
  <script type="text/javascript">
27
  tinyMCE.init({
28
+ mode: "specific_textareas",
29
+ editor_selector: "visual",
30
+ theme: "advanced",
31
+ theme_advanced_disable: "styleselect",
32
+ relative_urls: false,
33
+ remove_script_host: false,
34
  theme_advanced_buttons3: "",
35
+ theme_advanced_toolbar_location: "top",
36
+ theme_advanced_resizing: true,
37
  theme_advanced_statusbar_location: "bottom",
38
+ document_base_url: "<?php echo get_option('home'); ?>/",
39
+ content_css: "<?php echo get_option('blogurl'); ?>/wp-content/plugins/newsletter/editor.css?" + new Date().getTime()
40
  });
41
  </script>
42
 
43
  <div class="wrap">
44
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscription-module'; ?>
45
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
46
 
47
+ <div id="newsletter-title">
48
+ <?php include NEWSLETTER_DIR . '/subscription/menu.inc.php'; ?>
49
 
50
+ <h2>Subscription Form Fields and Layout</h2>
51
+ <p>
52
+ This panel contains the configuration of the subscription and profile editing forms which collect the subscriber data you want to have.<br>
53
+ And let you to <strong>translate</strong> every single button and label.<br>
54
+ <strong>Preferences</strong> can be an important setting for your newsletter: <a href="http://www.satollo.net/plugins/newsletter/newsletter-preferences" target="_blank">here you can read more about them</a>.
55
+ </p>
56
 
 
 
 
 
 
 
57
  </div>
58
+ <div class="newsletter-separator"></div>
59
 
 
60
 
61
+ <?php $controls->show(); ?>
62
  <form action="" method="post">
63
+ <?php $controls->init(); ?>
64
 
65
  <div id="tabs">
66
 
67
+ <ul>
68
+ <li><a href="#tabs-2">Main profile fields</a></li>
69
+ <li><a href="#tabs-3">Extra profile fields</a></li>
70
+ <li><a href="#tabs-4">Preferences</a></li>
71
+ <li><a href="#tabs-5">Form code</a></li>
72
+ <li><a href="#tabs-6">Form style</a></li>
73
+ </ul>
74
 
75
+ <div id="tabs-2">
76
+ <div class="tab-preamble">
77
+ <p>The main subscriber fields. Only the email field is, of course, mandatory.</p>
78
  </div>
79
+ <table class="form-table">
80
+ <tr>
81
+ <th>Email</th>
82
+ <td>
83
+ <table class="newsletter-option-grid">
84
+ <tr><th>Field label</th><td><?php $controls->text('email', 50); ?></td></tr>
85
+ <tr><th>Error message</th><td><?php $controls->text('email_error', 50); ?></td></tr>
86
+ </table>
87
+ </td>
88
+ </tr>
89
+ <tr>
90
+ <th>Name or first name</th>
91
+ <td>
92
+ <table class="newsletter-option-grid">
93
+ <tr><th>Field label</th><td><?php $controls->text('name', 50); ?></td></tr>
94
+ <tr><th>When to show</th><td><?php $controls->select('name_status', $status); ?></td></tr>
95
+ <tr><th>Rules</th><td><?php $controls->select('name_rules', $rules); ?></td></tr>
96
+ <tr><th>Error message</th><td><?php $controls->text('name_error', 50); ?></td></tr>
97
+ </table>
98
+ <div class="hints">
99
+ If you want to collect only a generic "name", use only this field and not the
100
+ last name field.
101
+ </div>
102
+ </td>
103
+ </tr>
104
+ <tr>
105
+ <th>Last name</th>
106
+ <td>
107
+ <table class="newsletter-option-grid">
108
+ <tr><th>Field label</th><td><?php $controls->text('surname', 50); ?></td></tr>
109
+ <tr><th>When to show</th><td><?php $controls->select('surname_status', $status); ?></td></tr>
110
+ <tr><th>Rules</th><td><?php $controls->select('surname_rules', $rules); ?></td></tr>
111
+ <tr><th>Error message</th><td><?php $controls->text('surname_error', 50); ?></td></tr>
112
+ </table>
113
+ </td>
114
+ </tr>
115
+ <tr>
116
+ <th>Sex/Gender</th>
117
+ <td>
118
+ <table class="newsletter-option-grid">
119
+ <tr><th>Field label</th><td><?php $controls->text('sex', 50); ?></td></tr>
120
+ <tr><th>When to show</th><td><?php $controls->select('sex_status', $status); ?></td></tr>
121
+ <tr><th>Value labels</th><td>
122
+ female: <?php $controls->text('sex_female'); ?>
123
+ male: <?php $controls->text('sex_male'); ?>
124
+ not specified: <?php $controls->text('sex_none'); ?>
125
+ </td></tr>
126
+
127
+ <tr><th>Salutation titles</th><td>
128
+
129
+ for males: <?php $controls->text('title_male'); ?> (ex. "Mr")<br>
130
+ for females: <?php $controls->text('title_female'); ?> (ex. "Mrs")<br>
131
+ for others: <?php $controls->text('title_none'); ?>
132
+ </td></tr>
133
+ </table>
134
+ <div class="hints">
135
+ Salutation titles are inserted in emails message when the tag {title} is used. For example
136
+ "Good morning {title} {surname} {name}".
137
+ </div>
138
+ </td>
139
+ </tr>
140
+
141
+ <tr>
142
+ <th>Button labels</th>
143
+ <td>
144
+ <table class="newsletter-option-grid">
145
+ <tr><th>Subscribe button</th><td><?php $controls->text('subscribe'); ?></td></tr>
146
+ <tr><th>Save button</th><td><?php $controls->text('save'); ?> (on profile page)</td></tr>
147
+ </table>
148
+ <div class="hints">
149
+ For "subscribe" insert an URL to an image (http://...) to use it as a graphical button.
150
+ </div>
151
  </td>
152
  </tr>
153
+ <tr>
154
+ <th>Privacy check box</th>
155
+ <td>
156
+ <table class="newsletter-option-grid">
157
+ <tr><th>Enabled?</th><?php $controls->yesno('privacy_status'); ?></td></tr>
158
+ <tr><th>Label</th><td><?php $controls->text('privacy', 50); ?></td></tr>
159
+ <tr><th>Error message</th><td><?php $controls->text('privacy_error', 50); ?></td></tr>
160
+ <tr><th>Privacy URL</th><td><?php $controls->text('privacy_url', 50); ?></td></tr>
161
+ </table>
162
+ </td>
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  </tr>
 
164
 
 
 
165
 
166
+ </table>
167
+ </div>
168
 
169
+
170
+ <div id="tabs-3">
171
+ <table class="form-table">
 
 
 
 
 
 
 
172
  <tr>
173
+ <th>Generic profile fields</th>
174
+ <td>
175
+ <div class="hints">Fields of type "list" must be configured with a set of options, comma separated
176
+ like: "first option, second option, third option".
177
+ </div>
178
+ <table class="widefat">
179
+ <thead>
180
+ <tr>
181
+ <th>Field</th><th>Label</th><th>When/Where</th><th>Type</th><th>Configuration</th>
182
+ </tr>
183
+ </thead>
184
+ <?php for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i++) { ?>
185
+ <tr>
186
+ <td>Profile <?php echo $i; ?></td>
187
+ <td><?php $controls->text('profile_' . $i); ?></td>
188
+ <td><?php $controls->select('profile_' . $i . '_status', $status); ?></td>
189
+ <td><?php $controls->select('profile_' . $i . '_type', array('text' => 'Text', 'select' => 'List')); ?></td>
190
+ <td>
191
+ <?php $controls->textarea_fixed('profile_' . $i . '_options', '300px', '50px'); ?>
192
+ </td>
193
+ </tr>
194
+ <?php } ?>
195
+ </table>
196
+ <div class="hints">
197
+ Those fields are collected as texts, Newsletter Pro does not give meaning to them, it just stores them.
198
+ </div>
199
+ </td>
200
  </tr>
201
+ </table>
202
+ </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
 
204
 
205
  <div id="tabs-4">
225
  <td>Preference <?php echo $i; ?></td>
226
  <td><?php $controls->select('list_' . $i . '_status', $status); ?></td>
227
  <td><?php $controls->text('list_' . $i); ?></td>
228
+ <td><?php $controls->select('list_' . $i . '_checked', array(0 => 'Uncheked', 1 => 'Checked')); ?></td>
229
  </tr>
230
  <?php } ?>
231
  </table>
241
 
242
  <div id="tabs-5">
243
  <div class="tab-preamble">
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">
256
  <div class="tab-preamble">
257
+ <p></p>
258
  </div>
259
+ <table class="form-table">
260
  <tr>
261
  <th>Subscription form style</th>
262
  <td>
263
+ <?php $controls->select('style', $module->get_styles()); ?>
264
  </td>
265
  </tr>
266
  <tr>
267
  <th>Widget style</th>
268
  <td>
269
+ <?php $controls->select('widget_style', $module->get_styles()); ?>
270
  </td>
271
  </tr>
272
+ </table>
273
  </div>
274
 
275
  </div>
subscription/subscription.php CHANGED
@@ -1009,6 +1009,8 @@ function newsletter_subscription_user_register($wp_user_id) {
1009
  $module->logger->error('User not found?!');
1010
  return;
1011
  }
 
 
1012
 
1013
  $_REQUEST['ne'] = $wp_user->user_email;
1014
  $_REQUEST['nr'] = 'registration';
1009
  $module->logger->error('User not found?!');
1010
  return;
1011
  }
1012
+
1013
+ if (!NewsletterModule::is_email($wp_user->user_email)) return;
1014
 
1015
  $_REQUEST['ne'] = $wp_user->user_email;
1016
  $_REQUEST['nr'] = 'registration';
users/csv.php CHANGED
@@ -1,15 +1,19 @@
1
  <?php
2
 
3
- // This page is linked to {subscription_confirm_url} tag.
4
 
5
  require_once '../../../../wp-load.php';
6
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
7
 
8
  // TODO: Check the user capabilities
9
- if (!current_user_can('administrator')) die('Only administrators allowed.');
 
10
 
11
- $controls = new NewsletterControls();
12
-
13
- if ($controls->is_action('export')) {
14
- NewsletterUsers::instance()->export();
 
15
  }
 
 
1
  <?php
2
 
3
+ global $newsletter;
4
 
5
  require_once '../../../../wp-load.php';
6
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
7
 
8
  // TODO: Check the user capabilities
9
+ if (current_user_can('manage_options') || ($newsletter->options['editor'] == 1 && current_user_can('manage_categories'))) {
10
+ $controls = new NewsletterControls();
11
 
12
+ if ($controls->is_action('export')) {
13
+ NewsletterUsers::instance()->export();
14
+ }
15
+ } else {
16
+ die('Not allowed.');
17
  }
18
+
19
+
users/edit.php CHANGED
@@ -36,10 +36,14 @@ $options_profile = get_option('newsletter_profile');
36
  ?>
37
  <div class="wrap">
38
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
39
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
40
- <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
 
 
41
 
42
  <h2>Subscriber Edit</h2>
 
 
43
 
44
  <?php $controls->show(); ?>
45
 
@@ -49,13 +53,13 @@ $options_profile = get_option('newsletter_profile');
49
  <div id="tabs">
50
 
51
  <ul>
52
- <li><a href="#tabs-1">General</a></li>
53
- <li><a href="#tabs-2">Preferences</a></li>
54
- <li><a href="#tabs-3">Profile</a></li>
55
- <li><a href="#tabs-4">Other</a></li>
56
  </ul>
57
 
58
- <div id="tabs-1">
59
 
60
  <table class="form-table">
61
  <tr valign="top">
@@ -69,8 +73,7 @@ $options_profile = get_option('newsletter_profile');
69
  <td>
70
  <?php $controls->text('name', 50); ?>
71
  <div class="hints">
72
- If you collect only the name of the subscriber without distinction of first and last name, use
73
- this field.
74
  </div>
75
  </td>
76
  </tr>
@@ -81,7 +84,7 @@ $options_profile = get_option('newsletter_profile');
81
  </td>
82
  </tr>
83
  <tr valign="top">
84
- <th>Sex</th>
85
  <td>
86
  <?php $controls->select('sex', array('n' => 'Not specified', 'f' => 'female', 'm' => 'male')); ?>
87
  </td>
@@ -97,7 +100,8 @@ $options_profile = get_option('newsletter_profile');
97
  <td>
98
  <?php $controls->yesno('test'); ?>
99
  <div class="hints">
100
- A test subscriber is a normal subscriber that is used when sending test are made, too.
 
101
  </div>
102
  </td>
103
  </tr>
@@ -108,11 +112,21 @@ $options_profile = get_option('newsletter_profile');
108
  <th>Feed by mail</th>
109
  <td>
110
  <?php $controls->yesno('feed'); ?>
 
 
 
 
111
  </td>
112
  </tr>
113
  </table>
114
  </div>
115
- <div id="tabs-2">
 
 
 
 
 
 
116
  <table class="form-table">
117
  <tr>
118
  <th>Preferences</th>
@@ -123,8 +137,13 @@ $options_profile = get_option('newsletter_profile');
123
  </table>
124
  </div>
125
 
126
- <div id="tabs-3">
127
-
 
 
 
 
 
128
  <table class="widefat" style="width:auto">
129
  <thead>
130
  <tr>
@@ -148,8 +167,12 @@ $options_profile = get_option('newsletter_profile');
148
  </table>
149
  </div>
150
 
151
- <div id="tabs-4">
152
-
 
 
 
 
153
  <table class="form-table">
154
  <tr valign="top">
155
  <th>Subscriber ID</th>
@@ -167,6 +190,9 @@ $options_profile = get_option('newsletter_profile');
167
  <th>From IP address</th>
168
  <td>
169
  <?php $controls->value('ip'); ?>
 
 
 
170
  </td>
171
  </tr>
172
  <tr valign="top">
@@ -174,7 +200,7 @@ $options_profile = get_option('newsletter_profile');
174
  <td>
175
  <?php $controls->text('token', 50); ?>
176
  <div class="hints">
177
- This secret token is used to access the profile page and edit profile data.
178
  </div>
179
  </td>
180
  </tr>
@@ -182,6 +208,9 @@ $options_profile = get_option('newsletter_profile');
182
  <th>Profile URL</th>
183
  <td>
184
  <?php echo plugins_url('newsletter/do/profile.php') . '?nk=' . $id . '-' . $controls->data['token']; ?>
 
 
 
185
  </td>
186
  </tr>
187
 
36
  ?>
37
  <div class="wrap">
38
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
39
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
40
+
41
+ <div id="newsletter-title">
42
+ <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
43
 
44
  <h2>Subscriber Edit</h2>
45
+ </div>
46
+ <div class="newsletter-separator"></div>
47
 
48
  <?php $controls->show(); ?>
49
 
53
  <div id="tabs">
54
 
55
  <ul>
56
+ <li><a href="#tabs-general">General</a></li>
57
+ <li><a href="#tabs-preferences">Preferences</a></li>
58
+ <li><a href="#tabs-profile">Profile</a></li>
59
+ <li><a href="#tabs-other">Other</a></li>
60
  </ul>
61
 
62
+ <div id="tabs-general">
63
 
64
  <table class="form-table">
65
  <tr valign="top">
73
  <td>
74
  <?php $controls->text('name', 50); ?>
75
  <div class="hints">
76
+ If you collect only the name of the subscriber without distinction of first and last name this field is used.
 
77
  </div>
78
  </td>
79
  </tr>
84
  </td>
85
  </tr>
86
  <tr valign="top">
87
+ <th>Gender</th>
88
  <td>
89
  <?php $controls->select('sex', array('n' => 'Not specified', 'f' => 'female', 'm' => 'male')); ?>
90
  </td>
100
  <td>
101
  <?php $controls->yesno('test'); ?>
102
  <div class="hints">
103
+ A test subscriber is a regular subscriber that is even used as recipint when sending test newsletter are sent
104
+ (for example to check the layout).
105
  </div>
106
  </td>
107
  </tr>
112
  <th>Feed by mail</th>
113
  <td>
114
  <?php $controls->yesno('feed'); ?>
115
+ <div class="hints">
116
+ "Yes" when this subscriber has the feed by mail service active. The
117
+ <a href="http://www.satollo.net/plugins/newsletter/feed-by-mail-module" target="_blank">feed by mail is an extension of this plugin</a>.
118
+ </div>
119
  </td>
120
  </tr>
121
  </table>
122
  </div>
123
+ <div id="tabs-preferences">
124
+ <div class="tab-preamble">
125
+ <p>
126
+ The subscriber's preferences are a set of "on/off" fields that can be used while sending newsletter to
127
+ select a subset of subscribes.
128
+ </p>
129
+ </div>
130
  <table class="form-table">
131
  <tr>
132
  <th>Preferences</th>
137
  </table>
138
  </div>
139
 
140
+ <div id="tabs-profile">
141
+ <div class="tab-preamble">
142
+ <p>
143
+ The user's profile is a set of optional and textual fields you can collect along with the subscription process
144
+ or when the user's editing his profile. Those fields can be configured in the "Subscription Form" panel.
145
+ </p>
146
+ </div>
147
  <table class="widefat" style="width:auto">
148
  <thead>
149
  <tr>
167
  </table>
168
  </div>
169
 
170
+ <div id="tabs-other">
171
+ <div class="tab-preamble">
172
+ <p>
173
+ Other user's data collected or generated along the subscription process.
174
+ </p>
175
+ </div>
176
  <table class="form-table">
177
  <tr valign="top">
178
  <th>Subscriber ID</th>
190
  <th>From IP address</th>
191
  <td>
192
  <?php $controls->value('ip'); ?>
193
+ <div class="hints">
194
+ Internet address from which the subscription started. Required by many providers.
195
+ </div>
196
  </td>
197
  </tr>
198
  <tr valign="top">
200
  <td>
201
  <?php $controls->text('token', 50); ?>
202
  <div class="hints">
203
+ This secret token is used to access the profile page and edit profile data, to confirm and cancel the subscription.
204
  </div>
205
  </td>
206
  </tr>
208
  <th>Profile URL</th>
209
  <td>
210
  <?php echo plugins_url('newsletter/do/profile.php') . '?nk=' . $id . '-' . $controls->data['token']; ?>
211
+ <div class="hints">
212
+ The URL which lands on the user profile editing page. It can be added on newsletters using the {profile_url} tag.
213
+ </div>
214
  </td>
215
  </tr>
216
 
users/export.php CHANGED
@@ -7,22 +7,27 @@ $module = NewsletterUsers::instance();
7
 
8
  $lists = array('0' => 'All');
9
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
10
- if (!isset($options_profile['list_' . $i])) $options_profile['list_' . $i] = '';
 
11
  $lists['' . $i] = '(' . $i . ') ' . $options_profile['list_' . $i];
12
  }
13
  ?>
14
 
15
  <div class="wrap">
16
- <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
17
 
18
- <h2>Export</h2
 
19
 
20
- <div class="preamble">
21
- <p>
22
- The import and export functions <strong>ARE NOT for backup</strong>. If you want to backup you should consider to backup the
23
- wp_newsletter* tables.
24
- </p>
 
25
  </div>
 
 
26
 
27
  <form method="post" action="<?php echo plugins_url('newsletter'); ?>/users/csv.php">
28
  <?php $controls->init(); ?>
7
 
8
  $lists = array('0' => 'All');
9
  for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
10
+ if (!isset($options_profile['list_' . $i]))
11
+ $options_profile['list_' . $i] = '';
12
  $lists['' . $i] = '(' . $i . ') ' . $options_profile['list_' . $i];
13
  }
14
  ?>
15
 
16
  <div class="wrap">
17
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
18
 
19
+ <div id="newsletter-title">
20
+ <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
21
 
22
+ <h2>Subscriber Export</h2>
23
+ <p>
24
+ The import and export functions <strong>ARE NOT for backup</strong>.
25
+ If you want to backup you should consider to backup the
26
+ wp_newsletter* tables.
27
+ </p>
28
  </div>
29
+ <div class="newsletter-separator"></div>
30
+
31
 
32
  <form method="post" action="<?php echo plugins_url('newsletter'); ?>/users/csv.php">
33
  <?php $controls->init(); ?>
users/import.php CHANGED
@@ -16,7 +16,8 @@ if ($controls->is_action('import')) {
16
  $results = '';
17
 
18
  // Set the selected preferences inside the
19
- if (!is_array($controls->data['preferences'])) $controls->data['preferences'] = array();
 
20
 
21
  // if ($options['followup'] == 'activate') {
22
  // $subscriber['followup'] = 1;
@@ -30,10 +31,13 @@ if ($controls->is_action('import')) {
30
  foreach ($lines as &$line) {
31
  // Parse the CSV line
32
  $line = trim($line);
33
- if ($line == '') continue;
34
- if ($line[0] == '#' || $line[0] == ';') continue;
 
 
35
  $separator = $controls->data['separator'];
36
- if ($separator == 'tab') $separator = "\t";
 
37
  $data = explode($separator, $line);
38
 
39
  // Builds a subscriber data structure
@@ -51,12 +55,12 @@ if ($controls->is_action('import')) {
51
  $subscriber['name'] = $newsletter->normalize_name($data[1]);
52
  $subscriber['surname'] = $newsletter->normalize_name($data[2]);
53
  $subscriber['status'] = 'C';
54
- foreach ($controls->data['preferences'] as $i) $subscriber['list_' . $i] = 1;
 
55
  NewsletterUsers::instance()->save_user($subscriber);
56
  $results .= '[ADDED] ' . $line . "\n";
57
  $added_count++;
58
- }
59
- else {
60
  if ($mode == 'skip') {
61
  $results .= '[SKIPPED] ' . $line . "\n";
62
  $skipped_count++;
@@ -68,15 +72,18 @@ if ($controls->is_action('import')) {
68
  $subscriber['surname'] = $newsletter->normalize_name($data[2]);
69
 
70
  // Prepare the preference to zero
71
- for ($i=1; $i<NEWSLETTER_LIST_MAX; $i++) $subscriber['list_' . $i] = 0;
 
72
 
73
- foreach ($controls->data['preferences'] as $i) $subscriber['list_' . $i] = 1;
 
74
  }
75
 
76
  if ($mode == 'update') {
77
  $subscriber['name'] = $newsletter->normalize_name($data[1]);
78
  $subscriber['surname'] = $newsletter->normalize_name($data[2]);
79
- foreach ($controls->data['preferences'] as $i) $subscriber['list_' . $i] = 1;
 
80
  }
81
 
82
  NewsletterUsers::instance()->save_user($subscriber);
@@ -84,7 +91,6 @@ if ($controls->is_action('import')) {
84
  $results .= '[UPDATED] ' . $line . "\n";
85
  $updated_count++;
86
  }
87
-
88
  }
89
  if ($error_count) {
90
  $controls->errors = "Import completed but with errors.";
@@ -95,39 +101,30 @@ if ($controls->is_action('import')) {
95
 
96
  <div class="wrap">
97
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
98
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
99
 
100
- <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
 
101
 
102
- <h2>Import</h2>
 
 
 
 
 
103
 
104
- <?php $controls->show(); ?>
105
 
106
- <div class="preamble">
107
- <p>
108
- The import and export functions <strong>ARE NOT for backup</strong>. If you want to backup you should consider to backup the
109
- wp_newsletter* tables.
110
- </p>
111
 
112
- <p>
113
- Please consider to break up your input list if you get errors, blank pages or partially imported lists: it can be a time/resource limit
114
- of your provider. It's safe to import the same list a second time, no duplications will occur.
115
- </p>
116
- <p>
117
- Import list format is:<br /><br />
118
- <b>email 1</b><i>[separator]</i><b>first name 1</b><i>[separator]</i><b>last name 1</b><i>[new line]</i><br />
119
- <b>email 2</b><i>[separator]</i><b>first name 2</b><i>[separator]</i><b>last name 2</b><i>[new line]</i><br />
120
- <br />
121
- where [separator] must be selected from the available ones. Empty lines and lines starting with "#" will be skipped. There is
122
- no separator essaping mechanism, so be sure that field values do not contain the selected separator.
123
- </p>
124
- </div>
125
 
126
  <?php if (!empty($results)) { ?>
127
 
128
- <h3>Results</h3>
129
 
130
- <textarea wrap="off" style="width: 100%; height: 150px; font-size: 11px; font-family: monospace"><?php echo htmlspecialchars($results) ?></textarea>
131
 
132
  <?php } ?>
133
 
@@ -135,7 +132,6 @@ if ($controls->is_action('import')) {
135
 
136
  <?php $controls->init(); ?>
137
 
138
- <h3>CSV text with subscribers</h3>
139
  <table class="form-table">
140
  <tr valign="top">
141
  <th>Preferences</th>
@@ -151,7 +147,7 @@ if ($controls->is_action('import')) {
151
  <tr valign="top">
152
  <th>Follow up</th>
153
  <td>
154
- <?php $controls->select('followup', array('none' => 'None', 'activate' => 'Activate')); ?>
155
  </td>
156
  </tr>
157
  -->
@@ -190,4 +186,20 @@ if ($controls->is_action('import')) {
190
  </p>
191
  </form>
192
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
193
  </div>
16
  $results = '';
17
 
18
  // Set the selected preferences inside the
19
+ if (!is_array($controls->data['preferences']))
20
+ $controls->data['preferences'] = array();
21
 
22
  // if ($options['followup'] == 'activate') {
23
  // $subscriber['followup'] = 1;
31
  foreach ($lines as &$line) {
32
  // Parse the CSV line
33
  $line = trim($line);
34
+ if ($line == '')
35
+ continue;
36
+ if ($line[0] == '#' || $line[0] == ';')
37
+ continue;
38
  $separator = $controls->data['separator'];
39
+ if ($separator == 'tab')
40
+ $separator = "\t";
41
  $data = explode($separator, $line);
42
 
43
  // Builds a subscriber data structure
55
  $subscriber['name'] = $newsletter->normalize_name($data[1]);
56
  $subscriber['surname'] = $newsletter->normalize_name($data[2]);
57
  $subscriber['status'] = 'C';
58
+ foreach ($controls->data['preferences'] as $i)
59
+ $subscriber['list_' . $i] = 1;
60
  NewsletterUsers::instance()->save_user($subscriber);
61
  $results .= '[ADDED] ' . $line . "\n";
62
  $added_count++;
63
+ } else {
 
64
  if ($mode == 'skip') {
65
  $results .= '[SKIPPED] ' . $line . "\n";
66
  $skipped_count++;
72
  $subscriber['surname'] = $newsletter->normalize_name($data[2]);
73
 
74
  // Prepare the preference to zero
75
+ for ($i = 1; $i < NEWSLETTER_LIST_MAX; $i++)
76
+ $subscriber['list_' . $i] = 0;
77
 
78
+ foreach ($controls->data['preferences'] as $i)
79
+ $subscriber['list_' . $i] = 1;
80
  }
81
 
82
  if ($mode == 'update') {
83
  $subscriber['name'] = $newsletter->normalize_name($data[1]);
84
  $subscriber['surname'] = $newsletter->normalize_name($data[2]);
85
+ foreach ($controls->data['preferences'] as $i)
86
+ $subscriber['list_' . $i] = 1;
87
  }
88
 
89
  NewsletterUsers::instance()->save_user($subscriber);
91
  $results .= '[UPDATED] ' . $line . "\n";
92
  $updated_count++;
93
  }
 
94
  }
95
  if ($error_count) {
96
  $controls->errors = "Import completed but with errors.";
101
 
102
  <div class="wrap">
103
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
104
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
105
 
106
+ <div id="newsletter-title">
107
+ <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
108
 
109
+ <h2>Subscriber Import</h2>
110
+ <p>
111
+ The import and export functions <strong>ARE NOT for backup</strong>. If you want to backup you should consider to backup the
112
+ wp_newsletter* tables.
113
+ </p>
114
+ <p>Please, read on bottom of this page the data format to use and other important notes.</p>
115
 
116
+ </div>
117
 
118
+ <div class="newsletter-separator"></div>
119
+
120
+ <?php $controls->show(); ?>
 
 
121
 
 
 
 
 
 
 
 
 
 
 
 
 
 
122
 
123
  <?php if (!empty($results)) { ?>
124
 
125
+ <h3>Results</h3>
126
 
127
+ <textarea wrap="off" style="width: 100%; height: 150px; font-size: 11px; font-family: monospace"><?php echo htmlspecialchars($results) ?></textarea>
128
 
129
  <?php } ?>
130
 
132
 
133
  <?php $controls->init(); ?>
134
 
 
135
  <table class="form-table">
136
  <tr valign="top">
137
  <th>Preferences</th>
147
  <tr valign="top">
148
  <th>Follow up</th>
149
  <td>
150
+ <?php $controls->select('followup', array('none' => 'None', 'activate' => 'Activate')); ?>
151
  </td>
152
  </tr>
153
  -->
186
  </p>
187
  </form>
188
 
189
+ <h3>Data format and other notes</h3>
190
+
191
+ <p>
192
+ Consider to break up your input list if you get errors, blank pages or partially imported lists: it can be a time/resource limit
193
+ of your provider. It's safe to import the same list a second time, no duplications will occur.
194
+ </p>
195
+
196
+ <p>
197
+ Import list format is:<br /><br />
198
+ <b>email 1</b><i>[separator]</i><b>first name 1</b><i>[separator]</i><b>last name 1</b><i>[new line]</i><br />
199
+ <b>email 2</b><i>[separator]</i><b>first name 2</b><i>[separator]</i><b>last name 2</b><i>[new line]</i><br />
200
+ <br />
201
+ where [separator] must be selected from the available ones. Empty lines and lines starting with "#" will be skipped. There is
202
+ no separator essaping mechanism, so be sure that field values do not contain the selected separator.
203
+ </p>
204
+
205
  </div>
users/index-old.php CHANGED
@@ -92,7 +92,7 @@ else {
92
  <div class="wrap">
93
 
94
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
95
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
96
 
97
  <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
98
 
92
  <div class="wrap">
93
 
94
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
95
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
96
 
97
  <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
98
 
users/index.php CHANGED
@@ -10,6 +10,16 @@ $options_lists = get_option('newsletter_profile');
10
  $options_profile = get_option('newsletter_profile');
11
  $options_main = get_option('newsletter_main');
12
 
 
 
 
 
 
 
 
 
 
 
13
  $lists = array(''=>'Any');
14
  for ($i=1; $i<=NEWSLETTER_LIST_MAX; $i++)
15
  {
@@ -67,16 +77,6 @@ $count = Newsletter::instance()->store->get_count($wpdb->prefix . 'newsletter',
67
  $last_page = floor($count / $items_per_page) - ($count % $items_per_page == 0 ? 1 : 0);
68
  if ($last_page < 0) $last_page = 0;
69
 
70
- // Move to base zero
71
- if ($controls->is_action()) {
72
- $controls->data['search_page'] = (int)$controls->data['search_page']-1;
73
- $module->save_options($controls->data, 'search');
74
- }
75
- else {
76
- $controls->data = $module->get_options('search');
77
- if (empty($controls->data['search_page'])) $controls->data['search_page'] = 0;
78
- }
79
-
80
  if ($controls->is_action('last')) {
81
  $controls->data['search_page'] = $last_page;
82
  }
@@ -108,12 +108,17 @@ $controls->data['search_page']++;
108
  <div class="wrap">
109
 
110
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
111
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
112
 
113
- <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
114
 
 
 
115
  <h2>Subscriber Search</h2>
 
116
 
 
 
117
  <?php $controls->show(); ?>
118
 
119
  <form id="channel" method="post" action="">
10
  $options_profile = get_option('newsletter_profile');
11
  $options_main = get_option('newsletter_main');
12
 
13
+ // Move to base zero
14
+ if ($controls->is_action()) {
15
+ $controls->data['search_page'] = (int)$controls->data['search_page']-1;
16
+ $module->save_options($controls->data, 'search');
17
+ }
18
+ else {
19
+ $controls->data = $module->get_options('search');
20
+ if (empty($controls->data['search_page'])) $controls->data['search_page'] = 0;
21
+ }
22
+
23
  $lists = array(''=>'Any');
24
  for ($i=1; $i<=NEWSLETTER_LIST_MAX; $i++)
25
  {
77
  $last_page = floor($count / $items_per_page) - ($count % $items_per_page == 0 ? 1 : 0);
78
  if ($last_page < 0) $last_page = 0;
79
 
 
 
 
 
 
 
 
 
 
 
80
  if ($controls->is_action('last')) {
81
  $controls->data['search_page'] = $last_page;
82
  }
108
  <div class="wrap">
109
 
110
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
111
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
112
 
113
+
114
 
115
+ <div id="newsletter-title">
116
+ <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
117
  <h2>Subscriber Search</h2>
118
+ </div>
119
 
120
+ <div class="newsletter-separator"></div>
121
+
122
  <?php $controls->show(); ?>
123
 
124
  <form id="channel" method="post" action="">
users/massive.php CHANGED
@@ -194,12 +194,16 @@ if ($controls->is_action('bounces')) {
194
 
195
  <div class="wrap">
196
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
197
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
198
- <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
199
 
 
 
200
  <h2>Massive Actions on Subscribers</h2>
201
- <p>A bug or an error using this panel can scramble the subscribers database. Please, backup before run a massive operation.</p>
 
202
 
 
203
  <?php $controls->show(); ?>
204
 
205
  <?php if (!empty($results)) { ?>
@@ -356,7 +360,25 @@ if ($controls->is_action('bounces')) {
356
  </div>
357
 
358
  <div id="tabs-4">
359
- <?php $controls->textarea('bounced_emails'); ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
360
  <?php $controls->button_confirm('bounces', 'Mark those emails as bounced', 'Are you sure?'); ?>
361
  </div>
362
 
194
 
195
  <div class="wrap">
196
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
197
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
198
+
199
 
200
+ <div id="newsletter-title">
201
+ <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
202
  <h2>Massive Actions on Subscribers</h2>
203
+ <p>Please, backup before run a massive operation.</p>
204
+ </div>
205
 
206
+ <div style="clear: both; height: 10px;"></div>
207
  <?php $controls->show(); ?>
208
 
209
  <?php if (!empty($results)) { ?>
360
  </div>
361
 
362
  <div id="tabs-4">
363
+ <div class="tab-preamble">
364
+ <p>
365
+ Import a set of bounced email addresses: they will be marked as "bounced" and no more contacted. Sending
366
+ emails to bounced address (many times) can put your server in some black list.
367
+ </p>
368
+ </div>
369
+ <table class="form-table">
370
+ <tr>
371
+ <th>Bounced addresses</th>
372
+ <td>
373
+ <?php $controls->textarea('bounced_emails'); ?>
374
+ <div class="hints">
375
+ One email address per line.
376
+ </div>
377
+ </td>
378
+ </tr>
379
+ </table>
380
+
381
+
382
  <?php $controls->button_confirm('bounces', 'Mark those emails as bounced', 'Are you sure?'); ?>
383
  </div>
384
 
users/menu.inc.php CHANGED
@@ -1,4 +1,4 @@
1
- <h5>Subscribers Management Module</h5>
2
 
3
  <div id="newsletter-nav">
4
  <a class="button" href="<?php echo $module->get_admin_page_url('index'); ?>">Search</a>
1
+ <!--<h5>Subscribers Management Module</h5>-->
2
 
3
  <div id="newsletter-nav">
4
  <a class="button" href="<?php echo $module->get_admin_page_url('index'); ?>">Search</a>
users/new.php CHANGED
@@ -19,11 +19,13 @@ if ($controls->is_action('save')) {
19
  ?>
20
  <div class="wrap">
21
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
22
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
 
23
  <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
24
 
25
  <h2>New subscriber</h2>
26
-
 
27
  <?php $controls->show(); ?>
28
 
29
  <form method="post" action="">
19
  ?>
20
  <div class="wrap">
21
  <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
22
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
23
+ <div id="newsletter-title">
24
  <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
25
 
26
  <h2>New subscriber</h2>
27
+ </div>
28
+ <div class="newsletter-separator"></div>
29
  <?php $controls->show(); ?>
30
 
31
  <form method="post" action="">
users/stats.php CHANGED
@@ -1,267 +1,296 @@
1
  <?php
2
- $all_count = $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter");
3
- $options_profile = get_option('newsletter_profile');
4
 
5
- $module = NewsletterUsers::instance();
6
  ?>
7
 
8
 
9
  <div class="wrap">
10
-
11
- <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
12
- <?php include NEWSLETTER_DIR . '/header.php'; ?>
13
- <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
14
-
15
- <h2>Subscriber Statistics</h2>
16
-
17
- <p>Reports are limited to confirmed subscribers.</p>
18
-
19
- <div id="tabs">
20
-
21
- <ul>
22
- <li><a href="#tab-overview">Overview</a></li>
23
- <li><a href="#tabs-preferences">Preferences</a></li>
24
- <li><a href="#tabs-countries">Countries</a></li>
25
- <li><a href="#tabs-referrers">Referrers</a></li>
26
- <li><a href="#tabs-sources">Sources</a></li>
27
- <li><a href="#tabs-gender">Gender</a></li>
28
- <li><a href="#tabs-time">By time</a></li>
29
- </ul>
30
-
31
- <div id="tab-overview">
32
-
33
- <table class="widefat" style="width: 300px;">
34
- <thead><tr><th>Status</th><th>Total</th></thead>
35
- <tr valign="top">
36
- <td>Any</td>
37
- <td>
38
- <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter"); ?>
39
- </td>
40
- </tr>
41
- <tr>
42
- <td>Confirmed</td>
43
- <td>
44
- <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='C'"); ?>
45
- </td>
46
- </tr>
47
- <tr>
48
- <td>Not confirmed</td>
49
- <td>
50
- <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='S'"); ?>
51
- </td>
52
- </tr>
53
- <tr>
54
- <td>Subscribed to feed by mail</td>
55
- <td>
56
- <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='C' and feed=1"); ?>
57
- </td>
58
- </tr>
59
- <tr>
60
- <td>Unsubscribed</td>
61
- <td>
62
- <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='U'"); ?>
63
- </td>
64
- </tr>
65
- <tr>
66
- <td>Bounced</td>
67
- <td>
68
- <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='B'"); ?>
69
- </td>
70
- </tr>
71
- </table>
72
 
 
 
 
 
 
 
 
 
 
73
  </div>
74
-
75
-
76
- <div id="tabs-preferences">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
 
78
- <div class="tab-preamble">
79
- <a href="http://www.satollo.net/plugins/newsletter/newsletter-preferences" target="_blank">Click here know more about preferences.</a>
80
- They can be configured on Subscription/Form field panel.
81
  </div>
82
-
83
- <table class="widefat" style="width: 300px;">
84
- <thead><tr><th>Preference</th><th>Total</th></thead>
85
- <?php for ($i=1; $i<=NEWSLETTER_LIST_MAX; $i++) { ?>
86
- <?php if (empty($options_profile['list_' . $i])) continue; ?>
87
- <tr>
88
- <td><?php echo '(' . $i . ') ' . $options_profile['list_' . $i]; ?></td>
89
- <td>
90
- <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where list_" . $i . "=1 and status='C'"); ?>
91
- </td>
92
- </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
93
  <?php } ?>
94
- </table>
95
-
96
- </div>
97
-
98
-
99
- <div id="tabs-countries">
100
-
101
- <?php
102
- if (class_exists('NewsletterReports')) {
103
- $countries = $wpdb->get_results("select country, count(*) as total from " . $wpdb->prefix . "newsletter where status='C' and country<>'' group by country order by total");
104
- }
105
- ?>
106
-
107
- <?php if (!class_exists('NewsletterReports')) { ?>
108
- <p>You need the <a href="http://www.satollo.net/plugins/newsletter/reports-module" target="_blank">Reports Extension</a> for this chart.</p>
109
- <?php } else if (empty($countries)) { ?>
110
- <p>No data available, just wait some time to let the processor to work on your subscriber list. Thank you.</p>
111
- <?php } else { ?>
112
- <p><div id="country-chart" style="width:400; height:300"></div></p>
113
- <?php } ?>
114
 
115
- </div>
116
-
117
-
118
- <div id="tabs-referrers">
119
 
120
- <?php
 
 
 
 
 
 
 
121
  $list = $wpdb->get_results("select referrer, count(*) as total from " . $wpdb->prefix . "newsletter where status='C' group by referrer order by total desc");
122
- ?>
123
- <table class="widefat" style="width: 300px">
124
- <thead><tr><th>Referrer</th><th>Total</th></thead>
125
- <?php foreach($list as $row) { ?>
126
- <tr><td><?php echo $row->referrer; ?></td><td><?php echo $row->total; ?></td></tr>
127
- <?php } ?>
128
- </table>
129
-
130
- </div>
131
-
132
-
133
- <div id="tabs-sources">
134
 
135
- <?php
 
 
 
 
 
 
 
 
 
 
136
  $list = $wpdb->get_results("select http_referer, count(*) as total from " . $wpdb->prefix . "newsletter where status='C' group by http_referer order by count(*) desc limit 100");
137
- ?>
138
- <table class="widefat" style="width: 300px">
139
- <thead><tr><th>URL</th><th>Total</th></thead>
140
- <?php foreach($list as $row) { ?>
141
- <tr><td><?php echo $row->http_referer; ?></td><td><?php echo $row->total; ?></td></tr>
142
- <?php } ?>
143
- </table>
 
 
144
 
145
- </div>
146
 
147
-
148
- <div id="tabs-gender">
149
 
150
- <?php
151
  $male_count = $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where sex='m'");
152
  $female_count = $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where sex='f'");
153
- $other_count = ($all_count-$male_count-$female_count)
154
- ?>
155
- <table class="widefat" style="width: 300px">
156
- <thead><tr><th>Sex</th><th>Total</th></thead>
157
- <tr><td>Male</td><td><?php echo $male_count; ?></td></tr>
158
- <tr><td>Female</td><td><?php echo $female_count; ?></td></tr>
159
- <tr><td>Not specified</td><td><?php echo $other_count; ?></td></tr>
160
- </table>
161
 
162
- <p><div id="sex-chart"></div></p>
163
 
164
- </div>
165
 
166
 
167
- <div id="tabs-time">
168
-
169
- <h4>Subscriptions by month (max 24 months)</h4>
170
- <?php
171
- $months = $wpdb->get_results("select count(*) as c, concat(year(created), '-', date_format(created, '%m')) as d from " . $wpdb->prefix . "newsletter where status='C' group by concat(year(created), '-', date_format(created, '%m')) order by d desc limit 24");
172
- ?>
173
- <div id="months-chart"></div>
174
-
175
- <table class="widefat" style="width: 300px">
176
- <thead>
177
- <tr valign="top">
178
- <th>Date</th>
179
- <th>Subscribers</th>
180
- </tr>
181
- </thead>
182
- <?php foreach ($months as &$day) { ?>
183
- <tr valign="top">
184
- <td><?php echo $day->d; ?></td>
185
- <td><?php echo $day->c; ?></td>
186
- </tr>
187
- <?php } ?>
188
- </table>
189
-
190
- <h4>Subscriptions by day (max 90 days)</h4>
191
- <?php
192
- $list = $wpdb->get_results("select count(*) as c, date(created) as d from " . $wpdb->prefix . "newsletter where status='C' group by date(created) order by d desc limit 90");
193
- ?>
194
- <table class="widefat" style="width: 300px">
195
- <thead>
196
- <tr valign="top">
197
- <th>Date</th>
198
- <th>Subscribers</th>
199
- </tr>
200
- </thead>
201
- <?php foreach ($list as $day) { ?>
202
- <tr valign="top">
203
- <td><?php echo $day->d; ?></td>
204
- <td><?php echo $day->c; ?></td>
205
- </tr>
206
- <?php } ?>
207
- </table>
208
-
209
- </div>
210
-
211
- </div>
212
 
213
  </div>
214
 
215
 
216
  <script type="text/javascript" src="https://www.google.com/jsapi"></script>
217
  <script type="text/javascript">
218
- google.load('visualization', '1', {'packages':['corechart', 'geochart']});
219
-
220
- google.setOnLoadCallback(drawChart);
221
 
222
- function drawChart() {
223
 
 
224
 
225
- var data = new google.visualization.DataTable();
226
- data.addColumn('string', 'Gender');
227
- data.addColumn('number', 'Total');
228
- data.addRows([
229
- ['None', <?php echo $other_count; ?>],
230
- ['Female', <?php echo $female_count; ?>],
231
- ['Male', <?php echo $male_count; ?>]
232
- ]);
233
 
234
- var options = {'title':'Gender',
235
- 'width':400,
236
- 'height':300};
 
 
 
 
 
237
 
238
- var chart = new google.visualization.PieChart(document.getElementById('sex-chart'));
239
- chart.draw(data, options);
 
240
 
241
- var months = new google.visualization.DataTable();
242
- months.addColumn('string', 'Month');
243
- months.addColumn('number', 'Subscribers');
244
 
245
- <?php foreach ($months as $day) { ?>
246
- months.addRow(['<?php echo $day->d; ?>', <?php echo $day->c; ?>]);
247
- <?php } ?>
248
 
249
- var options = {'title':'By months', 'width':700, 'height':500};
 
 
250
 
251
- var chart = new google.visualization.BarChart(document.getElementById('months-chart'));
252
- chart.draw(months, options);
253
 
254
- <?php if (!empty($countries)) { ?>
255
- var countries = new google.visualization.DataTable();
256
- countries.addColumn('string', 'Country');
257
- countries.addColumn('number', 'Total');
258
- <?php foreach ($countries as &$country) { ?>
259
- countries.addRow(['<?php echo $country->country; ?>', <?php echo $country->total; ?>]);
260
- <?php } ?>
261
 
262
- var options = {'title': 'Country', 'width': 700, 'height': 500};
263
- var chart = new google.visualization.GeoChart(document.getElementById('country-chart'));
264
- chart.draw(countries, options);
 
 
 
265
  <?php } ?>
266
- }
 
 
 
 
 
267
  </script>
1
  <?php
2
+ $all_count = $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter");
3
+ $options_profile = get_option('newsletter_profile');
4
 
5
+ $module = NewsletterUsers::instance();
6
  ?>
7
 
8
 
9
  <div class="wrap">
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
 
11
+ <?php $help_url = 'http://www.satollo.net/plugins/newsletter/subscribers-module'; ?>
12
+ <?php include NEWSLETTER_DIR . '/header-new.php'; ?>
13
+
14
+ <div id="newsletter-title">
15
+ <?php include NEWSLETTER_DIR . '/users/menu.inc.php'; ?>
16
+
17
+ <h2>Subscriber Statistics</h2>
18
+
19
+ <p>Reports values are usually computed only counting confirmed subscribers.</p>
20
  </div>
21
+ <div class="newsletter-separator"></div>
22
+
23
+ <div id="tabs">
24
+
25
+ <ul>
26
+ <li><a href="#tab-overview">Overview</a></li>
27
+ <li><a href="#tabs-preferences">Preferences</a></li>
28
+ <li><a href="#tabs-countries">Countries</a></li>
29
+ <li><a href="#tabs-referrers">Referrers</a></li>
30
+ <li><a href="#tabs-sources">Sources</a></li>
31
+ <li><a href="#tabs-gender">Gender</a></li>
32
+ <li><a href="#tabs-time">By time</a></li>
33
+ </ul>
34
+
35
+ <div id="tab-overview">
36
+
37
+ <table class="widefat" style="width: 300px;">
38
+ <thead><tr><th>Status</th><th>Total</th></thead>
39
+ <tr valign="top">
40
+ <td>Any</td>
41
+ <td>
42
+ <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter"); ?>
43
+ </td>
44
+ </tr>
45
+ <tr>
46
+ <td>Confirmed</td>
47
+ <td>
48
+ <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='C'"); ?>
49
+ </td>
50
+ </tr>
51
+ <tr>
52
+ <td>Not confirmed</td>
53
+ <td>
54
+ <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='S'"); ?>
55
+ </td>
56
+ </tr>
57
+ <tr>
58
+ <td>Subscribed to feed by mail</td>
59
+ <td>
60
+ <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='C' and feed=1"); ?>
61
+ </td>
62
+ </tr>
63
+ <tr>
64
+ <td>Unsubscribed</td>
65
+ <td>
66
+ <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='U'"); ?>
67
+ </td>
68
+ </tr>
69
+ <tr>
70
+ <td>Bounced</td>
71
+ <td>
72
+ <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where status='B'"); ?>
73
+ </td>
74
+ </tr>
75
+ </table>
76
 
 
 
 
77
  </div>
78
+
79
+
80
+ <div id="tabs-preferences">
81
+
82
+ <div class="tab-preamble">
83
+ <p>
84
+ User count by preference.
85
+ <a href="http://www.satollo.net/plugins/newsletter/newsletter-preferences" target="_blank">Read more about preferences</a> and/or
86
+ configure them from te "Subscription Form" panel.
87
+ <p>
88
+ </div>
89
+
90
+ <table class="widefat" style="width: 300px;">
91
+ <thead>
92
+ <tr>
93
+ <th>Preference</th>
94
+ <th>Total</th>
95
+ </thead>
96
+ <?php for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) { ?>
97
+ <?php if (empty($options_profile['list_' . $i])) continue; ?>
98
+ <tr>
99
+ <td><?php echo '(' . $i . ') ' . $options_profile['list_' . $i]; ?></td>
100
+ <td>
101
+ <?php echo $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where list_" . $i . "=1 and status='C'"); ?>
102
+ </td>
103
+ </tr>
104
+ <?php } ?>
105
+ </table>
106
+
107
+ </div>
108
+
109
+
110
+ <div id="tabs-countries">
111
+ <div class="tab-preamble">
112
+ <?php if (!class_exists('NewsletterReports')) { ?>
113
+ <p><strong>The <a href="http://www.satollo.net/plugins/newsletter/reports-module" target="_blank">Reports Extension</a> is required
114
+ to compute the data for this chart.</strong></p>
115
+ <?php } ?>
116
+ <p>
117
+ This panel shows a World map with the number of subscriptions per country.
118
+ <p>
119
+ </div>
120
+ <?php
121
+ if (class_exists('NewsletterReports')) {
122
+ $countries = $wpdb->get_results("select country, count(*) as total from " . $wpdb->prefix . "newsletter where status='C' and country<>'' group by country order by total");
123
+ }
124
+ ?>
125
+
126
+ <?php if (empty($countries)) { ?>
127
+ <p>No data available, just wait some time to let the processor to work on your subscriber list. Thank you.</p>
128
+ <?php } else { ?>
129
+ <p><div id="country-chart" style="width:400; height:300"></div></p>
130
  <?php } ?>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
131
 
132
+ </div>
133
+
 
 
134
 
135
+ <div id="tabs-referrers">
136
+ <div class="tab-preamble">
137
+ <p>The referrer is a special (hidden) fields collected during the subscription. For example the widget
138
+ adds the "widget" referrer to his generated form. With custom forms you can add
139
+ your own referrer using an hidden field named "nr".
140
+ </p>
141
+ </div>
142
+ <?php
143
  $list = $wpdb->get_results("select referrer, count(*) as total from " . $wpdb->prefix . "newsletter where status='C' group by referrer order by total desc");
144
+ ?>
145
+ <table class="widefat" style="width: 300px">
146
+ <thead><tr><th>Referrer</th><th>Total</th></thead>
147
+ <?php foreach ($list as $row) { ?>
148
+ <tr><td><?php echo $row->referrer; ?></td><td><?php echo $row->total; ?></td></tr>
149
+ <?php } ?>
150
+ </table>
151
+
152
+ </div>
 
 
 
153
 
154
+
155
+ <div id="tabs-sources">
156
+
157
+ <div class="tab-preamble">
158
+ <p>
159
+ URLs from which the subscription started. For example, if you use the widget on your blog sidebar
160
+ you can discover which page is converting more.
161
+ </p>
162
+ </div>
163
+
164
+ <?php
165
  $list = $wpdb->get_results("select http_referer, count(*) as total from " . $wpdb->prefix . "newsletter where status='C' group by http_referer order by count(*) desc limit 100");
166
+ ?>
167
+ <table class="widefat" style="width: 300px">
168
+ <thead><tr><th>URL</th><th>Total</th></thead>
169
+ <?php foreach ($list as $row) { ?>
170
+ <tr><td><?php echo $row->http_referer; ?></td><td><?php echo $row->total; ?></td></tr>
171
+ <?php } ?>
172
+ </table>
173
+
174
+ </div>
175
 
 
176
 
177
+ <div id="tabs-gender">
 
178
 
179
+ <?php
180
  $male_count = $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where sex='m'");
181
  $female_count = $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where sex='f'");
182
+ $other_count = ($all_count - $male_count - $female_count)
183
+ ?>
184
+ <table class="widefat" style="width: 300px">
185
+ <thead><tr><th>Sex</th><th>Total</th></thead>
186
+ <tr><td>Male</td><td><?php echo $male_count; ?></td></tr>
187
+ <tr><td>Female</td><td><?php echo $female_count; ?></td></tr>
188
+ <tr><td>Not specified</td><td><?php echo $other_count; ?></td></tr>
189
+ </table>
190
 
191
+ <p><div id="sex-chart"></div></p>
192
 
193
+ </div>
194
 
195
 
196
+ <div id="tabs-time">
197
+
198
+ <h4>Subscriptions by month (max 24 months)</h4>
199
+ <?php
200
+ $months = $wpdb->get_results("select count(*) as c, concat(year(created), '-', date_format(created, '%m')) as d from " . $wpdb->prefix . "newsletter where status='C' group by concat(year(created), '-', date_format(created, '%m')) order by d desc limit 24");
201
+ ?>
202
+ <div id="months-chart"></div>
203
+
204
+ <table class="widefat" style="width: 300px">
205
+ <thead>
206
+ <tr valign="top">
207
+ <th>Date</th>
208
+ <th>Subscribers</th>
209
+ </tr>
210
+ </thead>
211
+ <?php foreach ($months as &$day) { ?>
212
+ <tr valign="top">
213
+ <td><?php echo $day->d; ?></td>
214
+ <td><?php echo $day->c; ?></td>
215
+ </tr>
216
+ <?php } ?>
217
+ </table>
218
+
219
+ <h4>Subscriptions by day (max 90 days)</h4>
220
+ <?php
221
+ $list = $wpdb->get_results("select count(*) as c, date(created) as d from " . $wpdb->prefix . "newsletter where status='C' group by date(created) order by d desc limit 90");
222
+ ?>
223
+ <table class="widefat" style="width: 300px">
224
+ <thead>
225
+ <tr valign="top">
226
+ <th>Date</th>
227
+ <th>Subscribers</th>
228
+ </tr>
229
+ </thead>
230
+ <?php foreach ($list as $day) { ?>
231
+ <tr valign="top">
232
+ <td><?php echo $day->d; ?></td>
233
+ <td><?php echo $day->c; ?></td>
234
+ </tr>
235
+ <?php } ?>
236
+ </table>
237
+
238
+ </div>
239
+
240
+ </div>
241
 
242
  </div>
243
 
244
 
245
  <script type="text/javascript" src="https://www.google.com/jsapi"></script>
246
  <script type="text/javascript">
247
+ google.load('visualization', '1', {'packages': ['corechart', 'geochart']});
 
 
248
 
249
+ google.setOnLoadCallback(drawChart);
250
 
251
+ function drawChart() {
252
 
 
 
 
 
 
 
 
 
253
 
254
+ var data = new google.visualization.DataTable();
255
+ data.addColumn('string', 'Gender');
256
+ data.addColumn('number', 'Total');
257
+ data.addRows([
258
+ ['None', <?php echo $other_count; ?>],
259
+ ['Female', <?php echo $female_count; ?>],
260
+ ['Male', <?php echo $male_count; ?>]
261
+ ]);
262
 
263
+ var options = {'title': 'Gender',
264
+ 'width': 400,
265
+ 'height': 300};
266
 
267
+ var chart = new google.visualization.PieChart(document.getElementById('sex-chart'));
268
+ chart.draw(data, options);
 
269
 
270
+ var months = new google.visualization.DataTable();
271
+ months.addColumn('string', 'Month');
272
+ months.addColumn('number', 'Subscribers');
273
 
274
+ <?php foreach ($months as $day) { ?>
275
+ months.addRow(['<?php echo $day->d; ?>', <?php echo $day->c; ?>]);
276
+ <?php } ?>
277
 
278
+ var options = {'title': 'By months', 'width': 700, 'height': 500};
 
279
 
280
+ var chart = new google.visualization.BarChart(document.getElementById('months-chart'));
281
+ chart.draw(months, options);
 
 
 
 
 
282
 
283
+ <?php if (!empty($countries)) { ?>
284
+ var countries = new google.visualization.DataTable();
285
+ countries.addColumn('string', 'Country');
286
+ countries.addColumn('number', 'Total');
287
+ <?php foreach ($countries as &$country) { ?>
288
+ countries.addRow(['<?php echo $country->country; ?>', <?php echo $country->total; ?>]);
289
  <?php } ?>
290
+
291
+ var options = {'title': 'Country', 'width': 700, 'height': 500};
292
+ var chart = new google.visualization.GeoChart(document.getElementById('country-chart'));
293
+ chart.draw(countries, options);
294
+ <?php } ?>
295
+ }
296
  </script>