Newsletter - Version 4.6.2

Version Description

  • Fixed the import option "override status" not working in update mode
  • Fixed the missing http when the couldflare plugin is installed (!)
  • Improved controls and security on open tracking link
  • Added few new diagnostic parameters
Download this release

Release Info

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

Code changes from version 4.6.1 to 4.6.2

Files changed (107) hide show
  1. api/add.php +0 -46
  2. api/delete.php +0 -13
  3. do/change.php +0 -48
  4. do/confirm.php +0 -6
  5. do/profile.php +0 -7
  6. do/save.php +0 -10
  7. do/subscribe.php +0 -6
  8. do/subscription.php +0 -26
  9. do/unlock.php +0 -6
  10. do/unsubscribe.php +0 -5
  11. do/unsubscription.php +0 -6
  12. do/view.php +0 -3
  13. emails/composer.php +3 -0
  14. emails/cpreview.php +9 -3
  15. emails/create.php +0 -54
  16. emails/css.php +0 -17
  17. emails/edit.php +10 -4
  18. emails/emails.php +127 -5
  19. emails/index.php +2 -0
  20. emails/new.php +29 -29
  21. emails/preview-text.php +0 -15
  22. emails/preview.php +0 -13
  23. emails/theme.php +6 -4
  24. emails/themes/blank/theme-options.php +8 -5
  25. emails/themes/blank/theme-text.php +3 -0
  26. emails/themes/blank/theme.php +3 -1
  27. emails/themes/cta-2015/theme-options.php +10 -7
  28. emails/themes/cta-2015/theme.php +161 -159
  29. emails/themes/default/footer.php +10 -7
  30. emails/themes/default/social-options.php +41 -38
  31. emails/themes/default/social.php +57 -55
  32. emails/themes/default/social_main.php +45 -43
  33. emails/themes/default/theme-options.php +60 -78
  34. emails/themes/default/theme-text.php +3 -1
  35. emails/themes/default/theme.php +4 -2
  36. emails/themes/linear/theme-options.php +21 -17
  37. emails/themes/linear/theme-text.php +4 -1
  38. emails/themes/linear/theme.php +3 -0
  39. emails/themes/pint/theme-options.php +18 -14
  40. emails/themes/pint/theme-text.php +4 -1
  41. emails/themes/pint/theme.php +2 -0
  42. emails/themes/simple/theme-text.php +4 -1
  43. emails/themes/simple/theme.php +3 -0
  44. emails/themes/theme-1/theme-options.php +46 -42
  45. emails/themes/theme-1/theme-text.php +3 -0
  46. emails/themes/theme-1/theme.php +3 -0
  47. emails/themes/theme-3/theme-options.php +47 -43
  48. emails/themes/theme-3/theme-text.php +3 -0
  49. emails/themes/theme-3/theme.php +3 -0
  50. emails/themes/vimeo-like/theme-options.php +64 -60
  51. emails/themes/vimeo-like/theme-text.php +4 -1
  52. emails/themes/vimeo-like/theme.php +3 -0
  53. emails/themes/xmas-2014/theme.php +124 -121
  54. emails/tnp-composer/edit.php +4 -1
  55. emails/tnp-composer/index.php +87 -85
  56. feed/feed.php +0 -26
  57. feed/index.php +0 -26
  58. header-extension.php +31 -28
  59. includes/controls.php +87 -76
  60. includes/helper.php +1 -0
  61. includes/logger.php +1 -0
  62. includes/module.php +17 -14
  63. includes/store.php +3 -2
  64. includes/themes.php +218 -217
  65. lock/index.php +2 -0
  66. lock/lock.php +1 -0
  67. main/diagnostic.php +68 -26
  68. main/index.php +2 -0
  69. main/info.php +193 -191
  70. main/main.php +2 -8
  71. main/smtp.php +2 -0
  72. main/startup.php +163 -161
  73. plugin.php +34 -15
  74. readme.txt +7 -0
  75. statistics/index.php +2 -0
  76. statistics/link.php +0 -69
  77. statistics/newsletters.php +5 -3
  78. statistics/open.php +0 -21
  79. statistics/settings.php +2 -0
  80. statistics/statistics.php +114 -13
  81. statistics/view-retarget.php +2 -0
  82. statistics/view-urls.php +2 -0
  83. statistics/view-users.php +2 -0
  84. statistics/view.php +2 -0
  85. subscription/forms.php +2 -0
  86. subscription/lists.php +2 -0
  87. subscription/options.php +2 -0
  88. subscription/page.php +1 -1
  89. subscription/profile.php +2 -0
  90. subscription/subscription.php +13 -12
  91. subscription/template.php +2 -0
  92. subscription/unsubscription.php +2 -0
  93. tnp-footer.php +3 -0
  94. tnp-header.php +2 -0
  95. users/csv.php +0 -19
  96. users/edit.php +3 -2
  97. users/export.php +1 -0
  98. users/import.php +10 -3
  99. users/index.php +1 -0
  100. users/massive.php +2 -0
  101. users/new.php +2 -0
  102. users/statistics-time.php +4 -0
  103. users/statistics.php +2 -0
  104. users/users.php +1 -0
  105. widget.php +1 -0
  106. wp/index.php +2 -0
  107. wp/wp.php +1 -0
api/add.php DELETED
@@ -1,46 +0,0 @@
1
- <?php
2
-
3
- include '../../../../wp-load.php';
4
-
5
- if (!isset($newsletter)) $newsletter = new Newsletter();
6
-
7
- $key = stripslashes($_REQUEST['nk']);
8
- if (empty($newsletter->options['api_key']) || $key != $newsletter->options['api_key']) {
9
- die('Wrong API key');
10
- }
11
-
12
- if (!is_email($_REQUEST['ne'])) {
13
- die('Wrong email');
14
- }
15
-
16
- $subscriber = array();
17
- $subscriber['name'] = stripslashes($_REQUEST['nn']);
18
- $subscriber['surname'] = stripslashes($_REQUEST['ns']);
19
- $subscriber['email'] = $newsletter->normalize_email(stripslashes($_REQUEST['ne']));
20
-
21
- if (is_array($_REQUEST['nl'])) {
22
- foreach ($_REQUEST['nl'] as $add_list) {
23
- $subscriber['list_' . $add_list] = 1;
24
- }
25
- }
26
- else if (!empty($_REQUEST['nl'])) {
27
- $add_lists = explode('|', $_REQUEST['nl']);
28
- foreach ($add_lists as $add_list) {
29
- $subscriber['list_' . $add_list] = 1;
30
- }
31
- }
32
-
33
- $options_feed = get_option('newsletter_feed', array());
34
- if ($options_feed['add_new'] == 1) $subscriber['feed'] = 1;
35
-
36
- $options_followup = get_option('newsletter_followup', array());
37
- if ($options_followup['add_new'] == 1) {
38
- $subscriber['followup'] = 1;
39
- $subscriber['followup_time'] = time() + $options_followup['interval'] * 3600;
40
- }
41
-
42
- $subscriber['status'] = 'C';
43
-
44
- // TODO: add control for already subscribed emails
45
- NewsletterUsers::instance()->save_user($subscriber);
46
- die('ok');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
api/delete.php DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
-
3
- include '../../../../wp-load.php';
4
-
5
- if (!isset($newsletter)) $newsletter = new Newsletter();
6
-
7
- $key = stripslashes($_REQUEST['nk']);
8
- if (empty(trim($newsletter->options['api_key'])) || $key != $newsletter->options['api_key'])
9
- die('Wrong API key');
10
-
11
- $email = $newsletter->normalize_email(stripslashes($_REQUEST['ne']));
12
- $r = $wpdb->query($wpdb->prepare("delete from " . NEWSLETTER_USERS_TABLE . " where email=%s", $email));
13
- die($r = 0 ? 'ko' : 'ok');
 
 
 
 
 
 
 
 
 
 
 
 
 
do/change.php DELETED
@@ -1,48 +0,0 @@
1
- <?php
2
-
3
- header('Content-Type: text/html;charset=UTF-8');
4
- header('X-Robots-Tag: noindex,nofollow,noarchive');
5
- header('Cache-Control: no-cache,no-store,private');
6
- include '../../../../wp-load.php';
7
-
8
- $user = Newsletter::instance()->get_user_from_request(true);
9
- $field = $_REQUEST['nf'];
10
- $value = $_REQUEST['nv'];
11
- $url = $_REQUEST['nu'];
12
-
13
-
14
- switch ($field) {
15
- case 'sex':
16
- if (!in_array($value, array('f', 'm', 'n')))
17
- die('Invalid sex value');
18
- NewsletterUsers::instance()->set_user_field($user->id, 'sex', $value);
19
- break;
20
- // Should be managed by Feed by Mail
21
- case 'feed':
22
- if (isset($value) && ($value === '0' || $value === '1')) {
23
- NewsletterUsers::instance()->set_user_field($user->id, 'feed', $value);
24
- } else
25
- die('Invalid feed value');
26
- break;
27
- }
28
-
29
- if (strpos($field, 'preference_') === 0) {
30
- $idx = (int) substr($field, 11);
31
- $options_profile = get_option('newsletter_profile');
32
-
33
- if ($options_profile['list_' . $idx . '_status'] == 0) {
34
- die('Not allowed field.');
35
- }
36
-
37
- if (isset($value) && ($value === '0' || $value === '1')) {
38
- NewsletterUsers::instance()->set_user_field($user->id, 'list_' . $idx, $value);
39
- } else {
40
- die('Invalid preference value');
41
- }
42
- }
43
-
44
- if (isset($url)) {
45
- header("Location: $url");
46
- } else {
47
- NewsletterSubscription::instance()->show_message('profile', $user, NewsletterSubscription::instance()->options['profile_saved']);
48
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
do/confirm.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- if (!defined('ABSPATH')) {
4
- $_GET['na'] = 'c';
5
- require_once '../../../../wp-load.php';
6
- }
 
 
 
 
 
 
do/profile.php DELETED
@@ -1,7 +0,0 @@
1
- <?php
2
-
3
- if (!defined('ABSPATH')) {
4
- $_GET['na'] = 'p';
5
- require_once '../../../../wp-load.php';
6
- }
7
-
 
 
 
 
 
 
 
do/save.php DELETED
@@ -1,10 +0,0 @@
1
- <?php
2
-
3
- header('Content-Type: text/html;charset=UTF-8');
4
- header('X-Robots-Tag: noindex,nofollow,noarchive');
5
- header('Cache-Control: no-cache,no-store,private');
6
- include '../../../../wp-load.php';
7
-
8
- $user = NewsletterSubscription::instance()->save_profile();
9
- // $user->alert is a temporary field
10
- NewsletterSubscription::instance()->show_message('profile', $user, $user->alert);
 
 
 
 
 
 
 
 
 
 
do/subscribe.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
-
4
- $_GET['na'] = 's';
5
- require_once '../../../../wp-load.php';
6
-
 
 
 
 
 
 
do/subscription.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- require_once '../../../../wp-load.php';
4
-
5
- if (!isset($newsletter)) $newsletter = new Newsletter();
6
-
7
- $options_main = get_option('newsletter_main', array());
8
-
9
- if (!empty($options_main['url'])) {
10
- header('Location: ' . $options_main['url']);
11
- die();
12
- }
13
-
14
- $options = get_option('newsletter', array());
15
-
16
- if (stripos($options['subscription_text'], '<form') !== false) {
17
- $message = str_ireplace('<form', '<form method="post" action="' . plugins_url('newsletter/do/subscribe.php') . '" onsubmit="return newsletter_check(this)"', $options['subscription_text']);
18
- $message = $this->replace_lists($message);
19
- } else {
20
- $form = $newsletter->subscription_form();
21
-
22
- if (strpos($options['subscription_text'], '{subscription_form}') !== false)
23
- $message = str_replace('{subscription_form}', $form, $options['subscription_text']);
24
- else $message = $options['subscription_text'] . $form;
25
- }
26
- include NEWSLETTER_DIR . '/page.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
do/unlock.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- if (!defined('ABSPATH')) {
4
- $_GET['na'] = 'ul';
5
- include '../../../../wp-load.php';
6
- }
 
 
 
 
 
 
do/unsubscribe.php DELETED
@@ -1,5 +0,0 @@
1
- <?php
2
- if (!defined('ABSPATH')) {
3
- $_GET['na'] = 'uc';
4
- require_once '../../../../wp-load.php';
5
- }
 
 
 
 
 
do/unsubscription.php DELETED
@@ -1,6 +0,0 @@
1
- <?php
2
-
3
- if (!defined('ABSPATH')) {
4
- $_GET['na'] = 'u';
5
- require_once '../../../../wp-load.php';
6
- }
 
 
 
 
 
 
do/view.php DELETED
@@ -1,3 +0,0 @@
1
- <?php
2
- $_GET['na'] = 'v';
3
- require_once '../../../../wp-load.php';
 
 
 
emails/composer.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterEmails::instance();
@@ -19,6 +21,7 @@ if (($controls->is_action('save') || $controls->is_action('preview')) && !$_GET[
19
  $email['status'] = 'new';
20
  $email['subject'] = __('Here the email subject', 'newsletter');
21
  $email['track'] = 1;
 
22
 
23
  $email['message'] = $controls->data['body'];
24
  $email['subject'] = $controls->data['subject'];
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterEmails::instance();
21
  $email['status'] = 'new';
22
  $email['subject'] = __('Here the email subject', 'newsletter');
23
  $email['track'] = 1;
24
+ $email['token'] = $module->get_token();
25
 
26
  $email['message'] = $controls->data['body'];
27
  $email['subject'] = $controls->data['subject'];
emails/cpreview.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterEmails::instance();
@@ -441,16 +443,20 @@ echo $wpdb->get_var(str_replace('*', 'count(*)', $email['query']));
441
  <table class="form-table">
442
  <tr valign="top">
443
  <th>Email status</th>
444
- <td><?php echo $email['status']; ?></td>
445
  </tr>
446
  <tr valign="top">
447
  <th>Messages sent</th>
448
- <td><?php echo $email['sent']; ?> of <?php echo $email['total']; ?></td>
449
  </tr>
450
  <tr valign="top">
451
  <th>Query (tech)</th>
452
- <td><?php echo $email['query']; ?></td>
453
  </tr>
 
 
 
 
454
  </table>
455
  </div>
456
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterEmails::instance();
443
  <table class="form-table">
444
  <tr valign="top">
445
  <th>Email status</th>
446
+ <td><?php echo $email['status'] ?></td>
447
  </tr>
448
  <tr valign="top">
449
  <th>Messages sent</th>
450
+ <td><?php echo $email['sent'] ?> of <?php echo $email['total'] ?></td>
451
  </tr>
452
  <tr valign="top">
453
  <th>Query (tech)</th>
454
+ <td><?php echo esc_html($email['query']) ?></td>
455
  </tr>
456
+ <tr valign="top">
457
+ <th>Token (tech)</th>
458
+ <td><?php echo esc_html($email['token']) ?></td>
459
+ </tr>
460
  </table>
461
  </div>
462
 
emails/create.php DELETED
@@ -1,54 +0,0 @@
1
- <?php
2
-
3
- // Stops WP Super Cache which removes the logged_in cookie
4
- $_GET['preview'] = 'true';
5
-
6
- require_once '../../../../wp-load.php';
7
-
8
- if (!is_user_logged_in()) {
9
- die('No logged in user found. A plugin is almost surely removing the authentication cookies, usually a cache plugin. Try to report the issue on http://www.thenewsletterplugin.com forum.');
10
- }
11
-
12
- if (!current_user_can('manage_categories')) {
13
- die('Not enough privileges');
14
- }
15
-
16
- if (Newsletter::instance()->options['editor'] != 1 && !current_user_can('manage_options')) {
17
- die('Not enough privileges');
18
- }
19
-
20
- require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
21
- $controls = new NewsletterControls();
22
- $module = NewsletterEmails::instance();
23
-
24
- if ($controls->is_action('create')) {
25
- $module->save_options($controls->data);
26
-
27
- $email = array();
28
- $email['status'] = 'new';
29
- $email['subject'] = ''; //__('Here the email subject', 'newsletter');
30
- $email['track'] = 1;
31
-
32
- $theme_options = $module->get_current_theme_options();
33
-
34
- $theme_url = $module->get_current_theme_url();
35
- $theme_subject = '';
36
-
37
- ob_start();
38
- include $module->get_current_theme_file_path('theme.php');
39
- $email['message'] = ob_get_clean();
40
-
41
- if (!empty($theme_subject)) {
42
- $email['subject'] = $theme_subject;
43
- }
44
-
45
- ob_start();
46
- include $module->get_current_theme_file_path('theme-text.php');
47
- $email['message_text'] = ob_get_clean();
48
-
49
- $email['type'] = 'message';
50
- $email['send_on'] = time();
51
- $email = Newsletter::instance()->save_email($email);
52
-
53
- header('Location: ' . $module->get_admin_page_url('edit') . '&id=' . $email->id);
54
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
emails/css.php DELETED
@@ -1,17 +0,0 @@
1
- <?php
2
-
3
- include '../../../../wp-load.php';
4
-
5
- $email_id = (int)$_GET['id'];
6
-
7
- $body = Newsletter::instance()->get_email_field($email_id, 'message');
8
-
9
- $x = strpos($body, '<style');
10
- if ($x === false) return;
11
-
12
- $x = strpos($body, '>', $x);
13
- $y = strpos($body, '</style>');
14
-
15
- header('Content-Type: text/css');
16
-
17
- echo substr($body, $x+1, $y-$x-1);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
emails/edit.php CHANGED
@@ -32,6 +32,7 @@ if (!$controls->is_action()) {
32
  if ($controls->is_action('test') || $controls->is_action('save') || $controls->is_action('send') || $controls->is_action('editor')) {
33
 
34
  // If we were editing with visual editor (==0), we must read the extra <body> content
 
35
  if ($email['editor'] == 0) {
36
  $x = strpos($email['message'], '<body');
37
  if ($x !== false) {
@@ -43,7 +44,7 @@ if ($controls->is_action('test') || $controls->is_action('save') || $controls->i
43
  } else {
44
  $email['message'] = $controls->data['message'];
45
  }
46
- $email['message_text'] = $controls->data['message_text'];
47
  $email['subject'] = $controls->data['subject'];
48
  $email['track'] = $controls->data['track'];
49
  $email['private'] = $controls->data['private'];
@@ -237,7 +238,7 @@ if ($email['editor'] == 0) {
237
  theme_advanced_resizing: true,
238
  theme_advanced_toolbar_location: "top",
239
  document_base_url: "<?php echo get_option('home'); ?>/",
240
- content_css: ["<?php echo plugins_url('newsletter') ?>/emails/editor.css", "<?php echo plugins_url('newsletter') . '/emails/css.php?id=' . $email_id . '&' . time(); ?>"]
241
  });
242
 
243
  jQuery(document).ready(function () {
@@ -248,6 +249,7 @@ if ($email['editor'] == 0) {
248
 
249
  window.send_to_editor = function (html) {
250
  var imgURL = html.match(/src=\"(.*?)\"/);
 
251
  tinyMCE.execCommand('mceInsertContent', false, '<img src="' + imgURL[1] + '" />');
252
  tb_remove();
253
  }
@@ -450,7 +452,7 @@ if ($email['editor'] == 0) {
450
  <table class="form-table">
451
  <tr valign="top">
452
  <th>Email status</th>
453
- <td><?php echo $email['status']; ?></td>
454
  </tr>
455
  <tr valign="top">
456
  <th>Messages sent</th>
@@ -458,7 +460,11 @@ if ($email['editor'] == 0) {
458
  </tr>
459
  <tr valign="top">
460
  <th>Query (tech)</th>
461
- <td><?php echo $email['query']; ?></td>
 
 
 
 
462
  </tr>
463
  </table>
464
  </div>
32
  if ($controls->is_action('test') || $controls->is_action('save') || $controls->is_action('send') || $controls->is_action('editor')) {
33
 
34
  // If we were editing with visual editor (==0), we must read the extra <body> content
35
+ $email['message'] = str_ireplace('<script', '', $controls->data['message']);
36
  if ($email['editor'] == 0) {
37
  $x = strpos($email['message'], '<body');
38
  if ($x !== false) {
44
  } else {
45
  $email['message'] = $controls->data['message'];
46
  }
47
+ $email['message_text'] = str_ireplace('<script', '', $controls->data['message_text']);
48
  $email['subject'] = $controls->data['subject'];
49
  $email['track'] = $controls->data['track'];
50
  $email['private'] = $controls->data['private'];
238
  theme_advanced_resizing: true,
239
  theme_advanced_toolbar_location: "top",
240
  document_base_url: "<?php echo get_option('home'); ?>/",
241
+ content_css: ["<?php echo plugins_url('newsletter') ?>/emails/editor.css", "<?php echo home_url('/') . '?na=emails-css&id=' . $email_id . '&' . time(); ?>"]
242
  });
243
 
244
  jQuery(document).ready(function () {
249
 
250
  window.send_to_editor = function (html) {
251
  var imgURL = html.match(/src=\"(.*?)\"/);
252
+ if (imgURL.indexOf("http") !== 0) imgURL = "http:" + imgURL;
253
  tinyMCE.execCommand('mceInsertContent', false, '<img src="' + imgURL[1] + '" />');
254
  tb_remove();
255
  }
452
  <table class="form-table">
453
  <tr valign="top">
454
  <th>Email status</th>
455
+ <td><?php echo esc_html($email['status']); ?></td>
456
  </tr>
457
  <tr valign="top">
458
  <th>Messages sent</th>
460
  </tr>
461
  <tr valign="top">
462
  <th>Query (tech)</th>
463
+ <td><?php echo esc_html($email['query']); ?></td>
464
+ </tr>
465
+ <tr valign="top">
466
+ <th>Token (tech)</th>
467
+ <td><?php echo esc_html($email['token']); ?></td>
468
  </tr>
469
  </table>
470
  </div>
emails/emails.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  require_once NEWSLETTER_INCLUDES_DIR . '/themes.php';
4
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
@@ -19,12 +20,15 @@ class NewsletterEmails extends NewsletterModule {
19
 
20
  function __construct() {
21
  $this->themes = new NewsletterThemes('emails');
22
- parent::__construct('emails', '1.1.4');
23
  add_action('wp_loaded', array($this, 'hook_wp_loaded'));
24
  }
25
 
26
  function hook_wp_loaded() {
27
- global $newsletter, $wpdb;
 
 
 
28
  switch ($newsletter->action) {
29
  case 'v':
30
  // TODO: Change to Newsletter::instance()->get:email(), not urgent
@@ -32,7 +36,7 @@ class NewsletterEmails extends NewsletterModule {
32
  if (empty($email)) {
33
  die('Email not found');
34
  }
35
-
36
  if ($email->private == 1) {
37
  die('Email not found');
38
  }
@@ -49,6 +53,121 @@ class NewsletterEmails extends NewsletterModule {
49
  echo $newsletter->replace($email->message, $user, $email->id);
50
 
51
  die();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
52
  }
53
  }
54
 
@@ -64,8 +183,11 @@ class NewsletterEmails extends NewsletterModule {
64
  $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column private tinyint(1) not null default 0");
65
 
66
  // Force a token to email without one already set.
67
- $token = self::get_token();
68
- $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set token='" . $token . "' where token=''");
 
 
 
69
  $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set total=sent where status='sent' and type='message'");
70
 
71
  return true;
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/themes.php';
5
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
20
 
21
  function __construct() {
22
  $this->themes = new NewsletterThemes('emails');
23
+ parent::__construct('emails', '1.1.5');
24
  add_action('wp_loaded', array($this, 'hook_wp_loaded'));
25
  }
26
 
27
  function hook_wp_loaded() {
28
+ global $wpdb;
29
+
30
+ $newsletter = Newsletter::instance();
31
+
32
  switch ($newsletter->action) {
33
  case 'v':
34
  // TODO: Change to Newsletter::instance()->get:email(), not urgent
36
  if (empty($email)) {
37
  die('Email not found');
38
  }
39
+
40
  if ($email->private == 1) {
41
  die('Email not found');
42
  }
53
  echo $newsletter->replace($email->message, $user, $email->id);
54
 
55
  die();
56
+ break;
57
+
58
+ case 'emails-css':
59
+ $email_id = (int) $_GET['id'];
60
+
61
+ $body = Newsletter::instance()->get_email_field($email_id, 'message');
62
+
63
+ $x = strpos($body, '<style');
64
+ if ($x === false)
65
+ return;
66
+
67
+ $x = strpos($body, '>', $x);
68
+ $y = strpos($body, '</style>');
69
+
70
+ header('Content-Type: text/css;charset=UTF-8');
71
+
72
+ echo substr($body, $x + 1, $y - $x - 1);
73
+
74
+ die();
75
+ break;
76
+
77
+ case 'emails-preview':
78
+ if (!current_user_can('manage_categories')) {
79
+ die('Not enough privileges');
80
+ }
81
+
82
+ if (Newsletter::instance()->options['editor'] != 1 && !current_user_can('manage_options')) {
83
+ die('Not enough privileges');
84
+ }
85
+ if (!check_admin_referer('view')) {
86
+ die();
87
+ }
88
+
89
+ // Used by theme code
90
+ $theme_options = $this->get_current_theme_options();
91
+ $theme_url = $this->get_current_theme_url();
92
+ header('Content-Type: text/html;charset=UTF-8');
93
+
94
+ include($this->get_current_theme_file_path('theme.php'));
95
+
96
+ die();
97
+ break;
98
+
99
+ case 'emails-preview-text':
100
+ header('Content-Type: text/plain;charset=UTF-8');
101
+ if (!current_user_can('manage_categories')) {
102
+ die('Not enough privileges');
103
+ }
104
+
105
+ if (Newsletter::instance()->options['editor'] != 1 && !current_user_can('manage_options')) {
106
+ die('Not enough privileges');
107
+ }
108
+
109
+ if (!check_admin_referer('view')) {
110
+ die();
111
+ }
112
+
113
+ // Used by theme code
114
+ $theme_options = $this->get_current_theme_options();
115
+
116
+ $file = $this->get_current_theme_file_path('theme-text.php');
117
+ if (is_file($file)) {
118
+ include($this->get_current_theme_file_path('theme-text.php'));
119
+ }
120
+
121
+ die();
122
+ break;
123
+
124
+
125
+ case 'emails-create':
126
+
127
+ if (!current_user_can('manage_categories')) {
128
+ die('Not enough privileges');
129
+ }
130
+
131
+ if ($newsletter->options['editor'] != 1 && !current_user_can('manage_options')) {
132
+ die('Not enough privileges');
133
+ }
134
+
135
+ require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
136
+ $controls = new NewsletterControls();
137
+
138
+ if ($controls->is_action('create')) {
139
+ $this->save_options($controls->data);
140
+
141
+ $email = array();
142
+ $email['status'] = 'new';
143
+ $email['subject'] = ''; //__('Here the email subject', 'newsletter');
144
+ $email['track'] = 1;
145
+
146
+ $theme_options = $this->get_current_theme_options();
147
+
148
+ $theme_url = $this->get_current_theme_url();
149
+ $theme_subject = '';
150
+
151
+ ob_start();
152
+ include $this->get_current_theme_file_path('theme.php');
153
+ $email['message'] = ob_get_clean();
154
+
155
+ if (!empty($theme_subject)) {
156
+ $email['subject'] = $theme_subject;
157
+ }
158
+
159
+ ob_start();
160
+ include $this->get_current_theme_file_path('theme-text.php');
161
+ $email['message_text'] = ob_get_clean();
162
+
163
+ $email['type'] = 'message';
164
+ $email['send_on'] = time();
165
+ $email = $newsletter->save_email($email);
166
+
167
+ header('Location: ' . $this->get_admin_page_url('edit') . '&id=' . $email->id);
168
+ }
169
+ die();
170
+ break;
171
  }
172
  }
173
 
183
  $this->upgrade_query("alter table " . NEWSLETTER_EMAILS_TABLE . " add column private tinyint(1) not null default 0");
184
 
185
  // Force a token to email without one already set.
186
+ //$token = self::get_token();
187
+ //$wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set token='" . $token . "' where token=''");
188
+ if ($this->old_version < '1.1.5') {
189
+ $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set token=''");
190
+ }
191
  $wpdb->query("update " . NEWSLETTER_EMAILS_TABLE . " set total=sent where status='sent' and type='message'");
192
 
193
  return true;
emails/index.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterEmails::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterEmails::instance();
emails/new.php CHANGED
@@ -13,6 +13,7 @@ if ($controls->is_action('theme')) {
13
  $email['status'] = 'new';
14
  $email['subject'] = __('Here the email subject', 'newsletter');
15
  $email['track'] = 1;
 
16
 
17
  $theme_options = $module->get_current_theme_options();
18
  $theme_url = $module->get_current_theme_url();
@@ -124,7 +125,6 @@ function newsletter_emails_get_theme_options($theme) {
124
 
125
  <div class="wrap" id="tnp-wrap">
126
 
127
- <?php $help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter/newsletters-module'; ?>
128
  <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
129
 
130
  <div id="tnp-heading">
@@ -138,34 +138,34 @@ function newsletter_emails_get_theme_options($theme) {
138
  </div>
139
 
140
  <div id="tnp-body" class="tnp-body-lite">
141
-
142
- <form method="post" action="<?php echo $module->get_admin_page_url('new'); ?>">
143
- <?php $controls->init(); ?>
144
- <?php $controls->hidden('theme'); ?>
145
-
146
- <table style="width: 100%; border-collapse: collapse">
147
- <tr>
148
- <td style="text-align: left; vertical-align: top; border-bottom: 1px solid #ddd; padding-bottom: 10px">
149
- <div style="float: right; margin-left: 15px;"><?php $controls->button_primary('save', __('Refresh the preview', 'newsletter')); ?></div>
150
-
151
- </td>
152
- <td style="text-align: left; vertical-align: top; border-bottom: 1px solid #ddd; padding-bottom: 10px">
153
- <div style="float: right"><?php $controls->button_primary('create', 'Proceed to edit &raquo;', 'this.form.action=\'' . plugins_url('newsletter') . '/emails/create.php\';this.form.submit()'); ?></div>
154
- <img style="position: relative; left: 5px; top: 10px;"src="<?php echo plugins_url('newsletter') ?>/images/arrow.png" height="35">
155
- </td>
156
- </tr>
157
- <tr>
158
- <td style="width: 600px; vertical-align: top; padding-top: 10px">
159
- <?php @include $module->get_current_theme_file_path('theme-options.php'); ?>
160
- </td>
161
- <td style="vertical-align: top; padding-top: 15px; padding-left: 15px">
162
- <iframe src="<?php echo wp_nonce_url(plugins_url('newsletter') . '/emails/preview.php?' . time(), 'view'); ?>" height="700" style="width: 100%; border: 1px solid #ccc"></iframe>
163
- </td>
164
- </tr>
165
- </table>
166
-
167
- </form>
168
- </div>
169
 
170
  <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
171
 
13
  $email['status'] = 'new';
14
  $email['subject'] = __('Here the email subject', 'newsletter');
15
  $email['track'] = 1;
16
+ $email['token'] = $module->get_token();
17
 
18
  $theme_options = $module->get_current_theme_options();
19
  $theme_url = $module->get_current_theme_url();
125
 
126
  <div class="wrap" id="tnp-wrap">
127
 
 
128
  <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
129
 
130
  <div id="tnp-heading">
138
  </div>
139
 
140
  <div id="tnp-body" class="tnp-body-lite">
141
+
142
+ <form method="post" action="<?php echo $module->get_admin_page_url('new'); ?>">
143
+ <?php $controls->init(); ?>
144
+ <?php $controls->hidden('theme'); ?>
145
+
146
+ <table style="width: 100%; border-collapse: collapse">
147
+ <tr>
148
+ <td style="text-align: left; vertical-align: top; border-bottom: 1px solid #ddd; padding-bottom: 10px">
149
+ <div style="float: right; margin-left: 15px;"><?php $controls->button_primary('save', __('Refresh the preview', 'newsletter')); ?></div>
150
+
151
+ </td>
152
+ <td style="text-align: left; vertical-align: top; border-bottom: 1px solid #ddd; padding-bottom: 10px">
153
+ <div style="float: right"><?php $controls->button_primary('create', 'Proceed to edit &raquo;', 'this.form.action=\'' . home_url('/') . '?na=emails-create\';this.form.submit()'); ?></div>
154
+ <img style="position: relative; left: 5px; top: 10px;"src="<?php echo plugins_url('newsletter') ?>/images/arrow.png" height="35">
155
+ </td>
156
+ </tr>
157
+ <tr>
158
+ <td style="width: 600px; vertical-align: top; padding-top: 10px">
159
+ <?php @include $module->get_current_theme_file_path('theme-options.php'); ?>
160
+ </td>
161
+ <td style="vertical-align: top; padding-top: 15px; padding-left: 15px">
162
+ <iframe src="<?php echo wp_nonce_url(home_url('/') . '?na=emails-preview&ts=' . time(), 'view'); ?>" height="700" style="width: 100%; border: 1px solid #ccc"></iframe>
163
+ </td>
164
+ </tr>
165
+ </table>
166
+
167
+ </form>
168
+ </div>
169
 
170
  <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
171
 
emails/preview-text.php DELETED
@@ -1,15 +0,0 @@
1
- <?php
2
- header('Content-Type: text/plain;charset=UTF-8');
3
-
4
- include '../../../../wp-load.php';
5
-
6
- if (!check_admin_referer('view'))
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 DELETED
@@ -1,13 +0,0 @@
1
- <?php
2
-
3
- include '../../../../wp-load.php';
4
-
5
- if (!check_admin_referer('view'))
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
- header('Content-Type: text/html;charset=UTF-8');
12
-
13
- include(NewsletterEmails::instance()->get_current_theme_file_path('theme.php'));
 
 
 
 
 
 
 
 
 
 
 
 
 
emails/theme.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterEmails::instance();
@@ -69,15 +71,15 @@ $themes = $module->themes->get_all_with_data();
69
  </a>
70
  </div>
71
 
72
- <?php foreach ($themes as $key => &$data) { ?>
73
  <div class="tnp-theme-preview">
74
- <p><?php echo $data['name']; ?></p>
75
  <a href="#" onclick="var f = document.getElementById('newsletter-form');
76
  f.act.value = 'theme';
77
- f.elements['options[theme]'].value = '<?php echo $data['id']; ?>';
78
  f.submit();
79
  return false;" style="margin-right: 20px; margin-bottom: 20px">
80
- <img src="<?php echo $data['screenshot'] ?>" width="200" height="200">
81
  </a>
82
  </div>
83
  <?php } ?>
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterEmails::instance();
71
  </a>
72
  </div>
73
 
74
+ <?php foreach ($themes as $key => $data) { ?>
75
  <div class="tnp-theme-preview">
76
+ <p><?php echo esc_html($data['name']) ?></p>
77
  <a href="#" onclick="var f = document.getElementById('newsletter-form');
78
  f.act.value = 'theme';
79
+ f.elements['options[theme]'].value = '<?php echo esc_js($data['id']) ?>';
80
  f.submit();
81
  return false;" style="margin-right: 20px; margin-bottom: 20px">
82
+ <img src="<?php echo esc_attr($data['screenshot']) ?>" width="200" height="200">
83
  </a>
84
  </div>
85
  <?php } ?>
emails/themes/blank/theme-options.php CHANGED
@@ -1,6 +1,9 @@
1
- <table class="form-table">
2
- <tr>
3
- <th>Disable social links</th>
4
- <td><?php $controls->checkbox('theme_social_disable', ''); ?></td>
5
- </tr>
 
 
 
6
  </table>
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?>
4
+ <table class="form-table">
5
+ <tr>
6
+ <th>Disable social links</th>
7
+ <td><?php $controls->checkbox('theme_social_disable', ''); ?></td>
8
+ </tr>
9
  </table>
emails/themes/blank/theme-text.php CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  This email requires a modern e-mail reader but you can view the email online here:
2
 
3
  {email_url}.
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?>
4
  This email requires a modern e-mail reader but you can view the email online here:
5
 
6
  {email_url}.
emails/themes/blank/theme.php CHANGED
@@ -1,4 +1,6 @@
1
- <html>
 
 
2
  <head>
3
  <style>
4
  body {
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?><html>
4
  <head>
5
  <style>
6
  body {
emails/themes/cta-2015/theme-options.php CHANGED
@@ -1,8 +1,11 @@
1
- <table class="form-table">
2
- <tr>
3
- <th>Main color</th>
4
- <td>
5
- <?php $controls->color('theme_color'); ?> (eg. #87aa14)
6
- </td>
7
- </tr>
 
 
 
8
  </table>
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?>
4
+ <table class="form-table">
5
+ <tr>
6
+ <th>Main color</th>
7
+ <td>
8
+ <?php $controls->color('theme_color'); ?> (eg. #87aa14)
9
+ </td>
10
+ </tr>
11
  </table>
emails/themes/cta-2015/theme.php CHANGED
@@ -1,160 +1,162 @@
1
- <?php
2
- /*
3
- * Name: CTA 2015
4
- * Type: standard
5
- * Description: Single call to action marketing template
6
- */
7
-
8
- $color = '#87aa14';
9
- if (!empty($theme_options['theme_color'])) {
10
- $color = $theme_options['theme_color'];
11
- }
12
-
13
- $header = '';
14
- $header_color = '#000000';
15
- if (!empty($theme_options['main_header_logo']['url'])) {
16
- $header = '<img src="' . $theme_options['main_header_logo']['url'] . '" style="max-width: 500px">';
17
- } else {
18
- if (!empty($theme_options['main_header_title'])) {
19
- $header = '<h2 style="color: ' . $header_color . '">' . $theme_options['main_header_title'] . '</h2>';
20
- } else {
21
- $header = '<h2 style="color: ' . $header_color . '">' . get_option('blogname') . '</h2>';
22
- }
23
- if (!empty($theme_options['main_header_sub'])) {
24
- $header .= '<p style="color: #666666">' . $theme_options['main_header_sub'] . '</p>';
25
- }
26
- }
27
- $font_family = 'Verdana';
28
- //$cta_bgcolor = '#008800';
29
- //if (!empty($theme_options['theme_cta_bgcolor'])) {
30
- // $cta_bgcolor = $theme_options['theme_cta_bgcolor'];
31
- //}
32
- $social_icon_url = plugins_url('newsletter') . '/emails/themes/cta-2015/images';
33
- ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
34
- <html>
35
- <head>
36
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
37
- <title></title>
38
- </head>
39
- <body bgcolor="#ffffff">
40
- <table width="500" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" border="0">
41
- <tr>
42
- <td align="center" style="font-family: Verdana">
43
- <table cellpadding="10" cellspacing="0" border="0" width="100%">
44
- <tr>
45
- <td style="font-size: 12px" align="center">
46
- <a href="{email_url}" style="text-decoration: none">View online</a>
47
- </td>
48
- </tr>
49
- </table>
50
- </td>
51
- </tr>
52
-
53
- <!-- header -->
54
- <tr>
55
- <td align="center" style="font-family: Verdana">
56
- <?php echo $header; ?>
57
- </td>
58
- </tr>
59
-
60
- <!-- body -->
61
- <tr>
62
- <td style="font-family: Verdana">
63
-
64
- <!-- main text -->
65
- <table cellpadding="15" cellspacing="0" align="center" border="0" width="100%">
66
- <tr>
67
- <td style="font-size: 15px" align="center">
68
- <h1>Super catching title</h1>
69
- <p>
70
- Here you should introduce your incredible offer. Remeber the golden rule: write
71
- something useful for your readers, not for yourself.
72
- </p>
73
- <p>
74
- If a reader ask the question: what's here for me, the content is answering?
75
- </p>
76
- </td>
77
- </tr>
78
- </table>
79
-
80
- <!-- cta -->
81
- <table cellpadding="15" cellspacing="0" align="center" bgcolor="<?php echo $color ?>" border="0" style="border-radius: 5px">
82
- <tr>
83
- <td><a href="#" style="font-size: 15px; color: #ffffff; text-decoration: none">Call to action</a></td>
84
- </tr>
85
- </table>
86
-
87
- <!-- spacer -->
88
- <table cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" border="0" width="100%">
89
- <tr>
90
- <td>
91
- &nbsp;
92
- </td>
93
- </tr>
94
- </table>
95
-
96
- <!-- social -->
97
- <table cellpadding="5" align="center">
98
- <tr>
99
- <?php if (!empty($theme_options['main_facebook_url'])) { ?>
100
- <td align="center" valign="top">
101
- <a href="<?php echo $theme_options['main_facebook_url'] ?>"><img src="<?php echo $social_icon_url ?>/facebook.png" alt="Facebook"></a>
102
- </td>
103
- <?php } ?>
104
-
105
- <?php if (!empty($theme_options['main_googleplus_url'])) { ?>
106
- <td align="center" valign="top">
107
- <a href="<?php echo $theme_options['main_googleplus_url'] ?>"><img src="<?php echo $social_icon_url ?>/googleplus.png"></a>
108
- </td>
109
- <?php } ?>
110
-
111
- <?php if (!empty($theme_options['main_twitter_url'])) { ?>
112
- <td align="center" valign="top">
113
- <a href="<?php echo $theme_options['main_twitter_url'] ?>"><img src="<?php echo $social_icon_url ?>/twitter.png"></a>
114
- </td>
115
- <?php } ?>
116
-
117
- <?php if (!empty($theme_options['main_linkedin_url'])) { ?>
118
- <td align="center" valign="top">
119
- <a href="<?php echo $theme_options['main_linkedin_url'] ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png"></a>
120
- </td>
121
- <?php } ?>
122
-
123
- <?php if (!empty($theme_options['main_youtube_url'])) { ?>
124
- <td align="center" valign="top">
125
- <a href="<?php echo $theme_options['main_youtube_url'] ?>"><img src="<?php echo $social_icon_url ?>/youtube.png"></a>
126
- </td>
127
- <?php } ?>
128
-
129
- <?php if (!empty($theme_options['main_vimeo_url'])) { ?>
130
- <td align="center" valign="top">
131
- <a href="<?php echo $theme_options['main_vimeo_url'] ?>"><img src="<?php echo $social_icon_url ?>/vimeo.png"></a>
132
- </td>
133
- <?php } ?>
134
- </tr>
135
- </table>
136
-
137
- <!-- spacer -->
138
- <table cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" border="0" width="100%">
139
- <tr>
140
- <td>
141
- &nbsp;
142
- </td>
143
- </tr>
144
- </table>
145
-
146
- <!-- footer -->
147
- <table cellpadding="15" cellspacing="0" align="center" width="100%" bgcolor="#eeeeee" border="0">
148
- <tr>
149
- <td style="font-size: 12px">
150
- <p><a href="{profile_url}">Manage your subscription</a></p>
151
- <p><?php echo $theme_options['main_footer_contact'] ?></p>
152
- <p><?php echo $theme_options['main_footer_legal'] ?></p>
153
- </td>
154
- </tr>
155
- </table>
156
- </td>
157
- </tr>
158
- </table>
159
- </body>
 
 
160
  </html>
1
+ <?php
2
+ /*
3
+ * Name: CTA 2015
4
+ * Type: standard
5
+ * Description: Single call to action marketing template
6
+ */
7
+
8
+ if (!defined('ABSPATH')) exit;
9
+
10
+ $color = '#87aa14';
11
+ if (!empty($theme_options['theme_color'])) {
12
+ $color = $theme_options['theme_color'];
13
+ }
14
+
15
+ $header = '';
16
+ $header_color = '#000000';
17
+ if (!empty($theme_options['main_header_logo']['url'])) {
18
+ $header = '<img src="' . $theme_options['main_header_logo']['url'] . '" style="max-width: 500px">';
19
+ } else {
20
+ if (!empty($theme_options['main_header_title'])) {
21
+ $header = '<h2 style="color: ' . $header_color . '">' . $theme_options['main_header_title'] . '</h2>';
22
+ } else {
23
+ $header = '<h2 style="color: ' . $header_color . '">' . get_option('blogname') . '</h2>';
24
+ }
25
+ if (!empty($theme_options['main_header_sub'])) {
26
+ $header .= '<p style="color: #666666">' . $theme_options['main_header_sub'] . '</p>';
27
+ }
28
+ }
29
+ $font_family = 'Verdana';
30
+ //$cta_bgcolor = '#008800';
31
+ //if (!empty($theme_options['theme_cta_bgcolor'])) {
32
+ // $cta_bgcolor = $theme_options['theme_cta_bgcolor'];
33
+ //}
34
+ $social_icon_url = plugins_url('newsletter') . '/emails/themes/cta-2015/images';
35
+ ?><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
36
+ <html>
37
+ <head>
38
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
39
+ <title></title>
40
+ </head>
41
+ <body bgcolor="#ffffff">
42
+ <table width="500" cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" border="0">
43
+ <tr>
44
+ <td align="center" style="font-family: Verdana">
45
+ <table cellpadding="10" cellspacing="0" border="0" width="100%">
46
+ <tr>
47
+ <td style="font-size: 12px" align="center">
48
+ <a href="{email_url}" style="text-decoration: none">View online</a>
49
+ </td>
50
+ </tr>
51
+ </table>
52
+ </td>
53
+ </tr>
54
+
55
+ <!-- header -->
56
+ <tr>
57
+ <td align="center" style="font-family: Verdana">
58
+ <?php echo $header; ?>
59
+ </td>
60
+ </tr>
61
+
62
+ <!-- body -->
63
+ <tr>
64
+ <td style="font-family: Verdana">
65
+
66
+ <!-- main text -->
67
+ <table cellpadding="15" cellspacing="0" align="center" border="0" width="100%">
68
+ <tr>
69
+ <td style="font-size: 15px" align="center">
70
+ <h1>Super catching title</h1>
71
+ <p>
72
+ Here you should introduce your incredible offer. Remeber the golden rule: write
73
+ something useful for your readers, not for yourself.
74
+ </p>
75
+ <p>
76
+ If a reader ask the question: what's here for me, the content is answering?
77
+ </p>
78
+ </td>
79
+ </tr>
80
+ </table>
81
+
82
+ <!-- cta -->
83
+ <table cellpadding="15" cellspacing="0" align="center" bgcolor="<?php echo $color ?>" border="0" style="border-radius: 5px">
84
+ <tr>
85
+ <td><a href="#" style="font-size: 15px; color: #ffffff; text-decoration: none">Call to action</a></td>
86
+ </tr>
87
+ </table>
88
+
89
+ <!-- spacer -->
90
+ <table cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" border="0" width="100%">
91
+ <tr>
92
+ <td>
93
+ &nbsp;
94
+ </td>
95
+ </tr>
96
+ </table>
97
+
98
+ <!-- social -->
99
+ <table cellpadding="5" align="center">
100
+ <tr>
101
+ <?php if (!empty($theme_options['main_facebook_url'])) { ?>
102
+ <td align="center" valign="top">
103
+ <a href="<?php echo $theme_options['main_facebook_url'] ?>"><img src="<?php echo $social_icon_url ?>/facebook.png" alt="Facebook"></a>
104
+ </td>
105
+ <?php } ?>
106
+
107
+ <?php if (!empty($theme_options['main_googleplus_url'])) { ?>
108
+ <td align="center" valign="top">
109
+ <a href="<?php echo $theme_options['main_googleplus_url'] ?>"><img src="<?php echo $social_icon_url ?>/googleplus.png"></a>
110
+ </td>
111
+ <?php } ?>
112
+
113
+ <?php if (!empty($theme_options['main_twitter_url'])) { ?>
114
+ <td align="center" valign="top">
115
+ <a href="<?php echo $theme_options['main_twitter_url'] ?>"><img src="<?php echo $social_icon_url ?>/twitter.png"></a>
116
+ </td>
117
+ <?php } ?>
118
+
119
+ <?php if (!empty($theme_options['main_linkedin_url'])) { ?>
120
+ <td align="center" valign="top">
121
+ <a href="<?php echo $theme_options['main_linkedin_url'] ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png"></a>
122
+ </td>
123
+ <?php } ?>
124
+
125
+ <?php if (!empty($theme_options['main_youtube_url'])) { ?>
126
+ <td align="center" valign="top">
127
+ <a href="<?php echo $theme_options['main_youtube_url'] ?>"><img src="<?php echo $social_icon_url ?>/youtube.png"></a>
128
+ </td>
129
+ <?php } ?>
130
+
131
+ <?php if (!empty($theme_options['main_vimeo_url'])) { ?>
132
+ <td align="center" valign="top">
133
+ <a href="<?php echo $theme_options['main_vimeo_url'] ?>"><img src="<?php echo $social_icon_url ?>/vimeo.png"></a>
134
+ </td>
135
+ <?php } ?>
136
+ </tr>
137
+ </table>
138
+
139
+ <!-- spacer -->
140
+ <table cellpadding="0" cellspacing="0" align="center" bgcolor="#ffffff" border="0" width="100%">
141
+ <tr>
142
+ <td>
143
+ &nbsp;
144
+ </td>
145
+ </tr>
146
+ </table>
147
+
148
+ <!-- footer -->
149
+ <table cellpadding="15" cellspacing="0" align="center" width="100%" bgcolor="#eeeeee" border="0">
150
+ <tr>
151
+ <td style="font-size: 12px">
152
+ <p><a href="{profile_url}">Manage your subscription</a></p>
153
+ <p><?php echo $theme_options['main_footer_contact'] ?></p>
154
+ <p><?php echo $theme_options['main_footer_legal'] ?></p>
155
+ </td>
156
+ </tr>
157
+ </table>
158
+ </td>
159
+ </tr>
160
+ </table>
161
+ </body>
162
  </html>
emails/themes/default/footer.php CHANGED
@@ -1,8 +1,11 @@
1
- <!-- Footer -->
2
- <div style="text-align: center; font-weight: bold; margin: 40px 0 10px;"><?php echo $theme_options['main_footer_title'] ?></div>
3
- <div style="text-align: center; margin: 10px 0 20px;"><?php echo $theme_options['main_footer_contact'] ?></div>
4
-
5
- <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social_main.php'; ?>
6
-
7
- <div style="text-align: center; color: #888; margin-top: 20px;"><?php echo $theme_options['main_footer_legal'] ?></div>
 
 
 
8
  <div style="text-align: center; color: #888">To change your subscription, <a target="_blank" href="{profile_url}">click here</a>.</div>
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?>
4
+ <!-- Footer -->
5
+ <div style="text-align: center; font-weight: bold; margin: 40px 0 10px;"><?php echo $theme_options['main_footer_title'] ?></div>
6
+ <div style="text-align: center; margin: 10px 0 20px;"><?php echo $theme_options['main_footer_contact'] ?></div>
7
+
8
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social_main.php'; ?>
9
+
10
+ <div style="text-align: center; color: #888; margin-top: 20px;"><?php echo $theme_options['main_footer_legal'] ?></div>
11
  <div style="text-align: center; color: #888">To change your subscription, <a target="_blank" href="{profile_url}">click here</a>.</div>
emails/themes/default/social-options.php CHANGED
@@ -1,39 +1,42 @@
1
- <h3>Social icons</h3>
2
- <table class="form-table">
3
- <tr>
4
- <th>Social block</th>
5
- <td><?php $controls->checkbox('theme_social_disable'); ?> Disable</td>
6
- </tr>
7
- <tr>
8
- <th>Facebook</th>
9
- <td><?php $controls->text_url('theme_facebook', 30); ?></td>
10
- </tr>
11
- <tr>
12
- <th>Twitter</th>
13
- <td><?php $controls->text_url('theme_twitter', 30); ?></td>
14
- </tr>
15
- <tr>
16
- <th>Pinterest</th>
17
- <td><?php $controls->text_url('theme_pinterest', 30); ?></td>
18
- </tr>
19
- <tr>
20
- <th>Google+</th>
21
- <td><?php $controls->text_url('theme_googleplus', 30); ?></td>
22
- </tr>
23
- <tr>
24
- <th>LinkedIn</th>
25
- <td><?php $controls->text_url('theme_linkedin', 30); ?></td>
26
- </tr>
27
- <tr>
28
- <th>Tumblr</th>
29
- <td><?php $controls->text_url('theme_tumblr', 30); ?></td>
30
- </tr>
31
- <tr>
32
- <th>YouTube</th>
33
- <td><?php $controls->text_url('theme_youtube', 30); ?></td>
34
- </tr>
35
- <tr>
36
- <th>Soundcloud</th>
37
- <td><?php $controls->text_url('theme_soundcloud', 30); ?></td>
38
- </tr>
 
 
 
39
  </table>
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?>
4
+ <h3>Social icons</h3>
5
+ <table class="form-table">
6
+ <tr>
7
+ <th>Social block</th>
8
+ <td><?php $controls->checkbox('theme_social_disable'); ?> Disable</td>
9
+ </tr>
10
+ <tr>
11
+ <th>Facebook</th>
12
+ <td><?php $controls->text_url('theme_facebook', 30); ?></td>
13
+ </tr>
14
+ <tr>
15
+ <th>Twitter</th>
16
+ <td><?php $controls->text_url('theme_twitter', 30); ?></td>
17
+ </tr>
18
+ <tr>
19
+ <th>Pinterest</th>
20
+ <td><?php $controls->text_url('theme_pinterest', 30); ?></td>
21
+ </tr>
22
+ <tr>
23
+ <th>Google+</th>
24
+ <td><?php $controls->text_url('theme_googleplus', 30); ?></td>
25
+ </tr>
26
+ <tr>
27
+ <th>LinkedIn</th>
28
+ <td><?php $controls->text_url('theme_linkedin', 30); ?></td>
29
+ </tr>
30
+ <tr>
31
+ <th>Tumblr</th>
32
+ <td><?php $controls->text_url('theme_tumblr', 30); ?></td>
33
+ </tr>
34
+ <tr>
35
+ <th>YouTube</th>
36
+ <td><?php $controls->text_url('theme_youtube', 30); ?></td>
37
+ </tr>
38
+ <tr>
39
+ <th>Soundcloud</th>
40
+ <td><?php $controls->text_url('theme_soundcloud', 30); ?></td>
41
+ </tr>
42
  </table>
emails/themes/default/social.php CHANGED
@@ -1,56 +1,58 @@
1
- <!-- Social -->
2
- <?php
3
- if (isset($theme_options['theme_social_disable'])) return;
4
- $social_icon_url = plugins_url('newsletter') . '/emails/themes/default/images';
5
- ?>
6
- <table cellpadding="5" align="center">
7
- <tr>
8
- <?php if (!empty($theme_options['theme_facebook'])) { ?>
9
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
10
- <a href="<?php echo $theme_options['theme_facebook'] ?>"><img src="<?php echo $social_icon_url ?>/facebook.png"><br>Facebook</a>
11
- </td>
12
- <?php } ?>
13
-
14
- <?php if (!empty($theme_options['theme_twitter'])) { ?>
15
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
16
- <a href="<?php echo $theme_options['theme_twitter'] ?>"><img src="<?php echo $social_icon_url ?>/twitter.png"><br>Twitter</a>
17
- </td>
18
- <?php } ?>
19
-
20
- <?php if (!empty($theme_options['theme_googleplus'])) { ?>
21
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
22
- <a href="<?php echo $theme_options['theme_googleplus'] ?>"><img src="<?php echo $social_icon_url ?>/googleplus.png"><br>Google+</a>
23
- </td>
24
- <?php } ?>
25
-
26
- <?php if (!empty($theme_options['theme_pinterest'])) { ?>
27
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
28
- <a href="<?php echo $theme_options['theme_pinterest'] ?>"><img src="<?php echo $social_icon_url ?>/pinterest.png"><br>Pinterest</a>
29
- </td>
30
- <?php } ?>
31
-
32
- <?php if (!empty($theme_options['theme_linkedin'])) { ?>
33
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
34
- <a href="<?php echo $theme_options['theme_linkedin'] ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png"><br>LinkedIn</a>
35
- </td>
36
- <?php } ?>
37
-
38
- <?php if (!empty($theme_options['theme_tumblr'])) { ?>
39
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
40
- <a href="<?php echo $theme_options['theme_tumblr'] ?>"><img src="<?php echo $social_icon_url ?>/tumblr.png"><br>Tumblr</a>
41
- </td>
42
- <?php } ?>
43
-
44
- <?php if (!empty($theme_options['theme_youtube'])) { ?>
45
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
46
- <a href="<?php echo $theme_options['theme_youtube'] ?>"><img src="<?php echo $social_icon_url ?>/youtube.png"><br>Youtube</a>
47
- </td>
48
- <?php } ?>
49
-
50
- <?php if (!empty($theme_options['theme_soundcloud'])) { ?>
51
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
52
- <a href="<?php echo $theme_options['theme_soundcloud'] ?>"><img src="<?php echo $social_icon_url ?>/soundcloud.png"><br>SoundCloud</a>
53
- </td>
54
- <?php } ?>
55
- </tr>
 
 
56
  </table>
1
+ <!-- Social -->
2
+ <?php
3
+ if (!defined('ABSPATH')) exit;
4
+
5
+ if (isset($theme_options['theme_social_disable'])) return;
6
+ $social_icon_url = plugins_url('newsletter') . '/emails/themes/default/images';
7
+ ?>
8
+ <table cellpadding="5" align="center">
9
+ <tr>
10
+ <?php if (!empty($theme_options['theme_facebook'])) { ?>
11
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
12
+ <a href="<?php echo esc_attr($theme_options['theme_facebook']) ?>"><img src="<?php echo $social_icon_url ?>/facebook.png"><br>Facebook</a>
13
+ </td>
14
+ <?php } ?>
15
+
16
+ <?php if (!empty($theme_options['theme_twitter'])) { ?>
17
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
18
+ <a href="<?php echo esc_attr($theme_options['theme_twitter']) ?>"><img src="<?php echo $social_icon_url ?>/twitter.png"><br>Twitter</a>
19
+ </td>
20
+ <?php } ?>
21
+
22
+ <?php if (!empty($theme_options['theme_googleplus'])) { ?>
23
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
24
+ <a href="<?php echo esc_attr($theme_options['theme_googleplus']) ?>"><img src="<?php echo $social_icon_url ?>/googleplus.png"><br>Google+</a>
25
+ </td>
26
+ <?php } ?>
27
+
28
+ <?php if (!empty($theme_options['theme_pinterest'])) { ?>
29
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
30
+ <a href="<?php echo esc_attr($theme_options['theme_pinterest']) ?>"><img src="<?php echo $social_icon_url ?>/pinterest.png"><br>Pinterest</a>
31
+ </td>
32
+ <?php } ?>
33
+
34
+ <?php if (!empty($theme_options['theme_linkedin'])) { ?>
35
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
36
+ <a href="<?php echo esc_attr($theme_options['theme_linkedin']) ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png"><br>LinkedIn</a>
37
+ </td>
38
+ <?php } ?>
39
+
40
+ <?php if (!empty($theme_options['theme_tumblr'])) { ?>
41
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
42
+ <a href="<?php echo esc_attr($theme_options['theme_tumblr']) ?>"><img src="<?php echo $social_icon_url ?>/tumblr.png"><br>Tumblr</a>
43
+ </td>
44
+ <?php } ?>
45
+
46
+ <?php if (!empty($theme_options['theme_youtube'])) { ?>
47
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
48
+ <a href="<?php echo esc_attr($theme_options['theme_youtube']) ?>"><img src="<?php echo $social_icon_url ?>/youtube.png"><br>Youtube</a>
49
+ </td>
50
+ <?php } ?>
51
+
52
+ <?php if (!empty($theme_options['theme_soundcloud'])) { ?>
53
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
54
+ <a href="<?php echo esc_attr($theme_options['theme_soundcloud']) ?>"><img src="<?php echo $social_icon_url ?>/soundcloud.png"><br>SoundCloud</a>
55
+ </td>
56
+ <?php } ?>
57
+ </tr>
58
  </table>
emails/themes/default/social_main.php CHANGED
@@ -1,44 +1,46 @@
1
- <!-- Social -->
2
- <?php
3
- if (isset($theme_options['theme_social_disable'])) return;
4
- $social_icon_url = plugins_url('newsletter') . '/emails/themes/default/images';
5
- ?>
6
- <table cellpadding="5" align="center">
7
- <tr>
8
- <?php if (!empty($theme_options['main_facebook_url'])) { ?>
9
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
10
- <a href="<?php echo $theme_options['main_facebook_url'] ?>"><img src="<?php echo $social_icon_url ?>/facebook.png" alt="Facebook"></a>
11
- </td>
12
- <?php } ?>
13
-
14
- <?php if (!empty($theme_options['main_googleplus_url'])) { ?>
15
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
16
- <a href="<?php echo $theme_options['main_googleplus_url'] ?>"><img src="<?php echo $social_icon_url ?>/googleplus.png"></a>
17
- </td>
18
- <?php } ?>
19
-
20
- <?php if (!empty($theme_options['main_twitter_url'])) { ?>
21
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
22
- <a href="<?php echo $theme_options['main_twitter_url'] ?>"><img src="<?php echo $social_icon_url ?>/twitter.png"></a>
23
- </td>
24
- <?php } ?>
25
-
26
- <?php if (!empty($theme_options['main_linkedin_url'])) { ?>
27
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
28
- <a href="<?php echo $theme_options['main_linkedin_url'] ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png"></a>
29
- </td>
30
- <?php } ?>
31
-
32
- <?php if (!empty($theme_options['main_youtube_url'])) { ?>
33
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
34
- <a href="<?php echo $theme_options['main_youtube_url'] ?>"><img src="<?php echo $social_icon_url ?>/youtube.png"></a>
35
- </td>
36
- <?php } ?>
37
-
38
- <?php if (!empty($theme_options['main_vimeo_url'])) { ?>
39
- <td style="text-align: center; vertical-align: top" align="center" valign="top">
40
- <a href="<?php echo $theme_options['main_vimeo_url'] ?>"><img src="<?php echo $social_icon_url ?>/vimeo.png"></a>
41
- </td>
42
- <?php } ?>
43
- </tr>
 
 
44
  </table>
1
+ <!-- Social -->
2
+ <?php
3
+ if (!defined('ABSPATH')) exit;
4
+
5
+ if (isset($theme_options['theme_social_disable'])) return;
6
+ $social_icon_url = plugins_url('newsletter') . '/emails/themes/default/images';
7
+ ?>
8
+ <table cellpadding="5" align="center">
9
+ <tr>
10
+ <?php if (!empty($theme_options['main_facebook_url'])) { ?>
11
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
12
+ <a href="<?php echo esc_attr($theme_options['main_facebook_url']) ?>"><img src="<?php echo $social_icon_url ?>/facebook.png" alt="Facebook"></a>
13
+ </td>
14
+ <?php } ?>
15
+
16
+ <?php if (!empty($theme_options['main_googleplus_url'])) { ?>
17
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
18
+ <a href="<?php echo esc_attr($theme_options['main_googleplus_url']) ?>"><img src="<?php echo $social_icon_url ?>/googleplus.png"></a>
19
+ </td>
20
+ <?php } ?>
21
+
22
+ <?php if (!empty($theme_options['main_twitter_url'])) { ?>
23
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
24
+ <a href="<?php echo esc_attr($theme_options['main_twitter_url']) ?>"><img src="<?php echo $social_icon_url ?>/twitter.png"></a>
25
+ </td>
26
+ <?php } ?>
27
+
28
+ <?php if (!empty($theme_options['main_linkedin_url'])) { ?>
29
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
30
+ <a href="<?php echo esc_attr($theme_options['main_linkedin_url']) ?>"><img src="<?php echo $social_icon_url ?>/linkedin.png"></a>
31
+ </td>
32
+ <?php } ?>
33
+
34
+ <?php if (!empty($theme_options['main_youtube_url'])) { ?>
35
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
36
+ <a href="<?php echo esc_attr($theme_options['main_youtube_url']) ?>"><img src="<?php echo $social_icon_url ?>/youtube.png"></a>
37
+ </td>
38
+ <?php } ?>
39
+
40
+ <?php if (!empty($theme_options['main_vimeo_url'])) { ?>
41
+ <td style="text-align: center; vertical-align: top" align="center" valign="top">
42
+ <a href="<?php echo esc_attr($theme_options['main_vimeo_url']) ?>"><img src="<?php echo $social_icon_url ?>/vimeo.png"></a>
43
+ </td>
44
+ <?php } ?>
45
+ </tr>
46
  </table>
emails/themes/default/theme-options.php CHANGED
@@ -1,78 +1,60 @@
1
- <!--<div id="tabs">
2
- <ul>
3
- <li><a href="#tab-general">General</a></li>
4
- <li><a href="#tab-posts">Posts</a></li>
5
- </ul>
6
-
7
- <div id="tab-general">-->
8
- <table class="form-table">
9
- <tr><td colspan="2">General options for header, social links and footer sections could also be set in <a href="?page=newsletter_main_main">Blog Info panel</a>.</td></tr>
10
- <tr>
11
- <th>Base color</th>
12
- <td>
13
- <?php $controls->color('theme_color'); ?>
14
- <p class="description" style="display: inline">Hex values, e.g. #FF0000</p>
15
- </td>
16
- </tr>
17
- <tr>
18
- <th>Disable social links</th>
19
- <td><?php $controls->checkbox('theme_social_disable', ''); ?></td>
20
- </tr>
21
- <!-- <tr>
22
- <th>Banner/Title</th>
23
- <td>
24
- <?php //$controls->wp_editor('theme_banner'); ?>
25
- <div class="hints">
26
- Create a content with an image (500 pixel wide) that will be your newsletter banner and that will replace the
27
- title with your blog name.
28
- </div>
29
- <?php $controls->media('theme_header_logo', 'full'); ?>
30
- <p class="description">
31
- Click to change. This should be your logo in .png or .jpg format.
32
- </p>
33
- </td>
34
- </tr>-->
35
- </table>
36
- <h3>Posts</h3>
37
- <table class="form-table">
38
- <tr>
39
- <th>Posts</th>
40
- <td>
41
- <?php $controls->checkbox('theme_posts', 'Add latest posts'); ?>
42
- <br>
43
- <?php $controls->checkbox('theme_thumbnails', 'Add post thumbnails'); ?>
44
- <br>
45
- <?php $controls->checkbox('theme_excerpts', 'Add post excerpts'); ?>
46
- </td>
47
- </tr>
48
- <tr>
49
- <th>Categories</th>
50
- <td>
51
- <?php $controls->categories_group('theme_categories'); ?>
52
- </td>
53
- </tr>
54
- <tr>
55
- <th>Tags</th>
56
- <td>
57
- <?php $controls->text('theme_tags', 30); ?>
58
- <p class="description" style="display: inline"> comma separated</p>
59
- </td>
60
- </tr>
61
- <tr>
62
- <th>Max posts</th>
63
- <td>
64
- <?php $controls->text('theme_max_posts', 5); ?>
65
- </td>
66
- </tr>
67
- <tr>
68
- <th>Post types to include</th>
69
- <td>
70
- <?php $controls->post_types('theme_post_types'); ?>
71
- <div class="hints">Leave all unchecked for default behaviour.</div>
72
- </td>
73
- </tr>
74
- </table>
75
- <!--</div>-->
76
- <!--<div id="tab-posts">-->
77
- <!--</div>-->
78
- <!--</div>-->
1
+ <?php
2
+ if (!defined('ABSPATH'))
3
+ exit;
4
+ ?>
5
+
6
+ <table class="form-table">
7
+ <tr><td colspan="2">General options for header, social links and footer sections could also be set in <a href="?page=newsletter_main_main">Blog Info panel</a>.</td></tr>
8
+ <tr>
9
+ <th>Base color</th>
10
+ <td>
11
+ <?php $controls->color('theme_color'); ?>
12
+ <p class="description" style="display: inline">Hex values, e.g. #FF0000</p>
13
+ </td>
14
+ </tr>
15
+ <tr>
16
+ <th>Disable social links</th>
17
+ <td><?php $controls->checkbox('theme_social_disable', ''); ?></td>
18
+ </tr>
19
+
20
+ </table>
21
+
22
+ <h3>Posts</h3>
23
+ <table class="form-table">
24
+ <tr>
25
+ <th>Posts</th>
26
+ <td>
27
+ <?php $controls->checkbox('theme_posts', 'Add latest posts'); ?>
28
+ <br>
29
+ <?php $controls->checkbox('theme_thumbnails', 'Add post thumbnails'); ?>
30
+ <br>
31
+ <?php $controls->checkbox('theme_excerpts', 'Add post excerpts'); ?>
32
+ </td>
33
+ </tr>
34
+ <tr>
35
+ <th>Categories</th>
36
+ <td>
37
+ <?php $controls->categories_group('theme_categories'); ?>
38
+ </td>
39
+ </tr>
40
+ <tr>
41
+ <th>Tags</th>
42
+ <td>
43
+ <?php $controls->text('theme_tags', 30); ?>
44
+ <p class="description" style="display: inline"> comma separated</p>
45
+ </td>
46
+ </tr>
47
+ <tr>
48
+ <th>Max posts</th>
49
+ <td>
50
+ <?php $controls->text('theme_max_posts', 5); ?>
51
+ </td>
52
+ </tr>
53
+ <tr>
54
+ <th>Post types to include</th>
55
+ <td>
56
+ <?php $controls->post_types('theme_post_types'); ?>
57
+ <div class="hints">Leave all unchecked for default behaviour.</div>
58
+ </td>
59
+ </tr>
60
+ </table>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
emails/themes/default/theme-text.php CHANGED
@@ -1,4 +1,6 @@
1
- This email requires a modern e-mail reader but you can view the email online here:
 
 
2
 
3
  {email_url}.
4
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?>This email requires a modern e-mail reader but you can view the email online here:
4
 
5
  {email_url}.
6
 
emails/themes/default/theme.php CHANGED
@@ -12,6 +12,8 @@
12
 
13
  global $newsletter, $post;
14
 
 
 
15
  $color = $theme_options['theme_color'];
16
  if (empty($color)) $color = '#000000';
17
 
@@ -58,9 +60,9 @@ if (isset($theme_options['theme_posts'])) {
58
  // if (!empty($theme_options['theme_banner'])) {
59
  // echo $theme_options['theme_banner'];
60
  if (!empty($theme_options['theme_header_logo']['url'])) { ?>
61
- <img style="max-width: 500px" alt="<?php echo $theme_options['main_header_title'] ?>" src="<?php echo $theme_options['theme_header_logo']['url'] ?>" />
62
  <?php } elseif (!empty($theme_options['main_header_logo']['url'])) { ?>
63
- <img style="max-width: 500px" alt="<?php echo $theme_options['main_header_title'] ?>" src="<?php echo $theme_options['main_header_logo']['url'] ?>" />
64
  <?php } elseif (!empty($theme_options['main_header_title'])) { ?>
65
  <div style="padding: 30px 0; color: #000; font-size: 28px; background-color: #EFEFEF; border-bottom: 1px solid #ddd; text-align: center;">
66
  <?php echo $theme_options['main_header_title'] ?>
12
 
13
  global $newsletter, $post;
14
 
15
+ if (!defined('ABSPATH')) exit;
16
+
17
  $color = $theme_options['theme_color'];
18
  if (empty($color)) $color = '#000000';
19
 
60
  // if (!empty($theme_options['theme_banner'])) {
61
  // echo $theme_options['theme_banner'];
62
  if (!empty($theme_options['theme_header_logo']['url'])) { ?>
63
+ <img style="max-width: 500px" alt="<?php echo esc_attr($theme_options['main_header_title']) ?>" src="<?php echo esc_attr($theme_options['theme_header_logo']['url']) ?>">
64
  <?php } elseif (!empty($theme_options['main_header_logo']['url'])) { ?>
65
+ <img style="max-width: 500px" alt="<?php echo esc_attr($theme_options['main_header_title']) ?>" src="<?php echo esc_attr($theme_options['main_header_logo']['url']) ?>">
66
  <?php } elseif (!empty($theme_options['main_header_title'])) { ?>
67
  <div style="padding: 30px 0; color: #000; font-size: 28px; background-color: #EFEFEF; border-bottom: 1px solid #ddd; text-align: center;">
68
  <?php echo $theme_options['main_header_title'] ?>
emails/themes/linear/theme-options.php CHANGED
@@ -1,18 +1,22 @@
1
- <table class="form-table">
2
- <tr>
3
- <th>Max posts</th>
4
- <td><?php $controls->text('theme_max_posts', 5); ?></td>
5
- </tr>
6
- <tr>
7
- <th>Categories</th>
8
- <td><?php $controls->categories_group('theme_categories'); ?></td>
9
- </tr>
10
- <tr>
11
- <th>Post types</th>
12
- <td>
13
- <?php $controls->post_types('theme_post_types'); ?>
14
- <p class="description">Leave all uncheck for a default behavior.</p>
15
- </td>
16
- </tr>
17
- </table>
 
 
 
 
18
  <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
1
+ <?php
2
+ if (!defined('ABSPATH'))
3
+ exit;
4
+ ?>
5
+ <table class="form-table">
6
+ <tr>
7
+ <th>Max posts</th>
8
+ <td><?php $controls->text('theme_max_posts', 5); ?></td>
9
+ </tr>
10
+ <tr>
11
+ <th>Categories</th>
12
+ <td><?php $controls->categories_group('theme_categories'); ?></td>
13
+ </tr>
14
+ <tr>
15
+ <th>Post types</th>
16
+ <td>
17
+ <?php $controls->post_types('theme_post_types'); ?>
18
+ <p class="description">Leave all uncheck for a default behavior.</p>
19
+ </td>
20
+ </tr>
21
+ </table>
22
  <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
emails/themes/linear/theme-text.php CHANGED
@@ -1,4 +1,7 @@
1
- This email requires a modern e-mail reader but you can view the email online here:
 
 
 
2
 
3
  {email_url}.
4
 
1
+ <?php
2
+ if (!defined('ABSPATH'))
3
+ exit;
4
+ ?>This email requires a modern e-mail reader but you can view the email online here:
5
 
6
  {email_url}.
7
 
emails/themes/linear/theme.php CHANGED
@@ -1,6 +1,9 @@
1
  <?php
2
  global $post;
3
 
 
 
 
4
  $filters = array();
5
  if (!empty($theme_options['theme_categories'])) {
6
  $filters['category__in'] = $theme_options['theme_categories'];
1
  <?php
2
  global $post;
3
 
4
+ if (!defined('ABSPATH'))
5
+ exit;
6
+
7
  $filters = array();
8
  if (!empty($theme_options['theme_categories'])) {
9
  $filters['category__in'] = $theme_options['theme_categories'];
emails/themes/pint/theme-options.php CHANGED
@@ -1,15 +1,19 @@
1
- <p>
2
- This theme requires posts with at least one image and a number of posts like
3
- 3, 6, 9, ...
4
- </p>
5
- <table class="form-table">
6
- <tr>
7
- <th>Max posts</th>
8
- <td><?php $controls->text('theme_max_posts', 5); ?></td>
9
- </tr>
10
- <tr>
11
- <th>Categories</th>
12
- <td><?php $controls->categories_group('theme_categories'); ?></td>
13
- </tr>
14
- </table>
 
 
 
 
15
  <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
1
+ <?php
2
+ if (!defined('ABSPATH'))
3
+ exit;
4
+ ?>
5
+ <p>
6
+ This theme requires posts with at least one image and a number of posts like
7
+ 3, 6, 9, ...
8
+ </p>
9
+ <table class="form-table">
10
+ <tr>
11
+ <th>Max posts</th>
12
+ <td><?php $controls->text('theme_max_posts', 5); ?></td>
13
+ </tr>
14
+ <tr>
15
+ <th>Categories</th>
16
+ <td><?php $controls->categories_group('theme_categories'); ?></td>
17
+ </tr>
18
+ </table>
19
  <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
emails/themes/pint/theme-text.php CHANGED
@@ -1,4 +1,7 @@
1
- This email requires a modern e-mail reader but you can view the email online here:
 
 
 
2
 
3
  {email_url}.
4
 
1
+ <?php
2
+ if (!defined('ABSPATH'))
3
+ exit;
4
+ ?>This email requires a modern e-mail reader but you can view the email online here:
5
 
6
  {email_url}.
7
 
emails/themes/pint/theme.php CHANGED
@@ -10,6 +10,8 @@
10
 
11
  global $newsletter, $post;
12
 
 
 
13
  $filters = array();
14
  if (!empty($theme_options['theme_categories'])) {
15
  $filters['category__in'] = $theme_options['theme_categories'];
10
 
11
  global $newsletter, $post;
12
 
13
+ if (!defined('ABSPATH')) exit;
14
+
15
  $filters = array();
16
  if (!empty($theme_options['theme_categories'])) {
17
  $filters['category__in'] = $theme_options['theme_categories'];
emails/themes/simple/theme-text.php CHANGED
@@ -1,4 +1,7 @@
1
- This email requires a modern e-mail reader but you can view the email online here:
 
 
 
2
 
3
  {email_url}.
4
 
1
+ <?php
2
+ if (!defined('ABSPATH'))
3
+ exit;
4
+ ?>This email requires a modern e-mail reader but you can view the email online here:
5
 
6
  {email_url}.
7
 
emails/themes/simple/theme.php CHANGED
@@ -10,6 +10,9 @@
10
 
11
  global $newsletter, $post;
12
 
 
 
 
13
  $color = $theme_options['theme_color'];
14
  if (empty($color))
15
  $color = '#0088cc';
10
 
11
  global $newsletter, $post;
12
 
13
+ if (!defined('ABSPATH'))
14
+ exit;
15
+
16
  $color = $theme_options['theme_color'];
17
  if (empty($color))
18
  $color = '#0088cc';
emails/themes/theme-1/theme-options.php CHANGED
@@ -1,42 +1,46 @@
1
- <?php
2
- /*
3
- * This is a pre packaged theme options page. Every option name
4
- * must start with "theme_" so Newsletter can distinguish them from other
5
- * options that are specific to the object using the theme.
6
- *
7
- * An array of theme default options should always be present and that default options
8
- * should be merged with the current complete set of options as shown below.
9
- *
10
- * Every theme can define its own set of options, the will be used in the theme.php
11
- * file while composing the email body. Newsletter knows nothing about theme options
12
- * (other than saving them) and does not use or relies on any of them.
13
- *
14
- * For multilanguage purpose you can actually check the constants "WP_LANG", until
15
- * a decent system will be implemented.
16
- */
17
- $theme_defaults = array(
18
- 'theme_max_posts'=>10,
19
- 'theme_categories'=>array()
20
- );
21
-
22
- // Mandatory!
23
- $controls->merge_defaults($theme_defaults);
24
- ?>
25
-
26
- <table class="form-table">
27
- <tr valign="top">
28
- <th>Max new posts to include</th>
29
- <td>
30
- <?php $controls->text('theme_max_posts', 5); ?> (it defaults to 10 if empty or invalid)
31
- </td>
32
- </tr>
33
- <tr valign="top">
34
- <th>Categories</th>
35
- <td>
36
- <?php $controls->categories_group('theme_categories'); ?>
37
- </td>
38
- </tr>
39
- </table>
40
-
41
- <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
42
-
 
 
 
 
1
+ <?php
2
+ /*
3
+ * This is a pre packaged theme options page. Every option name
4
+ * must start with "theme_" so Newsletter can distinguish them from other
5
+ * options that are specific to the object using the theme.
6
+ *
7
+ * An array of theme default options should always be present and that default options
8
+ * should be merged with the current complete set of options as shown below.
9
+ *
10
+ * Every theme can define its own set of options, the will be used in the theme.php
11
+ * file while composing the email body. Newsletter knows nothing about theme options
12
+ * (other than saving them) and does not use or relies on any of them.
13
+ *
14
+ * For multilanguage purpose you can actually check the constants "WP_LANG", until
15
+ * a decent system will be implemented.
16
+ */
17
+
18
+ if (!defined('ABSPATH'))
19
+ exit;
20
+
21
+ $theme_defaults = array(
22
+ 'theme_max_posts'=>10,
23
+ 'theme_categories'=>array()
24
+ );
25
+
26
+ // Mandatory!
27
+ $controls->merge_defaults($theme_defaults);
28
+ ?>
29
+
30
+ <table class="form-table">
31
+ <tr valign="top">
32
+ <th>Max new posts to include</th>
33
+ <td>
34
+ <?php $controls->text('theme_max_posts', 5); ?> (it defaults to 10 if empty or invalid)
35
+ </td>
36
+ </tr>
37
+ <tr valign="top">
38
+ <th>Categories</th>
39
+ <td>
40
+ <?php $controls->categories_group('theme_categories'); ?>
41
+ </td>
42
+ </tr>
43
+ </table>
44
+
45
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
46
+
emails/themes/theme-1/theme-text.php CHANGED
@@ -2,6 +2,9 @@
2
  global $newsletter; // Newsletter object
3
  global $post; // Current post managed by WordPress
4
 
 
 
 
5
  // This file is included inside a function so it inherit all the local variables.
6
 
7
  // Since a theme has it's own options, it must check if there is new content to send
2
  global $newsletter; // Newsletter object
3
  global $post; // Current post managed by WordPress
4
 
5
+ if (!defined('ABSPATH'))
6
+ exit;
7
+
8
  // This file is included inside a function so it inherit all the local variables.
9
 
10
  // Since a theme has it's own options, it must check if there is new content to send
emails/themes/theme-1/theme.php CHANGED
@@ -2,6 +2,9 @@
2
  global $newsletter; // Newsletter object
3
  global $post; // Current post managed by WordPress
4
 
 
 
 
5
  /*
6
  * Some variabled are prepared by Newsletter Plus and are available inside the theme,
7
  * for example the theme options used to build the email body as configured by blog
2
  global $newsletter; // Newsletter object
3
  global $post; // Current post managed by WordPress
4
 
5
+ if (!defined('ABSPATH'))
6
+ exit;
7
+
8
  /*
9
  * Some variabled are prepared by Newsletter Plus and are available inside the theme,
10
  * for example the theme options used to build the email body as configured by blog
emails/themes/theme-3/theme-options.php CHANGED
@@ -1,43 +1,47 @@
1
- <?php
2
- /*
3
- * This is a pre packaged theme options page. Every option name
4
- * must start with "theme_" so Newsletter can distinguish them from other
5
- * options that are specific to the object using the theme.
6
- *
7
- * An array of theme default options should always be present and that default options
8
- * should be merged with the current complete set of options as shown below.
9
- *
10
- * Every theme can define its own set of options, the will be used in the theme.php
11
- * file while composing the email body. Newsletter knows nothing about theme options
12
- * (other than saving them) and does not use or relies on any of them.
13
- *
14
- * For multilanguage purpose you can actually check the constants "WP_LANG", until
15
- * a decent system will be implemented.
16
- */
17
- $theme_defaults = array(
18
- 'theme_max_posts'=>10,
19
-
20
- 'theme_categories'=>array()
21
- );
22
-
23
- // Mandatory!
24
- $controls->merge_defaults($theme_defaults);
25
- ?>
26
- <p>This theme build an email loading all new posts after the date of the last run.</p>
27
- <table class="form-table">
28
- <tr valign="top">
29
- <th>Max new posts to include</th>
30
- <td>
31
- <?php $controls->text('theme_max_posts', 5); ?> (it defaults to 10 if empty or invalid)
32
- </td>
33
- </tr>
34
- <tr valign="top">
35
- <th>Categories</th>
36
- <td>
37
- <?php $controls->categories_group('theme_categories'); ?>
38
- </td>
39
- </tr>
40
- </table>
41
-
42
- <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
43
-
 
 
 
 
1
+ <?php
2
+ /*
3
+ * This is a pre packaged theme options page. Every option name
4
+ * must start with "theme_" so Newsletter can distinguish them from other
5
+ * options that are specific to the object using the theme.
6
+ *
7
+ * An array of theme default options should always be present and that default options
8
+ * should be merged with the current complete set of options as shown below.
9
+ *
10
+ * Every theme can define its own set of options, the will be used in the theme.php
11
+ * file while composing the email body. Newsletter knows nothing about theme options
12
+ * (other than saving them) and does not use or relies on any of them.
13
+ *
14
+ * For multilanguage purpose you can actually check the constants "WP_LANG", until
15
+ * a decent system will be implemented.
16
+ */
17
+
18
+ if (!defined('ABSPATH'))
19
+ exit;
20
+
21
+ $theme_defaults = array(
22
+ 'theme_max_posts'=>10,
23
+
24
+ 'theme_categories'=>array()
25
+ );
26
+
27
+ // Mandatory!
28
+ $controls->merge_defaults($theme_defaults);
29
+ ?>
30
+ <p>This theme build an email loading all new posts after the date of the last run.</p>
31
+ <table class="form-table">
32
+ <tr valign="top">
33
+ <th>Max new posts to include</th>
34
+ <td>
35
+ <?php $controls->text('theme_max_posts', 5); ?> (it defaults to 10 if empty or invalid)
36
+ </td>
37
+ </tr>
38
+ <tr valign="top">
39
+ <th>Categories</th>
40
+ <td>
41
+ <?php $controls->categories_group('theme_categories'); ?>
42
+ </td>
43
+ </tr>
44
+ </table>
45
+
46
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
47
+
emails/themes/theme-3/theme-text.php CHANGED
@@ -2,6 +2,9 @@
2
  global $newsletter; // Newsletter object
3
  global $post; // Current post managed by WordPress
4
 
 
 
 
5
  // This file is included inside a function so it inherit all the local variables.
6
 
7
  // Since a theme has it's own options, it must check if there is new content to send
2
  global $newsletter; // Newsletter object
3
  global $post; // Current post managed by WordPress
4
 
5
+ if (!defined('ABSPATH'))
6
+ exit;
7
+
8
  // This file is included inside a function so it inherit all the local variables.
9
 
10
  // Since a theme has it's own options, it must check if there is new content to send
emails/themes/theme-3/theme.php CHANGED
@@ -2,6 +2,9 @@
2
  global $newsletter; // Newsletter object
3
  global $post; // Current post managed by WordPress
4
 
 
 
 
5
  /*
6
  * Some variabled are prepared by Newsletter Plus and are available inside the theme,
7
  * for example the theme options used to build the email body as configured by blog
2
  global $newsletter; // Newsletter object
3
  global $post; // Current post managed by WordPress
4
 
5
+ if (!defined('ABSPATH'))
6
+ exit;
7
+
8
  /*
9
  * Some variabled are prepared by Newsletter Plus and are available inside the theme,
10
  * for example the theme options used to build the email body as configured by blog
emails/themes/vimeo-like/theme-options.php CHANGED
@@ -1,60 +1,64 @@
1
- <?php
2
- /*
3
- * This is a pre packaged theme options page. Every option name
4
- * must start with "theme_" so Newsletter can distinguish them from other
5
- * options that are specific to the object using the theme.
6
- *
7
- * An array of theme default options should always be present and that default options
8
- * should be merged with the current complete set of options as shown below.
9
- *
10
- * Every theme can define its own set of options, the will be used in the theme.php
11
- * file while composing the email body. Newsletter knows nothing about theme options
12
- * (other than saving them) and does not use or relies on any of them.
13
- *
14
- * For multilanguage purpose you can actually check the constants "WP_LANG", until
15
- * a decent system will be implemented.
16
- */
17
- $theme_defaults = array(
18
- 'theme_max_posts'=>5,
19
- 'theme_read_more'=>'Read More',
20
- 'theme_pre_message'=>'This email has been sent to {email} because subscribed and confirmed on ' . get_option('blogname') . '. <a href="{profile_url}">Click here to modify you subscription or unsubscribe</a>.',
21
- 'theme_categories'=>array()
22
- );
23
-
24
- // Mandatory!
25
- $controls->merge_defaults($theme_defaults);
26
- ?>
27
-
28
- <table class="form-table">
29
- <tr valign="top">
30
- <th>Max new posts to include</th>
31
- <td>
32
- <?php $controls->text('theme_max_posts', 5); ?> (it defaults to 10 if empty or invalid)
33
- </td>
34
- </tr>
35
- <tr valign="top">
36
- <th>Categories to include</th>
37
- <td><?php $controls->categories_group('theme_categories'); ?></td>
38
- </tr>
39
- <tr>
40
- <th>Post types</th>
41
- <td>
42
- <?php $controls->post_types('theme_post_types'); ?>
43
- <p class="description">Leave all uncheck for a default behavior.</p>
44
- </td>
45
- </tr>
46
- <tr valign="top">
47
- <th>Pre message</th>
48
- <td>
49
- <?php $controls->text('theme_pre_message', 70); ?>
50
- </td>
51
- </tr>
52
- <tr valign="top">
53
- <th>Read more label</th>
54
- <td>
55
- <?php $controls->text('theme_read_more'); ?>
56
- </td>
57
- </tr>
58
- </table>
59
-
60
- <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
 
 
 
 
1
+ <?php
2
+ /*
3
+ * This is a pre packaged theme options page. Every option name
4
+ * must start with "theme_" so Newsletter can distinguish them from other
5
+ * options that are specific to the object using the theme.
6
+ *
7
+ * An array of theme default options should always be present and that default options
8
+ * should be merged with the current complete set of options as shown below.
9
+ *
10
+ * Every theme can define its own set of options, the will be used in the theme.php
11
+ * file while composing the email body. Newsletter knows nothing about theme options
12
+ * (other than saving them) and does not use or relies on any of them.
13
+ *
14
+ * For multilanguage purpose you can actually check the constants "WP_LANG", until
15
+ * a decent system will be implemented.
16
+ */
17
+
18
+ if (!defined('ABSPATH'))
19
+ exit;
20
+
21
+ $theme_defaults = array(
22
+ 'theme_max_posts'=>5,
23
+ 'theme_read_more'=>'Read More',
24
+ 'theme_pre_message'=>'This email has been sent to {email} because subscribed and confirmed on ' . get_option('blogname') . '. <a href="{profile_url}">Click here to modify you subscription or unsubscribe</a>.',
25
+ 'theme_categories'=>array()
26
+ );
27
+
28
+ // Mandatory!
29
+ $controls->merge_defaults($theme_defaults);
30
+ ?>
31
+
32
+ <table class="form-table">
33
+ <tr valign="top">
34
+ <th>Max new posts to include</th>
35
+ <td>
36
+ <?php $controls->text('theme_max_posts', 5); ?> (it defaults to 10 if empty or invalid)
37
+ </td>
38
+ </tr>
39
+ <tr valign="top">
40
+ <th>Categories to include</th>
41
+ <td><?php $controls->categories_group('theme_categories'); ?></td>
42
+ </tr>
43
+ <tr>
44
+ <th>Post types</th>
45
+ <td>
46
+ <?php $controls->post_types('theme_post_types'); ?>
47
+ <p class="description">Leave all uncheck for a default behavior.</p>
48
+ </td>
49
+ </tr>
50
+ <tr valign="top">
51
+ <th>Pre message</th>
52
+ <td>
53
+ <?php $controls->text('theme_pre_message', 70); ?>
54
+ </td>
55
+ </tr>
56
+ <tr valign="top">
57
+ <th>Read more label</th>
58
+ <td>
59
+ <?php $controls->text('theme_read_more'); ?>
60
+ </td>
61
+ </tr>
62
+ </table>
63
+
64
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social-options.php'; ?>
emails/themes/vimeo-like/theme-text.php CHANGED
@@ -1,4 +1,7 @@
1
- This email requires a modern e-mail reader but you can view the email online here:
 
 
 
2
 
3
  {email_url}.
4
 
1
+ <?php
2
+ if (!defined('ABSPATH'))
3
+ exit;
4
+ ?>This email requires a modern e-mail reader but you can view the email online here:
5
 
6
  {email_url}.
7
 
emails/themes/vimeo-like/theme.php CHANGED
@@ -2,6 +2,9 @@
2
  global $newsletter; // Newsletter object
3
  global $post; // Current post managed by WordPress
4
 
 
 
 
5
  /*
6
  * Some variabled are prepared by Newsletter Plus and are available inside the theme,
7
  * for example the theme options used to build the email body as configured by blog
2
  global $newsletter; // Newsletter object
3
  global $post; // Current post managed by WordPress
4
 
5
+ if (!defined('ABSPATH'))
6
+ exit;
7
+
8
  /*
9
  * Some variabled are prepared by Newsletter Plus and are available inside the theme,
10
  * for example the theme options used to build the email body as configured by blog
emails/themes/xmas-2014/theme.php CHANGED
@@ -1,122 +1,125 @@
1
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2
- <html xmlns="http://www.w3.org/1999/xhtml">
3
- <head>
4
- <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
5
- <title></title>
6
-
7
- <style type="text/css">
8
- .ExternalClass {width:100%;}
9
-
10
- .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {
11
- line-height: 100%;
12
- }
13
-
14
- body {-webkit-text-size-adjust:none; -ms-text-size-adjust:none;}
15
-
16
- body {margin:0; padding:0;}
17
-
18
- table td {border-collapse:collapse;}
19
-
20
- p {margin:0; padding:0; margin-bottom:1em;}
21
-
22
- h1, h2, h3, h4, h5, h6 {
23
- color: #666;
24
- line-height: 100%;
25
- }
26
-
27
- a, a:link {
28
- color:#2A5DB0;
29
- text-decoration: underline;
30
- }
31
-
32
- body, #body_style {
33
- background:#A52B00;
34
- min-height:1000px;
35
- xcolor:#000;
36
- font-family:Arial, Helvetica, sans-serif;
37
- font-size:14px;
38
- }
39
-
40
- span.yshortcuts { color:#000; background-color:none; border:none;}
41
- span.yshortcuts:hover,
42
- span.yshortcuts:active,
43
- span.yshortcuts:focus {color:#000; background-color:none; border:none;}
44
-
45
- a:visited { color: #3c96e2; text-decoration: none}
46
- a:focus { color: #3c96e2; text-decoration: underline}
47
- a:hover { color: #3c96e2; text-decoration: underline}
48
-
49
- @media only screen and (max-device-width: 480px) {
50
-
51
-
52
- body[yahoo] #container1 {display:block !important}
53
- body[yahoo] p {font-size: 10px}
54
-
55
- }
56
-
57
- @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
58
-
59
-
60
- body[yahoo] #container1 {display:block !important}
61
- body[yahoo] p {font-size: 14px}
62
-
63
- }
64
-
65
- </style>
66
-
67
-
68
- </head>
69
- <body style="margin-top: 0; background:#A52B00; min-height:1000px; color:#000;font-family:Arial, Helvetica, sans-serif; font-size:14px"
70
- alink="#FF0000" link="#FF0000" bgcolor="#A52B00" text="#000000" yahoo="fix">
71
-
72
- <div id="body_style" style="padding:0px">
73
-
74
- <table cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff" width="600" align="center">
75
- <tr>
76
- <td width="600" colspan="3"><img src="<?php echo $theme_url; ?>/images/header.png"></td>
77
- </tr>
78
- <tr>
79
- <td width="600" align="center" colspan="3">
80
- <h1><?php echo get_option('blogname'); ?></h1>
81
- </td>
82
- </tr>
83
- <tr>
84
- <td width="20">&nbsp;</td>
85
- <td width="560">
86
- <p>Hi {name},</p>
87
-
88
- <p>The Newsletter Team wishes you merry Christmas and happy New Year. This time of year is special for us and we would like
89
- to share this time with you, also.</p>
90
-
91
- <p>We'll take a rest for few days with our families but we have a <strong>big surprise</strong> for YOU that will
92
- be unvealed the first days of the New Year.</p>
93
-
94
- <p>Curious? You can <a href="<?php echo get_option('blogname'); ?>">discover a little more right now</a>.</p>
95
-
96
- <p>
97
- See you soon, TNT.<br>
98
- <a href="<?php echo get_option('blogname'); ?>">http://www.thenewsletterplugin.com</a>
99
- </p>
100
-
101
- </td>
102
- <td width="20">&nbsp;</td>
103
- </tr>
104
- <td width="600" colspan="3">
105
- <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php'; ?>
106
- </td>
107
- <tr>
108
- <td width="20">&nbsp;</td>
109
- <td width="560" style="color:#666">
110
- <p>To change your subscription, <a target="_blank" href="{profile_url}">click here</a>.
111
- </td>
112
- <td width="20">&nbsp;</td>
113
- </tr>
114
- <tr>
115
- <td width="600" colspan="3" bgcolor="#A52B00"><img src="<?php echo $theme_url; ?>/images/footer.png"></td>
116
- </tr>
117
- </table>
118
-
119
- </div>
120
-
121
- </body>
 
 
 
122
  </html>
1
+ <?php
2
+ if (!defined('ABSPATH'))
3
+ exit;
4
+ ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
5
+ <html xmlns="http://www.w3.org/1999/xhtml">
6
+ <head>
7
+ <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
8
+ <title></title>
9
+
10
+ <style type="text/css">
11
+ .ExternalClass {width:100%;}
12
+
13
+ .ExternalClass, .ExternalClass p, .ExternalClass span, .ExternalClass font, .ExternalClass td, .ExternalClass div {
14
+ line-height: 100%;
15
+ }
16
+
17
+ body {-webkit-text-size-adjust:none; -ms-text-size-adjust:none;}
18
+
19
+ body {margin:0; padding:0;}
20
+
21
+ table td {border-collapse:collapse;}
22
+
23
+ p {margin:0; padding:0; margin-bottom:1em;}
24
+
25
+ h1, h2, h3, h4, h5, h6 {
26
+ color: #666;
27
+ line-height: 100%;
28
+ }
29
+
30
+ a, a:link {
31
+ color:#2A5DB0;
32
+ text-decoration: underline;
33
+ }
34
+
35
+ body, #body_style {
36
+ background:#A52B00;
37
+ min-height:1000px;
38
+ xcolor:#000;
39
+ font-family:Arial, Helvetica, sans-serif;
40
+ font-size:14px;
41
+ }
42
+
43
+ span.yshortcuts { color:#000; background-color:none; border:none;}
44
+ span.yshortcuts:hover,
45
+ span.yshortcuts:active,
46
+ span.yshortcuts:focus {color:#000; background-color:none; border:none;}
47
+
48
+ a:visited { color: #3c96e2; text-decoration: none}
49
+ a:focus { color: #3c96e2; text-decoration: underline}
50
+ a:hover { color: #3c96e2; text-decoration: underline}
51
+
52
+ @media only screen and (max-device-width: 480px) {
53
+
54
+
55
+ body[yahoo] #container1 {display:block !important}
56
+ body[yahoo] p {font-size: 10px}
57
+
58
+ }
59
+
60
+ @media only screen and (min-device-width: 768px) and (max-device-width: 1024px) {
61
+
62
+
63
+ body[yahoo] #container1 {display:block !important}
64
+ body[yahoo] p {font-size: 14px}
65
+
66
+ }
67
+
68
+ </style>
69
+
70
+
71
+ </head>
72
+ <body style="margin-top: 0; background:#A52B00; min-height:1000px; color:#000;font-family:Arial, Helvetica, sans-serif; font-size:14px"
73
+ alink="#FF0000" link="#FF0000" bgcolor="#A52B00" text="#000000" yahoo="fix">
74
+
75
+ <div id="body_style" style="padding:0px">
76
+
77
+ <table cellpadding="0" cellspacing="0" border="0" bgcolor="#ffffff" width="600" align="center">
78
+ <tr>
79
+ <td width="600" colspan="3"><img src="<?php echo $theme_url; ?>/images/header.png"></td>
80
+ </tr>
81
+ <tr>
82
+ <td width="600" align="center" colspan="3">
83
+ <h1><?php echo get_option('blogname'); ?></h1>
84
+ </td>
85
+ </tr>
86
+ <tr>
87
+ <td width="20">&nbsp;</td>
88
+ <td width="560">
89
+ <p>Hi {name},</p>
90
+
91
+ <p>The Newsletter Team wishes you merry Christmas and happy New Year. This time of year is special for us and we would like
92
+ to share this time with you, also.</p>
93
+
94
+ <p>We'll take a rest for few days with our families but we have a <strong>big surprise</strong> for YOU that will
95
+ be unvealed the first days of the New Year.</p>
96
+
97
+ <p>Curious? You can <a href="<?php echo get_option('blogname'); ?>">discover a little more right now</a>.</p>
98
+
99
+ <p>
100
+ See you soon, TNT.<br>
101
+ <a href="<?php echo get_option('blogname'); ?>">http://www.thenewsletterplugin.com</a>
102
+ </p>
103
+
104
+ </td>
105
+ <td width="20">&nbsp;</td>
106
+ </tr>
107
+ <td width="600" colspan="3">
108
+ <?php include WP_PLUGIN_DIR . '/newsletter/emails/themes/default/social.php'; ?>
109
+ </td>
110
+ <tr>
111
+ <td width="20">&nbsp;</td>
112
+ <td width="560" style="color:#666">
113
+ <p>To change your subscription, <a target="_blank" href="{profile_url}">click here</a>.
114
+ </td>
115
+ <td width="20">&nbsp;</td>
116
+ </tr>
117
+ <tr>
118
+ <td width="600" colspan="3" bgcolor="#A52B00"><img src="<?php echo $theme_url; ?>/images/footer.png"></td>
119
+ </tr>
120
+ </table>
121
+
122
+ </div>
123
+
124
+ </body>
125
  </html>
emails/tnp-composer/edit.php CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  <div class="tnpc-edit" id="tnpc-edit-image">
2
  <div class="tnpc-edit-box">
3
  <div class="tnpc-edit-box-title"><?php _e("Edit Image", "newsletter") ?></div>
@@ -1391,7 +1394,7 @@
1391
  <div class="tnpc-edit-box-title"><?php _e("Edit Block", "newsletter") ?></div>
1392
 
1393
  <div class="tnpc-edit-box-content">
1394
- <div class="tnpc-edit-box-content-text"><?php _e("_Background Color", "newsletter") ?></div>
1395
  <div class="tnpc-edit-box-content-field"><input type="text" class="tnpc-edit-box-content-field-input bgcolor"/></div>
1396
  <div class="tnpc-edit-box-content-text"><?php _e("Font Family", "newsletter") ?></div>
1397
  <div class="tnpc-edit-box-content-field">
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?>
4
  <div class="tnpc-edit" id="tnpc-edit-image">
5
  <div class="tnpc-edit-box">
6
  <div class="tnpc-edit-box-title"><?php _e("Edit Image", "newsletter") ?></div>
1394
  <div class="tnpc-edit-box-title"><?php _e("Edit Block", "newsletter") ?></div>
1395
 
1396
  <div class="tnpc-edit-box-content">
1397
+ <div class="tnpc-edit-box-content-text"><?php _e("Background Color", "newsletter") ?></div>
1398
  <div class="tnpc-edit-box-content-field"><input type="text" class="tnpc-edit-box-content-field-input bgcolor"/></div>
1399
  <div class="tnpc-edit-box-content-text"><?php _e("Font Family", "newsletter") ?></div>
1400
  <div class="tnpc-edit-box-content-field">
emails/tnp-composer/index.php CHANGED
@@ -1,86 +1,88 @@
1
- <?php
2
- /* READ THE BLOCKS */
3
- $blocks_dir = NEWSLETTER_DIR . '/emails/tnp-composer/blocks/';
4
- $files = glob($blocks_dir . '*.block', GLOB_BRACE);
5
- foreach ($files as $file) {
6
- $path_parts = pathinfo($file);
7
- $filename = $path_parts['filename'];
8
- $section = substr($filename, 0, strpos($filename, '-'));
9
- $index = substr($filename, strpos($filename, '-') + 1, 2);
10
- $blocks[$section][$index]['name'] = substr($filename, strrpos($filename, '-') + 1);
11
- $blocks[$section][$index]['filename'] = $filename;
12
- }
13
- // order the sections
14
- $blocks = array_merge(array_flip(array('header', 'content', 'footer')), $blocks);
15
-
16
- // prepare the options for the default blocks
17
- $block_options = get_option('newsletter_main');
18
- ?>
19
-
20
- <div id="newsletter-preloaded-export" style="display: none;"></div>
21
-
22
- <?php include NEWSLETTER_DIR . '/emails/tnp-composer/edit.php'; ?>
23
-
24
- <div id="newsletter-builder">
25
-
26
- <?php /* SIDEBAR */ ?>
27
- <div id="newsletter-builder-sidebar">
28
-
29
- <?php
30
- foreach ($blocks as $k => $section) {
31
- ?>
32
- <div class="newsletter-sidebar-add-buttons" id="sidebar-add-<?php echo $k ?>">
33
- <h4><span><?php echo ucfirst($k) ?></span></h4>
34
- <?php foreach ($section AS $key => $block) { ?>
35
- <div class="newsletter-sidebar-buttons-content-tab" data-id="<?php echo $k . '-' . $key ?>" data-file="<?php echo $block['filename'] ?>">
36
- <?php if (file_exists(NEWSLETTER_DIR . '/emails/tnp-composer/blocks/' . $block['filename'] . '.png')) { ?>
37
- <img src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/blocks/<?php echo $block['filename'] ?>.png" title="Drag&Drop" />
38
- <?php } else { ?>
39
- <img src="http://placehold.it/200x100?text=<?php echo $block['name'] ?>" title="Drag&Drop" />
40
- <?php } ?>
41
- </div>
42
- <?php } ?>
43
- </div>
44
- <?php } ?>
45
-
46
- </div>
47
-
48
- <div id="newsletter-builder-area">
49
-
50
- <div id="newsletter-builder-area-center">
51
-
52
- <div id="newsletter-builder-area-center-frame">
53
-
54
- <div id="newsletter-builder-area-center-frame-content">
55
-
56
- <?php
57
- if (isset($email)) {
58
- $x = strpos($body, '<body');
59
- if ($x !== false) {
60
- $x = strpos($body, '>', $x);
61
- $y = strpos($body, '</body>');
62
- echo substr($body, $x + 1, $y - $x - 1);
63
- } else {
64
- echo $body;
65
- }
66
- } else {
67
- include $blocks_dir . 'header-01-header.block';
68
- include $blocks_dir . 'content-01-hero.block';
69
- include $blocks_dir . 'footer-01-footer.block';
70
- include $blocks_dir . 'footer-02-canspam.block';
71
- }
72
- ?>
73
-
74
- </div>
75
- </div>
76
- </div>
77
- </div>
78
- </div>
79
-
80
- <script type="text/javascript">
81
- TNP_PLUGIN_URL = "<?php echo NEWSLETTER_URL ?>";
82
- </script>
83
- <!--<script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/jquery-2.2.3.min.js"></script>-->
84
- <!--<script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/jquery-ui-1.10.4.min.js"></script>-->
85
- <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/newsletter-builder.js"></script>
 
 
86
  <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/tinymce4/tinymce.min.js"></script>
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
+ /* READ THE BLOCKS */
5
+ $blocks_dir = NEWSLETTER_DIR . '/emails/tnp-composer/blocks/';
6
+ $files = glob($blocks_dir . '*.block', GLOB_BRACE);
7
+ foreach ($files as $file) {
8
+ $path_parts = pathinfo($file);
9
+ $filename = $path_parts['filename'];
10
+ $section = substr($filename, 0, strpos($filename, '-'));
11
+ $index = substr($filename, strpos($filename, '-') + 1, 2);
12
+ $blocks[$section][$index]['name'] = substr($filename, strrpos($filename, '-') + 1);
13
+ $blocks[$section][$index]['filename'] = $filename;
14
+ }
15
+ // order the sections
16
+ $blocks = array_merge(array_flip(array('header', 'content', 'footer')), $blocks);
17
+
18
+ // prepare the options for the default blocks
19
+ $block_options = get_option('newsletter_main');
20
+ ?>
21
+
22
+ <div id="newsletter-preloaded-export" style="display: none;"></div>
23
+
24
+ <?php include NEWSLETTER_DIR . '/emails/tnp-composer/edit.php'; ?>
25
+
26
+ <div id="newsletter-builder">
27
+
28
+ <?php /* SIDEBAR */ ?>
29
+ <div id="newsletter-builder-sidebar">
30
+
31
+ <?php
32
+ foreach ($blocks as $k => $section) {
33
+ ?>
34
+ <div class="newsletter-sidebar-add-buttons" id="sidebar-add-<?php echo $k ?>">
35
+ <h4><span><?php echo ucfirst($k) ?></span></h4>
36
+ <?php foreach ($section AS $key => $block) { ?>
37
+ <div class="newsletter-sidebar-buttons-content-tab" data-id="<?php echo $k . '-' . $key ?>" data-file="<?php echo $block['filename'] ?>">
38
+ <?php if (file_exists(NEWSLETTER_DIR . '/emails/tnp-composer/blocks/' . $block['filename'] . '.png')) { ?>
39
+ <img src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/blocks/<?php echo $block['filename'] ?>.png" title="Drag&Drop" />
40
+ <?php } else { ?>
41
+ <img src="http://placehold.it/200x100?text=<?php echo $block['name'] ?>" title="Drag&Drop" />
42
+ <?php } ?>
43
+ </div>
44
+ <?php } ?>
45
+ </div>
46
+ <?php } ?>
47
+
48
+ </div>
49
+
50
+ <div id="newsletter-builder-area">
51
+
52
+ <div id="newsletter-builder-area-center">
53
+
54
+ <div id="newsletter-builder-area-center-frame">
55
+
56
+ <div id="newsletter-builder-area-center-frame-content">
57
+
58
+ <?php
59
+ if (isset($email)) {
60
+ $x = strpos($body, '<body');
61
+ if ($x !== false) {
62
+ $x = strpos($body, '>', $x);
63
+ $y = strpos($body, '</body>');
64
+ echo substr($body, $x + 1, $y - $x - 1);
65
+ } else {
66
+ echo $body;
67
+ }
68
+ } else {
69
+ include $blocks_dir . 'header-01-header.block';
70
+ include $blocks_dir . 'content-01-hero.block';
71
+ include $blocks_dir . 'footer-01-footer.block';
72
+ include $blocks_dir . 'footer-02-canspam.block';
73
+ }
74
+ ?>
75
+
76
+ </div>
77
+ </div>
78
+ </div>
79
+ </div>
80
+ </div>
81
+
82
+ <script type="text/javascript">
83
+ TNP_PLUGIN_URL = "<?php echo NEWSLETTER_URL ?>";
84
+ </script>
85
+ <!--<script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/jquery-2.2.3.min.js"></script>-->
86
+ <!--<script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/jquery-ui-1.10.4.min.js"></script>-->
87
+ <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/emails/tnp-composer/_scripts/newsletter-builder.js"></script>
88
  <script type="text/javascript" src="<?php echo plugins_url('newsletter'); ?>/tinymce4/tinymce.min.js"></script>
feed/feed.php DELETED
@@ -1,26 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * This is only demo code just to make the demo Feed by Mail panel work.
5
- */
6
- class NewsletterFeed extends NewsletterModule {
7
-
8
- static $instance;
9
-
10
- static function instance() {
11
- if (self::$instance == null) {
12
- self::$instance = new NewsletterFeed();
13
- }
14
- return self::$instance;
15
- }
16
-
17
- function __construct() {
18
- parent::__construct('feed', '1.0.0');
19
- }
20
-
21
- function admin_menu() {
22
- // $this->add_menu_page('index', 'Feed by Mail');
23
- }
24
- }
25
-
26
- NewsletterFeed::instance();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
feed/index.php DELETED
@@ -1,26 +0,0 @@
1
-
2
- <div class="wrap" id="tnp-wrap">
3
-
4
- <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
5
-
6
- <div id="tnp-heading">
7
-
8
- <h2>Feed by Mail</h2>
9
-
10
- </div>
11
-
12
- <div id="tnp-body">
13
-
14
- <div class="updated">
15
- <p>
16
- The Feed by Mail demo has been removed to make the plugin <strong>faster</strong>. You can install the demo separately getting it
17
- from <a href="http://www.thenewsletterplugin.com/downloads/demos" target="_blank">here</a> or directly the full version from
18
- <a href="http://www.thenewsletterplugin.com/downloads" target="_blank">here</a>.
19
- </p>
20
- </div>
21
-
22
- </div>
23
-
24
- <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
25
-
26
- </div>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
header-extension.php CHANGED
@@ -1,28 +1,31 @@
1
- <?php
2
- /*
3
- * Header file for the extensions administrative panels.
4
- *
5
- * - no top noticies
6
- * - no donation link
7
- */
8
- ?>
9
- <?php if (NEWSLETTER_HEADER) { ?>
10
- <div id="newsletter-header-ext">
11
- <div style="text-align: center; margin-top: 5px;">
12
- <a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-documentation" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/header/documentation.png"> Documentation</a>
13
- <a href="http://www.thenewsletterplugin.com/forums" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/header/forum.png"> Forum</a>
14
- <a href="https://www.facebook.com/thenewsletterplugin
15
- " target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/header/facebook.png"> Facebook</a>
16
-
17
- <!--<a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-collaboration" target="_blank">Collaboration</a>-->
18
- </div>
19
-
20
- <div style="text-align: center; margin-top: 5px;">
21
- <form style="margin: 0;" action="http://www.thenewsletterplugin.com/wp-content/plugins/newsletter/do/subscribe.php" method="post" target="_blank">
22
- My Newsletter<!-- to thenewsletterplugin.com--> <input type="email" name="ne" required placeholder="Your email" style="padding: 2px">
23
- <input type="submit" value="Go" style="padding: 2px">
24
- </form>
25
- </div>
26
- </div>
27
- <?php } ?>
28
-
 
 
 
1
+ <?php
2
+ /*
3
+ * Header file for the extensions administrative panels.
4
+ *
5
+ * - no top noticies
6
+ * - no donation link
7
+ */
8
+
9
+ if (!defined('ABSPATH')) exit;
10
+
11
+ ?>
12
+ <?php if (NEWSLETTER_HEADER) { ?>
13
+ <div id="newsletter-header-ext">
14
+ <div style="text-align: center; margin-top: 5px;">
15
+ <a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-documentation" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/header/documentation.png"> Documentation</a>
16
+ <a href="http://www.thenewsletterplugin.com/forums" target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/header/forum.png"> Forum</a>
17
+ <a href="https://www.facebook.com/thenewsletterplugin
18
+ " target="_blank"><img style="vertical-align: bottom" src="<?php echo plugins_url('newsletter'); ?>/images/header/facebook.png"> Facebook</a>
19
+
20
+ <!--<a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-collaboration" target="_blank">Collaboration</a>-->
21
+ </div>
22
+
23
+ <div style="text-align: center; margin-top: 5px;">
24
+ <form style="margin: 0;" action="http://www.thenewsletterplugin.com/wp-content/plugins/newsletter/do/subscribe.php" method="post" target="_blank">
25
+ My Newsletter<!-- to thenewsletterplugin.com--> <input type="email" name="ne" required placeholder="Your email" style="padding: 2px">
26
+ <input type="submit" value="Go" style="padding: 2px">
27
+ </form>
28
+ </div>
29
+ </div>
30
+ <?php } ?>
31
+
includes/controls.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  class NewsletterControls {
4
 
@@ -112,16 +113,18 @@ class NewsletterControls {
112
  }
113
 
114
  function add_message_saved() {
115
- if (!empty($this->messages))
116
  $this->messages .= '<br><br>';
 
117
  $this->messages .= __('Saved.', 'newsletter');
118
  }
119
 
120
  function hint($text, $url = '') {
121
  echo '<div class="hints">';
 
122
  echo $text;
123
  if (!empty($url)) {
124
- echo " <a href='$url' target='_blank'>Read more</a>.";
125
  }
126
  echo '</div>';
127
  }
@@ -129,14 +132,16 @@ class NewsletterControls {
129
  function yesno($name) {
130
  $value = isset($this->data[$name]) ? (int) $this->data[$name] : 0;
131
 
132
- echo '<select style="width: 60px" name="options[' . $name . ']">';
133
  echo '<option value="0"';
134
- if ($value == 0)
135
  echo ' selected';
 
136
  echo '>No</option>';
137
  echo '<option value="1"';
138
- if ($value == 1)
139
  echo ' selected';
 
140
  echo '>Yes</option>';
141
  echo '</select>&nbsp;&nbsp;&nbsp;';
142
  }
@@ -144,7 +149,7 @@ class NewsletterControls {
144
  function enabled($name) {
145
  $value = isset($this->data[$name]) ? (int) $this->data[$name] : 0;
146
 
147
- echo '<select style="width: 100px" name="options[' . $name . ']">';
148
  echo '<option value="0"';
149
  if ($value == 0) {
150
  echo ' selected';
@@ -161,14 +166,16 @@ class NewsletterControls {
161
  function disabled($name) {
162
  $value = isset($this->data[$name]) ? (int) $this->data[$name] : 0;
163
 
164
- echo '<select style="width: 100px" name="options[' . $name . ']">';
165
  echo '<option value="0"';
166
- if ($value == 0)
167
  echo ' selected';
 
168
  echo '>Enabled</option>';
169
  echo '<option value="1"';
170
- if ($value == 1)
171
  echo ' selected';
 
172
  echo '>Disabled</option>';
173
  echo '</select>';
174
  }
@@ -191,12 +198,14 @@ class NewsletterControls {
191
  echo "<div class='newsletter-checkboxes-group'>";
192
  foreach ($values_labels as $value => $label) {
193
  echo "<div class='newsletter-checkboxes-item'>";
194
- echo "<label><input type='checkbox' id='$name' name='options[$name][]' value='$value'";
195
- if (array_search($value, $value_array) !== false)
196
- echo " checked";
197
- echo '/>';
198
- if ($label != '')
199
- echo $label;
 
 
200
  echo "</label></div>";
201
  }
202
  echo "</div><div style='clear: both'></div>";
@@ -207,7 +216,7 @@ class NewsletterControls {
207
  function post_types($name = 'post_types') {
208
  $list = array();
209
  $post_types = get_post_types(array('public' => true), 'objects', 'and');
210
- foreach ($post_types as &$post_type) {
211
  $list[$post_type->name] = $post_type->labels->name;
212
  }
213
 
@@ -222,14 +231,14 @@ class NewsletterControls {
222
  function select_group($name, $options) {
223
  $value_array = $this->get_value_array($name);
224
 
225
- echo '<select name="options[' . $name . '][]">';
226
 
227
  foreach ($options as $key => $label) {
228
- echo '<option value="' . $key . '"';
229
  if (array_search($key, $value_array) !== false) {
230
  echo ' selected';
231
  }
232
- echo '>' . htmlspecialchars($label) . '</option>';
233
  }
234
 
235
  echo '</select>';
@@ -238,7 +247,7 @@ class NewsletterControls {
238
  function select($name, $options, $first = null) {
239
  $value = $this->get_value($name);
240
 
241
- echo '<select id="options-' . $name . '" name="options[' . $name . ']">';
242
  if (!empty($first)) {
243
  echo '<option value="">' . esc_html($first) . '</option>';
244
  }
@@ -260,11 +269,13 @@ class NewsletterControls {
260
  echo '<optgroup label="' . esc_attr($group['']) . '">';
261
  if (!empty($group)) {
262
  foreach ($group as $key => $label) {
263
- if ($key == '')
264
  continue;
 
265
  echo '<option value="' . esc_attr($key) . '"';
266
- if ($value == $key)
267
  echo ' selected';
 
268
  echo '>' . esc_html($label) . '</option>';
269
  }
270
  }
@@ -280,9 +291,9 @@ class NewsletterControls {
280
  function themes($name, $themes, $submit_on_click = true) {
281
  foreach ($themes as $key => $data) {
282
  echo '<label style="display: block; float: left; text-align: center; margin-right: 10px;">';
283
- echo $key . '<br>';
284
- echo '<img src="' . $data['screenshot'] . '" width="100" height="100" style="border: 1px solid #666; padding: 5px"><br>';
285
- echo '<input style="position: relative; top: -40px" type="radio" onchange="this.form.act.value=\'theme\';this.form.submit()" name="options[' . $name . ']" value="' . $key . '"';
286
  if ($this->data[$name] == $key) {
287
  echo ' checked';
288
  }
@@ -326,32 +337,32 @@ class NewsletterControls {
326
 
327
  function text_email($name, $size = 40) {
328
  $value = $this->get_value($name);
329
- echo '<input name="options[' . $name . ']" type="email" placeholder="';
330
  echo esc_attr(__('Valid email address', 'newsletter'));
331
- echo '" size="' . $size . '" value="';
332
  echo esc_attr($value);
333
  echo '">';
334
  }
335
 
336
  function text_url($name, $size = 40) {
337
  $value = $this->get_value($name);
338
- echo '<input name="options[' . $name . ']" type="url" placeholder="http://..." size="' . $size . '" value="';
339
- echo htmlspecialchars($value);
340
  echo '"/>';
341
  }
342
 
343
  function hidden($name) {
344
  $value = $this->get_value($name);
345
  echo '<input name="options[' . $name . ']" type="hidden" value="';
346
- echo htmlspecialchars($value);
347
  echo '"/>';
348
  }
349
 
350
  function button($action, $label, $function = null) {
351
  if ($function != null) {
352
- echo '<input class="button-secondary" type="button" value="' . $label . '" onclick="this.form.act.value=\'' . $action . '\';' . htmlspecialchars($function) . '"/>';
353
  } else {
354
- echo '<input class="button-secondary" type="submit" value="' . $label . '" onclick="this.form.act.value=\'' . $action . '\';return true;"/>';
355
  }
356
  }
357
 
@@ -373,7 +384,7 @@ class NewsletterControls {
373
 
374
  function button_back($url) {
375
  echo '<a href="';
376
- echo $url;
377
  echo '" class="button"><i class="fa fa-chevron-left"></i>&nbsp;';
378
  _e('Back', 'newsletter');
379
  echo '</a>';
@@ -407,30 +418,30 @@ class NewsletterControls {
407
 
408
  function button_primary($action, $label, $function = null) {
409
  if ($function != null) {
410
- echo '<input class="button-primary" type="button" value="' . $label . '" onclick="this.form.act.value=\'' . $action . '\';' . htmlspecialchars($function) . '"/>';
411
  } else {
412
- echo '<input class="button-primary" type="button" value="' . $label . '" onclick="this.form.act.value=\'' . $action . '\';this.form.submit()"/>';
413
  }
414
  }
415
 
416
  function button_confirm($action, $label, $message = '', $data = '') {
417
  if (empty($message)) {
418
- echo '<input class="button-secondary" type="button" value="' . $label . '" onclick="this.form.btn.value=\'' . $data . '\';this.form.act.value=\'' . $action . '\';this.form.submit()"/>';
419
  } else {
420
- echo '<input class="button-secondary" type="button" value="' . $label . '" onclick="this.form.btn.value=\'' . $data . '\';this.form.act.value=\'' . $action . '\';if (confirm(\'' .
421
  esc_attr(esc_js($message)) . '\')) this.form.submit()"/>';
422
  }
423
  }
424
 
425
  function editor($name, $rows = 5, $cols = 75) {
426
- echo '<textarea class="visual" name="options[' . $name . ']" style="width: 100%" wrap="off" rows="' . $rows . '">';
427
  echo esc_html($this->get_value($name));
428
  echo '</textarea>';
429
  }
430
 
431
  function wp_editor($name, $settings = array()) {
432
  $value = $this->get_value($name);
433
- wp_editor($value, $name, array_merge(array('textarea_name' => 'options[' . $name . ']', 'wpautop' => false), $settings));
434
  if (!is_plugin_active('mce_table_buttons/mce_table_buttons.php')) {
435
  echo '<p class="description">You can install <a href="https://wordpress.org/plugins/mce-table-buttons/" target="_blank">MCE Table Button</a> for a table management toolbar add on.</p>';
436
  }
@@ -438,14 +449,14 @@ class NewsletterControls {
438
 
439
  function textarea($name, $width = '100%', $height = '50') {
440
  $value = $this->get_value($name);
441
- echo '<textarea class="dynamic" name="options[' . $name . ']" wrap="off" style="width:' . $width . ';height:' . $height . '">';
442
  echo esc_html($value);
443
  echo '</textarea>';
444
  }
445
 
446
  function textarea_fixed($name, $width = '100%', $height = '200') {
447
  $value = $this->get_value($name);
448
- echo '<textarea id="options-' . $name . '" name="options[' . $name . ']" wrap="off" style="width:' . $width . ';height:' . $height . 'px">';
449
  echo esc_html($value);
450
  echo '</textarea>';
451
  }
@@ -453,13 +464,13 @@ class NewsletterControls {
453
  function textarea_preview($name, $width = '100%', $height = '200', $header = '', $footer = '') {
454
  $value = $this->get_value($name);
455
  //do_action('newsletter_controls_textarea_preview', $name);
456
- echo '<input class="button" type="button" onclick="newsletter_textarea_preview(\'options-' . $name . '\', \'\', \'\')" value="Switch editor/preview">';
457
  echo '<br><br>';
458
  echo '<div style="position: relative">';
459
- echo '<textarea id="options-' . $name . '" name="options[' . $name . ']" wrap="off" style="width:' . $width . ';height:' . $height . 'px">';
460
  echo esc_html($value);
461
  echo '</textarea>';
462
- echo '<iframe id="options-' . $name . '-iframe" class="newsletter-textarea-preview" style="background-color: #fff; width: ' . $width . '; height: ' . $height . 'px; position: absolute; top: 0; left: 0; z-index: 10000; display: none"></iframe>';
463
  echo '</div>';
464
  }
465
 
@@ -484,13 +495,13 @@ class NewsletterControls {
484
  if ($label != '') {
485
  echo '<label>';
486
  }
487
- echo '<input type="checkbox" id="' . $name . '" name="options[' . $name . ']" value="1"';
488
  if (!empty($this->data[$name])) {
489
  echo ' checked="checked"';
490
  }
491
  echo '>';
492
  if ($label != '') {
493
- echo '&nbsp;' . $label . '</label>';
494
  }
495
  }
496
 
@@ -498,15 +509,15 @@ class NewsletterControls {
498
  if ($label != '') {
499
  echo '<label>';
500
  }
501
- echo '<input type="checkbox" id="' . $name . '" onchange="document.getElementById(\'' . $name . '_hidden\').value=this.checked?\'1\':\'0\'"';
502
  if (!empty($this->data[$name])) {
503
  echo ' checked="checked"';
504
  }
505
  echo '>';
506
  if ($label != '') {
507
- echo '&nbsp;' . $label . '</label>';
508
  }
509
- echo '<input type="hidden" id="' . $name . '_hidden" name="options[' . $name . ']" value="';
510
 
511
  echo empty($this->data[$name]) ? '0' : '1';
512
  echo '">';
@@ -516,14 +527,14 @@ class NewsletterControls {
516
  if ($label != '') {
517
  echo '<label>';
518
  }
519
- echo '<input type="radio" id="' . $name . '" name="options[' . $name . ']" value="' . esc_attr($value) . '"';
520
  $v = $this->get_value($name);
521
  if ($v == $value) {
522
  echo ' checked="checked"';
523
  }
524
  echo '>';
525
  if ($label != '') {
526
- echo '&nbsp;' . $label . '</label>';
527
  }
528
  }
529
 
@@ -532,13 +543,13 @@ class NewsletterControls {
532
  * the key $name an array containig the passed value.
533
  */
534
  function checkbox_group($name, $value, $label = '') {
535
- echo '<label><input type="checkbox" id="' . $name . '" name="options[' . $name . '][]" value="' . esc_attr($value) . '"';
536
  if (isset($this->data[$name]) && is_array($this->data[$name]) && array_search($value, $this->data[$name]) !== false) {
537
  echo ' checked';
538
  }
539
- echo '/>';
540
  if ($label != '') {
541
- echo $label;
542
  }
543
  echo '</label>';
544
  }
@@ -552,7 +563,7 @@ class NewsletterControls {
552
  function categories($name = 'category') {
553
  $categories = get_categories();
554
  echo '<div class="newsletter-checkboxes-group">';
555
- foreach ($categories as &$c) {
556
  echo '<div class="newsletter-checkboxes-item">';
557
  $this->checkbox($name . '_' . $c->cat_ID, esc_html($c->cat_name));
558
  echo '</div>';
@@ -671,8 +682,8 @@ class NewsletterControls {
671
  $year = date('Y', $this->data[$name]);
672
  $day = date('j', $this->data[$name]);
673
  $month = date('m', $this->data[$name]);
674
- $onchange = "this.form.elements['options[" . $name . "]'].value = new Date(document.getElementById('" . $name . "_year').value, document.getElementById('" . $name . "_month').value, document.getElementById('" . $name . "_day').value, 12, 0, 0).getTime()/1000";
675
- echo '<select id="' . $name . '_month" onchange="' . $onchange . '">';
676
  for ($i = 0; $i < 12; $i++) {
677
  echo '<option value="' . $i . '"';
678
  if ($month - 1 == $i) {
@@ -682,7 +693,7 @@ class NewsletterControls {
682
  }
683
  echo '</select>';
684
 
685
- echo '<select id="' . $name . '_day" onchange="' . $onchange . '">';
686
  for ($i = 1; $i <= 31; $i++) {
687
  echo '<option value="' . $i . '"';
688
  if ($day == $i) {
@@ -692,7 +703,7 @@ class NewsletterControls {
692
  }
693
  echo '</select>';
694
 
695
- echo '<select id="' . $name . '_year" onchange="' . $onchange . '">';
696
  for ($i = 2011; $i <= 2021; $i++) {
697
  echo '<option value="' . $i . '"';
698
  if ($year == $i) {
@@ -707,14 +718,14 @@ class NewsletterControls {
707
  * Date and time (hour) selector. Timestamp stored.
708
  */
709
  function datetime($name) {
710
- echo '<input type="hidden" name="fields[' . $name . ']" value="datetime">';
711
  $time = $this->data[$name] + get_option('gmt_offset') * 3600;
712
  $year = gmdate('Y', $time);
713
  $day = gmdate('j', $time);
714
  $month = gmdate('m', $time);
715
  $hour = gmdate('H', $time);
716
 
717
- echo '<select name="' . $name . '_month">';
718
  for ($i = 1; $i <= 12; $i++) {
719
  echo '<option value="' . $i . '"';
720
  if ($month == $i) {
@@ -724,7 +735,7 @@ class NewsletterControls {
724
  }
725
  echo '</select>';
726
 
727
- echo '<select name="' . $name . '_day">';
728
  for ($i = 1; $i <= 31; $i++) {
729
  echo '<option value="' . $i . '"';
730
  if ($day == $i) {
@@ -734,7 +745,7 @@ class NewsletterControls {
734
  }
735
  echo '</select>';
736
 
737
- echo '<select name="' . $name . '_year">';
738
  for ($i = 2011; $i <= 2021; $i++) {
739
  echo '<option value="' . $i . '"';
740
  if ($year == $i) {
@@ -744,7 +755,7 @@ class NewsletterControls {
744
  }
745
  echo '</select>';
746
 
747
- echo '<select name="' . $name . '_hour">';
748
  for ($i = 0; $i <= 23; $i++) {
749
  echo '<option value="' . $i . '"';
750
  if ($hour == $i) {
@@ -838,7 +849,7 @@ class NewsletterControls {
838
 
839
  function js_redirect($url) {
840
  echo '<script>';
841
- echo 'location.href="' . $url . '"';
842
  echo '</script>';
843
  }
844
 
@@ -859,7 +870,7 @@ class NewsletterControls {
859
  function css_font_size($name) {
860
  $value = $this->get_value($name);
861
 
862
- echo '<select id="options-' . $name . '" name="options[' . $name . ']">';
863
  for ($i = 8; $i < 50; $i++) {
864
  echo '<option value="' . $i . '"';
865
  if ($value == $i) {
@@ -873,7 +884,7 @@ class NewsletterControls {
873
  function css_border($name) {
874
  $value = $this->get_value($name . '_width');
875
 
876
- echo 'width&nbsp;<select id="options-' . $name . '-width" name="options[' . $name . '_width]">';
877
  for ($i = 0; $i < 10; $i++) {
878
  echo '<option value="' . $i . '"';
879
  if ($value == $i) {
@@ -889,7 +900,7 @@ class NewsletterControls {
889
 
890
  $value = $this->get_value($name . '_radius');
891
 
892
- echo '&nbsp;&nbsp;radius&nbsp;<select id="options-' . $name . '-radius" name="options[' . $name . '_radius]">';
893
  for ($i = 0; $i < 10; $i++) {
894
  echo '<option value="' . $i . '"';
895
  if ($value == $i) {
@@ -907,24 +918,24 @@ class NewsletterControls {
907
 
908
  if ($media === false) {
909
  $media = array('', '', '');
910
- echo '<img style="width: 200px" id="' . $name . '_img" src="' . plugins_url('newsletter') . '/images/nomedia.png" onclick="newsletter_media(\'' . $name . '\')">';
911
  } else {
912
- echo '<img style="width: 200px" id="' . $name . '_img" src="' . $media[0] . '" onclick="newsletter_media(\'' . $name . '\')">';
913
  echo '<br>';
914
- echo '<a href="#" onclick="newsletter_media_remove(\'' . $name . '\'); return false">Remove</a>';
915
  }
916
 
917
- echo '<input type="hidden" id="' . $name . '_id" name="options[' . $name . '][id]" value="' . $media_id . '" size="5">';
918
- echo '<input type="hidden" id="' . $name . '_url" name="options[' . $name . '][url]" value="' . esc_attr($media_full[0]) . '" size="50">';
919
  }
920
 
921
  function media_input($option, $name, $label) {
922
 
923
  if (!empty($label)) {
924
- $output = '<label class="select" for="tnp_' . $name . '">' . $label . ':</label>';
925
  }
926
- $output .= '<input id="tnp_' . $name . '" type="text" size="36" name="' . $option . '[' . $name . ']" value="' . esc_attr($val) . '" />';
927
- $output .= '<input id="tnp_' . $name . '_button" class="button" type="button" value="Select Image" />';
928
  $output .= '<br class="clear"/>';
929
 
930
  echo $output;
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  class NewsletterControls {
5
 
113
  }
114
 
115
  function add_message_saved() {
116
+ if (!empty($this->messages)) {
117
  $this->messages .= '<br><br>';
118
+ }
119
  $this->messages .= __('Saved.', 'newsletter');
120
  }
121
 
122
  function hint($text, $url = '') {
123
  echo '<div class="hints">';
124
+ // Do not escape that, it can be formatted
125
  echo $text;
126
  if (!empty($url)) {
127
+ echo ' <a href="' . esc_attr($url) . '" target="_blank">Read more</a>.';
128
  }
129
  echo '</div>';
130
  }
132
  function yesno($name) {
133
  $value = isset($this->data[$name]) ? (int) $this->data[$name] : 0;
134
 
135
+ echo '<select style="width: 60px" name="options[' . esc_attr($name) . ']">';
136
  echo '<option value="0"';
137
+ if ($value == 0) {
138
  echo ' selected';
139
+ }
140
  echo '>No</option>';
141
  echo '<option value="1"';
142
+ if ($value == 1) {
143
  echo ' selected';
144
+ }
145
  echo '>Yes</option>';
146
  echo '</select>&nbsp;&nbsp;&nbsp;';
147
  }
149
  function enabled($name) {
150
  $value = isset($this->data[$name]) ? (int) $this->data[$name] : 0;
151
 
152
+ echo '<select style="width: 100px" name="options[' . esc_attr($name) . ']">';
153
  echo '<option value="0"';
154
  if ($value == 0) {
155
  echo ' selected';
166
  function disabled($name) {
167
  $value = isset($this->data[$name]) ? (int) $this->data[$name] : 0;
168
 
169
+ echo '<select style="width: 100px" name="options[' . esc_attr($name) . ']">';
170
  echo '<option value="0"';
171
+ if ($value == 0) {
172
  echo ' selected';
173
+ }
174
  echo '>Enabled</option>';
175
  echo '<option value="1"';
176
+ if ($value == 1) {
177
  echo ' selected';
178
+ }
179
  echo '>Disabled</option>';
180
  echo '</select>';
181
  }
198
  echo "<div class='newsletter-checkboxes-group'>";
199
  foreach ($values_labels as $value => $label) {
200
  echo "<div class='newsletter-checkboxes-item'>";
201
+ echo '<label><input type="checkbox" id="' . esc_attr($name) . '" name="options[' . esc_attr($name) . '][]" value="' . esc_attr($value) . '"';
202
+ if (array_search($value, $value_array) !== false) {
203
+ echo ' checked';
204
+ }
205
+ echo '>';
206
+ if ($label != '') {
207
+ echo esc_html($label);
208
+ }
209
  echo "</label></div>";
210
  }
211
  echo "</div><div style='clear: both'></div>";
216
  function post_types($name = 'post_types') {
217
  $list = array();
218
  $post_types = get_post_types(array('public' => true), 'objects', 'and');
219
+ foreach ($post_types as $post_type) {
220
  $list[$post_type->name] = $post_type->labels->name;
221
  }
222
 
231
  function select_group($name, $options) {
232
  $value_array = $this->get_value_array($name);
233
 
234
+ echo '<select name="options[' . esc_attr($name) . '][]">';
235
 
236
  foreach ($options as $key => $label) {
237
+ echo '<option value="' . esc_attr($key) . '"';
238
  if (array_search($key, $value_array) !== false) {
239
  echo ' selected';
240
  }
241
+ echo '>' . esc_html($label) . '</option>';
242
  }
243
 
244
  echo '</select>';
247
  function select($name, $options, $first = null) {
248
  $value = $this->get_value($name);
249
 
250
+ echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
251
  if (!empty($first)) {
252
  echo '<option value="">' . esc_html($first) . '</option>';
253
  }
269
  echo '<optgroup label="' . esc_attr($group['']) . '">';
270
  if (!empty($group)) {
271
  foreach ($group as $key => $label) {
272
+ if ($key == '') {
273
  continue;
274
+ }
275
  echo '<option value="' . esc_attr($key) . '"';
276
+ if ($value == $key) {
277
  echo ' selected';
278
+ }
279
  echo '>' . esc_html($label) . '</option>';
280
  }
281
  }
291
  function themes($name, $themes, $submit_on_click = true) {
292
  foreach ($themes as $key => $data) {
293
  echo '<label style="display: block; float: left; text-align: center; margin-right: 10px;">';
294
+ echo esc_html($key) . '<br>';
295
+ echo '<img src="' . esc_attr($data['screenshot']) . '" width="100" height="100" style="border: 1px solid #666; padding: 5px"><br>';
296
+ echo '<input style="position: relative; top: -40px" type="radio" onchange="this.form.act.value=\'theme\';this.form.submit()" name="options[' . esc_attr($name) . ']" value="' . esc_attr($key) . '"';
297
  if ($this->data[$name] == $key) {
298
  echo ' checked';
299
  }
337
 
338
  function text_email($name, $size = 40) {
339
  $value = $this->get_value($name);
340
+ echo '<input name="options[' . esc_attr($name) . ']" type="email" placeholder="';
341
  echo esc_attr(__('Valid email address', 'newsletter'));
342
+ echo '" size="' . esc_attr($size) . '" value="';
343
  echo esc_attr($value);
344
  echo '">';
345
  }
346
 
347
  function text_url($name, $size = 40) {
348
  $value = $this->get_value($name);
349
+ echo '<input name="options[' . esc_attr($name) . ']" type="url" placeholder="http://..." size="' . esc_attr($size) . '" value="';
350
+ echo esc_attr($value);
351
  echo '"/>';
352
  }
353
 
354
  function hidden($name) {
355
  $value = $this->get_value($name);
356
  echo '<input name="options[' . $name . ']" type="hidden" value="';
357
+ echo esc_attr($value);
358
  echo '"/>';
359
  }
360
 
361
  function button($action, $label, $function = null) {
362
  if ($function != null) {
363
+ echo '<input class="button-secondary" type="button" value="' . esc_attr($label) . '" onclick="this.form.act.value=\'' . esc_attr($action) . '\';' . esc_html($function) . '"/>';
364
  } else {
365
+ echo '<input class="button-secondary" type="submit" value="' . esc_attr($label) . '" onclick="this.form.act.value=\'' . esc_attr($action) . '\';return true;"/>';
366
  }
367
  }
368
 
384
 
385
  function button_back($url) {
386
  echo '<a href="';
387
+ echo esc_attr($url);
388
  echo '" class="button"><i class="fa fa-chevron-left"></i>&nbsp;';
389
  _e('Back', 'newsletter');
390
  echo '</a>';
418
 
419
  function button_primary($action, $label, $function = null) {
420
  if ($function != null) {
421
+ echo '<input class="button-primary" type="button" value="' . esc_attr($label) . '" onclick="this.form.act.value=\'' . esc_attr($action) . '\';' . esc_attr($function) . '"/>';
422
  } else {
423
+ echo '<input class="button-primary" type="button" value="' . esc_attr($label) . '" onclick="this.form.act.value=\'' . esc_attr($action) . '\';this.form.submit()"/>';
424
  }
425
  }
426
 
427
  function button_confirm($action, $label, $message = '', $data = '') {
428
  if (empty($message)) {
429
+ echo '<input class="button-secondary" type="button" value="' . esc_attr($label) . '" onclick="this.form.btn.value=\'' . esc_attr($data) . '\';this.form.act.value=\'' . esc_attr($action) . '\';this.form.submit()"/>';
430
  } else {
431
+ echo '<input class="button-secondary" type="button" value="' . esc_attr($label) . '" onclick="this.form.btn.value=\'' . esc_attr($data) . '\';this.form.act.value=\'' . esc_attr($action) . '\';if (confirm(\'' .
432
  esc_attr(esc_js($message)) . '\')) this.form.submit()"/>';
433
  }
434
  }
435
 
436
  function editor($name, $rows = 5, $cols = 75) {
437
+ echo '<textarea class="visual" name="options[' . esc_attr($name) . ']" style="width: 100%" wrap="off" rows="' . esc_attr($rows) . '">';
438
  echo esc_html($this->get_value($name));
439
  echo '</textarea>';
440
  }
441
 
442
  function wp_editor($name, $settings = array()) {
443
  $value = $this->get_value($name);
444
+ wp_editor($value, $name, array_merge(array('textarea_name' => 'options[' . esc_attr($name) . ']', 'wpautop' => false), $settings));
445
  if (!is_plugin_active('mce_table_buttons/mce_table_buttons.php')) {
446
  echo '<p class="description">You can install <a href="https://wordpress.org/plugins/mce-table-buttons/" target="_blank">MCE Table Button</a> for a table management toolbar add on.</p>';
447
  }
449
 
450
  function textarea($name, $width = '100%', $height = '50') {
451
  $value = $this->get_value($name);
452
+ echo '<textarea class="dynamic" name="options[' . esc_attr($name) . ']" wrap="off" style="width:' . esc_attr($width) . ';height:' . esc_attr($height) . '">';
453
  echo esc_html($value);
454
  echo '</textarea>';
455
  }
456
 
457
  function textarea_fixed($name, $width = '100%', $height = '200') {
458
  $value = $this->get_value($name);
459
+ echo '<textarea id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']" wrap="off" style="width:' . esc_attr($width) . ';height:' . esc_attr($height) . 'px">';
460
  echo esc_html($value);
461
  echo '</textarea>';
462
  }
464
  function textarea_preview($name, $width = '100%', $height = '200', $header = '', $footer = '') {
465
  $value = $this->get_value($name);
466
  //do_action('newsletter_controls_textarea_preview', $name);
467
+ echo '<input class="button" type="button" onclick="newsletter_textarea_preview(\'options-' . esc_attr($name) . '\', \'\', \'\')" value="Switch editor/preview">';
468
  echo '<br><br>';
469
  echo '<div style="position: relative">';
470
+ echo '<textarea id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']" wrap="off" style="width:' . esc_attr($width) . ';height:' . esc_attr($height) . 'px">';
471
  echo esc_html($value);
472
  echo '</textarea>';
473
+ echo '<iframe id="options-' . esc_attr($name) . '-iframe" class="newsletter-textarea-preview" style="background-color: #fff; width: ' . esc_attr($width) . '; height: ' . esc_attr($height) . 'px; position: absolute; top: 0; left: 0; z-index: 10000; display: none"></iframe>';
474
  echo '</div>';
475
  }
476
 
495
  if ($label != '') {
496
  echo '<label>';
497
  }
498
+ echo '<input type="checkbox" id="' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']" value="1"';
499
  if (!empty($this->data[$name])) {
500
  echo ' checked="checked"';
501
  }
502
  echo '>';
503
  if ($label != '') {
504
+ echo '&nbsp;' . esc_html($label) . '</label>';
505
  }
506
  }
507
 
509
  if ($label != '') {
510
  echo '<label>';
511
  }
512
+ echo '<input type="checkbox" id="' . esc_attr($name) . '" onchange="document.getElementById(\'' . esc_attr($name) . '_hidden\').value=this.checked?\'1\':\'0\'"';
513
  if (!empty($this->data[$name])) {
514
  echo ' checked="checked"';
515
  }
516
  echo '>';
517
  if ($label != '') {
518
+ echo '&nbsp;' . esc_html($label) . '</label>';
519
  }
520
+ echo '<input type="hidden" id="' . esc_attr($name) . '_hidden" name="options[' . esc_attr($name) . ']" value="';
521
 
522
  echo empty($this->data[$name]) ? '0' : '1';
523
  echo '">';
527
  if ($label != '') {
528
  echo '<label>';
529
  }
530
+ echo '<input type="radio" id="' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']" value="' . esc_attr($value) . '"';
531
  $v = $this->get_value($name);
532
  if ($v == $value) {
533
  echo ' checked="checked"';
534
  }
535
  echo '>';
536
  if ($label != '') {
537
+ echo '&nbsp;' . esc_html($label) . '</label>';
538
  }
539
  }
540
 
543
  * the key $name an array containig the passed value.
544
  */
545
  function checkbox_group($name, $value, $label = '') {
546
+ echo '<label><input type="checkbox" id="' . esc_attr($name) . '" name="options[' . esc_attr($name) . '][]" value="' . esc_attr($value) . '"';
547
  if (isset($this->data[$name]) && is_array($this->data[$name]) && array_search($value, $this->data[$name]) !== false) {
548
  echo ' checked';
549
  }
550
+ echo '>';
551
  if ($label != '') {
552
+ echo esc_html($label);
553
  }
554
  echo '</label>';
555
  }
563
  function categories($name = 'category') {
564
  $categories = get_categories();
565
  echo '<div class="newsletter-checkboxes-group">';
566
+ foreach ($categories as $c) {
567
  echo '<div class="newsletter-checkboxes-item">';
568
  $this->checkbox($name . '_' . $c->cat_ID, esc_html($c->cat_name));
569
  echo '</div>';
682
  $year = date('Y', $this->data[$name]);
683
  $day = date('j', $this->data[$name]);
684
  $month = date('m', $this->data[$name]);
685
+ $onchange = "this.form.elements['options[" . esc_attr($name) . "]'].value = new Date(document.getElementById('" . esc_attr($name) . "_year').value, document.getElementById('" . esc_attr($name) . "_month').value, document.getElementById('" . esc_attr($name) . "_day').value, 12, 0, 0).getTime()/1000";
686
+ echo '<select id="' . $name . '_month" onchange="' . esc_attr($onchange) . '">';
687
  for ($i = 0; $i < 12; $i++) {
688
  echo '<option value="' . $i . '"';
689
  if ($month - 1 == $i) {
693
  }
694
  echo '</select>';
695
 
696
+ echo '<select id="' . esc_attr($name) . '_day" onchange="' . esc_attr($onchange) . '">';
697
  for ($i = 1; $i <= 31; $i++) {
698
  echo '<option value="' . $i . '"';
699
  if ($day == $i) {
703
  }
704
  echo '</select>';
705
 
706
+ echo '<select id="' . esc_attr($name) . '_year" onchange="' . esc_attr($onchange) . '">';
707
  for ($i = 2011; $i <= 2021; $i++) {
708
  echo '<option value="' . $i . '"';
709
  if ($year == $i) {
718
  * Date and time (hour) selector. Timestamp stored.
719
  */
720
  function datetime($name) {
721
+ echo '<input type="hidden" name="fields[' . esc_attr($name) . ']" value="datetime">';
722
  $time = $this->data[$name] + get_option('gmt_offset') * 3600;
723
  $year = gmdate('Y', $time);
724
  $day = gmdate('j', $time);
725
  $month = gmdate('m', $time);
726
  $hour = gmdate('H', $time);
727
 
728
+ echo '<select name="' . esc_attr($name) . '_month">';
729
  for ($i = 1; $i <= 12; $i++) {
730
  echo '<option value="' . $i . '"';
731
  if ($month == $i) {
735
  }
736
  echo '</select>';
737
 
738
+ echo '<select name="' . esc_attr($name) . '_day">';
739
  for ($i = 1; $i <= 31; $i++) {
740
  echo '<option value="' . $i . '"';
741
  if ($day == $i) {
745
  }
746
  echo '</select>';
747
 
748
+ echo '<select name="' . esc_attr($name) . '_year">';
749
  for ($i = 2011; $i <= 2021; $i++) {
750
  echo '<option value="' . $i . '"';
751
  if ($year == $i) {
755
  }
756
  echo '</select>';
757
 
758
+ echo '<select name="' . esc_attr($name) . '_hour">';
759
  for ($i = 0; $i <= 23; $i++) {
760
  echo '<option value="' . $i . '"';
761
  if ($hour == $i) {
849
 
850
  function js_redirect($url) {
851
  echo '<script>';
852
+ echo 'location.href="' . esc_js($url) . '"';
853
  echo '</script>';
854
  }
855
 
870
  function css_font_size($name) {
871
  $value = $this->get_value($name);
872
 
873
+ echo '<select id="options-' . esc_attr($name) . '" name="options[' . esc_attr($name) . ']">';
874
  for ($i = 8; $i < 50; $i++) {
875
  echo '<option value="' . $i . '"';
876
  if ($value == $i) {
884
  function css_border($name) {
885
  $value = $this->get_value($name . '_width');
886
 
887
+ echo 'width&nbsp;<select id="options-' . esc_attr($name) . '-width" name="options[' . esc_attr($name) . '_width]">';
888
  for ($i = 0; $i < 10; $i++) {
889
  echo '<option value="' . $i . '"';
890
  if ($value == $i) {
900
 
901
  $value = $this->get_value($name . '_radius');
902
 
903
+ echo '&nbsp;&nbsp;radius&nbsp;<select id="options-' . esc_attr($name) . '-radius" name="options[' . esc_attr($name) . '_radius]">';
904
  for ($i = 0; $i < 10; $i++) {
905
  echo '<option value="' . $i . '"';
906
  if ($value == $i) {
918
 
919
  if ($media === false) {
920
  $media = array('', '', '');
921
+ echo '<img style="width: 200px" id="' . esc_attr($name) . '_img" src="' . plugins_url('newsletter') . '/images/nomedia.png" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
922
  } else {
923
+ echo '<img style="width: 200px" id="' . esc_attr($name) . '_img" src="' . $media[0] . '" onclick="newsletter_media(\'' . esc_attr($name) . '\')">';
924
  echo '<br>';
925
+ echo '<a href="#" onclick="newsletter_media_remove(\'' . esc_attr($name) . '\'); return false">Remove</a>';
926
  }
927
 
928
+ echo '<input type="hidden" id="' . esc_attr($name) . '_id" name="options[' . esc_attr($name) . '][id]" value="' . esc_attr($media_id) . '" size="5">';
929
+ echo '<input type="hidden" id="' . esc_attr($name) . '_url" name="options[' . esc_attr($name) . '][url]" value="' . esc_attr($media_full[0]) . '" size="50">';
930
  }
931
 
932
  function media_input($option, $name, $label) {
933
 
934
  if (!empty($label)) {
935
+ $output = '<label class="select" for="tnp_' . esc_attr($name) . '">' . esc_html($label) . ':</label>';
936
  }
937
+ $output .= '<input id="tnp_' . esc_attr($name) . '" type="text" size="36" name="' . esc_attr($option) . '[' . esc_attr($name) . ']" value="' . esc_attr($val) . '" />';
938
+ $output .= '<input id="tnp_' . esc_attr($name) . '_button" class="button" type="button" value="Select Image" />';
939
  $output .= '<br class="clear"/>';
940
 
941
  echo $output;
includes/helper.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  function tnp_post_thumbnail_src($post, $size = 'thumbnail') {
4
  $media = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), $size);
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  function tnp_post_thumbnail_src($post, $size = 'thumbnail') {
5
  $media = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), $size);
includes/logger.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  if (!defined('NEWSLETTER_LOG_DIR')) {
4
  define('NEWSLETTER_LOG_DIR', WP_CONTENT_DIR . '/logs/newsletter/');
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  if (!defined('NEWSLETTER_LOG_DIR')) {
5
  define('NEWSLETTER_LOG_DIR', WP_CONTENT_DIR . '/logs/newsletter/');
includes/module.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  class NewsletterModule {
4
 
@@ -375,7 +376,7 @@ class NewsletterModule {
375
  static function format_scheduler_time($name) {
376
  $time = wp_next_scheduled($name);
377
  if ($time === false) {
378
- return 'Not active';
379
  }
380
  $delta = $time - time();
381
  // If less 10 minutes late it can be a cron problem but now it is working
@@ -496,19 +497,21 @@ class NewsletterModule {
496
  }
497
 
498
  $dir = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/styles';
499
- $handle = @opendir($dir);
500
-
501
- if ($handle !== false) {
502
- while ($file = readdir($handle)) {
503
- if ($file == '.' || $file == '..')
504
- continue;
505
- if (isset($list[$file]))
506
- continue;
507
- if (substr($file, -4) != '.css')
508
- continue;
509
- $list[$file] = substr($file, 0, strlen($file) - 4);
 
 
 
510
  }
511
- closedir($handle);
512
  }
513
  return $list;
514
  }
@@ -546,7 +549,7 @@ class NewsletterModule {
546
  $name = apply_filters('newsletter_admin_page', $name);
547
  add_submenu_page(null, $title, $title, ($newsletter->options['editor'] == 1) ? 'manage_categories' : 'manage_options', $name, array($this, 'menu_page'));
548
  }
549
-
550
  function sanitize_file_name($name) {
551
  return preg_replace('/[^a-z_\\-]/i', '', $name);
552
  }
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  class NewsletterModule {
5
 
376
  static function format_scheduler_time($name) {
377
  $time = wp_next_scheduled($name);
378
  if ($time === false) {
379
+ return 'No next run scheduled';
380
  }
381
  $delta = $time - time();
382
  // If less 10 minutes late it can be a cron problem but now it is working
497
  }
498
 
499
  $dir = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/styles';
500
+ if (is_dir($dir)) {
501
+ $handle = @opendir($dir);
502
+
503
+ if ($handle !== false) {
504
+ while ($file = readdir($handle)) {
505
+ if ($file == '.' || $file == '..')
506
+ continue;
507
+ if (isset($list[$file]))
508
+ continue;
509
+ if (substr($file, -4) != '.css')
510
+ continue;
511
+ $list[$file] = substr($file, 0, strlen($file) - 4);
512
+ }
513
+ closedir($handle);
514
  }
 
515
  }
516
  return $list;
517
  }
549
  $name = apply_filters('newsletter_admin_page', $name);
550
  add_submenu_page(null, $title, $title, ($newsletter->options['editor'] == 1) ? 'manage_categories' : 'manage_options', $name, array($this, 'menu_page'));
551
  }
552
+
553
  function sanitize_file_name($name) {
554
  return preg_replace('/[^a-z_\\-]/i', '', $name);
555
  }
includes/store.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  @require_once NEWSLETTER_INCLUDES_DIR . '/logger.php';
4
 
@@ -115,7 +116,7 @@ class NewsletterStore {
115
  if ($r === false) {
116
  $this->logger->fatal($wpdb->last_error);
117
  $this->logger->fatal($wpdb->last_query);
118
- die('Database error.');
119
  }
120
  }
121
  //$this->logger->debug('save: ' . $wpdb->last_query);
@@ -124,7 +125,7 @@ class NewsletterStore {
124
  if ($r === false) {
125
  $this->logger->fatal($wpdb->last_error);
126
  $this->logger->fatal($wpdb->last_query);
127
- die('Database error.');
128
  }
129
  $id = $wpdb->insert_id;
130
  }
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  @require_once NEWSLETTER_INCLUDES_DIR . '/logger.php';
5
 
116
  if ($r === false) {
117
  $this->logger->fatal($wpdb->last_error);
118
  $this->logger->fatal($wpdb->last_query);
119
+ die('Database error see the log files (log files path can be found on Newsletter diagnostic panel)');
120
  }
121
  }
122
  //$this->logger->debug('save: ' . $wpdb->last_query);
125
  if ($r === false) {
126
  $this->logger->fatal($wpdb->last_error);
127
  $this->logger->fatal($wpdb->last_query);
128
+ die('Database error see the log files (log files path can be found on Newsletter diagnostic panel)');
129
  }
130
  $id = $wpdb->insert_id;
131
  }
includes/themes.php CHANGED
@@ -1,217 +1,218 @@
1
- <?php
2
-
3
- class NewsletterThemes {
4
-
5
- var $module;
6
- var $is_extension = false;
7
-
8
- function __construct($module, $is_extension = false) {
9
- $this->module = $module;
10
- $this->is_extension = $is_extension;
11
- }
12
-
13
- /** Loads all themes of a module (actually only "emails" module makes sense). Themes are located inside the subfolder
14
- * named as the module on plugin folder and on a subfolder named as the module on wp-content/newsletter folder (which
15
- * must be manually created).
16
- *
17
- * @param type $module
18
- * @return type
19
- */
20
- function get_all() {
21
- $list = array();
22
-
23
- $dir = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes';
24
- $handle = @opendir($dir);
25
-
26
- if ($handle !== false) {
27
- while ($file = readdir($handle)) {
28
- if ($file == '.' || $file == '..')
29
- continue;
30
- if (!is_file($dir . '/' . $file . '/theme.php'))
31
- continue;
32
- $list[$file] = $file;
33
- }
34
- closedir($handle);
35
- }
36
-
37
- if (!$this->is_extension) {
38
- $dir = NEWSLETTER_DIR . '/' . $this->module . '/themes';
39
- $handle = @opendir($dir);
40
-
41
- if ($handle !== false) {
42
- while ($file = readdir($handle)) {
43
- if ($file == '.' || $file == '..')
44
- continue;
45
- if (isset($list[$file]))
46
- continue;
47
- if (!is_file($dir . '/' . $file . '/theme.php'))
48
- continue;
49
-
50
- $list[$file] = $file;
51
- }
52
- closedir($handle);
53
- }
54
- }
55
-
56
- return $list;
57
- }
58
-
59
- function themescmp($a, $b) {
60
- $al = strtolower($a['name']);
61
- $bl = strtolower($b['name']);
62
- if ($al == 'default') {
63
- return -1;
64
- }
65
- return (strcmp($al, $bl));
66
- }
67
-
68
- function get_all_with_data() {
69
- $list = array();
70
-
71
- $dir = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes';
72
- $handle = @opendir($dir);
73
-
74
- if ($handle !== false) {
75
- while ($file = readdir($handle)) {
76
- if ($file == '.' || $file == '..') {
77
- continue;
78
- }
79
- if (isset($list[$file])) {
80
- continue;
81
- }
82
- if (!is_file($dir . '/' . $file . '/theme.php')) {
83
- continue;
84
- }
85
- $data = get_file_data($dir . '/' . $file . '/theme.php', array('name' => 'Name', 'type' => 'Type', 'description'=>'Description'));
86
- $data['id'] = $file;
87
- if (empty($data['name'])) {
88
- $data['name'] = $file;
89
- }
90
- if (empty($data['type'])) {
91
- $data['type'] = 'standard';
92
- }
93
- $screenshot = $dir . '/' . $file . '/screenshot.png';
94
- if (is_file($screenshot)) {
95
- $data['screenshot'] = $this->get_theme_url($file) . '/screenshot.png';
96
- } else {
97
- $data['screenshot'] = plugins_url('newsletter') . '/images/theme-screenshot.png';
98
- }
99
- $list[$file] = $data;
100
- }
101
- closedir($handle);
102
- }
103
-
104
- if (!$this->is_extension) {
105
- $dir = NEWSLETTER_DIR . '/' . $this->module . '/themes';
106
- $handle = @opendir($dir);
107
-
108
- if ($handle !== false) {
109
- while ($file = readdir($handle)) {
110
- if ($file == '.' || $file == '..') {
111
- continue;
112
- }
113
- if (!is_file($dir . '/' . $file . '/theme.php')) {
114
- continue;
115
- }
116
- $data = get_file_data($dir . '/' . $file . '/theme.php', array('name' => 'Name', 'type' => 'Type', 'description'=>'Description'));
117
- $data['id'] = $file;
118
- if (empty($data['name'])) {
119
- $data['name'] = $file;
120
- }
121
- if (empty($data['type'])) {
122
- $data['type'] = 'standard';
123
- }
124
- $screenshot = $dir . '/' . $file . '/screenshot.png';
125
- if (is_file($screenshot)) {
126
- $data['screenshot'] = $this->get_theme_url($file) . '/screenshot.png';
127
- } else {
128
- $data['screenshot'] = plugins_url('newsletter') . '/images/theme-screenshot.png';
129
- }
130
- $list[$file] = $data;
131
- }
132
- closedir($handle);
133
- }
134
- }
135
-
136
- usort($list, array($this, "themescmp"));
137
-
138
- return $list;
139
- }
140
-
141
- /**
142
- *
143
- * @param type $theme
144
- * @param type $options
145
- * @param type $module
146
- */
147
- function save_options($theme, &$options) {
148
- add_option('newsletter_' . $this->module . '_theme_' . $theme, array(), null, 'no');
149
- $theme_options = array();
150
- foreach ($options as $key => &$value) {
151
- if (substr($key, 0, 6) != 'theme_')
152
- continue;
153
- $theme_options[$key] = $value;
154
- }
155
- update_option('newsletter_' . $this->module . '_theme_' . $theme, $theme_options);
156
- }
157
-
158
- function get_options($theme) {
159
- $options = get_option('newsletter_' . $this->module . '_theme_' . $theme);
160
- // To avoid merge problems.
161
- if (!is_array($options)) {
162
- return array();
163
- }
164
- return $options;
165
- }
166
-
167
- function get_file_path($theme, $file) {
168
- $path = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes/' . $theme . '/' . $file;
169
- if (is_file($path)) {
170
- return $path;
171
- } else {
172
- return NEWSLETTER_DIR . '/' . $this->module . '/themes/' . $theme . '/' . $file;
173
- }
174
- }
175
-
176
- function get_theme_url($theme) {
177
- if ($this->is_extension) {
178
- return WP_CONTENT_URL . '/extensions/newsletter/' . $this->module . '/themes/' . $theme;
179
- }
180
-
181
- $path = NEWSLETTER_DIR . '/' . $this->module . '/themes/' . $theme;
182
- if (is_dir($path)) {
183
- return plugins_url('newsletter') . '/' . $this->module . '/themes/' . $theme;
184
- } else {
185
- return WP_CONTENT_URL . '/extensions/newsletter/' . $this->module . '/themes/' . $theme;
186
- }
187
- }
188
-
189
- function get_default_options() {
190
- if ($this->is_extension) {
191
- $path2 = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes/' . $theme . '/languages';
192
- @include $path2 . '/en_US.php';
193
- @include $path2 . '/' . WPLANG . '.php';
194
- } else {
195
- $path1 = NEWSLETTER_DIR . '/' . $this->module . '/themes/' . $theme . '/languages';
196
- $path2 = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes/' . $theme . '/languages';
197
- @include $path1 . '/en_US.php';
198
- @include $path2 . '/en_US.php';
199
- @include $path1 . '/' . WPLANG . '.php';
200
- @include $path2 . '/' . WPLANG . '.php';
201
- }
202
-
203
- if (!is_array($options))
204
- return array();
205
- return $options;
206
- }
207
-
208
- }
209
-
210
- function nt_option($name, $def = null) {
211
- $options = get_option('newsletter_email');
212
- $option = $options['theme_' . $name];
213
- if (!isset($option))
214
- return $def;
215
- else
216
- return $option;
217
- }
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
+ class NewsletterThemes {
5
+
6
+ var $module;
7
+ var $is_extension = false;
8
+
9
+ function __construct($module, $is_extension = false) {
10
+ $this->module = $module;
11
+ $this->is_extension = $is_extension;
12
+ }
13
+
14
+ /** Loads all themes of a module (actually only "emails" module makes sense). Themes are located inside the subfolder
15
+ * named as the module on plugin folder and on a subfolder named as the module on wp-content/newsletter folder (which
16
+ * must be manually created).
17
+ *
18
+ * @param type $module
19
+ * @return type
20
+ */
21
+ function get_all() {
22
+ $list = array();
23
+
24
+ $dir = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes';
25
+ $handle = @opendir($dir);
26
+
27
+ if ($handle !== false) {
28
+ while ($file = readdir($handle)) {
29
+ if ($file == '.' || $file == '..')
30
+ continue;
31
+ if (!is_file($dir . '/' . $file . '/theme.php'))
32
+ continue;
33
+ $list[$file] = $file;
34
+ }
35
+ closedir($handle);
36
+ }
37
+
38
+ if (!$this->is_extension) {
39
+ $dir = NEWSLETTER_DIR . '/' . $this->module . '/themes';
40
+ $handle = @opendir($dir);
41
+
42
+ if ($handle !== false) {
43
+ while ($file = readdir($handle)) {
44
+ if ($file == '.' || $file == '..')
45
+ continue;
46
+ if (isset($list[$file]))
47
+ continue;
48
+ if (!is_file($dir . '/' . $file . '/theme.php'))
49
+ continue;
50
+
51
+ $list[$file] = $file;
52
+ }
53
+ closedir($handle);
54
+ }
55
+ }
56
+
57
+ return $list;
58
+ }
59
+
60
+ function themescmp($a, $b) {
61
+ $al = strtolower($a['name']);
62
+ $bl = strtolower($b['name']);
63
+ if ($al == 'default') {
64
+ return -1;
65
+ }
66
+ return (strcmp($al, $bl));
67
+ }
68
+
69
+ function get_all_with_data() {
70
+ $list = array();
71
+
72
+ $dir = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes';
73
+ $handle = @opendir($dir);
74
+
75
+ if ($handle !== false) {
76
+ while ($file = readdir($handle)) {
77
+ if ($file == '.' || $file == '..') {
78
+ continue;
79
+ }
80
+ if (isset($list[$file])) {
81
+ continue;
82
+ }
83
+ if (!is_file($dir . '/' . $file . '/theme.php')) {
84
+ continue;
85
+ }
86
+ $data = get_file_data($dir . '/' . $file . '/theme.php', array('name' => 'Name', 'type' => 'Type', 'description'=>'Description'));
87
+ $data['id'] = $file;
88
+ if (empty($data['name'])) {
89
+ $data['name'] = $file;
90
+ }
91
+ if (empty($data['type'])) {
92
+ $data['type'] = 'standard';
93
+ }
94
+ $screenshot = $dir . '/' . $file . '/screenshot.png';
95
+ if (is_file($screenshot)) {
96
+ $data['screenshot'] = $this->get_theme_url($file) . '/screenshot.png';
97
+ } else {
98
+ $data['screenshot'] = plugins_url('newsletter') . '/images/theme-screenshot.png';
99
+ }
100
+ $list[$file] = $data;
101
+ }
102
+ closedir($handle);
103
+ }
104
+
105
+ if (!$this->is_extension) {
106
+ $dir = NEWSLETTER_DIR . '/' . $this->module . '/themes';
107
+ $handle = @opendir($dir);
108
+
109
+ if ($handle !== false) {
110
+ while ($file = readdir($handle)) {
111
+ if ($file == '.' || $file == '..') {
112
+ continue;
113
+ }
114
+ if (!is_file($dir . '/' . $file . '/theme.php')) {
115
+ continue;
116
+ }
117
+ $data = get_file_data($dir . '/' . $file . '/theme.php', array('name' => 'Name', 'type' => 'Type', 'description'=>'Description'));
118
+ $data['id'] = $file;
119
+ if (empty($data['name'])) {
120
+ $data['name'] = $file;
121
+ }
122
+ if (empty($data['type'])) {
123
+ $data['type'] = 'standard';
124
+ }
125
+ $screenshot = $dir . '/' . $file . '/screenshot.png';
126
+ if (is_file($screenshot)) {
127
+ $data['screenshot'] = $this->get_theme_url($file) . '/screenshot.png';
128
+ } else {
129
+ $data['screenshot'] = plugins_url('newsletter') . '/images/theme-screenshot.png';
130
+ }
131
+ $list[$file] = $data;
132
+ }
133
+ closedir($handle);
134
+ }
135
+ }
136
+
137
+ usort($list, array($this, "themescmp"));
138
+
139
+ return $list;
140
+ }
141
+
142
+ /**
143
+ *
144
+ * @param type $theme
145
+ * @param type $options
146
+ * @param type $module
147
+ */
148
+ function save_options($theme, &$options) {
149
+ add_option('newsletter_' . $this->module . '_theme_' . $theme, array(), null, 'no');
150
+ $theme_options = array();
151
+ foreach ($options as $key => &$value) {
152
+ if (substr($key, 0, 6) != 'theme_')
153
+ continue;
154
+ $theme_options[$key] = $value;
155
+ }
156
+ update_option('newsletter_' . $this->module . '_theme_' . $theme, $theme_options);
157
+ }
158
+
159
+ function get_options($theme) {
160
+ $options = get_option('newsletter_' . $this->module . '_theme_' . $theme);
161
+ // To avoid merge problems.
162
+ if (!is_array($options)) {
163
+ return array();
164
+ }
165
+ return $options;
166
+ }
167
+
168
+ function get_file_path($theme, $file) {
169
+ $path = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes/' . $theme . '/' . $file;
170
+ if (is_file($path)) {
171
+ return $path;
172
+ } else {
173
+ return NEWSLETTER_DIR . '/' . $this->module . '/themes/' . $theme . '/' . $file;
174
+ }
175
+ }
176
+
177
+ function get_theme_url($theme) {
178
+ if ($this->is_extension) {
179
+ return WP_CONTENT_URL . '/extensions/newsletter/' . $this->module . '/themes/' . $theme;
180
+ }
181
+
182
+ $path = NEWSLETTER_DIR . '/' . $this->module . '/themes/' . $theme;
183
+ if (is_dir($path)) {
184
+ return plugins_url('newsletter') . '/' . $this->module . '/themes/' . $theme;
185
+ } else {
186
+ return WP_CONTENT_URL . '/extensions/newsletter/' . $this->module . '/themes/' . $theme;
187
+ }
188
+ }
189
+
190
+ function get_default_options() {
191
+ if ($this->is_extension) {
192
+ $path2 = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes/' . $theme . '/languages';
193
+ @include $path2 . '/en_US.php';
194
+ @include $path2 . '/' . WPLANG . '.php';
195
+ } else {
196
+ $path1 = NEWSLETTER_DIR . '/' . $this->module . '/themes/' . $theme . '/languages';
197
+ $path2 = WP_CONTENT_DIR . '/extensions/newsletter/' . $this->module . '/themes/' . $theme . '/languages';
198
+ @include $path1 . '/en_US.php';
199
+ @include $path2 . '/en_US.php';
200
+ @include $path1 . '/' . WPLANG . '.php';
201
+ @include $path2 . '/' . WPLANG . '.php';
202
+ }
203
+
204
+ if (!is_array($options))
205
+ return array();
206
+ return $options;
207
+ }
208
+
209
+ }
210
+
211
+ function nt_option($name, $def = null) {
212
+ $options = get_option('newsletter_email');
213
+ $option = $options['theme_' . $name];
214
+ if (!isset($option))
215
+ return $def;
216
+ else
217
+ return $option;
218
+ }
lock/index.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterLock::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterLock::instance();
lock/lock.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
4
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
5
 
main/diagnostic.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $module = Newsletter::instance();
4
  $controls = new NewsletterControls();
@@ -167,6 +169,31 @@ if (count($calls) > 1) {
167
  }
168
  $mean = $mean / count($calls) - 1;
169
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
170
  ?>
171
 
172
  <div class="wrap" id="tnp-wrap">
@@ -266,7 +293,7 @@ if (count($calls) > 1) {
266
  Log secret
267
  </td>
268
  <td>
269
- <code><?php echo get_option("newsletter_logger_secret")?></code>
270
  </td>
271
  </tr>
272
  </tbody>
@@ -305,7 +332,7 @@ if (count($calls) > 1) {
305
  ?>
306
 
307
  <p class="description">
308
- Should be less than <?php echo NEWSLETTER_CRON_INTERVAL; ?> seconds.
309
  <a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-delivery-engine" target="_blank">Read more</a>.
310
  </p>
311
 
@@ -337,10 +364,10 @@ if (count($calls) > 1) {
337
  } else {
338
  $found = false;
339
 
340
- foreach ($schedules as $key => &$data) {
341
  if ($key == 'newsletter')
342
  $found = true;
343
- echo $key . ' - ' . $data['interval'] . ' s<br>';
344
  }
345
 
346
  if (!$found) {
@@ -370,7 +397,39 @@ if (count($calls) > 1) {
370
  <p class="description">Samples are collected in a maximum number of <?php echo Newsletter::MAX_CRON_SAMPLES; ?></p>
371
  </td>
372
  </tr>
373
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
374
  </tbody>
375
  </table>
376
 
@@ -474,9 +533,9 @@ if (count($calls) > 1) {
474
  foreach ($filter as &$entry) {
475
  echo '<li>';
476
  if (is_array($entry['function']))
477
- echo get_class($entry['function'][0]) . '->' . $entry['function'][1];
478
  else
479
- echo $entry['function'];
480
  echo '</li>';
481
  }
482
  }
@@ -510,7 +569,7 @@ if (count($calls) > 1) {
510
  <tr>
511
  <td>Absolute path</td>
512
  <td>
513
- <?php echo ABSPATH; ?>
514
  </td>
515
  </tr>
516
  <tr>
@@ -525,24 +584,7 @@ if (count($calls) > 1) {
525
  <?php echo DB_CHARSET; ?> <?php echo DB_COLLATE; ?>
526
  </td>
527
  </tr>
528
- <tr>
529
- <td>Action file accessibility (obsolete)</td>
530
- <td>
531
- <?php
532
- $res = wp_remote_get(plugins_url('newsletter') . '/do/subscribe.php?test=1');
533
- if (is_wp_error($res)) {
534
- echo 'It seems the Newsletter action files are not reachable. See the note and the file permission check below.';
535
- } else {
536
- echo 'OK';
537
- }
538
- ?>
539
- <p class="description">
540
- If this internal test fails, subscription, confirmation and so on could fail. Try to open
541
- <a href="<?php echo plugins_url('newsletter') . '/do/subscribe.php?test=1' ?>" target="_blank">this link</a>: if
542
- it reports "ok", consider this test as passed.
543
- </p>
544
- </td>
545
- </tr>
546
  <tr>
547
  <td>File permissions (obsolete)</td>
548
  <td>
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $module = Newsletter::instance();
6
  $controls = new NewsletterControls();
169
  }
170
  $mean = $mean / count($calls) - 1;
171
  }
172
+
173
+ // Send calls stats
174
+ $send_calls = get_option('newsletter_diagnostic_send_calls', array());
175
+ if (count($send_calls)) {
176
+ $send_max = 0;
177
+ $send_min = PHP_INT_MAX;
178
+ $send_total_time = 0;
179
+ $send_total_emails = 0;
180
+ $send_completed = 0;
181
+ for ($i = 0; $i < count($send_calls); $i++) {
182
+ $delta = $send_calls[$i][1] - $send_calls[$i][0];
183
+ $send_total_time += $delta;
184
+ $send_total_emails += $send_calls[$i][2];
185
+ $send_mean = $delta / $send_calls[$i][2];
186
+ if ($send_min > $send_mean) {
187
+ $send_min = $send_mean;
188
+ }
189
+ if ($send_max < $send_mean) {
190
+ $send_max = $send_mean;
191
+ }
192
+ if ($send_calls[$i][3]) $send_completed++;
193
+ }
194
+ $send_mean = $send_total_time / $send_total_emails;
195
+ }
196
+
197
  ?>
198
 
199
  <div class="wrap" id="tnp-wrap">
293
  Log secret
294
  </td>
295
  <td>
296
+ <code><?php echo esc_html(get_option("newsletter_logger_secret"))?></code>
297
  </td>
298
  </tr>
299
  </tbody>
332
  ?>
333
 
334
  <p class="description">
335
+ Should be less than <?php echo esc_html(NEWSLETTER_CRON_INTERVAL) ?> seconds.
336
  <a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-delivery-engine" target="_blank">Read more</a>.
337
  </p>
338
 
364
  } else {
365
  $found = false;
366
 
367
+ foreach ($schedules as $key => $data) {
368
  if ($key == 'newsletter')
369
  $found = true;
370
+ echo esc_html($key . ' - ' . $data['interval']) . ' s<br>';
371
  }
372
 
373
  if (!$found) {
397
  <p class="description">Samples are collected in a maximum number of <?php echo Newsletter::MAX_CRON_SAMPLES; ?></p>
398
  </td>
399
  </tr>
400
+
401
+ <tr>
402
+ <td>Sending statistics</td>
403
+ <td>
404
+
405
+ <?php if (!$send_calls) { ?>
406
+ <em>Still not enough data.</em>
407
+ <?php } else { ?>
408
+ Average time to send an email: <?php echo sprintf("%.2f", $send_mean) ?> seconds<br>
409
+ Max mean time measured: <?php echo $send_max ?> seconds<br>
410
+ Min mean time measured: <?php echo $send_min ?> seconds<br>
411
+ Total emails: <?php echo $send_total_emails ?><br>
412
+ Batches prematurely interrupted: <?php echo sprintf("%.2f", (count($send_calls)-$send_completed)*100.0/count($send_calls)) ?>%<br>
413
+ Collected batch samples: <?php echo count($send_calls); ?><br>
414
+ <?php } ?>
415
+ </td>
416
+ </tr>
417
+ <tr>
418
+ <td>WP transients</td>
419
+ <td>
420
+ <?php
421
+ $result = true;
422
+ set_transient('newsletter_transient_test', 1, 300);
423
+ delete_transient('newsletter_transient_test');
424
+ if (get_transient('newsletter_transient_test')){
425
+ echo 'Transients cannot be delete!';
426
+ } else {
427
+ echo 'OK';
428
+ }
429
+ ?>
430
+ </td>
431
+ </tr>
432
+
433
  </tbody>
434
  </table>
435
 
533
  foreach ($filter as &$entry) {
534
  echo '<li>';
535
  if (is_array($entry['function']))
536
+ echo esc_html(get_class($entry['function'][0]) . '->' . $entry['function'][1]);
537
  else
538
+ echo esc_html($entry['function']);
539
  echo '</li>';
540
  }
541
  }
569
  <tr>
570
  <td>Absolute path</td>
571
  <td>
572
+ <?php echo esc_html(ABSPATH); ?>
573
  </td>
574
  </tr>
575
  <tr>
584
  <?php echo DB_CHARSET; ?> <?php echo DB_COLLATE; ?>
585
  </td>
586
  </tr>
587
+
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
588
  <tr>
589
  <td>File permissions (obsolete)</td>
590
  <td>
main/index.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
 
4
  $controls = new NewsletterControls();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
 
6
  $controls = new NewsletterControls();
main/info.php CHANGED
@@ -1,191 +1,193 @@
1
- <?php
2
- @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
- $module = Newsletter::instance();
4
- $controls = new NewsletterControls();
5
-
6
- if (!$controls->is_action()) {
7
- $controls->data = get_option('newsletter_main');
8
- } else {
9
-
10
- if ($controls->is_action('save')) {
11
- $module->merge_options($controls->data);
12
- $controls->messages .= 'Saved.';
13
- }
14
- }
15
- ?>
16
-
17
- <div class="wrap" id="tnp-wrap">
18
-
19
- <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
20
-
21
- <div id="tnp-heading">
22
-
23
- <h2><?php _e('Company Info', 'newsletter') ?></h2>
24
- <p>
25
- These informations are used by Newsletter themes to automatically generate some sections of regular newsletters,
26
- <a href="http://www.thenewsletterplugin.com/feed-by-mail-extension?utm_source=plugin&utm_medium=link&utm_campaign=newsletter-feed" target="_blank">
27
- auto messages
28
- </a> and
29
- <a href="http://www.thenewsletterplugin.com/plugins/newsletter/follow-up-module?utm_source=plugin&utm_medium=link&utm_campaign=newsletter-followup" target="_blank">
30
- follow-up mails
31
- </a>.
32
- Themes may not use all these fields and/or have specific alternate configurations. All fields are <strong>optional</strong>.
33
- </p>
34
-
35
- </div>
36
- <div id="tnp-body">
37
-
38
- <form method="post" action="">
39
- <?php $controls->init(); ?>
40
-
41
- <div id="tabs">
42
-
43
- <ul>
44
- <li><a href="#tabs-general"><?php _e('General', 'newsletter') ?></a></li>
45
- <li><a href="#tabs-social"><?php _e('Social', 'newsletter') ?></a></li>
46
- </ul>
47
-
48
- <div id="tabs-general">
49
- <h3>Header Settings</h3>
50
-
51
- <table class="form-table">
52
- <tr valign="top">
53
- <th>
54
- Logo
55
- <div class="tnp-tip">
56
- <span class="tip-button">Tip</span>
57
- <span class="tip-content">
58
- Keep the file lightweight and ideally smaller than 500px in width and 200px in height.
59
- Remember that .png images provide best performances with text and shapes logos.
60
- </span>
61
- </div>
62
- </th>
63
- <td>
64
- <?php $controls->media('header_logo', 'medium'); ?>
65
- <p class="description">
66
- Click to change. This should be your logo in .png or .jpg format.
67
- </p>
68
- </td>
69
- </tr>
70
- <tr>
71
- <th>Title</th>
72
- <td>
73
- <?php $controls->text('header_title', 40); ?>
74
- <p class="description">Appears only when no logo has been uploaded or when it's blocked by email clients.</p>
75
- </td>
76
- </tr>
77
- <tr>
78
- <th>Subtitle</th>
79
- <td>
80
- <?php $controls->text('header_sub', 40); ?>
81
- <p class="description">Appears only if present.</p>
82
- </td>
83
- </tr>
84
- </table>
85
-
86
- <h3>Footer Settings</h3>
87
-
88
- <table class="form-table">
89
- <tr valign="top">
90
- <th>Blog or company name</th>
91
- <td>
92
- <?php $controls->text('footer_title', 40); ?>
93
- <p class="description">
94
- User or corporation name to be displayed on the newsletter footer.
95
- </p>
96
- </td>
97
- </tr>
98
- <tr valign="top">
99
- <th>Address</th>
100
- <td>
101
- <?php $controls->text('footer_contact', 40); ?>
102
- <p class="description">
103
- Your real address, if available. The CAN-SPAM Act requires it.
104
- </p>
105
- </td>
106
- </tr>
107
- <tr>
108
- <th>Copyright, privacy or legal text</th>
109
- <td>
110
- <?php $controls->text('footer_legal', 40); ?>
111
- <p class="description">
112
- Any copyright, privacy or legal text you want on the newsletter footer.
113
- </p>
114
- </td>
115
- </tr>
116
- </table>
117
- </div>
118
- <div id="tabs-social">
119
- <h3>Social Settings</h3>
120
-
121
- <p>Social icons will be added automatically to your newsletter only for set URLs.</p>
122
-
123
- <table class="form-table">
124
- <tr valign="top">
125
- <th>Facebook</th>
126
- <td>
127
- <?php $controls->text('facebook_url', 40); ?>
128
- <p class="description">
129
- Your Facebook url (e.g. https://www.facebook.com/thenewsletterplugin)
130
- </p>
131
- </td>
132
- </tr>
133
- <tr valign="top">
134
- <th>Google+</th>
135
- <td>
136
- <?php $controls->text('googleplus_url', 40); ?>
137
- <p class="description">
138
- Your Google+ url (e.g. https://plus.google.com/...)
139
- </p>
140
- </td>
141
- </tr>
142
- <tr valign="top">
143
- <th>Twitter</th>
144
- <td>
145
- <?php $controls->text('twitter_url', 40); ?>
146
- <p class="description">
147
- Your Twitter url (e.g. https://twitter.com/...)
148
- </p>
149
- </td>
150
- </tr>
151
- <tr valign="top">
152
- <th>Linkedin</th>
153
- <td>
154
- <?php $controls->text('linkedin_url', 40); ?>
155
- <p class="description">
156
- Your Linkedin url (e.g. https://www.linkedin.com/in/...)
157
- </p>
158
- </td>
159
- </tr>
160
- <tr valign="top">
161
- <th>YouTube</th>
162
- <td>
163
- <?php $controls->text('youtube_url', 40); ?>
164
- <p class="description">
165
- Your YouTube url (e.g. https://www.youtube.com/channel/...)
166
- </p>
167
- </td>
168
- </tr>
169
- <tr valign="top">
170
- <th>Vimeo</th>
171
- <td>
172
- <?php $controls->text('vimeo_url', 40); ?>
173
- <p class="description">
174
- Your Vimeo url (e.g. http://vimeo.com/...)
175
- </p>
176
- </td>
177
- </tr>
178
- </table>
179
- </div>
180
- </div>
181
-
182
- <p>
183
- <?php $controls->button('save', 'Save'); ?>
184
- </p>
185
-
186
- </form>
187
- </div>
188
-
189
- <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
190
-
191
- </div>
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
+ @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
+ $module = Newsletter::instance();
6
+ $controls = new NewsletterControls();
7
+
8
+ if (!$controls->is_action()) {
9
+ $controls->data = get_option('newsletter_main');
10
+ } else {
11
+
12
+ if ($controls->is_action('save')) {
13
+ $module->merge_options($controls->data);
14
+ $controls->messages .= 'Saved.';
15
+ }
16
+ }
17
+ ?>
18
+
19
+ <div class="wrap" id="tnp-wrap">
20
+
21
+ <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
22
+
23
+ <div id="tnp-heading">
24
+
25
+ <h2><?php _e('Company Info', 'newsletter') ?></h2>
26
+ <p>
27
+ These informations are used by Newsletter themes to automatically generate some sections of regular newsletters,
28
+ <a href="http://www.thenewsletterplugin.com/feed-by-mail-extension?utm_source=plugin&utm_medium=link&utm_campaign=newsletter-feed" target="_blank">
29
+ auto messages
30
+ </a> and
31
+ <a href="http://www.thenewsletterplugin.com/plugins/newsletter/follow-up-module?utm_source=plugin&utm_medium=link&utm_campaign=newsletter-followup" target="_blank">
32
+ follow-up mails
33
+ </a>.
34
+ Themes may not use all these fields and/or have specific alternate configurations. All fields are <strong>optional</strong>.
35
+ </p>
36
+
37
+ </div>
38
+ <div id="tnp-body">
39
+
40
+ <form method="post" action="">
41
+ <?php $controls->init(); ?>
42
+
43
+ <div id="tabs">
44
+
45
+ <ul>
46
+ <li><a href="#tabs-general"><?php _e('General', 'newsletter') ?></a></li>
47
+ <li><a href="#tabs-social"><?php _e('Social', 'newsletter') ?></a></li>
48
+ </ul>
49
+
50
+ <div id="tabs-general">
51
+ <h3>Header Settings</h3>
52
+
53
+ <table class="form-table">
54
+ <tr valign="top">
55
+ <th>
56
+ Logo
57
+ <div class="tnp-tip">
58
+ <span class="tip-button">Tip</span>
59
+ <span class="tip-content">
60
+ Keep the file lightweight and ideally smaller than 500px in width and 200px in height.
61
+ Remember that .png images provide best performances with text and shapes logos.
62
+ </span>
63
+ </div>
64
+ </th>
65
+ <td>
66
+ <?php $controls->media('header_logo', 'medium'); ?>
67
+ <p class="description">
68
+ Click to change. This should be your logo in .png or .jpg format.
69
+ </p>
70
+ </td>
71
+ </tr>
72
+ <tr>
73
+ <th>Title</th>
74
+ <td>
75
+ <?php $controls->text('header_title', 40); ?>
76
+ <p class="description">Appears only when no logo has been uploaded or when it's blocked by email clients.</p>
77
+ </td>
78
+ </tr>
79
+ <tr>
80
+ <th>Subtitle</th>
81
+ <td>
82
+ <?php $controls->text('header_sub', 40); ?>
83
+ <p class="description">Appears only if present.</p>
84
+ </td>
85
+ </tr>
86
+ </table>
87
+
88
+ <h3>Footer Settings</h3>
89
+
90
+ <table class="form-table">
91
+ <tr valign="top">
92
+ <th>Blog or company name</th>
93
+ <td>
94
+ <?php $controls->text('footer_title', 40); ?>
95
+ <p class="description">
96
+ User or corporation name to be displayed on the newsletter footer.
97
+ </p>
98
+ </td>
99
+ </tr>
100
+ <tr valign="top">
101
+ <th>Address</th>
102
+ <td>
103
+ <?php $controls->text('footer_contact', 40); ?>
104
+ <p class="description">
105
+ Your real address, if available. The CAN-SPAM Act requires it.
106
+ </p>
107
+ </td>
108
+ </tr>
109
+ <tr>
110
+ <th>Copyright, privacy or legal text</th>
111
+ <td>
112
+ <?php $controls->text('footer_legal', 40); ?>
113
+ <p class="description">
114
+ Any copyright, privacy or legal text you want on the newsletter footer.
115
+ </p>
116
+ </td>
117
+ </tr>
118
+ </table>
119
+ </div>
120
+ <div id="tabs-social">
121
+ <h3>Social Settings</h3>
122
+
123
+ <p>Social icons will be added automatically to your newsletter only for set URLs.</p>
124
+
125
+ <table class="form-table">
126
+ <tr valign="top">
127
+ <th>Facebook</th>
128
+ <td>
129
+ <?php $controls->text('facebook_url', 40); ?>
130
+ <p class="description">
131
+ Your Facebook url (e.g. https://www.facebook.com/thenewsletterplugin)
132
+ </p>
133
+ </td>
134
+ </tr>
135
+ <tr valign="top">
136
+ <th>Google+</th>
137
+ <td>
138
+ <?php $controls->text('googleplus_url', 40); ?>
139
+ <p class="description">
140
+ Your Google+ url (e.g. https://plus.google.com/...)
141
+ </p>
142
+ </td>
143
+ </tr>
144
+ <tr valign="top">
145
+ <th>Twitter</th>
146
+ <td>
147
+ <?php $controls->text('twitter_url', 40); ?>
148
+ <p class="description">
149
+ Your Twitter url (e.g. https://twitter.com/...)
150
+ </p>
151
+ </td>
152
+ </tr>
153
+ <tr valign="top">
154
+ <th>Linkedin</th>
155
+ <td>
156
+ <?php $controls->text('linkedin_url', 40); ?>
157
+ <p class="description">
158
+ Your Linkedin url (e.g. https://www.linkedin.com/in/...)
159
+ </p>
160
+ </td>
161
+ </tr>
162
+ <tr valign="top">
163
+ <th>YouTube</th>
164
+ <td>
165
+ <?php $controls->text('youtube_url', 40); ?>
166
+ <p class="description">
167
+ Your YouTube url (e.g. https://www.youtube.com/channel/...)
168
+ </p>
169
+ </td>
170
+ </tr>
171
+ <tr valign="top">
172
+ <th>Vimeo</th>
173
+ <td>
174
+ <?php $controls->text('vimeo_url', 40); ?>
175
+ <p class="description">
176
+ Your Vimeo url (e.g. http://vimeo.com/...)
177
+ </p>
178
+ </td>
179
+ </tr>
180
+ </table>
181
+ </div>
182
+ </div>
183
+
184
+ <p>
185
+ <?php $controls->button('save', 'Save'); ?>
186
+ </p>
187
+
188
+ </form>
189
+ </div>
190
+
191
+ <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
192
+
193
+ </div>
main/main.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = Newsletter::instance();
@@ -280,14 +282,6 @@ if (!empty($controls->data['contract_key'])) {
280
  </p>
281
  </td>
282
  </tr>
283
- <!--
284
- <tr valign="top">
285
- <th>Totally remove this plugin</th>
286
- <td>
287
- <?php $controls->button_confirm('remove', 'Totally remove this plugin', 'Really sure to totally remove this plugin. All data will be lost!'); ?>
288
- </td>
289
- </tr>
290
- -->
291
  </table>
292
 
293
  </div>
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = Newsletter::instance();
282
  </p>
283
  </td>
284
  </tr>
 
 
 
 
 
 
 
 
285
  </table>
286
 
287
  </div>
main/smtp.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $module = Newsletter::instance();
4
  $controls = new NewsletterControls();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $module = Newsletter::instance();
6
  $controls = new NewsletterControls();
main/startup.php CHANGED
@@ -1,161 +1,163 @@
1
- x<?php
2
- @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
-
4
- $controls = new NewsletterControls();
5
-
6
- if ($controls->is_action('feed_enable')) {
7
- delete_option('newsletter_feed_demo_disable');
8
- $controls->messages = 'Feed by Mail demo panels enabled. On next page reload it will show up.';
9
- }
10
-
11
- if ($controls->is_action('feed_disable')) {
12
- update_option('newsletter_feed_demo_disable', 1);
13
- $controls->messages = 'Feed by Mail demo panel disabled. On next page reload it will disappear.';
14
- }
15
- ?>
16
-
17
- <div class="wrap" id="tnp-wrap">
18
-
19
- <?php $help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter'; ?>
20
- <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
21
-
22
- <div id="tnp-heading">
23
-
24
- <h2><?php _e('Quick Startup', 'newsletter') ?></h2>
25
- <p>
26
- With my horrible English, everything can be found starting from <a href="http://www.thenewsletterplugin.com/plugins/newsletter" target="_blank">Newsletter Official page</a>
27
- and every configuration panel has some included documentation just to avoid the most common mistakes.
28
- </p>
29
-
30
- </div>
31
-
32
- <div id="tnp-body" class="tnp-body-lite">
33
-
34
- <?php $controls->show(); ?>
35
- <form method="post" action="">
36
- <?php $controls->init(); ?>
37
-
38
- <h3>Few minutes to get the most out of Newsletter</h3>
39
-
40
- <ol>
41
- <li>
42
- <em>It (should) work!</em> Newsletter <strong>works out of the box</strong>, you should only
43
- <a href="widgets.php"><strong>add the Newsletter Widget</strong></a> to the sidebar and subscriptions will start to get in.
44
- </li>
45
-
46
- <li>
47
- <em>Subscription page.</em> If you feel more confortable with a <strong>subscription page</strong>, let Newsletter create one for you: on
48
- the <a href="admin.php?page=newsletter_subscription_options">subscription configuration panel</a>. You can keep both the
49
- widget and the page, of course.
50
- </li>
51
-
52
- <li>
53
- <em>Translations.</em> The <strong>administrative panels</strong> are only in (my bad) English but any other public
54
- message and label and button can be translated on <a href="admin.php?page=newsletter_subscription_options">subscription configuration panel</a>:
55
- please <strong>explore it</strong>.
56
- </li>
57
-
58
- <li>
59
- <em>More about subscription.</em> The subscription and unsubscription processes to a mailing
60
- list <strong>must be clear</strong> to the blog owner. <a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscription-module" target="_blank">You can find more on thenewsletterplugin.com</a>.
61
- </li>
62
- </ol>
63
-
64
- <h3>Something is not working (it could happen)</h3>
65
-
66
- <ol>
67
- <li>
68
- <em>No emails are sent.</em> This is mostly a problem of your provider. <strong>Make a test</strong> using the instructions you find on
69
- the diagnostic panel.
70
- </li>
71
- <li>
72
- <em>I get a 500/fatal error during subscription.</em> This is mostly a problem of file permissions. On the diagnostic
73
- panel there is a check and on
74
- <a target="_blank" href="http://www.thenewsletterplugin.com/plugins/newsletter/subscription-module#errors">thenewsletterplugin.com there are some solutions</a>.
75
- </li>
76
- </ol>
77
-
78
- <h3>I want to create and send a newsletter</h3>
79
-
80
- <ol>
81
- <li>
82
- <em>I want to create a newsletter.</em> Use the <a href="admin.php?page=newsletter_emails_index">newsletters panel</a>
83
- <strong>choose a theme</strong>, preview, twick it if needed and create your message.
84
- </li>
85
- <li>
86
- <em>I want to test my newsletter.</em> Save the newsletter and move to the
87
- <a href="admin.php?page=newsletter_users_index">subscribers panel</a>.
88
- Create some subscribers manually using your own email addresses and mark them as test subscribers. They will be
89
- used for newsletter tests.
90
- </li>
91
- <li>
92
- <em>I want to send my newsletter.</em> Simple, press the send button. The email is created and put on
93
- <a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-delivery-engine" target="_blank">delivery engine queue</a>.
94
- On newsletter list, it will be shown as "sending".
95
- </li>
96
- <li>
97
- <em>The newsletter is going out too slowly.</em> The <a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-delivery-engine" target="_blank">delivery engine</a> sends
98
- emails as quickly as configured, see the <a href="admin.php?page=newsletter_main_main">main
99
- configuration panel</a>. Look at your provider documentation as well, since it surely has a hourly limit.
100
- </li>
101
- </ol>
102
-
103
- <h3>Extensions</h3>
104
- <p>
105
- Newsletter plugin can be extended with advanced features installing one or more of the
106
- available Professional Extensions you can find on <a href="http://www.thenewsletterplugin.com/downloads" target="_blank">www.thenewsletterplugin.com/downloads</a>.
107
- </p>
108
- <p>
109
- Newsletter Extensions are regular plugins (from version 2.x) and can be managed from the plugin panel of your
110
- once installed for the first time.
111
- </p>
112
-
113
- <h3>Support</h3>
114
- <p>
115
- There are few options to find or ask for support:
116
- </p>
117
- <ul>
118
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter" target="_blank">The official Newsletter page</a> contains information and links to documentation and FAQ</li>
119
- <li><a href="http://www.thenewsletterplugin.com/forums/forum/newsletter-plugin" target="_blank">The official Newsletter forum</a> where to find solutions or create new requests</li>
120
- <li><a href="http://www.thenewsletterplugin.com/tag/newsletter" target="_blank">Newsletter articles and comments</a> are a source of solutions</li>
121
- <li>Only for <a href="http://www.thenewsletterplugin.com/membership" target="_blank">members</a> the <a href="http://www.thenewsletterplugin.com/support-form" target="_blank">support page</a>
122
- <li>Write directly to us at info@thenewsletterplugin.com</li>
123
- </ul>
124
-
125
- <h3>Documentation</h3>
126
- <p>
127
- Below are the pages on www.thenewsletterplugin.com which document Newsletter. Since the site evolves, more pages can be available and
128
- the full list is always up-to-date on main Newsletter page.
129
- </p>
130
-
131
- <ul>
132
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter" target="_blank">Official Newsletter page</a></li>
133
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-configuration" target="_blank">Main configuration</a></li>
134
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-diagnostic" target="_blank">Diagnostic</a></li>
135
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-faq" target="_blank">FAQ</a></li>
136
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-delivery-engine" target="_blank">Delivery Engine</a></li>
137
-
138
-
139
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscription-module" target="_blank">Subscription Module</a></li>
140
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-forms" target="_blank">Subscription Forms</a></li>
141
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-preferences" target="_blank">Subscriber's preferences</a></li>
142
-
143
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletters-module" target="_blank">Newsletters Module</a></li>
144
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-themes" target="_blank">Themes</a></li>
145
-
146
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module" target="_blank">Subscribers Module</a></li>
147
- <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/statistics-module" target="_blank">Statistics Module</a></li>
148
-
149
- <li><a href="http://www.thenewsletterplugin.com/feed-by-mail-extension?utm_source=plugin&utm_medium=link&utm_campaign=newsletter-feed" target="_blank">Feed by Mail Module</a></li>
150
- <!--<li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/follow-up-module" target="_blank">Follow Up Module</a></li>
151
- -->
152
- </ul>
153
-
154
-
155
- </form>
156
-
157
- </div>
158
-
159
- <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
160
-
161
- </div>
 
 
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
+ @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
+
6
+ $controls = new NewsletterControls();
7
+
8
+ if ($controls->is_action('feed_enable')) {
9
+ delete_option('newsletter_feed_demo_disable');
10
+ $controls->messages = 'Feed by Mail demo panels enabled. On next page reload it will show up.';
11
+ }
12
+
13
+ if ($controls->is_action('feed_disable')) {
14
+ update_option('newsletter_feed_demo_disable', 1);
15
+ $controls->messages = 'Feed by Mail demo panel disabled. On next page reload it will disappear.';
16
+ }
17
+ ?>
18
+
19
+ <div class="wrap" id="tnp-wrap">
20
+
21
+ <?php $help_url = 'http://www.thenewsletterplugin.com/plugins/newsletter'; ?>
22
+ <?php include NEWSLETTER_DIR . '/tnp-header.php'; ?>
23
+
24
+ <div id="tnp-heading">
25
+
26
+ <h2><?php _e('Quick Startup', 'newsletter') ?></h2>
27
+ <p>
28
+ With my horrible English, everything can be found starting from <a href="http://www.thenewsletterplugin.com/plugins/newsletter" target="_blank">Newsletter Official page</a>
29
+ and every configuration panel has some included documentation just to avoid the most common mistakes.
30
+ </p>
31
+
32
+ </div>
33
+
34
+ <div id="tnp-body" class="tnp-body-lite">
35
+
36
+ <?php $controls->show(); ?>
37
+ <form method="post" action="">
38
+ <?php $controls->init(); ?>
39
+
40
+ <h3>Few minutes to get the most out of Newsletter</h3>
41
+
42
+ <ol>
43
+ <li>
44
+ <em>It (should) work!</em> Newsletter <strong>works out of the box</strong>, you should only
45
+ <a href="widgets.php"><strong>add the Newsletter Widget</strong></a> to the sidebar and subscriptions will start to get in.
46
+ </li>
47
+
48
+ <li>
49
+ <em>Subscription page.</em> If you feel more confortable with a <strong>subscription page</strong>, let Newsletter create one for you: on
50
+ the <a href="admin.php?page=newsletter_subscription_options">subscription configuration panel</a>. You can keep both the
51
+ widget and the page, of course.
52
+ </li>
53
+
54
+ <li>
55
+ <em>Translations.</em> The <strong>administrative panels</strong> are only in (my bad) English but any other public
56
+ message and label and button can be translated on <a href="admin.php?page=newsletter_subscription_options">subscription configuration panel</a>:
57
+ please <strong>explore it</strong>.
58
+ </li>
59
+
60
+ <li>
61
+ <em>More about subscription.</em> The subscription and unsubscription processes to a mailing
62
+ list <strong>must be clear</strong> to the blog owner. <a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscription-module" target="_blank">You can find more on thenewsletterplugin.com</a>.
63
+ </li>
64
+ </ol>
65
+
66
+ <h3>Something is not working (it could happen)</h3>
67
+
68
+ <ol>
69
+ <li>
70
+ <em>No emails are sent.</em> This is mostly a problem of your provider. <strong>Make a test</strong> using the instructions you find on
71
+ the diagnostic panel.
72
+ </li>
73
+ <li>
74
+ <em>I get a 500/fatal error during subscription.</em> This is mostly a problem of file permissions. On the diagnostic
75
+ panel there is a check and on
76
+ <a target="_blank" href="http://www.thenewsletterplugin.com/plugins/newsletter/subscription-module#errors">thenewsletterplugin.com there are some solutions</a>.
77
+ </li>
78
+ </ol>
79
+
80
+ <h3>I want to create and send a newsletter</h3>
81
+
82
+ <ol>
83
+ <li>
84
+ <em>I want to create a newsletter.</em> Use the <a href="admin.php?page=newsletter_emails_index">newsletters panel</a>
85
+ <strong>choose a theme</strong>, preview, twick it if needed and create your message.
86
+ </li>
87
+ <li>
88
+ <em>I want to test my newsletter.</em> Save the newsletter and move to the
89
+ <a href="admin.php?page=newsletter_users_index">subscribers panel</a>.
90
+ Create some subscribers manually using your own email addresses and mark them as test subscribers. They will be
91
+ used for newsletter tests.
92
+ </li>
93
+ <li>
94
+ <em>I want to send my newsletter.</em> Simple, press the send button. The email is created and put on
95
+ <a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-delivery-engine" target="_blank">delivery engine queue</a>.
96
+ On newsletter list, it will be shown as "sending".
97
+ </li>
98
+ <li>
99
+ <em>The newsletter is going out too slowly.</em> The <a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-delivery-engine" target="_blank">delivery engine</a> sends
100
+ emails as quickly as configured, see the <a href="admin.php?page=newsletter_main_main">main
101
+ configuration panel</a>. Look at your provider documentation as well, since it surely has a hourly limit.
102
+ </li>
103
+ </ol>
104
+
105
+ <h3>Extensions</h3>
106
+ <p>
107
+ Newsletter plugin can be extended with advanced features installing one or more of the
108
+ available Professional Extensions you can find on <a href="http://www.thenewsletterplugin.com/downloads" target="_blank">www.thenewsletterplugin.com/downloads</a>.
109
+ </p>
110
+ <p>
111
+ Newsletter Extensions are regular plugins (from version 2.x) and can be managed from the plugin panel of your
112
+ once installed for the first time.
113
+ </p>
114
+
115
+ <h3>Support</h3>
116
+ <p>
117
+ There are few options to find or ask for support:
118
+ </p>
119
+ <ul>
120
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter" target="_blank">The official Newsletter page</a> contains information and links to documentation and FAQ</li>
121
+ <li><a href="http://www.thenewsletterplugin.com/forums/forum/newsletter-plugin" target="_blank">The official Newsletter forum</a> where to find solutions or create new requests</li>
122
+ <li><a href="http://www.thenewsletterplugin.com/tag/newsletter" target="_blank">Newsletter articles and comments</a> are a source of solutions</li>
123
+ <li>Only for <a href="http://www.thenewsletterplugin.com/membership" target="_blank">members</a> the <a href="http://www.thenewsletterplugin.com/support-form" target="_blank">support page</a>
124
+ <li>Write directly to us at info@thenewsletterplugin.com</li>
125
+ </ul>
126
+
127
+ <h3>Documentation</h3>
128
+ <p>
129
+ Below are the pages on www.thenewsletterplugin.com which document Newsletter. Since the site evolves, more pages can be available and
130
+ the full list is always up-to-date on main Newsletter page.
131
+ </p>
132
+
133
+ <ul>
134
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter" target="_blank">Official Newsletter page</a></li>
135
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-configuration" target="_blank">Main configuration</a></li>
136
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-diagnostic" target="_blank">Diagnostic</a></li>
137
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-faq" target="_blank">FAQ</a></li>
138
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-delivery-engine" target="_blank">Delivery Engine</a></li>
139
+
140
+
141
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscription-module" target="_blank">Subscription Module</a></li>
142
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-forms" target="_blank">Subscription Forms</a></li>
143
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-preferences" target="_blank">Subscriber's preferences</a></li>
144
+
145
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletters-module" target="_blank">Newsletters Module</a></li>
146
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/newsletter-themes" target="_blank">Themes</a></li>
147
+
148
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/subscribers-module" target="_blank">Subscribers Module</a></li>
149
+ <li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/statistics-module" target="_blank">Statistics Module</a></li>
150
+
151
+ <li><a href="http://www.thenewsletterplugin.com/feed-by-mail-extension?utm_source=plugin&utm_medium=link&utm_campaign=newsletter-feed" target="_blank">Feed by Mail Module</a></li>
152
+ <!--<li><a href="http://www.thenewsletterplugin.com/plugins/newsletter/follow-up-module" target="_blank">Follow Up Module</a></li>
153
+ -->
154
+ </ul>
155
+
156
+
157
+ </form>
158
+
159
+ </div>
160
+
161
+ <?php include NEWSLETTER_DIR . '/tnp-footer.php'; ?>
162
+
163
+ </div>
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: http://www.thenewsletterplugin.com/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.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
- Version: 4.6.1
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: http://www.thenewsletterplugin.com
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
@@ -14,7 +14,7 @@
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
- define('NEWSLETTER_VERSION', '4.6.1');
18
 
19
  global $wpdb, $newsletter;
20
 
@@ -126,6 +126,11 @@ class Newsletter extends NewsletterModule {
126
  if (isset($_POST['na'])) {
127
  $this->action = $_POST['na'];
128
  }
 
 
 
 
 
129
 
130
  $this->time_start = time();
131
 
@@ -476,8 +481,8 @@ class Newsletter extends NewsletterModule {
476
  }
477
  }
478
 
479
- function relink($text, $email_id, $user_id) {
480
- return NewsletterStatistics::instance()->relink($text, $email_id, $user_id);
481
  }
482
 
483
  /**
@@ -544,12 +549,18 @@ class Newsletter extends NewsletterModule {
544
  return true;
545
  }
546
  }
 
 
 
 
547
 
548
- foreach ($users as &$user) {
549
 
550
  // Before try to send, check the limits.
551
- if (!$test && $this->limits_exceeded())
552
- return false;
 
 
553
 
554
  $headers = array('List-Unsubscribe' => '<' . home_url('/') . '?na=u&nk=' . $user->id . '-' . $user->token . '>');
555
  $headers['Precedence'] = 'bulk';
@@ -565,7 +576,7 @@ class Newsletter extends NewsletterModule {
565
 
566
 
567
  if ($email->track == 1) {
568
- $m = $this->relink($m, $email->id, $user->id);
569
  }
570
 
571
  $s = $this->replace($email->subject, $user);
@@ -589,9 +600,18 @@ class Newsletter extends NewsletterModule {
589
  $wpdb->query($wpdb->prepare("insert into " . $wpdb->prefix . 'newsletter_sent (user_id, email_id, time, status, error) values (%d, %d, %d, %d, %s) on duplicate key update time=%d, status=%d, error=%s', $user->id, $email->id, time(), $status, $this->mail_last_error, time(), $status, $this->mail_last_error));
590
 
591
  $this->email_limit--;
 
592
  }
 
 
 
 
 
 
 
 
593
 
594
- return true;
595
  }
596
 
597
  /**
@@ -1232,6 +1252,11 @@ class Newsletter extends NewsletterModule {
1232
  }
1233
 
1234
  function save_email($email, $return_format = OBJECT) {
 
 
 
 
 
1235
  return $this->store->save(NEWSLETTER_EMAILS_TABLE, $email, $return_format);
1236
  }
1237
 
@@ -1414,12 +1439,6 @@ require_once NEWSLETTER_DIR . '/wp/wp.php';
1414
  if (!is_dir(WP_PLUGIN_DIR . '/newsletter-feed')) {
1415
  if (is_file(WP_CONTENT_DIR . '/extensions/newsletter/feed/feed.php')) {
1416
  require_once WP_CONTENT_DIR . '/extensions/newsletter/feed/feed.php';
1417
- } else {
1418
- if (get_option('newsletter_feed_demo_disable') != 1) {
1419
- if (is_file(NEWSLETTER_DIR . '/feed/feed.php')) {
1420
- require_once NEWSLETTER_DIR . '/feed/feed.php';
1421
- }
1422
- }
1423
  }
1424
  }
1425
 
4
  Plugin Name: Newsletter
5
  Plugin URI: http://www.thenewsletterplugin.com/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.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
+ Version: 4.6.2
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: http://www.thenewsletterplugin.com
10
  Disclaimer: Use at your own risk. No warranty expressed or implied is provided.
14
  */
15
 
16
  // Used as dummy parameter on css and js links
17
+ define('NEWSLETTER_VERSION', '4.6.2');
18
 
19
  global $wpdb, $newsletter;
20
 
126
  if (isset($_POST['na'])) {
127
  $this->action = $_POST['na'];
128
  }
129
+
130
+ if (!empty($this->action)) {
131
+ // For old versions of wp super cache
132
+ $_GET['preview'] = 'true';
133
+ }
134
 
135
  $this->time_start = time();
136
 
481
  }
482
  }
483
 
484
+ function relink($text, $email_id, $user_id, $email_token = '') {
485
+ return NewsletterStatistics::instance()->relink($text, $email_id, $user_id, $email_token);
486
  }
487
 
488
  /**
549
  return true;
550
  }
551
  }
552
+
553
+ $start_time = time();
554
+ $count = 0;
555
+ $result = true;
556
 
557
+ foreach ($users as $user) {
558
 
559
  // Before try to send, check the limits.
560
+ if (!$test && $this->limits_exceeded()) {
561
+ $result = false;
562
+ break;
563
+ }
564
 
565
  $headers = array('List-Unsubscribe' => '<' . home_url('/') . '?na=u&nk=' . $user->id . '-' . $user->token . '>');
566
  $headers['Precedence'] = 'bulk';
576
 
577
 
578
  if ($email->track == 1) {
579
+ $m = $this->relink($m, $email->id, $user->id, $email->token);
580
  }
581
 
582
  $s = $this->replace($email->subject, $user);
600
  $wpdb->query($wpdb->prepare("insert into " . $wpdb->prefix . 'newsletter_sent (user_id, email_id, time, status, error) values (%d, %d, %d, %d, %s) on duplicate key update time=%d, status=%d, error=%s', $user->id, $email->id, time(), $status, $this->mail_last_error, time(), $status, $this->mail_last_error));
601
 
602
  $this->email_limit--;
603
+ $count++;
604
  }
605
+ $end_time = time();
606
+
607
+ $send_calls = get_option('newsletter_diagnostic_send_calls', array());
608
+ $send_calls[] = array($start_time, $end_time, $count, $result);
609
+
610
+ if (count($send_calls) > self::MAX_CRON_SAMPLES) array_shift($send_calls);
611
+
612
+ update_option('newsletter_diagnostic_send_calls', $send_calls, false);
613
 
614
+ return $result;
615
  }
616
 
617
  /**
1252
  }
1253
 
1254
  function save_email($email, $return_format = OBJECT) {
1255
+ if (isset($email['subject'])) {
1256
+ if (mb_strlen($email['subject'], 'UTF-8') > 250) {
1257
+ $email['subject'] = mb_substr($email['subject'], 0, 250, 'UTF-8');
1258
+ }
1259
+ }
1260
  return $this->store->save(NEWSLETTER_EMAILS_TABLE, $email, $return_format);
1261
  }
1262
 
1439
  if (!is_dir(WP_PLUGIN_DIR . '/newsletter-feed')) {
1440
  if (is_file(WP_CONTENT_DIR . '/extensions/newsletter/feed/feed.php')) {
1441
  require_once WP_CONTENT_DIR . '/extensions/newsletter/feed/feed.php';
 
 
 
 
 
 
1442
  }
1443
  }
1444
 
readme.txt CHANGED
@@ -77,6 +77,13 @@ Thank you, The Newsletter Team
77
 
78
  == Changelog ==
79
 
 
 
 
 
 
 
 
80
  = 4.6.1 =
81
 
82
  * Fixed a security issue on admin side only exploitable by logged in admins
77
 
78
  == Changelog ==
79
 
80
+ = 4.6.2 =
81
+
82
+ * Fixed the import option "override status" not working in update mode
83
+ * Fixed the missing http when the couldflare plugin is installed (!)
84
+ * Improved controls and security on open tracking link
85
+ * Added few new diagnostic parameters
86
+
87
  = 4.6.1 =
88
 
89
  * Fixed a security issue on admin side only exploitable by logged in admins
statistics/index.php CHANGED
@@ -1,5 +1,7 @@
1
  <?php
2
  /* @var $wpdb wpdb */
 
 
3
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
4
  $module = NewsletterStatistics::instance();
5
  $controls = new NewsletterControls();
1
  <?php
2
  /* @var $wpdb wpdb */
3
+ if (!defined('ABSPATH')) exit;
4
+
5
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
6
  $module = NewsletterStatistics::instance();
7
  $controls = new NewsletterControls();
statistics/link.php DELETED
@@ -1,69 +0,0 @@
1
- <?php
2
- global $wpdb;
3
-
4
- if (!defined('ABSPATH')) {
5
- include '../../../../wp-load.php';
6
- }
7
- list($email_id, $user_id, $url, $anchor, $key) = explode(';', base64_decode($_GET['r']), 5);
8
-
9
- if (!is_user_logged_in()) {
10
- if (empty($email_id) || empty($user_id) || empty($url)) {
11
- header("HTTP/1.0 404 Not Found");
12
- die();
13
- }
14
- }
15
-
16
- $parts = parse_url($url);
17
- //die($url);
18
- $verified = $parts['host'] == $_SERVER['HTTP_HOST'];
19
- if (!$verified) {
20
- $options = NewsletterStatistics::instance()->options;
21
- $verified = $key == md5($email_id . ';' . $user_id . ';' . $url . ';' . $anchor . $options['key']);
22
- }
23
-
24
- // For feed by mail tests
25
- if ($verified && empty($email_id) && is_user_logged_in()) {
26
- header('Location: ' . $url);
27
- die();
28
- }
29
-
30
- $ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] );
31
-
32
- if ($verified) {
33
- $wpdb->insert(NEWSLETTER_STATS_TABLE, array(
34
- 'email_id' => $email_id,
35
- 'user_id' => $user_id,
36
- 'url' => $url,
37
- //'anchor' => $anchor,
38
- 'ip' => $ip
39
- )
40
- );
41
-
42
- $wpdb->query($wpdb->prepare("update " . NEWSLETTER_SENT_TABLE . " set open=2, ip=%s where email_id=%d and user_id=%d limit 1", $ip, $email_id, $user_id));
43
-
44
- $user = Newsletter::instance()->get_user($user_id);
45
- if ($user) {
46
- setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
47
- }
48
- header('Location: ' . $url);
49
- die();
50
- } else {
51
- header("HTTP/1.0 404 Not Found");
52
- //header('Location: ' . home_url());
53
- //die();
54
- }
55
- ?><html>
56
- <head>
57
- <style>
58
- body {
59
- font-family: sans-serif;
60
- }
61
- </style>
62
- </head>
63
- <body>
64
- <div style="max-width: 100%; width: 500px; margin: 40px auto; text-align: center">
65
- <p>The requested URL (<?php echo esc_html($url) ?>) has not been verified.</p>
66
- <p>You can follow it if you recognize it as a valid URL.</p>
67
- </div>
68
- </body>
69
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
statistics/newsletters.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $module = NewsletterStatistics::instance();
4
  $controls = new NewsletterControls();
@@ -68,9 +70,9 @@ function percentValue($value, $total) {
68
  <?php if ($email->type != 'message' && $email->type != 'feed') continue; ?>
69
  <tr>
70
  <td><?php echo $email->id; ?></td>
71
- <td><?php echo htmlspecialchars($email->subject); ?></td>
72
- <td><?php echo $module->get_email_type_label($email) ?></td>
73
- <td><?php echo $module->get_email_status_label($email)?></td>
74
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $email->sent . ' ' . __('of', 'newsletter') . ' ' . $email->total; ?></td>
75
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $module->format_date($email->send_on); ?></td>
76
  <td><?php echo $email->track == 1 ? 'Yes' : 'No'; ?></td>
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $module = NewsletterStatistics::instance();
6
  $controls = new NewsletterControls();
70
  <?php if ($email->type != 'message' && $email->type != 'feed') continue; ?>
71
  <tr>
72
  <td><?php echo $email->id; ?></td>
73
+ <td><?php echo esc_html($email->subject); ?></td>
74
+ <td><?php echo esc_html($module->get_email_type_label($email)) ?></td>
75
+ <td><?php echo esc_html($module->get_email_status_label($email)) ?></td>
76
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $email->sent . ' ' . __('of', 'newsletter') . ' ' . $email->total; ?></td>
77
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $module->format_date($email->send_on); ?></td>
78
  <td><?php echo $email->track == 1 ? 'Yes' : 'No'; ?></td>
statistics/open.php DELETED
@@ -1,21 +0,0 @@
1
- <?php
2
- global $wpdb;
3
-
4
- if (!defined('ABSPATH')) {
5
- require_once '../../../../wp-load.php';
6
- }
7
- list($email_id, $user_id) = explode(';', base64_decode($_GET['r']), 2);
8
- $ip = preg_replace( '/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR'] );
9
- $wpdb->insert(NEWSLETTER_STATS_TABLE, array(
10
- 'email_id' => $email_id,
11
- 'user_id' => $user_id,
12
- 'ip' => $ip
13
- )
14
- );
15
-
16
- $wpdb->query($wpdb->prepare("update " . NEWSLETTER_SENT_TABLE . " set open=1, ip=%s where email_id=%d and user_id=%d and open=0 limit 1", $ip, $email_id, $user_id));
17
-
18
- header('Content-Type: image/gif');
19
- echo base64_decode('_R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
20
- die();
21
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
statistics/settings.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $module = NewsletterStatistics::instance();
4
  $controls = new NewsletterControls();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $module = NewsletterStatistics::instance();
6
  $controls = new NewsletterControls();
statistics/statistics.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
4
 
@@ -24,31 +25,128 @@ class NewsletterStatistics extends NewsletterModule {
24
  add_action('wp_loaded', array($this, 'hook_wp_loaded'));
25
  }
26
 
 
 
 
 
27
  function hook_wp_loaded() {
28
  global $wpdb;
29
 
30
  // Newsletter Link Tracking
31
  if (isset($_GET['nltr'])) {
32
- $_GET['r'] = $_GET['nltr'];
33
- include dirname(__FILE__) . '/link.php';
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  die();
35
  }
36
 
37
  // Newsletter Open Traking Image
38
  if (isset($_GET['noti'])) {
39
- list($email_id, $user_id) = explode(';', base64_decode($_GET['noti']), 2);
40
-
41
- $wpdb->insert(NEWSLETTER_STATS_TABLE, array(
42
- 'email_id' => (int)$email_id,
43
- 'user_id' => (int)$user_id,
44
- 'ip' => $_SERVER['REMOTE_ADDR'])
45
- );
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
46
 
47
  header('Content-Type: image/gif');
48
  echo base64_decode('_R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
49
  die();
50
  }
51
-
52
  }
53
 
54
  function upgrade() {
@@ -88,7 +186,6 @@ class NewsletterStatistics extends NewsletterModule {
88
  $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_emails` ADD COLUMN `open_count` int UNSIGNED NOT NULL DEFAULT 0");
89
  $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_emails` ADD COLUMN `click_count` int UNSIGNED NOT NULL DEFAULT 0");
90
  $this->upgrade_query("alter table {$wpdb->prefix}newsletter_emails change column read_count open_count int not null default 0");
91
-
92
  }
93
 
94
  function admin_menu() {
@@ -101,12 +198,16 @@ class NewsletterStatistics extends NewsletterModule {
101
  $this->add_admin_page('view_users', 'Statistics');
102
  }
103
 
104
- function relink($text, $email_id, $user_id) {
105
  $this->relink_email_id = $email_id;
106
  $this->relink_user_id = $user_id;
 
 
 
107
  $text = preg_replace_callback('/(<[aA][^>]+href=["\'])([^>"\']+)(["\'][^>]*>)(.*?)(<\/[Aa]>)/', array($this, 'relink_callback'), $text);
108
 
109
- $text = str_replace('</body>', '<img width="1" height="1" alt="" src="' . home_url('/') . '?noti=' . urlencode(base64_encode($email_id . ';' . $user_id)) . '"/></body>', $text);
 
110
  return $text;
111
  }
112
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
5
 
25
  add_action('wp_loaded', array($this, 'hook_wp_loaded'));
26
  }
27
 
28
+ /**
29
+ *
30
+ * @global wpdb $wpdb
31
+ */
32
  function hook_wp_loaded() {
33
  global $wpdb;
34
 
35
  // Newsletter Link Tracking
36
  if (isset($_GET['nltr'])) {
37
+
38
+ list($email_id, $user_id, $url, $anchor, $key) = explode(';', base64_decode($_GET['nltr']), 5);
39
+
40
+ if (!is_user_logged_in()) {
41
+ if (empty($email_id) || empty($user_id) || empty($url)) {
42
+ header("HTTP/1.0 404 Not Found");
43
+ die();
44
+ }
45
+ }
46
+
47
+ $parts = parse_url($url);
48
+
49
+ $verified = $parts['host'] == $_SERVER['HTTP_HOST'];
50
+ if (!$verified) {
51
+ $verified = $key == md5($email_id . ';' . $user_id . ';' . $url . ';' . $anchor . $this->options['key']);
52
+ }
53
+
54
+ // For feed by mail tests
55
+ if ($verified && empty($email_id) && is_user_logged_in()) {
56
+ header('Location: ' . $url);
57
+ die();
58
+ }
59
+
60
+ $ip = preg_replace('/[^0-9a-fA-F:., ]/', '', $_SERVER['REMOTE_ADDR']);
61
+
62
+ if ($verified) {
63
+ $wpdb->insert(NEWSLETTER_STATS_TABLE, array(
64
+ 'email_id' => $email_id,
65
+ 'user_id' => $user_id,
66
+ 'url' => $url,
67
+ 'ip' => $ip
68
+ )
69
+ );
70
+
71
+ $wpdb->query($wpdb->prepare("update " . NEWSLETTER_SENT_TABLE . " set open=2, ip=%s where email_id=%d and user_id=%d limit 1", $ip, $email_id, $user_id));
72
+
73
+ $user = Newsletter::instance()->get_user($user_id);
74
+ if ($user) {
75
+ setcookie('newsletter', $user->id . '-' . $user->token, time() + 60 * 60 * 24 * 365, '/');
76
+ }
77
+ header('Location: ' . $url);
78
+ die();
79
+ } else {
80
+ header("HTTP/1.0 404 Not Found");
81
+ }
82
+ ?><html>
83
+ <head>
84
+ <style>
85
+ body {
86
+ font-family: sans-serif;
87
+ }
88
+ </style>
89
+ </head>
90
+ <body>
91
+ <div style="max-width: 100%; width: 500px; margin: 40px auto; text-align: center">
92
+ <p>The requested URL (<?php echo esc_html($url) ?>) has not been verified.</p>
93
+ <p>You can follow it if you recognize it as a valid URL.</p>
94
+ </div>
95
+ </body>
96
+ </html>
97
+ <?php
98
  die();
99
  }
100
 
101
  // Newsletter Open Traking Image
102
  if (isset($_GET['noti'])) {
103
+ $this->logger->debug('Open tracking: ' . $_GET['noti']);
104
+
105
+ list($email_id, $user_id, $signature) = explode(';', base64_decode($_GET['noti']), 3);
106
+
107
+ $email = $this->get_email($email_id);
108
+ if (!$email) {
109
+ $this->logger->error('Open tracking request for unexistant email');
110
+ die();
111
+ }
112
+
113
+ $user = $this->get_user($user_id);
114
+ if (!$user) {
115
+ $this->logger->error('Open tracking request for unexistant subscriber');
116
+ die();
117
+ }
118
+
119
+ if ($email->token) {
120
+ $this->logger->debug('Signature: ' . $signature);
121
+ $s = md5($email_id . $user_id . $email->token);
122
+ if ($s != $signature) {
123
+ $this->logger->error('Open tracking request with wrong signature. Email token: ' . $email->token);
124
+ die();
125
+ }
126
+ } else {
127
+ $this->logger->info('Email with no token hence not signature to check');
128
+ }
129
+
130
+ $row = $wpdb->get_row($wpdb->prepare("select * from " . NEWSLETTER_STATS_TABLE . " where email_id=%d and user_id=%d and url='' limit 1", $email->id, $user->id));
131
+ if ($row) {
132
+ $this->logger->info('Open already registered');
133
+ // MAybe an update for some fields?
134
+ } else {
135
+
136
+ $res = $wpdb->insert(NEWSLETTER_STATS_TABLE, array(
137
+ 'email_id' => (int) $email_id,
138
+ 'user_id' => (int) $user_id,
139
+ 'ip' => $_SERVER['REMOTE_ADDR'])
140
+ );
141
+ if (!$res) {
142
+ $this->logger->fatal($wpdb->last_error);
143
+ }
144
+ }
145
 
146
  header('Content-Type: image/gif');
147
  echo base64_decode('_R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7');
148
  die();
149
  }
 
150
  }
151
 
152
  function upgrade() {
186
  $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_emails` ADD COLUMN `open_count` int UNSIGNED NOT NULL DEFAULT 0");
187
  $this->upgrade_query("ALTER TABLE `{$wpdb->prefix}newsletter_emails` ADD COLUMN `click_count` int UNSIGNED NOT NULL DEFAULT 0");
188
  $this->upgrade_query("alter table {$wpdb->prefix}newsletter_emails change column read_count open_count int not null default 0");
 
189
  }
190
 
191
  function admin_menu() {
198
  $this->add_admin_page('view_users', 'Statistics');
199
  }
200
 
201
+ function relink($text, $email_id, $user_id, $email_token = '') {
202
  $this->relink_email_id = $email_id;
203
  $this->relink_user_id = $user_id;
204
+ $this->relink_email_token = $email_token;
205
+
206
+ $this->logger->debug('Relink with token: ' . $email_token);
207
  $text = preg_replace_callback('/(<[aA][^>]+href=["\'])([^>"\']+)(["\'][^>]*>)(.*?)(<\/[Aa]>)/', array($this, 'relink_callback'), $text);
208
 
209
+ $signature = md5($email_id . $user_id . $email_token);
210
+ $text = str_replace('</body>', '<img width="1" height="1" alt="" src="' . home_url('/') . '?noti=' . urlencode(base64_encode($email_id . ';' . $user_id . ';' . $signature)) . '"/></body>', $text);
211
  return $text;
212
  }
213
 
statistics/view-retarget.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  $email_id = (int) $_GET['id'];
3
  $module = NewsletterStatistics::instance();
4
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  $email_id = (int) $_GET['id'];
5
  $module = NewsletterStatistics::instance();
6
 
statistics/view-urls.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  $email_id = (int) $_GET['id'];
3
  $module = NewsletterStatistics::instance();
4
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  $email_id = (int) $_GET['id'];
5
  $module = NewsletterStatistics::instance();
6
 
statistics/view-users.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  $email_id = (int) $_GET['id'];
3
  $module = NewsletterStatistics::instance();
4
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  $email_id = (int) $_GET['id'];
5
  $module = NewsletterStatistics::instance();
6
 
statistics/view.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
 
4
  $module = NewsletterStatistics::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
 
6
  $module = NewsletterStatistics::instance();
subscription/forms.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterSubscription::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterSubscription::instance();
subscription/lists.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterSubscription::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterSubscription::instance();
subscription/options.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterSubscription::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterSubscription::instance();
subscription/page.php CHANGED
@@ -12,7 +12,7 @@
12
  //
13
  // and modify that copy.
14
 
15
- include '../../../../wp-load.php';
16
 
17
  $module = NewsletterSubscription::instance();
18
  $user = $module->get_user_from_request();
12
  //
13
  // and modify that copy.
14
 
15
+ if (!defined('ABSPATH')) exit;
16
 
17
  $module = NewsletterSubscription::instance();
18
  $user = $module->get_user_from_request();
subscription/profile.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterSubscription::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterSubscription::instance();
subscription/subscription.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
4
 
@@ -1011,19 +1012,19 @@ class NewsletterSubscription extends NewsletterModule {
1011
  if ($name == 'preference' || $name == 'list') {
1012
  $list = (int) $attrs['number'];
1013
  if (isset($attrs['hidden'])) {
1014
- return '<input type="hidden" name="nl[]" value="' . $list . '">';
1015
  }
1016
  $buffer .= '<div class="newsletter-field newsletter-field-checkbox newsletter-field-list">';
1017
- $buffer .= '<input type="checkbox" id="nl' . $list . '" name="nl[]" value="' . $list . '"';
1018
  if (isset($attrs['checked'])) {
1019
  $buffer .= ' checked';
1020
  }
1021
  $buffer .= '>';
1022
  if (isset($attrs['label'])) {
1023
  if ($attrs['label'] != '')
1024
- $buffer .= '<label for="nl' . $list . '">' . $attrs['label'] . '</label>';
1025
  } else {
1026
- $buffer .= '<label for="nl' . $list . '">' . $options_profile['list_' . $list] . '</label>';
1027
  }
1028
  $buffer .= '</div>';
1029
 
@@ -1040,7 +1041,7 @@ class NewsletterSubscription extends NewsletterModule {
1040
  $lists .= '<input type="checkbox" id="nl' . $i . '" name="nl[]" value="' . $i . '"';
1041
  if ($options_profile['list_' . $i . '_checked'] == 1)
1042
  $lists .= ' checked';
1043
- $lists .= '> <label for="nl' . $i . '>' . $options_profile['list_' . $i] . '</label>';
1044
  $lists .= '</div>';
1045
  }
1046
  return $lists;
@@ -1051,14 +1052,14 @@ class NewsletterSubscription extends NewsletterModule {
1051
  $buffer .= '<div class="newsletter-field newsletter-field-gender">';
1052
  if (isset($attrs['label'])) {
1053
  if ($attrs['label'] != '')
1054
- $buffer .= '<label for="">' . $attrs['label'] . '</label>';
1055
  } else {
1056
- $buffer .= '<label for="">' . $options_profile['sex'] . '</label>';
1057
  }
1058
 
1059
  $buffer .= '<select name="nx" class="newsletter-gender">';
1060
- $buffer .= '<option value="m">' . $options_profile['sex_male'] . '</option>';
1061
- $buffer .= '<option value="f">' . $options_profile['sex_female'] . '</option>';
1062
  $buffer .= '</select>';
1063
  $buffer .= '</div>';
1064
  return $buffer;
@@ -1071,7 +1072,7 @@ class NewsletterSubscription extends NewsletterModule {
1071
  $buffer .= '<div class="newsletter-field newsletter-field-profile">';
1072
  if (isset($attrs['label'])) {
1073
  if ($attrs['label'] != '') {
1074
- $buffer .= '<label for="">' . $attrs['label'] . '</label>';
1075
  }
1076
  } else {
1077
  $buffer .= '<label for="">' . $options_profile['profile_' . $number] . '</label>';
@@ -1082,7 +1083,7 @@ class NewsletterSubscription extends NewsletterModule {
1082
 
1083
  // Text field
1084
  if ($type == 'text') {
1085
- $buffer .= '<input class="newsletter-profile newsletter-profile-' . $number . '" type="text" size="' . $size . '" name="np' . $number . '" placeholder="' . esc_attr($placeholder) . '"';
1086
  if ($required) {
1087
  $buffer .= ' required';
1088
  }
@@ -1101,7 +1102,7 @@ class NewsletterSubscription extends NewsletterModule {
1101
  }
1102
  $opts = explode(',', $options_profile['profile_' . $number . '_options']);
1103
  for ($j = 0; $j < count($opts); $j++) {
1104
- $buffer .= '<option>' . trim($opts[$j]) . '</option>';
1105
  }
1106
  $buffer .= '</select>';
1107
  }
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
5
 
1012
  if ($name == 'preference' || $name == 'list') {
1013
  $list = (int) $attrs['number'];
1014
  if (isset($attrs['hidden'])) {
1015
+ return '<input type="hidden" name="nl[]" value="' . esc_attr($list) . '">';
1016
  }
1017
  $buffer .= '<div class="newsletter-field newsletter-field-checkbox newsletter-field-list">';
1018
+ $buffer .= '<input type="checkbox" id="nl' . esc_attr($list) . '" name="nl[]" value="' . esc_attr($list) . '"';
1019
  if (isset($attrs['checked'])) {
1020
  $buffer .= ' checked';
1021
  }
1022
  $buffer .= '>';
1023
  if (isset($attrs['label'])) {
1024
  if ($attrs['label'] != '')
1025
+ $buffer .= '<label for="nl' . esc_attr($list) . '">' . esc_html($attrs['label']) . '</label>';
1026
  } else {
1027
+ $buffer .= '<label for="nl' . esc_attr($list) . '">' . esc_html($options_profile['list_' . $list]) . '</label>';
1028
  }
1029
  $buffer .= '</div>';
1030
 
1041
  $lists .= '<input type="checkbox" id="nl' . $i . '" name="nl[]" value="' . $i . '"';
1042
  if ($options_profile['list_' . $i . '_checked'] == 1)
1043
  $lists .= ' checked';
1044
+ $lists .= '> <label for="nl' . $i . '>' . esc_html($options_profile['list_' . $i]) . '</label>';
1045
  $lists .= '</div>';
1046
  }
1047
  return $lists;
1052
  $buffer .= '<div class="newsletter-field newsletter-field-gender">';
1053
  if (isset($attrs['label'])) {
1054
  if ($attrs['label'] != '')
1055
+ $buffer .= '<label for="">' . esc_html($attrs['label']) . '</label>';
1056
  } else {
1057
+ $buffer .= '<label for="">' . esc_html($options_profile['sex']) . '</label>';
1058
  }
1059
 
1060
  $buffer .= '<select name="nx" class="newsletter-gender">';
1061
+ $buffer .= '<option value="m">' . esc_html($options_profile['sex_male']) . '</option>';
1062
+ $buffer .= '<option value="f">' . esc_html($options_profile['sex_female']) . '</option>';
1063
  $buffer .= '</select>';
1064
  $buffer .= '</div>';
1065
  return $buffer;
1072
  $buffer .= '<div class="newsletter-field newsletter-field-profile">';
1073
  if (isset($attrs['label'])) {
1074
  if ($attrs['label'] != '') {
1075
+ $buffer .= '<label for="">' . esc_html($attrs['label']) . '</label>';
1076
  }
1077
  } else {
1078
  $buffer .= '<label for="">' . $options_profile['profile_' . $number] . '</label>';
1083
 
1084
  // Text field
1085
  if ($type == 'text') {
1086
+ $buffer .= '<input class="newsletter-profile newsletter-profile-' . $number . '" type="text" size="' . esc_attr($size) . '" name="np' . $number . '" placeholder="' . esc_attr($placeholder) . '"';
1087
  if ($required) {
1088
  $buffer .= ' required';
1089
  }
1102
  }
1103
  $opts = explode(',', $options_profile['profile_' . $number . '_options']);
1104
  for ($j = 0; $j < count($opts); $j++) {
1105
+ $buffer .= '<option>' . esc_html(trim($opts[$j])) . '</option>';
1106
  }
1107
  $buffer .= '</select>';
1108
  }
subscription/template.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterSubscription::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterSubscription::instance();
subscription/unsubscription.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterSubscription::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterSubscription::instance();
tnp-footer.php CHANGED
@@ -1,3 +1,6 @@
 
 
 
1
  <div id="tnp-footer">
2
  <div>
3
  <ul>
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?>
4
  <div id="tnp-footer">
5
  <div>
6
  <ul>
tnp-header.php CHANGED
@@ -1,6 +1,8 @@
1
  <?php
2
  global $current_user, $wpdb, $newsletter;
3
 
 
 
4
  $dismissed = get_option('newsletter_dismissed', array());
5
 
6
  $user_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='C'");
1
  <?php
2
  global $current_user, $wpdb, $newsletter;
3
 
4
+ if (!defined('ABSPATH')) exit;
5
+
6
  $dismissed = get_option('newsletter_dismissed', array());
7
 
8
  $user_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE . " where status='C'");
users/csv.php DELETED
@@ -1,19 +0,0 @@
1
- <?php
2
-
3
- require_once '../../../../wp-load.php';
4
-
5
- $newsletter = Newsletter::instance();
6
- require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
7
-
8
- // TODO: Check the user capabilities
9
- if (current_user_can('manage_options') || ($newsletter->options['editor'] == 1 && current_user_can('manage_categories'))) {
10
- $controls = new NewsletterControls();
11
-
12
- if ($controls->is_action('export')) {
13
- NewsletterUsers::instance()->export($controls->data);
14
- }
15
- } else {
16
- die('Not allowed.');
17
- }
18
-
19
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
users/edit.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
4
  $controls = new NewsletterControls();
@@ -205,7 +206,7 @@ function percentValue($value, $total) {
205
  for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i++) {
206
  echo '<tr><td>(' . $i . ') ';
207
  echo '</td><td>';
208
- echo $options_profile['profile_' . $i];
209
  echo '</td><td>';
210
  $controls->text('profile_' . $i, 70);
211
  echo '</td></tr>';
@@ -255,7 +256,7 @@ function percentValue($value, $total) {
255
  <tr valign="top">
256
  <th>Profile URL</th>
257
  <td>
258
- <?php echo plugins_url('newsletter/do/profile.php') . '?nk=' . $id . '-' . $controls->data['token']; ?>
259
  <p class="description">
260
  The URL which lands on the user profile editing page. It can be added on newsletters using the {profile_url} tag.
261
  </p>
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
206
  for ($i = 1; $i <= NEWSLETTER_PROFILE_MAX; $i++) {
207
  echo '<tr><td>(' . $i . ') ';
208
  echo '</td><td>';
209
+ echo esc_html($options_profile['profile_' . $i]);
210
  echo '</td><td>';
211
  $controls->text('profile_' . $i, 70);
212
  echo '</td></tr>';
256
  <tr valign="top">
257
  <th>Profile URL</th>
258
  <td>
259
+ <?php echo esc_html(home_url('/') . '?na=pe&nk=' . $id . '-' . $controls->data['token']) ?>
260
  <p class="description">
261
  The URL which lands on the user profile editing page. It can be added on newsletters using the {profile_url} tag.
262
  </p>
users/export.php CHANGED
@@ -27,6 +27,7 @@ for ($i = 1; $i <= NEWSLETTER_LIST_MAX; $i++) {
27
  </p>
28
 
29
  </div>
 
30
  <div id="tnp-body">
31
 
32
  <form method="post" action="<?php echo admin_url('admin-ajax.php') ?>?action=newsletter_users_export">
27
  </p>
28
 
29
  </div>
30
+
31
  <div id="tnp-body">
32
 
33
  <form method="post" action="<?php echo admin_url('admin-ajax.php') ?>?action=newsletter_users_export">
users/import.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterUsers::instance();
@@ -95,12 +97,14 @@ if ($controls->is_action('import')) {
95
  }
96
 
97
  // Prepare the preference to zero
98
- for ($i = 1; $i < NEWSLETTER_LIST_MAX; $i++)
99
  $subscriber['list_' . $i] = 0;
 
100
 
101
- foreach ($controls->data['preferences'] as $i)
102
  $subscriber['list_' . $i] = 1;
103
  }
 
104
 
105
  if ($mode == 'update') {
106
  $subscriber['name'] = $newsletter->normalize_name($data[1]);
@@ -108,10 +112,13 @@ if ($controls->is_action('import')) {
108
  if (isset($data[3])) {
109
  $subscriber['sex'] = $newsletter->normalize_sex($data[3]);
110
  }
 
111
  $subscriber['status'] = $controls->data['import_as'];
112
- foreach ($controls->data['preferences'] as $i)
 
113
  $subscriber['list_' . $i] = 1;
114
  }
 
115
 
116
  NewsletterUsers::instance()->save_user($subscriber);
117
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterUsers::instance();
97
  }
98
 
99
  // Prepare the preference to zero
100
+ for ($i = 1; $i < NEWSLETTER_LIST_MAX; $i++) {
101
  $subscriber['list_' . $i] = 0;
102
+ }
103
 
104
+ foreach ($controls->data['preferences'] as $i) {
105
  $subscriber['list_' . $i] = 1;
106
  }
107
+ }
108
 
109
  if ($mode == 'update') {
110
  $subscriber['name'] = $newsletter->normalize_name($data[1]);
112
  if (isset($data[3])) {
113
  $subscriber['sex'] = $newsletter->normalize_sex($data[3]);
114
  }
115
+ if (isset($controls->data['override_status'])) {
116
  $subscriber['status'] = $controls->data['import_as'];
117
+ }
118
+ foreach ($controls->data['preferences'] as $i) {
119
  $subscriber['list_' . $i] = 1;
120
  }
121
+ }
122
 
123
  NewsletterUsers::instance()->save_user($subscriber);
124
 
users/index.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
4
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
 
users/massive.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
 
4
  $controls = new NewsletterControls();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
 
6
  $controls = new NewsletterControls();
users/new.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterUsers::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  require_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterUsers::instance();
users/statistics-time.php CHANGED
@@ -1,3 +1,7 @@
 
 
 
 
1
  <h4>Subscriptions by month (max 12 months)</h4>
2
  <?php
3
  $months = $wpdb->get_results("select count(*) as c, concat(year(created), '-', date_format(created, '%m')) as d from " . NEWSLETTER_USERS_TABLE . " where status='C' group by concat(year(created), '-', date_format(created, '%m')) order by d desc limit 12");
1
+ <?php
2
+ if (!defined('ABSPATH')) exit;
3
+ ?>
4
+
5
  <h4>Subscriptions by month (max 12 months)</h4>
6
  <?php
7
  $months = $wpdb->get_results("select count(*) as c, concat(year(created), '-', date_format(created, '%m')) as d from " . NEWSLETTER_USERS_TABLE . " where status='C' group by concat(year(created), '-', date_format(created, '%m')) order by d desc limit 12");
users/statistics.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
 
4
  $all_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE);
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
 
6
  $all_count = $wpdb->get_var("select count(*) from " . NEWSLETTER_USERS_TABLE);
users/users.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
4
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
5
 
widget.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  /**
4
  * Newsletter widget version 2.0: it'll replace the old version left for compatibility.
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  /**
5
  * Newsletter widget version 2.0: it'll replace the old version left for compatibility.
wp/index.php CHANGED
@@ -1,4 +1,6 @@
1
  <?php
 
 
2
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
3
  $controls = new NewsletterControls();
4
  $module = NewsletterWp::instance();
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
+
4
  @include_once NEWSLETTER_INCLUDES_DIR . '/controls.php';
5
  $controls = new NewsletterControls();
6
  $module = NewsletterWp::instance();
wp/wp.php CHANGED
@@ -1,4 +1,5 @@
1
  <?php
 
2
 
3
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
4
 
1
  <?php
2
+ if (!defined('ABSPATH')) exit;
3
 
4
  require_once NEWSLETTER_INCLUDES_DIR . '/module.php';
5