Newsletter - Version 5.3.3

Version Description

  • Added GIPHY composer block
  • Added raw HTML composer block
  • API: Newsletters and subscribers lists
Download this release

Release Info

Developer webagile
Plugin Icon 128x128 Newsletter
Version 5.3.3
Comparing to
See all releases

Code changes from version 5.3.2 to 5.3.3

admin.css CHANGED
@@ -278,7 +278,7 @@
278
  max-width: 200px;
279
  color: #000000;
280
  background-color: #ECF0F1;
281
- vertical-align: top;
282
  }
283
 
284
  #tnp-body .form-table th small {
278
  max-width: 200px;
279
  color: #000000;
280
  background-color: #ECF0F1;
281
+ vertical-align: middle;
282
  }
283
 
284
  #tnp-body .form-table th small {
emails/blocks/giphy/block.php ADDED
@@ -0,0 +1,34 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Name: Giphy
4
+ * Section: content
5
+ * Description: Add a Giphy image
6
+ *
7
+ */
8
+
9
+ /* @var $options array */
10
+ /* @var $wpdb wpdb */
11
+
12
+ $default_options = array(
13
+ 'view'=>'View online',
14
+ 'text'=>'Few words summary',
15
+ 'block_background'=>'#ffffff',
16
+ 'font_family'=>$font_family,
17
+ 'font_size'=>13,
18
+ 'color'=>'#999999'
19
+ );
20
+
21
+ $options = array_merge($default_options, $options);
22
+ $options['block_padding_top'] = '15px';
23
+ $options['block_padding_bottom'] = '15px';
24
+
25
+ ?>
26
+
27
+ <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
28
+ <tr>
29
+ <td width="100%" valign="top" align="center">
30
+ <img src="<?php echo $options['giphy_url'] ?>" />
31
+ </td>
32
+ </tr>
33
+ </table>
34
+
emails/blocks/giphy/options.php CHANGED
@@ -15,7 +15,7 @@
15
  <tr>
16
  <th><?php _e('Choose', 'newsletter') ?></th>
17
  <td>
18
- <div style="clear: both" id="tnp-giphy-results"></div>
19
  </td>
20
  </tr>
21
  <tr>
@@ -24,6 +24,12 @@
24
  <?php $controls->text('giphy_url') ?>
25
  </td>
26
  </tr>
 
 
 
 
 
 
27
  </table>
28
 
29
  <script type="text/javascript">
@@ -31,6 +37,7 @@
31
  function choose_gif(url) {
32
  jQuery("#tnp-giphy-results").html("");
33
  jQuery("#options-giphy_url").val(url);
 
34
  }
35
 
36
  jQuery("#options-q").keyup(
15
  <tr>
16
  <th><?php _e('Choose', 'newsletter') ?></th>
17
  <td>
18
+ <div style="clear: both" id="tnp-giphy-results">Write something in the search above</div>
19
  </td>
20
  </tr>
21
  <tr>
24
  <?php $controls->text('giphy_url') ?>
25
  </td>
26
  </tr>
27
+ <tr>
28
+ <th>&nbsp;</th>
29
+ <td>
30
+ <div id="giphy-preview"></div>
31
+ </td>
32
+ </tr>
33
  </table>
34
 
35
  <script type="text/javascript">
37
  function choose_gif(url) {
38
  jQuery("#tnp-giphy-results").html("");
39
  jQuery("#options-giphy_url").val(url);
40
+ jQuery("#giphy-preview").html('<img src="' + url + '" />');
41
  }
42
 
43
  jQuery("#options-q").keyup(
emails/blocks/html/block.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ /*
3
+ * Name: Html
4
+ * Section: content
5
+ * Description: Free HTML block
6
+ *
7
+ */
8
+
9
+ /* @var $options array */
10
+ /* @var $wpdb wpdb */
11
+
12
+ $default_options = array(
13
+ 'html'=>'<p>My <strong>HTML</strong> code<p>'
14
+ );
15
+
16
+ $options = array_merge($default_options, $options);
17
+
18
+ ?>
19
+
20
+ <table width="100%" border="0" cellpadding="0" align="center" cellspacing="0">
21
+ <tr>
22
+ <td width="100%" valign="top" align="center">
23
+ <?php echo $options['html'] ?>
24
+ </td>
25
+ </tr>
26
+ </table>
27
+
emails/blocks/html/options.php CHANGED
@@ -5,9 +5,26 @@
5
  */
6
  ?>
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  <table class="form-table">
9
  <tr>
10
- <th><?php _e('HTML code', 'newsletter') ?></th>
11
  <td>
12
  <?php $controls->textarea('html') ?>
13
  </td>
5
  */
6
  ?>
7
 
8
+ <style>
9
+ .CodeMirror {
10
+ height: 400px;
11
+ }
12
+ </style>
13
+
14
+ <script>
15
+ var templateEditor;
16
+ jQuery(function () {
17
+ templateEditor = CodeMirror.fromTextArea(document.getElementById("options-html"), {
18
+ lineNumbers: true,
19
+ mode: 'htmlmixed',
20
+ lineWrapping: true,
21
+ extraKeys: {"Ctrl-Space": "autocomplete"}
22
+ });
23
+ });
24
+ </script>
25
+
26
  <table class="form-table">
27
  <tr>
 
28
  <td>
29
  <?php $controls->textarea('html') ?>
30
  </td>
emails/composer.php CHANGED
@@ -13,6 +13,18 @@ wp_enqueue_style('tnpc-style', plugins_url('/tnp-composer/_css/newsletter-builde
13
  //wp_enqueue_style('tnpc-newsletter-style', plugins_url('/tnp-composer/css/newsletter.css', __FILE__));
14
  wp_enqueue_style('tnpc-newsletter-style', home_url('/') . '?na=emails-composer-css');
15
 
 
 
 
 
 
 
 
 
 
 
 
 
16
  if (($controls->is_action('save') || $controls->is_action('preview')) && !isset($_GET['id'])) {
17
 
18
  $module->save_options($controls->data);
13
  //wp_enqueue_style('tnpc-newsletter-style', plugins_url('/tnp-composer/css/newsletter.css', __FILE__));
14
  wp_enqueue_style('tnpc-newsletter-style', home_url('/') . '?na=emails-composer-css');
15
 
16
+ wp_enqueue_style('tnpc-cm-style1', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.css');
17
+ wp_enqueue_style('tnpc-cm-style2', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/show-hint.css');
18
+
19
+ wp_enqueue_script('tnpc-cm-1', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/codemirror.js');
20
+ wp_enqueue_script('tnpc-cm-2', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/xml/xml.js');
21
+ wp_enqueue_script('tnpc-cm-3', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/css/css.js');
22
+ wp_enqueue_script('tnpc-cm-4', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/javascript/javascript.js');
23
+ wp_enqueue_script('tnpc-cm-5', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/mode/htmlmixed/htmlmixed.js');
24
+ wp_enqueue_script('tnpc-cm-6', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/show-hint.js');
25
+ wp_enqueue_script('tnpc-cm-7', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/xml-hint.js');
26
+ wp_enqueue_script('tnpc-cm-8', 'https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/html-hint.js');
27
+
28
  if (($controls->is_action('save') || $controls->is_action('preview')) && !isset($_GET['id'])) {
29
 
30
  $module->save_options($controls->data);
emails/edit-html.php CHANGED
@@ -14,7 +14,6 @@
14
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/xml-hint.js"></script>
15
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/html-hint.js"></script>
16
  <script>
17
-
18
  var templateEditor;
19
  jQuery(function () {
20
  templateEditor = CodeMirror.fromTextArea(document.getElementById("options-message"), {
14
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/xml-hint.js"></script>
15
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.20.2/addon/hint/html-hint.js"></script>
16
  <script>
 
17
  var templateEditor;
18
  jQuery(function () {
19
  templateEditor = CodeMirror.fromTextArea(document.getElementById("options-message"), {
emails/index.php CHANGED
@@ -111,7 +111,12 @@ $emails = Newsletter::instance()->get_emails('message');
111
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $email->sent . ' ' . __('of', 'newsletter') . ' ' . $email->total; ?></td>
112
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $module->format_date($email->send_on); ?></td>
113
  <td><?php echo $email->track == 1 ? __('Yes', 'newsletter') : __('No', 'newsletter'); ?></td>
114
- <td><a class="button-primary" href="<?php echo $module->get_admin_page_url('edit'); ?>&amp;id=<?php echo $email->id; ?>"><i class="fa fa-<?php echo $composer ? 'th-large' : 'pencil' ?>"></i> <?php _e('Edit', 'newsletter') ?></a></td>
 
 
 
 
 
115
  <td>
116
  <a class="button-primary" href="<?php echo NewsletterStatistics::instance()->get_statistics_url($email->id); ?>"><i class="fa fa-bar-chart"></i> <?php _e('Statistics', 'newsletter') ?></a>
117
  </td>
111
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $email->sent . ' ' . __('of', 'newsletter') . ' ' . $email->total; ?></td>
112
  <td><?php if ($email->status == 'sent' || $email->status == 'sending') echo $module->format_date($email->send_on); ?></td>
113
  <td><?php echo $email->track == 1 ? __('Yes', 'newsletter') : __('No', 'newsletter'); ?></td>
114
+
115
+ <td><a class="button-primary"
116
+ href="<?php echo $module->get_admin_page_url($email->status == 'new' && $composer ? 'composer' : 'edit') ?>&amp;id=<?php echo $email->id; ?>">
117
+ <i class="fa fa-<?php echo $composer ? 'th-large' : 'pencil' ?>"></i> <?php _e('Edit', 'newsletter') ?>
118
+ </a></td>
119
+
120
  <td>
121
  <a class="button-primary" href="<?php echo NewsletterStatistics::instance()->get_statistics_url($email->id); ?>"><i class="fa fa-bar-chart"></i> <?php _e('Statistics', 'newsletter') ?></a>
122
  </td>
emails/tnp-composer/_scripts/newsletter-builder.js CHANGED
@@ -404,7 +404,12 @@ jQuery(function () {
404
  });
405
 
406
  jQuery("#tnpc-block-options .tnpc-edit-box-buttons-save").click(function () {
407
- //alert(target.data('options'));
 
 
 
 
 
408
  jQuery(this).parent().parent().parent().fadeOut(500)
409
  jQuery(this).parent().parent().slideUp(500)
410
 
404
  });
405
 
406
  jQuery("#tnpc-block-options .tnpc-edit-box-buttons-save").click(function () {
407
+
408
+ // fix for Codemirror
409
+ if (typeof templateEditor !== 'undefined') { templateEditor.save(); };
410
+
411
+ // console.log(target.data('options'));
412
+
413
  jQuery(this).parent().parent().parent().fadeOut(500)
414
  jQuery(this).parent().parent().slideUp(500)
415
 
includes/TNP.php CHANGED
@@ -220,6 +220,25 @@ class TNP {
220
 
221
  return $user;
222
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
 
224
  /*
225
  * Deletes a subscriber
@@ -243,5 +262,28 @@ class TNP {
243
  return new WP_Error('-1', $wpdb->last_error, array('status' => 400));
244
  }
245
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
246
 
247
  }
220
 
221
  return $user;
222
  }
223
+
224
+ /*
225
+ * Subscribers list
226
+ */
227
+
228
+ public static function subscribers($params) {
229
+
230
+ global $wpdb;
231
+ $newsletter = Newsletter::instance();
232
+
233
+ $items_per_page = 20;
234
+ $where = "";
235
+
236
+ $query = "select name, email from " . NEWSLETTER_USERS_TABLE . ' ' . $where . " order by id desc";
237
+ $query .= " limit 0," . $items_per_page;
238
+ $list = $wpdb->get_results($query);
239
+
240
+ return $list;
241
+ }
242
 
243
  /*
244
  * Deletes a subscriber
262
  return new WP_Error('-1', $wpdb->last_error, array('status' => 400));
263
  }
264
  }
265
+
266
+ /*
267
+ * Newsletters list
268
+ */
269
+
270
+ public static function newsletters($params) {
271
+
272
+ global $wpdb;
273
+
274
+ $list = $wpdb->get_results("SELECT id, subject, created, status, total, sent, send_on FROM " . NEWSLETTER_EMAILS_TABLE . " ORDER BY id DESC LIMIT 10", OBJECT);
275
+
276
+ if ($wpdb->last_error) {
277
+ $this->logger->error($wpdb->last_error);
278
+ return false;
279
+ }
280
+
281
+ if (empty($list)) {
282
+ return array();
283
+ }
284
+
285
+ return $list;
286
+
287
+ }
288
 
289
  }
main/index.php CHANGED
@@ -299,7 +299,7 @@ $labels = array_reverse($labels);
299
  ?>
300
  </td>
301
  <td style="white-space:nowrap">
302
- <a class="button-primary tnp-button-white" title="<?php _e('Edit', 'newsletter') ?>" href="<?php echo $emails_module->get_admin_page_url(is_array($email_options) && array_key_exists('composer', $email_options) && $email_options['composer'] ? 'composer' : 'edit'); ?>&amp;id=<?php echo $email->id; ?>"><i class="fa fa-pencil"></i></a>
303
  <a class="button-primary tnp-button-white" title="<?php _e('Statistics', 'newsletter') ?>" href="<?php echo NewsletterStatistics::instance()->get_statistics_url($email->id); ?>"><i class="fa fa-bar-chart"></i></a>
304
  </td>
305
  </tr>
299
  ?>
300
  </td>
301
  <td style="white-space:nowrap">
302
+ <a class="button-primary tnp-button-white" title="<?php _e('Edit', 'newsletter') ?>" href="<?php echo $emails_module->get_admin_page_url(is_array($email_options) && array_key_exists('composer', $email_options) && $email_options['composer'] && $email->status == 'new' ? 'composer' : 'edit'); ?>&amp;id=<?php echo $email->id; ?>"><i class="fa fa-pencil"></i></a>
303
  <a class="button-primary tnp-button-white" title="<?php _e('Statistics', 'newsletter') ?>" href="<?php echo NewsletterStatistics::instance()->get_statistics_url($email->id); ?>"><i class="fa fa-bar-chart"></i></a>
304
  </td>
305
  </tr>
plugin.php CHANGED
@@ -4,7 +4,7 @@
4
  Plugin Name: Newsletter
5
  Plugin URI: https://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="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
- Version: 5.3.2
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: https://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', '5.3.2');
18
 
19
  global $wpdb, $newsletter;
20
 
4
  Plugin Name: Newsletter
5
  Plugin URI: https://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="https://www.thenewsletterplugin.com/category/release">this page</a> to know what's changed.</strong>
7
+ Version: 5.3.3
8
  Author: Stefano Lissa & The Newsletter Team
9
  Author URI: https://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', '5.3.3');
18
 
19
  global $wpdb, $newsletter;
20
 
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated
3
  Requires at least: 3.4.0
4
- Tested up to: 4.9.4
5
- Stable tag: 5.3.2
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -89,6 +89,12 @@ Thank you, The Newsletter Team
89
 
90
  == Changelog ==
91
 
 
 
 
 
 
 
92
  = 5.3.2 =
93
 
94
  * Security panel reorganized
1
  === Newsletter ===
2
  Tags: newsletter,email,subscription,mass mail,list build,email marketing,direct mailing,automation,automated
3
  Requires at least: 3.4.0
4
+ Tested up to: 4.9.5
5
+ Stable tag: 5.3.3
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
89
 
90
  == Changelog ==
91
 
92
+ = 5.3.3 =
93
+
94
+ * Added GIPHY composer block
95
+ * Added raw HTML composer block
96
+ * API: Newsletters and subscribers lists
97
+
98
  = 5.3.2 =
99
 
100
  * Security panel reorganized