Subscribe2 - Version 8.9

Version Description

Download this release

Release Info

Developer MattyRob
Plugin Icon 128x128 Subscribe2
Version 8.9
Comparing to
See all releases

Code changes from version 8.8 to 8.9

ChangeLog.txt CHANGED
@@ -1,3 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
1
  = Version 8.8 by Matthew Robinson =
2
 
3
  * Added ability to filter both excerpt_length and word_wrap
1
+ = Version 8.9 by Matthew Robinson =
2
+
3
+ * Fix fatal error in the uninstall.php file
4
+ * Correct error using set_url_scheme() function in WordPress version prior to 3.5
5
+ * Allow the Widget to post form back to referring page by omitting action for parameter - thanks to Peter Gordon
6
+ * Fix for options being reset on Multisite installs - thanks to Luca
7
+ * Make sure translation strings are loaded during install(), upgrade() and reset() - thanks to Milan Dinić
8
+ * Fix internationalisation of subscribers list table - thanks to Milan Dinić
9
+ * Use mb_encode_mimeheader on email sender name - thanks to xl32
10
+ * Trim email addresses before sanitising them - thanks to byarts
11
+
12
  = Version 8.8 by Matthew Robinson =
13
 
14
  * Added ability to filter both excerpt_length and word_wrap
ReadMe.txt CHANGED
@@ -4,7 +4,7 @@ Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_butt
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
- Stable tag: 8.8
8
  License: GPL3
9
 
10
  Sends a list of subscribers an email notification when new posts are published to your blog
@@ -32,9 +32,9 @@ AUTOMATIC INSTALLATION
32
 
33
  1. Log in to your WordPress blog and visit Plugins->Add New.
34
  2. Search for Subscribe2, click "Install Now" and then Activate the Plugin
35
- 3. Click the "Settings" admin menu link, and select "Subscribe2".
36
  4. Configure the options to taste, including the email template and any categories which should be excluded from notification
37
- 5. Click the "Tools" admin menu link, and select "Subscribers".
38
  6. Manually subscribe people as you see fit.
39
  7. Create a [WordPress Page](http://codex.wordpress.org/Pages) to display the subscription form. When creating the page, you may click the "S2" button on the QuickBar to automatically insert the Subscribe2 token. Or, if you prefer, you may manually insert the Subscribe2 shortcode or token: [subscribe2] or the HTML invisible `<!--subscribe2-->` ***Ensure the token is on a line by itself and that it has a blank line above and below.***
40
  This token will automatically be replaced by dynamic subscription information and will display all forms and messages as necessary.
@@ -44,9 +44,9 @@ MANUAL INSTALLATION
44
 
45
  1. Copy the entire /subscribe2/ directory into your /wp-content/plugins/ directory.
46
  2. Activate the plugin.
47
- 3. Click the "Settings" admin menu link, and select "Subscribe2".
48
  4. Configure the options to taste, including the email template and any categories which should be excluded from notification
49
- 5. Click the "Tools" admin menu link, and select "Subscribers".
50
  6. Manually subscribe people as you see fit.
51
  7. Create a [WordPress Page](http://codex.wordpress.org/Pages) to display the subscription form. When creating the page, you may click the "S2" button on the QuickBar to automatically insert the Subscribe2 token. Or, if you prefer, you may manually insert the Subscribe2 shortcode or token: [subscribe2] or the HTML invisible `<!--subscribe2-->` ***Ensure the token is on a line by itself and that it has a blank line above and below.***
52
  This token will automatically be replaced by dynamic subscription information and will display all forms and messages as necessary.
@@ -310,7 +310,7 @@ By default Public Subscribers get plain text emails and only Registered Subscrib
310
 
311
  WordPress 3.1 and up requires Subscribe2 from the 7.x or 8.x stable branch. The most recent version is hosted via [Wordpress.org](http://wordpress.org/extend/plugins/subscribe2/).
312
 
313
- WordPress 2.8 and up requires Subscribe2 from the 6.x stable branch. The most q version is [6.5](http://downloads.wordpress.org/plugin/subscribe2.6.5.zip).
314
 
315
  WordPress 2.3.x through to 2.7.x require Subscribe2 from the 4.x or 5.x stable branch. The most recent version is [5.9](http://downloads.wordpress.org/plugin/subscribe2.5.9.zip).
316
 
4
  Tags: posts, subscription, email, subscribe, notify, notification
5
  Requires at least: 3.1
6
  Tested up to: 3.5.1
7
+ Stable tag: 8.9
8
  License: GPL3
9
 
10
  Sends a list of subscribers an email notification when new posts are published to your blog
32
 
33
  1. Log in to your WordPress blog and visit Plugins->Add New.
34
  2. Search for Subscribe2, click "Install Now" and then Activate the Plugin
35
+ 3. Visit the "Subscribe2 -> Settings" menu.
36
  4. Configure the options to taste, including the email template and any categories which should be excluded from notification
37
+ 5. Visit the "Subscribe2 -> Subscribers" menu.
38
  6. Manually subscribe people as you see fit.
39
  7. Create a [WordPress Page](http://codex.wordpress.org/Pages) to display the subscription form. When creating the page, you may click the "S2" button on the QuickBar to automatically insert the Subscribe2 token. Or, if you prefer, you may manually insert the Subscribe2 shortcode or token: [subscribe2] or the HTML invisible `<!--subscribe2-->` ***Ensure the token is on a line by itself and that it has a blank line above and below.***
40
  This token will automatically be replaced by dynamic subscription information and will display all forms and messages as necessary.
44
 
45
  1. Copy the entire /subscribe2/ directory into your /wp-content/plugins/ directory.
46
  2. Activate the plugin.
47
+ 3. Visit the "Subscribe2 -> Settings" menu.
48
  4. Configure the options to taste, including the email template and any categories which should be excluded from notification
49
+ 5. Visit the "Subscribe2 -> Subscribers" menu.
50
  6. Manually subscribe people as you see fit.
51
  7. Create a [WordPress Page](http://codex.wordpress.org/Pages) to display the subscription form. When creating the page, you may click the "S2" button on the QuickBar to automatically insert the Subscribe2 token. Or, if you prefer, you may manually insert the Subscribe2 shortcode or token: [subscribe2] or the HTML invisible `<!--subscribe2-->` ***Ensure the token is on a line by itself and that it has a blank line above and below.***
52
  This token will automatically be replaced by dynamic subscription information and will display all forms and messages as necessary.
310
 
311
  WordPress 3.1 and up requires Subscribe2 from the 7.x or 8.x stable branch. The most recent version is hosted via [Wordpress.org](http://wordpress.org/extend/plugins/subscribe2/).
312
 
313
+ WordPress 2.8 and up requires Subscribe2 from the 6.x stable branch. The most recent version is [6.5](http://downloads.wordpress.org/plugin/subscribe2.6.5.zip).
314
 
315
  WordPress 2.3.x through to 2.7.x require Subscribe2 from the 4.x or 5.x stable branch. The most recent version is [5.9](http://downloads.wordpress.org/plugin/subscribe2.5.9.zip).
316
 
admin/subscribers.php CHANGED
@@ -143,7 +143,7 @@ $S2ListTable->prepare_items();
143
  // show our form
144
  echo "<div class=\"wrap\">";
145
  echo "<div id=\"icon-tools\" class=\"icon32\"></div>";
146
- $tabs = array('public' => 'Public Subscribers', 'registered' => 'Registered Subscribers');
147
  echo "<h2 class=\"nav-tab-wrapper\">";
148
  foreach ( $tabs as $tab_key => $tab_caption ) {
149
  $active = ($current_tab == $tab_key) ? "nav-tab-active" : "";
143
  // show our form
144
  echo "<div class=\"wrap\">";
145
  echo "<div id=\"icon-tools\" class=\"icon32\"></div>";
146
+ $tabs = array('public' => __('Public Subscribers', 'subscribe2'), 'registered' => __('Registered Subscribers', 'subscribe2'));
147
  echo "<h2 class=\"nav-tab-wrapper\">";
148
  foreach ( $tabs as $tab_key => $tab_caption ) {
149
  $active = ($current_tab == $tab_key) ? "nav-tab-active" : "";
classes/class-s2-admin.php CHANGED
@@ -612,7 +612,7 @@ class s2_admin extends s2class {
612
  $ids = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_email IN ($useremails)");
613
  $ids = implode(',', array_map(array($this, 'prepare_in_data'), $ids));
614
  $sql = "UPDATE $wpdb->usermeta SET meta_value='{$format}' WHERE meta_key='" . $this->get_usermeta_keyname('s2_format') . "' AND user_id IN ($ids)";
615
- $wpdb->get_results($sql);
616
  } // end format_change()
617
 
618
  /**
612
  $ids = $wpdb->get_col("SELECT ID FROM $wpdb->users WHERE user_email IN ($useremails)");
613
  $ids = implode(',', array_map(array($this, 'prepare_in_data'), $ids));
614
  $sql = "UPDATE $wpdb->usermeta SET meta_value='{$format}' WHERE meta_key='" . $this->get_usermeta_keyname('s2_format') . "' AND user_id IN ($ids)";
615
+ $wpdb->query($sql);
616
  } // end format_change()
617
 
618
  /**
classes/class-s2-core.php CHANGED
@@ -67,6 +67,9 @@ class s2class {
67
  Install our table
68
  */
69
  function install() {
 
 
 
70
  // include upgrade-functions for maybe_create_table;
71
  if ( !function_exists('maybe_create_table') ) {
72
  require_once(ABSPATH . 'wp-admin/install-helper.php');
@@ -109,6 +112,9 @@ class s2class {
109
  Upgrade function for the database and settings
110
  */
111
  function upgrade() {
 
 
 
112
  require(S2PATH . "classes/class-s2-upgrade.php");
113
  global $s2_upgrade;
114
  $s2_upgrade = new s2class_upgrade;
@@ -124,30 +130,48 @@ class s2class {
124
  $s2_upgrade->upgrade_core();
125
  if ( version_compare($this->subscribe2_options['version'], '2.3', '<') ) {
126
  $s2_upgrade->upgrade23();
 
 
127
  }
128
  if ( version_compare($this->subscribe2_options['version'], '5.1', '<') ) {
129
  $s2_upgrade->upgrade51();
 
 
130
  }
131
  if ( version_compare($this->subscribe2_options['version'], '5.6', '<') ) {
132
  $s2_upgrade->upgrade56();
 
 
133
  }
134
  if ( version_compare($this->subscribe2_options['version'], '5.9', '<') ) {
135
  $s2_upgrade->upgrade59();
 
 
136
  }
137
  if ( version_compare($this->subscribe2_options['version'], '6.4', '<') ) {
138
  $s2_upgrade->upgrade64();
 
 
139
  }
140
  if ( version_compare($this->subscribe2_options['version'], '7.0', '<') ) {
141
  $s2_upgrade->upgrade70();
 
 
142
  }
143
  if ( version_compare($this->subscribe2_options['version'], '8.5', '<') ) {
144
  $s2_upgrade->upgrade85();
 
 
145
  }
146
  if ( version_compare($this->subscribe2_options['version'], '8.6', '<') ) {
147
  $s2_upgrade->upgrade86();
 
 
148
  }
149
  if ( version_compare($this->subscribe2_options['version'], '8.8', '<') ) {
150
  $s2_upgrade->upgrade88();
 
 
151
  }
152
 
153
  $this->subscribe2_options['version'] = S2VERSION;
@@ -160,11 +184,15 @@ class s2class {
160
  Reset our options
161
  */
162
  function reset() {
 
 
 
163
  delete_option('subscribe2_options');
164
  wp_clear_scheduled_hook('s2_digest_cron');
165
  unset($this->subscribe2_options);
166
  require(S2PATH . "include/options.php");
167
- add_option('subscribe2_options', $this->subscribe2_options, '', 'no');
 
168
  } // end reset()
169
 
170
  /* ===== mail handling ===== */
@@ -207,6 +235,10 @@ class s2class {
207
  function mail($recipients = array(), $subject = '', $message = '', $type = 'text') {
208
  if ( empty($recipients) || '' == $message ) { return; }
209
 
 
 
 
 
210
  if ( 'html' == $type ) {
211
  $headers = $this->headers('html');
212
  if ( 'yes' == $this->subscribe2_options['stylesheet'] ) {
@@ -222,10 +254,6 @@ class s2class {
222
  $mailtext = apply_filters('s2_plain_email', $message);
223
  }
224
 
225
- // Replace any escaped html symbols in subject then apply filter
226
- $subject = strip_tags(html_entity_decode($subject, ENT_QUOTES));
227
- $subject = apply_filters('s2_email_subject', $subject);
228
-
229
  // Construct BCC headers for sending or send individual emails
230
  $bcc = '';
231
  natcasesort($recipients);
@@ -323,8 +351,8 @@ class s2class {
323
  }
324
  }
325
 
326
- $header['From'] = $this->myname . " <" . $this->myemail . ">";
327
- $header['Reply-To'] = $this->myname . " <" . $this->myemail . ">";
328
  $header['Return-path'] = "<" . $this->myemail . ">";
329
  $header['Precedence'] = "list\nList-Id: " . html_entity_decode(get_option('blogname'), ENT_QUOTES) . "";
330
  if ( $type == 'html' ) {
@@ -727,16 +755,16 @@ class s2class {
727
  $check = $wpdb->get_var($wpdb->prepare("SELECT user_email FROM $wpdb->users WHERE user_email=%s", $this->email));
728
  if ( $check ) { return; }
729
  if ( $confirm ) {
730
- $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET active='1', ip=%s WHERE CAST(email as binary)=%s", $this->ip, $email));
731
  } else {
732
- $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET date=CURDATE(), time=CURTIME() WHERE CAST(email as binary)=%s", $email));
733
  }
734
  } else {
735
  if ( $confirm ) {
736
  global $current_user;
737
- $wpdb->get_results($wpdb->prepare("INSERT INTO $this->public (email, active, date, time, ip) VALUES (%s, %d, CURDATE(), CURTIME(), %s)", $email, 1, $current_user->user_login));
738
  } else {
739
- $wpdb->get_results($wpdb->prepare("INSERT INTO $this->public (email, active, date, time, ip) VALUES (%s, %d, CURDATE(), CURTIME(), %s)", $email, 0, $this->ip));
740
  }
741
  }
742
  } // end add()
@@ -748,7 +776,7 @@ class s2class {
748
  global $wpdb;
749
 
750
  if ( !is_email($email) ) { return false; }
751
- $wpdb->get_results($wpdb->prepare("DELETE FROM $this->public WHERE CAST(email as binary)=%s", $email));
752
  } // end delete()
753
 
754
  /**
@@ -764,9 +792,9 @@ class s2class {
764
  if ( false === $status ) { return false; }
765
 
766
  if ( '0' == $status ) {
767
- $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET active='1', conf_date=CURDATE(), conf_time=CURTIME(), conf_ip=%s WHERE CAST(email as binary)=%s", $this->ip, $email));
768
  } else {
769
- $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET active='0', conf_date=CURDATE(), conf_time=CURTIME(), conf_ip=%s WHERE CAST(email as binary)=%s", $this->ip, $email));
770
  }
771
  } // end toggle()
772
 
@@ -992,6 +1020,7 @@ class s2class {
992
  Function to ensure email is compliant with internet messaging standards
993
  */
994
  function sanitize_email($email) {
 
995
  if ( !is_email($email) ) { return; }
996
 
997
  // ensure that domain is in lowercase as per internet email standards http://www.ietf.org/rfc/rfc5321.txt
67
  Install our table
68
  */
69
  function install() {
70
+ // load our translations and strings
71
+ $this->load_translations();
72
+
73
  // include upgrade-functions for maybe_create_table;
74
  if ( !function_exists('maybe_create_table') ) {
75
  require_once(ABSPATH . 'wp-admin/install-helper.php');
112
  Upgrade function for the database and settings
113
  */
114
  function upgrade() {
115
+ // load our translations and strings
116
+ $this->load_translations();
117
+
118
  require(S2PATH . "classes/class-s2-upgrade.php");
119
  global $s2_upgrade;
120
  $s2_upgrade = new s2class_upgrade;
130
  $s2_upgrade->upgrade_core();
131
  if ( version_compare($this->subscribe2_options['version'], '2.3', '<') ) {
132
  $s2_upgrade->upgrade23();
133
+ $this->subscribe2_options['version'] = '2.3';
134
+ update_option('subscribe2_options', $this->subscribe2_options);
135
  }
136
  if ( version_compare($this->subscribe2_options['version'], '5.1', '<') ) {
137
  $s2_upgrade->upgrade51();
138
+ $this->subscribe2_options['version'] = '5.1';
139
+ update_option('subscribe2_options', $this->subscribe2_options);
140
  }
141
  if ( version_compare($this->subscribe2_options['version'], '5.6', '<') ) {
142
  $s2_upgrade->upgrade56();
143
+ $this->subscribe2_options['version'] = '5.6';
144
+ update_option('subscribe2_options', $this->subscribe2_options);
145
  }
146
  if ( version_compare($this->subscribe2_options['version'], '5.9', '<') ) {
147
  $s2_upgrade->upgrade59();
148
+ $this->subscribe2_options['version'] = '5.9';
149
+ update_option('subscribe2_options', $this->subscribe2_options);
150
  }
151
  if ( version_compare($this->subscribe2_options['version'], '6.4', '<') ) {
152
  $s2_upgrade->upgrade64();
153
+ $this->subscribe2_options['version'] = '6.4';
154
+ update_option('subscribe2_options', $this->subscribe2_options);
155
  }
156
  if ( version_compare($this->subscribe2_options['version'], '7.0', '<') ) {
157
  $s2_upgrade->upgrade70();
158
+ $this->subscribe2_options['version'] = '7.0';
159
+ update_option('subscribe2_options', $this->subscribe2_options);
160
  }
161
  if ( version_compare($this->subscribe2_options['version'], '8.5', '<') ) {
162
  $s2_upgrade->upgrade85();
163
+ $this->subscribe2_options['version'] = '8.5';
164
+ update_option('subscribe2_options', $this->subscribe2_options);
165
  }
166
  if ( version_compare($this->subscribe2_options['version'], '8.6', '<') ) {
167
  $s2_upgrade->upgrade86();
168
+ $this->subscribe2_options['version'] = '8.6';
169
+ update_option('subscribe2_options', $this->subscribe2_options);
170
  }
171
  if ( version_compare($this->subscribe2_options['version'], '8.8', '<') ) {
172
  $s2_upgrade->upgrade88();
173
+ $this->subscribe2_options['version'] = '8.8';
174
+ update_option('subscribe2_options', $this->subscribe2_options);
175
  }
176
 
177
  $this->subscribe2_options['version'] = S2VERSION;
184
  Reset our options
185
  */
186
  function reset() {
187
+ // load our translations and strings
188
+ $this->load_translations();
189
+
190
  delete_option('subscribe2_options');
191
  wp_clear_scheduled_hook('s2_digest_cron');
192
  unset($this->subscribe2_options);
193
  require(S2PATH . "include/options.php");
194
+ $this->subscribe2_options['version'] = S2VERSION;
195
+ update_option('subscribe2_options', $this->subscribe2_options);
196
  } // end reset()
197
 
198
  /* ===== mail handling ===== */
235
  function mail($recipients = array(), $subject = '', $message = '', $type = 'text') {
236
  if ( empty($recipients) || '' == $message ) { return; }
237
 
238
+ // Replace any escaped html symbols in subject then apply filter
239
+ $subject = strip_tags(html_entity_decode($subject, ENT_QUOTES));
240
+ $subject = apply_filters('s2_email_subject', $subject);
241
+
242
  if ( 'html' == $type ) {
243
  $headers = $this->headers('html');
244
  if ( 'yes' == $this->subscribe2_options['stylesheet'] ) {
254
  $mailtext = apply_filters('s2_plain_email', $message);
255
  }
256
 
 
 
 
 
257
  // Construct BCC headers for sending or send individual emails
258
  $bcc = '';
259
  natcasesort($recipients);
351
  }
352
  }
353
 
354
+ $header['From'] = mb_encode_mimeheader($this->myname, 'UTF-8', 'Q') . " <" . $this->myemail . ">";
355
+ $header['Reply-To'] = mb_encode_mimeheader($this->myname, 'UTF-8', 'Q') . " <" . $this->myemail . ">";
356
  $header['Return-path'] = "<" . $this->myemail . ">";
357
  $header['Precedence'] = "list\nList-Id: " . html_entity_decode(get_option('blogname'), ENT_QUOTES) . "";
358
  if ( $type == 'html' ) {
755
  $check = $wpdb->get_var($wpdb->prepare("SELECT user_email FROM $wpdb->users WHERE user_email=%s", $this->email));
756
  if ( $check ) { return; }
757
  if ( $confirm ) {
758
+ $wpdb->query($wpdb->prepare("UPDATE $this->public SET active='1', ip=%s WHERE CAST(email as binary)=%s", $this->ip, $email));
759
  } else {
760
+ $wpdb->query($wpdb->prepare("UPDATE $this->public SET date=CURDATE(), time=CURTIME() WHERE CAST(email as binary)=%s", $email));
761
  }
762
  } else {
763
  if ( $confirm ) {
764
  global $current_user;
765
+ $wpdb->query($wpdb->prepare("INSERT INTO $this->public (email, active, date, time, ip) VALUES (%s, %d, CURDATE(), CURTIME(), %s)", $email, 1, $current_user->user_login));
766
  } else {
767
+ $wpdb->query($wpdb->prepare("INSERT INTO $this->public (email, active, date, time, ip) VALUES (%s, %d, CURDATE(), CURTIME(), %s)", $email, 0, $this->ip));
768
  }
769
  }
770
  } // end add()
776
  global $wpdb;
777
 
778
  if ( !is_email($email) ) { return false; }
779
+ $wpdb->query($wpdb->prepare("DELETE FROM $this->public WHERE CAST(email as binary)=%s", $email));
780
  } // end delete()
781
 
782
  /**
792
  if ( false === $status ) { return false; }
793
 
794
  if ( '0' == $status ) {
795
+ $wpdb->query($wpdb->prepare("UPDATE $this->public SET active='1', conf_date=CURDATE(), conf_time=CURTIME(), conf_ip=%s WHERE CAST(email as binary)=%s", $this->ip, $email));
796
  } else {
797
+ $wpdb->query($wpdb->prepare("UPDATE $this->public SET active='0', conf_date=CURDATE(), conf_time=CURTIME(), conf_ip=%s WHERE CAST(email as binary)=%s", $this->ip, $email));
798
  }
799
  } // end toggle()
800
 
1020
  Function to ensure email is compliant with internet messaging standards
1021
  */
1022
  function sanitize_email($email) {
1023
+ $email = trim($email);
1024
  if ( !is_email($email) ) { return; }
1025
 
1026
  // ensure that domain is in lowercase as per internet email standards http://www.ietf.org/rfc/rfc5321.txt
classes/class-s2-frontend.php CHANGED
@@ -34,13 +34,17 @@ class s2_frontend extends s2class {
34
  // both form input actions
35
  $this->input_form_action = "<input type=\"submit\" name=\"subscribe\" value=\"" . esc_attr($subscribe_button_value) . "\" />&nbsp;<input type=\"submit\" name=\"unsubscribe\" value=\"" . esc_attr($unsubscribe_button_value) . "\" />";
36
  }
 
37
  // if ID is provided, get permalink
38
- if ( $id ) {
39
- $url = get_permalink( $id );
 
 
 
 
 
40
  } elseif ( $this->subscribe2_options['s2page'] > 0 ) {
41
- $url = get_permalink( $this->subscribe2_options['s2page'] );
42
- } else {
43
- $url = get_site_url();
44
  }
45
 
46
  // allow remote setting of email in form
@@ -54,9 +58,9 @@ class s2_frontend extends s2class {
54
 
55
  // build default form
56
  if ( $nojs == 'true' ) {
57
- $this->form = "<form method=\"post\" action=\"" . $url . "\"><input type=\"hidden\" name=\"ip\" value=\"" . $_SERVER['REMOTE_ADDR'] . "\" /><p><label for=\"s2email\">" . __('Your email:', 'subscribe2') . "</label><br /><input type=\"text\" name=\"email\" id=\"s2email\" value=\"" . $value . "\" size=\"" . $size . "\" /></p><p>" . $this->input_form_action . "</p></form>";
58
  } else {
59
- $this->form = "<form method=\"post\" action=\"" . $url . "\"><input type=\"hidden\" name=\"ip\" value=\"" . $_SERVER['REMOTE_ADDR'] . "\" /><p><label for=\"s2email\">" . __('Your email:', 'subscribe2') . "</label><br /><input type=\"text\" name=\"email\" id=\"s2email\" value=\"" . $value . "\" size=\"" . $size . "\" onfocus=\"if (this.value == '" . $value . "') {this.value = '';}\" onblur=\"if (this.value == '') {this.value = '" . $value . "';}\" /></p><p>" . $this->input_form_action . "</p></form>\r\n";
60
  }
61
  $this->s2form = $this->form;
62
 
34
  // both form input actions
35
  $this->input_form_action = "<input type=\"submit\" name=\"subscribe\" value=\"" . esc_attr($subscribe_button_value) . "\" />&nbsp;<input type=\"submit\" name=\"unsubscribe\" value=\"" . esc_attr($unsubscribe_button_value) . "\" />";
36
  }
37
+
38
  // if ID is provided, get permalink
39
+ $action = '';
40
+ if ( is_numeric($id) ) {
41
+ $action = " action=\"" . get_permalink( $id ) . "\"";
42
+ } elseif ( $id === 'home' ) {
43
+ $action = " action=\"" . get_site_url() . "\"";
44
+ } elseif ( $id === 'self' ) {
45
+ $action = '';
46
  } elseif ( $this->subscribe2_options['s2page'] > 0 ) {
47
+ $action = " action=\"" . get_permalink( $this->subscribe2_options['s2page'] ) . "\"";
 
 
48
  }
49
 
50
  // allow remote setting of email in form
58
 
59
  // build default form
60
  if ( $nojs == 'true' ) {
61
+ $this->form = "<form method=\"post\"" . $action . "><input type=\"hidden\" name=\"ip\" value=\"" . $_SERVER['REMOTE_ADDR'] . "\" /><p><label for=\"s2email\">" . __('Your email:', 'subscribe2') . "</label><br /><input type=\"text\" name=\"email\" id=\"s2email\" value=\"" . $value . "\" size=\"" . $size . "\" /></p><p>" . $this->input_form_action . "</p></form>";
62
  } else {
63
+ $this->form = "<form method=\"post\"" . $action . "><input type=\"hidden\" name=\"ip\" value=\"" . $_SERVER['REMOTE_ADDR'] . "\" /><p><label for=\"s2email\">" . __('Your email:', 'subscribe2') . "</label><br /><input type=\"text\" name=\"email\" id=\"s2email\" value=\"" . $value . "\" size=\"" . $size . "\" onfocus=\"if (this.value == '" . $value . "') {this.value = '';}\" onblur=\"if (this.value == '') {this.value = '" . $value . "';}\" /></p><p>" . $this->input_form_action . "</p></form>\r\n";
64
  }
65
  $this->s2form = $this->form;
66
 
classes/class-s2-list-table.php CHANGED
@@ -33,7 +33,7 @@ class Subscribe2_List_Table extends WP_List_Table {
33
  function column_email($item) {
34
  global $current_tab;
35
  if ( $current_tab == 'registered' ) {
36
- $actions = array('edit' => sprintf('<a href="?page=%s&amp;email=%s">Edit</a>', 's2', $item['email']));
37
  return sprintf('%1$s %2$s', $item['email'], $this->row_actions($actions));
38
  } else {
39
  global $mysubscribe2;
@@ -52,12 +52,12 @@ class Subscribe2_List_Table extends WP_List_Table {
52
  function get_columns() {
53
  global $current_tab;
54
  if ( $current_tab == 'registered' ) {
55
- $columns = array('email' => 'Email');
56
  } else {
57
  $columns = array(
58
- 'cb' => '<input type="checkbox" />',
59
- 'email' => 'Email',
60
- 'date' => 'Date'
61
  );
62
  }
63
  return $columns;
@@ -95,7 +95,7 @@ class Subscribe2_List_Table extends WP_List_Table {
95
 
96
  extract( $this->_pagination_args, EXTR_SKIP );
97
 
98
- $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items ), number_format_i18n( $total_items ) ) . '</span>';
99
 
100
  if ( isset($_POST['what']) ) {
101
  $current = 1;
@@ -103,7 +103,11 @@ class Subscribe2_List_Table extends WP_List_Table {
103
  $current = $this->get_pagenum();
104
  }
105
 
106
- $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
 
 
 
 
107
 
108
  $current_url = remove_query_arg( array('hotkeys_highlight_last', 'hotkeys_highlight_first'), $current_url );
109
 
@@ -123,14 +127,14 @@ class Subscribe2_List_Table extends WP_List_Table {
123
 
124
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
125
  'first-page' . $disable_first,
126
- esc_attr__( 'Go to the first page' ),
127
  esc_url( remove_query_arg( 'paged', $current_url ) ),
128
  '&laquo;'
129
  );
130
 
131
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
132
  'prev-page' . $disable_first,
133
- esc_attr__( 'Go to the previous page' ),
134
  esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
135
  '&lsaquo;'
136
  );
@@ -139,24 +143,24 @@ class Subscribe2_List_Table extends WP_List_Table {
139
  $html_current_page = $current;
140
  else
141
  $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />",
142
- esc_attr__( 'Current page' ),
143
  $current,
144
  strlen( $total_pages )
145
  );
146
 
147
  $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
148
- $page_links[] = '<span class="paging-input">' . sprintf( _x( '%1$s of %2$s', 'paging' ), $html_current_page, $html_total_pages ) . '</span>';
149
 
150
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
151
  'next-page' . $disable_last,
152
- esc_attr__( 'Go to the next page' ),
153
  esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
154
  '&rsaquo;'
155
  );
156
 
157
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
158
  'last-page' . $disable_last,
159
- esc_attr__( 'Go to the last page' ),
160
  esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
161
  '&raquo;'
162
  );
@@ -191,11 +195,11 @@ class Subscribe2_List_Table extends WP_List_Table {
191
 
192
  $data = array();
193
  if ( $current_tab == 'public' ) {
194
- foreach($subscribers as $email) {
195
  $data[] = array('email' => $email, 'date' => $mysubscribe2->signup_date($email));
196
  }
197
  } else {
198
- foreach($subscribers as $email) {
199
  $data[] = array('email' => $email);
200
  }
201
  }
@@ -218,9 +222,9 @@ class Subscribe2_List_Table extends WP_List_Table {
218
  $this->items = $data;
219
 
220
  $this->set_pagination_args( array(
221
- 'total_items' => $total_items,
222
- 'per_page' => $per_page,
223
- 'total_pages' => ceil($total_items/$per_page)
224
  ) );
225
  }
226
  }
33
  function column_email($item) {
34
  global $current_tab;
35
  if ( $current_tab == 'registered' ) {
36
+ $actions = array('edit' => sprintf('<a href="?page=%s&amp;email=%s">%s</a>', 's2', $item['email'], __('Edit', 'subscribe2')));
37
  return sprintf('%1$s %2$s', $item['email'], $this->row_actions($actions));
38
  } else {
39
  global $mysubscribe2;
52
  function get_columns() {
53
  global $current_tab;
54
  if ( $current_tab == 'registered' ) {
55
+ $columns = array('email' => _x('Email', 'column name', 'subscribe2'));
56
  } else {
57
  $columns = array(
58
+ 'cb' => '<input type="checkbox" />',
59
+ 'email' => _x('Email', 'column name', 'subscribe2'),
60
+ 'date' => _x('Date', 'column name', 'subscribe2')
61
  );
62
  }
63
  return $columns;
95
 
96
  extract( $this->_pagination_args, EXTR_SKIP );
97
 
98
+ $output = '<span class="displaying-num">' . sprintf( _n( '1 item', '%s items', $total_items, 'subscribe2' ), number_format_i18n( $total_items ) ) . '</span>';
99
 
100
  if ( isset($_POST['what']) ) {
101
  $current = 1;
103
  $current = $this->get_pagenum();
104
  }
105
 
106
+ if ( version_compare($GLOBALS['wp_version'], '3.5', '<') ) {
107
+ $current_url = ( is_ssl() ? 'https://' : 'http://' ) . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
108
+ } else {
109
+ $current_url = set_url_scheme( 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'] );
110
+ }
111
 
112
  $current_url = remove_query_arg( array('hotkeys_highlight_last', 'hotkeys_highlight_first'), $current_url );
113
 
127
 
128
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
129
  'first-page' . $disable_first,
130
+ esc_attr__('Go to the first page', 'subscribe2'),
131
  esc_url( remove_query_arg( 'paged', $current_url ) ),
132
  '&laquo;'
133
  );
134
 
135
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
136
  'prev-page' . $disable_first,
137
+ esc_attr__('Go to the previous page', 'subscribe2'),
138
  esc_url( add_query_arg( 'paged', max( 1, $current-1 ), $current_url ) ),
139
  '&lsaquo;'
140
  );
143
  $html_current_page = $current;
144
  else
145
  $html_current_page = sprintf( "<input class='current-page' title='%s' type='text' name='paged' value='%s' size='%d' />",
146
+ esc_attr__('Current page', 'subscribe2'),
147
  $current,
148
  strlen( $total_pages )
149
  );
150
 
151
  $html_total_pages = sprintf( "<span class='total-pages'>%s</span>", number_format_i18n( $total_pages ) );
152
+ $page_links[] = '<span class="paging-input">' . sprintf( _x('%1$s of %2$s', 'paging', 'subscribe2'), $html_current_page, $html_total_pages ) . '</span>';
153
 
154
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
155
  'next-page' . $disable_last,
156
+ esc_attr__('Go to the next page', 'subscribe2'),
157
  esc_url( add_query_arg( 'paged', min( $total_pages, $current+1 ), $current_url ) ),
158
  '&rsaquo;'
159
  );
160
 
161
  $page_links[] = sprintf( "<a class='%s' title='%s' href='%s'>%s</a>",
162
  'last-page' . $disable_last,
163
+ esc_attr__('Go to the last page', 'subscribe2'),
164
  esc_url( add_query_arg( 'paged', $total_pages, $current_url ) ),
165
  '&raquo;'
166
  );
195
 
196
  $data = array();
197
  if ( $current_tab == 'public' ) {
198
+ foreach((array)$subscribers as $email) {
199
  $data[] = array('email' => $email, 'date' => $mysubscribe2->signup_date($email));
200
  }
201
  } else {
202
+ foreach((array)$subscribers as $email) {
203
  $data[] = array('email' => $email);
204
  }
205
  }
222
  $this->items = $data;
223
 
224
  $this->set_pagination_args( array(
225
+ 'total_items' => $total_items,
226
+ 'per_page' => $per_page,
227
+ 'total_pages' => ceil($total_items/$per_page)
228
  ) );
229
  }
230
  }
classes/class-s2-upgrade.php CHANGED
@@ -49,7 +49,6 @@ class s2class_upgrade {
49
  delete_option($option);
50
  }
51
  }
52
- return;
53
  } // end upgrade23()
54
 
55
  function upgrade51() {
@@ -86,7 +85,6 @@ class s2class_upgrade {
86
  $wpdb->get_results($wpdb->prepare("UPDATE $mysubscribe2->public SET email=%s WHERE CAST(email as binary)=%s", $new_email, $email));
87
  }
88
  }
89
- return;
90
  } // end upgrade59()
91
 
92
  function upgrade64() {
@@ -103,24 +101,88 @@ class s2class_upgrade {
103
  $mysubscribe2->subscribe2_options['remind_email'] = preg_replace($regex, $replace, $mysubscribe2->subscribe2_options['remind_email']);
104
  $mysubscribe2->subscribe2_options['remind_subject'] = preg_replace($regex, $replace, $mysubscribe2->subscribe2_options['remind_subject']);
105
 
106
- $users = $mysubscribe2->get_all_registered('ID');
107
- foreach ( $users as $user_ID ) {
108
- $check_format = get_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_format'), true);
109
- // if user is already registered update format remove 's2_excerpt' field and update 's2_format'
110
- if ( 'html' == $check_format ) {
111
- delete_user_meta($user_ID, 's2_excerpt');
112
- } elseif ( 'text' == $check_format ) {
113
- update_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_format'), get_user_meta($user_ID, 's2_excerpt'));
114
- delete_user_meta($user_ID, 's2_excerpt');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
115
  }
116
- $subscribed = get_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), true);
117
- if ( strstr($subscribed, '-1') ) {
118
- // make sure we remove '-1' from any settings
119
- $old_cats = explode(',', $subscribed);
120
- $pos = array_search('-1', $old_cats);
121
- unset($old_cats[$pos]);
122
- $cats = implode(',', $old_cats);
123
- update_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), $cats);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
124
  }
125
  }
126
 
@@ -171,19 +233,33 @@ class s2class_upgrade {
171
  }
172
  }
173
  }
174
- return;
175
  } // end upgrade64()
176
 
177
  function upgrade70() {
178
  global $mysubscribe2;
179
- $users = $mysubscribe2->get_all_registered('ID');
 
180
  foreach ( $users as $user_ID ) {
181
- $check_authors = get_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_authors'), true);
182
- if ( empty($check_authors) ) {
183
- update_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_authors'), '');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
184
  }
185
  }
186
- return;
187
  } // end upgrade70()
188
 
189
  function upgrade85() {
@@ -197,7 +273,6 @@ class s2class_upgrade {
197
 
198
  // update postmeta field to a protected name, from version 8.5
199
  $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_s2mail' WHERE meta_key = 's2mail'" );
200
- return;
201
  } // end upgrade85()
202
 
203
  function upgrade86() {
@@ -213,26 +288,45 @@ class s2class_upgrade {
213
 
214
  // remove unnecessary table data
215
  $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 's2_cat'" );
216
- if ( strpos($subscribed, ',') === 0 ) {
 
 
 
217
  // make sure we remove leading ',' from this setting
 
218
  $old_cats = explode(',', $subscribed);
219
  unset($old_cats[0]);
220
  $cats = implode(',', $old_cats);
221
- update_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), $cats);
222
  }
223
- return;
224
  } // end upgrade86()
225
 
226
  function upgrade88() {
227
  // to ensure compulsory category collects all users we need there to be s2_subscribed meta-keys for all users
228
  global $mysubscribe2;
229
 
230
- $all_registered = $mysubscribe2->get_all_registered('ID');
231
- if ( !empty($all_registered) ) {
232
- foreach ( $all_registered as $user_ID ) {
233
- $check_subscribed = get_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), true);
234
- if ( empty($check_subscribed) ) {
235
- update_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), '');
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
236
  }
237
  }
238
  }
49
  delete_option($option);
50
  }
51
  }
 
52
  } // end upgrade23()
53
 
54
  function upgrade51() {
85
  $wpdb->get_results($wpdb->prepare("UPDATE $mysubscribe2->public SET email=%s WHERE CAST(email as binary)=%s", $new_email, $email));
86
  }
87
  }
 
88
  } // end upgrade59()
89
 
90
  function upgrade64() {
101
  $mysubscribe2->subscribe2_options['remind_email'] = preg_replace($regex, $replace, $mysubscribe2->subscribe2_options['remind_email']);
102
  $mysubscribe2->subscribe2_options['remind_subject'] = preg_replace($regex, $replace, $mysubscribe2->subscribe2_options['remind_subject']);
103
 
104
+ if ( version_compare($mysubscribe2->wp_release, '3.5', '<') ) {
105
+ $users = $mysubscribe2->get_all_registered('ID');
106
+ foreach ( $users as $user_ID ) {
107
+ $check_format = get_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_format'), true);
108
+ // if user is already registered update format remove 's2_excerpt' field and update 's2_format'
109
+ if ( 'html' == $check_format ) {
110
+ delete_user_meta($user_ID, 's2_excerpt');
111
+ } elseif ( 'text' == $check_format ) {
112
+ update_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_format'), get_user_meta($user_ID, 's2_excerpt'));
113
+ delete_user_meta($user_ID, 's2_excerpt');
114
+ }
115
+ $subscribed = get_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), true);
116
+ if ( strstr($subscribed, '-1') ) {
117
+ // make sure we remove '-1' from any settings
118
+ $old_cats = explode(',', $subscribed);
119
+ $pos = array_search('-1', $old_cats);
120
+ unset($old_cats[$pos]);
121
+ $cats = implode(',', $old_cats);
122
+ update_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), $cats);
123
+ }
124
+ }
125
+ } else {
126
+ $args = array(
127
+ 'relation' => 'AND',
128
+ 'meta_query' => array(
129
+ array('key' => $mysubscribe2->get_usermeta_keyname('s2_format'),
130
+ 'value' => 'html')
131
+ ),
132
+ 'meta_query' => array(
133
+ array('key' => 's2_excerpt',
134
+ 'compare' => 'EXISTS')
135
+ )
136
+ );
137
+
138
+ $user_query = new WP_User_Query( $args );
139
+ $users = $user_query->get_results();
140
+ if ( !empty($users) ) {
141
+ foreach ($users as $user) {
142
+ delete_user_meta($user->ID, 's2_excerpt');
143
+ }
144
  }
145
+
146
+ $args = array(
147
+ 'relation' => 'AND',
148
+ 'meta_query' => array(
149
+ array('key' => $mysubscribe2->get_usermeta_keyname('s2_format'),
150
+ 'value' => 'text')
151
+ ),
152
+ 'meta_query' => array(
153
+ array('key' => 's2_excerpt',
154
+ 'compare' => 'EXISTS')
155
+ )
156
+ );
157
+
158
+ $user_query = new WP_User_Query( $args );
159
+ $users = $user_query->get_results();
160
+ if ( !empty($users) ) {
161
+ foreach ($users as $user) {
162
+ update_user_meta($user->ID, $mysubscribe2->get_usermeta_keyname('s2_format'), get_user_meta($user->ID, 's2_excerpt'));
163
+ delete_user_meta($user->ID, 's2_excerpt');
164
+ }
165
+ }
166
+
167
+ $args = array(
168
+ 'meta_query' => array(
169
+ array('key' => $mysubscribe2->get_usermeta_keyname('s2_subscribed'),
170
+ 'value' => '-1',
171
+ 'compare' => 'LIKE')
172
+ )
173
+ );
174
+
175
+ $user_query = new WP_User_Query( $args );
176
+ $users = $user_query->get_results();
177
+ if ( !empty($users) ) {
178
+ foreach ($users as $user) {
179
+ $subscribed = get_user_meta($user->ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), true);
180
+ $old_cats = explode(',', $subscribed);
181
+ $pos = array_search('-1', $old_cats);
182
+ unset($old_cats[$pos]);
183
+ $cats = implode(',', $old_cats);
184
+ update_user_meta($user->ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), $cats);
185
+ }
186
  }
187
  }
188
 
233
  }
234
  }
235
  }
 
236
  } // end upgrade64()
237
 
238
  function upgrade70() {
239
  global $mysubscribe2;
240
+ if ( version_compare($mysubscribe2->wp_release, '3.5', '<') ) {
241
+ $users = $mysubscribe2->get_all_registered('ID');
242
  foreach ( $users as $user_ID ) {
243
+ $check_authors = get_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_authors'), true);
244
+ if ( empty($check_authors) ) {
245
+ update_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_authors'), '');
246
+ }
247
+ }
248
+ } else {
249
+ $args = array(
250
+ 'meta_query' => array(
251
+ array('key' => $mysubscribe2->get_usermeta_keyname('s2_authors'), 'compare' => 'NOT EXISTS')
252
+ )
253
+ );
254
+
255
+ $user_query = new WP_User_Query( $args );
256
+ $users = $user_query->get_results();
257
+ if ( !empty($users) ) {
258
+ foreach ($users as $user) {
259
+ update_user_meta($user->ID, $mysubscribe2->get_usermeta_keyname('s2_authors'), '');
260
+ }
261
  }
262
  }
 
263
  } // end upgrade70()
264
 
265
  function upgrade85() {
273
 
274
  // update postmeta field to a protected name, from version 8.5
275
  $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_s2mail' WHERE meta_key = 's2mail'" );
 
276
  } // end upgrade85()
277
 
278
  function upgrade86() {
288
 
289
  // remove unnecessary table data
290
  $wpdb->query( "DELETE FROM $wpdb->usermeta WHERE meta_key = 's2_cat'" );
291
+
292
+ $sql = "SELECT ID FROM $wpdb->users INNER JOIN $wpdb->usermeta ON ( $wpdb->users.ID = $wpdb->usermeta.user_id) WHERE ( $wpdb->usermeta.meta_key = '" . $this->get_usermeta_keyname('s2_subscribed') . "' AND $wpdb->usermeta.meta_value LIKE ',%' )";
293
+ $users = $wpdb->get_results($sql);
294
+ foreach ( $users as $user ) {
295
  // make sure we remove leading ',' from this setting
296
+ $subscribed = get_user_meta($user->ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), true);
297
  $old_cats = explode(',', $subscribed);
298
  unset($old_cats[0]);
299
  $cats = implode(',', $old_cats);
300
+ update_user_meta($user->ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), $cats);
301
  }
 
302
  } // end upgrade86()
303
 
304
  function upgrade88() {
305
  // to ensure compulsory category collects all users we need there to be s2_subscribed meta-keys for all users
306
  global $mysubscribe2;
307
 
308
+ if ( version_compare($mysubscribe2->wp_release, '3.5', '<') ) {
309
+ $all_registered = $mysubscribe2->get_all_registered('ID');
310
+ if ( !empty($all_registered) ) {
311
+ foreach ( $all_registered as $user_ID ) {
312
+ $check_subscribed = get_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), true);
313
+ if ( empty($check_subscribed) ) {
314
+ update_user_meta($user_ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), '');
315
+ }
316
+ }
317
+ }
318
+ } else {
319
+ $args = array(
320
+ 'meta_query' => array(
321
+ array('key' => $mysubscribe2->get_usermeta_keyname('s2_subscribed'), 'compare' => 'NOT EXISTS')
322
+ )
323
+ );
324
+
325
+ $user_query = new WP_User_Query( $args );
326
+ $users = $user_query->get_results();
327
+ if ( !empty($users) ) {
328
+ foreach ($users as $user) {
329
+ update_user_meta($user->ID, $mysubscribe2->get_usermeta_keyname('s2_subscribed'), '');
330
  }
331
  }
332
  }
include/widget.php CHANGED
@@ -29,7 +29,7 @@ class S2_Form_widget extends WP_Widget {
29
  $hide = " link=\"" . __('(Un)Subscribe to Posts', 'subscribe2') . "\"";
30
  }
31
  $postid = '';
32
- if ( !empty($postto) || $postto !== 'home' ) {
33
  $postid = " id=\"" . $postto . "\"";
34
  }
35
  $size = " size=\"" . $textbox_size . "\"";
@@ -122,6 +122,9 @@ class S2_Form_widget extends WP_Widget {
122
  echo "<option value=\"home\"";
123
  if ( $postto === 'home' ) { echo " selected=\"selected\""; }
124
  echo ">" . __('Use Home Page', 'subscribe2') . "</option>\r\n";
 
 
 
125
  $mysubscribe2->pages_dropdown($postto);
126
  echo "</select></label></p>\r\n";
127
  echo "<p><label for=\"" . $this->get_field_id('js') . "\">" . __('Disable JavaScript', 'subscribe2') . ":\r\n";
29
  $hide = " link=\"" . __('(Un)Subscribe to Posts', 'subscribe2') . "\"";
30
  }
31
  $postid = '';
32
+ if ( !empty($postto) ) {
33
  $postid = " id=\"" . $postto . "\"";
34
  }
35
  $size = " size=\"" . $textbox_size . "\"";
122
  echo "<option value=\"home\"";
123
  if ( $postto === 'home' ) { echo " selected=\"selected\""; }
124
  echo ">" . __('Use Home Page', 'subscribe2') . "</option>\r\n";
125
+ echo "<option value=\"self\"";
126
+ if ( $postto === 'self' ) { echo " selected=\"selected\""; }
127
+ echo ">" . __('Use Referring Page', 'subscribe2') . "</option>\r\n";
128
  $mysubscribe2->pages_dropdown($postto);
129
  echo "</select></label></p>\r\n";
130
  echo "<p><label for=\"" . $this->get_field_id('js') . "\">" . __('Disable JavaScript', 'subscribe2') . ":\r\n";
subscribe2.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
  Description: Notifies an email list when new entries are posted.
6
- Version: 8.8
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  Licence: GPL3
@@ -48,13 +48,13 @@ if ( !function_exists( 'is_plugin_active_for_network' ) ) {
48
 
49
  if ( is_plugin_active_for_network(plugin_basename(__FILE__)) ) {
50
  deactivate_plugins( plugin_basename(__FILE__) );
51
- $exit_msg = __('Subscribe2 cannot be activate as a network plugin. Please activate it at on a site level', 'subscribe2');
52
  exit($exit_msg);
53
  }
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', '8.8' );
58
  define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
59
  define( 'S2DIR', trailingslashit(dirname(plugin_basename(__FILE__))) );
60
  define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );
3
  Plugin Name: Subscribe2
4
  Plugin URI: http://subscribe2.wordpress.com
5
  Description: Notifies an email list when new entries are posted.
6
+ Version: 8.9
7
  Author: Matthew Robinson
8
  Author URI: http://subscribe2.wordpress.com
9
  Licence: GPL3
48
 
49
  if ( is_plugin_active_for_network(plugin_basename(__FILE__)) ) {
50
  deactivate_plugins( plugin_basename(__FILE__) );
51
+ $exit_msg = __('Subscribe2 cannot be activated as a network plugin. Please activate it at on a site level', 'subscribe2');
52
  exit($exit_msg);
53
  }
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', '8.9' );
58
  define( 'S2PATH', trailingslashit(dirname(__FILE__)) );
59
  define( 'S2DIR', trailingslashit(dirname(plugin_basename(__FILE__))) );
60
  define( 'S2URL', plugin_dir_url(dirname(__FILE__)) . S2DIR );
subscribe2.pot CHANGED
@@ -1,21 +1,16 @@
1
- # SOME DESCRIPTIVE TITLE.
2
- # Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
3
- # This file is distributed under the same license as the PACKAGE package.
4
- # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
5
- #
6
- #, fuzzy
7
  msgid ""
8
  msgstr ""
9
- "Project-Id-Version: PACKAGE VERSION\n"
10
- "Report-Msgid-Bugs-To: \n"
11
- "POT-Creation-Date: 2013-02-08 13:23+0000\n"
12
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
13
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
14
- "Language-Team: LANGUAGE <LL@li.org>\n"
15
- "Language: \n"
16
  "MIME-Version: 1.0\n"
17
- "Content-Type: text/plain; charset=CHARSET\n"
18
  "Content-Transfer-Encoding: 8bit\n"
 
 
 
19
 
20
  #: admin/send_email.php:46
21
  msgid "Preview message sent!"
@@ -94,6 +89,7 @@ msgid "Restrict the number of recipients per email to (0 for unlimited)"
94
  msgstr ""
95
 
96
  #: admin/settings.php:165 admin/settings.php:397
 
97
  msgid "Edit"
98
  msgstr ""
99
 
@@ -545,6 +541,14 @@ msgstr ""
545
  msgid "Digest Subscription updated for Selected Registered Users!"
546
  msgstr ""
547
 
 
 
 
 
 
 
 
 
548
  #: admin/subscribers.php:158 admin/subscribers.php:180
549
  msgid "Add/Remove Subscribers"
550
  msgstr ""
@@ -702,6 +706,8 @@ msgstr ""
702
  msgid "Subscribe to new blogs"
703
  msgstr ""
704
 
 
 
705
  #: classes/class-s2-admin.php:8 include/widget.php:17
706
  msgid "Subscribe2"
707
  msgstr ""
@@ -744,10 +750,6 @@ msgstr ""
744
  msgid "All Users and Subscribers"
745
  msgstr ""
746
 
747
- #: classes/class-s2-admin.php:354
748
- msgid "Public Subscribers"
749
- msgstr ""
750
-
751
  #: classes/class-s2-admin.php:355
752
  msgid "Confirmed"
753
  msgstr ""
@@ -760,10 +762,6 @@ msgstr ""
760
  msgid "All Registered Users"
761
  msgstr ""
762
 
763
- #: classes/class-s2-admin.php:358
764
- msgid "Registered Subscribers"
765
- msgstr ""
766
-
767
  #: classes/class-s2-admin.php:444
768
  msgid "Post Author"
769
  msgstr ""
@@ -913,116 +911,126 @@ msgstr ""
913
  msgid "Options reset!"
914
  msgstr ""
915
 
916
- #: classes/class-s2-core.php:580
917
  msgid "Plain Text Excerpt Preview"
918
  msgstr ""
919
 
920
- #: classes/class-s2-core.php:582
921
  msgid "Plain Text Full Preview"
922
  msgstr ""
923
 
924
- #: classes/class-s2-core.php:584
925
  msgid "HTML Excerpt Preview"
926
  msgstr ""
927
 
928
- #: classes/class-s2-core.php:586
929
  msgid "HTML Full Preview"
930
  msgstr ""
931
 
932
- #: classes/class-s2-core.php:1187
933
  msgid "Registered User"
934
  msgstr ""
935
 
936
- #: classes/class-s2-core.php:1192
937
  msgid "Confirmed Public Subscriber"
938
  msgstr ""
939
 
940
- #: classes/class-s2-core.php:1194
941
  msgid "Unconfirmed Public Subscriber"
942
  msgstr ""
943
 
944
- #: classes/class-s2-core.php:1231
945
  msgid "Check here to Subscribe to email notifications for new posts"
946
  msgstr ""
947
 
948
- #: classes/class-s2-core.php:1237
949
  msgid ""
950
  "By registering with this blog you are also agreeing to receive email "
951
  "notifications for new posts but you can unsubscribe at anytime"
952
  msgstr ""
953
 
954
- #: classes/class-s2-core.php:1263
955
  msgid "Check here to Subscribe to notifications for new posts"
956
  msgstr ""
957
 
958
- #: classes/class-s2-core.php:1353
959
  msgid "Weekly"
960
  msgstr ""
961
 
962
- #: classes/class-s2-core.php:1487 classes/class-s2-core.php:1488
963
  msgid "Author"
964
  msgstr ""
965
 
966
- #: classes/class-s2-core.php:1494
967
  msgid "Posted on"
968
  msgstr ""
969
 
970
- #: classes/class-s2-core.php:1512 classes/class-s2-core.php:1513
971
  msgid "Posted in"
972
  msgstr ""
973
 
974
- #: classes/class-s2-core.php:1518 classes/class-s2-core.php:1519
975
  msgid "Tagged as"
976
  msgstr ""
977
 
978
- #: classes/class-s2-core.php:1585
979
  msgid "Digest Email"
980
  msgstr ""
981
 
982
- #: classes/class-s2-core.php:1595
983
  msgid "Digest Preview"
984
  msgstr ""
985
 
986
- #: classes/class-s2-frontend.php:52
987
  msgid "Enter email address..."
988
  msgstr ""
989
 
990
- #: classes/class-s2-frontend.php:57 classes/class-s2-frontend.php:59
991
  msgid "Your email:"
992
  msgstr ""
993
 
994
- #: classes/class-s2-frontend.php:167
995
  msgid "Subscription Confirmation"
996
  msgstr ""
997
 
998
- #: classes/class-s2-frontend.php:169
999
  msgid "Unsubscription Confirmation"
1000
  msgstr ""
1001
 
1002
- #: classes/class-s2-frontend.php:208
1003
  msgid "New Subscription"
1004
  msgstr ""
1005
 
1006
- #: classes/class-s2-frontend.php:210
1007
  msgid "subscribed to email notifications!"
1008
  msgstr ""
1009
 
1010
- #: classes/class-s2-frontend.php:231
1011
  msgid "New Unsubscription"
1012
  msgstr ""
1013
 
1014
- #: classes/class-s2-frontend.php:233
1015
  msgid "unsubscribed from email notifications!"
1016
  msgstr ""
1017
 
1018
- #: classes/class-s2-frontend.php:259
1019
  msgid "[Un]Subscribe to Posts"
1020
  msgstr ""
1021
 
1022
- #: classes/class-s2-frontend.php:289 classes/class-s2-frontend.php:291
1023
  msgid "Subscribe to this blog"
1024
  msgstr ""
1025
 
 
 
 
 
 
 
 
 
 
 
1026
  #: classes/class-s2-list-table.php:85
1027
  msgid "Delete"
1028
  msgstr ""
@@ -1031,6 +1039,37 @@ msgstr ""
1031
  msgid "Toggle"
1032
  msgstr ""
1033
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1034
  #: include/counterwidget.php:7
1035
  msgid "Subscriber Counter widget for Subscribe2"
1036
  msgstr ""
@@ -1189,6 +1228,10 @@ msgid "Use Home Page"
1189
  msgstr ""
1190
 
1191
  #: include/widget.php:127
 
 
 
 
1192
  msgid "Disable JavaScript"
1193
  msgstr ""
1194
 
@@ -1197,7 +1240,6 @@ msgid "I'm just a plugin, please don't call me directly"
1197
  msgstr ""
1198
 
1199
  #: subscribe2.php:39
1200
- #, php-format
1201
  msgid ""
1202
  "This version of Subscribe2 requires WordPress 3.1 or greater. Please update "
1203
  "%1$s or use an older version of %2$s."
@@ -1205,6 +1247,21 @@ msgstr ""
1205
 
1206
  #: subscribe2.php:51
1207
  msgid ""
1208
- "Subscribe2 cannot be activate as a network plugin. Please activate it at on "
1209
  "a site level"
1210
  msgstr ""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013 Subscribe2
2
+ # This file is distributed under the same license as the Subscribe2 package.
 
 
 
 
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Subscribe2 8.9\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/Subscribe2\n"
7
+ "POT-Creation-Date: 2013-03-19 20:24:19+00:00\n"
 
 
 
 
8
  "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
+ "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
+ "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
15
  #: admin/send_email.php:46
16
  msgid "Preview message sent!"
89
  msgstr ""
90
 
91
  #: admin/settings.php:165 admin/settings.php:397
92
+ #: classes/class-s2-list-table.php:36
93
  msgid "Edit"
94
  msgstr ""
95
 
541
  msgid "Digest Subscription updated for Selected Registered Users!"
542
  msgstr ""
543
 
544
+ #: admin/subscribers.php:146 classes/class-s2-admin.php:354
545
+ msgid "Public Subscribers"
546
+ msgstr ""
547
+
548
+ #: admin/subscribers.php:146 classes/class-s2-admin.php:358
549
+ msgid "Registered Subscribers"
550
+ msgstr ""
551
+
552
  #: admin/subscribers.php:158 admin/subscribers.php:180
553
  msgid "Add/Remove Subscribers"
554
  msgstr ""
706
  msgid "Subscribe to new blogs"
707
  msgstr ""
708
 
709
+ #. #-#-#-#-# Subscribe2.pot (Subscribe2 8.9) #-#-#-#-#
710
+ #. Plugin Name of the plugin/theme
711
  #: classes/class-s2-admin.php:8 include/widget.php:17
712
  msgid "Subscribe2"
713
  msgstr ""
750
  msgid "All Users and Subscribers"
751
  msgstr ""
752
 
 
 
 
 
753
  #: classes/class-s2-admin.php:355
754
  msgid "Confirmed"
755
  msgstr ""
762
  msgid "All Registered Users"
763
  msgstr ""
764
 
 
 
 
 
765
  #: classes/class-s2-admin.php:444
766
  msgid "Post Author"
767
  msgstr ""
911
  msgid "Options reset!"
912
  msgstr ""
913
 
914
+ #: classes/class-s2-core.php:608
915
  msgid "Plain Text Excerpt Preview"
916
  msgstr ""
917
 
918
+ #: classes/class-s2-core.php:610
919
  msgid "Plain Text Full Preview"
920
  msgstr ""
921
 
922
+ #: classes/class-s2-core.php:612
923
  msgid "HTML Excerpt Preview"
924
  msgstr ""
925
 
926
+ #: classes/class-s2-core.php:614
927
  msgid "HTML Full Preview"
928
  msgstr ""
929
 
930
+ #: classes/class-s2-core.php:1216
931
  msgid "Registered User"
932
  msgstr ""
933
 
934
+ #: classes/class-s2-core.php:1221
935
  msgid "Confirmed Public Subscriber"
936
  msgstr ""
937
 
938
+ #: classes/class-s2-core.php:1223
939
  msgid "Unconfirmed Public Subscriber"
940
  msgstr ""
941
 
942
+ #: classes/class-s2-core.php:1260
943
  msgid "Check here to Subscribe to email notifications for new posts"
944
  msgstr ""
945
 
946
+ #: classes/class-s2-core.php:1266
947
  msgid ""
948
  "By registering with this blog you are also agreeing to receive email "
949
  "notifications for new posts but you can unsubscribe at anytime"
950
  msgstr ""
951
 
952
+ #: classes/class-s2-core.php:1292
953
  msgid "Check here to Subscribe to notifications for new posts"
954
  msgstr ""
955
 
956
+ #: classes/class-s2-core.php:1382
957
  msgid "Weekly"
958
  msgstr ""
959
 
960
+ #: classes/class-s2-core.php:1516 classes/class-s2-core.php:1517
961
  msgid "Author"
962
  msgstr ""
963
 
964
+ #: classes/class-s2-core.php:1523
965
  msgid "Posted on"
966
  msgstr ""
967
 
968
+ #: classes/class-s2-core.php:1541 classes/class-s2-core.php:1542
969
  msgid "Posted in"
970
  msgstr ""
971
 
972
+ #: classes/class-s2-core.php:1547 classes/class-s2-core.php:1548
973
  msgid "Tagged as"
974
  msgstr ""
975
 
976
+ #: classes/class-s2-core.php:1614
977
  msgid "Digest Email"
978
  msgstr ""
979
 
980
+ #: classes/class-s2-core.php:1624
981
  msgid "Digest Preview"
982
  msgstr ""
983
 
984
+ #: classes/class-s2-frontend.php:56
985
  msgid "Enter email address..."
986
  msgstr ""
987
 
988
+ #: classes/class-s2-frontend.php:61 classes/class-s2-frontend.php:63
989
  msgid "Your email:"
990
  msgstr ""
991
 
992
+ #: classes/class-s2-frontend.php:171
993
  msgid "Subscription Confirmation"
994
  msgstr ""
995
 
996
+ #: classes/class-s2-frontend.php:173
997
  msgid "Unsubscription Confirmation"
998
  msgstr ""
999
 
1000
+ #: classes/class-s2-frontend.php:212
1001
  msgid "New Subscription"
1002
  msgstr ""
1003
 
1004
+ #: classes/class-s2-frontend.php:214
1005
  msgid "subscribed to email notifications!"
1006
  msgstr ""
1007
 
1008
+ #: classes/class-s2-frontend.php:235
1009
  msgid "New Unsubscription"
1010
  msgstr ""
1011
 
1012
+ #: classes/class-s2-frontend.php:237
1013
  msgid "unsubscribed from email notifications!"
1014
  msgstr ""
1015
 
1016
+ #: classes/class-s2-frontend.php:263
1017
  msgid "[Un]Subscribe to Posts"
1018
  msgstr ""
1019
 
1020
+ #: classes/class-s2-frontend.php:293 classes/class-s2-frontend.php:295
1021
  msgid "Subscribe to this blog"
1022
  msgstr ""
1023
 
1024
+ #: classes/class-s2-list-table.php:55 classes/class-s2-list-table.php:59
1025
+ msgctxt "column name"
1026
+ msgid "Email"
1027
+ msgstr ""
1028
+
1029
+ #: classes/class-s2-list-table.php:60
1030
+ msgctxt "column name"
1031
+ msgid "Date"
1032
+ msgstr ""
1033
+
1034
  #: classes/class-s2-list-table.php:85
1035
  msgid "Delete"
1036
  msgstr ""
1039
  msgid "Toggle"
1040
  msgstr ""
1041
 
1042
+ #: classes/class-s2-list-table.php:98
1043
+ msgid "1 item"
1044
+ msgid_plural "%s items"
1045
+ msgstr[0] ""
1046
+ msgstr[1] ""
1047
+
1048
+ #: classes/class-s2-list-table.php:130
1049
+ msgid "Go to the first page"
1050
+ msgstr ""
1051
+
1052
+ #: classes/class-s2-list-table.php:137
1053
+ msgid "Go to the previous page"
1054
+ msgstr ""
1055
+
1056
+ #: classes/class-s2-list-table.php:146
1057
+ msgid "Current page"
1058
+ msgstr ""
1059
+
1060
+ #: classes/class-s2-list-table.php:152
1061
+ msgctxt "paging"
1062
+ msgid "%1$s of %2$s"
1063
+ msgstr ""
1064
+
1065
+ #: classes/class-s2-list-table.php:156
1066
+ msgid "Go to the next page"
1067
+ msgstr ""
1068
+
1069
+ #: classes/class-s2-list-table.php:163
1070
+ msgid "Go to the last page"
1071
+ msgstr ""
1072
+
1073
  #: include/counterwidget.php:7
1074
  msgid "Subscriber Counter widget for Subscribe2"
1075
  msgstr ""
1228
  msgstr ""
1229
 
1230
  #: include/widget.php:127
1231
+ msgid "Use Referring Page"
1232
+ msgstr ""
1233
+
1234
+ #: include/widget.php:130
1235
  msgid "Disable JavaScript"
1236
  msgstr ""
1237
 
1240
  msgstr ""
1241
 
1242
  #: subscribe2.php:39
 
1243
  msgid ""
1244
  "This version of Subscribe2 requires WordPress 3.1 or greater. Please update "
1245
  "%1$s or use an older version of %2$s."
1247
 
1248
  #: subscribe2.php:51
1249
  msgid ""
1250
+ "Subscribe2 cannot be activated as a network plugin. Please activate it at on "
1251
  "a site level"
1252
  msgstr ""
1253
+
1254
+ #. #-#-#-#-# Subscribe2.pot (Subscribe2 8.9) #-#-#-#-#
1255
+ #. Plugin URI of the plugin/theme
1256
+ #. #-#-#-#-# Subscribe2.pot (Subscribe2 8.9) #-#-#-#-#
1257
+ #. Author URI of the plugin/theme
1258
+ msgid "http://subscribe2.wordpress.com"
1259
+ msgstr ""
1260
+
1261
+ #. Description of the plugin/theme
1262
+ msgid "Notifies an email list when new entries are posted."
1263
+ msgstr ""
1264
+
1265
+ #. Author of the plugin/theme
1266
+ msgid "Matthew Robinson"
1267
+ msgstr ""
uninstall.php CHANGED
@@ -22,30 +22,29 @@ if ( !defined('ABSPATH') && !defined('WP_UNINSTALL_PLUGIN') ) {
22
  } else {
23
  s2_uninstall();
24
  }
25
-
26
- function s2_uninstall() {
27
- global $wpdb;
28
- // get name of subscribe2 table
29
- $public = $wpdb->prefix . "subscribe2";
30
- // delete entry from wp_options table
31
- delete_option('subscribe2_options');
32
- // delete legacy entry from wp-options table
33
- delete_option('s2_future_posts');
34
- // remove and scheduled events
35
- wp_clear_scheduled_hook('s2_digest_cron');
36
- // delete usermeta data for registered users
37
- // use LIKE and % wildcard as meta_key names are prepended on WPMU
38
- // and s2_cat is appended with category ID integer
39
- $wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_cat%'");
40
- $wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_subscribed'");
41
- $wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_format'");
42
- $wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_autosub'");
43
- // delete any postmeta data that supressed notifications
44
- $wpdb->query("DELETE from $wpdb->postmeta WHERE meta_key = 's2mail'");
45
-
46
- // drop the subscribe2 table
47
- $sql = "DROP TABLE IF EXISTS `" . $public . "`";
48
- $wpdb->query($sql);
49
- } // end s2_uninstall()
50
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
51
  ?>
22
  } else {
23
  s2_uninstall();
24
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
25
  }
26
+ function s2_uninstall() {
27
+ global $wpdb;
28
+ // get name of subscribe2 table
29
+ $public = $wpdb->prefix . "subscribe2";
30
+ // delete entry from wp_options table
31
+ delete_option('subscribe2_options');
32
+ // delete legacy entry from wp-options table
33
+ delete_option('s2_future_posts');
34
+ // remove and scheduled events
35
+ wp_clear_scheduled_hook('s2_digest_cron');
36
+ // delete usermeta data for registered users
37
+ // use LIKE and % wildcard as meta_key names are prepended on WPMU
38
+ // and s2_cat is appended with category ID integer
39
+ $wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_cat%'");
40
+ $wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_subscribed'");
41
+ $wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_format'");
42
+ $wpdb->query("DELETE from $wpdb->usermeta WHERE meta_key LIKE '%s2_autosub'");
43
+ // delete any postmeta data that supressed notifications
44
+ $wpdb->query("DELETE from $wpdb->postmeta WHERE meta_key = 's2mail'");
45
+
46
+ // drop the subscribe2 table
47
+ $sql = "DROP TABLE IF EXISTS `" . $public . "`";
48
+ $wpdb->query($sql);
49
+ } // end s2_uninstall()
50
  ?>