Newsletter - Version 6.1.9

Version Description

  • Fixed a missing default on profile configuration
  • Fixed the default message template
  • Added image alt on image block
  • Improved addons version check and performances
  • Post block and image block fixes
Download this release

Release Info

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

Code changes from version 6.1.8 to 6.1.9

emails/blocks/hero/block.php CHANGED
@@ -117,7 +117,7 @@ if (!empty($options['image']['id'])) {
117
  <tr>
118
  <td class="padding-copy tnpc-row-edit">
119
  <a href="<?php echo $url ?>" target="_blank" rel="noopener nofollow">
120
- <img src="<?php echo $image ?>" border="0" alt="" inline-class="hero-image">
121
  </a>
122
  </td>
123
  </tr>
117
  <tr>
118
  <td class="padding-copy tnpc-row-edit">
119
  <a href="<?php echo $url ?>" target="_blank" rel="noopener nofollow">
120
+ <img src="<?php echo $image ?>" border="0" alt="Image" inline-class="hero-image">
121
  </a>
122
  </td>
123
  </tr>
emails/blocks/image/block.php CHANGED
@@ -20,6 +20,7 @@ $defaults = array(
20
 
21
  $options = array_merge($defaults, $options);
22
 
 
23
  if (empty($options['image']['id'])) {
24
  // A placeholder can be set by a preset and it is kept indefinitely
25
  if (!empty($options['placeholder'])) {
@@ -29,6 +30,7 @@ if (empty($options['image']['id'])) {
29
  }
30
  } else {
31
  $image = tnp_media_resize($options['image']['id'], array(600, 0));
 
32
  }
33
 
34
  $url = $options['url'];
@@ -37,5 +39,5 @@ $url = $options['url'];
37
  <?php if (!empty($url)) { ?>
38
  <a href="<?php echo $url ?>" target="_blank"><img src="<?php echo $image ?>" border="0" alt="" style="max-width: 100%!important; height: auto!important; display: inline-block;"></a>
39
  <?php } else { ?>
40
- <img src="<?php echo $image ?>" border="0" alt="" style="max-width: 100%!important; height: auto!important; display: inline-block;">
41
  <?php } ?>
20
 
21
  $options = array_merge($defaults, $options);
22
 
23
+ $alt = '';
24
  if (empty($options['image']['id'])) {
25
  // A placeholder can be set by a preset and it is kept indefinitely
26
  if (!empty($options['placeholder'])) {
30
  }
31
  } else {
32
  $image = tnp_media_resize($options['image']['id'], array(600, 0));
33
+ $alt = $options['image_alt'];
34
  }
35
 
36
  $url = $options['url'];
39
  <?php if (!empty($url)) { ?>
40
  <a href="<?php echo $url ?>" target="_blank"><img src="<?php echo $image ?>" border="0" alt="" style="max-width: 100%!important; height: auto!important; display: inline-block;"></a>
41
  <?php } else { ?>
42
+ <img src="<?php echo $image ?>" border="0" alt="<?php echo esc_attr($alt) ?>" style="max-width: 100%!important; height: auto!important; display: inline-block;">
43
  <?php } ?>
emails/blocks/image/options.php CHANGED
@@ -6,7 +6,7 @@
6
  ?>
7
 
8
  <?php $controls->hidden('placeholder') ?>
9
- <?php $fields->media('image') ?>
10
 
11
  <?php $fields->url('url', 'URL') ?>
12
 
6
  ?>
7
 
8
  <?php $controls->hidden('placeholder') ?>
9
+ <?php $fields->media('image', null, array('alt'=>true)) ?>
10
 
11
  <?php $fields->url('url', 'URL') ?>
12
 
emails/blocks/posts/block.php CHANGED
@@ -150,7 +150,7 @@ $alternative_2 = plugins_url('newsletter') . '/emails/blocks/posts/images/blank-
150
  <?php if ($show_image) { ?>
151
  <td valign="top" style="padding: 30px 0 0 0; width: 105px!important" class="mobile-hide">
152
  <a href="<?php echo tnp_post_permalink($post) ?>" target="_blank">
153
- <img src="<?php echo tnp_post_thumbnail_src($post, array(105, 105, true), $alternative) ?>" width="105" height="105" border="0" style="display: block; font-family: Arial; color: #666666; font-size: 14px; min-width: 105px!important; width: 105px!important;">
154
  </a>
155
  </td>
156
  <?php } ?>
@@ -263,7 +263,7 @@ $alternative_2 = plugins_url('newsletter') . '/emails/blocks/posts/images/blank-
263
  <tr>
264
  <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
265
  <a href="<?php echo tnp_post_permalink($row[0]) ?>" target="_blank">
266
- <img src="<?php echo tnp_post_thumbnail_src($row[0], array(240, 160, true), $alternative_2) ?>" width="240" height="160" border="0" class="img-max">
267
  </a>
268
  </td>
269
  </tr>
@@ -308,7 +308,7 @@ $alternative_2 = plugins_url('newsletter') . '/emails/blocks/posts/images/blank-
308
  <tr>
309
  <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
310
  <a href="<?php echo tnp_post_permalink($row[1]) ?>" target="_blank">
311
- <img src="<?php echo tnp_post_thumbnail_src($row[1], array(240, 160, true), $alternative_2) ?>" width="240" height="160" border="0" class="img-max">
312
  </a>
313
  </td>
314
  </tr>
150
  <?php if ($show_image) { ?>
151
  <td valign="top" style="padding: 30px 0 0 0; width: 105px!important" class="mobile-hide">
152
  <a href="<?php echo tnp_post_permalink($post) ?>" target="_blank">
153
+ <img src="<?php echo tnp_post_thumbnail_src($post, array(105, 105, true), $alternative) ?>" width="105" height="105" alt="Image" border="0" style="display: block; font-family: Arial; color: #666666; font-size: 14px; min-width: 105px!important; width: 105px!important;">
154
  </a>
155
  </td>
156
  <?php } ?>
263
  <tr>
264
  <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
265
  <a href="<?php echo tnp_post_permalink($row[0]) ?>" target="_blank">
266
+ <img src="<?php echo tnp_post_thumbnail_src($row[0], array(240, 160, true), $alternative_2) ?>" alt="Image" width="240" height="160" border="0" class="img-max">
267
  </a>
268
  </td>
269
  </tr>
308
  <tr>
309
  <td align="center" valign="middle" class="tnpc-row-edit" data-type="image">
310
  <a href="<?php echo tnp_post_permalink($row[1]) ?>" target="_blank">
311
+ <img src="<?php echo tnp_post_thumbnail_src($row[1], array(240, 160, true), $alternative_2) ?>" alt="Image" width="240" height="160" border="0" class="img-max">
312
  </a>
313
  </td>
314
  </tr>
emails/emails.php CHANGED
@@ -185,8 +185,11 @@ class NewsletterEmails extends NewsletterModule {
185
  * @return string
186
  */
187
  function regenerate($theme, $context = array()) {
 
 
188
 
189
  if (empty($theme)) {
 
190
  return array('body' => '', 'subject' => '');
191
  }
192
 
@@ -204,6 +207,7 @@ class NewsletterEmails extends NewsletterModule {
204
 
205
  $block = $this->get_block($options['block_id']);
206
  if (!$block) {
 
207
  continue;
208
  }
209
 
@@ -289,6 +293,7 @@ class NewsletterEmails extends NewsletterModule {
289
 
290
 
291
  ob_start();
 
292
  include $block['dir'] . '/block.php';
293
  $content = trim(ob_get_clean());
294
 
@@ -794,6 +799,8 @@ class NewsletterEmails extends NewsletterModule {
794
  $blocks = array_merge($extended, $blocks);
795
 
796
  $dirs = apply_filters('newsletter_blocks_dir', array());
 
 
797
 
798
  foreach ($dirs as $dir) {
799
  $dir = str_replace('\\', '/', $dir);
185
  * @return string
186
  */
187
  function regenerate($theme, $context = array()) {
188
+ $this->logger->debug('Starting email regeneration');
189
+ $this->logger->debug($context);
190
 
191
  if (empty($theme)) {
192
+ $this->logger->debug('The email was empty');
193
  return array('body' => '', 'subject' => '');
194
  }
195
 
207
 
208
  $block = $this->get_block($options['block_id']);
209
  if (!$block) {
210
+ $this->logger->debug('Unable to load the block ' . $options['block_id']);
211
  continue;
212
  }
213
 
293
 
294
 
295
  ob_start();
296
+ $logger = $this->logger;
297
  include $block['dir'] . '/block.php';
298
  $content = trim(ob_get_clean());
299
 
799
  $blocks = array_merge($extended, $blocks);
800
 
801
  $dirs = apply_filters('newsletter_blocks_dir', array());
802
+
803
+ $this->logger->debug('Block dirs: ' . print_r($dirs, true));
804
 
805
  foreach ($dirs as $dir) {
806
  $dir = str_replace('\\', '/', $dir);
includes/fields.php CHANGED
@@ -300,10 +300,13 @@ class NewsletterFields {
300
  * @param type $attrs
301
  */
302
  public function media($name, $label = '', $attrs = array()) {
303
- $attrs = $this->_merge_attrs($attrs);
304
  $this->_open();
305
  $this->_label($label);
306
  $this->controls->media($name);
 
 
 
307
  $this->_description($attrs);
308
  $this->_close();
309
  }
300
  * @param type $attrs
301
  */
302
  public function media($name, $label = '', $attrs = array()) {
303
+ $attrs = $this->_merge_attrs($attrs, array('alt'=>false));
304
  $this->_open();
305
  $this->_label($label);
306
  $this->controls->media($name);
307
+ if ($attrs['alt']) {
308
+ $this->controls->text($name . '_alt', 20, 'Alternative text');
309
+ }
310
  $this->_description($attrs);
311
  $this->_close();
312
  }
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: 6.1.8
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.
@@ -29,7 +29,7 @@
29
  */
30
 
31
  // Used as dummy parameter on css and js links
32
- define('NEWSLETTER_VERSION', '6.1.8');
33
 
34
  global $newsletter, $wpdb;
35
 
@@ -399,6 +399,8 @@ class Newsletter extends NewsletterModule {
399
 
400
  add_shortcode('newsletter_replace', array($this, 'shortcode_newsletter_replace'));
401
 
 
 
402
  if (is_admin()) {
403
  add_action('in_admin_header', array($this, 'hook_in_admin_header'), 1000);
404
 
@@ -1090,98 +1092,122 @@ class Newsletter extends NewsletterModule {
1090
  $this->mailer->SmtpClose();
1091
  }
1092
 
1093
- /**
1094
- * Called weekly if at least one extension is active.
1095
- */
1096
- // function hook_newsletter_extension_versions($force = false) {
1097
- //
1098
- // $response = wp_remote_get('http://www.thenewsletterplugin.com/wp-content/versions/all.txt?ts=' . time());
1099
- // if (is_wp_error($response)) {
1100
- // $this->logger->error($response);
1101
- // return;
1102
- // }
1103
- //
1104
- // $versions = json_decode(wp_remote_retrieve_body($response));
1105
- // update_option('newsletter_extension_versions', $versions, false);
1106
- // }
1107
-
1108
- function get_extension_version($extension_id) {
1109
- $extensions = $this->getTnpExtensions();
1110
 
1111
- if (!is_array($extensions)) {
1112
- return null;
1113
- }
1114
- foreach ($extensions as $extension) {
1115
- if ($extension->id == $extension_id) {
1116
- return $extension->version;
1117
- }
1118
- }
1119
-
1120
- return null;
1121
- }
1122
-
1123
- /**
1124
- * Completes the WordPress plugin update data with the extension data.
1125
- * $value is the data WordPress is saving
1126
- * $extension is an instance of an extension
1127
- */
1128
- function set_extension_update_data($value, $extension) {
1129
 
1130
- // See the wp_update_plugins function
1131
  if (!is_object($value)) {
 
 
 
 
 
 
 
1132
  return $value;
1133
  }
1134
 
1135
- // If someone registered our extension name on wordpress.org... get rid of it otherwise
1136
- // our extenions will be overwritten!
1137
- unset($value->response[$extension->plugin]);
1138
- unset($value->no_update[$extension->plugin]);
 
 
1139
 
1140
  if (!NEWSLETTER_EXTENSION_UPDATE) {
 
1141
  return $value;
1142
  }
1143
 
1144
  include_once(ABSPATH . 'wp-admin/includes/plugin.php');
1145
 
1146
  if (!function_exists('get_plugin_data')) {
 
1147
  return $value;
1148
  }
1149
 
1150
- $new_version = $this->get_extension_version($extension->id);
 
 
 
 
 
 
 
 
 
 
 
 
 
1151
 
1152
- if (empty($new_version)) {
1153
- return $value;
1154
- }
 
1155
 
1156
- if (file_exists(WP_PLUGIN_DIR . '/' . $extension->plugin)) {
1157
- $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $extension->plugin, false, false);
1158
- } else if (file_exists(WPMU_PLUGIN_DIR . '/' . $extension->plugin)) {
1159
- $plugin_data = get_plugin_data(WPMU_PLUGIN_DIR . '/' . $extension->plugin, false, false);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1160
  }
 
 
 
 
 
1161
 
1162
- if (!isset($plugin_data)) {
1163
- return $value;
1164
- }
 
 
1165
 
1166
- if (version_compare($new_version, $plugin_data['Version']) <= 0) {
1167
- return $value;
1168
  }
1169
-
1170
- $plugin = new stdClass();
1171
- $plugin->id = $extension->id;
1172
- $plugin->slug = $extension->slug;
1173
- $plugin->plugin = $extension->plugin;
1174
- $plugin->new_version = $new_version;
1175
- $plugin->url = '';
1176
- $value->response[$extension->plugin] = $plugin;
1177
-
1178
- $value->response[$extension->plugin]->package = '';
1179
-
1180
- if (class_exists('NewsletterExtensions')) {
1181
- // NO filters here!
1182
- $value->response[$extension->plugin]->package = NewsletterExtensions::$instance->get_package($extension->id);
1183
  }
1184
 
 
 
 
 
 
 
 
 
 
1185
  return $value;
1186
  }
1187
 
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: 6.1.9
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.
29
  */
30
 
31
  // Used as dummy parameter on css and js links
32
+ define('NEWSLETTER_VERSION', '6.1.9');
33
 
34
  global $newsletter, $wpdb;
35
 
399
 
400
  add_shortcode('newsletter_replace', array($this, 'shortcode_newsletter_replace'));
401
 
402
+ add_filter('site_transient_update_plugins', array($this, 'hook_site_transient_update_plugins'));
403
+
404
  if (is_admin()) {
405
  add_action('in_admin_header', array($this, 'hook_in_admin_header'), 1000);
406
 
1092
  $this->mailer->SmtpClose();
1093
  }
1094
 
1095
+ function hook_site_transient_update_plugins($value) {
1096
+ static $extra_response = array();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1097
 
1098
+ //$this->logger->debug('Update plugins transient called');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1099
 
 
1100
  if (!is_object($value)) {
1101
+ //$this->logger->info('Empty object');
1102
+ return $value;
1103
+ }
1104
+
1105
+ if ($extra_response) {
1106
+ //$this->logger->debug('Already updated');
1107
+ $value->response = array_merge($value->response, $extra_response);
1108
  return $value;
1109
  }
1110
 
1111
+ $extensions = $this->getTnpExtensions();
1112
+
1113
+ foreach ($extensions as $extension) {
1114
+ unset($value->response[$extension->wp_slug]);
1115
+ unset($value->no_update[$extension->wp_slug]);
1116
+ }
1117
 
1118
  if (!NEWSLETTER_EXTENSION_UPDATE) {
1119
+ //$this->logger->info('Updates disabled');
1120
  return $value;
1121
  }
1122
 
1123
  include_once(ABSPATH . 'wp-admin/includes/plugin.php');
1124
 
1125
  if (!function_exists('get_plugin_data')) {
1126
+ //$this->logger->error('No get_plugin_data function available!');
1127
  return $value;
1128
  }
1129
 
1130
+ foreach ($extensions as $extension) {
1131
+
1132
+ // Patch for names convention
1133
+ $extension->plugin = $extension->wp_slug;
1134
+
1135
+ //$this->logger->debug('Processing ' . $extension->plugin);
1136
+ //$this->logger->debug($extension);
1137
+
1138
+ $plugin_data = false;
1139
+ if (file_exists(WP_PLUGIN_DIR . '/' . $extension->plugin)) {
1140
+ $plugin_data = get_plugin_data(WP_PLUGIN_DIR . '/' . $extension->plugin, false, false);
1141
+ } else if (file_exists(WPMU_PLUGIN_DIR . '/' . $extension->plugin)) {
1142
+ $plugin_data = get_plugin_data(WPMU_PLUGIN_DIR . '/' . $extension->plugin, false, false);
1143
+ }
1144
 
1145
+ if (!$plugin_data) {
1146
+ //$this->logger->debug('Seems not installed');
1147
+ continue;
1148
+ }
1149
 
1150
+ $plugin = new stdClass();
1151
+ $plugin->id = $extension->id;
1152
+ $plugin->slug = $extension->slug;
1153
+ $plugin->plugin = $extension->plugin;
1154
+ $plugin->new_version = $extension->version;
1155
+ $plugin->url = $extension->url;
1156
+ if (class_exists('NewsletterExtensions') && $this->get_license_key()) {
1157
+ // NO filters here!
1158
+ $plugin->package = NewsletterExtensions::$instance->get_package($extension->id);
1159
+ } else {
1160
+
1161
+ }
1162
+ // [banners] => Array
1163
+ // (
1164
+ // [2x] => https://ps.w.org/wp-rss-aggregator/assets/banner-1544x500.png?rev=2040548
1165
+ // [1x] => https://ps.w.org/wp-rss-aggregator/assets/banner-772x250.png?rev=2040548
1166
+ // )
1167
+ // [icons] => Array
1168
+ // (
1169
+ // [2x] => https://ps.w.org/advanced-custom-fields/assets/icon-256x256.png?rev=1082746
1170
+ // [1x] => https://ps.w.org/advanced-custom-fields/assets/icon-128x128.png?rev=1082746
1171
+ // )
1172
+ if (version_compare($extension->version, $plugin_data['Version']) > 0) {
1173
+ //$this->logger->debug('There is a new version');
1174
+ $extra_response[$extension->plugin] = $plugin;
1175
+ } else {
1176
+ //$this->logger->debug('There is NOT a new version');
1177
+ $value->no_update[$extension->plugin] = $plugin;
1178
+ }
1179
+ //$this->logger->debug('Added');
1180
  }
1181
+
1182
+ $value->response = array_merge($value->response, $extra_response);
1183
+
1184
+ return $value;
1185
+ }
1186
 
1187
+ /**
1188
+ * @deprecated since version 6.1.9
1189
+ */
1190
+ function get_extension_version($extension_id) {
1191
+ $extensions = $this->getTnpExtensions();
1192
 
1193
+ if (!is_array($extensions)) {
1194
+ return null;
1195
  }
1196
+ foreach ($extensions as $extension) {
1197
+ if ($extension->id == $extension_id) {
1198
+ return $extension->version;
1199
+ }
 
 
 
 
 
 
 
 
 
 
1200
  }
1201
 
1202
+ return null;
1203
+ }
1204
+
1205
+ /**
1206
+ * MUST be kept for old addons.
1207
+ *
1208
+ * @deprecated since version 6.1.9
1209
+ */
1210
+ function set_extension_update_data($value, $extension) {
1211
  return $value;
1212
  }
1213
 
readme.txt CHANGED
@@ -1,8 +1,8 @@
1
  === Newsletter ===
2
  Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
3
  Requires at least: 3.4.0
4
- Tested up to: 5.2.2
5
- Stable tag: 6.1.8
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
@@ -108,6 +108,14 @@ Thank you, The Newsletter Team
108
 
109
  == Changelog ==
110
 
 
 
 
 
 
 
 
 
111
  = 6.1.8 =
112
 
113
  * Fixed a version check on main settings
1
  === Newsletter ===
2
  Tags: email, email marketing, newsletter, newsletter subscribers, welcome email, signup forms, contact, lead generation, popup, marketing automation
3
  Requires at least: 3.4.0
4
+ Tested up to: 5.2.3
5
+ Stable tag: 6.1.9
6
  Contributors: satollo,webagile,michael-travan
7
 
8
  Add a real newsletter system to your blog. For free. With unlimited newsletters and subscribers.
108
 
109
  == Changelog ==
110
 
111
+ = 6.1.9 =
112
+
113
+ * Fixed a missing default on profile configuration
114
+ * Fixed the default message template
115
+ * Added image alt on image block
116
+ * Improved addons version check and performances
117
+ * Post block and image block fixes
118
+
119
  = 6.1.8 =
120
 
121
  * Fixed a version check on main settings
subscription/defaults-profile.php CHANGED
@@ -31,6 +31,8 @@ $options['sex_male'] = 'Man';
31
  $options['sex_female'] = 'Woman';
32
  $options['sex_none'] = 'Not specified';
33
 
 
 
34
  for ($i=1; $i<=NEWSLETTER_PROFILE_MAX; $i++) {
35
  $options['profile_' . $i . '_status'] = 0;
36
  $options['profile_' . $i] = '';
31
  $options['sex_female'] = 'Woman';
32
  $options['sex_none'] = 'Not specified';
33
 
34
+ $options['profile_error'] = __('A mandatory field is not filled in', 'newsletter');
35
+
36
  for ($i=1; $i<=NEWSLETTER_PROFILE_MAX; $i++) {
37
  $options['profile_' . $i . '_status'] = 0;
38
  $options['profile_' . $i] = '';
subscription/email.html CHANGED
@@ -34,7 +34,7 @@
34
  <table style="background-color: #fff; max-width: 600px; width: 100%; border: 1px solid #ddd;">
35
  <tr>
36
  <td style="padding: 15px; color: #333; font-size: 16px; font-family: sans-serif">
37
- <!-- The {message} tag is replaced with one of confirmation, welcome or goodbye messages -->
38
  <!-- Messages content can be configured on Newsletter List Building panels -->
39
 
40
  {message}
34
  <table style="background-color: #fff; max-width: 600px; width: 100%; border: 1px solid #ddd;">
35
  <tr>
36
  <td style="padding: 15px; color: #333; font-size: 16px; font-family: sans-serif">
37
+ <!-- The "message" tag below is replaced with one of confirmation, welcome or goodbye messages -->
38
  <!-- Messages content can be configured on Newsletter List Building panels -->
39
 
40
  {message}