Subscribe2 - Version 10.31

Version Description

Download this release

Release Info

Developer Collizo4sky
Plugin Icon 128x128 Subscribe2
Version 10.31
Comparing to
See all releases

Code changes from version 10.30.1 to 10.31

ChangeLog.txt CHANGED
@@ -1,3 +1,11 @@
 
 
 
 
 
 
 
 
1
  = 10.30.1 =
2
 
3
  * Clean unused global variables
1
+ = 10.31 =
2
+
3
+ * Enhance DNS check when validating email addresses
4
+ * Pass full email as second parameter to 's2_sanitize_email' filter
5
+ * Validate emails fully when making database changes, but simpler and faster checks when sending notifications
6
+ * Better escaping of subscriber email data when reporting errors to Subscribers page
7
+ * Fix some Coding Standards Issues
8
+
9
  = 10.30.1 =
10
 
11
  * Clean unused global variables
admin/settings.php CHANGED
@@ -83,7 +83,7 @@ if ( isset( $_POST['s2_admin'] ) ) {
83
  $timestamp_offset = get_option( 'gmt_offset' ) * 60 * 60;
84
  $crondate = ( isset( $_POST['crondate'] ) ) ? $_POST['crondate'] : 0;
85
  $crontime = ( isset( $_POST['crondate'] ) ) ? $_POST['crontime'] : 0;
86
- if ( $email_freq !== $this->subscribe2_options['email_freq'] || date_i18n( get_option( 'date_format' ), $scheduled_time + $timestamp_offset ) !== $crondate || date( 'G', $scheduled_time + $timestamp_offset ) !== $crontime ) {
87
  $this->subscribe2_options['email_freq'] = $email_freq;
88
  wp_clear_scheduled_hook( 's2_digest_cron' );
89
  $scheds = (array) wp_get_schedules();
@@ -150,7 +150,7 @@ foreach ( $disallowed_keywords as $disallowed_keyword ) {
150
  $template_link = '<a href="' . admin_url( 'admin.php?page=s2_settings&tab=templates' ) . '">' . __( 'Modify your template', 'subscribe2' ) . '</a>';
151
  if ( false !== $disallowed ) {
152
  $disallowed_keywords = __( 'Your chosen email type (per-post or digest) does not support the following keywords:', 'subscribe2' );
153
- echo '<div id="keyword_message" class="error"><p class="s2_error"><strong>' . $disallowed_keywords . '</strong><br />' . implode( $disallowed, ', ' ) . '<br />' . $template_link . '</p></div>';
154
  }
155
 
156
  // send error message if sender email address is off-domain
@@ -160,8 +160,8 @@ if ( 'blogname' === $this->subscribe2_options['sender'] ) {
160
  $user = $this->get_userdata( $this->subscribe2_options['sender'] );
161
  $sender = $user->user_email;
162
  }
163
- list( $user, $domain ) = explode( '@', $sender, 2 );
164
- if ( ! stristr( esc_html( $_SERVER['SERVER_NAME'] ), $domain ) && 'author' !== $this->subscribe2_options['sender'] && '0' === $this->subscribe2_options['dismiss_sender_warning'] ) {
165
  // Translators: Warning message
166
  echo '<div id="sender_message" class="error notice is-dismissible"><p class="s2_error"><strong>' . sprintf( __( 'You appear to be sending notifications from %1$s, which has a different domain name than your blog server %2$s. This may result in failed emails.', 'subscribe2' ), $sender, $_SERVER['SERVER_NAME'] ) . '</strong></p></div>';
167
  }
83
  $timestamp_offset = get_option( 'gmt_offset' ) * 60 * 60;
84
  $crondate = ( isset( $_POST['crondate'] ) ) ? $_POST['crondate'] : 0;
85
  $crontime = ( isset( $_POST['crondate'] ) ) ? $_POST['crontime'] : 0;
86
+ if ( $email_freq !== $this->subscribe2_options['email_freq'] || date_i18n( get_option( 'date_format' ), $scheduled_time + $timestamp_offset ) !== $crondate || gmdate( 'G', $scheduled_time + $timestamp_offset ) !== $crontime ) {
87
  $this->subscribe2_options['email_freq'] = $email_freq;
88
  wp_clear_scheduled_hook( 's2_digest_cron' );
89
  $scheds = (array) wp_get_schedules();
150
  $template_link = '<a href="' . admin_url( 'admin.php?page=s2_settings&tab=templates' ) . '">' . __( 'Modify your template', 'subscribe2' ) . '</a>';
151
  if ( false !== $disallowed ) {
152
  $disallowed_keywords = __( 'Your chosen email type (per-post or digest) does not support the following keywords:', 'subscribe2' );
153
+ echo '<div id="keyword_message" class="error"><p class="s2_error"><strong>' . $disallowed_keywords . '</strong><br />' . implode( ', ', $disallowed ) . '<br />' . $template_link . '</p></div>';
154
  }
155
 
156
  // send error message if sender email address is off-domain
160
  $user = $this->get_userdata( $this->subscribe2_options['sender'] );
161
  $sender = $user->user_email;
162
  }
163
+ list( $user, $sender_domain ) = explode( '@', $sender, 2 );
164
+ if ( ! stristr( esc_html( $_SERVER['SERVER_NAME'] ), $sender_domain ) && 'author' !== $this->subscribe2_options['sender'] && '0' === $this->subscribe2_options['dismiss_sender_warning'] ) {
165
  // Translators: Warning message
166
  echo '<div id="sender_message" class="error notice is-dismissible"><p class="s2_error"><strong>' . sprintf( __( 'You appear to be sending notifications from %1$s, which has a different domain name than your blog server %2$s. This may result in failed emails.', 'subscribe2' ), $sender, $_SERVER['SERVER_NAME'] ) . '</strong></p></div>';
167
  }
admin/subscribers.php CHANGED
@@ -39,43 +39,43 @@ if ( isset( $_POST['s2_admin'] ) ) {
39
  $email_error = '';
40
  $message = '';
41
  foreach ( preg_split( '/[\s,]+/', $_POST['addresses'] ) as $email ) {
42
- $email = $this->sanitize_email( $email );
43
- if ( false === $this->validate_email( $email ) ) {
44
  ( '' === $email_error ) ? $email_error = "$email" : $email_error .= ", $email";
45
  continue;
46
  } else {
47
  if ( isset( $_POST['subscribe'] ) ) {
48
- if ( false !== $this->is_public( $email ) ) {
49
- ( '' === $pub_sub_error ) ? $pub_sub_error = "$email" : $pub_sub_error .= ", $email";
50
  continue;
51
  }
52
- if ( $this->is_registered( $email ) ) {
53
- ( '' === $reg_sub_error ) ? $reg_sub_error = "$email" : $reg_sub_error .= ", $email";
54
  continue;
55
  }
56
- $this->add( $email, true );
57
  $message = '<div id="message" class="updated fade"><p><strong>' . __( 'Address(es) subscribed!', 'subscribe2' ) . '</strong></p></div>';
58
  } elseif ( isset( $_POST['unsubscribe'] ) ) {
59
- if ( false === $this->is_public( $email ) || $this->is_registered( $email ) ) {
60
- ( '' === $unsub_error ) ? $unsub_error = "$email" : $unsub_error .= ", $email";
61
  continue;
62
  }
63
- $this->delete( $email );
64
  $message = '<div id="message" class="updated fade"><p><strong>' . __( 'Address(es) unsubscribed!', 'subscribe2' ) . '</strong></p></div>';
65
  }
66
  }
67
  }
68
  if ( '' !== $reg_sub_error ) {
69
- echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following are already Registered Subscribers', 'subscribe2' ) . ':<br />' . $reg_sub_error . '</strong></p></div>';
70
  }
71
  if ( '' !== $pub_sub_error ) {
72
- echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following are already Public Subscribers', 'subscribe2' ) . ':<br />' . $pub_sub_error . '</strong></p></div>';
73
  }
74
  if ( '' !== $unsub_error ) {
75
- echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following were not in the database', 'subscribe2' ) . ':<br /> ' . $unsub_error . '</strong></p></div>';
76
  }
77
  if ( '' !== $email_error ) {
78
- echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following were invalid email addresses', 'subscribe2' ) . ':<br /> ' . $email_error . '</strong></p></div>';
79
  }
80
  if ( '' !== $message ) {
81
  echo $message;
39
  $email_error = '';
40
  $message = '';
41
  foreach ( preg_split( '/[\s,]+/', $_POST['addresses'] ) as $email ) {
42
+ $clean_email = $this->sanitize_email( $email );
43
+ if ( false === $this->validate_email( $clean_email ) ) {
44
  ( '' === $email_error ) ? $email_error = "$email" : $email_error .= ", $email";
45
  continue;
46
  } else {
47
  if ( isset( $_POST['subscribe'] ) ) {
48
+ if ( false !== $this->is_public( $clean_email ) ) {
49
+ ( '' === $pub_sub_error ) ? $pub_sub_error = "$clean_email" : $pub_sub_error .= ", $clean_email";
50
  continue;
51
  }
52
+ if ( $this->is_registered( $clean_email ) ) {
53
+ ( '' === $reg_sub_error ) ? $reg_sub_error = "$clean_email" : $reg_sub_error .= ", $clean_email";
54
  continue;
55
  }
56
+ $this->add( $clean_email, true );
57
  $message = '<div id="message" class="updated fade"><p><strong>' . __( 'Address(es) subscribed!', 'subscribe2' ) . '</strong></p></div>';
58
  } elseif ( isset( $_POST['unsubscribe'] ) ) {
59
+ if ( false === $this->is_public( $clean_email ) || $this->is_registered( $clean_email ) ) {
60
+ ( '' === $unsub_error ) ? $unsub_error = "$clean_email" : $unsub_error .= ", $clean_email";
61
  continue;
62
  }
63
+ $this->delete( $clean_email );
64
  $message = '<div id="message" class="updated fade"><p><strong>' . __( 'Address(es) unsubscribed!', 'subscribe2' ) . '</strong></p></div>';
65
  }
66
  }
67
  }
68
  if ( '' !== $reg_sub_error ) {
69
+ echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following are already Registered Subscribers', 'subscribe2' ) . ':<br />' . esc_html( $reg_sub_error ) . '</strong></p></div>';
70
  }
71
  if ( '' !== $pub_sub_error ) {
72
+ echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following are already Public Subscribers', 'subscribe2' ) . ':<br />' . esc_html( $pub_sub_error ) . '</strong></p></div>';
73
  }
74
  if ( '' !== $unsub_error ) {
75
+ echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following were not in the database', 'subscribe2' ) . ':<br /> ' . esc_html( $unsub_error ) . '</strong></p></div>';
76
  }
77
  if ( '' !== $email_error ) {
78
+ echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following were invalid email addresses', 'subscribe2' ) . ':<br /> ' . esc_html( $email_error ) . '</strong></p></div>';
79
  }
80
  if ( '' !== $message ) {
81
  echo $message;
classes/class-mo-admin-notice.php ADDED
@@ -0,0 +1,183 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ if ( ! class_exists( 'MO_Admin_Notice' ) ) {
4
+
5
+ class MO_Admin_Notice {
6
+ public function __construct() {
7
+ add_action( 'admin_notices', array( $this, 'admin_notice' ) );
8
+ add_action( 'network_admin_notices', array( $this, 'admin_notice' ) );
9
+
10
+ add_action( 'admin_init', array( $this, 'dismiss_admin_notice' ) );
11
+ }
12
+
13
+ public function dismiss_admin_notice() {
14
+ if ( ! isset( $_GET['mo-adaction'] ) || 'mo_dismiss_adnotice' !== $_GET['mo-adaction'] ) {
15
+ return;
16
+ }
17
+
18
+ $url = admin_url();
19
+ update_option( 'mo_dismiss_adnotice', 'true' );
20
+
21
+ wp_safe_redirect( $url );
22
+ exit;
23
+ }
24
+
25
+ public function admin_notice() {
26
+
27
+ global $pagenow;
28
+
29
+ if ( 'index.php' === $pagenow || ( isset( $_GET['page'] ) && false !== strpos( $_GET['page'], 's2_' ) ) ) {
30
+
31
+ if ( get_option( 'mo_dismiss_adnotice', 'false' ) === 'true' ) {
32
+ return;
33
+ }
34
+
35
+ if ( $this->is_plugin_installed() && $this->is_plugin_active() ) {
36
+ return;
37
+ }
38
+
39
+ $dismiss_url = esc_url_raw(
40
+ add_query_arg(
41
+ array(
42
+ 'mo-adaction' => 'mo_dismiss_adnotice',
43
+ ),
44
+ admin_url()
45
+ )
46
+ );
47
+ $this->notice_css();
48
+ $install_url = wp_nonce_url(
49
+ admin_url( 'update.php?action=install-plugin&plugin=mailoptin' ),
50
+ 'install-plugin_mailoptin'
51
+ );
52
+
53
+ $activate_url = wp_nonce_url( admin_url( 'plugins.php?action=activate&plugin=mailoptin%2Fmailoptin.php' ), 'activate-plugin_mailoptin/mailoptin.php' );
54
+ ?>
55
+ <div class="mo-admin-notice notice notice-success">
56
+ <div class="mo-notice-first-half">
57
+ <p>
58
+ <?php
59
+ printf(
60
+ // Translators: Mail Optin admin notice
61
+ __( 'Free optin form plugin that will %1$sincrease your email list subscribers%2$s and keep them engaged with %1$sautomated and schedule newsletters%2$s.', 'subscribe2' ),
62
+ '<span class="mo-stylize"><strong>',
63
+ '</strong></span>'
64
+ );
65
+ ?>
66
+ </p>
67
+ <p style="text-decoration: underline;font-size: 12px;">Recommended by Subscribe2 plugin</p>
68
+ </div>
69
+ <div class="mo-notice-other-half">
70
+ <?php if ( ! $this->is_plugin_installed() ) : ?>
71
+ <a class="button button-primary button-hero" id="mo-install-mailoptin-plugin" href="<?php echo $install_url; ?>">
72
+ <?php _e( 'Install MailOptin Now for Free!', 'subscribe2' ); ?>
73
+ </a>
74
+ <?php endif; ?>
75
+ <?php if ( $this->is_plugin_installed() && ! $this->is_plugin_active() ) : ?>
76
+ <a class="button button-primary button-hero" id="mo-activate-mailoptin-plugin" href="<?php echo $activate_url; ?>">
77
+ <?php _e( 'Activate MailOptin Now!', 'subscribe2' ); ?>
78
+ </a>
79
+ <?php endif; ?>
80
+ <div class="mo-notice-learn-more">
81
+ <a target="_blank" href="https://mailoptin.io">Learn more</a>
82
+ </div>
83
+ </div>
84
+ <a href="<?php echo $dismiss_url; ?>">
85
+ <button type="button" class="notice-dismiss">
86
+ <span class="screen-reader-text"><?php _e( 'Dismiss this notice', 'subscribe2' ); ?>.</span>
87
+ </button>
88
+ </a>
89
+ </div>
90
+ <?php
91
+ }
92
+ }
93
+
94
+ public function current_admin_url() {
95
+ $parts = wp_parse_url( home_url() );
96
+ $uri = $parts['scheme'] . '://' . $parts['host'];
97
+
98
+ if ( array_key_exists( 'port', $parts ) ) {
99
+ $uri .= ':' . $parts['port'];
100
+ }
101
+
102
+ $uri .= add_query_arg( array() );
103
+
104
+ return $uri;
105
+ }
106
+
107
+ public function is_plugin_installed() {
108
+ $installed_plugins = get_plugins();
109
+
110
+ return isset( $installed_plugins['mailoptin/mailoptin.php'] );
111
+ }
112
+
113
+ public function is_plugin_active() {
114
+ return is_plugin_active( 'mailoptin/mailoptin.php' );
115
+ }
116
+
117
+ public function notice_css() {
118
+ ?>
119
+ <style type="text/css">
120
+ .mo-admin-notice {
121
+ background: #fff;
122
+ color: #000;
123
+ border-left-color: #46b450;
124
+ position: relative;
125
+ }
126
+
127
+ .mo-admin-notice .notice-dismiss:before {
128
+ color: #72777c;
129
+ }
130
+
131
+ .mo-admin-notice .mo-stylize {
132
+ line-height: 2;
133
+ }
134
+
135
+ .mo-admin-notice .button-primary {
136
+ background: #006799;
137
+ text-shadow: none;
138
+ border: 0;
139
+ box-shadow: none;
140
+ }
141
+
142
+ .mo-notice-first-half {
143
+ width: 66%;
144
+ display: inline-block;
145
+ margin: 10px 0;
146
+ }
147
+
148
+ .mo-notice-other-half {
149
+ width: 33%;
150
+ display: inline-block;
151
+ padding: 20px 0;
152
+ position: absolute;
153
+ text-align: center;
154
+ }
155
+
156
+ .mo-notice-first-half p {
157
+ font-size: 14px;
158
+ }
159
+
160
+ .mo-notice-learn-more a {
161
+ margin: 10px;
162
+ }
163
+
164
+ .mo-notice-learn-more {
165
+ margin-top: 10px;
166
+ }
167
+ </style>
168
+ <?php
169
+ }
170
+
171
+ public static function instance() {
172
+ static $instance = null;
173
+
174
+ if ( is_null( $instance ) ) {
175
+ $instance = new self();
176
+ }
177
+
178
+ return $instance;
179
+ }
180
+ }
181
+
182
+ MO_Admin_Notice::instance();
183
+ }
classes/class-s2-admin.php CHANGED
@@ -6,8 +6,9 @@ class S2_Admin extends S2_Core {
6
  */
7
  public function admin_menu() {
8
  add_menu_page( __( 'Subscribe2', 'subscribe2' ), __( 'Subscribe2', 'subscribe2' ), apply_filters( 's2_capability', 'read', 'user' ), 's2', null, S2URL . 'include/email-edit.png' );
9
- $s2user = add_submenu_page( 's2', __( 'Your Subscriptions', 'subscribe2' ), __( 'Your Subscriptions', 'subscribe2' ), apply_filters( 's2_capability', 'read', 'user' ), 's2', array( &$this, 'user_menu' ) );
10
- add_action( "admin_print_scripts-$s2user", array( &$this, 'checkbox_form_js' ) );
 
11
  add_action( "admin_print_styles-$s2user", array( &$this, 'user_admin_css' ) );
12
  add_action( 'load-' . $s2user, array( &$this, 'user_help' ) );
13
 
@@ -400,7 +401,7 @@ class S2_Admin extends S2_Core {
400
  'default',
401
  array(
402
  '__block_editor_compatible_meta_box' => false,
403
- '__back_compat_meta_box' => true,
404
  )
405
  );
406
  }
6
  */
7
  public function admin_menu() {
8
  add_menu_page( __( 'Subscribe2', 'subscribe2' ), __( 'Subscribe2', 'subscribe2' ), apply_filters( 's2_capability', 'read', 'user' ), 's2', null, S2URL . 'include/email-edit.png' );
9
+
10
+ $s2user = add_submenu_page( 's2', __( 'Your Subscriptions', 'subscribe2' ), __( 'Your Subscriptions', 'subscribe2' ), apply_filters( 's2_capability', 'read', 'user' ), 's2', array( &$this, 'user_menu' ) );
11
+ add_action( "admin_print_scripts-$s2user", array( &$this, 'checkbox_form_js' ) );
12
  add_action( "admin_print_styles-$s2user", array( &$this, 'user_admin_css' ) );
13
  add_action( 'load-' . $s2user, array( &$this, 'user_help' ) );
14
 
401
  'default',
402
  array(
403
  '__block_editor_compatible_meta_box' => false,
404
+ '__back_compat_meta_box' => true,
405
  )
406
  );
407
  }
classes/class-s2-ajax.php CHANGED
@@ -86,7 +86,7 @@ class S2_Ajax {
86
  echo '<p>' . __( 'Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2' ) . '</p>';
87
  } else {
88
  if ( is_int( $s2_frontend->lockout ) && $s2_frontend->lockout > 0 ) {
89
- $date = date( 'H:i:s.u', $s2_frontend->lockout );
90
  $ips = $wpdb->get_col( $wpdb->prepare( "SELECT ip FROM $wpdb->subscribe2 WHERE date = CURDATE() AND time > SUBTIME(CURTIME(), %s)", $date ) );
91
  if ( in_array( $s2_frontend->ip, $ips, true ) ) {
92
  echo '<p>' . __( 'Slow down, you move too fast.', 'subscribe2' ) . '</p>';
86
  echo '<p>' . __( 'Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2' ) . '</p>';
87
  } else {
88
  if ( is_int( $s2_frontend->lockout ) && $s2_frontend->lockout > 0 ) {
89
+ $date = gmdate( 'H:i:s.u', $s2_frontend->lockout );
90
  $ips = $wpdb->get_col( $wpdb->prepare( "SELECT ip FROM $wpdb->subscribe2 WHERE date = CURDATE() AND time > SUBTIME(CURTIME(), %s)", $date ) );
91
  if ( in_array( $s2_frontend->ip, $ips, true ) ) {
92
  echo '<p>' . __( 'Slow down, you move too fast.', 'subscribe2' ) . '</p>';
classes/class-s2-core.php CHANGED
@@ -105,7 +105,7 @@ class S2_Core {
105
  foreach ( $recipients as $recipient ) {
106
  $recipient = trim( $recipient );
107
  // sanity check -- make sure we have a valid email
108
- if ( false === $this->validate_email( $recipient ) || empty( $recipient ) ) {
109
  continue;
110
  }
111
  // Use the mail queue provided we are not sending a preview
@@ -121,7 +121,7 @@ class S2_Core {
121
  foreach ( $recipients as $recipient ) {
122
  $recipient = trim( $recipient );
123
  // sanity check -- make sure we have a valid email
124
- if ( false === $this->validate_email( $recipient ) ) {
125
  continue;
126
  }
127
  // and NOT the sender's email, since they'll get a copy anyway
@@ -138,7 +138,7 @@ class S2_Core {
138
  foreach ( $recipients as $recipient ) {
139
  $recipient = trim( $recipient );
140
  // sanity check -- make sure we have a valid email
141
- if ( false === $this->validate_email( $recipient ) ) {
142
  continue;
143
  }
144
  // and NOT the sender's email, since they'll get a copy anyway
@@ -1009,7 +1009,7 @@ class S2_Core {
1009
 
1010
  // ensure that domain is in lowercase as per internet email standards http://www.ietf.org/rfc/rfc5321.txt
1011
  list( $name, $domain ) = explode( '@', $email, 2 );
1012
- return apply_filters( 's2_sanitize_email', $name . '@' . strtolower( $domain ) );
1013
  }
1014
 
1015
  /**
@@ -1021,8 +1021,16 @@ class S2_Core {
1021
  if ( false === filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
1022
  return false;
1023
  }
 
 
 
1024
  $domain = explode( '@', $email, 2 );
1025
- if ( true === checkdnsrr( $domain[1] ) ) {
 
 
 
 
 
1026
  return $email;
1027
  } else {
1028
  return false;
@@ -1915,10 +1923,10 @@ class S2_Core {
1915
  $this->block_editor = true;
1916
  }
1917
 
1918
- // Compatibility with Fusion Builder
1919
- if ( is_plugin_active( 'fusion-builder/fusion-builder.php' ) && ! isset( $_GET['gutenberg-editor'] ) ) {
1920
- $this->block_editor = false;
1921
- }
1922
 
1923
  if ( true === $this->block_editor ) {
1924
  require_once S2PATH . 'classes/class-s2-block-editor.php';
@@ -1974,11 +1982,11 @@ class S2_Core {
1974
  add_filter( 'set-screen-option', array( &$this, 'subscribers_set_screen_option' ), 10, 3 );
1975
 
1976
  // MailOptin admin notices
1977
- require_once S2PATH . 'classes/mo-notice.php';
1978
 
1979
  // capture CSV export
1980
  if ( isset( $_POST['s2_admin'] ) && isset( $_POST['csv'] ) ) {
1981
- $date = date( 'Y-m-d' );
1982
  header( 'Content-Description: File Transfer' );
1983
  header( 'Content-type: application/octet-stream' );
1984
  header( "Content-Disposition: attachment; filename=subscribe2_users_$date.csv" );
105
  foreach ( $recipients as $recipient ) {
106
  $recipient = trim( $recipient );
107
  // sanity check -- make sure we have a valid email
108
+ if ( false === is_email( $recipient ) || empty( $recipient ) ) {
109
  continue;
110
  }
111
  // Use the mail queue provided we are not sending a preview
121
  foreach ( $recipients as $recipient ) {
122
  $recipient = trim( $recipient );
123
  // sanity check -- make sure we have a valid email
124
+ if ( false === is_email( $recipient ) ) {
125
  continue;
126
  }
127
  // and NOT the sender's email, since they'll get a copy anyway
138
  foreach ( $recipients as $recipient ) {
139
  $recipient = trim( $recipient );
140
  // sanity check -- make sure we have a valid email
141
+ if ( false === is_email( $recipient ) ) {
142
  continue;
143
  }
144
  // and NOT the sender's email, since they'll get a copy anyway
1009
 
1010
  // ensure that domain is in lowercase as per internet email standards http://www.ietf.org/rfc/rfc5321.txt
1011
  list( $name, $domain ) = explode( '@', $email, 2 );
1012
+ return apply_filters( 's2_sanitize_email', $name . '@' . strtolower( $domain ), $email );
1013
  }
1014
 
1015
  /**
1021
  if ( false === filter_var( $email, FILTER_VALIDATE_EMAIL ) ) {
1022
  return false;
1023
  }
1024
+ }
1025
+
1026
+ if ( true === apply_filters( 's2_validate_email_with_dns', true ) ) {
1027
  $domain = explode( '@', $email, 2 );
1028
+ if ( function_exists( 'idn_to_ascii' ) ) {
1029
+ $check_domain = idn_to_ascii( $domain[1], IDNA_NONTRANSITIONAL_TO_ASCII, INTL_IDNA_VARIANT_UTS46 );
1030
+ } else {
1031
+ $check_domain = $domain[1];
1032
+ }
1033
+ if ( true === checkdnsrr( $check_domain, 'MX' ) ) {
1034
  return $email;
1035
  } else {
1036
  return false;
1923
  $this->block_editor = true;
1924
  }
1925
 
1926
+ // Compatibility with Fusion Builder
1927
+ if ( is_plugin_active( 'fusion-builder/fusion-builder.php' ) && ! isset( $_GET['gutenberg-editor'] ) ) {
1928
+ $this->block_editor = false;
1929
+ }
1930
 
1931
  if ( true === $this->block_editor ) {
1932
  require_once S2PATH . 'classes/class-s2-block-editor.php';
1982
  add_filter( 'set-screen-option', array( &$this, 'subscribers_set_screen_option' ), 10, 3 );
1983
 
1984
  // MailOptin admin notices
1985
+ require_once S2PATH . 'classes/class-mo-admin-notice.php';
1986
 
1987
  // capture CSV export
1988
  if ( isset( $_POST['s2_admin'] ) && isset( $_POST['csv'] ) ) {
1989
+ $date = gmdate( 'Y-m-d' );
1990
  header( 'Content-Description: File Transfer' );
1991
  header( 'Content-type: application/octet-stream' );
1992
  header( "Content-Disposition: attachment; filename=subscribe2_users_$date.csv" );
classes/class-s2-frontend.php CHANGED
@@ -182,7 +182,7 @@ class S2_Frontend extends S2_Core {
182
  } else {
183
  $this->ip = $_POST['ip'];
184
  if ( is_int( $this->lockout ) && $this->lockout > 0 ) {
185
- $date = date( 'H:i:s.u', $this->lockout );
186
  $ips = $wpdb->get_col( $wpdb->prepare( "SELECT ip FROM $wpdb->subscribe2 WHERE date = CURDATE() AND time > SUBTIME(CURTIME(), %s)", $date ) );
187
  if ( in_array( $this->ip, $ips, true ) ) {
188
  return __( 'Slow down, you move too fast.', 'subscribe2' );
182
  } else {
183
  $this->ip = $_POST['ip'];
184
  if ( is_int( $this->lockout ) && $this->lockout > 0 ) {
185
+ $date = gmdate( 'H:i:s.u', $this->lockout );
186
  $ips = $wpdb->get_col( $wpdb->prepare( "SELECT ip FROM $wpdb->subscribe2 WHERE date = CURDATE() AND time > SUBTIME(CURTIME(), %s)", $date ) );
187
  if ( in_array( $this->ip, $ips, true ) ) {
188
  return __( 'Slow down, you move too fast.', 'subscribe2' );
classes/class-s2-upgrade.php CHANGED
@@ -22,7 +22,7 @@ class S2_Upgrade {
22
  $charset_collate .= " COLLATE {$wpdb->collate}";
23
  }
24
 
25
- $date = date( 'Y-m-d' );
26
  $sql = "CREATE TABLE $wpdb->subscribe2 (
27
  id int(11) NOT NULL auto_increment,
28
  email varchar(64) NOT NULL default '',
@@ -194,7 +194,7 @@ class S2_Upgrade {
194
  if ( ! function_exists( 'maybe_add_column' ) ) {
195
  require_once ABSPATH . 'wp-admin/install-helper.php';
196
  }
197
- $date = date( 'Y-m-d' );
198
  maybe_add_column( $wpdb->subscribe2, 'date', "ALTER TABLE $wpdb->subscribe2 ADD date DATE DEFAULT '$date' NOT NULL AFTER active" );
199
 
200
  // update the options table to serialized format
22
  $charset_collate .= " COLLATE {$wpdb->collate}";
23
  }
24
 
25
+ $date = gmdate( 'Y-m-d' );
26
  $sql = "CREATE TABLE $wpdb->subscribe2 (
27
  id int(11) NOT NULL auto_increment,
28
  email varchar(64) NOT NULL default '',
194
  if ( ! function_exists( 'maybe_add_column' ) ) {
195
  require_once ABSPATH . 'wp-admin/install-helper.php';
196
  }
197
+ $date = gmdate( 'Y-m-d' );
198
  maybe_add_column( $wpdb->subscribe2, 'date', "ALTER TABLE $wpdb->subscribe2 ADD date DATE DEFAULT '$date' NOT NULL AFTER active" );
199
 
200
  // update the options table to serialized format
classes/mo-notice.php DELETED
@@ -1,180 +0,0 @@
1
- <?php
2
-
3
- if ( ! class_exists( 'MO_Admin_Notice' ) ) {
4
-
5
- class MO_Admin_Notice {
6
- public function __construct() {
7
- add_action( 'admin_notices', array( $this, 'admin_notice' ) );
8
- add_action( 'network_admin_notices', array( $this, 'admin_notice' ) );
9
-
10
- add_action( 'admin_init', array( $this, 'dismiss_admin_notice' ) );
11
- }
12
-
13
- public function dismiss_admin_notice() {
14
- if ( ! isset( $_GET['mo-adaction'] ) || $_GET['mo-adaction'] != 'mo_dismiss_adnotice' ) {
15
- return;
16
- }
17
-
18
- $url = admin_url();
19
- update_option( 'mo_dismiss_adnotice', 'true' );
20
-
21
- wp_redirect( $url );
22
- exit;
23
- }
24
-
25
- public function admin_notice() {
26
-
27
- global $pagenow;
28
-
29
- if($pagenow == 'index.php' || (isset($_GET['page']) && strpos($_GET['page'], 's2_') !== false)) {
30
-
31
- if (get_option('mo_dismiss_adnotice', 'false') == 'true') {
32
- return;
33
- }
34
-
35
- if ($this->is_plugin_installed() && $this->is_plugin_active()) {
36
- return;
37
- }
38
-
39
- $dismiss_url = esc_url_raw(
40
- add_query_arg(
41
- array(
42
- 'mo-adaction' => 'mo_dismiss_adnotice'
43
- ),
44
- admin_url()
45
- )
46
- );
47
- $this->notice_css();
48
- $install_url = wp_nonce_url(
49
- admin_url('update.php?action=install-plugin&plugin=mailoptin'),
50
- 'install-plugin_mailoptin'
51
- );
52
-
53
- $activate_url = wp_nonce_url(admin_url('plugins.php?action=activate&plugin=mailoptin%2Fmailoptin.php'), 'activate-plugin_mailoptin/mailoptin.php');
54
- ?>
55
- <div class="mo-admin-notice notice notice-success">
56
- <div class="mo-notice-first-half">
57
- <p>
58
- <?php
59
- printf(
60
- __('Free optin form plugin that will %1$sincrease your email list subscribers%2$s and keep them engaged with %1$sautomated and schedule newsletters%2$s.', 'subscribe2'),
61
- '<span class="mo-stylize"><strong>', '</strong></span>');
62
- ?>
63
- </p>
64
- <p style="text-decoration: underline;font-size: 12px;">Recommended by Subscribe2 plugin</p>
65
- </div>
66
- <div class="mo-notice-other-half">
67
- <?php if ( ! $this->is_plugin_installed()) : ?>
68
- <a class="button button-primary button-hero" id="mo-install-mailoptin-plugin" href="<?php echo $install_url; ?>">
69
- <?php _e('Install MailOptin Now for Free!', 'subscribe2'); ?>
70
- </a>
71
- <?php endif; ?>
72
- <?php if ($this->is_plugin_installed() && ! $this->is_plugin_active()) : ?>
73
- <a class="button button-primary button-hero" id="mo-activate-mailoptin-plugin" href="<?php echo $activate_url; ?>">
74
- <?php _e('Activate MailOptin Now!', 'subscribe2'); ?>
75
- </a>
76
- <?php endif; ?>
77
- <div class="mo-notice-learn-more">
78
- <a target="_blank" href="https://mailoptin.io">Learn more</a>
79
- </div>
80
- </div>
81
- <a href="<?php echo $dismiss_url; ?>">
82
- <button type="button" class="notice-dismiss">
83
- <span class="screen-reader-text"><?php _e('Dismiss this notice', 'subscribe2'); ?>.</span>
84
- </button>
85
- </a>
86
- </div>
87
- <?php
88
- }
89
- }
90
-
91
- public function current_admin_url() {
92
- $parts = parse_url( home_url() );
93
- $uri = $parts['scheme'] . '://' . $parts['host'];
94
-
95
- if ( array_key_exists( 'port', $parts ) ) {
96
- $uri .= ':' . $parts['port'];
97
- }
98
-
99
- $uri .= add_query_arg( array() );
100
-
101
- return $uri;
102
- }
103
-
104
- public function is_plugin_installed() {
105
- $installed_plugins = get_plugins();
106
-
107
- return isset( $installed_plugins['mailoptin/mailoptin.php'] );
108
- }
109
-
110
- public function is_plugin_active() {
111
- return is_plugin_active( 'mailoptin/mailoptin.php' );
112
- }
113
-
114
- public function notice_css() {
115
- ?>
116
- <style type="text/css">
117
- .mo-admin-notice {
118
- background: #fff;
119
- color: #000;
120
- border-left-color: #46b450;
121
- position: relative;
122
- }
123
-
124
- .mo-admin-notice .notice-dismiss:before {
125
- color: #72777c;
126
- }
127
-
128
- .mo-admin-notice .mo-stylize {
129
- line-height: 2;
130
- }
131
-
132
- .mo-admin-notice .button-primary {
133
- background: #006799;
134
- text-shadow: none;
135
- border: 0;
136
- box-shadow: none;
137
- }
138
-
139
- .mo-notice-first-half {
140
- width: 66%;
141
- display: inline-block;
142
- margin: 10px 0;
143
- }
144
-
145
- .mo-notice-other-half {
146
- width: 33%;
147
- display: inline-block;
148
- padding: 20px 0;
149
- position: absolute;
150
- text-align: center;
151
- }
152
-
153
- .mo-notice-first-half p {
154
- font-size: 14px;
155
- }
156
-
157
- .mo-notice-learn-more a {
158
- margin: 10px;
159
- }
160
-
161
- .mo-notice-learn-more {
162
- margin-top: 10px;
163
- }
164
- </style>
165
- <?php
166
- }
167
-
168
- public static function instance() {
169
- static $instance = null;
170
-
171
- if ( is_null( $instance ) ) {
172
- $instance = new self();
173
- }
174
-
175
- return $instance;
176
- }
177
- }
178
-
179
- MO_Admin_Notice::instance();
180
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
subscribe2.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Subscribe2
4
  Plugin URI: https://subscribe2.wordpress.com/
5
  Description: Notifies an email list when new entries are posted.
6
- Version: 10.30.1
7
  Author: Subscribe2
8
  Author URI: https://subscribe2.wordpress.com/
9
  Licence: GPLv3
@@ -54,14 +54,14 @@ if ( is_plugin_active_for_network( plugin_basename( __FILE__ ) ) ) {
54
 
55
  // our version number. Don't touch this or any line below
56
  // unless you know exactly what you are doing
57
- define( 'S2VERSION', '10.30.1' );
58
  define( 'S2PATH', trailingslashit( dirname( __FILE__ ) ) );
59
  define( 'S2DIR', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
60
  define( 'S2URL', plugin_dir_url( dirname( __FILE__ ) ) . S2DIR );
61
 
62
  // Set maximum execution time to 5 minutes
63
  if ( function_exists( 'set_time_limit' ) ) {
64
- set_time_limit( 600 );
65
  }
66
 
67
  require_once S2PATH . 'classes/class-s2-core.php';
3
  Plugin Name: Subscribe2
4
  Plugin URI: https://subscribe2.wordpress.com/
5
  Description: Notifies an email list when new entries are posted.
6
+ Version: 10.31
7
  Author: Subscribe2
8
  Author URI: https://subscribe2.wordpress.com/
9
  Licence: GPLv3
54
 
55
  // our version number. Don't touch this or any line below
56
  // unless you know exactly what you are doing
57
+ define( 'S2VERSION', '10.31' );
58
  define( 'S2PATH', trailingslashit( dirname( __FILE__ ) ) );
59
  define( 'S2DIR', trailingslashit( dirname( plugin_basename( __FILE__ ) ) ) );
60
  define( 'S2URL', plugin_dir_url( dirname( __FILE__ ) ) . S2DIR );
61
 
62
  // Set maximum execution time to 5 minutes
63
  if ( function_exists( 'set_time_limit' ) ) {
64
+ set_time_limit( 300 );
65
  }
66
 
67
  require_once S2PATH . 'classes/class-s2-core.php';