Newsletter - Version 3.0.9

Version Description

  • Fixed an important bug
Download this release

Release Info

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

Code changes from version 3.0.0 to 3.0.9

Files changed (55) hide show
  1. admin.css +16 -0
  2. diagnostic.php +27 -2
  3. do/change.php +21 -4
  4. do/view.php +1 -1
  5. emails/edit.php +7 -1
  6. emails/emails.php +5 -4
  7. emails/index.php +4 -0
  8. emails/new.php +5 -4
  9. emails/preview-text.php +6 -3
  10. emails/preview.php +3 -1
  11. example/base.php +0 -73
  12. example/index.php +0 -66
  13. feed/whatis.txt +0 -1
  14. header.php +18 -0
  15. includes/controls.php +6 -5
  16. includes/module.php +7 -2
  17. includes/store.php +20 -9
  18. main.php +14 -6
  19. plugin-menu.inc.php +1 -1
  20. plugin.php +35 -31
  21. readme.txt +99 -2
  22. statistics/statistics.php +1 -1
  23. subscription/email.php +16 -3
  24. subscription/languages/de_DE.php +1 -4
  25. subscription/languages/en_US.php +1 -1
  26. subscription/languages/es_ES.php +1 -4
  27. subscription/languages/fr_FR.php +1 -3
  28. subscription/languages/it_IT.php +1 -4
  29. subscription/languages/nl_NL.php +1 -3
  30. subscription/languages/pl_PL.php +1 -3
  31. subscription/languages/profile-en_US.php +15 -0
  32. subscription/languages/profile-it_IT.php +15 -0
  33. subscription/languages/pt_BR.php +1 -3
  34. subscription/languages/ru_RU.php +1 -3
  35. subscription/options.php +48 -8
  36. subscription/page.php +4 -2
  37. subscription/profile.php +23 -6
  38. subscription/styles/neutral.css +62 -0
  39. subscription/styles/widget-neutral.css +54 -0
  40. subscription/styles/widget-neutral/button.png +0 -0
  41. subscription/subscription.php +83 -28
  42. tiny_mce/themes/simple/editor_template.js +0 -1
  43. tiny_mce/themes/simple/editor_template_src.js +0 -84
  44. tiny_mce/themes/simple/img/icons.gif +0 -0
  45. tiny_mce/themes/simple/langs/en.js +0 -1
  46. tiny_mce/themes/simple/skins/default/content.css +0 -25
  47. tiny_mce/themes/simple/skins/default/ui.css +0 -32
  48. tiny_mce/themes/simple/skins/o2k7/content.css +0 -17
  49. tiny_mce/themes/simple/skins/o2k7/img/button_bg.png +0 -0
  50. tiny_mce/themes/simple/skins/o2k7/ui.css +0 -35
  51. users/index.php +1 -1
  52. users/massive.php +0 -1
  53. users/stats.php +22 -0
  54. welcome.php +6 -18
  55. widget.php +3 -16
admin.css CHANGED
@@ -756,6 +756,21 @@ table.clicks {
756
  }
757
  */
758
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
759
  .newsletter-message {
760
  background-color: lightYellow;
761
  border-color: #E6DB55;
@@ -764,6 +779,7 @@ table.clicks {
764
  border-width: 1px;
765
  padding: .6em;
766
  margin-bottom: .6em;
 
767
  }
768
 
769
  .newsletter-error {
756
  }
757
  */
758
 
759
+ .newsletter-notice {
760
+ background-color: lightYellow;
761
+ border-color: #E6DB55;
762
+ border-radius: 3px;
763
+ border-style: solid;
764
+ border-width: 1px;
765
+ padding: .6em;
766
+ margin-bottom: .6em;
767
+ margin-top: .6em;
768
+ }
769
+
770
+ .newsletter-dismiss {
771
+ float: right;
772
+ }
773
+
774
  .newsletter-message {
775
  background-color: lightYellow;
776
  border-color: #E6DB55;
779
  border-width: 1px;
780
  padding: .6em;
781
  margin-bottom: .6em;
782
+
783
  }
784
 
785
  .newsletter-error {
diagnostic.php CHANGED
@@ -14,6 +14,11 @@ if ($controls->is_action('trigger')) {
14
  $controls->messages = 'Delivery engine triggered.';
15
  }
16
 
 
 
 
 
 
17
  if ($controls->is_action('trigger_followup')) {
18
  NewsletterFollowup::instance()->send();
19
  $controls->messages = 'Follow up delivery engine triggered.';
@@ -142,7 +147,7 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
142
  <li><a href="#tabs-1">Modules and logging</a></li>
143
  <li><a href="#tabs-2">Sempahores and Crons</a></li>
144
  <li><a href="#tabs-4">System</a></li>
145
- <li><a href="#tabs-upgrade">Upgrade</a></li>
146
  </ul>
147
 
148
  <div id="tabs-1">
@@ -373,12 +378,25 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
373
  ?>
374
  </td>
375
  </tr>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
376
  </tbody>
377
  </table>
378
 
379
  </div>
380
  <div id="tabs-upgrade">
381
- <h3>Upgrade</h3>
382
  <p>
383
  Plugin and modules are able to upgrade them self when needed. If you urgently need to try to force an upgrade, press the
384
  button below.
@@ -386,6 +404,13 @@ if (empty($controls->data)) $controls->data = get_option('newsletter_diagnostic'
386
  <p>
387
  <?php $controls->button('upgrade', 'Force an upgrade'); ?>
388
  </p>
 
 
 
 
 
 
 
389
  </div>
390
  </div>
391
 
14
  $controls->messages = 'Delivery engine triggered.';
15
  }
16
 
17
+ if ($controls->is_action('undismiss')) {
18
+ update_option('newsletter_dismissed', array());
19
+ $controls->messages = 'Notices restored.';
20
+ }
21
+
22
  if ($controls->is_action('trigger_followup')) {
23
  NewsletterFollowup::instance()->send();
24
  $controls->messages = 'Follow up delivery engine triggered.';
147
  <li><a href="#tabs-1">Modules and logging</a></li>
148
  <li><a href="#tabs-2">Sempahores and Crons</a></li>
149
  <li><a href="#tabs-4">System</a></li>
150
+ <li><a href="#tabs-upgrade">Maintainance</a></li>
151
  </ul>
152
 
153
  <div id="tabs-1">
378
  ?>
379
  </td>
380
  </tr>
381
+ <tr>
382
+ <td>File permissions</td>
383
+ <td>
384
+ <?php
385
+ $index_permissions = fileperms(ABSPATH . '/index.php');
386
+ $subscribe_permissions = fileperms(NEWSLETTER_DIR . '/do/subscribe.php');
387
+ if ($index_permissions != $subscribe_permissions) {
388
+ echo 'Plugin file permissions differ from blog index.php permissions, that may compromise the subscription process';
389
+ }else {
390
+ echo 'OK';
391
+ }
392
+ ?>
393
+ </td>
394
+ </tr>
395
  </tbody>
396
  </table>
397
 
398
  </div>
399
  <div id="tabs-upgrade">
 
400
  <p>
401
  Plugin and modules are able to upgrade them self when needed. If you urgently need to try to force an upgrade, press the
402
  button below.
404
  <p>
405
  <?php $controls->button('upgrade', 'Force an upgrade'); ?>
406
  </p>
407
+
408
+ <p>
409
+ Restore al dismissed messages
410
+ </p>
411
+ <p>
412
+ <?php $controls->button('undismiss', 'Restore'); ?>
413
+ </p>
414
  </div>
415
  </div>
416
 
do/change.php CHANGED
@@ -7,6 +7,7 @@ $field = $_REQUEST['nf'];
7
  $value = $_REQUEST['nv'];
8
  $url = $_REQUEST['nu'];
9
 
 
10
  switch ($field) {
11
  case 'sex':
12
  if (!in_array($value, array('f', 'm', 'n'))) die('Invalid sex value');
@@ -14,12 +15,28 @@ switch ($field) {
14
  break;
15
  // Should be managed by Feed by Mail
16
  case 'feed':
17
- if ($value != 1) die('Invalid feed value');
18
- NewsletterUsers::instance()->set_user_field($user->id, 'feed', $value);
 
19
  break;
20
- default:
21
- die('Invalid field');
22
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  if (isset($url)) {
24
  header("Location: $url");
25
  } else {
7
  $value = $_REQUEST['nv'];
8
  $url = $_REQUEST['nu'];
9
 
10
+
11
  switch ($field) {
12
  case 'sex':
13
  if (!in_array($value, array('f', 'm', 'n'))) die('Invalid sex value');
15
  break;
16
  // Should be managed by Feed by Mail
17
  case 'feed':
18
+ //if (isset($value) && ($value === '0' || $value === '1')) {
19
+ NewsletterUsers::instance()->set_user_field($user->id, 'feed', $value);
20
+ //} else die('Invalid feed value');
21
  break;
 
 
22
  }
23
+
24
+ if (strpos($field, 'preference_') === 0) {
25
+ $idx = (int) substr($field, 11);
26
+ //echo $idx;
27
+ $options_profile = get_option('newsletter_profile');
28
+
29
+ if ($options_profile['list_' . $idx . '_status'] == 0) {
30
+ die('Not allowed field.');
31
+ }
32
+ //die($value);
33
+ //if (isset($value) && ($value === '0' || $value === '1')) {
34
+ NewsletterUsers::instance()->set_user_field($user->id, 'list_' . $idx, $value);
35
+ //} else {
36
+ // die('Invalid preference value');
37
+ //}
38
+ }
39
+
40
  if (isset($url)) {
41
  header("Location: $url");
42
  } else {
do/view.php CHANGED
@@ -6,7 +6,7 @@
6
  include '../../../../wp-load.php';
7
 
8
  // TODO: Change to Newsletter::instance()->get:email(), not urgent
9
- $email = Newsletter::instance()->get_email($_GET['id']);
10
  if (empty($email)) die('Email not found');
11
 
12
  $user = NewsletterSubscription::instance()->get_user_from_request();
6
  include '../../../../wp-load.php';
7
 
8
  // TODO: Change to Newsletter::instance()->get:email(), not urgent
9
+ $email = Newsletter::instance()->get_email((int)$_GET['id']);
10
  if (empty($email)) die('Email not found');
11
 
12
  $user = NewsletterSubscription::instance()->get_user_from_request();
emails/edit.php CHANGED
@@ -73,8 +73,14 @@ if ($controls->is_action('test') || $controls->is_action('save') || $controls->i
73
  $email['sent'] = 0;
74
  $email['last_id'] = 0;
75
  $email['send_on'] = $controls->data['send_on'];
 
 
 
 
76
 
77
  Newsletter::instance()->save_email($email);
 
 
78
  }
79
 
80
  if ($controls->is_action('send')) {
@@ -205,7 +211,7 @@ if ($email['editor'] == 0) {
205
  <th>Message</th>
206
  <td>
207
  <input id="upload_image_button" type="button" value="Choose or upload an image" />
208
- <?php $email['editor'] == 0 ? $controls->editor('message', 30) : $controls->textarea_fixed('message', '100%'); ?>
209
  <div class="hints">
210
  Tags: <strong>{name}</strong> receiver name;
211
  <strong>{unsubscription_url}</strong> unsubscription URL;
73
  $email['sent'] = 0;
74
  $email['last_id'] = 0;
75
  $email['send_on'] = $controls->data['send_on'];
76
+
77
+ if ($controls->is_action('editor')) {
78
+ $email['editor'] = $email['editor'] == 0?1:0;
79
+ }
80
 
81
  Newsletter::instance()->save_email($email);
82
+
83
+ $controls->data['message'] = $email['message'];
84
  }
85
 
86
  if ($controls->is_action('send')) {
211
  <th>Message</th>
212
  <td>
213
  <input id="upload_image_button" type="button" value="Choose or upload an image" />
214
+ <?php $email['editor'] == 0 ? $controls->editor('message', 30) : $controls->textarea_fixed('message', '100%', '400'); ?>
215
  <div class="hints">
216
  Tags: <strong>{name}</strong> receiver name;
217
  <strong>{unsubscription_url}</strong> unsubscription URL;
emails/emails.php CHANGED
@@ -5,7 +5,7 @@ require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
5
 
6
  class NewsletterEmails extends NewsletterModule {
7
 
8
- const VERSION = '1.0.4';
9
 
10
  /**
11
  * @var NewsletterThemes
@@ -32,9 +32,10 @@ class NewsletterEmails extends NewsletterModule {
32
 
33
  function upgrade() {
34
  global $wpdb, $charset_collate;
35
-
36
- $wpdb->query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column token varchar(10) not null default ''");
37
- $wpdb->query("alter table " . NEWSLETTER_EMAILS_TABLE . " drop column visibility");
 
38
 
39
  // Force a token to email without one already set.
40
  $token = self::get_token();
5
 
6
  class NewsletterEmails extends NewsletterModule {
7
 
8
+ const VERSION = '1.0.7';
9
 
10
  /**
11
  * @var NewsletterThemes
32
 
33
  function upgrade() {
34
  global $wpdb, $charset_collate;
35
+ $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " change column `type` `type` varchar(50) not null default ''");
36
+ $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column token varchar(10) not null default ''");
37
+ $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " drop column visibility");
38
+ $this->upgrade_query("update " . NEWSLETTER_EMAILS_TABLE . " set type='message' where type=''");
39
 
40
  // Force a token to email without one already set.
41
  $token = self::get_token();
emails/index.php CHANGED
@@ -100,7 +100,11 @@ $emails = Newsletter::instance()->get_emails('message');
100
  <td><?php echo htmlspecialchars($email->subject); ?></td>
101
  <td><?php echo $module->date($email->send_on); ?></td>
102
  <td>
 
 
 
103
  <?php echo $email->status; ?>
 
104
  (<?php echo $email->sent; ?>/<?php echo $email->total; ?>)
105
  </td>
106
  <td><a class="button" href="admin.php?page=newsletter/emails/edit.php&amp;id=<?php echo $email->id; ?>">Edit</a></td>
100
  <td><?php echo htmlspecialchars($email->subject); ?></td>
101
  <td><?php echo $module->date($email->send_on); ?></td>
102
  <td>
103
+ <?php if ($email->status == 'new' && $email->send_on > time()) { ?>
104
+ planned
105
+ <?php } else { ?>
106
  <?php echo $email->status; ?>
107
+ <?php } ?>
108
  (<?php echo $email->sent; ?>/<?php echo $email->total; ?>)
109
  </td>
110
  <td><a class="button" href="admin.php?page=newsletter/emails/edit.php&amp;id=<?php echo $email->id; ?>">Edit</a></td>
emails/new.php CHANGED
@@ -42,12 +42,10 @@ if ($controls->is_action('create') || $controls->is_action('test')) {
42
  ob_start();
43
  include $module->get_current_theme_file_path('theme.php');
44
  $email['message'] = ob_get_clean();
45
- ob_end_clean();
46
 
47
  ob_start();
48
  include $module->get_current_theme_file_path('theme-text.php');
49
  $email['message_text'] = ob_get_clean();
50
- ob_end_clean();
51
 
52
  $email['type'] = 'message';
53
  $email['send_on'] = time();
@@ -56,6 +54,9 @@ if ($controls->is_action('create') || $controls->is_action('test')) {
56
  <script>
57
  location.href="admin.php?page=newsletter/emails/edit.php&id=<?php echo $email->id; ?>";
58
  </script>
 
 
 
59
  <?php
60
  return;
61
  }
@@ -143,12 +144,12 @@ function newsletter_emails_get_theme_options($theme) {
143
 
144
 
145
  <div id="tabs-2">
146
- <iframe src="<?php echo NEWSLETTER_URL; ?>/emails/preview.php?<?php echo time(); ?>" width="100%" height="500"></iframe>
147
  </div>
148
 
149
 
150
  <div id="tabs-3">
151
- <iframe src="<?php echo NEWSLETTER_URL; ?>/emails/preview-text.php?<?php echo time(); ?>" width="100%" height="500"></iframe>
152
  </div>
153
 
154
  <div id="tabs-4">
42
  ob_start();
43
  include $module->get_current_theme_file_path('theme.php');
44
  $email['message'] = ob_get_clean();
 
45
 
46
  ob_start();
47
  include $module->get_current_theme_file_path('theme-text.php');
48
  $email['message_text'] = ob_get_clean();
 
49
 
50
  $email['type'] = 'message';
51
  $email['send_on'] = time();
54
  <script>
55
  location.href="admin.php?page=newsletter/emails/edit.php&id=<?php echo $email->id; ?>";
56
  </script>
57
+ <div class="wrap">
58
+ <p>If you are not automatically redirected to the composer, <a href="admin.php?page=newsletter/emails/edit.php&id=<?php echo $email->id; ?>">click here</a>.</p>
59
+ </div>
60
  <?php
61
  return;
62
  }
144
 
145
 
146
  <div id="tabs-2">
147
+ <iframe src="<?php echo wp_nonce_url(NEWSLETTER_URL . '/emails/preview.php?' . time()); ?>" width="100%" height="500"></iframe>
148
  </div>
149
 
150
 
151
  <div id="tabs-3">
152
+ <iframe src="<?php echo wp_nonce_url(NEWSLETTER_URL . '/emails/preview-text.php?' . time()); ?>" width="100%" height="500"></iframe>
153
  </div>
154
 
155
  <div id="tabs-4">
emails/preview-text.php CHANGED
@@ -1,12 +1,15 @@
1
  <?php
2
- header('Content-Type: text/plain');
3
 
4
  include '../../../../wp-load.php';
5
 
6
- if (get_current_user_id() != 1)
7
  die('Only the administrator can view the preview');
8
 
9
  // Used by theme code
10
  $theme_options = NewsletterEmails::instance()->get_current_theme_options();
11
 
12
- include(NewsletterEmails::instance()->get_current_theme_file_path('theme-text.php'));
 
 
 
1
  <?php
2
+ header('Content-Type: text/plain;charset=UTF-8');
3
 
4
  include '../../../../wp-load.php';
5
 
6
+ if (!check_admin_referer())
7
  die('Only the administrator can view the preview');
8
 
9
  // Used by theme code
10
  $theme_options = NewsletterEmails::instance()->get_current_theme_options();
11
 
12
+ $file = NewsletterEmails::instance()->get_current_theme_file_path('theme-text.php');
13
+ if (is_file($file)) {
14
+ include(NewsletterEmails::instance()->get_current_theme_file_path('theme-text.php'));
15
+ }
emails/preview.php CHANGED
@@ -2,11 +2,13 @@
2
 
3
  include '../../../../wp-load.php';
4
 
5
- if (get_current_user_id() != 1)
6
  die('Only the administrator can view the preview');
7
 
8
  // Used by theme code
9
  $theme_options = NewsletterEmails::instance()->get_current_theme_options();
10
  $theme_url = NewsletterEmails::instance()->get_current_theme_url();
11
 
 
 
12
  include(NewsletterEmails::instance()->get_current_theme_file_path('theme.php'));
2
 
3
  include '../../../../wp-load.php';
4
 
5
+ if (!check_admin_referer())
6
  die('Only the administrator can view the preview');
7
 
8
  // Used by theme code
9
  $theme_options = NewsletterEmails::instance()->get_current_theme_options();
10
  $theme_url = NewsletterEmails::instance()->get_current_theme_url();
11
 
12
+ header('Content-Type: text/html;charset=UTF-8');
13
+
14
  include(NewsletterEmails::instance()->get_current_theme_file_path('theme.php'));
example/base.php DELETED
@@ -1,73 +0,0 @@
1
- <?php
2
- /**
3
- * This is only a module example. Pay attention to correct all the "NewsletterBase" references, even most of them
4
- * are only useful for code completion inside IDEs like Netbeans.
5
- */
6
- require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
7
-
8
- class NewsletterBase extends NewsletterModule {
9
-
10
- /**
11
- * Use to track the current version. A version change, see the construction, triggers an upgrade.
12
- */
13
- const VERSION = '1.0.0';
14
-
15
- /**
16
- * Internal variable used to keep the module instance when the singleton pattern is used (recommended).
17
- * @var NewsletterBase
18
- */
19
- static private $instance;
20
-
21
- /**
22
- * Create an instance of this module. Cannot done on NewsletterModule since there is no way to reference the
23
- * extending class (need PHP 5.3 to do that).
24
- * @return NewsletterBase
25
- */
26
- static function instance() {
27
- if (self::$instance == null) {
28
- self::$instance = new NewsletterBase();
29
- }
30
- return self::$instance;
31
- }
32
-
33
- function __construct() {
34
- // Pay attetion to module name that must be tha same of the containing folder basename. The module name
35
- // can be replaced with basename(dirname(__FILE__)) but it's a lot less efficient.
36
- parent::__construct('base', self::VERSION);
37
- }
38
-
39
- /**
40
- * Called when there is a version change or when explicitely triggered. Add here the installation/upgrade code.
41
- *
42
- * @global type $wpdb
43
- * @global type $charset_collate
44
- */
45
- function upgrade() {
46
- global $wpdb, $charset_collate;
47
-
48
- // That call loads initialize the module options if they are not present on database. Multilangua options can
49
- // be stored under the "language" folder of this module. See documentation on site.
50
- parent::upgrade();
51
-
52
- // Use $this->upgrade_query() se the query will be logged.
53
- //$this->upgrade_query("create table if not exists {$wpdb->prefix}newsletter_table (id int auto_increment, primary key (id)) $charset_collate");
54
- }
55
-
56
- }
57
-
58
- // Registering here the actions/filters we avoid to initialize the module when not needed.
59
- add_action('newsletter_admin_menu', 'newsletter_base_admin_menu');
60
-
61
- /**
62
- * Add menu pages for this module.
63
- * @global Newsletter $newsletter
64
- */
65
- function newsletter_base_admin_menu() {
66
- global $newsletter;
67
-
68
- // The global $newsletter variable can be used in place of Newsletter::instance() that is less performant. Newsletter
69
- // class is always initialized and an instance associated to the $newsletter global variable.
70
- $newsletter->add_menu_page('statistics', 'index', 'Statistics');
71
- $newsletter->add_admin_page('statistics', 'view', 'Statistics');
72
- }
73
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
example/index.php DELETED
@@ -1,66 +0,0 @@
1
- <?php
2
- require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
- $module = NewsletterStatistics::instance();
4
- $controls = new NewsletterControls();
5
- $emails = Newsletter::instance()->get_emails();
6
-
7
- if ($controls->is_action('save')) {
8
- $module->save_options($controls->data);
9
- $controls->messages = 'Saved.';
10
- }
11
- ?>
12
-
13
- <div class="wrap">
14
- <h2>Statistics</h2>
15
- <p>
16
- This is the basic version of Newsletter Statistics module. Single email statistics can be accessed directly from
17
- email list on Emails, Updates, Follow Up panels. Below the complete list.
18
- </p>
19
-
20
- <form method="post">
21
- <?php $controls->init(); ?>
22
-
23
- <table class="form-table">
24
- <tr>
25
- <th>Log level</th>
26
- <td>
27
- <?php $controls->log_level(); ?>
28
- </td>
29
- </tr>
30
- </table>
31
- <p><?php $controls->button('save', 'Save'); ?>
32
- </form>
33
-
34
- <table class="widefat" style="width: auto">
35
- <thead>
36
- <tr>
37
- <th>Id</th>
38
- <th>Subject</th>
39
- <th>Date</th>
40
- <th>Type</th>
41
- <th>Status</th>
42
- <th>&nbsp;</th>
43
- </tr>
44
- </thead>
45
-
46
- <tbody>
47
- <?php foreach ($emails as &$email) { ?>
48
- <tr>
49
- <td><?php echo $email->id; ?></td>
50
- <td><?php echo htmlspecialchars($email->subject); ?></td>
51
- <td><?php echo $email->date; ?></td>
52
- <td><?php echo $email->type; ?></td>
53
- <td>
54
- <?php echo $email->status; ?>
55
- (<?php echo $email->sent; ?>/<?php echo $email->total; ?>)
56
- </td>
57
- <td>
58
- <a class="button" href="<?php echo NewsletterStatistics::instance()->get_statistics_url($email->id); ?>">statistics</a>
59
- </td>
60
- </tr>
61
- <?php } ?>
62
- </tbody>
63
- </table>
64
- </div>
65
-
66
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
feed/whatis.txt DELETED
@@ -1 +0,0 @@
1
- Reserved for feed integration.
 
header.php CHANGED
@@ -1,3 +1,12 @@
 
 
 
 
 
 
 
 
 
1
  <div id="newsletter-header">
2
  <a href="<?php echo $help_url?$help_url:'http://www.satollo.net/plugins/newsletter/newsletter-configuration'; ?>" target="_blank">Get Help</a>
3
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-faq" target="_blank">FAQ</a>
@@ -17,4 +26,13 @@
17
  Engine next run in <?php echo wp_next_scheduled('newsletter') - time(); ?> s
18
  </div>
19
 
 
 
 
 
 
 
 
 
 
20
  <?php $newsletter->warnings(); ?>
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
  <div id="newsletter-header">
11
  <a href="<?php echo $help_url?$help_url:'http://www.satollo.net/plugins/newsletter/newsletter-configuration'; ?>" target="_blank">Get Help</a>
12
  <a href="http://www.satollo.net/plugins/newsletter/newsletter-faq" target="_blank">FAQ</a>
26
  Engine next run in <?php echo wp_next_scheduled('newsletter') - time(); ?> s
27
  </div>
28
 
29
+ <?php if ($dismissed['rate'] != 1) { ?>
30
+ <div class="newsletter-notice">
31
+ I never asked before and I'm curious: <a href="http://wordpress.org/extend/plugins/newsletter/" target="_blank">would you rate this plugin</a>?
32
+ (few seconds required). (account on WordPress.org required, every blog owner should have one...). <strong>Really appreciated, Stefano</strong>.
33
+ <div class="newsletter-dismiss"><a href="<?php echo wp_nonce_url($_SERVER['REQUEST_URI'] . '&dismiss=rate')?>">Dismiss</a></div>
34
+ <div style="clear: both"></div>
35
+ </div>
36
+ <?php } ?>
37
+
38
  <?php $newsletter->warnings(); ?>
includes/controls.php CHANGED
@@ -26,10 +26,7 @@ class NewsletterControls {
26
 
27
  $time = gmmktime($_REQUEST[$name . '_hour'], 0, 0,
28
  $_REQUEST[$name . '_month'], $_REQUEST[$name . '_day'], $_REQUEST[$name . '_year']);
29
- echo $_REQUEST[$name . '_year'];
30
  $time -= get_option('gmt_offset') * 3600;
31
- //echo date('Y-m-j', $time);
32
- // echo $time;
33
  $this->data[$name] = $time;
34
  }
35
  }
@@ -236,14 +233,18 @@ class NewsletterControls {
236
  echo htmlspecialchars($this->data[$name]);
237
  echo '</textarea>';
238
  }
 
 
 
 
239
 
240
  function textarea($name, $width = '100%', $height = '50') {
241
- echo '<textarea class="dymanic" name="options[' . $name . ']" wrap="off" style="width:' . $width . ';height:' . $height . '">';
242
  echo htmlspecialchars($this->data[$name]);
243
  echo '</textarea>';
244
  }
245
 
246
- function textarea_fixed($name, $width = '100%', $height = '50') {
247
  echo '<textarea name="options[' . $name . ']" wrap="off" style="width:' . $width . ';height:' . $height . 'px">';
248
  echo htmlspecialchars($this->data[$name]);
249
  echo '</textarea>';
26
 
27
  $time = gmmktime($_REQUEST[$name . '_hour'], 0, 0,
28
  $_REQUEST[$name . '_month'], $_REQUEST[$name . '_day'], $_REQUEST[$name . '_year']);
 
29
  $time -= get_option('gmt_offset') * 3600;
 
 
30
  $this->data[$name] = $time;
31
  }
32
  }
233
  echo htmlspecialchars($this->data[$name]);
234
  echo '</textarea>';
235
  }
236
+
237
+ function wp_editor($name, $settings = array()) {
238
+ wp_editor($this->data[$name], $name, array_merge(array('textarea_name'=>'options[' . $name . ']', 'wpautop'=>false), $settings));
239
+ }
240
 
241
  function textarea($name, $width = '100%', $height = '50') {
242
+ echo '<textarea class="dynamic" name="options[' . $name . ']" wrap="off" style="width:' . $width . ';height:' . $height . '">';
243
  echo htmlspecialchars($this->data[$name]);
244
  echo '</textarea>';
245
  }
246
 
247
+ function textarea_fixed($name, $width = '100%', $height = '200') {
248
  echo '<textarea name="options[' . $name . ']" wrap="off" style="width:' . $width . ';height:' . $height . 'px">';
249
  echo htmlspecialchars($this->data[$name]);
250
  echo '</textarea>';
includes/module.php CHANGED
@@ -94,11 +94,16 @@ class NewsletterModule {
94
 
95
  function get_default_options($sub = '') {
96
  if ($sub != '') $sub .= '-';
97
- @include NEWSLETTER_DIR . '/' . $this->module . '/languages/' . $sub . '/en_US.php';
98
  @include NEWSLETTER_DIR . '/' . $this->module . '/languages/' . $sub . WPLANG . '.php';
99
  if (!is_array($options)) return array();
100
  return $options;
101
  }
 
 
 
 
 
102
 
103
  function save_options($options, $sub = '') {
104
  update_option($this->get_prefix($sub), $options);
@@ -107,7 +112,7 @@ class NewsletterModule {
107
  }
108
 
109
  function backup_options($sub) {
110
- $options = $this->get_options();
111
  add_option($this->get_prefix($sub) . '_backup', '', null, 'no');
112
  update_option($this->get_prefix($sub) . '_backup', $options);
113
  }
94
 
95
  function get_default_options($sub = '') {
96
  if ($sub != '') $sub .= '-';
97
+ @include NEWSLETTER_DIR . '/' . $this->module . '/languages/' . $sub . 'en_US.php';
98
  @include NEWSLETTER_DIR . '/' . $this->module . '/languages/' . $sub . WPLANG . '.php';
99
  if (!is_array($options)) return array();
100
  return $options;
101
  }
102
+
103
+ function reset_options($sub = '') {
104
+ $this->save_options(array_merge($this->get_options($sub), $this->get_default_options($sub)), $sub);
105
+ return $this->get_options($sub);
106
+ }
107
 
108
  function save_options($options, $sub = '') {
109
  update_option($this->get_prefix($sub), $options);
112
  }
113
 
114
  function backup_options($sub) {
115
+ $options = $this->get_options($sub);
116
  add_option($this->get_prefix($sub) . '_backup', '', null, 'no');
117
  update_option($this->get_prefix($sub) . '_backup', $options);
118
  }
includes/store.php CHANGED
@@ -32,7 +32,7 @@ class NewsletterStore {
32
 
33
  function get_field($table, $id, $field_name) {
34
  global $wpdb;
35
- $r = $wpdb->get_var("select $field_name from $table where id=" . (int)$id . " limit 1");
36
  if ($wpdb->last_error) {
37
  $this->logger->error($wpdb->last_error);
38
  return false;
@@ -41,7 +41,8 @@ class NewsletterStore {
41
  }
42
 
43
  function get_single($table, $id, $format = OBJECT) {
44
- return $this->get_single_by_query("select * from $table where id=$id limit 1", $format);
 
45
  }
46
 
47
  function get_single_by_field($table, $field_name, $field_value) {
@@ -68,7 +69,7 @@ class NewsletterStore {
68
  * @param type $format
69
  * @return boolean|mixed
70
  */
71
- function get_single_by_query($query, $format=OBJECT) {
72
  global $wpdb;
73
  $r = $wpdb->get_row($query, $format);
74
  if ($wpdb->last_error) {
@@ -123,9 +124,19 @@ class NewsletterStore {
123
  return $result;
124
  }
125
 
 
 
 
 
 
 
126
  function delete($table, $id) {
127
  global $wpdb;
128
- $wpdb->delete($table, array('id' => $id));
 
 
 
 
129
  if ($wpdb->last_error) {
130
  $this->logger->error($wpdb->last_error);
131
  return false;
@@ -141,7 +152,7 @@ class NewsletterStore {
141
  * @param type $format
142
  * @return type
143
  */
144
- function get_all($table, $where=null, $format = OBJECT) {
145
  global $wpdb;
146
  if ($where == null) {
147
  $result = $wpdb->get_results("select * from $table", $format);
@@ -151,10 +162,10 @@ class NewsletterStore {
151
  return $result;
152
  }
153
 
154
- function set_field($table, $id, $field, $value)
155
- {
156
  global $wpdb;
157
- $result = $wpdb->query($wpdb->prepare("update $table set $field=%s where id=$id", $value));
 
158
 
159
  if ($wpdb->last_error) {
160
  $this->logger->error($wpdb->last_error);
@@ -162,8 +173,8 @@ class NewsletterStore {
162
  }
163
 
164
  return $result;
165
-
166
  }
 
167
  function query($query) {
168
  global $wpdb;
169
  $result = $wpdb->query($query);
32
 
33
  function get_field($table, $id, $field_name) {
34
  global $wpdb;
35
+ $r = $wpdb->get_var($wpdb->prepare("select $field_name from $table where id=%d limit 1", $id));
36
  if ($wpdb->last_error) {
37
  $this->logger->error($wpdb->last_error);
38
  return false;
41
  }
42
 
43
  function get_single($table, $id, $format = OBJECT) {
44
+ global $wpdb;
45
+ return $this->get_single_by_query($wpdb->prepare("select * from $table where id=%d limit 1", $id), $format);
46
  }
47
 
48
  function get_single_by_field($table, $field_name, $field_value) {
69
  * @param type $format
70
  * @return boolean|mixed
71
  */
72
+ function get_single_by_query($query, $format = OBJECT) {
73
  global $wpdb;
74
  $r = $wpdb->get_row($query, $format);
75
  if ($wpdb->last_error) {
124
  return $result;
125
  }
126
 
127
+ /**
128
+ * Deletes one or more rows by id (or an array of id)
129
+ *
130
+ * @param int|array $id
131
+ * @return int Number of rows deleted
132
+ */
133
  function delete($table, $id) {
134
  global $wpdb;
135
+ if (is_array($id)) {
136
+ $wpdb->query("delete from " . $table . " where id in (" . implode(',', $id) . ")");
137
+ } else {
138
+ $wpdb->delete($table, array('id' => $id));
139
+ }
140
  if ($wpdb->last_error) {
141
  $this->logger->error($wpdb->last_error);
142
  return false;
152
  * @param type $format
153
  * @return type
154
  */
155
+ function get_all($table, $where = null, $format = OBJECT) {
156
  global $wpdb;
157
  if ($where == null) {
158
  $result = $wpdb->get_results("select * from $table", $format);
162
  return $result;
163
  }
164
 
165
+ function set_field($table, $id, $field, $value) {
 
166
  global $wpdb;
167
+ // For security check the field name
168
+ $result = $wpdb->query($wpdb->prepare("update $table set $field=%s where id=%d", $value, $id));
169
 
170
  if ($wpdb->last_error) {
171
  $this->logger->error($wpdb->last_error);
173
  }
174
 
175
  return $result;
 
176
  }
177
+
178
  function query($query) {
179
  global $wpdb;
180
  $result = $wpdb->query($query);
main.php CHANGED
@@ -32,10 +32,10 @@ if (!$controls->is_action()) {
32
  $controls->errors .= 'Return path email is not correct.<br />';
33
  }
34
 
35
- $controls->data['test_email'] = $newsletter->normalize_email($controls->data['test_email']);
36
- if (!$newsletter->is_email($controls->data['test_email'], true)) {
37
- $controls->errors .= 'Test email is not correct.<br />';
38
- }
39
 
40
  $controls->data['reply_to'] = $newsletter->normalize_email($controls->data['reply_to']);
41
  if (!$newsletter->is_email($controls->data['reply_to'], true)) {
@@ -79,12 +79,11 @@ if (!$controls->is_action()) {
79
 
80
  $mail->SMTPKeepAlive = true;
81
  $mail->ClearAddresses();
82
- $mail->AddAddress($controls->data['test_email']);
83
  ob_start();
84
  $mail->Send();
85
  $mail->SmtpClose();
86
  $debug = htmlspecialchars(ob_get_clean());
87
- ob_end_clean();
88
 
89
  if ($mail->IsError()) $controls->errors = $mail->ErrorInfo;
90
  else $controls->messages = 'Success.';
@@ -291,6 +290,15 @@ if (!$controls->is_action()) {
291
  </div>
292
  </td>
293
  </tr>
 
 
 
 
 
 
 
 
 
294
  </table>
295
  <?php $controls->button('smtp_test', 'Test'); ?>
296
 
32
  $controls->errors .= 'Return path email is not correct.<br />';
33
  }
34
 
35
+ //$controls->data['test_email'] = $newsletter->normalize_email($controls->data['test_email']);
36
+ //if (!$newsletter->is_email($controls->data['test_email'], true)) {
37
+ // $controls->errors .= 'Test email is not correct.<br />';
38
+ //}
39
 
40
  $controls->data['reply_to'] = $newsletter->normalize_email($controls->data['reply_to']);
41
  if (!$newsletter->is_email($controls->data['reply_to'], true)) {
79
 
80
  $mail->SMTPKeepAlive = true;
81
  $mail->ClearAddresses();
82
+ $mail->AddAddress($controls->data['smtp_test_email']);
83
  ob_start();
84
  $mail->Send();
85
  $mail->SmtpClose();
86
  $debug = htmlspecialchars(ob_get_clean());
 
87
 
88
  if ($mail->IsError()) $controls->errors = $mail->ErrorInfo;
89
  else $controls->messages = 'Success.';
290
  </div>
291
  </td>
292
  </tr>
293
+ <tr>
294
+ <th>Test email address</th>
295
+ <td>
296
+ <?php $controls->text('smtp_test_email', 30); ?>
297
+ <div class="hints">
298
+ SMTP test will be addressed to this email
299
+ </div>
300
+ </td>
301
+ </tr>
302
  </table>
303
  <?php $controls->button('smtp_test', 'Test'); ?>
304
 
plugin-menu.inc.php CHANGED
@@ -1,6 +1,6 @@
1
  <?php
2
 
3
- $level = $this->options_main['editor'] ? 7 : 10;
4
 
5
  add_menu_page('Newsletter', 'Newsletter', $level, 'newsletter/welcome.php', '', '');
6
  //add_submenu_page('newsletter/welcome.php', 'User Guide', 'User Guide', $level, 'newsletter/main.php');
1
  <?php
2
 
3
+ $level = $this->options['editor'] ? 7 : 10;
4
 
5
  add_menu_page('Newsletter', 'Newsletter', $level, 'newsletter/welcome.php', '', '');
6
  //add_submenu_page('newsletter/welcome.php', 'User Guide', 'User Guide', $level, 'newsletter/main.php');
plugin.php CHANGED
@@ -3,8 +3,8 @@
3
  /*
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.0.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.
@@ -13,7 +13,7 @@
13
  */
14
 
15
  // Useed as dummy parameter on css and js links
16
- define('NEWSLETTER_VERSION', '3.0.0');
17
 
18
  global $wpdb, $newsletter;
19
 
@@ -56,7 +56,7 @@ require_once NEWSLETTER_INCLUDES_DIR . '/themes.php';
56
 
57
  class Newsletter extends NewsletterModule {
58
 
59
- const VERSION = '1.0.7';
60
 
61
  // Limits to respect to avoid memory, time or provider limits
62
  var $time_limit;
@@ -148,7 +148,8 @@ class Newsletter extends NewsletterModule {
148
  $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column send_on int not null default 0");
149
  $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column track tinyint not null default 0");
150
  $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column editor tinyint not null default 0");
151
- $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column sex char(1) not null default 'n'");
 
152
 
153
  $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column query text");
154
  $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column preferences text");
@@ -208,8 +209,7 @@ class Newsletter extends NewsletterModule {
208
  $x = wp_next_scheduled('newsletter');
209
  if ($x === false) {
210
  $warnings .= 'The delivery engine is off (it should never be off). See the System Check below to reactivate it.<br>';
211
- }
212
- else if (time() - $x > 900) {
213
  $warnings .= 'The cron system seems not running correctly. See <a href="http://www.satollo.net/how-to-make-the-wordpress-cron-work" target="_blank">this page</a> for more information.<br>';
214
  }
215
 
@@ -276,7 +276,6 @@ class Newsletter extends NewsletterModule {
276
  do_action('newsletter_admin_menu');
277
 
278
  add_submenu_page('newsletter/welcome.php', 'Diagnostic', 'Diagnostic', $level, 'newsletter/diagnostic.php');
279
-
280
  }
281
 
282
  function hook_wp_head() {
@@ -289,7 +288,10 @@ class Newsletter extends NewsletterModule {
289
  // TODO: move on subscription module
290
  $profile_options = get_option('newsletter_profile');
291
  if ($profile_options['style'] != '') {
292
- echo '<link href="' . NewsletterSubscription::instance()->get_style_url($profile_options['style']) . '" type="text/css" rel="stylesheet">\n';
 
 
 
293
  }
294
  }
295
 
@@ -422,8 +424,7 @@ class Newsletter extends NewsletterModule {
422
 
423
  $wpdb->query("set session wait_timeout=300");
424
  // From default-constants.php
425
- if (function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < 128 ))
426
- @ini_set('memory_limit', '256M');
427
 
428
  $this->limits_set = true;
429
  }
@@ -464,8 +465,7 @@ class Newsletter extends NewsletterModule {
464
  if (!is_array($message)) {
465
  $this->mailer->IsHTML(true);
466
  $this->mailer->Body = $message;
467
- }
468
- else {
469
  // Only html is present?
470
  if (empty($message['text'])) {
471
  $this->mailer->IsHTML(true);
@@ -475,8 +475,7 @@ class Newsletter extends NewsletterModule {
475
  else if (empty($message['html'])) {
476
  $this->mailer->IsHTML(false);
477
  $this->mailer->Body = $message['text'];
478
- }
479
- else {
480
  $this->mailer->IsHTML(true);
481
 
482
  $this->mailer->Body = $message['html'];
@@ -527,8 +526,7 @@ class Newsletter extends NewsletterModule {
527
  }
528
  else $this->mailer->IsMail();
529
 
530
- if (!empty($this->options['content_transfer_encoding']))
531
- $this->mailer->Encoding = $this->options['content_transfer_encoding'];
532
 
533
  $this->mailer->CharSet = 'UTF-8';
534
  $this->mailer->From = $this->options['sender_email'];
@@ -675,8 +673,7 @@ class Newsletter extends NewsletterModule {
675
  $text = str_replace('{key}', $user->id . '-' . $user->token, $text);
676
  $text = str_replace('%7Bkey%7D', $user->id . '-' . $user->token, $text);
677
 
678
- if (strpos($text, '{profile_form}') !== false)
679
- $text = str_replace('{profile_form}', NewsletterSubscription::instance()->get_profile_form($user), $text);
680
 
681
  for ($i = 1; $i < NEWSLETTER_PROFILE_MAX; $i++) {
682
  $p = 'profile_' . $i;
@@ -708,10 +705,8 @@ class Newsletter extends NewsletterModule {
708
  $text = $this->replace_url($text, 'FEED_UNSUBSCRIPTION_URL', self::add_qs($base, 'nm=eu' . $id_token));
709
 
710
  $options_profile = get_option('newsletter_profile');
711
- if (empty($options_profile['profile_url']))
712
- $text = $this->replace_url($text, 'PROFILE_URL', NEWSLETTER_PROFILE_URL . '?nk=' . $nk);
713
- else
714
- $text = $this->replace_url($text, 'PROFILE_URL', self::add_qs($options_profile['profile_url'], 'ni=' . $user->id . '&amp;nt=' . $user->token));
715
 
716
  //$text = $this->replace_url($text, 'UNLOCK_URL', self::add_qs($this->options_main['lock_url'], 'nm=m' . $id_token));
717
  $text = $this->replace_url($text, 'UNLOCK_URL', NEWSLETTER_UNLOCK_URL . '?nk=' . $nk);
@@ -723,6 +718,14 @@ class Newsletter extends NewsletterModule {
723
  $text = $this->replace_url($text, 'LIST_' . $i . '_SUBSCRIPTION_URL', self::add_qs($base, 'nm=ls&amp;nl=' . $i . $id_token));
724
  $text = $this->replace_url($text, 'LIST_' . $i . '_UNSUBSCRIPTION_URL', self::add_qs($base, 'nm=lu&amp;nl=' . $i . $id_token));
725
  }
 
 
 
 
 
 
 
 
726
  }
727
  return $text;
728
  }
@@ -840,8 +843,8 @@ class Newsletter extends NewsletterModule {
840
  $file = NEWSLETTER_DIR . '/' . $module . '/' . $page . '.php';
841
  }
842
  $name = 'newsletter_' . $module . '_' . $page;
843
- eval('function ' . $name . '(){global $newsletter;require "' . $file . '";}');
844
- add_submenu_page('newsletter/welcome.php', $title, $title, 10, $name, $name);
845
  }
846
 
847
  function add_admin_page($module, $page, $title) {
@@ -852,8 +855,8 @@ class Newsletter extends NewsletterModule {
852
  }
853
 
854
  $name = 'newsletter_' . $module . '_' . $page;
855
- eval('function ' . $name . '(){global $newsletter;require "' . $file . '";}');
856
- add_submenu_page(null, $title, $title, 10, $name, $name);
857
  }
858
 
859
  function get_emails($type = null, $format = OBJECT) {
@@ -888,13 +891,15 @@ class Newsletter extends NewsletterModule {
888
  }
889
 
890
  /**
 
 
891
  * Saves a new user on the database. Return false if the email (that must be unique) is already
892
  * there. For a new users set the token and creation time if not passed.
893
  *
894
  * @param type $user
895
  * @return type
896
  */
897
- function save_user($user, $return_format=OBJECT) {
898
  if (is_object($user)) $user = (array) $user;
899
  if (empty($user['id'])) {
900
  if (empty($user['token'])) $user['token'] = NewsletterModule::get_token();
@@ -922,7 +927,7 @@ class Newsletter extends NewsletterModule {
922
  * @param type $format
923
  * @return boolean
924
  */
925
- function get_user($id_or_email, $format=OBJECT) {
926
  global $wpdb;
927
 
928
  // To simplify the reaload of a user passing the user it self.
@@ -948,7 +953,7 @@ class Newsletter extends NewsletterModule {
948
  global $wpdb;
949
  $r = $this->store->delete(NEWSLETTER_USERS_TABLE, $id);
950
  if ($r !== false) {
951
- $wpdb->delete(NEWSLETTER_STATS_TABLE, array('user_id'=>$id));
952
  }
953
  }
954
 
@@ -969,7 +974,6 @@ class Newsletter extends NewsletterModule {
969
  return $r;
970
  }
971
 
972
-
973
  }
974
 
975
  // Newsletter will be always instantiated.
3
  /*
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. Please, do not update while the plugin is delivering a newsletter.
7
+ Version: 3.0.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.
13
  */
14
 
15
  // Useed as dummy parameter on css and js links
16
+ define('NEWSLETTER_VERSION', '3.0.9');
17
 
18
  global $wpdb, $newsletter;
19
 
56
 
57
  class Newsletter extends NewsletterModule {
58
 
59
+ const VERSION = '1.1.0';
60
 
61
  // Limits to respect to avoid memory, time or provider limits
62
  var $time_limit;
148
  $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column send_on int not null default 0");
149
  $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column track tinyint not null default 0");
150
  $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column editor tinyint not null default 0");
151
+ $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column sex varchar(10) not null default ''");
152
+ $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails change column sex sex varchar(10) not null default ''");
153
 
154
  $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column query text");
155
  $this->upgrade_query("alter table " . $wpdb->prefix . "newsletter_emails add column preferences text");
209
  $x = wp_next_scheduled('newsletter');
210
  if ($x === false) {
211
  $warnings .= 'The delivery engine is off (it should never be off). See the System Check below to reactivate it.<br>';
212
+ } else if (time() - $x > 900) {
 
213
  $warnings .= 'The cron system seems not running correctly. See <a href="http://www.satollo.net/how-to-make-the-wordpress-cron-work" target="_blank">this page</a> for more information.<br>';
214
  }
215
 
276
  do_action('newsletter_admin_menu');
277
 
278
  add_submenu_page('newsletter/welcome.php', 'Diagnostic', 'Diagnostic', $level, 'newsletter/diagnostic.php');
 
279
  }
280
 
281
  function hook_wp_head() {
288
  // TODO: move on subscription module
289
  $profile_options = get_option('newsletter_profile');
290
  if ($profile_options['style'] != '') {
291
+ echo '<link href="' . NewsletterSubscription::instance()->get_style_url($profile_options['style']) . '" type="text/css" rel="stylesheet">';
292
+ }
293
+ if ($profile_options['widget_style'] != '') {
294
+ echo '<link href="' . NewsletterSubscription::instance()->get_style_url($profile_options['widget_style']) . '" type="text/css" rel="stylesheet">';
295
  }
296
  }
297
 
424
 
425
  $wpdb->query("set session wait_timeout=300");
426
  // From default-constants.php
427
+ if (function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < 128 )) @ini_set('memory_limit', '256M');
 
428
 
429
  $this->limits_set = true;
430
  }
465
  if (!is_array($message)) {
466
  $this->mailer->IsHTML(true);
467
  $this->mailer->Body = $message;
468
+ } else {
 
469
  // Only html is present?
470
  if (empty($message['text'])) {
471
  $this->mailer->IsHTML(true);
475
  else if (empty($message['html'])) {
476
  $this->mailer->IsHTML(false);
477
  $this->mailer->Body = $message['text'];
478
+ } else {
 
479
  $this->mailer->IsHTML(true);
480
 
481
  $this->mailer->Body = $message['html'];
526
  }
527
  else $this->mailer->IsMail();
528
 
529
+ if (!empty($this->options['content_transfer_encoding'])) $this->mailer->Encoding = $this->options['content_transfer_encoding'];
 
530
 
531
  $this->mailer->CharSet = 'UTF-8';
532
  $this->mailer->From = $this->options['sender_email'];
673
  $text = str_replace('{key}', $user->id . '-' . $user->token, $text);
674
  $text = str_replace('%7Bkey%7D', $user->id . '-' . $user->token, $text);
675
 
676
+ if (strpos($text, '{profile_form}') !== false) $text = str_replace('{profile_form}', NewsletterSubscription::instance()->get_profile_form($user), $text);
 
677
 
678
  for ($i = 1; $i < NEWSLETTER_PROFILE_MAX; $i++) {
679
  $p = 'profile_' . $i;
705
  $text = $this->replace_url($text, 'FEED_UNSUBSCRIPTION_URL', self::add_qs($base, 'nm=eu' . $id_token));
706
 
707
  $options_profile = get_option('newsletter_profile');
708
+ if (empty($options_profile['profile_url'])) $text = $this->replace_url($text, 'PROFILE_URL', NEWSLETTER_PROFILE_URL . '?nk=' . $nk);
709
+ else $text = $this->replace_url($text, 'PROFILE_URL', self::add_qs($options_profile['profile_url'], 'ni=' . $user->id . '&amp;nt=' . $user->token));
 
 
710
 
711
  //$text = $this->replace_url($text, 'UNLOCK_URL', self::add_qs($this->options_main['lock_url'], 'nm=m' . $id_token));
712
  $text = $this->replace_url($text, 'UNLOCK_URL', NEWSLETTER_UNLOCK_URL . '?nk=' . $nk);
718
  $text = $this->replace_url($text, 'LIST_' . $i . '_SUBSCRIPTION_URL', self::add_qs($base, 'nm=ls&amp;nl=' . $i . $id_token));
719
  $text = $this->replace_url($text, 'LIST_' . $i . '_UNSUBSCRIPTION_URL', self::add_qs($base, 'nm=lu&amp;nl=' . $i . $id_token));
720
  }
721
+
722
+ // Profile fields change links
723
+ $text = $this->replace_url($text, 'SET_SEX_MALE', NEWSLETTER_CHANGE_URL . '?nk=' . $nk . '&nf=sex&nv=m');
724
+ $text = $this->replace_url($text, 'SET_SEX_FEMALE', NEWSLETTER_CHANGE_URL . '?nk=' . $nk . '&nf=sex&nv=f');
725
+ $text = $this->replace_url($text, 'SET_FEED', NEWSLETTER_CHANGE_URL . '?nk=' . $nk . '&nf=feed');
726
+ for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
727
+ $text = $this->replace_url($text, 'SET_PREFERENCE_' . $i, NEWSLETTER_CHANGE_URL . '?nk=' . $nk . '&nf=preference_' . $i);
728
+ }
729
  }
730
  return $text;
731
  }
843
  $file = NEWSLETTER_DIR . '/' . $module . '/' . $page . '.php';
844
  }
845
  $name = 'newsletter_' . $module . '_' . $page;
846
+ eval('function ' . $name . '(){global $newsletter;require \'' . $file . '\';}');
847
+ add_submenu_page('newsletter/welcome.php', $title, $title, $this->options['editor'] ? 7 : 10, $name, $name);
848
  }
849
 
850
  function add_admin_page($module, $page, $title) {
855
  }
856
 
857
  $name = 'newsletter_' . $module . '_' . $page;
858
+ eval('function ' . $name . '(){global $newsletter;require \'' . $file . '\';}');
859
+ add_submenu_page(null, $title, $title, $this->options['editor'] ? 7 : 10, $name, $name);
860
  }
861
 
862
  function get_emails($type = null, $format = OBJECT) {
891
  }
892
 
893
  /**
894
+ * NEVER CHANGE THIS METHOD SIGNATURE, USER BY THIRD PARTY PLUGINS.
895
+ *
896
  * Saves a new user on the database. Return false if the email (that must be unique) is already
897
  * there. For a new users set the token and creation time if not passed.
898
  *
899
  * @param type $user
900
  * @return type
901
  */
902
+ function save_user($user, $return_format = OBJECT) {
903
  if (is_object($user)) $user = (array) $user;
904
  if (empty($user['id'])) {
905
  if (empty($user['token'])) $user['token'] = NewsletterModule::get_token();
927
  * @param type $format
928
  * @return boolean
929
  */
930
+ function get_user($id_or_email, $format = OBJECT) {
931
  global $wpdb;
932
 
933
  // To simplify the reaload of a user passing the user it self.
953
  global $wpdb;
954
  $r = $this->store->delete(NEWSLETTER_USERS_TABLE, $id);
955
  if ($r !== false) {
956
+ $wpdb->delete(NEWSLETTER_STATS_TABLE, array('user_id' => $id));
957
  }
958
  }
959
 
974
  return $r;
975
  }
976
 
 
977
  }
978
 
979
  // Newsletter will be always instantiated.
readme.txt CHANGED
@@ -1,7 +1,7 @@
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing
3
  Requires at least: 3.0.0
4
- Tested up to: 3.4.2
5
  Stable tag: trunk
6
  Donate link: http://www.satollo.net/donations
7
 
@@ -56,6 +56,80 @@ No screen shots are available at this time.
56
 
57
  == Changelog ==
58
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
59
  = 3.0.0 =
60
 
61
  * Release
@@ -188,4 +262,27 @@ Version 2.5.0.1
188
  - Fix unsubscription process not working
189
 
190
  Version 2.5.0
191
- - Official first release
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing
3
  Requires at least: 3.0.0
4
+ Tested up to: 3.5
5
  Stable tag: trunk
6
  Donate link: http://www.satollo.net/donations
7
 
56
 
57
  == Changelog ==
58
 
59
+ = 3.1.0 (not released) =
60
+
61
+ * Added link to change preferences/sex from emails
62
+ * Added tag reference on email composer
63
+ * Added "negative" preference selection on email targeting
64
+ * Improved the subscription during WordPress user registration
65
+
66
+ = 3.0.9 =
67
+
68
+ * Fixed an important bug
69
+
70
+ = 3.0.8 =
71
+
72
+ * Fixed the charset on some pages and previews for umlaut characters
73
+
74
+ = 3.0.7 =
75
+
76
+ * Fixed a warning in WP 3.5
77
+ * Fixed the visual editor on/off on composer panel
78
+
79
+ = 3.0.6 =
80
+
81
+ * Added file permissions check on diagnostic panel
82
+ * Fixed the default value for "sex" on email at database level
83
+ * Fixed the checking of required surname
84
+ * Fixed a warning on subscription panel
85
+ * Improved the subscription management for bounced or unsubscribed addresses
86
+ * Removed the simple theme of tinymce to reduce the number of files
87
+ * Added neutral style for subscription form
88
+
89
+ = 3.0.5 =
90
+
91
+ * Added styling for widget
92
+ * Fixed the widget html
93
+ * Fixed the reset button on subscription panels
94
+ * Fixed the language initialization on first installation
95
+ * Fixed save button on profile page (now it can be an image)
96
+ * Fixed email listing showing the planned status
97
+
98
+ = 3.0.4 =
99
+
100
+ * Fixed the alternative email template for subscription messages
101
+ * Added user statistics by referrer (field nr passed during subscription)
102
+ * Added user statistics by http referer (one r missing according to the http protocol)
103
+ * Fixed the preview for themes without textual version
104
+ * Fixed the subscription redirect for blogs without permalink
105
+ * Fixed the "sex" column on database so email configuration is correctly stored
106
+ * Fixed the wp user integration
107
+
108
+ = 3.0.3 =
109
+
110
+ * Fixed documentation on subscription panel and on subscription/page.php file
111
+ * Fixed the statistics module URL rewriting
112
+ * Fixed a "echo" on module.php datetime method
113
+ * Fixed the multi-delete on newsletter list
114
+ * Fixed eval() usage on add_menu_page and add_admin_page function
115
+ * Fixed a number of ob_end_clean() called wht not required and interfering with other output buffering
116
+ * Fixed the editor access level
117
+
118
+ = 3.0.2 =
119
+
120
+ * Documented how to customize the subscription/email.php file (see inside the file) for subscription messages
121
+ * Fixed the confirmation message lost (only for who do not already save the subscription options...)
122
+
123
+ = 3.0.1 =
124
+
125
+ * Fixed an extra character on head when including the form css
126
+ * Fixed the double privacy check on subscription widget
127
+ * Fixed the charset of subscription/page.php
128
+ * Fixed the theme preview with wp_nonce_url
129
+ * Added compatibility code for forms directly coded inside the subscription message
130
+ * Added link to composer when the javascript redirect fails on creation of a new newsletter
131
+ * Fixed the old email list and conversion
132
+
133
  = 3.0.0 =
134
 
135
  * Release
262
  - Fix unsubscription process not working
263
 
264
  Version 2.5.0
265
+ - Official first release
266
+
267
+ = SVN =
268
+
269
+ Actually I'm using SVN in a wrong way (deliberately). Usually development with SNV
270
+ should be done in this way:
271
+
272
+ * the trunk is where the latest (eventually not working code) is available
273
+ * the tags should contains some folders with public releases (stable or beta or alpha)
274
+ * the branches should contains some folders representing stable releases which are there to be eventually fixed
275
+
276
+ For example, when I released the version 3.0 of this plugin, I should have created
277
+ a 3.0 folder inside the branches and fixed it when bug were reported. From time to
278
+ time from that branch I should have created a tag, for example 3.0.4.
279
+
280
+ Actually, to make this tag available it should have been reported on the readme.txt
281
+ committed on the trunk.
282
+
283
+ To make it easier, I keep in the trunk the 3.0 branch and I fix it committing the patches
284
+ and leaving the official stable tag on readme.txt set to "trunk". That helps me
285
+ in quick fixing the plugin without creating tags.
286
+
287
+ On branches I have the 3.1 branch where I'm develping new features and when ready to be
288
+ committed I'll merge them on trunk, updating the trunk.
statistics/statistics.php CHANGED
@@ -64,10 +64,10 @@ class NewsletterStatistics extends NewsletterModule {
64
  }
65
 
66
  function relink_callback($matches) {
 
67
  // Do not replace the tracking or subscription/unsubscription links.
68
  if (strpos($href, '/newsletter/') !== false) return $matches[0];
69
  if (substr($href, 0, 1) == '#') return $matches[0];
70
- $href = str_replace('&amp;', '&', $matches[2]);
71
 
72
  $anchor = '';
73
  if ($this->options['anchor'] == 1) {
64
  }
65
 
66
  function relink_callback($matches) {
67
+ $href = str_replace('&amp;', '&', $matches[2]);
68
  // Do not replace the tracking or subscription/unsubscription links.
69
  if (strpos($href, '/newsletter/') !== false) return $matches[0];
70
  if (substr($href, 0, 1) == '#') return $matches[0];
 
71
 
72
  $anchor = '';
73
  if ($this->options['anchor'] == 1) {
subscription/email.php CHANGED
@@ -1,10 +1,23 @@
1
  <?php
2
-
3
- // TODO: Explain how to customize.
 
 
 
 
 
 
 
 
 
 
 
 
 
4
 
5
  if (is_file(WP_CONTENT_DIR . '/extensions/newsletter/subscription/email.php')) {
6
  include WP_CONTENT_DIR . '/extensions/newsletter/subscription/email.php';
7
- die();
8
  }
9
 
10
  ?>
1
  <?php
2
+ /*
3
+ * To customize this file, do not edit it. Instead use the sample alternative email-alternative.php
4
+ * and copy it on
5
+ *
6
+ * wp-content/extensions/newsletter/subscription/email.php
7
+ *
8
+ * creating the folders as needed. Then customize that file.
9
+ *
10
+ * Remember to keep at least the line of code
11
+ *
12
+ * <?php echo $message; ?>
13
+ *
14
+ * which prints the current email body created by Newsletter based on te current subscription
15
+ * process step.
16
+ */
17
 
18
  if (is_file(WP_CONTENT_DIR . '/extensions/newsletter/subscription/email.php')) {
19
  include WP_CONTENT_DIR . '/extensions/newsletter/subscription/email.php';
20
+ return;
21
  }
22
 
23
  ?>
subscription/languages/de_DE.php CHANGED
@@ -1,10 +1,7 @@
1
  <?php
2
 
3
-
4
- $options = array();
5
-
6
  // Message show after a subbscription request has made.
7
- $options['subscribed_text'] =
8
  "<p>Sie haben sich in unseren Newsletter eingetragen.
9
  In wenigen Minuten erhalten Sie eine Best&auml;tigungs-Email. Folgen Sie dem Link um die Anmeldung zu best&auml;tigen. Sollte die Email nicht innerhalb der n&auml;chsten 15 Minuten in Ihrem Posteingang erscheinen, &uuml;berpr&uuml;fen Sie Ihren Spam-Ordner.</p>";
10
 
1
  <?php
2
 
 
 
 
3
  // Message show after a subbscription request has made.
4
+ $options['confirmation_text'] =
5
  "<p>Sie haben sich in unseren Newsletter eingetragen.
6
  In wenigen Minuten erhalten Sie eine Best&auml;tigungs-Email. Folgen Sie dem Link um die Anmeldung zu best&auml;tigen. Sollte die Email nicht innerhalb der n&auml;chsten 15 Minuten in Ihrem Posteingang erscheinen, &uuml;berpr&uuml;fen Sie Ihren Spam-Ordner.</p>";
7
 
subscription/languages/en_US.php CHANGED
@@ -18,7 +18,7 @@ $options['subscription_text'] =
18
  "{subscription_form}";
19
 
20
  // Message show after a subbscription request has made.
21
- $options['subscribed_text'] =
22
  "<p>You successfully subscribed to my newsletter.
23
  You'll receive in few minutes a confirmation email. Follow the link
24
  in it to confirm the subscription. If the email takes more than 15
18
  "{subscription_form}";
19
 
20
  // Message show after a subbscription request has made.
21
+ $options['confirmation_text'] =
22
  "<p>You successfully subscribed to my newsletter.
23
  You'll receive in few minutes a confirmation email. Follow the link
24
  in it to confirm the subscription. If the email takes more than 15
subscription/languages/es_ES.php CHANGED
@@ -1,10 +1,7 @@
1
  <?php
2
 
3
-
4
- $options = array();
5
-
6
  // Mostrar mensaje despues de una solicitud de suscripcion hecha.
7
- $options['subscribed_text'] =
8
  "<p>Con exito suscrito a mi boletín informativo.
9
  Usted recibirá en pocos minutos un email de confirmacion. Siga el enlace
10
  en el para confirmar la suscripcion. Si el correo tarda mas de 15
1
  <?php
2
 
 
 
 
3
  // Mostrar mensaje despues de una solicitud de suscripcion hecha.
4
+ $options['confirmation_text'] =
5
  "<p>Con exito suscrito a mi boletín informativo.
6
  Usted recibirá en pocos minutos un email de confirmacion. Siga el enlace
7
  en el para confirmar la suscripcion. Si el correo tarda mas de 15
subscription/languages/fr_FR.php CHANGED
@@ -1,9 +1,7 @@
1
  <?php
2
 
3
- $options = array();
4
-
5
  // Message show after a subbscription request has made.
6
- $options['subscribed_text'] =
7
  "<p>Votre demande d'inscription est enregistr&eacute;e. Merci ! Un e-mail de confirmation vous a été envoyé. V&eacute;rifier &eacute;galement votre dossier spam.</p>";
8
 
9
  // Confirmation email subject (double opt-in)
1
  <?php
2
 
 
 
3
  // Message show after a subbscription request has made.
4
+ $options['confirmation_text'] =
5
  "<p>Votre demande d'inscription est enregistr&eacute;e. Merci ! Un e-mail de confirmation vous a été envoyé. V&eacute;rifier &eacute;galement votre dossier spam.</p>";
6
 
7
  // Confirmation email subject (double opt-in)
subscription/languages/it_IT.php CHANGED
@@ -1,10 +1,7 @@
1
  <?php
2
 
3
-
4
- $options = array();
5
-
6
  // Subscription registration message
7
- $options['subscribed_text'] =
8
  "<p>L'iscrizione è quasi completa: controlla la tua
9
  casella di posta, c'è un messaggio per te con il quale confermare l'iscrizione.</p>";
10
 
1
  <?php
2
 
 
 
 
3
  // Subscription registration message
4
+ $options['confirmation_text'] =
5
  "<p>L'iscrizione è quasi completa: controlla la tua
6
  casella di posta, c'è un messaggio per te con il quale confermare l'iscrizione.</p>";
7
 
subscription/languages/nl_NL.php CHANGED
@@ -1,9 +1,7 @@
1
  <?php
2
 
3
- $options = array();
4
-
5
  // Message show after a subbscription request has made.
6
- $options['subscribed_text'] =
7
  "<p>Je hebt je ingeschreven op de nieuwsbrief.</p>
8
  <p>Binnen enkele minuten zal je een bevestigingsmail ontvangen. Volg de link in die mail om jouw inschrijving te bevestigen. Indien je problemen hebt met het ontvangen van de bevestigingsmail kan je ons via het contactformulier bereiken.</p>";
9
 
1
  <?php
2
 
 
 
3
  // Message show after a subbscription request has made.
4
+ $options['confirmation_text'] =
5
  "<p>Je hebt je ingeschreven op de nieuwsbrief.</p>
6
  <p>Binnen enkele minuten zal je een bevestigingsmail ontvangen. Volg de link in die mail om jouw inschrijving te bevestigen. Indien je problemen hebt met het ontvangen van de bevestigingsmail kan je ons via het contactformulier bereiken.</p>";
7
 
subscription/languages/pl_PL.php CHANGED
@@ -1,9 +1,7 @@
1
  <?php
2
 
3
- $options = array();
4
-
5
  // Message show after a subbscription request has made.
6
- $options['subscribed_text'] =
7
  "<p>Zostałeś zapisany do subskrypcji.
8
  W ciągu kilku minut otrzymasz e-mail potwierdzający.
9
  Kliknij w odnośnik w nim zawarty aby potwierdzić subskrypcję. Jeśli e-mail nie pojawi się w Twojej skrzynce przez 15 minut - sprawdź folder spam.</p>";
1
  <?php
2
 
 
 
3
  // Message show after a subbscription request has made.
4
+ $options['confirmation_text'] =
5
  "<p>Zostałeś zapisany do subskrypcji.
6
  W ciągu kilku minut otrzymasz e-mail potwierdzający.
7
  Kliknij w odnośnik w nim zawarty aby potwierdzić subskrypcję. Jeśli e-mail nie pojawi się w Twojej skrzynce przez 15 minut - sprawdź folder spam.</p>";
subscription/languages/profile-en_US.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $options = array();
4
+ $options['email'] = 'Email';
5
+ $options['email_error'] = 'The email is not correct';
6
+ $options['name'] = 'Name';
7
+ $options['name_error'] = 'The name is not correct';
8
+ $options['surname'] = 'Last name';
9
+ $options['surname_error'] = 'The last name is not correct';
10
+ $options['sex'] = 'I\'m';
11
+ $options['privacy'] = 'Subscribing I accept the privacy rules of this site';
12
+ $options['privacy_error'] = 'You must accept the privacy statement';
13
+ $options['subscribe'] = 'Subscribe';
14
+ $options['save'] = 'Save';
15
+
subscription/languages/profile-it_IT.php ADDED
@@ -0,0 +1,15 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ $options = array();
4
+ $options['email'] = 'Email';
5
+ $options['email_error'] = 'L\'indirizzo email non è corretto';
6
+ $options['name'] = 'Nome';
7
+ $options['name_error'] = 'Il nome non è corretto';
8
+ $options['surname'] = 'Cognome';
9
+ $options['surname_error'] = 'Il cognome non è corretto';
10
+ $options['sex'] = 'Sono';
11
+ $options['privacy'] = 'Accetto le regole di riservatezza di questo sito';
12
+ $options['privacy_error'] = 'Devi accettare le regole di riservatezza';
13
+ $options['subscribe'] = 'Procedi';
14
+ $options['save'] = 'Salva';
15
+
subscription/languages/pt_BR.php CHANGED
@@ -1,9 +1,7 @@
1
  <?php
2
 
3
- $options = array();
4
-
5
  // Message show after a subbscription request has made.
6
- $options['subscribed_text'] =
7
  "<p>Você foi inscrito corretamente na newsletter.
8
  Em alguns minutos você receberá um email de confirmação. Siga o link para confirmar a inscrição.
9
  Se o email demorar mais do que 15 minutos para chegar, cheque sua caixa de SPAM.</p>";
1
  <?php
2
 
 
 
3
  // Message show after a subbscription request has made.
4
+ $options['confirmation_text'] =
5
  "<p>Você foi inscrito corretamente na newsletter.
6
  Em alguns minutos você receberá um email de confirmação. Siga o link para confirmar a inscrição.
7
  Se o email demorar mais do que 15 minutos para chegar, cheque sua caixa de SPAM.</p>";
subscription/languages/ru_RU.php CHANGED
@@ -1,9 +1,7 @@
1
  <?php
2
 
3
- $options = array();
4
-
5
  // Message show after a subbscription request has made.
6
- $options['subscribed_text'] =
7
  "<p>Вы успешно подписаны на рассылку. Вы получите письмо с подтверждением через несколько минут. Перейдите по ссылке в письме для подтверждения. Если в течении 15 минут письмо все-таки не пришло, проверьте папку со спамом на вашем ящике, на случай если почтовая служба сочла письмо спамом. Если же письма нигде нет, свяжитесь с администратором сайта</a>.</p>";
8
 
9
  // Confirmation email subject (double opt-in)
1
  <?php
2
 
 
 
3
  // Message show after a subbscription request has made.
4
+ $options['confirmation_text'] =
5
  "<p>Вы успешно подписаны на рассылку. Вы получите письмо с подтверждением через несколько минут. Перейдите по ссылке в письме для подтверждения. Если в течении 15 минут письмо все-таки не пришло, проверьте папку со спамом на вашем ящике, на случай если почтовая служба сочла письмо спамом. Если же письма нигде нет, свяжитесь с администратором сайта</a>.</p>";
6
 
7
  // Confirmation email subject (double opt-in)
subscription/options.php CHANGED
@@ -9,26 +9,53 @@ $options = get_option('newsletter', array());
9
  if ($controls->is_action()) {
10
  if ($controls->is_action('save')) {
11
 
 
 
12
  if (empty($controls->data['profile_text'])) {
13
- $defaults = $module->get_default_options();
14
  $controls->data['profile_text'] = $defaults['profile_text'];
15
  }
16
 
17
  // Without the last curly bracket since there can be a form number apended
18
  if (empty($controls->data['subscription_text'])) {
19
- $defaults = $module->get_default_options();
20
  $controls->data['subscription_text'] = $defaults['subscription_text'];
21
  }
22
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
  $controls->data['confirmed_url'] = trim($controls->data['confirmed_url']);
24
  $controls->data['confirmation_url'] = trim($controls->data['confirmation_url']);
25
- update_option('newsletter', $controls->data);
26
  $controls->messages = 'Saved.';
27
  }
28
 
29
- if ($action == 'reset') {
30
- $controls->data = $module->get_default_options();
31
- $module->save_options($controls->data);
32
  }
33
 
34
  if ($controls->is_action('align_wp_users')) {
@@ -57,6 +84,12 @@ if ($controls->is_action()) {
57
  }
58
  } else {
59
  $controls->data = get_option('newsletter', array());
 
 
 
 
 
 
60
  }
61
  ?>
62
 
@@ -93,8 +126,15 @@ if ($controls->is_action()) {
93
 
94
  <p>
95
  In this panel you can configure the subscription and cancellation process, setting every message, the single or double opt in and
96
- even a customized subscription form.<br />
97
- All tags that can be used on texts below are listed under <a href="#documentation">documentation</a> paragraph.
 
 
 
 
 
 
 
98
  </p>
99
 
100
 
9
  if ($controls->is_action()) {
10
  if ($controls->is_action('save')) {
11
 
12
+ $defaults = $module->get_default_options();
13
+
14
  if (empty($controls->data['profile_text'])) {
 
15
  $controls->data['profile_text'] = $defaults['profile_text'];
16
  }
17
 
18
  // Without the last curly bracket since there can be a form number apended
19
  if (empty($controls->data['subscription_text'])) {
 
20
  $controls->data['subscription_text'] = $defaults['subscription_text'];
21
  }
22
 
23
+ if (empty($controls->data['confirmation_text'])) {
24
+ $controls->data['confirmation_text'] = $defaults['confirmation_text'];
25
+ }
26
+
27
+ if (empty($controls->data['confirmation_subject'])) {
28
+ $controls->data['confirmation_subject'] = $defaults['confirmation_subject'];
29
+ }
30
+
31
+ if (empty($controls->data['confirmation_message'])) {
32
+ $controls->data['confirmation_message'] = $defaults['confirmation_message'];
33
+ }
34
+
35
+ if (empty($controls->data['confirmed_text'])) {
36
+ $controls->data['confirmed_text'] = $defaults['confirmed_text'];
37
+ }
38
+
39
+ if (empty($controls->data['confirmed_subject'])) {
40
+ $controls->data['confirmed_subject'] = $defaults['confirmed_subject'];
41
+ }
42
+
43
+ if (empty($controls->data['confirmed_message'])) {
44
+ $controls->data['confirmed_message'] = $defaults['confirmed_message'];
45
+ }
46
+
47
+ if (empty($controls->data['unsubscribed_text'])) {
48
+ $controls->data['unsubscribed_text'] = $defaults['unsubscribed_text'];
49
+ }
50
+
51
  $controls->data['confirmed_url'] = trim($controls->data['confirmed_url']);
52
  $controls->data['confirmation_url'] = trim($controls->data['confirmation_url']);
53
+ $module->save_options($controls->data);
54
  $controls->messages = 'Saved.';
55
  }
56
 
57
+ if ($controls->is_action('reset')) {
58
+ $controls->data = $module->reset_options();
 
59
  }
60
 
61
  if ($controls->is_action('align_wp_users')) {
84
  }
85
  } else {
86
  $controls->data = get_option('newsletter', array());
87
+
88
+ // Patch
89
+ if (isset($controls->data['subscribed_text'])) {
90
+ $controls->data['confirmation_text'] = $controls->data['subscribed_text'];
91
+ unset($controls->data['subscribed_text']);
92
+ }
93
  }
94
  ?>
95
 
126
 
127
  <p>
128
  In this panel you can configure the subscription and cancellation process, setting every message, the single or double opt in and
129
+ even a customized subscription form.
130
+ </p>
131
+ <p>
132
+ Emails sent during subscription process are themed with the file subscription/email.php which contains instructions on
133
+ how customize it.
134
+ </p>
135
+ <p>
136
+ Page layout where messages are shown is managed by subscription/page.php file which contains instruction on how to
137
+ customize it OR use a WordPress page for messages as described on subscription configuration.
138
  </p>
139
 
140
 
subscription/page.php CHANGED
@@ -6,9 +6,9 @@
6
  // WordPress page to be used to show messages and when there are no alternative
7
  // URLs specified on single messages.
8
  //
9
- // To create an alternative to this file, just copy the subscription-page-alternative.php on
10
  //
11
- // wp-content/newsletter/subscription/page.php
12
  //
13
  // and modify that copy.
14
 
@@ -20,6 +20,8 @@ $message_key = $module->get_message_key_from_request();
20
  $message = $newsletter->replace($module->options[$message_key . '_text'], $user);
21
  $alert = stripslashes($_REQUEST['alert']);
22
 
 
 
23
 
24
  if (is_file(WP_CONTENT_DIR . '/extensions/newsletter/subscription/page.php')) {
25
  include WP_CONTENT_DIR . '/extensions/newsletter/subscription/page.php';
6
  // WordPress page to be used to show messages and when there are no alternative
7
  // URLs specified on single messages.
8
  //
9
+ // To create an alternative to this file, just copy the page-alternative.php on
10
  //
11
+ // wp-content/extensions/newsletter/subscription/page.php
12
  //
13
  // and modify that copy.
14
 
20
  $message = $newsletter->replace($module->options[$message_key . '_text'], $user);
21
  $alert = stripslashes($_REQUEST['alert']);
22
 
23
+ // Force the UTF-8 charset
24
+ header('Content-Type: text/html;charset=UTF-8');
25
 
26
  if (is_file(WP_CONTENT_DIR . '/extensions/newsletter/subscription/page.php')) {
27
  include WP_CONTENT_DIR . '/extensions/newsletter/subscription/page.php';
subscription/profile.php CHANGED
@@ -10,12 +10,13 @@ else {
10
  if ($controls->is_action('save')) {
11
  update_option('newsletter_profile', $controls->data);
12
  }
 
13
  if ($controls->is_action('reset')) {
14
- @include NEWSLETTER_DIR . '/languages/en_US.php';
15
- if (defined(WPLANG) && WPLANG != '')
16
- @include NEWSLETTER_DIR . '/languages/' . WPLANG . '.php';
17
- update_option('newsletter_profile', $defaults_profile);
18
- $controls->data = $defaults_profile;
19
  }
20
  }
21
 
@@ -228,12 +229,28 @@ $rules = array(0=>'Optional', 1=>'Required');
228
  <div class="tab-preamble">
229
  <p></p>
230
  </div>
 
 
 
 
231
  <?php $controls->select('style', $module->get_styles()); ?>
 
 
 
 
 
 
 
 
 
232
  </div>
233
 
234
  </div>
235
 
236
- <p class="submit"><?php $controls->button('save', 'Save'); ?></p>
 
 
 
237
 
238
  </form>
239
  </div>
10
  if ($controls->is_action('save')) {
11
  update_option('newsletter_profile', $controls->data);
12
  }
13
+
14
  if ($controls->is_action('reset')) {
15
+ // TODO: Move this inside the module
16
+ @include NEWSLETTER_DIR . '/subscription/languages/profile-en_US.php';
17
+ @include NEWSLETTER_DIR . '/subscription/languages/profile-' . WPLANG . '.php';
18
+ update_option('newsletter_profile', array_merge(get_option('newsletter_profile', array()), $options));
19
+ $controls->data = get_option('newsletter_profile');
20
  }
21
  }
22
 
229
  <div class="tab-preamble">
230
  <p></p>
231
  </div>
232
+ <table class="form-table">
233
+ <tr>
234
+ <th>Subscription form style</th>
235
+ <td>
236
  <?php $controls->select('style', $module->get_styles()); ?>
237
+ </td>
238
+ </tr>
239
+ <tr>
240
+ <th>Widget style</th>
241
+ <td>
242
+ <?php $controls->select('widget_style', $module->get_styles()); ?>
243
+ </td>
244
+ </tr>
245
+ </table>
246
  </div>
247
 
248
  </div>
249
 
250
+ <p class="submit">
251
+ <?php $controls->button('save', 'Save'); ?>
252
+ <?php $controls->button_confirm('reset', 'Reset all', 'Are you sure you want to reset all?'); ?>
253
+ </p>
254
 
255
  </form>
256
  </div>
subscription/styles/neutral.css ADDED
@@ -0,0 +1,62 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .newsletter, .newsletter td {
2
+ text-align: left;
3
+ font-family: sans-serif;
4
+ font-size: 14px;
5
+ line-height: normal;
6
+ }
7
+
8
+ .newsletter p {
9
+ margin: 0 0 10px 0;
10
+ padding: 0;
11
+ }
12
+
13
+ .newsletter input, .newsletter select {
14
+ border: 1px solid #ccc;
15
+ border-radius: 5px;
16
+ padding: 5px 8px 5px 8px;
17
+ color: #666;
18
+ background-color: #fff!important;
19
+ box-shadow: none;
20
+ line-height: normal;
21
+ font-size: 14px;
22
+ font-family: sans-serif;
23
+ }
24
+
25
+ .newsletter option {
26
+ padding-left: 0;
27
+ margin-left: 0;
28
+ }
29
+ .newsletter .newsletter-email {
30
+
31
+ }
32
+
33
+ .newsletter .newsletter-firstname {
34
+
35
+ }
36
+
37
+ .newsletter .newsletter-lastname {
38
+
39
+ }
40
+
41
+ .newsletter .newsletter-sex {
42
+
43
+ }
44
+
45
+ .newsletter .newsletter-profile {
46
+
47
+ }
48
+
49
+ .newsletter .newsletter-submit {
50
+ border: 1px solid #ccc;
51
+ border-radius: 3px;
52
+ background-image: url(widget-neutral/button.png);
53
+ color: #fff;
54
+ }
55
+
56
+ .newsletter td {
57
+ border: 0;
58
+ }
59
+
60
+ .newsletter table {
61
+ border: 0;
62
+ }
subscription/styles/widget-neutral.css ADDED
@@ -0,0 +1,54 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ .newsletter-widget {
2
+ text-align: left;
3
+ font-family: sans-serif;
4
+ font-size: 14px;
5
+ line-height: normal;
6
+ }
7
+
8
+ .newsletter-widget p {
9
+ margin: 0 0 10px 0!important;
10
+ padding: 0;
11
+ }
12
+
13
+ .newsletter-widget input, .newsletter-widget select {
14
+ border: 1px solid #ccc;
15
+ border-radius: 5px;
16
+ padding: 5px 8px 5px 8px;
17
+ color: #666;
18
+ background-color: #fff!important;
19
+ box-shadow: none;
20
+ line-height: normal;
21
+ font-size: 14px;
22
+ font-family: sans-serif;
23
+ }
24
+
25
+ .newsletter-widget option {
26
+ padding-left: 0;
27
+ margin-left: 0;
28
+ }
29
+ .newsletter-widget .newsletter-email {
30
+
31
+ }
32
+
33
+ .newsletter-widget .newsletter-firstname {
34
+
35
+ }
36
+
37
+ .newsletter-widget .newsletter-lastname {
38
+
39
+ }
40
+
41
+ .newsletter-widget .newsletter-sex {
42
+
43
+ }
44
+
45
+ .newsletter-widget .newsletter-profile {
46
+
47
+ }
48
+
49
+ .newsletter-widget .newsletter-submit {
50
+ border: 1px solid #ccc;
51
+ border-radius: 3px;
52
+ background-image: url(widget-neutral/button.png);
53
+ color: #fff;
54
+ }
subscription/styles/widget-neutral/button.png ADDED
Binary file
subscription/subscription.php CHANGED
@@ -4,7 +4,7 @@ require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
4
 
5
  class NewsletterSubscription extends NewsletterModule {
6
 
7
- const VERSION = '1.0.0';
8
  const MESSAGE_CONFIRMED = 'confirmed';
9
 
10
  static $instance;
@@ -29,8 +29,21 @@ class NewsletterSubscription extends NewsletterModule {
29
  parent::upgrade();
30
 
31
  // Migrate the profile_text from profile to subscription options
32
- $options_profile = get_option('newsletter_profile');
33
- $options = get_option('newsletter');
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  if (isset($options_profile['profile_text'])) {
35
  $options['profile_text'] = $options_profile['profile_text'];
36
  update_option('newsletter', $options);
@@ -54,15 +67,32 @@ class NewsletterSubscription extends NewsletterModule {
54
  $options['url'] = Newsletter::instance()->options['url'];
55
  update_option('newsletter', $options);
56
  }
 
 
57
  return true;
58
  }
59
 
 
 
 
 
 
 
 
 
 
 
 
60
  function get_options($sub = '') {
61
  if ($sub == '') {
62
  // For compatibility the options are wrongly named
63
  return get_option('newsletter', array());
64
  }
65
- parent::get_options($sub);
 
 
 
 
66
  }
67
 
68
  /**
@@ -86,10 +116,16 @@ class NewsletterSubscription extends NewsletterModule {
86
 
87
  $user = NewsletterUsers::instance()->get_user($email);
88
 
89
- // This address is new?
90
- if ($user == null || $user->status == 'S') {
 
 
 
 
 
 
91
 
92
- if ($user->status == 'S') {
93
  $this->logger->info("Email address subscribed but not confirmed");
94
  $user = array('id' => $user->id);
95
  } else {
@@ -206,7 +242,6 @@ class NewsletterSubscription extends NewsletterModule {
206
  ob_start();
207
  include NEWSLETTER_DIR . '/subscription/email.php';
208
  $message = ob_get_clean();
209
- ob_end_clean();
210
 
211
  Newsletter::instance()->mail($to, $subject, $message);
212
  }
@@ -321,13 +356,13 @@ class NewsletterSubscription extends NewsletterModule {
321
  // Add exceptions for "profile" key.
322
  // Is there a custom url?
323
  if (!empty($this->options[$key . '_url'])) {
324
- header('Location: ' . self::add_qs($this->options[$key . '_url'], 'nk=' . $user->id . '-' . $user->token) . $params);
325
  die();
326
  }
327
 
328
  // Is there a dedicated page?
329
  if (!empty($this->options['url'])) {
330
- header('Location: ' . self::add_qs($this->options['url'], 'nm=' . $key . '&nk=' . $user->id . '-' . $user->token) . $params);
331
  die();
332
  }
333
 
@@ -447,6 +482,12 @@ class NewsletterSubscription extends NewsletterModule {
447
  $buffer .= ' return false;' . "\n";
448
  $buffer .= ' }' . "\n";
449
  }
 
 
 
 
 
 
450
  $buffer .= ' if (f.elements["ny"] && !f.elements["ny"].checked) {' . "\n";
451
  $buffer .= ' alert("' . addslashes($options_profile['privacy_error']) . '");' . "\n";
452
  $buffer .= ' return false;' . "\n";
@@ -641,7 +682,14 @@ class NewsletterSubscription extends NewsletterModule {
641
  $buffer .= $x['field'] . "\n\t</td>\n</tr>\n\n";
642
  }
643
 
644
- $buffer .= '<tr><td colspan="2" class="newsletter-td-submit"><input type="submit" class="newsletter-submit" value="' . $options['save'] . '"/></td></tr>';
 
 
 
 
 
 
 
645
  $buffer .= '</table></form></div>';
646
 
647
  return $buffer;
@@ -749,22 +797,29 @@ function newsletter_shortcode($attrs, $content) {
749
  // Now check what form must be added
750
  if ($message_key == 'subscription') {
751
 
752
- if (strpos($message, '{subscription_form') === false) {
753
- $message .= '{subscription_form}';
754
- }
 
 
755
 
756
- if (strpos($message, '{subscription_form}') !== false) {
757
- // TODO: Remove on version 3.1. For compatibility.
758
- if (isset($attrs['form'])) {
759
- $message = str_replace('{subscription_form}', $module->get_form($attrs['form']), $message);
760
- } else {
761
- $message = str_replace('{subscription_form}', $module->get_subscription_form(), $message);
762
  }
763
- } else {
764
- for ($i = 1; $i <= 10; $i++) {
765
- if (strpos($message, "{subscription_form_$i}") !== false) {
766
- $message = str_replace("{subscription_form_$i}", $module->get_form($i), $message);
767
- break;
 
 
 
 
 
 
 
 
 
768
  }
769
  }
770
  }
@@ -795,8 +850,8 @@ function newsletter_subscription_user_register($user_id) {
795
  return;
796
  }
797
  $user = array();
798
- $user['email'] = $module->normalize_email($wp_user['user_email']);
799
- $user['name'] = $wp_user['user_login'];
800
  $user['status'] = 'C';
801
  $user['wp_user_id'] = $wp_user->ID;
802
 
@@ -813,7 +868,7 @@ function newsletter_subscription_user_register($user_id) {
813
 
814
  function newsletter_form($number = null) {
815
  if ($number != null) {
816
- echo NewsletterSubscription::instance()->get_form($attrs[$number]);
817
  } else {
818
  echo NewsletterSubscription::instance()->get_subscription_form();
819
  }
4
 
5
  class NewsletterSubscription extends NewsletterModule {
6
 
7
+ const VERSION = '1.0.1';
8
  const MESSAGE_CONFIRMED = 'confirmed';
9
 
10
  static $instance;
29
  parent::upgrade();
30
 
31
  // Migrate the profile_text from profile to subscription options
32
+ $options_profile = $this->get_options('profile');
33
+
34
+ if (empty($options_profile)) {
35
+ update_option('newsletter_profile', $this->get_default_options('profile'));
36
+ }
37
+
38
+ $options = $this->get_options();
39
+ if (empty($options)) {
40
+ update_option('newsletter', $this->get_default_options());
41
+ }
42
+
43
+
44
+ $options = get_option('newsletter', array());
45
+
46
+
47
  if (isset($options_profile['profile_text'])) {
48
  $options['profile_text'] = $options_profile['profile_text'];
49
  update_option('newsletter', $options);
67
  $options['url'] = Newsletter::instance()->options['url'];
68
  update_option('newsletter', $options);
69
  }
70
+
71
+ wp_mkdir_p(WP_CONTENT_DIR . '/extensions/newsletter/subscription');
72
  return true;
73
  }
74
 
75
+ function save_options($options, $sub='') {
76
+ if ($sub == '') {
77
+ // For compatibility the options are wrongly named
78
+ return update_option('newsletter', $options);
79
+ }
80
+ if ($sub == 'profile') {
81
+ return update_option('newsletter_profile', $options);
82
+ }
83
+ return parent::save_options($sub);
84
+ }
85
+
86
  function get_options($sub = '') {
87
  if ($sub == '') {
88
  // For compatibility the options are wrongly named
89
  return get_option('newsletter', array());
90
  }
91
+ if ($sub == 'profile') {
92
+ // For compatibility the options are wrongly named
93
+ return get_option('newsletter_profile', array());
94
+ }
95
+ return parent::get_options($sub);
96
  }
97
 
98
  /**
116
 
117
  $user = NewsletterUsers::instance()->get_user($email);
118
 
119
+ if ($user != null && $user->status == 'B') {
120
+ $this->logger->error('Subscription attempo of a bounced address');
121
+ echo 'This address is bounced, cannot be subscribed. Contact the blog owner.';
122
+ die();
123
+ }
124
+
125
+ // This address is new or was it previously collected but never confirmed?
126
+ if ($user == null || $user->status == 'S' || $user->status == 'U') {
127
 
128
+ if ($user != null) {
129
  $this->logger->info("Email address subscribed but not confirmed");
130
  $user = array('id' => $user->id);
131
  } else {
242
  ob_start();
243
  include NEWSLETTER_DIR . '/subscription/email.php';
244
  $message = ob_get_clean();
 
245
 
246
  Newsletter::instance()->mail($to, $subject, $message);
247
  }
356
  // Add exceptions for "profile" key.
357
  // Is there a custom url?
358
  if (!empty($this->options[$key . '_url'])) {
359
+ header('Location: ' . self::add_qs($this->options[$key . '_url'], 'nk=' . $user->id . '-' . $user->token, false) . $params);
360
  die();
361
  }
362
 
363
  // Is there a dedicated page?
364
  if (!empty($this->options['url'])) {
365
+ header('Location: ' . self::add_qs($this->options['url'], 'nm=' . $key . '&nk=' . $user->id . '-' . $user->token, false) . $params);
366
  die();
367
  }
368
 
482
  $buffer .= ' return false;' . "\n";
483
  $buffer .= ' }' . "\n";
484
  }
485
+ if ($options_profile['surname_status'] == 2 && $options_profile['surname_rules'] == 1) {
486
+ $buffer .= ' if (f.elements["ns"] && (f.elements["ns"].value == "" || f.elements["ns"].value == f.elements["ns"].defaultValue)) {' . "\n";
487
+ $buffer .= ' alert("' . addslashes($options_profile['surname_error']) . '");' . "\n";
488
+ $buffer .= ' return false;' . "\n";
489
+ $buffer .= ' }' . "\n";
490
+ }
491
  $buffer .= ' if (f.elements["ny"] && !f.elements["ny"].checked) {' . "\n";
492
  $buffer .= ' alert("' . addslashes($options_profile['privacy_error']) . '");' . "\n";
493
  $buffer .= ' return false;' . "\n";
682
  $buffer .= $x['field'] . "\n\t</td>\n</tr>\n\n";
683
  }
684
 
685
+ $buffer .= '<tr><td colspan="2" class="newsletter-td-submit">';
686
+
687
+ if (strpos($options['save'], 'http://') !== false) {
688
+ $buffer .= '<input class="newsletter-submit" type="image" src="' . $options['save'] . '"/></td></tr>';
689
+ } else {
690
+ $buffer .= '<input class="newsletter-submit" type="submit" value="' . $options['save'] . '"/></td></tr>';
691
+ }
692
+
693
  $buffer .= '</table></form></div>';
694
 
695
  return $buffer;
797
  // Now check what form must be added
798
  if ($message_key == 'subscription') {
799
 
800
+ // Compatibility check
801
+ if (stripos($message, '<form') !== false) {
802
+ $message .= $module->get_form_javascript();
803
+ $message = str_ireplace('<form', '<form method="post" action="' . NEWSLETTER_SUBSCRIBE_URL . '" onsubmit="return newsletter_check(this)"', $message);
804
+ } else {
805
 
806
+ if (strpos($message, '{subscription_form') === false) {
807
+ $message .= '{subscription_form}';
 
 
 
 
808
  }
809
+
810
+ if (strpos($message, '{subscription_form}') !== false) {
811
+ // TODO: Remove on version 3.1. For compatibility.
812
+ if (isset($attrs['form'])) {
813
+ $message = str_replace('{subscription_form}', $module->get_form($attrs['form']), $message);
814
+ } else {
815
+ $message = str_replace('{subscription_form}', $module->get_subscription_form(), $message);
816
+ }
817
+ } else {
818
+ for ($i = 1; $i <= 10; $i++) {
819
+ if (strpos($message, "{subscription_form_$i}") !== false) {
820
+ $message = str_replace("{subscription_form_$i}", $module->get_form($i), $message);
821
+ break;
822
+ }
823
  }
824
  }
825
  }
850
  return;
851
  }
852
  $user = array();
853
+ $user['email'] = $module->normalize_email($wp_user->user_email);
854
+ $user['name'] = $wp_user->user_login;
855
  $user['status'] = 'C';
856
  $user['wp_user_id'] = $wp_user->ID;
857
 
868
 
869
  function newsletter_form($number = null) {
870
  if ($number != null) {
871
+ echo NewsletterSubscription::instance()->get_form($number);
872
  } else {
873
  echo NewsletterSubscription::instance()->get_subscription_form();
874
  }
tiny_mce/themes/simple/editor_template.js DELETED
@@ -1 +0,0 @@
1
- (function(){var a=tinymce.DOM;tinymce.ThemeManager.requireLangPack("simple");tinymce.create("tinymce.themes.SimpleTheme",{init:function(c,d){var e=this,b=["Bold","Italic","Underline","Strikethrough","InsertUnorderedList","InsertOrderedList"],f=c.settings;e.editor=c;c.contentCSS.push(d+"/skins/"+f.skin+"/content.css");c.onInit.add(function(){c.onNodeChange.add(function(h,g){tinymce.each(b,function(i){g.get(i.toLowerCase()).setActive(h.queryCommandState(i))})})});a.loadCSS((f.editor_css?c.documentBaseURI.toAbsolute(f.editor_css):"")||d+"/skins/"+f.skin+"/ui.css")},renderUI:function(h){var e=this,i=h.targetNode,b,c,d=e.editor,f=d.controlManager,g;i=a.insertAfter(a.create("span",{id:d.id+"_container","class":"mceEditor "+d.settings.skin+"SimpleSkin"}),i);i=g=a.add(i,"table",{cellPadding:0,cellSpacing:0,"class":"mceLayout"});i=c=a.add(i,"tbody");i=a.add(c,"tr");i=b=a.add(a.add(i,"td"),"div",{"class":"mceIframeContainer"});i=a.add(a.add(c,"tr",{"class":"last"}),"td",{"class":"mceToolbar mceLast",align:"center"});c=e.toolbar=f.createToolbar("tools1");c.add(f.createButton("bold",{title:"simple.bold_desc",cmd:"Bold"}));c.add(f.createButton("italic",{title:"simple.italic_desc",cmd:"Italic"}));c.add(f.createButton("underline",{title:"simple.underline_desc",cmd:"Underline"}));c.add(f.createButton("strikethrough",{title:"simple.striketrough_desc",cmd:"Strikethrough"}));c.add(f.createSeparator());c.add(f.createButton("undo",{title:"simple.undo_desc",cmd:"Undo"}));c.add(f.createButton("redo",{title:"simple.redo_desc",cmd:"Redo"}));c.add(f.createSeparator());c.add(f.createButton("cleanup",{title:"simple.cleanup_desc",cmd:"mceCleanup"}));c.add(f.createSeparator());c.add(f.createButton("insertunorderedlist",{title:"simple.bullist_desc",cmd:"InsertUnorderedList"}));c.add(f.createButton("insertorderedlist",{title:"simple.numlist_desc",cmd:"InsertOrderedList"}));c.renderTo(i);return{iframeContainer:b,editorContainer:d.id+"_container",sizeContainer:g,deltaHeight:-20}},getInfo:function(){return{longname:"Simple theme",author:"Moxiecode Systems AB",authorurl:"http://tinymce.moxiecode.com",version:tinymce.majorVersion+"."+tinymce.minorVersion}}});tinymce.ThemeManager.add("simple",tinymce.themes.SimpleTheme)})();
 
tiny_mce/themes/simple/editor_template_src.js DELETED
@@ -1,84 +0,0 @@
1
- /**
2
- * editor_template_src.js
3
- *
4
- * Copyright 2009, Moxiecode Systems AB
5
- * Released under LGPL License.
6
- *
7
- * License: http://tinymce.moxiecode.com/license
8
- * Contributing: http://tinymce.moxiecode.com/contributing
9
- */
10
-
11
- (function() {
12
- var DOM = tinymce.DOM;
13
-
14
- // Tell it to load theme specific language pack(s)
15
- tinymce.ThemeManager.requireLangPack('simple');
16
-
17
- tinymce.create('tinymce.themes.SimpleTheme', {
18
- init : function(ed, url) {
19
- var t = this, states = ['Bold', 'Italic', 'Underline', 'Strikethrough', 'InsertUnorderedList', 'InsertOrderedList'], s = ed.settings;
20
-
21
- t.editor = ed;
22
- ed.contentCSS.push(url + "/skins/" + s.skin + "/content.css");
23
-
24
- ed.onInit.add(function() {
25
- ed.onNodeChange.add(function(ed, cm) {
26
- tinymce.each(states, function(c) {
27
- cm.get(c.toLowerCase()).setActive(ed.queryCommandState(c));
28
- });
29
- });
30
- });
31
-
32
- DOM.loadCSS((s.editor_css ? ed.documentBaseURI.toAbsolute(s.editor_css) : '') || url + "/skins/" + s.skin + "/ui.css");
33
- },
34
-
35
- renderUI : function(o) {
36
- var t = this, n = o.targetNode, ic, tb, ed = t.editor, cf = ed.controlManager, sc;
37
-
38
- n = DOM.insertAfter(DOM.create('span', {id : ed.id + '_container', 'class' : 'mceEditor ' + ed.settings.skin + 'SimpleSkin'}), n);
39
- n = sc = DOM.add(n, 'table', {cellPadding : 0, cellSpacing : 0, 'class' : 'mceLayout'});
40
- n = tb = DOM.add(n, 'tbody');
41
-
42
- // Create iframe container
43
- n = DOM.add(tb, 'tr');
44
- n = ic = DOM.add(DOM.add(n, 'td'), 'div', {'class' : 'mceIframeContainer'});
45
-
46
- // Create toolbar container
47
- n = DOM.add(DOM.add(tb, 'tr', {'class' : 'last'}), 'td', {'class' : 'mceToolbar mceLast', align : 'center'});
48
-
49
- // Create toolbar
50
- tb = t.toolbar = cf.createToolbar("tools1");
51
- tb.add(cf.createButton('bold', {title : 'simple.bold_desc', cmd : 'Bold'}));
52
- tb.add(cf.createButton('italic', {title : 'simple.italic_desc', cmd : 'Italic'}));
53
- tb.add(cf.createButton('underline', {title : 'simple.underline_desc', cmd : 'Underline'}));
54
- tb.add(cf.createButton('strikethrough', {title : 'simple.striketrough_desc', cmd : 'Strikethrough'}));
55
- tb.add(cf.createSeparator());
56
- tb.add(cf.createButton('undo', {title : 'simple.undo_desc', cmd : 'Undo'}));
57
- tb.add(cf.createButton('redo', {title : 'simple.redo_desc', cmd : 'Redo'}));
58
- tb.add(cf.createSeparator());
59
- tb.add(cf.createButton('cleanup', {title : 'simple.cleanup_desc', cmd : 'mceCleanup'}));
60
- tb.add(cf.createSeparator());
61
- tb.add(cf.createButton('insertunorderedlist', {title : 'simple.bullist_desc', cmd : 'InsertUnorderedList'}));
62
- tb.add(cf.createButton('insertorderedlist', {title : 'simple.numlist_desc', cmd : 'InsertOrderedList'}));
63
- tb.renderTo(n);
64
-
65
- return {
66
- iframeContainer : ic,
67
- editorContainer : ed.id + '_container',
68
- sizeContainer : sc,
69
- deltaHeight : -20
70
- };
71
- },
72
-
73
- getInfo : function() {
74
- return {
75
- longname : 'Simple theme',
76
- author : 'Moxiecode Systems AB',
77
- authorurl : 'http://tinymce.moxiecode.com',
78
- version : tinymce.majorVersion + "." + tinymce.minorVersion
79
- }
80
- }
81
- });
82
-
83
- tinymce.ThemeManager.add('simple', tinymce.themes.SimpleTheme);
84
- })();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tiny_mce/themes/simple/img/icons.gif DELETED
Binary file
tiny_mce/themes/simple/langs/en.js DELETED
@@ -1 +0,0 @@
1
- tinyMCE.addI18n('en.simple',{"cleanup_desc":"Cleanup Messy Code","redo_desc":"Redo (Ctrl+Y)","undo_desc":"Undo (Ctrl+Z)","numlist_desc":"Insert/Remove Numbered List","bullist_desc":"Insert/Remove Bulleted List","striketrough_desc":"Strikethrough","underline_desc":"Underline (Ctrl+U)","italic_desc":"Italic (Ctrl+I)","bold_desc":"Bold (Ctrl+B)"});
 
tiny_mce/themes/simple/skins/default/content.css DELETED
@@ -1,25 +0,0 @@
1
- body, td, pre {
2
- font-family: Verdana, Arial, Helvetica, sans-serif;
3
- font-size: 10px;
4
- }
5
-
6
- body {
7
- background-color: #FFFFFF;
8
- }
9
-
10
- .mceVisualAid {
11
- border: 1px dashed #BBBBBB;
12
- }
13
-
14
- /* MSIE specific */
15
-
16
- * html body {
17
- scrollbar-3dlight-color: #F0F0EE;
18
- scrollbar-arrow-color: #676662;
19
- scrollbar-base-color: #F0F0EE;
20
- scrollbar-darkshadow-color: #DDDDDD;
21
- scrollbar-face-color: #E0E0DD;
22
- scrollbar-highlight-color: #F0F0EE;
23
- scrollbar-shadow-color: #F0F0EE;
24
- scrollbar-track-color: #F5F5F5;
25
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tiny_mce/themes/simple/skins/default/ui.css DELETED
@@ -1,32 +0,0 @@
1
- /* Reset */
2
- .defaultSimpleSkin table, .defaultSimpleSkin tbody, .defaultSimpleSkin a, .defaultSimpleSkin img, .defaultSimpleSkin tr, .defaultSimpleSkin div, .defaultSimpleSkin td, .defaultSimpleSkin iframe, .defaultSimpleSkin span, .defaultSimpleSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000}
3
-
4
- /* Containers */
5
- .defaultSimpleSkin {position:relative}
6
- .defaultSimpleSkin table.mceLayout {background:#F0F0EE; border:1px solid #CCC;}
7
- .defaultSimpleSkin iframe {display:block; background:#FFF; border-bottom:1px solid #CCC;}
8
- .defaultSimpleSkin .mceToolbar {height:24px;}
9
-
10
- /* Layout */
11
- .defaultSimpleSkin span.mceIcon, .defaultSimpleSkin img.mceIcon {display:block; width:20px; height:20px}
12
- .defaultSimpleSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
13
-
14
- /* Button */
15
- .defaultSimpleSkin .mceButton {display:block; border:1px solid #F0F0EE; width:20px; height:20px}
16
- .defaultSimpleSkin a.mceButtonEnabled:hover {border:1px solid #0A246A; background-color:#B2BBD0}
17
- .defaultSimpleSkin a.mceButtonActive {border:1px solid #0A246A; background-color:#C2CBE0}
18
- .defaultSimpleSkin .mceButtonDisabled span {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
19
-
20
- /* Separator */
21
- .defaultSimpleSkin .mceSeparator {display:block; background:url(../../img/icons.gif) -180px 0; width:2px; height:20px; margin:0 2px 0 4px}
22
-
23
- /* Theme */
24
- .defaultSimpleSkin span.mce_bold {background-position:0 0}
25
- .defaultSimpleSkin span.mce_italic {background-position:-60px 0}
26
- .defaultSimpleSkin span.mce_underline {background-position:-140px 0}
27
- .defaultSimpleSkin span.mce_strikethrough {background-position:-120px 0}
28
- .defaultSimpleSkin span.mce_undo {background-position:-160px 0}
29
- .defaultSimpleSkin span.mce_redo {background-position:-100px 0}
30
- .defaultSimpleSkin span.mce_cleanup {background-position:-40px 0}
31
- .defaultSimpleSkin span.mce_insertunorderedlist {background-position:-20px 0}
32
- .defaultSimpleSkin span.mce_insertorderedlist {background-position:-80px 0}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tiny_mce/themes/simple/skins/o2k7/content.css DELETED
@@ -1,17 +0,0 @@
1
- body, td, pre {font-family:Verdana, Arial, Helvetica, sans-serif; font-size:10px;}
2
-
3
- body {background: #FFF;}
4
- .mceVisualAid {border: 1px dashed #BBB;}
5
-
6
- /* IE */
7
-
8
- * html body {
9
- scrollbar-3dlight-color: #F0F0EE;
10
- scrollbar-arrow-color: #676662;
11
- scrollbar-base-color: #F0F0EE;
12
- scrollbar-darkshadow-color: #DDDDDD;
13
- scrollbar-face-color: #E0E0DD;
14
- scrollbar-highlight-color: #F0F0EE;
15
- scrollbar-shadow-color: #F0F0EE;
16
- scrollbar-track-color: #F5F5F5;
17
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
tiny_mce/themes/simple/skins/o2k7/img/button_bg.png DELETED
Binary file
tiny_mce/themes/simple/skins/o2k7/ui.css DELETED
@@ -1,35 +0,0 @@
1
- /* Reset */
2
- .o2k7SimpleSkin table, .o2k7SimpleSkin tbody, .o2k7SimpleSkin a, .o2k7SimpleSkin img, .o2k7SimpleSkin tr, .o2k7SimpleSkin div, .o2k7SimpleSkin td, .o2k7SimpleSkin iframe, .o2k7SimpleSkin span, .o2k7SimpleSkin * {border:0; margin:0; padding:0; background:transparent; white-space:nowrap; text-decoration:none; font-weight:normal; cursor:default; color:#000}
3
-
4
- /* Containers */
5
- .o2k7SimpleSkin {position:relative}
6
- .o2k7SimpleSkin table.mceLayout {background:#E5EFFD; border:1px solid #ABC6DD;}
7
- .o2k7SimpleSkin iframe {display:block; background:#FFF; border-bottom:1px solid #ABC6DD;}
8
- .o2k7SimpleSkin .mceToolbar {height:26px;}
9
-
10
- /* Layout */
11
- .o2k7SimpleSkin .mceToolbar .mceToolbarStart span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px; }
12
- .o2k7SimpleSkin .mceToolbar .mceToolbarEnd span {display:block; background:url(img/button_bg.png) -22px 0; width:1px; height:22px}
13
- .o2k7SimpleSkin span.mceIcon, .o2k7SimpleSkin img.mceIcon {display:block; width:20px; height:20px}
14
- .o2k7SimpleSkin .mceIcon {background:url(../../img/icons.gif) no-repeat 20px 20px}
15
-
16
- /* Button */
17
- .o2k7SimpleSkin .mceButton {display:block; background:url(img/button_bg.png); width:22px; height:22px}
18
- .o2k7SimpleSkin a.mceButton span, .o2k7SimpleSkin a.mceButton img {margin:1px 0 0 1px}
19
- .o2k7SimpleSkin a.mceButtonEnabled:hover {background-color:#B2BBD0; background-position:0 -22px}
20
- .o2k7SimpleSkin a.mceButtonActive {background-position:0 -44px}
21
- .o2k7SimpleSkin .mceButtonDisabled span {opacity:0.3; -ms-filter:'alpha(opacity=30)'; filter:alpha(opacity=30)}
22
-
23
- /* Separator */
24
- .o2k7SimpleSkin .mceSeparator {display:block; background:url(img/button_bg.png) -22px 0; width:5px; height:22px}
25
-
26
- /* Theme */
27
- .o2k7SimpleSkin span.mce_bold {background-position:0 0}
28
- .o2k7SimpleSkin span.mce_italic {background-position:-60px 0}
29
- .o2k7SimpleSkin span.mce_underline {background-position:-140px 0}
30
- .o2k7SimpleSkin span.mce_strikethrough {background-position:-120px 0}
31
- .o2k7SimpleSkin span.mce_undo {background-position:-160px 0}
32
- .o2k7SimpleSkin span.mce_redo {background-position:-100px 0}
33
- .o2k7SimpleSkin span.mce_cleanup {background-position:-40px 0}
34
- .o2k7SimpleSkin span.mce_insertunorderedlist {background-position:-20px 0}
35
- .o2k7SimpleSkin span.mce_insertorderedlist {background-position:-80px 0}
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
users/index.php CHANGED
@@ -103,7 +103,7 @@ else {
103
  <input type="hidden" name="options[subscriber_status]"/>
104
 
105
  <?php
106
- $tmp = $wpdb->get_results($wpdb->prepare("select distinct newsletter, url from " . $wpdb->prefix . "newsletter_stats order by newsletter,url"));
107
  $links = array(''=>'Unfiltered');
108
  foreach ($tmp as $t) {
109
  $links[$t->newsletter . '|' . $t->url] = $t->newsletter . ': ' . substr($t->url, 0, min(strlen($t->url), 50)) . '...';
103
  <input type="hidden" name="options[subscriber_status]"/>
104
 
105
  <?php
106
+ $tmp = $wpdb->get_results("select distinct newsletter, url from " . $wpdb->prefix . "newsletter_stats order by newsletter,url");
107
  $links = array(''=>'Unfiltered');
108
  foreach ($tmp as $t) {
109
  $links[$t->newsletter . '|' . $t->url] = $t->newsletter . ': ' . substr($t->url, 0, min(strlen($t->url), 50)) . '...';
users/massive.php CHANGED
@@ -264,7 +264,6 @@ if ($controls->is_action('bounces')) {
264
  Set preference <?php $controls->select('list_feed', $lists); ?> to feed by mail subscribers
265
  <?php $controls->button_confirm('feed', 'Go!', 'Are you sure?'); ?>
266
  <div class="hints">
267
- Useful to migrate from feed by mail to <a href="http://www.satollo.net/plugins/newsletter-updates" target="_blank">Newsletter Updates module</a>.
268
  </div>
269
  </td>
270
  </tr>
264
  Set preference <?php $controls->select('list_feed', $lists); ?> to feed by mail subscribers
265
  <?php $controls->button_confirm('feed', 'Go!', 'Are you sure?'); ?>
266
  <div class="hints">
 
267
  </div>
268
  </td>
269
  </tr>
users/stats.php CHANGED
@@ -65,6 +65,28 @@
65
  <?php } ?>
66
  </table>
67
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
68
  <h3>Sex</h3>
69
  <?php
70
  $male_count = $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where sex='m'");
65
  <?php } ?>
66
  </table>
67
 
68
+ <h3>Referrer</h3>
69
+ <?php
70
+ $list = $wpdb->get_results("select referrer, count(*) as total from " . $wpdb->prefix . "newsletter where status='C' group by referrer order by referrer");
71
+ ?>
72
+ <table class="widefat" style="width: 300px">
73
+ <thead><tr><th>Referrer</th><th>Total</th></thead>
74
+ <?php foreach($list as $row) { ?>
75
+ <tr><td><?php echo $row->referrer; ?></td><td><?php echo $row->total; ?></td></tr>
76
+ <?php } ?>
77
+ </table>
78
+
79
+ <h3>Source</h3>
80
+ <?php
81
+ $list = $wpdb->get_results("select http_referer, count(*) as total from " . $wpdb->prefix . "newsletter where status='C' group by http_referer order by http_referer");
82
+ ?>
83
+ <table class="widefat" style="width: 300px">
84
+ <thead><tr><th>URL</th><th>Total</th></thead>
85
+ <?php foreach($list as $row) { ?>
86
+ <tr><td><?php echo $row->http_referer; ?></td><td><?php echo $row->total; ?></td></tr>
87
+ <?php } ?>
88
+ </table>
89
+
90
  <h3>Sex</h3>
91
  <?php
92
  $male_count = $wpdb->get_var("select count(*) from " . $wpdb->prefix . "newsletter where sex='m'");
welcome.php CHANGED
@@ -57,37 +57,25 @@ if ($x === false) {
57
  </p>
58
 
59
  <p>
60
- <strong>Old 2.5.2.7 version is still available <a href="http://www.satollo.net/wp-content/uploads/newsletter-2.5.2.7.zip">here</a>.</strong>
61
- </p>
62
-
63
- <h3>Version 3.0</h3>
64
- <p>
65
- Many reasons lead me to create a totally new version: Newsletter needed more modularity,
66
- more compatibility, more functions. As for version 2.5, this is a big step forward on both
67
- configuration organization and functionalities and improvements.
68
- </p>
69
- <p>
70
- The great amount of rework, even if made will all possible attentions, could generate new bugs,
71
- little incompatibilities and other kinds of issues. I would ask you to be patince and to notify me
72
- every anomality you encounter, using the support options below.
73
  </p>
74
 
75
  <h3>First steps</h3>
76
  <p>
77
- <strong>Newsletter works out of box</strong>. You don't need to create lists or evenly configure it. Just use your WordPress
78
- appearance panel, enter the widgets panel and ass the Newsletter widget.
79
  </p>
80
  <p>
81
- To get the most out of Newsletter, to translate messages and so on, it's important to understand the single panels of Newsletter:
82
  </p>
83
  <ol>
84
  <li>
85
- <strong>Configuration</strong>: is where you find the main setting, like the SMTP, the sender address,
86
  the delivery engine speed and so on.
87
  </li>
88
  <li>
89
  <strong>Subscription</strong>: is where you configure the subscription process and it's one of the most important panel
90
- to explore and to understand. Subscription is not limited to collect email addresses! There you define the fields of the
91
  subscription box, optionally a dedicated page for subscription and profile edit and so on.
92
  </li>
93
  <li>
57
  </p>
58
 
59
  <p>
60
+ <strong>Old 2.5.2.7 version is available <a href="http://www.satollo.net/wp-content/uploads/newsletter-2.5.2.7.zip">here</a>.</strong>
 
 
 
 
 
 
 
 
 
 
 
 
61
  </p>
62
 
63
  <h3>First steps</h3>
64
  <p>
65
+ <strong>Newsletter works out of box</strong>. You don't need to create lists or configure it. Just use your WordPress
66
+ appearance panel, enter the widgets panel and add the Newsletter widget to your sidebar.
67
  </p>
68
  <p>
69
+ To get the most out of Newsletter, to translate messages and so on, it's important to understand the single configuration panels:
70
  </p>
71
  <ol>
72
  <li>
73
+ <strong>Configuration</strong>: is where you find the main setting, like the SMTP, the sender address and name,
74
  the delivery engine speed and so on.
75
  </li>
76
  <li>
77
  <strong>Subscription</strong>: is where you configure the subscription process and it's one of the most important panel
78
+ to explore and understand. Subscription is not limited to collect email addresses! There you define the fields of the
79
  subscription box, optionally a dedicated page for subscription and profile edit and so on.
80
  </li>
81
  <li>
widget.php CHANGED
@@ -37,7 +37,7 @@ class NewsletterWidget extends WP_Widget {
37
  if ($options_profile['surname_status'] == 2)
38
  $form .= '<p><input class="newsletter-lastname" type="text" name="ns" value="' . $options_profile['surname'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
39
 
40
- $form .= '<p><input class="newsletter-email" type="text" name="ne" value="' . $options_profile['email'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
41
 
42
  if ($options_profile['sex_status'] == 2) {
43
  $form .= '<p><select name="nx" class="newsletter-sex">';
@@ -76,19 +76,6 @@ class NewsletterWidget extends WP_Widget {
76
  $form .= $x['field'] . "</p>";
77
  }
78
 
79
- if ($options_profile['privacy_status'] == 1) {
80
- $form .= "<tr>\n\t" . '<td colspan="2" class="newsletter-td-privacy">' . "\n";
81
- $form .= "\t\t" . '<input type="checkbox" name="ny"/>&nbsp;';
82
- if (!empty($options_profile['privacy_url'])) {
83
- $form .= '<a target="_blank" href="' . $options_profile['privacy_url'] . '">';
84
- $form .= $options_profile['privacy'] . '</a>';
85
- } else {
86
- $form .= $options_profile['privacy'];
87
- }
88
- $form .= "\n\t</td>\n</tr>\n\n";
89
- }
90
-
91
-
92
  if ($options_profile['privacy_status'] == 1) {
93
  if (!empty($options_profile['privacy_url'])) {
94
  $form .= '<p><input type="checkbox" name="ny"/>&nbsp;<a target="_blank" href="' . $options_profile['privacy_url'] . '">' . $options_profile['privacy'] . '</a></p>';
@@ -97,9 +84,9 @@ class NewsletterWidget extends WP_Widget {
97
  }
98
 
99
  if (strpos($options_profile['subscribe'], 'http://') !== false) {
100
- $form .= '<p><input type="image" src="' . $options_profile['subscribe'] . '"/></p>';
101
  } else {
102
- $form .= '<p><input type="submit" value="' . $options_profile['subscribe'] . '"/></p>';
103
  }
104
 
105
  $form .= '</form></div>';
37
  if ($options_profile['surname_status'] == 2)
38
  $form .= '<p><input class="newsletter-lastname" type="text" name="ns" value="' . $options_profile['surname'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
39
 
40
+ $form .= '<p><input class="newsletter-email" type="email" required name="ne" value="' . $options_profile['email'] . '" onclick="if (this.defaultValue==this.value) this.value=\'\'" onblur="if (this.value==\'\') this.value=this.defaultValue"/></p>';
41
 
42
  if ($options_profile['sex_status'] == 2) {
43
  $form .= '<p><select name="nx" class="newsletter-sex">';
76
  $form .= $x['field'] . "</p>";
77
  }
78
 
 
 
 
 
 
 
 
 
 
 
 
 
 
79
  if ($options_profile['privacy_status'] == 1) {
80
  if (!empty($options_profile['privacy_url'])) {
81
  $form .= '<p><input type="checkbox" name="ny"/>&nbsp;<a target="_blank" href="' . $options_profile['privacy_url'] . '">' . $options_profile['privacy'] . '</a></p>';
84
  }
85
 
86
  if (strpos($options_profile['subscribe'], 'http://') !== false) {
87
+ $form .= '<p><input class="newsletter-submit" type="image" src="' . $options_profile['subscribe'] . '"/></p>';
88
  } else {
89
+ $form .= '<p><input class="newsletter-submit" type="submit" value="' . $options_profile['subscribe'] . '"/></p>';
90
  }
91
 
92
  $form .= '</form></div>';