Newsletter - Version 6.1.5

Version Description

  • Improved the Gutenberg block
Download this release

Release Info

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

Code changes from version 6.1.4 to 6.1.5

Files changed (3) hide show
  1. plugin.php +2 -2
  2. readme.txt +5 -1
  3. subscription/subscription.php +29 -29
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.4
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.4');
33
 
34
  global $newsletter, $wpdb;
35
 
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.5
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.5');
33
 
34
  global $newsletter, $wpdb;
35
 
readme.txt CHANGED
@@ -2,7 +2,7 @@
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.4
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,10 @@ Thank you, The Newsletter Team
108
 
109
  == Changelog ==
110
 
 
 
 
 
111
  = 6.1.4 =
112
 
113
  * Support for Automated theme regeneration
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.5
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.5 =
112
+
113
+ * Improved the Gutenberg block
114
+
115
  = 6.1.4 =
116
 
117
  * Support for Automated theme regeneration
subscription/subscription.php CHANGED
@@ -60,13 +60,12 @@ class NewsletterSubscription extends NewsletterModule {
60
  if (isset($_GET['page']) && $_GET['page'] === 'newsletter_subscription_forms') {
61
  header('X-XSS-Protection: 0');
62
  }
63
- // Add custom blocks to Gutenberg
64
- wp_enqueue_script(
65
- 'tnp-blocks',
66
- NEWSLETTER_URL . '/includes/tnp-blocks.js',
67
- array('wp-blocks', 'wp-element', 'wp-editor'),
68
- true
69
- );
70
  }
71
 
72
  function hook_wp_enqueue_scripts() {
@@ -74,7 +73,7 @@ class NewsletterSubscription extends NewsletterModule {
74
  wp_enqueue_script('newsletter-subscription', plugins_url('newsletter') . '/subscription/validate.js', array(), NEWSLETTER_VERSION, true);
75
 
76
  $options = $this->get_options('profile', $this->get_current_language());
77
-
78
  $data = array();
79
  $data['messages'] = array();
80
  if (isset($options['email_error'])) {
@@ -587,7 +586,7 @@ class NewsletterSubscription extends NewsletterModule {
587
 
588
  $id = (int) $id;
589
 
590
- $wpdb->update(NEWSLETTER_USERS_TABLE, array('updated' => $time, 'ip' => $ip, 'geo'=>0), array('id' => $id));
591
  }
592
 
593
  /**
@@ -831,7 +830,7 @@ class NewsletterSubscription extends NewsletterModule {
831
  */
832
  function mail($user, $subject, $message) {
833
  $language = $this->get_user_language($user);
834
-
835
  $options_template = $this->get_options('template', $language);
836
 
837
  $template = trim($options_template['template']);
@@ -845,7 +844,7 @@ class NewsletterSubscription extends NewsletterModule {
845
  // Replaces tags from the template
846
  $message = $this->replace($message, $user);
847
  $subject = $this->replace($subject, $user);
848
-
849
  return Newsletter::instance()->mail($user->email, $subject, $message, $headers);
850
  }
851
 
@@ -915,7 +914,7 @@ class NewsletterSubscription extends NewsletterModule {
915
  if (!$force && !empty($this->options[$type . '_disabled'])) {
916
  return true;
917
  }
918
-
919
  $language = $this->get_user_language($user);
920
 
921
  $options = $this->get_options('', $language);
@@ -924,7 +923,7 @@ class NewsletterSubscription extends NewsletterModule {
924
  $message = $this->add_microdata($message);
925
  }
926
  $subject = $options[$type . '_subject'];
927
-
928
  return $this->mail($user, $subject, $message);
929
  }
930
 
@@ -1061,9 +1060,9 @@ class NewsletterSubscription extends NewsletterModule {
1061
  $buffer = '<form method="post" action="' . $action . '" class="' . $class . '" style="' . $style . '">' . "\n";
1062
 
1063
  $language = $this->get_current_language();
1064
-
1065
  $buffer .= '<input type="hidden" name="nlang" value="' . esc_attr($language) . '">' . "\n";
1066
-
1067
  if (isset($attrs['referrer'])) {
1068
  $buffer .= '<input type="hidden" name="nr" value="' . esc_attr($attrs['referrer']) . '">' . "\n";
1069
  }
@@ -1105,7 +1104,7 @@ class NewsletterSubscription extends NewsletterModule {
1105
 
1106
  function _shortcode_label($name, $attrs, $suffix = null) {
1107
  $options_profile = $this->get_options('profile', $this->get_current_language());
1108
-
1109
  if (!$suffix) {
1110
  $suffix = $name;
1111
  }
@@ -1327,8 +1326,9 @@ class NewsletterSubscription extends NewsletterModule {
1327
  function get_privacy_field() {
1328
  $options_profile = $this->get_options('profile', $this->get_current_language());
1329
  $privacy_status = (int) $options_profile['privacy_status'];
1330
- if (empty($privacy_status)) return false;
1331
-
 
1332
  $buffer = '<label>';
1333
  if ($privacy_status === 1) {
1334
  $buffer .= '<input type="checkbox" name="ny" required class="tnp-privacy">&nbsp;';
@@ -1544,14 +1544,14 @@ class NewsletterSubscription extends NewsletterModule {
1544
  $buffer .= '<div class="tnp-field tnp-field-button">';
1545
 
1546
  $button_style = '';
1547
- if (!empty($attrs['button_color'])) {
1548
- $button_style = 'style="background-color:' . esc_attr( $attrs['button_color'] ) . '"';
1549
- }
1550
 
1551
  if (strpos($options_profile['subscribe'], 'http') === 0) {
1552
  $buffer .= '<input class="tnp-submit-image" type="image" src="' . esc_attr($options_profile['subscribe']) . '">' . "\n";
1553
  } else {
1554
- $buffer .= '<input class="tnp-submit" type="submit" value="' . esc_attr($options_profile['subscribe']) . '" ' . $button_style .'>' . "\n";
1555
  }
1556
 
1557
  $buffer .= "</div>\n</form>\n";
@@ -1614,7 +1614,7 @@ class NewsletterSubscription extends NewsletterModule {
1614
  "first name: " . $user->name . "\n" .
1615
  "last name: " . $user->surname . "\n" .
1616
  "gender: " . $user->sex . "\n";
1617
-
1618
  $lists = $this->get_lists();
1619
  foreach ($lists as $list) {
1620
  $field = 'list_' . $list->id;
@@ -1647,8 +1647,8 @@ class NewsletterSubscription extends NewsletterModule {
1647
  }
1648
  $options_profile = $this->get_options('profile', $language);
1649
  $attrs = array_merge(array('class' => '', 'referrer' => 'minimal',
1650
- 'button' => $options_profile['subscribe'], 'button_color' => '',
1651
- 'button_radius' => '', 'placeholder' => $options_profile['email']), $attrs);
1652
 
1653
  $form = '';
1654
  $form .= '<div class="tnp tnp-subscription-minimal ' . $attrs['class'] . '">';
@@ -1663,13 +1663,13 @@ class NewsletterSubscription extends NewsletterModule {
1663
  $form .= '<input type="hidden" name="nlang" value="' . esc_attr($language) . '">' . "\n";
1664
  $form .= '<input class="tnp-email" type="email" required name="ne" value="" placeholder="' . esc_attr($attrs['placeholder']) . '">';
1665
  $form .= '<input class="tnp-submit" type="submit" value="' . esc_attr($attrs['button']) . '"'
1666
- .' style="background-color:' . esc_attr($attrs['button_color']) . '">';
1667
-
1668
  $privacy_field = $this->get_privacy_field();
1669
  if (!empty($privacy_field)) {
1670
- $form .= '<div class="tnp-privacy-field">' . $privacy_field . '</div>';
1671
  }
1672
-
1673
  $form .= "</form></div>\n";
1674
 
1675
  return $form;
60
  if (isset($_GET['page']) && $_GET['page'] === 'newsletter_subscription_forms') {
61
  header('X-XSS-Protection: 0');
62
  }
63
+
64
+ if (function_exists('register_block_type')) {
65
+ // Add custom blocks to Gutenberg
66
+ wp_register_script('tnp-blocks', NEWSLETTER_URL . '/includes/tnp-blocks.js', array('wp-blocks', 'wp-element', 'wp-editor'), NEWSLETTER_VERSION);
67
+ register_block_type('tnp/minimal', array('editor_script' => 'tnp-blocks'));
68
+ }
 
69
  }
70
 
71
  function hook_wp_enqueue_scripts() {
73
  wp_enqueue_script('newsletter-subscription', plugins_url('newsletter') . '/subscription/validate.js', array(), NEWSLETTER_VERSION, true);
74
 
75
  $options = $this->get_options('profile', $this->get_current_language());
76
+
77
  $data = array();
78
  $data['messages'] = array();
79
  if (isset($options['email_error'])) {
586
 
587
  $id = (int) $id;
588
 
589
+ $wpdb->update(NEWSLETTER_USERS_TABLE, array('updated' => $time, 'ip' => $ip, 'geo' => 0), array('id' => $id));
590
  }
591
 
592
  /**
830
  */
831
  function mail($user, $subject, $message) {
832
  $language = $this->get_user_language($user);
833
+
834
  $options_template = $this->get_options('template', $language);
835
 
836
  $template = trim($options_template['template']);
844
  // Replaces tags from the template
845
  $message = $this->replace($message, $user);
846
  $subject = $this->replace($subject, $user);
847
+
848
  return Newsletter::instance()->mail($user->email, $subject, $message, $headers);
849
  }
850
 
914
  if (!$force && !empty($this->options[$type . '_disabled'])) {
915
  return true;
916
  }
917
+
918
  $language = $this->get_user_language($user);
919
 
920
  $options = $this->get_options('', $language);
923
  $message = $this->add_microdata($message);
924
  }
925
  $subject = $options[$type . '_subject'];
926
+
927
  return $this->mail($user, $subject, $message);
928
  }
929
 
1060
  $buffer = '<form method="post" action="' . $action . '" class="' . $class . '" style="' . $style . '">' . "\n";
1061
 
1062
  $language = $this->get_current_language();
1063
+
1064
  $buffer .= '<input type="hidden" name="nlang" value="' . esc_attr($language) . '">' . "\n";
1065
+
1066
  if (isset($attrs['referrer'])) {
1067
  $buffer .= '<input type="hidden" name="nr" value="' . esc_attr($attrs['referrer']) . '">' . "\n";
1068
  }
1104
 
1105
  function _shortcode_label($name, $attrs, $suffix = null) {
1106
  $options_profile = $this->get_options('profile', $this->get_current_language());
1107
+
1108
  if (!$suffix) {
1109
  $suffix = $name;
1110
  }
1326
  function get_privacy_field() {
1327
  $options_profile = $this->get_options('profile', $this->get_current_language());
1328
  $privacy_status = (int) $options_profile['privacy_status'];
1329
+ if (empty($privacy_status))
1330
+ return false;
1331
+
1332
  $buffer = '<label>';
1333
  if ($privacy_status === 1) {
1334
  $buffer .= '<input type="checkbox" name="ny" required class="tnp-privacy">&nbsp;';
1544
  $buffer .= '<div class="tnp-field tnp-field-button">';
1545
 
1546
  $button_style = '';
1547
+ if (!empty($attrs['button_color'])) {
1548
+ $button_style = 'style="background-color:' . esc_attr($attrs['button_color']) . '"';
1549
+ }
1550
 
1551
  if (strpos($options_profile['subscribe'], 'http') === 0) {
1552
  $buffer .= '<input class="tnp-submit-image" type="image" src="' . esc_attr($options_profile['subscribe']) . '">' . "\n";
1553
  } else {
1554
+ $buffer .= '<input class="tnp-submit" type="submit" value="' . esc_attr($options_profile['subscribe']) . '" ' . $button_style . '>' . "\n";
1555
  }
1556
 
1557
  $buffer .= "</div>\n</form>\n";
1614
  "first name: " . $user->name . "\n" .
1615
  "last name: " . $user->surname . "\n" .
1616
  "gender: " . $user->sex . "\n";
1617
+
1618
  $lists = $this->get_lists();
1619
  foreach ($lists as $list) {
1620
  $field = 'list_' . $list->id;
1647
  }
1648
  $options_profile = $this->get_options('profile', $language);
1649
  $attrs = array_merge(array('class' => '', 'referrer' => 'minimal',
1650
+ 'button' => $options_profile['subscribe'], 'button_color' => '',
1651
+ 'button_radius' => '', 'placeholder' => $options_profile['email']), $attrs);
1652
 
1653
  $form = '';
1654
  $form .= '<div class="tnp tnp-subscription-minimal ' . $attrs['class'] . '">';
1663
  $form .= '<input type="hidden" name="nlang" value="' . esc_attr($language) . '">' . "\n";
1664
  $form .= '<input class="tnp-email" type="email" required name="ne" value="" placeholder="' . esc_attr($attrs['placeholder']) . '">';
1665
  $form .= '<input class="tnp-submit" type="submit" value="' . esc_attr($attrs['button']) . '"'
1666
+ . ' style="background-color:' . esc_attr($attrs['button_color']) . '">';
1667
+
1668
  $privacy_field = $this->get_privacy_field();
1669
  if (!empty($privacy_field)) {
1670
+ $form .= '<div class="tnp-privacy-field">' . $privacy_field . '</div>';
1671
  }
1672
+
1673
  $form .= "</form></div>\n";
1674
 
1675
  return $form;