Subscribe2 - Version 8.6

Version Description

Download this release

Release Info

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

Code changes from version 8.5 to 8.6

ReadMe.txt CHANGED
@@ -3,8 +3,8 @@ Contributors: MattyRob, Skippy, RavanH
3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=2387904
4
Tags: posts, subscription, email, subscribe, notify, notification
5
Requires at least: 3.1
6
- Tested up to: 3.4.2
7
- Stable tag: 8.5
8
License: GPL3
9
10
Sends a list of subscribers an email notification when new posts are published to your blog
@@ -17,14 +17,14 @@ Email Notifications can be sent on a per-post basis or periodically in a Digest
17
18
The plugin also handles subscription requests allowing users to publicly subscribe (**Public Subscribers**) by submitting their email address in an easy to use form or to register with your blog (**Registered Users**) which enables greater flexibility over the email content for per-post notifications for the subscriber. Admins are given control over the presentation of the email notifications, can bulk manage subscriptions for users and manually send email notices to subscribers.
19
20
- The format of the email can also be customised for per-post notifications, subscribe2 can generate emails for each of the following formats:
21
22
* plaintext excerpt
23
* plaintext full post (Registered Users only)
24
* HTML excerpt (Registered Users only)
25
* HTML full post (Registered Users only)
26
27
- If you want to send full content HTML emails to Public Subscribers too then upgrade to [Subscribe2 HTML](http://wpplugins.com/plugin/46/subscribe2-html).
28
29
== Installation ==
30
@@ -36,7 +36,7 @@ AUTOMATIC INSTALLATION
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.
41
8. In the WordPress "Settings" area for Subscribe2 select the page name in the "Appearance" section that of the WordPress page created in step 7.
42
@@ -48,7 +48,7 @@ MANUAL INSTALLATION
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.
53
8. In the WordPress "Settings" area for Subscribe2 select the page name in the "Appearance" section that of the WordPress page created in step 7.
54
@@ -56,10 +56,10 @@ This token will automatically be replaced by dynamic subscription information an
56
57
= I want HTML email to be the default email type =
58
59
- You need to pay for the [Subscribe2 HTML version](http://wpplugins.com/plugin/46/subscribe2-html).
60
61
= Where can I get help? =
62
- So, you've downloaded the plugin an it isn't doing what you expect. First you should read the included documentation. There is a ReadMe.txt file and a PDF startup guide installed with the plugin.
63
64
Next you could search in the [WordPress forums](http://wordpress.org/support/), the old [Subscribe2 Forum](http://getsatisfaction.com/subscribe2/), or the [Subscribe2 blog FAQs](http://subscribe2.wordpress.com/category/faq/).
65
@@ -98,9 +98,9 @@ These restrictions broadly fall into one of three areas. These are the sender de
98
99
**Header Details**. Some hosting providers place a restriction on the maximum number of recipients in any one email message. Some hosts simply block all emails on certain low-cost hosting plans.
100
101
- Subscribe2 provides a facility to work around a restriction of the maximum number of recipients per email by sending batches of emails. To enable this feature, go to Settings->Subscribe2 and located the setting to restrict the number of recipients per email. If this is set to 30 then each outgoing email notification will only contain addresses for 30 recipients.
102
103
- Reminder: because subscribe2 places all recipients in BCC fields, and places the blog admin in the TO field, the blog admin will receive one email per batched delivery. So if you have 90 subscribers, the blog admin should receive three post notification emails, one for each set of 30 BCC recipients.
104
105
Batches will occur for each group of message as described above. A site like this with many public and registered subscribers could conceivably generate a lot of email for your own inbox.
106
@@ -132,7 +132,23 @@ Yes, this is possible, it just requires a little bit of code. Subscribe2 uses th
132
}
133
add_filter('cron_schedules', 'add_my_new_sched');`
134
135
- = When I click on Send Preview in Settings->Susbcribe2 I get 4 emails, why =
136
137
Subscribe2 supports 4 potential email formats for Susbcribers so you will get a preview for each of the different possibilities.
138
@@ -161,11 +177,11 @@ Subscribe2 creates four (4) new admin menus in the back end of WordPress. These
161
162
There are basically only 2 types of subscriber. Public Subscribers and Registered Subscribers.
163
164
- Public subscribers have provided their email address for email notification of your new posts. When they enter there address on your site they are sent an email asking them to confirm their request and added to a list of Unconfirmed Subscribers. Once they complete their request by clicking on the link in their email they will become Confirmed Subscribers. They will receive a limited email notification when new post is made or periodically (unless that post is assigned to one of the excluded categories you defined). The general public will receive a plaintext email with an excerpt of the post: either the excerpt you created when making the post, the portion of text before a <!--more--> tag (if present), or the first 50 words or so of the post.
165
166
- Registered Users have registered with your WordPress blog (provided you have enabled this in the core WordPress settings). Registered users of the blog can elect to receive email notifications for specific categories (unless Digest email are select, then it is an opt in or out decision). The Users->Subscription menu item will also allow them greater control to select the delivery format (plaintext or HTML), amount of message (excerpt or full post), and the categories to which they want to subscribe. You, the blog owner, have the option (Options->Subscribe2) to allow registered users to subscribe to your excluded categories or not.
167
168
- **Note** You can send HTML emails to Public Subscribers with the paid [Subscribe2 HTML version](http://wpplugins.com/plugin/46/subscribe2-html) of the plugin.
169
170
= Can I put the form elsewhere? (header, footer, sidebar without the widget) =
171
@@ -288,7 +304,7 @@ I'm open to suggestions but since the software is written by me for use on my si
288
289
= I'd like to be able to send my subscribers notifications in HTML =
290
291
- By default Public Subscribers get plain text emails and only Registered Subscribers can opt to receive email in HTML format. If you really want HTML for all you need to pay for the [Subscribe2 HTML version](http://wpplugins.com/plugin/46/subscribe2-html).
292
293
= Which version should I be using, I'm on WordPress x.x.x? =
294
@@ -309,13 +325,37 @@ Secondly, make sure that the token ([subscribe2] or <!--subscribe2-->) is correc
309
310
== Screenshots ==
311
312
- 1. The Subsribe2->Mail Subscribers admin page generated by the plugin.
313
- 2. The Subsribe2->Subscribers admin page generated by the plugin.
314
- 3. The Subsribe2->Subscriptions admin page generated by the plugin.
315
- 4. The Subsribe2->Subscribe2 admin page generated by the plugin.
316
317
== Changelog ==
318
319
= Version 8.5 by Matthew Robinson =
320
321
* Fixed width of a page select drop down in the Widget settings - thanks to Balky79
@@ -606,7 +646,7 @@ Secondly, make sure that the token ([subscribe2] or <!--subscribe2-->) is correc
606
= Version 5.0 by Matthew Robinson =
607
608
* Change version number to reflect change in the on going support of the plugin which is now a searchable forum or a paid service
609
- * Added links to online Subscribe2 resources into the Options->Subsribe2 page
610
* Fixed Digest Time Dropdown to recall Cron Task scheduled time
611
* Fixed code using updated [Admin Menu Plugin](http://wordpress.org/extend/plugins/ozh-admin-drop-down-menu/) API
612
* Fixed foreach() error in widget rename function
@@ -762,7 +802,7 @@ Secondly, make sure that the token ([subscribe2] or <!--subscribe2-->) is correc
762
* Added BCCLIMIT and S2PAGE to options page with AJAX editing
763
* Improved setting of CRON task base time
764
* Improved handling of option values in the options form
765
- * Full XHTML compliance on all subscribe2 admin pages
766
* Decode HTML entity codes in notification email subjects
767
* Added Subscribe2 support for blogging via email
768
* Work-around fix implemented for WordPress the_title bug
3
Donate link: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904
4
Tags: posts, subscription, email, subscribe, notify, notification
5
Requires at least: 3.1
6
+ Tested up to: 3.5
7
+ Stable tag: 8.6
8
License: GPL3
9
10
Sends a list of subscribers an email notification when new posts are published to your blog
17
18
The plugin also handles subscription requests allowing users to publicly subscribe (**Public Subscribers**) by submitting their email address in an easy to use form or to register with your blog (**Registered Users**) which enables greater flexibility over the email content for per-post notifications for the subscriber. Admins are given control over the presentation of the email notifications, can bulk manage subscriptions for users and manually send email notices to subscribers.
19
20
+ The format of the email can also be customised for per-post notifications, Subscribe2 can generate emails for each of the following formats:
21
22
* plaintext excerpt
23
* plaintext full post (Registered Users only)
24
* HTML excerpt (Registered Users only)
25
* HTML full post (Registered Users only)
26
27
+ If you want to send full content HTML emails to Public Subscribers too then upgrade to [Subscribe2 HTML](http://semperplugins.com/plugins/subscribe2-html/).
28
29
== Installation ==
30
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.
41
8. In the WordPress "Settings" area for Subscribe2 select the page name in the "Appearance" section that of the WordPress page created in step 7.
42
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.
53
8. In the WordPress "Settings" area for Subscribe2 select the page name in the "Appearance" section that of the WordPress page created in step 7.
54
56
57
= I want HTML email to be the default email type =
58
59
+ You need to pay for the [Subscribe2 HTML version](http://semperplugins.com/plugins/subscribe2-html/).
60
61
= Where can I get help? =
62
+ So, you've downloaded the plugin an it isn't doing what you expect. First you should read the included documentation. There is a [ReadMe.txt](http://plugins.svn.wordpress.org/subscribe2/trunk/ReadMe.txt) file and a [legacy PDF startup guide](http://plugins.svn.wordpress.org/subscribe2/tags/6.0/The%20WordPress%20Subscriber%20User%20Guide.pdf) installed with the plugin.
63
64
Next you could search in the [WordPress forums](http://wordpress.org/support/), the old [Subscribe2 Forum](http://getsatisfaction.com/subscribe2/), or the [Subscribe2 blog FAQs](http://subscribe2.wordpress.com/category/faq/).
65
98
99
**Header Details**. Some hosting providers place a restriction on the maximum number of recipients in any one email message. Some hosts simply block all emails on certain low-cost hosting plans.
100
101
+ Subscribe2 provides a facility to work around a restriction of the maximum number of recipients per email by sending batches of emails. To enable this feature, go to Subscribe2->Settings and locate the setting to restrict the number of recipients per email. If this is set to 30 then each outgoing email notification will only contain addresses for 30 recipients.
102
103
+ Reminder: Because Subscribe2 places all recipients in BCC fields, and places the blog admin in the TO field, the blog admin will receive one email per batched delivery. So if you have 90 subscribers, the blog admin should receive three post notification emails, one for each set of 30 BCC recipients.
104
105
Batches will occur for each group of message as described above. A site like this with many public and registered subscribers could conceivably generate a lot of email for your own inbox.
106
132
}
133
add_filter('cron_schedules', 'add_my_new_sched');`
134
135
+ = I'd like to change the size of the image inserted by the {IMAGE} keyword in the paid version of the code. Is this possible? =
136
+
137
+ Yes, this is possible, it just requires a little bit of code. Subscribe2 introduced a filter in version 8.6 that allows on-the-fly customisation of the image size. Use the code below in a plugin of your own.
138
+
139
+ `function my_s2_image_size() {
140
+ // return a pre-defined size like 'thumbnail' or 'full'
141
+ // or return a physical size as an array like array(300, 300) or array(150, 150)
142
+
143
+ // examples:
144
+ return 'thumbnail';
145
+ return 'full'
146
+ return array(300,300);
147
+ }
148
+
149
+ add_filter('s2_image_size', 'my_s2_image_size');`
150
+
151
+ = When I click on Send Preview in Susbcribe2->Settings I get 4 emails, why =
152
153
Subscribe2 supports 4 potential email formats for Susbcribers so you will get a preview for each of the different possibilities.
154
177
178
There are basically only 2 types of subscriber. Public Subscribers and Registered Subscribers.
179
180
+ Public Subscribers have provided their email address for email notification of your new posts. When they enter there address on your site they are sent an email asking them to confirm their request and added to a list of Unconfirmed Subscribers. Once they complete their request by clicking on the link in their email they will become Confirmed Subscribers. They will receive a limited email notification when new post is made or periodically (unless that post is assigned to one of the excluded categories you defined). These Public Subscribers will receive a plaintext email with an excerpt of the post: either the excerpt you created when making the post, the portion of text before a <!--more--> tag (if present), or the first 50 words or so of the post.
181
182
+ Registered Users have registered with your WordPress blog (provided you have enabled this in the core WordPress settings). Registered users of the blog can elect to receive email notifications for specific categories (unless Digest email are select, then it is an opt in or out decision). The Subscribe2->Your Subscriptions menu item will also allow them greater control to select the delivery format (plaintext or HTML), amount of message (excerpt or full post), and the categories to which they want to subscribe. You, the blog owner, have the option (Subscribe2->Settings) to allow registered users to subscribe to your excluded categories or not.
183
184
+ **Note** You can send HTML emails to Public Subscribers with the paid [Subscribe2 HTML version](http://semperplugins.com/plugins/subscribe2-html/) of the plugin.
185
186
= Can I put the form elsewhere? (header, footer, sidebar without the widget) =
187
304
305
= I'd like to be able to send my subscribers notifications in HTML =
306
307
+ By default Public Subscribers get plain text emails and only Registered Subscribers can opt to receive email in HTML format. If you really want HTML for all you need to pay for the [Subscribe2 HTML version](http://semperplugins.com/plugins/subscribe2-html/).
308
309
= Which version should I be using, I'm on WordPress x.x.x? =
310
325
326
== Screenshots ==
327
328
+ 1. The Subscribe2->Mail Subscribers admin page generated by the plugin.
329
+ 2. The Subscribe2->Subscribers admin page generated by the plugin.
330
+ 3. The Subscribe2->Subscriptions admin page generated by the plugin.
331
+ 4. The Subscribe2->Subscribe2 admin page generated by the plugin.
332
333
== Changelog ==
334
335
+ = Version 8.6 by Matthew Robinson =
336
+
337
+ * Minor layout update to Widget Settings
338
+ * Fix for non-sending notifications for pages - proposed by ctcdesign
339
+ * Fix for a translation domain error in admin/settings.php - proposed by monpelaud
340
+ * Fix for deprecated is_blog_user() function on Multisite installs - proposed by hallcp
341
+ * Extend Subscribe2 database table to collect additional data to meet DreamHost privacy policy - thanks to matt, joshukraine and Dreamhost
342
+ * Refresh Subscribers page in admin, tables now sortable on present columns
343
+ * Order CSS files better by applying CSSComb
344
+ * Reuse $value variable in the 'frontend' class to reduce translation strings
345
+ * Improve AJAX form to obey the shortcode hide parameter - proposed by bwsl
346
+ * Correct spelling error in the Settings page - proposed by dimadin
347
+ * Call translation code via a hook to allow greater dynamic control - proposed by dimadin
348
+ * Look in more locations for translation files, can place in core languages folder now for upgrade protection
349
+ * Refresh Settings page in admin to a tabbed interface
350
+ * Strip HTML from email subject to improve compatibility with other plugins and WordPress 3.5
351
+ * Fixed bug in the display of compulsory categories in the Settings page
352
+ * Add option to manually send emails to All Registered Users and Public Subscribers - proposed by TigWeb
353
+ * Enable TinyURL link shortening for Digest Notification Emails if {TINYLINK} is present in the Email Template
354
+ * Fixed bug in TinyURL error handling and fallback when link generation fails
355
+ * Fixed bug where {DATE} was left blank in the subject field for future scheduled post notifications - thanks to Steve Savoy
356
+ * Added a filter to allow on-the-fly alteration of the size of the {IMAGE} in the paid version
357
+ * Fixed a warning message for a core function ready for WordPress 3.6
358
+
359
= Version 8.5 by Matthew Robinson =
360
361
* Fixed width of a page select drop down in the Widget settings - thanks to Balky79
646
= Version 5.0 by Matthew Robinson =
647
648
* Change version number to reflect change in the on going support of the plugin which is now a searchable forum or a paid service
649
+ * Added links to online Subscribe2 resources into the Options->Subscribe2 page
650
* Fixed Digest Time Dropdown to recall Cron Task scheduled time
651
* Fixed code using updated [Admin Menu Plugin](http://wordpress.org/extend/plugins/ozh-admin-drop-down-menu/) API
652
* Fixed foreach() error in widget rename function
802
* Added BCCLIMIT and S2PAGE to options page with AJAX editing
803
* Improved setting of CRON task base time
804
* Improved handling of option values in the options form
805
+ * Full XHTML compliance on all Subscribe2 admin pages
806
* Decode HTML entity codes in notification email subjects
807
* Added Subscribe2 support for blogging via email
808
* Work-around fix implemented for WordPress the_title bug
admin/send_email.php CHANGED
@@ -71,10 +71,10 @@ echo "<p>" . __('Subject', 'subscribe2') . ": <input type=\"text\" size=\"69\" n
71
echo "<textarea rows=\"12\" cols=\"75\" name=\"content\">" . $body . "</textarea>";
72
echo "<br /><br />\r\n";
73
echo __('Recipients:', 'subscribe2') . " ";
74
- $this->display_subscriber_dropdown('registered', false, array('all'));
75
echo "<input type=\"hidden\" name=\"s2_admin\" value=\"mail\" />";
76
echo "</p>";
77
- echo "<p class=\"submit\"><input type=\"submit\" class=\"button-secondary\" name=\"preview\" value=\"" . __('Preview', 'subscribe2') . "\" /><input type=\"submit\" class=\"button-primary\" name=\"send\" value=\"" . __('Send', 'subscribe2') . "\" /></p>";
78
echo "</form></div>\r\n";
79
echo "<div style=\"clear: both;\"><p>&nbsp;</p></div>";
80
71
echo "<textarea rows=\"12\" cols=\"75\" name=\"content\">" . $body . "</textarea>";
72
echo "<br /><br />\r\n";
73
echo __('Recipients:', 'subscribe2') . " ";
74
+ $this->display_subscriber_dropdown('registered', false);
75
echo "<input type=\"hidden\" name=\"s2_admin\" value=\"mail\" />";
76
echo "</p>";
77
+ echo "<p class=\"submit\"><input type=\"submit\" class=\"button-secondary\" name=\"preview\" value=\"" . __('Preview', 'subscribe2') . "\" />&nbsp;<input type=\"submit\" class=\"button-primary\" name=\"send\" value=\"" . __('Send', 'subscribe2') . "\" /></p>";
78
echo "</form></div>\r\n";
79
echo "<div style=\"clear: both;\"><p>&nbsp;</p></div>";
80
admin/settings.php CHANGED
@@ -3,7 +3,7 @@ if ( !function_exists('add_action') ) {
3
exit();
4
}
5
6
- global $s2nonce, $wpdb, $wp_version;
7
8
// was anything POSTed?
9
if ( isset( $_POST['s2_admin']) ) {
@@ -30,158 +30,81 @@ if ( isset( $_POST['s2_admin']) ) {
30
echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Attempt made to resend the Digest Notification email', 'subscribe2') . "</strong></p></div>";
31
}
32
} elseif ( isset($_POST['submit']) ) {
33
- // BCClimit
34
- if ( is_numeric($_POST['bcc']) && $_POST['bcc'] >= 0 ) {
35
- $this->subscribe2_options['bcclimit'] = $_POST['bcc'];
36
- }
37
- // admin_email
38
- $this->subscribe2_options['admin_email'] = $_POST['admin_email'];
39
-
40
- // send as blogname, author or admin?
41
- if ( is_numeric($_POST['sender']) ) {
42
- $sender = $_POST['sender'];
43
- } elseif ($_POST['sender'] == 'author') {
44
- $sender = 'author';
45
- } else {
46
- $sender = 'blogname';
47
- }
48
- $this->subscribe2_options['sender'] = $sender;
49
-
50
- // send email for pages, private and password protected posts
51
- $this->subscribe2_options['stylesheet'] = $_POST['stylesheet'];
52
- $this->subscribe2_options['pages'] = $_POST['pages'];
53
- $this->subscribe2_options['password'] = $_POST['password'];
54
- $this->subscribe2_options['private'] = $_POST['private'];
55
- $this->subscribe2_options['stickies'] = $_POST['stickies'];
56
- $this->subscribe2_options['cron_order'] = $_POST['cron_order'];
57
- $this->subscribe2_options['tracking'] = $_POST['tracking'];
58
-
59
- // send per-post or digest emails
60
- $email_freq = $_POST['email_freq'];
61
- $scheduled_time = wp_next_scheduled('s2_digest_cron');
62
- if ( $email_freq != $this->subscribe2_options['email_freq'] || $_POST['hour'] != date('H', $scheduled_time) ) {
63
- $this->subscribe2_options['email_freq'] = $email_freq;
64
- wp_clear_scheduled_hook('s2_digest_cron');
65
- $scheds = (array)wp_get_schedules();
66
- $interval = ( isset($scheds[$email_freq]['interval']) ) ? (int) $scheds[$email_freq]['interval'] : 0;
67
- if ( $interval == 0 ) {
68
- // if we are on per-post emails remove last_cron entry
69
- unset($this->subscribe2_options['last_s2cron']);
70
- unset($this->subscribe2_options['previous_s2cron']);
71
- } else {
72
- // if we are using digest schedule the event and prime last_cron as now
73
- $time = time() + $interval;
74
- $timestamp = mktime($_POST['hour'], 0, 0, date('m', $time), date('d', $time), date('Y', $time));
75
- while ($timestamp < time()) {
76
- // if we are trying to set the time in the past increment it forward
77
- // by the interval period until it is in the future
78
- $timestamp += $interval;
79
}
80
- wp_schedule_event($timestamp, $email_freq, 's2_digest_cron');
81
- if ( !isset($this->subscribe2_options['last_s2cron']) ) {
82
- $this->subscribe2_options['last_s2cron'] = current_time('mysql');
83
}
84
}
85
}
86
87
- // email subject and body templates
88
- // ensure that are not empty before updating
89
- if ( !empty($_POST['notification_subject']) ) {
90
- $this->subscribe2_options['notification_subject'] = $_POST['notification_subject'];
91
- }
92
- if ( !empty($_POST['mailtext']) ) {
93
- $this->subscribe2_options['mailtext'] = $_POST['mailtext'];
94
- }
95
- if ( !empty($_POST['confirm_subject']) ) {
96
- $this->subscribe2_options['confirm_subject'] = $_POST['confirm_subject'];
97
- }
98
- if ( !empty($_POST['confirm_email']) ) {
99
- $this->subscribe2_options['confirm_email'] = $_POST['confirm_email'];
100
- }
101
- if ( !empty($_POST['remind_subject']) ) {
102
- $this->subscribe2_options['remind_subject'] = $_POST['remind_subject'];
103
- }
104
- if ( !empty($_POST['remind_email']) ) {
105
- $this->subscribe2_options['remind_email'] = $_POST['remind_email'];
106
- }
107
-
108
- // compulsory categories
109
- if ( !empty($_POST['compulsory']) ) {
110
- sort($_POST['compulsory']);
111
- $compulsory_cats = implode(',', $_POST['compulsory']);
112
- } else {
113
- $compulsory_cats = '';
114
- }
115
- $this->subscribe2_options['compulsory'] = $compulsory_cats;
116
-
117
- // excluded categories
118
- if ( !empty($_POST['category']) ) {
119
- sort($_POST['category']);
120
- $exclude_cats = implode(',', $_POST['category']);
121
- } else {
122
- $exclude_cats = '';
123
- }
124
- $this->subscribe2_options['exclude'] = $exclude_cats;
125
- // allow override?
126
- ( isset($_POST['reg_override']) ) ? $override = '1' : $override = '0';
127
- $this->subscribe2_options['reg_override'] = $override;
128
-
129
- // excluded formats
130
- if ( !empty($_POST['format']) ) {
131
- $exclude_formats = implode(',', $_POST['format']);
132
- } else {
133
- $exclude_formats = '';
134
- }
135
- $this->subscribe2_options['exclude_formats'] = $exclude_formats;
136
-
137
- // default WordPress page where Subscribe2 token is placed
138
- if ( is_numeric($_POST['page']) && $_POST['page'] >= 0 ) {
139
- $this->subscribe2_options['s2page'] = $_POST['page'];
140
- }
141
-
142
- // Number of subscriber per page
143
- if ( is_numeric($_POST['entries']) && $_POST['entries'] > 0 ) {
144
- $this->subscribe2_options['entries'] = (int)$_POST['entries'];
145
- }
146
-
147
- // show meta link?
148
- ( isset($_POST['show_meta']) && $_POST['show_meta'] == '1' ) ? $showmeta = '1' : $showmeta = '0';
149
- $this->subscribe2_options['show_meta'] = $showmeta;
150
-
151
- // show button?
152
- ( isset($_POST['show_button']) && $_POST['show_button'] == '1' ) ? $showbutton = '1' : $showbutton = '0';
153
- $this->subscribe2_options['show_button'] = $showbutton;
154
-
155
- // enable AJAX style form
156
- ( isset($_POST['ajax']) && $_POST['ajax'] == '1' ) ? $ajax = '1' : $ajax = '0';
157
- $this->subscribe2_options['ajax'] = $ajax;
158
-
159
- // show widget in Presentation->Widgets
160
- ( isset($_POST['widget']) && $_POST['widget'] == '1' ) ? $showwidget = '1' : $showwidget = '0';
161
- $this->subscribe2_options['widget'] = $showwidget;
162
-
163
- // show counterwidget in Presentation->Widgets
164
- ( isset($_POST['counterwidget']) && $_POST['counterwidget'] == '1' ) ? $showcounterwidget = '1' : $showcounterwidget = '0';
165
- $this->subscribe2_options['counterwidget'] = $showcounterwidget;
166
-
167
- // Subscribe2 over ride postmeta checked by default
168
- ( isset($_POST['s2meta_default']) && $_POST['s2meta_default'] == '1' ) ? $s2meta_default = '1' : $s2meta_default = '0';
169
- $this->subscribe2_options['s2meta_default'] = $s2meta_default;
170
-
171
- //automatic subscription
172
- $this->subscribe2_options['autosub'] = $_POST['autosub'];
173
- $this->subscribe2_options['newreg_override'] = $_POST['newreg_override'];
174
- $this->subscribe2_options['wpregdef'] = $_POST['wpregdef'];
175
- $this->subscribe2_options['autoformat'] = $_POST['autoformat'];
176
- $this->subscribe2_options['show_autosub'] = $_POST['show_autosub'];
177
- $this->subscribe2_options['autosub_def'] = $_POST['autosub_def'];
178
- $this->subscribe2_options['comment_subs'] = $_POST['comment_subs'];
179
- $this->subscribe2_options['comment_def'] = $_POST['comment_def'];
180
- $this->subscribe2_options['one_click_profile'] = $_POST['one_click_profile'];
181
-
182
- //barred domains
183
- $this->subscribe2_options['barred'] = $_POST['barred'];
184
-
185
echo "<div id=\"message\" class=\"updated fade\"><p><strong>$this->options_saved</strong></p></div>";
186
update_option('subscribe2_options', $this->subscribe2_options);
187
}
@@ -206,302 +129,333 @@ if ( !strstr($_SERVER['SERVER_NAME'], $domain) && $this->subscribe2_options['sen
206
echo "<div id=\"sender_message\" class=\"error\"><p class=\"s2_error\"><strong>" . __('You appear to be sending notifications from an email address from a different domain name to your blog, this may result in failed emails', 'subscribe2') . "</strong></p></div>";
207
}
208
209
// show our form
210
echo "<div class=\"wrap\">";
211
echo "<div id=\"icon-options-general\" class=\"icon32\"></div>";
212
- echo "<h2>" . __('Subscribe2 Settings', 'subscribe2') . "</h2>\r\n";
213
- echo "<a href=\"http://subscribe2.wordpress.com/\">" . __('Plugin Blog', 'subscribe2') . "</a> | ";
214
- echo "<a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904\">" . __('Make a donation via PayPal', 'subscribe2') . "</a>";
215
echo "<form method=\"post\">\r\n";
216
if ( function_exists('wp_nonce_field') ) {
217
wp_nonce_field('subscribe2-options_subscribers' . $s2nonce);
218
}
219
echo "<input type=\"hidden\" name=\"s2_admin\" value=\"options\" />\r\n";
220
- echo "<input type=\"hidden\" id=\"jsbcc\" value=\"" . $this->subscribe2_options['bcclimit'] . "\" />";
221
- echo "<input type=\"hidden\" id=\"jspage\" value=\"" . $this->subscribe2_options['s2page'] . "\" />";
222
echo "<input type=\"hidden\" id=\"jsentries\" value=\"" . $this->subscribe2_options['entries'] . "\" />";
223
224
- // settings for outgoing emails
225
- echo "<div class=\"s2_admin\" id=\"s2_notification_settings\">\r\n";
226
- echo "<h2>" . __('Notification Settings', 'subscribe2') . "</h2>\r\n";
227
- echo __('Restrict the number of recipients per email to (0 for unlimited)', 'subscribe2') . ': ';
228
- echo "<span id=\"s2bcc_1\"><span id=\"s2bcc\" style=\"background-color: #FFFBCC\">" . $this->subscribe2_options['bcclimit'] . "</span> ";
229
- echo "<a href=\"#\" onclick=\"s2_show('bcc'); return false;\">" . __('Edit', 'subscribe2') . "</a></span>\n";
230
- echo "<span id=\"s2bcc_2\">\r\n";
231
- echo "<input type=\"text\" name=\"bcc\" value=\"" . $this->subscribe2_options['bcclimit'] . "\" size=\"3\" />\r\n";
232
- echo "<a href=\"#\" onclick=\"s2_update('bcc'); return false;\">". __('Update', 'subscribe2') . "</a>\n";
233
- echo "<a href=\"#\" onclick=\"s2_revert('bcc'); return false;\">". __('Revert', 'subscribe2') . "</a></span>\n";
234
-
235
- echo "<br /><br />" . __('Send Admins notifications for new', 'subscribe2') . ': ';
236
- echo "<label><input type=\"radio\" name=\"admin_email\" value=\"subs\"" . checked($this->subscribe2_options['admin_email'], 'subs', false) . " />\r\n";
237
- echo __('Subscriptions', 'subscribe2') . "</label>&nbsp;&nbsp;";
238
- echo "<label><input type=\"radio\" name=\"admin_email\" value=\"unsubs\"" . checked($this->subscribe2_options['admin_email'], 'unsubs', false) . " />\r\n";
239
- echo __('Unsubscriptions', 'subscribe2') . "</label>&nbsp;&nbsp;";
240
- echo "<label><input type=\"radio\" name=\"admin_email\" value=\"both\"" . checked($this->subscribe2_options['admin_email'], 'both', false) . " />\r\n";
241
- echo __('Both', 'subscribe2') . "</label>&nbsp;&nbsp;";
242
- echo "<label><input type=\"radio\" name=\"admin_email\" value=\"none\"" . checked($this->subscribe2_options['admin_email'], 'none', false) . " />\r\n";
243
- echo __('Neither', 'subscribe2') . "</label><br /><br />\r\n";
244
-
245
- echo __('Include theme CSS stylesheet in HTML notifications', 'subscribe2') . ': ';
246
- echo "<label><input type=\"radio\" name=\"stylesheet\" value=\"yes\"" . checked($this->subscribe2_options['stylesheet'], 'yes', false) . " /> ";
247
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
248
- echo "<label><input type=\"radio\" name=\"stylesheet\" value=\"no\"" . checked($this->subscribe2_options['stylesheet'], 'no', false) . " /> ";
249
- echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
250
-
251
- echo __('Send Emails for Pages', 'subscribe2') . ': ';
252
- echo "<label><input type=\"radio\" name=\"pages\" value=\"yes\"" . checked($this->subscribe2_options['pages'], 'yes', false) . " /> ";
253
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
254
- echo "<label><input type=\"radio\" name=\"pages\" value=\"no\"" . checked($this->subscribe2_options['pages'], 'no', false) . " /> ";
255
- echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
256
- $s2_post_types = apply_filters('s2_post_types', NULL);
257
- if ( !empty($s2_post_types) ) {
258
- $types = '';
259
- echo __('Subscribe2 will send email notifications for the following custom post types', 'subscribe2') . ': <strong>';
260
- foreach ($s2_post_types as $type) {
261
- ('' == $types) ? $types = ucwords($type) : $types .= ", " . ucwords($type);
262
- }
263
- echo $types . "</strong><br /><br />\r\n";
264
- }
265
- echo __('Send Emails for Password Protected Posts', 'subscribe2') . ': ';
266
- echo "<label><input type=\"radio\" name=\"password\" value=\"yes\"" . checked($this->subscribe2_options['password'], 'yes', false) . " /> ";
267
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
268
- echo "<label><input type=\"radio\" name=\"password\" value=\"no\"" . checked($this->subscribe2_options['password'], 'no', false) . " /> ";
269
- echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
270
- echo __('Send Emails for Private Posts', 'subscribe2') . ': ';
271
- echo "<label><input type=\"radio\" name=\"private\" value=\"yes\"" . checked($this->subscribe2_options['private'], 'yes', false) . " /> ";
272
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
273
- echo "<label><input type=\"radio\" name=\"private\" value=\"no\"" . checked($this->subscribe2_options['private'], 'no', false) . " /> ";
274
- echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
275
- echo __('Include Sticky Posts at the top of all Digest Notifications', 'subscribe2') . ': ';
276
- echo "<label><input type=\"radio\" name=\"stickies\" value=\"yes\"" . checked($this->subscribe2_options['stickies'], 'yes', false) . " /> ";
277
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
278
- echo "<label><input type=\"radio\" name=\"stickies\" value=\"no\"" . checked($this->subscribe2_options['stickies'], 'no', false) . " /> ";
279
- echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
280
- echo __('Send Email From', 'subscribe2') . ': ';
281
- echo "<label>\r\n";
282
- $this->admin_dropdown(true);
283
- echo "</label><br /><br />\r\n";
284
- if ( function_exists('wp_schedule_event') ) {
285
- echo __('Send Emails', 'subscribe2') . ": <br /><br />\r\n";
286
- $this->display_digest_choices();
287
- echo __('For digest notifications, date order for posts is', 'subscribe2') . ": \r\n";
288
- echo "<label><input type=\"radio\" name=\"cron_order\" value=\"desc\"" . checked($this->subscribe2_options['cron_order'], 'desc', false) . " /> ";
289
- echo __('Descending', 'subscribe2') . "</label>&nbsp;&nbsp;";
290
- echo "<label><input type=\"radio\" name=\"cron_order\" value=\"asc\"" . checked($this->subscribe2_options['cron_order'], 'asc', false) . " /> ";
291
- echo __('Ascending', 'subscribe2') . "</label><br /><br />\r\n";
292
- }
293
- echo __('Add Tracking Parameters to the Permalink', 'subscribe2') . ": ";
294
- echo "<input type=\"text\" name=\"tracking\" value=\"" . stripslashes($this->subscribe2_options['tracking']) . "\" size=\"50\" /> ";
295
- echo "<br />" . __('eg. utm_source=subscribe2&amp;utm_medium=email&amp;utm_campaign=postnotify&amp;utm_id={ID}', 'subscribe2') . "<br /><br />\r\n";
296
- echo "</div>\r\n";
297
-
298
- // email templates
299
- echo "<div class=\"s2_admin\" id=\"s2_templates\">\r\n";
300
- echo "<h2>" . __('Email Templates', 'subscribe2') . "</h2>\r\n";
301
- echo "<br />";
302
- echo "<table style=\"width: 100%; border-collapse: separate; border-spacing: 5px; *border-collapse: expression('separate', cellSpacing = '5px');\" class=\"editform\">\r\n";
303
- echo "<tr><td style=\"vertical-align: top; height: 350px; min-height: 350px;\">";
304
- echo __('New Post email (must not be empty)', 'subscribe2') . ":<br />\r\n";
305
- echo __('Subject Line', 'subscribe2') . ": ";
306
- echo "<input type=\"text\" name=\"notification_subject\" value=\"" . stripslashes($this->subscribe2_options['notification_subject']) . "\" size=\"30\" />";
307
- echo "<br />\r\n";
308
- echo "<textarea rows=\"9\" cols=\"60\" name=\"mailtext\">" . stripslashes($this->subscribe2_options['mailtext']) . "</textarea>\r\n";
309
- echo "</td><td style=\"vertical-align: top;\" rowspan=\"3\">";
310
- echo "<p class=\"submit\"><input type=\"submit\" class=\"button-secondary\" name=\"preview\" value=\"" . __('Send Email Preview', 'subscribe2') . "\" /></p>\r\n";
311
- echo "<h3>" . __('Message substitutions', 'subscribe2') . "</h3>\r\n";
312
- echo "<dl>";
313
- echo "<dt><b><em style=\"color: red\">" . __('IF THE FOLLOWING KEYWORDS ARE ALSO IN YOUR POST THEY WILL BE SUBSTITUTED' ,'subscribe2') . "</em></b></dt><dd></dd>\r\n";
314
- echo "<dt><b>{BLOGNAME}</b></dt><dd>" . get_option('blogname') . "</dd>\r\n";
315
- echo "<dt><b>{BLOGLINK}</b></dt><dd>" . get_option('home') . "</dd>\r\n";
316
- echo "<dt><b>{TITLE}</b></dt><dd>" . __("the post's title<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
317
- echo "<dt><b>{POST}</b></dt><dd>" . __("the excerpt or the entire post<br />(<i>based on the subscriber's preferences</i>)", 'subscribe2') . "</dd>\r\n";
318
- echo "<dt><b>{POSTTIME}</b></dt><dd>" . __("the excerpt of the post and the time it was posted<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
319
- echo "<dt><b>{TABLE}</b></dt><dd>" . __("a list of post titles<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
320
- echo "<dt><b>{TABLELINKS}</b></dt><dd>" . __("a list of post titles followed by links to the atricles<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
321
- echo "<dt><b>{PERMALINK}</b></dt><dd>" . __("the post's permalink<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
322
- echo "<dt><b>{TINYLINK}</b></dt><dd>" . __("the post's permalink after conversion by TinyURL<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
323
- echo "<dt><b>{DATE}</b></dt><dd>" . __("the date the post was made<br />(<i>for per-post emails only</i>)", "subscribe2") . "</dd>\r\n";
324
- echo "<dt><b>{TIME}</b></dt><dd>" . __("the time the post was made<br />(<i>for per-post emails only</i>)", "subscribe2") . "</dd>\r\n";
325
- echo "<dt><b>{MYNAME}</b></dt><dd>" . __("the admin or post author's name", 'subscribe2') . "</dd>\r\n";
326
- echo "<dt><b>{EMAIL}</b></dt><dd>" . __("the admin or post author's email", 'subscribe2') . "</dd>\r\n";
327
- echo "<dt><b>{AUTHORNAME}</b></dt><dd>" . __("the post author's name", 'subscribe2') . "</dd>\r\n";
328
- echo "<dt><b>{LINK}</b></dt><dd>" . __("the generated link to confirm a request<br />(<i>only used in the confirmation email template</i>)", 'subscribe2') . "</dd>\r\n";
329
- echo "<dt><b>{ACTION}</b></dt><dd>" . __("Action performed by LINK in confirmation email<br />(<i>only used in the confirmation email template</i>)", 'subscribe2') . "</dd>\r\n";
330
- echo "<dt><b>{CATS}</b></dt><dd>" . __("the post's assigned categories", 'subscribe2') . "</dd>\r\n";
331
- echo "<dt><b>{TAGS}</b></dt><dd>" . __("the post's assigned Tags", 'subscribe2') . "</dd>\r\n";
332
- echo "<dt><b>{COUNT}</b></dt><dd>" . __("the number of posts included in the digest email<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
333
- echo "</dl></td></tr><tr><td style=\"vertical-align: top; height: 350px; min-height: 350px;\">";
334
- echo __('Subscribe / Unsubscribe confirmation email', 'subscribe2') . ":<br />\r\n";
335
- echo __('Subject Line', 'subscribe2') . ": ";
336
- echo "<input type=\"text\" name=\"confirm_subject\" value=\"" . stripslashes($this->subscribe2_options['confirm_subject']) . "\" size=\"30\" /><br />\r\n";
337
- echo "<textarea rows=\"9\" cols=\"60\" name=\"confirm_email\">" . stripslashes($this->subscribe2_options['confirm_email']) . "</textarea>\r\n";
338
- echo "</td></tr><tr><td style=\"vertical-align: top; height: 350px; min-height: 350px;\">";
339
- echo __('Reminder email to Unconfirmed Subscribers', 'subscribe2') . ":<br />\r\n";
340
- echo __('Subject Line', 'subscribe2') . ": ";
341
- echo "<input type=\"text\" name=\"remind_subject\" value=\"" . stripslashes($this->subscribe2_options['remind_subject']) . "\" size=\"30\" /><br />\r\n";
342
- echo "<textarea rows=\"9\" cols=\"60\" name=\"remind_email\">" . stripslashes($this->subscribe2_options['remind_email']) . "</textarea><br /><br />\r\n";
343
- echo "</td></tr></table><br />\r\n";
344
- echo "</div>\r\n";
345
-
346
- // compulsory categories
347
- echo "<div class=\"s2_admin\" id=\"s2_compulsory_categories\">\r\n";
348
- echo "<h2>" . __('Complusory Categories', 'subscribe2') . "</h2>\r\n";
349
- echo "<p>";
350
- echo "<strong><em style=\"color: red\">" . __('Compulsory categories will be checked by default for Registered Subscribers', 'subscribe2') . "</em></strong><br />\r\n";
351
- echo "</p>";
352
- $this->display_category_form(array(), 1, explode(',', $this->subscribe2_options['compulsory']), 'compulsory');
353
- echo "</div>\r\n";
354
-
355
- // excluded categories
356
- echo "<div class=\"s2_admin\" id=\"s2_excluded_categories\">\r\n";
357
- echo "<h2>" . __('Excluded Categories', 'subscribe2') . "</h2>\r\n";
358
- echo "<p>";
359
- echo "<strong><em style=\"color: red\">" . __('Posts assigned to any Excluded Category do not generate notifications and are not included in digest notifications', 'subscribe2') . "</em></strong><br />\r\n";
360
- echo "</p>";
361
- $this->display_category_form(explode(',', $this->subscribe2_options['exclude']));
362
- echo "<p style=\"text-align: center;\"><label><input type=\"checkbox\" name=\"reg_override\" value=\"1\"" . checked($this->subscribe2_options['reg_override'], '1', false) . " /> ";
363
- echo __('Allow registered users to subscribe to excluded categories?', 'subscribe2') . "</label></p><br />\r\n";
364
- echo "</div>\r\n";
365
-
366
- // excluded post formats
367
- $formats = get_theme_support('post-formats');
368
- if ( $formats !== false ) {
369
- // excluded formats
370
- echo "<div class=\"s2_admin\" id=\"s2_excluded_formats\">\r\n";
371
- echo "<h2>" . __('Excluded Formats', 'subscribe2') . "</h2>\r\n";
372
- echo "<p>";
373
- echo "<strong><em style=\"color: red\">" . __('Posts assigned to any Excluded Format do not generate notifications and are not included in digest notifications', 'subscribe2') . "</em></strong><br />\r\n";
374
- echo "</p>";
375
- $this->display_format_form($formats, explode(',', $this->subscribe2_options['exclude_formats']));
376
- echo "</div>\r\n";
377
- }
378
-
379
- // Appearance options
380
- echo "<div class=\"s2_admin\" id=\"s2_appearance_settings\">\r\n";
381
- echo "<h2>" . __('Appearance', 'subscribe2') . "</h2>\r\n";
382
- echo "<p>";
383
-
384
- // WordPress page ID where subscribe2 token is used
385
- echo __('Set default Subscribe2 page as ID', 'subscribe2') . ': ';
386
- echo "<select name=\"page\">\r\n";
387
- $this->pages_dropdown($this->subscribe2_options['s2page']);
388
- echo "</select>\r\n";
389
-
390
- // Number of subscribers per page
391
- echo "<br /><br />" . __('Set the number of Subscribers displayed per page', 'subscribe2') . ': ';
392
- echo "<span id=\"s2entries_1\"><span id=\"s2entries\" style=\"background-color: #FFFBCC\">" . $this->subscribe2_options['entries'] . "</span> ";
393
- echo "<a href=\"#\" onclick=\"s2_show('entries'); return false;\">" . __('Edit', 'subscribe2') . "</a></span>\n";
394
- echo "<span id=\"s2entries_2\">\r\n";
395
- echo "<input type=\"text\" name=\"entries\" value=\"" . $this->subscribe2_options['entries'] . "\" size=\"3\" />\r\n";
396
- echo "<a href=\"#\" onclick=\"s2_update('entries'); return false;\">". __('Update', 'subscribe2') . "</a>\n";
397
- echo "<a href=\"#\" onclick=\"s2_revert('entries'); return false;\">". __('Revert', 'subscribe2') . "</a></span>\n";
398
-
399
- // show link to WordPress page in meta
400
- echo "<br /><br /><label><input type=\"checkbox\" name=\"show_meta\" value=\"1\"" . checked($this->subscribe2_options['show_meta'], '1', false) . " /> ";
401
- echo __('Show a link to your subscription page in "meta"?', 'subscribe2') . "</label><br /><br />\r\n";
402
403
- // show QuickTag button
404
- echo "<label><input type=\"checkbox\" name=\"show_button\" value=\"1\"" . checked($this->subscribe2_options['show_button'], '1', false) . " /> ";
405
- echo __('Show the Subscribe2 button on the Write toolbar?', 'subscribe2') . "</label><br /><br />\r\n";
406
407
- // enable AJAX style form
408
- echo "<label><input type=\"checkbox\" name=\"ajax\" value=\"1\"" . checked($this->subscribe2_options['ajax'], '1', false) . " /> ";
409
- echo __('Enable AJAX style subscription form?', 'subscribe2') . "</label><br /><br />\r\n";
410
411
- // show Widget
412
- echo "<label><input type=\"checkbox\" name=\"widget\" value=\"1\"" . checked($this->subscribe2_options['widget'], '1', false) . " /> ";
413
- echo __('Enable Subscribe2 Widget?', 'subscribe2') . "</label><br /><br />\r\n";
414
415
- // show Counter Widget
416
- echo "<label><input type=\"checkbox\" name=\"counterwidget\" value=\"1\"" . checked($this->subscribe2_options['counterwidget'], '1', false) . " /> ";
417
- echo __('Enable Subscribe2 Counter Widget?', 'subscribe2') . "</label><br /><br />\r\n";
418
419
- // s2_meta checked by default
420
- echo "<label><input type =\"checkbox\" name=\"s2meta_default\" value=\"1\"" . checked($this->subscribe2_options['s2meta_default'], '1', false) . " /> ";
421
- echo __('Disable email notifications is checked by default on authoring pages?', 'subscribe2') . "</label>\r\n";
422
- echo "</p>";
423
- echo "</div>\r\n";
424
425
- //Auto Subscription for new registrations
426
- echo "<div class=\"s2_admin\" id=\"s2_autosubscribe_settings\">\r\n";
427
- echo "<h2>" . __('Auto Subscribe', 'subscribe2') . "</h2>\r\n";
428
- echo "<p>";
429
- echo __('Subscribe new users registering with your blog', 'subscribe2') . ":<br />\r\n";
430
- echo "<label><input type=\"radio\" name=\"autosub\" value=\"yes\"" . checked($this->subscribe2_options['autosub'], 'yes', false) . " /> ";
431
- echo __('Automatically', 'subscribe2') . "</label>&nbsp;&nbsp;";
432
- echo "<label><input type=\"radio\" name=\"autosub\" value=\"wpreg\"" . checked($this->subscribe2_options['autosub'], 'wpreg', false) . " /> ";
433
- echo __('Display option on Registration Form', 'subscribe2') . "</label>&nbsp;&nbsp;";
434
- echo "<label><input type=\"radio\" name=\"autosub\" value=\"no\"" . checked($this->subscribe2_options['autosub'], 'no', false) . " /> ";
435
- echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
436
- echo __('Auto-subscribe includes any excluded categories', 'subscribe2') . ":<br />\r\n";
437
- echo "<label><input type=\"radio\" name=\"newreg_override\" value=\"yes\"" . checked($this->subscribe2_options['newreg_override'], 'yes', false) . " /> ";
438
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
439
- echo "<label><input type=\"radio\" name=\"newreg_override\" value=\"no\"" . checked($this->subscribe2_options['newreg_override'], 'no', false) . " /> ";
440
- echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
441
- echo __('Registration Form option is checked by default', 'subscribe2') . ":<br />\r\n";
442
- echo "<label><input type=\"radio\" name=\"wpregdef\" value=\"yes\"" . checked($this->subscribe2_options['wpregdef'], 'yes', false) . " /> ";
443
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
444
- echo "<label><input type=\"radio\" name=\"wpregdef\" value=\"no\"" . checked($this->subscribe2_options['wpregdef'], 'no', false) . " /> ";
445
- echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
446
- echo __('Auto-subscribe users to receive email as', 'subscribe2') . ": <br />\r\n";
447
- echo "<label><input type=\"radio\" name=\"autoformat\" value=\"html\"" . checked($this->subscribe2_options['autoformat'], 'html', false) . " /> ";
448
- echo __('HTML - Full', 'subscribe2') ."</label>&nbsp;&nbsp;";
449
- echo "<label><input type=\"radio\" name=\"autoformat\" value=\"html_excerpt\"" . checked($this->subscribe2_options['autoformat'], 'html_excerpt', false) . " /> ";
450
- echo __('HTML - Excerpt', 'subscribe2') ."</label>&nbsp;&nbsp;";
451
- echo "<label><input type=\"radio\" name=\"autoformat\" value=\"post\"" . checked($this->subscribe2_options['autoformat'], 'post', false) . " /> ";
452
- echo __('Plain Text - Full', 'subscribe2') . "</label>&nbsp;&nbsp;";
453
- echo "<label><input type=\"radio\" name=\"autoformat\" value=\"excerpt\"" . checked($this->subscribe2_options['autoformat'], 'excerpt', false) . " /> ";
454
- echo __('Plain Text - Excerpt', 'subscribe2') . "</label><br /><br />";
455
- echo __('Registered Users have the option to auto-subscribe to new categories', 'subscribe2') . ": <br />\r\n";
456
- echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"yes\"" . checked($this->subscribe2_options['show_autosub'], 'yes', false) . " /> ";
457
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
458
- echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"no\"" . checked($this->subscribe2_options['show_autosub'], 'no', false) . " /> ";
459
- echo __('No', 'subscribe2') . "</label>&nbsp;&nbsp;";
460
- echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"exclude\"" . checked($this->subscribe2_options['show_autosub'], 'exclude', false) . " /> ";
461
- echo __('New categories are immediately excluded', 'subscribe2') . "</label><br /><br />";
462
- echo __('Option for Registered Users to auto-subscribe to new categories is checked by default', 'subscribe2') . ": <br />\r\n";
463
- echo "<label><input type=\"radio\" name=\"autosub_def\" value=\"yes\"" . checked($this->subscribe2_options['autosub_def'], 'yes', false) . " /> ";
464
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
465
- echo "<label><input type=\"radio\" name=\"autosub_def\" value=\"no\"" . checked($this->subscribe2_options['autosub_def'], 'no', false) . " /> ";
466
- echo __('No', 'subscribe2') . "</label><br /><br />";
467
- echo __('Display checkbox to allow subscriptions from the comment form', 'subscribe2') . ": <br />\r\n";
468
- echo "<label><input type=\"radio\" name=\"comment_subs\" value=\"before\"" . checked($this->subscribe2_options['comment_subs'], 'before', false) . " /> ";
469
- echo __('Before the Comment Submit button', 'subscribe2') . "</label>&nbsp;&nbsp;";
470
- echo "<label><input type=\"radio\" name=\"comment_subs\" value=\"after\"" . checked($this->subscribe2_options['comment_subs'], 'after', false) . " /> ";
471
- echo __('After the Comment Submit button', 'subscribe2') . "</label>&nbsp;&nbsp;";
472
- echo "<label><input type=\"radio\" name=\"comment_subs\" value=\"no\"" . checked($this->subscribe2_options['comment_subs'], 'no', false) . " /> ";
473
- echo __('No', 'subscribe2') . "</label><br /><br />";
474
- echo __('Comment form checkbox is checked by default', 'subscrib2') . ": <br />\r\n";
475
- echo "<label><input type=\"radio\" name=\"comment_def\" value=\"yes\"" . checked($this->subscribe2_options['comment_def'], 'yes', false) . " /> ";
476
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
477
- echo "<label><input type=\"radio\" name=\"comment_def\" value=\"no\"" . checked($this->subscribe2_options['comment_def'], 'no', false) . " /> ";
478
- echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
479
- echo __('Show one-click subscription on profile page', 'subscribe2') . ":<br />\r\n";
480
- echo "<label><input type=\"radio\" name=\"one_click_profile\" value=\"yes\"" . checked($this->subscribe2_options['one_click_profile'], 'yes', false) . " /> ";
481
- echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
482
- echo "<label><input type=\"radio\" name=\"one_click_profile\" value=\"no\"" . checked($this->subscribe2_options['one_click_profile'], 'no', false) . " /> ";
483
- echo __('No', 'subscribe2') . "</label>\r\n";
484
- echo "</p></div>\r\n";
485
486
- //barred domains
487
- echo "<div class=\"s2_admin\" id=\"s2_barred_domains\">\r\n";
488
- echo "<h2>" . __('Barred Domains', 'subscribe2') . "</h2>\r\n";
489
- echo "<p>";
490
- echo __('Enter domains to bar from public subscriptions: <br /> (Use a new line for each entry and omit the "@" symbol, for example email.com)', 'subscribe2');
491
- echo "<br />\r\n<textarea style=\"width: 98%;\" rows=\"4\" cols=\"60\" name=\"barred\">" . esc_textarea($this->subscribe2_options['barred']) . "</textarea>";
492
- echo "</p>";
493
- echo "</div>\r\n";
494
495
// submit
496
echo "<p class=\"submit\" style=\"text-align: center\"><input type=\"submit\" class=\"button-primary\" name=\"submit\" value=\"" . __('Submit', 'subscribe2') . "\" /></p>";
497
498
- // reset
499
- echo "<h2>" . __('Reset Default', 'subscribe2') . "</h2>\r\n";
500
- echo "<p>" . __('Use this to reset all options to their defaults. This <strong><em>will not</em></strong> modify your list of subscribers.', 'subscribe2') . "</p>\r\n";
501
- echo "<p class=\"submit\" style=\"text-align: center\">";
502
- echo "<input type=\"submit\" id=\"deletepost\" name=\"reset\" value=\"" . __('RESET', 'subscribe2') .
503
- "\" />";
504
- echo "</p></form></div>\r\n";
505
506
include(ABSPATH . 'wp-admin/admin-footer.php');
507
// just to be sure
3
exit();
4
}
5
6
+ global $s2nonce, $wpdb, $wp_version, $current_tab;
7
8
// was anything POSTed?
9
if ( isset( $_POST['s2_admin']) ) {
30
echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Attempt made to resend the Digest Notification email', 'subscribe2') . "</strong></p></div>";
31
}
32
} elseif ( isset($_POST['submit']) ) {
33
+ foreach ($_POST as $key => $value) {
34
+ if ( in_array($key, array('bcclimit', 's2page', 'entries')) ) {
35
+ // numerical inputs fixed for old option names
36
+ if ( is_numeric($_POST[$key]) && $_POST[$key] >= 0 ) {
37
+ $this->subscribe2_options[$key] = (int)$_POST[$key];
38
+ }
39
+ } elseif ( in_array($key, array('show_meta', 'show_button', 'ajax', 'widget', 'counterwidget', 's2meta_default', 'reg_override')) ) {
40
+ // check box entries
41
+ ( isset($_POST[$key]) && $_POST[$key] == '1' ) ? $newvalue = '1' : $newvalue = '0';
42
+ $this->subscribe2_options[$key] = $newvalue;
43
+ } elseif ( $key === 'appearance_users_tab' ) {
44
+ $options = array('show_meta', 'show_button', 'ajax', 'widget', 'counterwidget', 's2meta_default');
45
+ foreach ( $options as $option ) {
46
+ if ( !isset($_POST[$option]) ) {
47
+ $this->subscribe2_options[$option] = '';
48
+ }
49
+ }
50
+ } elseif ( in_array($key, array('notification_subject', 'mailtext', 'confirm_subject', 'confirm_email', 'remind_subject', 'remind_email')) && !empty($_POST[$key]) ) {
51
+ // email subject and body templates
52
+ $this->subscribe2_options[$key] = $_POST[$key];
53
+ } elseif ( in_array($key, array('compulsory', 'exclude', 'format')) ) {
54
+ sort($_POST[$key]);
55
+ $newvalue = implode(',', $_POST[$key]);
56
+
57
+ if ($key === 'format') {
58
+ $this->subscribe2_options['exclude_formats'] = $newvalue;
59
+ } else {
60
+ $this->subscribe2_options[$key] = $newvalue;
61
}
62
+ } elseif ( $key === 'registered_users_tab' ) {
63
+ $options = array('compulsory', 'exclude', 'format', 'reg_override');
64
+ foreach ( $options as $option ) {
65
+ if ( !isset($_POST[$option]) ) {
66
+ if ($option === 'format') {
67
+ $this->subscribe2_options['exclude_formats'] = '';
68
+ } else {
69
+ $this->subscribe2_options[$option] = '';
70
+ }
71
+ }
72
+ }
73
+ } elseif ( $key === 'email_freq' ) {
74
+ // send per-post or digest emails
75
+ $email_freq = $_POST['email_freq'];
76
+ $scheduled_time = wp_next_scheduled('s2_digest_cron');
77
+ if ( $email_freq != $this->subscribe2_options['email_freq'] || $_POST['hour'] != date('H', wp_next_scheduled('s2_digest_cron')) ) {
78
+ $this->subscribe2_options['email_freq'] = $email_freq;
79
+ wp_clear_scheduled_hook('s2_digest_cron');
80
+ $scheds = (array)wp_get_schedules();
81
+ $interval = ( isset($scheds[$email_freq]['interval']) ) ? (int)$scheds[$email_freq]['interval'] : 0;
82
+ if ( $interval == 0 ) {
83
+ // if we are on per-post emails remove last_cron entry
84
+ unset($this->subscribe2_options['last_s2cron']);
85
+ unset($this->subscribe2_options['previous_s2cron']);
86
+ } else {
87
+ // if we are using digest schedule the event and prime last_cron as now
88
+ $time = time() + $interval;
89
+ $timestamp = mktime($_POST['hour'], 0, 0, date('m', $time), date('d', $time), date('Y', $time));
90
+ while ($timestamp < time()) {
91
+ // if we are trying to set the time in the past increment it forward
92
+ // by the interval period until it is in the future
93
+ $timestamp += $interval;
94
+ }
95
+ wp_schedule_event($timestamp, $email_freq, 's2_digest_cron');
96
+ if ( !isset($this->subscribe2_options['last_s2cron']) ) {
97
+ $this->subscribe2_options['last_s2cron'] = current_time('mysql');
98
+ }
99
+ }
100
+ }
101
+ } else {
102
+ if ( isset($this->subscribe2_options[$key]) ) {
103
+ $this->subscribe2_options[$key] = $_POST[$key];
104
}
105
}
106
}
107
108
echo "<div id=\"message\" class=\"updated fade\"><p><strong>$this->options_saved</strong></p></div>";
109
update_option('subscribe2_options', $this->subscribe2_options);
110
}
129
echo "<div id=\"sender_message\" class=\"error\"><p class=\"s2_error\"><strong>" . __('You appear to be sending notifications from an email address from a different domain name to your blog, this may result in failed emails', 'subscribe2') . "</strong></p></div>";
130
}
131
132
+ // detect or define which tab we are in
133
+ $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'email';
134
+
135
// show our form
136
echo "<div class=\"wrap\">";
137
echo "<div id=\"icon-options-general\" class=\"icon32\"></div>";
138
+ $tabs = array('email' => __('Email Settings', 'subscribe2'),
139
+ 'templates' => __('Templates', 'subscribe2'),
140
+ 'registered' => __('Registered Users', 'subscribe2'),
141
+ 'appearance' => __('Appearance', 'subscribe2'),
142
+ 'misc' => __('Miscellaneous', 'subscribe2'));
143
+ echo "<h2 class=\"nav-tab-wrapper\">";
144
+ foreach ( $tabs as $tab_key => $tab_caption ) {
145
+ $active = ($current_tab == $tab_key) ? "nav-tab-active" : "";
146
+ echo "<a class=\"nav-tab " . $active . "\" href=\"?page=s2_settings&amp;tab=" . $tab_key . "\">" . $tab_caption . "</a>";
147
+ }
148
+ echo "</h2>";
149
+
150
echo "<form method=\"post\">\r\n";
151
if ( function_exists('wp_nonce_field') ) {
152
wp_nonce_field('subscribe2-options_subscribers' . $s2nonce);
153
}
154
echo "<input type=\"hidden\" name=\"s2_admin\" value=\"options\" />\r\n";
155
+ echo "<input type=\"hidden\" id=\"jsbcclimit\" value=\"" . $this->subscribe2_options['bcclimit'] . "\" />";
156
echo "<input type=\"hidden\" id=\"jsentries\" value=\"" . $this->subscribe2_options['entries'] . "\" />";
157
158
+ switch ($current_tab) {
159
+ case 'email':
160
+ // settings for outgoing emails
161
+ echo "<div class=\"s2_admin\" id=\"s2_notification_settings\">\r\n";
162
+ echo "<p>\r\n";
163
+ echo __('Restrict the number of recipients per email to (0 for unlimited)', 'subscribe2') . ': ';
164
+ echo "<span id=\"s2bcclimit_1\"><span id=\"s2bcclimit\" style=\"background-color: #FFFBCC\">" . $this->subscribe2_options['bcclimit'] . "</span> ";
165
+ echo "<a href=\"#\" onclick=\"s2_show('bcclimit'); return false;\">" . __('Edit', 'subscribe2') . "</a></span>\n";
166
+ echo "<span id=\"s2bcclimit_2\">\r\n";
167
+ echo "<input type=\"text\" name=\"bcclimit\" value=\"" . $this->subscribe2_options['bcclimit'] . "\" size=\"3\" />\r\n";
168
+ echo "<a href=\"#\" onclick=\"s2_update('bcclimit'); return false;\">". __('Update', 'subscribe2') . "</a>\n";
169
+ echo "<a href=\"#\" onclick=\"s2_revert('bcclimit'); return false;\">". __('Revert', 'subscribe2') . "</a></span>\n";
170
+
171
+ echo "<br /><br />" . __('Send Admins notifications for new', 'subscribe2') . ': ';
172
+ echo "<label><input type=\"radio\" name=\"admin_email\" value=\"subs\"" . checked($this->subscribe2_options['admin_email'], 'subs', false) . " />\r\n";
173
+ echo __('Subscriptions', 'subscribe2') . "</label>&nbsp;&nbsp;";
174
+ echo "<label><input type=\"radio\" name=\"admin_email\" value=\"unsubs\"" . checked($this->subscribe2_options['admin_email'], 'unsubs', false) . " />\r\n";
175
+ echo __('Unsubscriptions', 'subscribe2') . "</label>&nbsp;&nbsp;";
176
+ echo "<label><input type=\"radio\" name=\"admin_email\" value=\"both\"" . checked($this->subscribe2_options['admin_email'], 'both', false) . " />\r\n";
177
+ echo __('Both', 'subscribe2') . "</label>&nbsp;&nbsp;";
178
+ echo "<label><input type=\"radio\" name=\"admin_email\" value=\"none\"" . checked($this->subscribe2_options['admin_email'], 'none', false) . " />\r\n";
179
+ echo __('Neither', 'subscribe2') . "</label><br /><br />\r\n";
180
+
181
+ echo __('Include theme CSS stylesheet in HTML notifications', 'subscribe2') . ': ';
182
+ echo "<label><input type=\"radio\" name=\"stylesheet\" value=\"yes\"" . checked($this->subscribe2_options['stylesheet'], 'yes', false) . " /> ";
183
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
184
+ echo "<label><input type=\"radio\" name=\"stylesheet\" value=\"no\"" . checked($this->subscribe2_options['stylesheet'], 'no', false) . " /> ";
185
+ echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
186
+
187
+ echo __('Send Emails for Pages', 'subscribe2') . ': ';
188
+ echo "<label><input type=\"radio\" name=\"pages\" value=\"yes\"" . checked($this->subscribe2_options['pages'], 'yes', false) . " /> ";
189
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
190
+ echo "<label><input type=\"radio\" name=\"pages\" value=\"no\"" . checked($this->subscribe2_options['pages'], 'no', false) . " /> ";
191
+ echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
192
+ $s2_post_types = apply_filters('s2_post_types', NULL);
193
+ if ( !empty($s2_post_types) ) {
194
+ $types = '';
195
+ echo __('Subscribe2 will send email notifications for the following custom post types', 'subscribe2') . ': <strong>';
196
+ foreach ($s2_post_types as $type) {
197
+ ('' == $types) ? $types = ucwords($type) : $types .= ", " . ucwords($type);
198
+ }
199
+ echo $types . "</strong><br /><br />\r\n";
200
+ }
201
+ echo __('Send Emails for Password Protected Posts', 'subscribe2') . ': ';
202
+ echo "<label><input type=\"radio\" name=\"password\" value=\"yes\"" . checked($this->subscribe2_options['password'], 'yes', false) . " /> ";
203
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
204
+ echo "<label><input type=\"radio\" name=\"password\" value=\"no\"" . checked($this->subscribe2_options['password'], 'no', false) . " /> ";
205
+ echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
206
+ echo __('Send Emails for Private Posts', 'subscribe2') . ': ';
207
+ echo "<label><input type=\"radio\" name=\"private\" value=\"yes\"" . checked($this->subscribe2_options['private'], 'yes', false) . " /> ";
208
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
209
+ echo "<label><input type=\"radio\" name=\"private\" value=\"no\"" . checked($this->subscribe2_options['private'], 'no', false) . " /> ";
210
+ echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
211
+ echo __('Include Sticky Posts at the top of all Digest Notifications', 'subscribe2') . ': ';
212
+ echo "<label><input type=\"radio\" name=\"stickies\" value=\"yes\"" . checked($this->subscribe2_options['stickies'], 'yes', false) . " /> ";
213
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
214
+ echo "<label><input type=\"radio\" name=\"stickies\" value=\"no\"" . checked($this->subscribe2_options['stickies'], 'no', false) . " /> ";
215
+ echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
216
+ echo __('Send Email From', 'subscribe2') . ': ';
217
+ echo "<label>\r\n";
218
+ $this->admin_dropdown(true);
219
+ echo "</label><br /><br />\r\n";
220
+ if ( function_exists('wp_schedule_event') ) {
221
+ echo __('Send Emails', 'subscribe2') . ": <br /><br />\r\n";
222
+ $this->display_digest_choices();
223
+ echo __('For digest notifications, date order for posts is', 'subscribe2') . ": \r\n";
224
+ echo "<label><input type=\"radio\" name=\"cron_order\" value=\"desc\"" . checked($this->subscribe2_options['cron_order'], 'desc', false) . " /> ";
225
+ echo __('Descending', 'subscribe2') . "</label>&nbsp;&nbsp;";
226
+ echo "<label><input type=\"radio\" name=\"cron_order\" value=\"asc\"" . checked($this->subscribe2_options['cron_order'], 'asc', false) . " /> ";
227
+ echo __('Ascending', 'subscribe2') . "</label><br /><br />\r\n";
228
+ }
229
+ echo __('Add Tracking Parameters to the Permalink', 'subscribe2') . ": ";
230
+ echo "<input type=\"text\" name=\"tracking\" value=\"" . stripslashes($this->subscribe2_options['tracking']) . "\" size=\"50\" /> ";
231
+ echo "<br />" . __('eg. utm_source=subscribe2&amp;utm_medium=email&amp;utm_campaign=postnotify&amp;utm_id={ID}', 'subscribe2') . "\r\n";
232
+ echo "</p>\r\n";
233
+ echo "</div>\r\n";
234
+ break;
235
+
236
+ case 'templates':
237
+ // email templates
238
+ echo "<div class=\"s2_admin\" id=\"s2_templates\">\r\n";
239
+ echo "<p>\r\n";
240
+ echo "<table style=\"width: 100%; border-collapse: separate; border-spacing: 5px; *border-collapse: expression('separate', cellSpacing = '5px');\" class=\"editform\">\r\n";
241
+ echo "<tr><td style=\"vertical-align: top; height: 350px; min-height: 350px;\">";
242
+ echo __('New Post email (must not be empty)', 'subscribe2') . ":<br />\r\n";
243
+ echo __('Subject Line', 'subscribe2') . ": ";
244
+ echo "<input type=\"text\" name=\"notification_subject\" value=\"" . stripslashes($this->subscribe2_options['notification_subject']) . "\" size=\"30\" />";
245
+ echo "<br />\r\n";
246
+ echo "<textarea rows=\"9\" cols=\"60\" name=\"mailtext\">" . stripslashes($this->subscribe2_options['mailtext']) . "</textarea>\r\n";
247
+ echo "</td><td style=\"vertical-align: top;\" rowspan=\"3\">";
248
+ echo "<p class=\"submit\"><input type=\"submit\" class=\"button-secondary\" name=\"preview\" value=\"" . __('Send Email Preview', 'subscribe2') . "\" /></p>\r\n";
249
+ echo "<h3>" . __('Message substitutions', 'subscribe2') . "</h3>\r\n";
250
+ echo "<dl>";
251
+ echo "<dt><b><em style=\"color: red\">" . __('IF THE FOLLOWING KEYWORDS ARE ALSO IN YOUR POST THEY WILL BE SUBSTITUTED' ,'subscribe2') . "</em></b></dt><dd></dd>\r\n";
252
+ echo "<dt><b>{BLOGNAME}</b></dt><dd>" . get_option('blogname') . "</dd>\r\n";
253
+ echo "<dt><b>{BLOGLINK}</b></dt><dd>" . get_option('home') . "</dd>\r\n";
254
+ echo "<dt><b>{TITLE}</b></dt><dd>" . __("the post's title<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
255
+ echo "<dt><b>{POST}</b></dt><dd>" . __("the excerpt or the entire post<br />(<i>based on the subscriber's preferences</i>)", 'subscribe2') . "</dd>\r\n";
256
+ echo "<dt><b>{POSTTIME}</b></dt><dd>" . __("the excerpt of the post and the time it was posted<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
257
+ echo "<dt><b>{TABLE}</b></dt><dd>" . __("a list of post titles<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
258
+ echo "<dt><b>{TABLELINKS}</b></dt><dd>" . __("a list of post titles followed by links to the atricles<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
259
+ echo "<dt><b>{PERMALINK}</b></dt><dd>" . __("the post's permalink<br />(<i>for per-post emails only</i>)", 'subscribe2') . "</dd>\r\n";
260
+ echo "<dt><b>{TINYLINK}</b></dt><dd>" . __("the post's permalink after conversion by TinyURL", 'subscribe2') . "</dd>\r\n";
261
+ echo "<dt><b>{DATE}</b></dt><dd>" . __("the date the post was made<br />(<i>for per-post emails only</i>)", "subscribe2") . "</dd>\r\n";
262
+ echo "<dt><b>{TIME}</b></dt><dd>" . __("the time the post was made<br />(<i>for per-post emails only</i>)", "subscribe2") . "</dd>\r\n";
263
+ echo "<dt><b>{MYNAME}</b></dt><dd>" . __("the admin or post author's name", 'subscribe2') . "</dd>\r\n";
264
+ echo "<dt><b>{EMAIL}</b></dt><dd>" . __("the admin or post author's email", 'subscribe2') . "</dd>\r\n";
265
+ echo "<dt><b>{AUTHORNAME}</b></dt><dd>" . __("the post author's name", 'subscribe2') . "</dd>\r\n";
266
+ echo "<dt><b>{LINK}</b></dt><dd>" . __("the generated link to confirm a request<br />(<i>only used in the confirmation email template</i>)", 'subscribe2') . "</dd>\r\n";
267
+ echo "<dt><b>{ACTION}</b></dt><dd>" . __("Action performed by LINK in confirmation email<br />(<i>only used in the confirmation email template</i>)", 'subscribe2') . "</dd>\r\n";
268
+ echo "<dt><b>{CATS}</b></dt><dd>" . __("the post's assigned categories", 'subscribe2') . "</dd>\r\n";
269
+ echo "<dt><b>{TAGS}</b></dt><dd>" . __("the post's assigned Tags", 'subscribe2') . "</dd>\r\n";
270
+ echo "<dt><b>{COUNT}</b></dt><dd>" . __("the number of posts included in the digest email<br />(<i>for digest emails only</i>)", 'subscribe2') . "</dd>\r\n";
271
+ echo "</dl></td></tr><tr><td style=\"vertical-align: top; height: 350px; min-height: 350px;\">";
272
+ echo __('Subscribe / Unsubscribe confirmation email', 'subscribe2') . ":<br />\r\n";
273
+ echo __('Subject Line', 'subscribe2') . ": ";
274
+ echo "<input type=\"text\" name=\"confirm_subject\" value=\"" . stripslashes($this->subscribe2_options['confirm_subject']) . "\" size=\"30\" /><br />\r\n";
275
+ echo "<textarea rows=\"9\" cols=\"60\" name=\"confirm_email\">" . stripslashes($this->subscribe2_options['confirm_email']) . "</textarea>\r\n";
276
+ echo "</td></tr><tr><td style=\"vertical-align: top; height: 350px; min-height: 350px;\">";
277
+ echo __('Reminder email to Unconfirmed Subscribers', 'subscribe2') . ":<br />\r\n";
278
+ echo __('Subject Line', 'subscribe2') . ": ";
279
+ echo "<input type=\"text\" name=\"remind_subject\" value=\"" . stripslashes($this->subscribe2_options['remind_subject']) . "\" size=\"30\" /><br />\r\n";
280
+ echo "<textarea rows=\"9\" cols=\"60\" name=\"remind_email\">" . stripslashes($this->subscribe2_options['remind_email']) . "</textarea><br /><br />\r\n";
281
+ echo "</td></tr></table>\r\n";
282
+ echo "</div>\r\n";
283
+ break;
284
+
285
+ case 'registered':
286
+ // compulsory categories
287
+ echo "<div class=\"s2_admin\" id=\"s2_compulsory_categories\">\r\n";
288
+ echo "<input type=\"hidden\" name=\"registered_users_tab\" value=\"options\" />\r\n";
289
+ echo "<h3>" . __('Compulsory Categories', 'subscribe2') . "</h3>\r\n";
290
+ echo "<p>\r\n";
291
+ echo "<strong><em style=\"color: red\">" . __('Compulsory categories will be checked by default for Registered Subscribers', 'subscribe2') . "</em></strong><br />\r\n";
292
+ echo "</p>";
293
+ $this->display_category_form(explode(',', $this->subscribe2_options['compulsory']), 1, array(), 'compulsory');
294
+ echo "</div>\r\n";
295
296
+ // excluded categories
297
+ echo "<div class=\"s2_admin\" id=\"s2_excluded_categories\">\r\n";
298
+ echo "<h3>" . __('Excluded Categories', 'subscribe2') . "</h3>\r\n";
299
+ echo "<p>";
300
+ echo "<strong><em style=\"color: red\">" . __('Posts assigned to any Excluded Category do not generate notifications and are not included in digest notifications', 'subscribe2') . "</em></strong><br />\r\n";
301
+ echo "</p>";
302
+ $this->display_category_form(explode(',', $this->subscribe2_options['exclude']), 1, array(), 'exclude');
303
+ echo "<p style=\"text-align: center;\"><label><input type=\"checkbox\" name=\"reg_override\" value=\"1\"" . checked($this->subscribe2_options['reg_override'], '1', false) . " /> ";
304
+ echo __('Allow registered users to subscribe to excluded categories?', 'subscribe2') . "</label></p>\r\n";
305
+ echo "</div>\r\n";
306
+
307
+ // excluded post formats
308
+ $formats = get_theme_support('post-formats');
309
+ if ( $formats !== false ) {
310
+ // excluded formats
311
+ echo "<div class=\"s2_admin\" id=\"s2_excluded_formats\">\r\n";
312
+ echo "<h3>" . __('Excluded Formats', 'subscribe2') . "</h3>\r\n";
313
+ echo "<p>";
314
+ echo "<strong><em style=\"color: red\">" . __('Posts assigned to any Excluded Format do not generate notifications and are not included in digest notifications', 'subscribe2') . "</em></strong><br />\r\n";
315
+ echo "</p>";
316
+ $this->display_format_form($formats, explode(',', $this->subscribe2_options['exclude_formats']));
317
+ echo "</div>\r\n";
318
+ }
319
320
+ //Auto Subscription for new registrations
321
+ echo "<div class=\"s2_admin\" id=\"s2_autosubscribe_settings\">\r\n";
322
+ echo "<h3>" . __('Auto-Subscribe', 'subscribe2') . "</h3>\r\n";
323
+ echo "<p>\r\n";
324
+ echo __('Subscribe new users registering with your blog', 'subscribe2') . ":<br />\r\n";
325
+ echo "<label><input type=\"radio\" name=\"autosub\" value=\"yes\"" . checked($this->subscribe2_options['autosub'], 'yes', false) . " /> ";
326
+ echo __('Automatically', 'subscribe2') . "</label>&nbsp;&nbsp;";
327
+ echo "<label><input type=\"radio\" name=\"autosub\" value=\"wpreg\"" . checked($this->subscribe2_options['autosub'], 'wpreg', false) . " /> ";
328
+ echo __('Display option on Registration Form', 'subscribe2') . "</label>&nbsp;&nbsp;";
329
+ echo "<label><input type=\"radio\" name=\"autosub\" value=\"no\"" . checked($this->subscribe2_options['autosub'], 'no', false) . " /> ";
330
+ echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
331
+ echo __('Auto-subscribe includes any excluded categories', 'subscribe2') . ":<br />\r\n";
332
+ echo "<label><input type=\"radio\" name=\"newreg_override\" value=\"yes\"" . checked($this->subscribe2_options['newreg_override'], 'yes', false) . " /> ";
333
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
334
+ echo "<label><input type=\"radio\" name=\"newreg_override\" value=\"no\"" . checked($this->subscribe2_options['newreg_override'], 'no', false) . " /> ";
335
+ echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
336
+ echo __('Registration Form option is checked by default', 'subscribe2') . ":<br />\r\n";
337
+ echo "<label><input type=\"radio\" name=\"wpregdef\" value=\"yes\"" . checked($this->subscribe2_options['wpregdef'], 'yes', false) . " /> ";
338
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
339
+ echo "<label><input type=\"radio\" name=\"wpregdef\" value=\"no\"" . checked($this->subscribe2_options['wpregdef'], 'no', false) . " /> ";
340
+ echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
341
+ echo __('Auto-subscribe users to receive email as', 'subscribe2') . ": <br />\r\n";
342
+ echo "<label><input type=\"radio\" name=\"autoformat\" value=\"html\"" . checked($this->subscribe2_options['autoformat'], 'html', false) . " /> ";
343
+ echo __('HTML - Full', 'subscribe2') ."</label>&nbsp;&nbsp;";
344
+ echo "<label><input type=\"radio\" name=\"autoformat\" value=\"html_excerpt\"" . checked($this->subscribe2_options['autoformat'], 'html_excerpt', false) . " /> ";
345
+ echo __('HTML - Excerpt', 'subscribe2') ."</label>&nbsp;&nbsp;";
346
+ echo "<label><input type=\"radio\" name=\"autoformat\" value=\"post\"" . checked($this->subscribe2_options['autoformat'], 'post', false) . " /> ";
347
+ echo __('Plain Text - Full', 'subscribe2') . "</label>&nbsp;&nbsp;";
348
+ echo "<label><input type=\"radio\" name=\"autoformat\" value=\"excerpt\"" . checked($this->subscribe2_options['autoformat'], 'excerpt', false) . " /> ";
349
+ echo __('Plain Text - Excerpt', 'subscribe2') . "</label><br /><br />";
350
+ echo __('Registered Users have the option to auto-subscribe to new categories', 'subscribe2') . ": <br />\r\n";
351
+ echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"yes\"" . checked($this->subscribe2_options['show_autosub'], 'yes', false) . " /> ";
352
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
353
+ echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"no\"" . checked($this->subscribe2_options['show_autosub'], 'no', false) . " /> ";
354
+ echo __('No', 'subscribe2') . "</label>&nbsp;&nbsp;";
355
+ echo "<label><input type=\"radio\" name=\"show_autosub\" value=\"exclude\"" . checked($this->subscribe2_options['show_autosub'], 'exclude', false) . " /> ";
356
+ echo __('New categories are immediately excluded', 'subscribe2') . "</label><br /><br />";
357
+ echo __('Option for Registered Users to auto-subscribe to new categories is checked by default', 'subscribe2') . ": <br />\r\n";
358
+ echo "<label><input type=\"radio\" name=\"autosub_def\" value=\"yes\"" . checked($this->subscribe2_options['autosub_def'], 'yes', false) . " /> ";
359
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
360
+ echo "<label><input type=\"radio\" name=\"autosub_def\" value=\"no\"" . checked($this->subscribe2_options['autosub_def'], 'no', false) . " /> ";
361
+ echo __('No', 'subscribe2') . "</label><br /><br />";
362
+ echo __('Display checkbox to allow subscriptions from the comment form', 'subscribe2') . ": <br />\r\n";
363
+ echo "<label><input type=\"radio\" name=\"comment_subs\" value=\"before\"" . checked($this->subscribe2_options['comment_subs'], 'before', false) . " /> ";
364
+ echo __('Before the Comment Submit button', 'subscribe2') . "</label>&nbsp;&nbsp;";
365
+ echo "<label><input type=\"radio\" name=\"comment_subs\" value=\"after\"" . checked($this->subscribe2_options['comment_subs'], 'after', false) . " /> ";
366
+ echo __('After the Comment Submit button', 'subscribe2') . "</label>&nbsp;&nbsp;";
367
+ echo "<label><input type=\"radio\" name=\"comment_subs\" value=\"no\"" . checked($this->subscribe2_options['comment_subs'], 'no', false) . " /> ";
368
+ echo __('No', 'subscribe2') . "</label><br /><br />";
369
+ echo __('Comment form checkbox is checked by default', 'subscribe2') . ": <br />\r\n";
370
+ echo "<label><input type=\"radio\" name=\"comment_def\" value=\"yes\"" . checked($this->subscribe2_options['comment_def'], 'yes', false) . " /> ";
371
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
372
+ echo "<label><input type=\"radio\" name=\"comment_def\" value=\"no\"" . checked($this->subscribe2_options['comment_def'], 'no', false) . " /> ";
373
+ echo __('No', 'subscribe2') . "</label><br /><br />\r\n";
374
+ echo __('Show one-click subscription on profile page', 'subscribe2') . ":<br />\r\n";
375
+ echo "<label><input type=\"radio\" name=\"one_click_profile\" value=\"yes\"" . checked($this->subscribe2_options['one_click_profile'], 'yes', false) . " /> ";
376
+ echo __('Yes', 'subscribe2') . "</label>&nbsp;&nbsp;";
377
+ echo "<label><input type=\"radio\" name=\"one_click_profile\" value=\"no\"" . checked($this->subscribe2_options['one_click_profile'], 'no', false) . " /> ";
378
+ echo __('No', 'subscribe2') . "</label>\r\n";
379
+ echo "</p></div>\r\n";
380
+ break;
381
+
382
+ case 'appearance':
383
+ // Appearance options
384
+ echo "<div class=\"s2_admin\" id=\"s2_appearance_settings\">\r\n";
385
+ echo "<input type=\"hidden\" name=\"appearance_users_tab\" value=\"options\" />\r\n";
386
+ echo "<p>\r\n";
387
+
388
+ // WordPress page ID where subscribe2 token is used
389
+ echo __('Set default Subscribe2 page as ID', 'subscribe2') . ': ';
390
+ echo "<select name=\"s2page\">\r\n";
391
+ $this->pages_dropdown($this->subscribe2_options['s2page']);
392
+ echo "</select>\r\n";
393
+
394
+ // Number of subscribers per page
395
+ echo "<br /><br />" . __('Set the number of Subscribers displayed per page', 'subscribe2') . ': ';
396
+ echo "<span id=\"s2entries_1\"><span id=\"s2entries\" style=\"background-color: #FFFBCC\">" . $this->subscribe2_options['entries'] . "</span> ";
397
+ echo "<a href=\"#\" onclick=\"s2_show('entries'); return false;\">" . __('Edit', 'subscribe2') . "</a></span>\n";
398
+ echo "<span id=\"s2entries_2\">\r\n";
399
+ echo "<input type=\"text\" name=\"entries\" value=\"" . $this->subscribe2_options['entries'] . "\" size=\"3\" />\r\n";
400
+ echo "<a href=\"#\" onclick=\"s2_update('entries'); return false;\">". __('Update', 'subscribe2') . "</a>\n";
401
+ echo "<a href=\"#\" onclick=\"s2_revert('entries'); return false;\">". __('Revert', 'subscribe2') . "</a></span>\n";
402
+
403
+ // show link to WordPress page in meta
404
+ echo "<br /><br /><label><input type=\"checkbox\" name=\"show_meta\" value=\"1\"" . checked($this->subscribe2_options['show_meta'], '1', false) . " /> ";
405
+ echo __('Show a link to your subscription page in "meta"?', 'subscribe2') . "</label><br /><br />\r\n";
406
+
407
+ // show QuickTag button
408
+ echo "<label><input type=\"checkbox\" name=\"show_button\" value=\"1\"" . checked($this->subscribe2_options['show_button'], '1', false) . " /> ";
409
+ echo __('Show the Subscribe2 button on the Write toolbar?', 'subscribe2') . "</label><br /><br />\r\n";
410
411
+ // enable AJAX style form
412
+ echo "<label><input type=\"checkbox\" name=\"ajax\" value=\"1\"" . checked($this->subscribe2_options['ajax'], '1', false) . " /> ";
413
+ echo __('Enable AJAX style subscription form?', 'subscribe2') . "</label><br /><br />\r\n";
414
415
+ // show Widget
416
+ echo "<label><input type=\"checkbox\" name=\"widget\" value=\"1\"" . checked($this->subscribe2_options['widget'], '1', false) . " /> ";
417
+ echo __('Enable Subscribe2 Widget?', 'subscribe2') . "</label><br /><br />\r\n";
418
419
+ // show Counter Widget
420
+ echo "<label><input type=\"checkbox\" name=\"counterwidget\" value=\"1\"" . checked($this->subscribe2_options['counterwidget'], '1', false) . " /> ";
421
+ echo __('Enable Subscribe2 Counter Widget?', 'subscribe2') . "</label><br /><br />\r\n";
422
423
+ // s2_meta checked by default
424
+ echo "<label><input type =\"checkbox\" name=\"s2meta_default\" value=\"1\"" . checked($this->subscribe2_options['s2meta_default'], '1', false) . " /> ";
425
+ echo __('Disable email notifications is checked by default on authoring pages?', 'subscribe2') . "</label>\r\n";
426
+ echo "</p>";
427
+ echo "</div>\r\n";
428
+ break;
429
430
+ case 'misc':
431
+ //barred domains
432
+ echo "<div class=\"s2_admin\" id=\"s2_barred_domains\">\r\n";
433
+ echo "<h3>" . __('Barred Domains', 'subscribe2') . "</h3>\r\n";
434
+ echo "<p>\r\n";
435
+ echo __('Enter domains to bar from public subscriptions: <br /> (Use a new line for each entry and omit the "@" symbol, for example email.com)', 'subscribe2');
436
+ echo "<br />\r\n<textarea style=\"width: 98%;\" rows=\"4\" cols=\"60\" name=\"barred\">" . esc_textarea($this->subscribe2_options['barred']) . "</textarea>";
437
+ echo "</p>";
438
+ echo "<h3>" . __('Links', 'subscribe2') . "</h3>\r\n";
439
+ echo "<a href=\"http://wordpress.org/extend/plugins/subscribe2/\">" . __('Plugin Site', 'subscribe2') . "</a><br />";
440
+ echo "<a href=\"http://wordpress.org/support/plugin/subscribe2\">" . __('Plugin Forum', 'subscribe2') . "</a><br />";
441
+ echo "<a href=\"http://subscribe2.wordpress.com/\">" . __('Plugin Blog', 'subscribe2') . "</a><br />";
442
+ echo "<a href=\"https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904\">" . __('Make a donation via PayPal', 'subscribe2') . "</a>";
443
+ echo "</div>\r\n";
444
+ break;
445
446
+ }
447
// submit
448
echo "<p class=\"submit\" style=\"text-align: center\"><input type=\"submit\" class=\"button-primary\" name=\"submit\" value=\"" . __('Submit', 'subscribe2') . "\" /></p>";
449
450
+ if ($current_tab === 'misc') {
451
+ // reset
452
+ echo "<h3>" . __('Reset to Default Settings', 'subscribe2') . "</h3>\r\n";
453
+ echo "<p>" . __('Use this to reset all options to their defaults. This <strong><em>will not</em></strong> modify your list of subscribers.', 'subscribe2') . "</p>\r\n";
454
+ echo "<p class=\"submit\" style=\"text-align: center\">";
455
+ echo "<input type=\"submit\" id=\"deletepost\" name=\"reset\" value=\"" . __('RESET', 'subscribe2') .
456
+ "\" /></p>";
457
+ }
458
+ echo "</form></div>\r\n";
459
460
include(ABSPATH . 'wp-admin/admin-footer.php');
461
// just to be sure
admin/subscribers.php CHANGED
@@ -3,19 +3,15 @@ if ( !function_exists('add_action') ) {
3
exit();
4
}
5
6
- global $wpdb, $s2nonce;
7
-
8
- //Get Registered Subscribers for bulk management
9
- $registered = $this->get_registered();
10
- $all_users = $this->get_all_registered();
11
12
// was anything POSTed ?
13
if ( isset($_POST['s2_admin']) ) {
14
- check_admin_referer('subscribe2-manage_subscribers' . $s2nonce);
15
if ( !empty($_POST['addresses']) ) {
16
$sub_error = '';
17
$unsub_error = '';
18
- foreach ( preg_split ("|[\s,]+|", $_POST['addresses']) as $email ) {
19
$email = $this->sanitize_email($email);
20
if ( is_email($email) && $_POST['subscribe'] ) {
21
if ( $this->is_public($email) !== false ) {
@@ -41,35 +37,18 @@ if ( isset($_POST['s2_admin']) ) {
41
}
42
echo $message;
43
$_POST['what'] = 'confirmed';
44
- } elseif ( isset($_POST['process']) ) {
45
- if ( isset($_POST['delete']) ) {
46
- foreach ( $_POST['delete'] as $address ) {
47
- $this->delete($address);
48
- }
49
- echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Address(es) deleted!', 'subscribe2') . "</strong></p></div>";
50
}
51
- if ( isset($_POST['confirm']) ) {
52
- foreach ( $_POST['confirm'] as $address ) {
53
- $this->toggle($this->sanitize_email($address));
54
- }
55
- $message = "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Status changed!', 'subscribe2') . "</strong></p></div>";
56
- }
57
- if ( isset($_POST['unconfirm']) ) {
58
- foreach ( $_POST['unconfirm'] as $address ) {
59
- $this->toggle($this->sanitize_email($address));
60
- }
61
- $message = "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Status changed!', 'subscribe2') . "</strong></p></div>";
62
- }
63
- echo $message;
64
- } elseif ( !empty($_POST['searchterm']) ) {
65
- $confirmed = $this->get_public();
66
- $unconfirmed = $this->get_public(0);
67
- $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$all_users);
68
- foreach ( $subscribers as $subscriber ) {
69
- if ( is_numeric(stripos($subscriber, $_POST['searchterm'])) ) {
70
- $result[] = $subscriber;
71
- }
72
}
73
} elseif ( isset($_POST['remind']) ) {
74
$this->remind($_POST['reminderemails']);
75
echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Reminder Email(s) Sent!', 'subscribe2') . "</strong></p></div>";
@@ -88,150 +67,130 @@ if ( isset($_POST['s2_admin']) ) {
88
}
89
}
90
91
- //Get Public Subscribers once for filter
92
- $confirmed = $this->get_public();
93
- $unconfirmed = $this->get_public(0);
94
- // safety check for our arrays
95
- if ( '' == $confirmed ) { $confirmed = array(); }
96
- if ( '' == $unconfirmed ) { $unconfirmed = array(); }
97
- if ( '' == $registered ) { $registered = array(); }
98
- if ( '' == $all_users ) { $all_users = array(); }
99
-
100
- $reminderform = false;
101
- $urlpath = str_replace("\\", "/", S2PATH);
102
- $urlpath = trailingslashit(get_option('siteurl')) . substr($urlpath,strpos($urlpath, "wp-content/"));
103
- if ( isset($_GET['s2page']) ) {
104
- $page = (int) $_GET['s2page'];
105
} else {
106
- $page = 1;
107
}
108
109
- if ( isset($_POST['what']) ) {
110
- $page = 1;
111
- if ( 'all' == $_POST['what'] ) {
112
- $what = 'all';
113
- $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$all_users);
114
- } elseif ( 'public' == $_POST['what'] ) {
115
$what = 'public';
116
$subscribers = array_merge((array)$confirmed, (array)$unconfirmed);
117
- } elseif ( 'confirmed' == $_POST['what'] ) {
118
$what = 'confirmed';
119
$subscribers = $confirmed;
120
- } elseif ( 'unconfirmed' == $_POST['what'] ) {
121
$what = 'unconfirmed';
122
$subscribers = $unconfirmed;
123
if ( !empty($subscribers) ) {
124
$reminderemails = implode(",", $subscribers);
125
$reminderform = true;
126
}
127
- } elseif ( is_numeric($_POST['what']) ) {
128
- $what = intval($_POST['what']);
129
$subscribers = $this->get_registered("cats=$what");
130
- } elseif ( 'registered' == $_POST['what'] ) {
131
$what = 'registered';
132
$subscribers = $registered;
133
- } elseif ( 'all_users' == $_POST['what'] ) {
134
$what = 'all_users';
135
$subscribers = $all_users;
136
}
137
- } elseif ( isset($_GET['what']) ) {
138
- if ( 'all' == $_GET['what'] ) {
139
- $what = 'all';
140
- $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$all_users);
141
- } elseif ( 'public' == $_GET['what'] ) {
142
$what = 'public';
143
$subscribers = array_merge((array)$confirmed, (array)$unconfirmed);
144
- } elseif ( 'confirmed' == $_GET['what'] ) {
145
- $what = 'confirmed';
146
- $subscribers = $confirmed;
147
- } elseif ( 'unconfirmed' == $_GET['what'] ) {
148
- $what = 'unconfirmed';
149
- $subscribers = $unconfirmed;
150
- if ( !empty($subscribers) ) {
151
- $reminderemails = implode(",", $subscribers);
152
- $reminderform = true;
153
- }
154
- } elseif ( is_numeric($_GET['what']) ) {
155
- $what = intval($_GET['what']);
156
- $subscribers = $this->get_registered("cats=$what");
157
- } elseif ( 'registered' == $_GET['what'] ) {
158
- $what = 'registered';
159
- $subscribers = $registered;
160
- } elseif ( 'all_users' == $_GET['what'] ) {
161
$what = 'all_users';
162
$subscribers = $all_users;
163
}
164
- } else {
165
- $what = 'all';
166
- $subscribers = array_merge((array)$confirmed, (array)$unconfirmed, (array)$all_users);
167
- }
168
- if ( !empty($_POST['searchterm']) ) {
169
- $subscribers = &$result;
170
- $what = 'public';
171
}
172
173
- if ( !empty($subscribers) ) {
174
- natcasesort($subscribers);
175
- // Displays a page number strip - adapted from code in Akismet
176
- $args['what'] = $what;
177
- $total_subscribers = count($subscribers);
178
- $total_pages = ceil($total_subscribers / $this->subscribe2_options['entries']);
179
- $strip = '';
180
- if ( $page > 1 ) {
181
- $args['s2page'] = $page - 1;
182
- $strip .= '<a class="prev" href="' . esc_url(add_query_arg($args)) . '">&laquo; '. __('Previous Page', 'subscribe2') .'</a>' . "\n";
183
- }
184
- if ( $total_pages > 1 ) {
185
- for ( $page_num = 1; $page_num <= $total_pages; $page_num++ ) {
186
- if ( $page == $page_num ) {
187
- $strip .= "<strong>Page " . $page_num . "</strong>\n";
188
- } else {
189
- if ( $page_num < 3 || ( $page_num >= $page - 2 && $page_num <= $page + 2 ) || $page_num > $total_pages - 2 ) {
190
- $args['s2page'] = $page_num;
191
- $strip .= "<a class=\"page-numbers\" href=\"" . esc_url(add_query_arg($args)) . "\">" . $page_num . "</a>\n";
192
- $trunc = true;
193
- } elseif ( $trunc == true ) {
194
- $strip .= "...\n";
195
- $trunc = false;
196
- }
197
- }
198
}
199
}
200
- if ( ( $page ) * $this->subscribe2_options['entries'] < $total_subscribers ) {
201
- $args['s2page'] = $page + 1;
202
- $strip .= "<a class=\"next\" href=\"" . esc_url(add_query_arg($args)) . "\">". __('Next Page', 'subscribe2') . " &raquo;</a>\n";
203
- }
204
}
205
206
// show our form
207
echo "<div class=\"wrap\">";
208
echo "<div id=\"icon-tools\" class=\"icon32\"></div>";
209
- echo "<h2>" . __('Manage Subscribers', 'subscribe2') . "</h2>\r\n";
210
- echo "<form method=\"post\">\r\n";
211
- if ( function_exists('wp_nonce_field') ) {
212
- wp_nonce_field('subscribe2-manage_subscribers' . $s2nonce);
213
}
214
- echo "<div class=\"s2_admin\" id=\"s2_add_subscribers\">\r\n";
215
- echo "<h2>" . __('Add/Remove Subscribers', 'subscribe2') . "</h2>\r\n";
216
- echo "<p>" . __('Enter addresses, one per line or comma-separated', 'subscribe2') . "<br />\r\n";
217
- echo "<textarea rows=\"2\" cols=\"80\" name=\"addresses\"></textarea></p>\r\n";
218
echo "<input type=\"hidden\" name=\"s2_admin\" />\r\n";
219
- echo "<p class=\"submit\" style=\"border-top: none;\"><input type=\"submit\" class=\"button-primary\" name=\"subscribe\" value=\"" . __('Subscribe', 'subscribe2') . "\" />";
220
- echo "&nbsp;<input type=\"submit\" class=\"button-primary\" name=\"unsubscribe\" value=\"" . __('Unsubscribe', 'subscribe2') . "\" /></p>\r\n";
221
- echo "</div>\r\n";
222
223
- // subscriber lists
224
- echo "<div class=\"s2_admin\" id=\"s2_current_subscribers\">\r\n";
225
- echo "<h2>" . __('Current Subscribers', 'subscribe2') . "</h2>\r\n";
226
- echo "<br />";
227
- $this->display_subscriber_dropdown($what, __('Filter', 'subscribe2'));
228
- echo "<br /><br />";
229
// show the selected subscribers
230
- $alternate = 'alternate';
231
- echo "<table style=\"width: 100%; border-collapse: separate; border-spacing: 0px; *border-collapse: expression('separate', cellSpacing = '0px');\" class=\"widefat\" >";
232
- $searchterm = ( isset($_POST['searchterm']) ) ? stripslashes(esc_html($_POST['searchterm'])) : '';
233
- echo "<tr class=\"alternate\"><td colspan=\"3\"><input type=\"text\" name=\"searchterm\" value=\"" . $searchterm . "\" /></td>\r\n";
234
- echo "<td><input type=\"submit\" class=\"button-secondary\" name=\"search\" value=\"" . __('Search Subscribers', 'subscribe2') . "\" /></td>\r\n";
235
if ( $reminderform ) {
236
echo "<td style=\"width: 25%; text-align: right;\"><input type=\"hidden\" name=\"reminderemails\" value=\"" . $reminderemails . "\" />\r\n";
237
echo "<input type=\"submit\" class=\"button-secondary\" name=\"remind\" value=\"" . __('Send Reminder Email', 'subscribe2') . "\" /></td>\r\n";
@@ -245,76 +204,15 @@ if ( !empty($subscribers) ) {
245
} else {
246
echo "<td style=\"width: 25%;\"></td>";
247
}
248
- echo "</tr>";
249
250
- if ( !empty($subscribers) ) {
251
- echo "<tr><td colspan=\"3\" style=\"text-align: center;\"><input type=\"submit\" class=\"button-secondary\" name=\"process\" value=\"" . __('Process', 'subscribe2') . "\" /></td>\r\n";
252
- echo "<td style=\"text-align: right;\" colspan=\"3\">" . $strip . "</td></tr>\r\n";
253
- }
254
- if ( !empty($subscribers) ) {
255
- if ( is_int($this->subscribe2_options['entries']) ) {
256
- $subscriber_chunks = array_chunk($subscribers, $this->subscribe2_options['entries']);
257
- } else {
258
- $subscriber_chunks = array_chunk($subscribers, 25);
259
- }
260
- $chunk = $page - 1;
261
- $subscribers = $subscriber_chunks[$chunk];
262
- echo "<tr class=\"alternate\" style=\"height:1.5em;\">\r\n";
263
- echo "<td style=\"width: 4%; text-align: center;\">";
264
- echo "<img src=\"" . $urlpath . "include/accept.png\" alt=\"&lt;\" title=\"" . __('Confirm this email address', 'subscribe2') . "\" /></td>\r\n";
265
- echo "<td style=\"width: 4%; text-align: center;\">";
266
- echo "<img src=\"" . $urlpath . "include/exclamation.png\" alt=\"&gt;\" title=\"" . __('Unconfirm this email address', 'subscribe2') . "\" /></td>\r\n";
267
- echo "<td style=\"width: 4%; text-align: center;\">";
268
- echo "<img src=\"" . $urlpath . "include/cross.png\" alt=\"X\" title=\"" . __('Delete this email address', 'subscribe2') . "\" /></td><td colspan=\"3\"></td></tr>\r\n";
269
- echo "<tr class=\"\"><td style=\"text-align: center;\"><input type=\"checkbox\" name=\"checkall\" value=\"confirm_checkall\" /></td>\r\n";
270
- echo "<td style=\"text-align: center;\"><input type=\"checkbox\" name=\"checkall\" value=\"unconfirm_checkall\" /></td>\r\n";
271
- echo "<td style=\"text-align: center;\"><input type=\"checkbox\" name=\"checkall\" value=\"delete_checkall\" /></td>\r\n";
272
- echo "<td colspan =\"3\" style=\"text-align: left;\"><strong>" . __('Select / Unselect All', 'subscribe2') . "</strong></td></tr>\r\n";
273
-
274
- foreach ( $subscribers as $subscriber ) {
275
- echo "<tr class=\"$alternate\" style=\"height:1.5em;\">";
276
- echo "<td style=\"text-align: center;\">\r\n";
277
- if ( in_array($subscriber, $confirmed) ) {
278
- echo "</td><td style=\"text-align: center;\">\r\n";
279
- echo "<input class=\"unconfirm_checkall\" title=\"" . __('Unconfirm this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"unconfirm[]\" value=\"" . $subscriber . "\" /></td>\r\n";
280
- echo "<td style=\"text-align: center;\">\r\n";
281
- echo "<input class=\"delete_checkall\" title=\"" . __('Delete this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"delete[]\" value=\"" . $subscriber . "\" />\r\n";
282
- echo "</td>\r\n";
283
- echo "<td colspan=\"3\"><span style=\"color:#006600\">&#x221A;&nbsp;&nbsp;</span><abbr title=\"" . $this->signup_ip($subscriber) . "\"><a href=\"mailto:" . $subscriber . "\">" . $subscriber . "</a></abbr>\r\n";
284
- echo "(<span style=\"color:#006600\">" . $this->signup_date($subscriber) . "</span>)\r\n";
285
- } elseif ( in_array($subscriber, $unconfirmed) ) {
286
- echo "<input class=\"confirm_checkall\" title=\"" . __('Confirm this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"confirm[]\" value=\"" . $subscriber . "\" /></td>\r\n";
287
- echo "<td style=\"text-align: center;\"></td>\r\n";
288
- echo "<td style=\"text-align: center;\">\r\n";
289
- echo "<input class=\"delete_checkall\" title=\"" . __('Delete this email address', 'subscribe2') . "\" type=\"checkbox\" name=\"delete[]\" value=\"" . $subscriber . "\" />\r\n";
290
- echo "</td>\r\n";
291
- echo "<td colspan=\"3\"><span style=\"color:#FF0000\">&nbsp;!&nbsp;&nbsp;&nbsp;</span><abbr title=\"" . $this->signup_ip($subscriber) . "\"><a href=\"mailto:" . $subscriber . "\">" . $subscriber . "</a></abbr>\r\n";
292
- echo "(<span style=\"color:#FF0000\">" . $this->signup_date($subscriber) . "</span>)\r\n";
293
- } elseif ( in_array($subscriber, $all_users) ) {
294
- $user_info = get_user_by('email', $subscriber);
295
- echo "</td><td style=\"text-align: center;\"></td><td style=\"text-align: center;\"></td>\r\n";
296
- echo "<td colspan=\"3\"><span style=\"color:#006600\">&reg;&nbsp;&nbsp;</span><abbr title=\"" . $user_info->user_login . "\"><a href=\"mailto:" . $subscriber . "\">" . $subscriber . "</a></abbr>\r\n";
297
- echo "(<a href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=s2&amp;email=" . urlencode($subscriber) . "\">" . __('edit', 'subscribe2') . "</a>)\r\n";
298
- }
299
- echo "</td></tr>\r\n";
300
- ('alternate' == $alternate) ? $alternate = '' : $alternate = 'alternate';
301
- }
302
- } else {
303
- if ( $_POST['searchterm'] ) {
304
- echo "<tr><td colspan=\"6\" style=\"text-align: center;\"><b>" . __('No matching subscribers found', 'subscribe2') . "</b></td></tr>\r\n";
305
- } else {
306
- echo "<tr><td colspan=\"6\" style=\"text-align: center;\"><b>" . __('NONE', 'subscribe2') . "</b></td></tr>\r\n";
307
- }
308
- }
309
- if ( !empty($subscribers) ) {
310
- echo "<tr class=\"$alternate\"><td colspan=\"3\" style=\"text-align: center;\"><input type=\"submit\" class=\"button-secondary\" name=\"process\" value=\"" . __('Process', 'subscribe2') . "\" /></td>\r\n";
311
- echo "<td colspan=\"3\" style=\"text-align: right;\">" . $strip . "</td></tr>\r\n";
312
- }
313
- echo "</table>\r\n";
314
echo "</div>\r\n";
315
316
// show bulk managment form if filtered in some Registered Users
317
- if ( in_array($what, array('registered', 'all_users')) || is_numeric($what) ) {
318
echo "<div class=\"s2_admin\" id=\"s2_bulk_manage\">\r\n";
319
echo "<h2>" . __('Bulk Management', 'subscribe2') . "</h2>\r\n";
320
if ( $this->subscribe2_options['email_freq'] == 'never' ) {
@@ -348,4 +246,141 @@ echo "</form></div>\r\n";
348
include(ABSPATH . 'wp-admin/admin-footer.php');
349
// just to be sure
350
die;
351
?>
3
exit();
4
}
5
6
+ global $wpdb, $subscribers, $what, $current_tab;
7
8
// was anything POSTed ?
9
if ( isset($_POST['s2_admin']) ) {
10
+ check_admin_referer('bulk-subscribers');
11
if ( !empty($_POST['addresses']) ) {
12
$sub_error = '';
13
$unsub_error = '';
14
+ foreach ( preg_split("|[\s,]+|", $_POST['addresses']) as $email ) {
15
$email = $this->sanitize_email($email);
16
if ( is_email($email) && $_POST['subscribe'] ) {
17
if ( $this->is_public($email) !== false ) {
37
}
38
echo $message;
39
$_POST['what'] = 'confirmed';
40
+ } elseif ( $_POST['action'] === 'delete' || $_POST['action2'] === 'delete' ) {
41
+ foreach ( $_POST['subscriber'] as $address ) {
42
+ $this->delete($address);
43
}
44
+ echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Address(es) deleted!', 'subscribe2') . "</strong></p></div>";
45
+ } elseif ( $_POST['action'] === 'toggle' || $_POST['action2'] === 'toggle' ) {
46
+ global $current_user;
47
+ $this->ip = $current_user->user_login;
48
+ foreach ( $_POST['subscriber'] as $address ) {
49
+ $this->toggle($address);
50
}
51
+ echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Status changed!', 'subscribe2') . "</strong></p></div>";
52
} elseif ( isset($_POST['remind']) ) {
53
$this->remind($_POST['reminderemails']);
54
echo "<div id=\"message\" class=\"updated fade\"><p><strong>" . __('Reminder Email(s) Sent!', 'subscribe2') . "</strong></p></div>";
67
}
68
}
69
70
+ // detect or define which tab we are in
71
+ $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'public';
72
+ if ( $current_tab == 'registered' ) {
73
+ // Get Registered Subscribers
74
+ $registered = $this->get_registered();
75
+ $all_users = $this->get_all_registered();
76
+ // safety check for our arrays
77
+ if ( '' == $registered ) { $registered = array(); }
78
+ if ( '' == $all_users ) { $all_users = array(); }
79
} else {
80
+ //Get Public Subscribers
81
+ $confirmed = $this->get_public();
82
+ $unconfirmed = $this->get_public(0);
83
+ // safety check for our arrays
84
+ if ( '' == $confirmed ) { $confirmed = array(); }
85
+ if ( '' == $unconfirmed ) { $unconfirmed = array(); }
86
}
87
88
+ $reminderform = false;
89
+ if ( isset($_REQUEST['what']) ) {
90
+ if ( 'public' == $_REQUEST['what'] ) {
91
$what = 'public';
92
$subscribers = array_merge((array)$confirmed, (array)$unconfirmed);
93
+ } elseif ( 'confirmed' == $_REQUEST['what'] ) {
94
$what = 'confirmed';
95
$subscribers = $confirmed;
96
+ } elseif ( 'unconfirmed' == $_REQUEST['what'] ) {
97
$what = 'unconfirmed';
98
$subscribers = $unconfirmed;
99
if ( !empty($subscribers) ) {
100
$reminderemails = implode(",", $subscribers);
101
$reminderform = true;
102
}
103
+ } elseif ( is_numeric($_REQUEST['what']) ) {
104
+ $what = intval($_REQUEST['what']);
105
$subscribers = $this->get_registered("cats=$what");
106
+ } elseif ( 'registered' == $_REQUEST['what'] ) {
107
$what = 'registered';
108
$subscribers = $registered;
109
+ } elseif ( 'all_users' == $_REQUEST['what'] ) {
110
$what = 'all_users';
111
$subscribers = $all_users;
112
}
113
+ } else {
114
+ if ( $current_tab === 'public' ) {
115
$what = 'public';
116
$subscribers = array_merge((array)$confirmed, (array)$unconfirmed);
117
+ } else {
118
$what = 'all_users';
119
$subscribers = $all_users;
120
}
121
}
122
123
+ if ( !empty($_POST['s']) ) {
124
+ foreach ( $subscribers as $subscriber ) {
125
+ if ( is_numeric(stripos($subscriber, $_POST['s'])) ) {
126
+ $result[] = $subscriber;
127
}
128
}
129
+ $subscribers = $result;
130
+ }
131
+
132
+ if ( !class_exists('WP_List_Table') ){
133
+ require_once( ABSPATH . 'wp-admin/includes/class-wp-list-table.php' );
134
}
135
+ // Instantiate and prepare our table data - this also runs the bulk actions
136
+ $S2ListTable = new Subscribe2_List_Table();
137
+ $S2ListTable->prepare_items();
138
139
// show our form
140
echo "<div class=\"wrap\">";
141
echo "<div id=\"icon-tools\" class=\"icon32\"></div>";
142
+ $tabs = array('public' => 'Public Subscribers', 'registered' => 'Registered Subscribers');
143
+ echo "<h2 class=\"nav-tab-wrapper\">";
144
+ foreach ( $tabs as $tab_key => $tab_caption ) {
145
+ $active = ($current_tab == $tab_key) ? "nav-tab-active" : "";
146
+ echo "<a class=\"nav-tab " . $active . "\" href=\"?page=s2_tools&amp;tab=" . $tab_key . "\">" . $tab_caption . "</a>";
147
}
148
+ echo "</h2>";
149
+ echo "<form method=\"post\">\r\n";
150
echo "<input type=\"hidden\" name=\"s2_admin\" />\r\n";
151
+ switch ($current_tab) {
152
+ case 'public':
153
+ echo "<div class=\"s2_admin\" id=\"s2_add_subscribers\">\r\n";
154
+ echo "<h2>" . __('Add/Remove Subscribers', 'subscribe2') . "</h2>\r\n";
155
+ echo "<p>" . __('Enter addresses, one per line or comma-separated', 'subscribe2') . "<br />\r\n";
156
+ echo "<textarea rows=\"2\" cols=\"80\" name=\"addresses\"></textarea></p>\r\n";
157
+ echo "<input type=\"hidden\" name=\"s2_admin\" />\r\n";
158
+ echo "<p class=\"submit\" style=\"border-top: none;\"><input type=\"submit\" class=\"button-primary\" name=\"subscribe\" value=\"" . __('Subscribe', 'subscribe2') . "\" />";
159
+ echo "&nbsp;<input type=\"submit\" class=\"button-primary\" name=\"unsubscribe\" value=\"" . __('Unsubscribe', 'subscribe2') . "\" /></p>\r\n";
160
+ echo "</div>\r\n";
161
+
162
+ // subscriber lists
163
+ echo "<div class=\"s2_admin\" id=\"s2_current_subscribers\">\r\n";
164
+ echo "<h2>" . __('Current Subscribers', 'subscribe2') . "</h2>\r\n";
165
+ echo "<br />";
166
+ $cats = $this->all_cats();
167
+ $cat_ids = array();
168
+ foreach ( $cats as $cat) {
169
+ $cat_ids[] = $cat->term_id;
170
+ }
171
+ $exclude = array_merge(array('all', 'all_users', 'registered'), $cat_ids);
172
+ break;
173
+
174
+ case 'registered':
175
+ echo "<div class=\"s2_admin\" id=\"s2_add_subscribers\">\r\n";
176
+ echo "<h2>" . __('Add/Remove Subscribers', 'subscribe2') . "</h2>\r\n";
177
+ echo "<p class=\"submit\" style=\"border-top: none;\"><input type=\"submit\" class=\"button-primary\" name=\"add_user\" value=\"" . __('Add Registered User', 'subscribe2') . "\" formaction=\"" . admin_url() . "user-new.php\" /></p>\r\n";
178
+
179
+ echo "</div>\r\n";
180
+
181
+ // subscriber lists
182
+ echo "<div class=\"s2_admin\" id=\"s2_current_subscribers\">\r\n";
183
+ echo "<h2>" . __('Current Subscribers', 'subscribe2') . "</h2>\r\n";
184
+ echo "<br />";
185
+ $exclude = array('all', 'public', 'confirmed', 'unconfirmed');
186
+ break;
187
+ }
188
189
// show the selected subscribers
190
+ echo "<table style=\"width: 100%; border-collapse: separate; border-spacing: 0px; *border-collapse: expression('separate', cellSpacing = '0px');\"><tr>";
191
+ echo "<td style=\"width: 50%; text-align: left;\">";
192
+ $this->display_subscriber_dropdown($what, __('Filter', 'subscribe2'), $exclude);
193
+ echo "</td>\r\n";
194
if ( $reminderform ) {
195
echo "<td style=\"width: 25%; text-align: right;\"><input type=\"hidden\" name=\"reminderemails\" value=\"" . $reminderemails . "\" />\r\n";
196
echo "<input type=\"submit\" class=\"button-secondary\" name=\"remind\" value=\"" . __('Send Reminder Email', 'subscribe2') . "\" /></td>\r\n";
204
} else {
205
echo "<td style=\"width: 25%;\"></td>";
206
}
207
+ echo "</tr></table>";
208
209
+ // output our subscriber table
210
+ $S2ListTable->search_box(__('Search', 'subscribe2'), 'search_id');
211
+ $S2ListTable->display();
212
echo "</div>\r\n";
213
214
// show bulk managment form if filtered in some Registered Users
215
+ if ( $current_tab === 'registered' ) {
216
echo "<div class=\"s2_admin\" id=\"s2_bulk_manage\">\r\n";
217
echo "<h2>" . __('Bulk Management', 'subscribe2') . "</h2>\r\n";
218
if ( $this->subscribe2_options['email_freq'] == 'never' ) {
246
include(ABSPATH . 'wp-admin/admin-footer.php');
247
// just to be sure
248
die;
249
+
250
+ class Subscribe2_List_Table extends WP_List_Table {
251
+ function __construct(){
252
+ global $status, $page;
253
+
254
+ parent::__construct( array(
255
+ 'singular' => 'subscriber',
256
+ 'plural' => 'subscribers',
257
+ 'ajax' => false
258
+ ) );
259
+ }
260
+
261
+ function column_default($item, $column_name){
262
+ global $current_tab;
263
+ if ( $current_tab == 'registered' ) {
264
+ switch($column_name){
265
+ case 'email':
266
+ return $item[$column_name];
267
+ default:
268
+ return print_r($item,true);
269
+ }
270
+ } else {
271
+ switch($column_name){
272
+ case 'email':
273
+ case 'date':
274
+ return $item[$column_name];
275
+ default:
276
+ return print_r($item,true);
277
+ }
278
+ }
279
+ }
280
+
281
+ function column_email($item){
282
+ global $current_tab;
283
+ if ( $current_tab == 'registered' ) {
284
+ $actions = array('edit' => sprintf('<a href="?page=%s&amp;email=%s">Edit</a>', 's2', $item['email']));
285
+ return sprintf('%1$s %2$s', $item['email'], $this->row_actions($actions));
286
+ } else {
287
+ global $mysubscribe2;
288
+ if ( '0' === $mysubscribe2->is_public($item['email']) ) {
289
+ return sprintf('<span style="color:#FF0000">%1$s</span>', $item['email']);
290
+ } else {
291
+ return sprintf('%1$s', $item['email']);
292
+ }
293
+ }
294
+ }
295
+
296
+ function column_cb($item){
297
+ return sprintf('<input type="checkbox" name="%1$s[]" value="%2$s" />', $this->_args['singular'], $item['email']);
298
+ }
299
+
300
+ function get_columns(){
301
+ global $current_tab;
302
+ if ( $current_tab == 'registered' ) {
303
+ $columns = array('email' => 'Email');
304
+ } else {
305
+ $columns = array(
306
+ 'cb' => '<input type="checkbox" />',
307
+ 'email' => 'Email',
308
+ 'date' => 'Date'
309
+ );
310
+ }
311
+ return $columns;
312
+ }
313
+
314
+ function get_sortable_columns() {
315
+ global $current_tab;
316
+ if ( $current_tab == 'registered' ) {
317
+ $sortable_columns = array('email' => array('email', true));
318
+ } else {
319
+ $sortable_columns = array(
320
+ 'email' => array('email', true),
321
+ 'date' => array('date', false)
322
+ );
323
+ }
324
+ return $sortable_columns;
325
+ }
326
+
327
+ function get_bulk_actions() {
328
+ global $current_tab;
329
+ if ( $current_tab == 'registered' ) {
330
+ return array();
331
+ } else {
332
+ $actions = array(
333
+ 'delete' => __('Delete', 'subscribe2'),
334
+ 'toggle' => __('Toggle', 'subscribe2')
335
+ );
336
+ return $actions;
337
+ }
338
+ }
339
+
340
+ function prepare_items() {
341
+
342
+ global $mysubscribe2;
343
+ if ( is_int($mysubscribe2->subscribe2_options['entries']) ) {
344
+ $per_page = $mysubscribe2->subscribe2_options['entries'];
345
+ } else {
346
+ $per_page = 25;
347
+ }
348
+
349
+ $columns = $this->get_columns();
350
+ $hidden = array();
351
+ $sortable = $this->get_sortable_columns();
352
+ $this->_column_headers = array($columns, $hidden, $sortable);
353
+
354
+ global $mysubscribe2, $subscribers, $current_tab;
355
+ $data = array();
356
+ if ( $current_tab == 'public' ) {
357
+ foreach($subscribers as $email) {
358
+ $data[] = array('email' => $email, 'date' => $mysubscribe2->signup_date($email));
359
+ }
360
+ } else {
361
+ foreach($subscribers as $email) {
362
+ $data[] = array('email' => $email);
363
+ }
364
+ }
365
+
366
+ function usort_reorder($a,$b){
367
+ $orderby = (!empty($_REQUEST['orderby'])) ? $_REQUEST['orderby'] : 'email';
368
+ $order = (!empty($_REQUEST['order'])) ? $_REQUEST['order'] : 'asc';
369
+ $result = strcmp($a[$orderby], $b[$orderby]);
370
+ return ($order==='asc') ? $result : -$result;
371
+ }
372
+ usort($data, 'usort_reorder');
373
+
374
+ $current_page = $this->get_pagenum();
375
+ $total_items = count($data);
376
+ $data = array_slice($data,(($current_page-1)*$per_page),$per_page);
377
+ $this->items = $data;
378
+
379
+ $this->set_pagination_args( array(
380
+ 'total_items' => $total_items,
381
+ 'per_page' => $per_page,
382
+ 'total_pages' => ceil($total_items/$per_page)
383
+ ) );
384
+ }
385
+ }
386
?>
classes/class-s2-admin.php CHANGED
@@ -5,7 +5,7 @@ class s2_admin extends s2class {
5
Hook the menu
6
*/
7
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'), S2URL . 'include/email_edit.png');
11
add_action("admin_print_scripts-$s2user", array(&$this, 'checkbox_form_js'));
@@ -45,7 +45,7 @@ class s2_admin extends s2class {
45
} // end user_admin_css()
46
47
function option_form_js() {
48
- wp_register_script('s2_edit', S2URL . 'include/s2_edit' . $this->script_debug . '.js', array('jquery'), '1.0');
49
wp_enqueue_script('s2_edit');
50
} // end option_form_js()
51
@@ -230,16 +230,21 @@ class s2_admin extends s2class {
230
echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
231
} else {
232
echo "<label><input class=\"checkall_" . $name . "\" type=\"checkbox\" name=\"" . $name . "[]\" value=\"" . $cat->term_id . "\"";
233
- if ( in_array($cat->term_id, $selected) && !in_array($cat->term_id, $compulsory) ) {
234
echo " checked=\"checked\"";
235
}
236
- if ( in_array($cat->term_id, $compulsory) ) {
237
echo " checked=\"checked\" DISABLED";
238
}
239
echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
240
}
241
$i++;
242
}
243
echo "</td></tr>\r\n";
244
echo "</table>\r\n";
245
} // end display_category_form()
5
Hook the menu
6
*/
7
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'), S2URL . 'include/email_edit.png');
11
add_action("admin_print_scripts-$s2user", array(&$this, 'checkbox_form_js'));
45
} // end user_admin_css()
46
47
function option_form_js() {
48
+ wp_register_script('s2_edit', S2URL . 'include/s2_edit' . $this->script_debug . '.js', array('jquery'), '1.1');
49
wp_enqueue_script('s2_edit');
50
} // end option_form_js()
51
230
echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
231
} else {
232
echo "<label><input class=\"checkall_" . $name . "\" type=\"checkbox\" name=\"" . $name . "[]\" value=\"" . $cat->term_id . "\"";
233
+ if ( in_array($cat->term_id, $selected) || in_array($cat->term_id, $compulsory) ) {
234
echo " checked=\"checked\"";
235
}
236
+ if ( in_array($cat->term_id, $compulsory) && $name === 'category' ) {
237
echo " checked=\"checked\" DISABLED";
238
}
239
echo " /> <abbr title=\"" . $cat->slug . "\">" . $catName . "</abbr></label><br />\r\n";
240
}
241
$i++;
242
}
243
+ if ( !empty($compulsory) ) {
244
+ foreach ($compulsory as $cat) {
245
+ echo "<input type=\"hidden\" name=\"" . $name . "[]\" value=\"" . $cat . "\">\r\n";
246
+ }
247
+ }
248
echo "</td></tr>\r\n";
249
echo "</table>\r\n";
250
} // end display_category_form()
classes/class-s2-core.php CHANGED
@@ -1,6 +1,15 @@
1
<?php
2
class s2class {
3
// variables and constructor are declared at the end
4
/**
5
Load all our strings
6
*/
@@ -11,8 +20,9 @@ class s2class {
11
12
$this->profile = "<p class=\"s2_message\">" . __('You may manage your subscription options from your', 'subscribe2') . " <a href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=s2\">" . __('profile', 'subscribe2') . "</a>.</p>";
13
if ( $this->s2_mu === true ) {
14
- global $blog_id, $user_ID;
15
- if ( !is_blog_user($blog_id) ) {
16
// if we are on multisite and the user is not a member of this blog change the link
17
$this->profile = "<p class=\"s2_message\"><a href=\"" . get_option('siteurl') . "/wp-admin/?s2mu_subscribe=" . $blog_id . "\">" . __('Subscribe', 'subscribe2') . "</a> " . __('to email notifications when this blog posts new content', 'subscribe2') . ".</p>";
18
}
@@ -92,6 +102,9 @@ class s2class {
92
maybe_add_column($this->public, 'date', "ALTER TABLE $this->public ADD date DATE DEFAULT '$date' NOT NULL AFTER active");
93
maybe_add_column($this->public, 'ip', "ALTER TABLE $this->public ADD ip char(64) DEFAULT 'admin' NOT NULL AFTER date");
94
maybe_add_column($this->public, 'time', "ALTER TABLE $this->public ADD time TIME DEFAULT '00:00:00' NOT NULL AFTER date");
95
96
// let's take the time to check process registered users
97
// existing public subscribers are subscribed to all categories
@@ -219,8 +232,7 @@ class s2class {
219
}
220
221
// update postmeta field to a protected name, from version 8.5
222
- $sql = $wpdb->prepare( "UPDATE $wpdb->postmeta SET meta_key = '_s2mail' WHERE meta_key = 's2mail'");
223
- $wpdb->query($sql);
224
225
return;
226
} // end upgrade()
@@ -251,7 +263,7 @@ class s2class {
251
$string = str_replace("{PERMALINK}", $link, $string);
252
if ( strstr($string, "{TINYLINK}") ) {
253
$tinylink = file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode($this->get_tracking_link($this->permalink)));
254
- if ( $tinylink !== 'Error' || $tinylink != false ) {
255
$tlink = "<a href=\"" . $tinylink . "\">" . $tinylink . "</a>";
256
$string = str_replace("{TINYLINK}", $tlink, $string);
257
} else {
@@ -292,7 +304,7 @@ class s2class {
292
}
293
294
// Replace any escaped html symbols in subject then apply filter
295
- $subject = html_entity_decode($subject, ENT_QUOTES);
296
$subject = apply_filters('s2_email_subject', $subject);
297
298
// Construct BCC headers for sending or send individual emails
@@ -511,7 +523,7 @@ class s2class {
511
$public = $this->get_public();
512
}
513
if ( $post->post_type == 'page' ) {
514
- $post_cats_string = get_all_category_ids();
515
} else {
516
$post_cats_string = implode(',', $post_cats);
517
}
@@ -531,8 +543,8 @@ class s2class {
531
// passing them in function calls a little later
532
$this->post_title = "<a href=\"" . get_permalink($post->ID) . "\">" . html_entity_decode($post->post_title, ENT_QUOTES) . "</a>";
533
$this->permalink = get_permalink($post->ID);
534
- $this->post_date = get_the_time(get_option('date_format'));
535
- $this->post_time = get_the_time();
536
537
$author = get_userdata($post->post_author);
538
$this->authorname = html_entity_decode(apply_filters('the_author', $author->display_name), ENT_QUOTES);
@@ -827,9 +839,9 @@ class s2class {
827
if ( false === $status ) { return false; }
828
829
if ( '0' == $status ) {
830
- $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET active='1' WHERE CAST(email as binary)=%s", $email));
831
} else {
832
- $wpdb->get_results($wpdb->prepare("UPDATE $this->public SET active='0' WHERE CAST(email as binary)=%s", $email));
833
}
834
} // end toggle()
835
@@ -973,11 +985,6 @@ class s2class {
973
function get_registered($args = '') {
974
global $wpdb;
975
976
- $format = '';
977
- $cats = '';
978
- $authors = '';
979
- $subscribers = array();
980
-
981
parse_str($args, $r);
982
if ( !isset($r['format']) )
983
$r['format'] = 'all';
@@ -1539,10 +1546,20 @@ class s2class {
1539
$message_post .= "\r\n";
1540
$message_posttime .= "\r\n";
1541
1542
- $tablelinks .= "\r\n" . $this->get_tracking_link(get_permalink($post->ID)) . "\r\n";
1543
- $message_post .= $this->get_tracking_link(get_permalink($post->ID)) . "\r\n";
1544
$message_posttime .= __('Posted on', 'subscribe2') . ": " . mysql2date($datetime, $post->post_date) . "\r\n";
1545
- $message_posttime .= $this->get_tracking_link(get_permalink($post->ID)) . "\r\n";
1546
if ( strstr($mailtext, "{CATS}") ) {
1547
$post_cat_names = implode(', ', wp_get_object_terms($post->ID, $s2_taxonomies, array('fields' => 'names')));
1548
$message_post .= __('Posted in', 'subscribe2') . ": " . $post_cat_names . "\r\n";
@@ -1654,8 +1671,6 @@ class s2class {
1654
$tmp = explode('-', $wp_version, 2);
1655
$this->wp_release = $tmp[0];
1656
1657
- load_plugin_textdomain('subscribe2', false, S2DIR);
1658
-
1659
// Is this WordPressMU or not?
1660
if ( isset($wpmu_version) || strpos($wp_version, 'wordpress-mu') ) {
1661
$this->s2_mu = true;
@@ -1666,7 +1681,7 @@ class s2class {
1666
1667
// add action to handle WPMU subscriptions and unsubscriptions
1668
if ( $this->s2_mu === true ) {
1669
- require_once(S2PATH . "classes/class-s2_multisite.php");
1670
global $s2class_multisite;
1671
$s2class_multisite = new s2_multisite;
1672
if ( isset($_GET['s2mu_subscribe']) || isset($_GET['s2mu_unsubscribe']) ) {
@@ -1674,7 +1689,8 @@ class s2class {
1674
}
1675
}
1676
1677
- // load our strings
1678
add_action('init', array(&$this, 'load_strings'));
1679
1680
// do we need to install anything?
@@ -1798,7 +1814,7 @@ class s2class {
1798
// add actions for ajax form if enabled
1799
if ( '1' == $this->subscribe2_options['ajax'] ) {
1800
add_action('wp_enqueue_scripts', array(&$this, 'add_ajax'));
1801
- add_action('wp_head', array(&$this, 'add_s2_ajax'));
1802
}
1803
}
1804
} // end s2init()
1
<?php
2
class s2class {
3
// variables and constructor are declared at the end
4
+ /**
5
+ Load translations
6
+ */
7
+ function load_translations() {
8
+ load_plugin_textdomain('subscribe2', false, S2DIR);
9
+ load_plugin_textdomain('subscribe2', false, S2DIR . "languages/");
10
+ load_plugin_textdomain('subscribe2', false, WP_LANG_DIR . "/");
11
+ } // end load_translations()
12
+
13
/**
14
Load all our strings
15
*/
20
21
$this->profile = "<p class=\"s2_message\">" . __('You may manage your subscription options from your', 'subscribe2') . " <a href=\"" . get_option('siteurl') . "/wp-admin/admin.php?page=s2\">" . __('profile', 'subscribe2') . "</a>.</p>";
22
if ( $this->s2_mu === true ) {
23
+ global $blog_id;
24
+ $user_ID = get_current_user_id();
25
+ if ( !is_user_member_of_blog($user_ID, $blog_id) ) {
26
// if we are on multisite and the user is not a member of this blog change the link
27
$this->profile = "<p class=\"s2_message\"><a href=\"" . get_option('siteurl') . "/wp-admin/?s2mu_subscribe=" . $blog_id . "\">" . __('Subscribe', 'subscribe2') . "</a> " . __('to email notifications when this blog posts new content', 'subscribe2') . ".</p>";
28
}
102
maybe_add_column($this->public, 'date', "ALTER TABLE $this->public ADD date DATE DEFAULT '$date' NOT NULL AFTER active");
103
maybe_add_column($this->public, 'ip', "ALTER TABLE $this->public ADD ip char(64) DEFAULT 'admin' NOT NULL AFTER date");
104
maybe_add_column($this->public, 'time', "ALTER TABLE $this->public ADD time TIME DEFAULT '00:00:00' NOT NULL AFTER date");
105
+ maybe_add_column($this->public, 'conf_date', "ALTER TABLE $this->public ADD conf_date DATE AFTER ip");
106
+ maybe_add_column($this->public, 'conf_time', "ALTER TABLE $this->public ADD conf_time TIME AFTER conf_date");
107
+ maybe_add_column($this->public, 'conf_ip', "ALTER TABLE $this->public ADD conf_ip char(64) AFTER conf_time");
108
109
// let's take the time to check process registered users
110
// existing public subscribers are subscribed to all categories
232
}
233
234
// update postmeta field to a protected name, from version 8.5
235
+ $wpdb->query( "UPDATE $wpdb->postmeta SET meta_key = '_s2mail' WHERE meta_key = 's2mail'" );
236
237
return;
238
} // end upgrade()
263
$string = str_replace("{PERMALINK}", $link, $string);
264
if ( strstr($string, "{TINYLINK}") ) {
265
$tinylink = file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode($this->get_tracking_link($this->permalink)));
266
+ if ( $tinylink !== 'Error' && $tinylink != false ) {
267
$tlink = "<a href=\"" . $tinylink . "\">" . $tinylink . "</a>";
268
$string = str_replace("{TINYLINK}", $tlink, $string);
269
} else {
304
}
305
306
// Replace any escaped html symbols in subject then apply filter
307
+ $subject = strip_tags(html_entity_decode($subject, ENT_QUOTES));
308
$subject = apply_filters('s2_email_subject', $subject);
309
310
// Construct BCC headers for sending or send individual emails
523
$public = $this->get_public();
524
}
525
if ( $post->post_type == 'page' ) {
526
+ $post_cats_string = implode(',', get_all_category_ids());
527
} else {
528
$post_cats_string = implode(',', $post_cats);
529
}
543
// passing them in function calls a little later
544
$this->post_title = "<a href=\"" . get_permalink($post->ID) . "\">" . html_entity_decode($post->post_title, ENT_QUOTES) . "</a>";
545
$this->permalink = get_permalink($post->ID);
546
+ $this->post_date = get_the_time(get_option('date_format'), $post);
547
+ $this->post_time = get_the_time('', $post);
548
549
$author = get_userdata($post->post_author);
550
$this->authorname = html_entity_decode(apply_filters('the_author', $author->display_name), ENT_QUOTES);
839
if ( false === $status ) { return false; }
840
841
if ( '0' == $status ) {
842
+ $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));
843
} else {
844
+ $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));
845
}
846
} // end toggle()
847
985
function get_registered($args = '') {
986
global $wpdb;
987
988
parse_str($args, $r);
989
if ( !isset($r['format']) )
990
$r['format'] = 'all';
1546
$message_post .= "\r\n";
1547
$message_posttime .= "\r\n";
1548
1549
$message_posttime .= __('Posted on', 'subscribe2') . ": " . mysql2date($datetime, $post->post_date) . "\r\n";
1550
+ if ( strstr($mailtext, "{TINYLINK}") ) {
1551
+ $tinylink = file_get_contents('http://tinyurl.com/api-create.php?url=' . urlencode($this->get_tracking_link(get_permalink($post->ID))));
1552
+ if ( $tinylink !== 'Error' && $tinylink !== false ) {
1553
+ $tablelinks .= "\r\n" . $tinylink . "\r\n";
1554
+ $message_post .= $tinylink . "\r\n";
1555
+ $message_posttime .= $tinylink . "\r\n";
1556
+ } else {
1557
+ $tablelinks .= "\r\n" . $this->get_tracking_link(get_permalink($post->ID)) . "\r\n";
1558
+ $message_post .= $this->get_tracking_link(get_permalink($post->ID)) . "\r\n";
1559
+ $message_posttime .= $this->get_tracking_link(get_permalink($post->ID)) . "\r\n";
1560
+ }
1561
+ }
1562
+
1563
if ( strstr($mailtext, "{CATS}") ) {
1564
$post_cat_names = implode(', ', wp_get_object_terms($post->ID, $s2_taxonomies, array('fields' => 'names')));
1565
$message_post .= __('Posted in', 'subscribe2') . ": " . $post_cat_names . "\r\n";
1671
$tmp = explode('-', $wp_version, 2);
1672
$this->wp_release = $tmp[0];
1673
1674
// Is this WordPressMU or not?
1675
if ( isset($wpmu_version) || strpos($wp_version, 'wordpress-mu') ) {
1676
$this->s2_mu = true;
1681
1682
// add action to handle WPMU subscriptions and unsubscriptions
1683
if ( $this->s2_mu === true ) {
1684
+ require_once(S2PATH . "classes/class-s2-multisite.php");
1685
global $s2class_multisite;
1686
$s2class_multisite = new s2_multisite;
1687
if ( isset($_GET['s2mu_subscribe']) || isset($_GET['s2mu_unsubscribe']) ) {
1689
}
1690
}
1691
1692
+ // load our translations and strings
1693
+ add_action('init', array(&$this, 'load_translations'), 5);
1694
add_action('init', array(&$this, 'load_strings'));
1695
1696
// do we need to install anything?
1814
// add actions for ajax form if enabled
1815
if ( '1' == $this->subscribe2_options['ajax'] ) {
1816
add_action('wp_enqueue_scripts', array(&$this, 'add_ajax'));
1817
+ add_action('wp_footer', array(&$this, 'add_s2_ajax'));
1818
}
1819
}
1820
} // end s2init()
classes/class-s2-frontend.php CHANGED
@@ -6,7 +6,7 @@ class s2_frontend extends s2class {
6
*/
7
function shortcode($atts) {
8
extract(shortcode_atts(array(
9
- 'hide' => '',
10
'id' => '',
11
'url' => '',
12
'nojs' => 'false',
@@ -16,7 +16,8 @@ class s2_frontend extends s2class {
16
17
// if link is true return a link to the page with the ajax class
18
if ( $link !== '' && !is_user_logged_in() ) {
19
- $this->s2form = "<a href=\"" . get_permalink($this->subscribe2_options['s2page']) . "\" class=\"s2popup\">" . $link . "</a>\r\n";
20
return $this->s2form;
21
}
22
@@ -57,7 +58,7 @@ class s2_frontend extends s2class {
57
if ( $nojs == 'true' ) {
58
$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>";
59
} else {
60
- $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 == '" . __('Enter email address...', 'subscribe2') . "') {this.value = '';}\" onblur=\"if (this.value == '') {this.value = '" . __('Enter email address...', 'subscribe2') . "';}\" /></p><p>" . $this->input_form_action . "</p></form>\r\n";
61
}
62
$this->s2form = $this->form;
63
@@ -267,7 +268,7 @@ class s2_frontend extends s2class {
267
function add_ajax() {
268
// enqueue the jQuery script we need and let WordPress handle the dependencies
269
wp_enqueue_script('jquery-ui-dialog');
270
- wp_register_style('jquery-ui-style', apply_filters('s2_jqueryui_css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.16/themes/ui-darkness/jquery-ui.css'));
271
wp_enqueue_style('jquery-ui-style');
272
} // end add_ajax()
273
@@ -278,12 +279,18 @@ class s2_frontend extends s2class {
278
echo "<script type=\"text/javascript\">\r\n";
279
echo "//<![CDATA[\r\n";
280
echo "jQuery(document).ready(function() {\r\n";
281
- echo " var dialog = jQuery('<div></div>')\r\n";
282
- echo " .html('" . do_shortcode('[subscribe2 nojs="true"]') . "')\r\n";
283
if ( $this->s2form != $this->form && !is_user_logged_in() ) {
284
- echo " .dialog({modal: true, zIndex: 10000, title: '" . __('Subscribe to this blog', 'subscribe2') . "'});\r\n";
285
} else {
286
- echo " .dialog({autoOpen: false, modal: true, zIndex: 10000, title: '" . __('Subscribe to this blog', 'subscribe2') . "'});\r\n";
287
}
288
echo " jQuery('a.s2popup').click(function(){\r\n";
289
echo " dialog.dialog('open');\r\n";
6
*/
7
function shortcode($atts) {
8
extract(shortcode_atts(array(
9
+ 'hide' => strtolower(''),
10
'id' => '',
11
'url' => '',
12
'nojs' => 'false',
16
17
// if link is true return a link to the page with the ajax class
18
if ( $link !== '' && !is_user_logged_in() ) {
19
+ $hide_id = ($hide === '') ? "": " id=\"" . $hide . "\"";
20
+ $this->s2form = "<a href=\"" . get_permalink($this->subscribe2_options['s2page']) . "\" class=\"s2popup\"" . $hide_id . ">" . $link . "</a>\r\n";
21
return $this->s2form;
22
}
23
58
if ( $nojs == 'true' ) {
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 . "\" /></p><p>" . $this->input_form_action . "</p></form>";
60
} else {
61
+ $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";
62
}
63
$this->s2form = $this->form;
64
268
function add_ajax() {
269
// enqueue the jQuery script we need and let WordPress handle the dependencies
270
wp_enqueue_script('jquery-ui-dialog');
271
+ wp_register_style('jquery-ui-style', apply_filters('s2_jqueryui_css', 'http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.23/themes/ui-darkness/jquery-ui.css'));
272
wp_enqueue_style('jquery-ui-style');
273
} // end add_ajax()
274
279
echo "<script type=\"text/javascript\">\r\n";
280
echo "//<![CDATA[\r\n";
281
echo "jQuery(document).ready(function() {\r\n";
282
+ echo " var dialog = jQuery('<div></div>');\r\n";
283
+ echo " if (jQuery('a.s2popup').attr('id') === 'unsubscribe') {\r\n";
284
+ echo " dialog.html('" . do_shortcode('[subscribe2 nojs="true" hide="unsubscribe"]') . "');\r\n";
285
+ echo " } else if (jQuery('a.s2popup').attr('id') === 'subscribe') {\r\n";
286
+ echo " dialog.html('" . do_shortcode('[subscribe2 nojs="true" hide="subscribe"]') . "');\r\n";
287
+ echo " } else {\r\n";
288
+ echo " dialog.html('" . do_shortcode('[subscribe2 nojs="true"]') . "');\r\n";
289
+ echo " }\r\n";
290
if ( $this->s2form != $this->form && !is_user_logged_in() ) {
291
+ echo " dialog.dialog({modal: true, zIndex: 10000, title: '" . __('Subscribe to this blog', 'subscribe2') . "'});\r\n";
292
} else {
293
+ echo " dialog.dialog({autoOpen: false, modal: true, zIndex: 10000, title: '" . __('Subscribe to this blog', 'subscribe2') . "'});\r\n";
294
}
295
echo " jQuery('a.s2popup').click(function(){\r\n";
296
echo " dialog.dialog('open');\r\n";
classes/{class-s2_multisite.php → class-s2-multisite.php} RENAMED
@@ -15,7 +15,7 @@ class s2_multisite {
15
$user_ID = get_current_user_id();
16
17
// if user is not a user of the current blog
18
- if ( !is_blog_user($sub_id) ) {
19
// add user to current blog as subscriber
20
add_user_to_blog($sub_id, $user_ID, 'subscriber');
21
// add an action hook for external manipulation of blog and user data
15
$user_ID = get_current_user_id();
16
17
// if user is not a user of the current blog
18
+ if ( !is_user_member_of_blog($user_ID, $sub_id) ) {
19
// add user to current blog as subscriber
20
add_user_to_blog($sub_id, $user_ID, 'subscriber');
21
// add an action hook for external manipulation of blog and user data
include/accept.png DELETED
Binary file
include/cross.png DELETED
Binary file
include/exclamation.png DELETED
Binary file
include/options.php CHANGED
@@ -38,7 +38,7 @@ if (!isset($this->subscribe2_options['one_click_profile'])) {
38
$this->subscribe2_options['one_click_profile'] = "no";
39
} // option for displaying 'one-click' option on profile page
40
41
- if(!isset($this->subscribe2_options['bcclimit'])) {
42
$this->subscribe2_options['bcclimit'] = 1;
43
} // option for default bcc limit on email notifications
44
@@ -50,7 +50,7 @@ if (!isset($this->subscribe2_options['tracking'])) {
50
$this->subscribe2_options['tracking'] = "";
51
} // option for tracking
52
53
- if(!isset($this->subscribe2_options['s2page'])) {
54
$this->subscribe2_options['s2page'] = 0;
55
} // option for default WordPress page for Subscribe2 to use
56
@@ -98,7 +98,7 @@ if (!isset($this->subscribe2_options['reg_override'])) {
98
$this->subscribe2_options['reg_override'] = "1";
99
} // option for excluded categories to be overriden for registered users
100
101
- if(!isset($this->subscribe2_options['show_meta'])) {
102
$this->subscribe2_options['show_meta'] = "0";
103
} // option to display link to subscribe2 page from 'meta'
104
@@ -118,7 +118,7 @@ if (!isset($this->subscribe2_options['counterwidget'])) {
118
$this->subscribe2_options['counterwidget'] = "0";
119
} // option to enable Subscribe2 Counter Widget
120
121
- if(!isset($this->subscribe2_options['s2meta_default'])) {
122
$this->subscribe2_options['s2meta_default'] = "0";
123
} // option for Subscribe2 over ride postmeta to be checked by default
124
38
$this->subscribe2_options['one_click_profile'] = "no";
39
} // option for displaying 'one-click' option on profile page
40
41
+ if (!isset($this->subscribe2_options['bcclimit'])) {
42
$this->subscribe2_options['bcclimit'] = 1;
43
} // option for default bcc limit on email notifications
44
50
$this->subscribe2_options['tracking'] = "";
51
} // option for tracking
52
53
+ if (!isset($this->subscribe2_options['s2page'])) {
54
$this->subscribe2_options['s2page'] = 0;
55
} // option for default WordPress page for Subscribe2 to use
56
98
$this->subscribe2_options['reg_override'] = "1";
99
} // option for excluded categories to be overriden for registered users
100
101
+ if (!isset($this->subscribe2_options['show_meta'])) {
102
$this->subscribe2_options['show_meta'] = "0";
103
} // option to display link to subscribe2 page from 'meta'
104
118
$this->subscribe2_options['counterwidget'] = "0";
119
} // option to enable Subscribe2 Counter Widget
120
121
+ if (!isset($this->subscribe2_options['s2meta_default'])) {
122
$this->subscribe2_options['s2meta_default'] = "0";
123
} // option for Subscribe2 over ride postmeta to be checked by default
124
include/s2_edit.js CHANGED
@@ -1,8 +1,8 @@
1
// Version 1.0 - original version
2
jQuery(document).ready(function () {
3
// hide our span before page loads
4
- jQuery('#s2bcc_2').hide();
5
- jQuery('#s2page_2').hide();
6
jQuery('#s2entries_2').hide();
7
});
8
1
// Version 1.0 - original version
2
+ // Version 1.1 - updated for Subscribe2 8.6
3
jQuery(document).ready(function () {
4
// hide our span before page loads
5
+ jQuery('#s2bcclimit_2').hide();
6
jQuery('#s2entries_2').hide();
7
});
8
include/s2_edit.min.js CHANGED
@@ -1 +1 @@
1
- jQuery(document).ready(function(){jQuery('#s2bcc_2').hide();jQuery('#s2page_2').hide();jQuery('#s2entries_2').hide()});function s2_show(id){jQuery('#s2'+id+'_2').show();jQuery('#s2'+id+'_1').hide();return false}function s2_hide(id){jQuery('#s2'+id+'_1').show();jQuery('#s2'+id+'_2').hide();return false}function s2_update(id){var input=jQuery('input[name="'+id+'"]').val();jQuery('input[name="'+id+'"]').val(input);jQuery('#s2'+id).html(input);s2_hide(id)}function s2_revert(id){var option=jQuery('#js'+id).val();jQuery('input[name="'+id+'"]').val(option);jQuery('#s2'+id).html(option);s2_hide(id)}