Subscribe2 - Version 10.32

Version Description

Download this release

Release Info

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

Code changes from version 10.31 to 10.32

ChangeLog.txt CHANGED
@@ -1,3 +1,19 @@
1
= 10.31 =
2
3
* Enhance DNS check when validating email addresses
@@ -5,9 +21,9 @@
5
* Validate emails fully when making database changes, but simpler and faster checks when sending notifications
6
* Better escaping of subscriber email data when reporting errors to Subscribers page
7
* Fix some Coding Standards Issues
8
-
9
- = 10.30.1 =
10
-
11
* Clean unused global variables
12
* Implemented compatibility with Fusion Builder
13
* Fix error caused by menu registration in WordPress 5.3
1
+ = 10.32 =
2
+
3
+ * Bump minimum required WordPress to 4.4
4
+ * Apply fix for poor list layout in plaintext emails when using Block Editor - thank to @eightize
5
+ * Introduce 's2_plaintext' filter to allow plaintext to be filtered before tags are stripped to correct for layout needs
6
+ * Show join date for Registered Subscribers with data from WordPress table
7
+ * Fix email templates to preserve line spacing on new installs and resets
8
+ * Send Digest Preview emails from editing pages if Subscribe2 HTML is in Digest email mode
9
+ * Fix typo error in default options file
10
+ * Improve Help tab for Excluded categories - thanks to @iwaddo
11
+ * Convert some self closing HTML tags to HTML5
12
+ * Escape plugin output for better security
13
+ * Don't capitalise Custom Post Type names registered via the API when displayed back to admins
14
+ * Remove MailOptin from this fork
15
+ * Fix for JavaScript IP updater setting not saving when unchecked
16
+
17
= 10.31 =
18
19
* Enhance DNS check when validating email addresses
21
* Validate emails fully when making database changes, but simpler and faster checks when sending notifications
22
* Better escaping of subscriber email data when reporting errors to Subscribers page
23
* Fix some Coding Standards Issues
24
+ * Correct maximum execution time limit to 5 minutes
25
+ * Fix some new Coding Standards errors and warnings
26
+ * Applied coding standards to MO Notice class
27
* Clean unused global variables
28
* Implemented compatibility with Fusion Builder
29
* Fix error caused by menu registration in WordPress 5.3
ReadMe.txt CHANGED
@@ -3,7 +3,7 @@ Contributors: collizo4sky
3
Donate link: https://mailoptin.io
4
Tags: posts, subscription, email, subscribe, notify, notification, newsletter, post notification, email marketing, optin, form
5
Requires at least: 4.0
6
- Tested up to: 5.2
7
License: GPLv3
8
9
Sends a list of subscribers an email notification when you publish new posts.
3
Donate link: https://mailoptin.io
4
Tags: posts, subscription, email, subscribe, notify, notification, newsletter, post notification, email marketing, optin, form
5
Requires at least: 4.0
6
+ Tested up to: 5.3
7
License: GPLv3
8
9
Sends a list of subscribers an email notification when you publish new posts.
admin/send-email.php CHANGED
@@ -8,7 +8,7 @@ global $current_user;
8
// was anything POSTed?
9
if ( isset( $_POST['s2_admin'] ) && 'mail' === $_POST['s2_admin'] ) {
10
if ( false === wp_verify_nonce( $_REQUEST['_wpnonce'], 'subscribe2-write_subscribers' . S2VERSION ) ) {
11
- die( '<p>' . __( 'Security error! Your request cannot be completed.', 'subscribe2' ) . '</p>' );
12
}
13
14
$subject = html_entity_decode( stripslashes( wp_kses( $this->substitute( $_POST['subject'] ), '' ) ), ENT_QUOTES );
@@ -97,12 +97,12 @@ if ( isset( $_POST['s2_admin'] ) && 'mail' === $_POST['s2_admin'] ) {
97
global $phpmailer;
98
$message = '<p class="s2_error">' . __( 'Message failed!', 'subscribe2' ) . '</p>' . $error_message . $phpmailer->ErrorInfo;
99
}
100
- echo '<div id="message" class="updated"><strong><p>' . $message . '</p></strong></div>' . "\r\n";
101
}
102
103
// show our form
104
echo '<div class="wrap">';
105
- echo '<h1>' . __( 'Send an email to subscribers', 'subscribe2' ) . '</h1>' . "\r\n";
106
echo '<form method="post" enctype="multipart/form-data">' . "\r\n";
107
108
wp_nonce_field( 'subscribe2-write_subscribers' . S2VERSION );
@@ -115,15 +115,15 @@ if ( isset( $_POST['subject'] ) ) {
115
if ( ! isset( $_POST['content'] ) ) {
116
$body = '';
117
}
118
- echo '<p>' . __( 'Subject', 'subscribe2' ) . ': <input type="text" size="69" name="subject" value="' . $subject . '" /> <br /><br />';
119
- echo '<textarea rows="12" cols="75" name="content">' . $body . '</textarea>';
120
- echo "<br /><div id=\"upload_files\"><input type=\"file\" name=\"file[]\"></div>\r\n";
121
- echo '<input type="button" class="button-secondary" name="addmore" value="' . __( 'Add More Files', 'subscribe2' ) . "\" onClick=\"add_file_upload();\" />\r\n";
122
- echo "<br /><br />\r\n";
123
- echo __( 'Recipients:', 'subscribe2' ) . ' ';
124
$this->display_subscriber_dropdown( apply_filters( 's2_subscriber_dropdown_default', 'registered' ), false );
125
echo '<input type="hidden" name="s2_admin" value="mail" />';
126
- 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>';
127
echo '</form></div>' . "\r\n";
128
echo '<div style="clear: both;"><p>&nbsp;</p></div>';
129
?>
8
// was anything POSTed?
9
if ( isset( $_POST['s2_admin'] ) && 'mail' === $_POST['s2_admin'] ) {
10
if ( false === wp_verify_nonce( $_REQUEST['_wpnonce'], 'subscribe2-write_subscribers' . S2VERSION ) ) {
11
+ die( '<p>' . esc_html__( 'Security error! Your request cannot be completed.', 'subscribe2' ) . '</p>' );
12
}
13
14
$subject = html_entity_decode( stripslashes( wp_kses( $this->substitute( $_POST['subject'] ), '' ) ), ENT_QUOTES );
97
global $phpmailer;
98
$message = '<p class="s2_error">' . __( 'Message failed!', 'subscribe2' ) . '</p>' . $error_message . $phpmailer->ErrorInfo;
99
}
100
+ echo '<div id="message" class="updated"><strong><p>' . wp_kses_post( $message ) . '</p></strong></div>' . "\r\n";
101
}
102
103
// show our form
104
echo '<div class="wrap">';
105
+ echo '<h1>' . esc_html__( 'Send an email to subscribers', 'subscribe2' ) . '</h1>' . "\r\n";
106
echo '<form method="post" enctype="multipart/form-data">' . "\r\n";
107
108
wp_nonce_field( 'subscribe2-write_subscribers' . S2VERSION );
115
if ( ! isset( $_POST['content'] ) ) {
116
$body = '';
117
}
118
+ echo '<p>' . esc_html__( 'Subject', 'subscribe2' ) . ': <input type="text" size="69" name="subject" value="' . esc_attr( $subject ) . '" /> <br><br>';
119
+ echo '<textarea rows="12" cols="75" name="content">' . esc_textarea( $body ) . '</textarea>';
120
+ echo "<br><div id=\"upload_files\"><input type=\"file\" name=\"file[]\"></div>\r\n";
121
+ echo '<input type="button" class="button-secondary" name="addmore" value="' . esc_attr( __( 'Add More Files', 'subscribe2' ) ) . "\" onClick=\"add_file_upload();\" />\r\n";
122
+ echo "<br><br>\r\n";
123
+ echo esc_html__( 'Recipients:', 'subscribe2' ) . ' ';
124
$this->display_subscriber_dropdown( apply_filters( 's2_subscriber_dropdown_default', 'registered' ), false );
125
echo '<input type="hidden" name="s2_admin" value="mail" />';
126
+ echo '<p class="submit"><input type="submit" class="button-secondary" name="preview" value="' . esc_attr( __( 'Preview', 'subscribe2' ) ) . '" />&nbsp;<input type="submit" class="button-primary" name="send" value="' . esc_attr( __( 'Send', 'subscribe2' ) ) . '" /></p>';
127
echo '</form></div>' . "\r\n";
128
echo '<div style="clear: both;"><p>&nbsp;</p></div>';
129
?>
admin/settings.php CHANGED
@@ -8,7 +8,7 @@ global $wpdb, $current_tab;
8
// was anything POSTed?
9
if ( isset( $_POST['s2_admin'] ) ) {
10
if ( false === wp_verify_nonce( $_REQUEST['_wpnonce'], 'subscribe2-options_subscribers' . S2VERSION ) ) {
11
- die( '<p>' . __( 'Security error! Your request cannot be completed.', 'subscribe2' ) . '</p>' );
12
}
13
14
if ( isset( $_POST['reset'] ) ) {
@@ -16,7 +16,7 @@ if ( isset( $_POST['s2_admin'] ) ) {
16
global $s2_upgrade;
17
$s2_upgrade = new S2_Upgrade();
18
$s2_upgrade->reset();
19
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'Options reset!', 'subscribe2' ) . '</strong></p></div>';
20
} elseif ( isset( $_POST['preview'] ) ) {
21
global $user_email, $post;
22
$this->preview_email = true;
@@ -27,14 +27,14 @@ if ( isset( $_POST['s2_admin'] ) ) {
27
} else {
28
do_action( 's2_digest_preview', $user_email );
29
}
30
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'Preview message(s) sent to logged in user', 'subscribe2' ) . '</strong></p></div>';
31
} elseif ( isset( $_POST['resend'] ) ) {
32
$stickies = get_option( 'sticky_posts' );
33
if ( ! empty( $this->subscribe2_options['last_s2cron'] ) || ( 'yes' === $this->subscribe2_options['stickies'] && ! empty( $stickies ) ) ) {
34
do_action( 's2_digest_resend', 'resend' );
35
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'Attempt made to resend the Digest Notification email', 'subscribe2' ) . '</strong></p></div>';
36
} else {
37
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'The Digest Notification email contained no post information. No email was sent', 'subscribe2' ) . '</strong></p></div>';
38
}
39
} elseif ( isset( $_POST['submit'] ) ) {
40
foreach ( $_POST as $key => $value ) {
@@ -47,7 +47,7 @@ if ( isset( $_POST['s2_admin'] ) ) {
47
// check box entries
48
( isset( $_POST[ $key ] ) && '1' === $_POST[ $key ] ) ? $this->subscribe2_options[ $key ] = '1' : $this->subscribe2_options[ $key ] = '0';
49
} elseif ( 'appearance_tab' === $key ) {
50
- $options = array( 'show_meta', 'show_button', 'ajax', 'widget', 'counterwidget', 's2meta_default' );
51
foreach ( $options as $option ) {
52
if ( ! isset( $_POST[ $option ] ) ) {
53
$this->subscribe2_options[ $option ] = '0';
@@ -117,7 +117,7 @@ if ( isset( $_POST['s2_admin'] ) ) {
117
}
118
}
119
120
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'Options saved!', 'subscribe2' ) . '</strong></p></div>';
121
update_option( 'subscribe2_options', $this->subscribe2_options );
122
}
123
}
@@ -125,13 +125,13 @@ if ( isset( $_POST['s2_admin'] ) ) {
125
// send error message if no WordPress page exists
126
$page_id = $wpdb->get_var( "SELECT ID FROM `{$wpdb->prefix}posts` WHERE post_type='page' AND post_status='publish' LIMIT 1" );
127
if ( empty( $page_id ) ) {
128
- echo '<div id="page_message" class="error"><p class="s2_error"><strong>' . __( 'You must create a WordPress page for this plugin to work correctly.', 'subscribe2' ) . '</strong></p></div>';
129
}
130
131
// display error message for GDPR
132
if ( defined( 'S2GDPR' ) && true === S2GDPR ) {
133
if ( 'yes' === $this->subscribe2_options['autosub'] || 'yes' === $this->subscribe2_options['wpregdef'] || 'yes' === $this->subscribe2_options['autosub_def'] || 'yes' === $this->subscribe2_options['comment_def'] ) {
134
- echo '<div id="gdpr_message" class="error"><p class="s2_error"><strong>' . __( 'Your Settings may breach GDPR', 'subscribe2' ) . '</strong></p></div>';
135
}
136
}
137
@@ -150,7 +150,7 @@ foreach ( $disallowed_keywords as $disallowed_keyword ) {
150
$template_link = '<a href="' . admin_url( 'admin.php?page=s2_settings&tab=templates' ) . '">' . __( 'Modify your template', 'subscribe2' ) . '</a>';
151
if ( false !== $disallowed ) {
152
$disallowed_keywords = __( 'Your chosen email type (per-post or digest) does not support the following keywords:', 'subscribe2' );
153
- echo '<div id="keyword_message" class="error"><p class="s2_error"><strong>' . $disallowed_keywords . '</strong><br />' . implode( ', ', $disallowed ) . '<br />' . $template_link . '</p></div>';
154
}
155
156
// send error message if sender email address is off-domain
@@ -163,7 +163,7 @@ if ( 'blogname' === $this->subscribe2_options['sender'] ) {
163
list( $user, $sender_domain ) = explode( '@', $sender, 2 );
164
if ( ! stristr( esc_html( $_SERVER['SERVER_NAME'] ), $sender_domain ) && 'author' !== $this->subscribe2_options['sender'] && '0' === $this->subscribe2_options['dismiss_sender_warning'] ) {
165
// Translators: Warning message
166
- echo '<div id="sender_message" class="error notice is-dismissible"><p class="s2_error"><strong>' . sprintf( __( 'You appear to be sending notifications from %1$s, which has a different domain name than your blog server %2$s. This may result in failed emails.', 'subscribe2' ), $sender, $_SERVER['SERVER_NAME'] ) . '</strong></p></div>';
167
}
168
169
// detect or define which tab we are in
@@ -171,7 +171,7 @@ $current_tab = isset( $_GET['tab'] ) ? $_GET['tab'] : 'email';
171
172
// show our form
173
echo '<div class="wrap">';
174
- echo '<h1>' . __( 'Settings', 'subscribe2' ) . '</h1>' . "\r\n";
175
$s2tabs = array(
176
'email' => __( 'Email Settings', 'subscribe2' ),
177
'templates' => __( 'Templates', 'subscribe2' ),
@@ -182,7 +182,7 @@ $s2tabs = array(
182
echo '<h2 class="nav-tab-wrapper">';
183
foreach ( $s2tabs as $tab_key => $tab_caption ) {
184
$active = ( $current_tab === $tab_key ) ? 'nav-tab-active' : '';
185
- echo '<a class="nav-tab ' . $active . '" href="?page=s2_settings&amp;tab=' . $tab_key . '">' . $tab_caption . '</a>';
186
}
187
echo '</h2>';
188
@@ -191,84 +191,86 @@ echo '<form method="post">' . "\r\n";
191
wp_nonce_field( 'subscribe2-options_subscribers' . S2VERSION );
192
193
echo '<input type="hidden" name="s2_admin" value="options" />' . "\r\n";
194
- echo '<input type="hidden" id="jsbcclimit" value="' . $this->subscribe2_options['bcclimit'] . '" />';
195
196
switch ( $current_tab ) {
197
case 'email':
198
// settings for outgoing emails
199
echo '<div class="s2_admin" id="s2_notification_settings">' . "\r\n";
200
echo '<p>' . "\r\n";
201
- echo __( 'Restrict the number of <strong>recipients per email</strong> to (0 for unlimited)', 'subscribe2' ) . ': ';
202
- echo '<span id="s2bcclimit_1"><span id="s2bcclimit" style="background-color: #FFFBCC">' . $this->subscribe2_options['bcclimit'] . '</span> ';
203
- echo '<a href="#" onclick="s2Show(\'bcclimit\'); return false;">' . __( 'Edit', 'subscribe2' ) . '</a></span>' . "\r\n";
204
echo '<span id="s2bcclimit_2">' . "\r\n";
205
- echo '<input type="text" name="bcclimit" value="' . $this->subscribe2_options['bcclimit'] . '" size="3" />' . "\r\n";
206
- echo '<a href="#" onclick="s2Update(\'bcclimit\'); return false;">' . __( 'Update', 'subscribe2' ) . '</a>' . "\r\n";
207
- echo '<a href="#" onclick="s2Revert(\'bcclimit\'); return false;">' . __( 'Revert', 'subscribe2' ) . '</a></span>' . "\n";
208
209
- echo '<br /><br />' . __( 'Send Admins notifications for new', 'subscribe2' ) . ': ';
210
echo '<label><input type="radio" name="admin_email" value="subs"' . checked( $this->subscribe2_options['admin_email'], 'subs', false ) . ' />' . "\r\n";
211
- echo __( 'Subscriptions', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
212
echo '<label><input type="radio" name="admin_email" value="unsubs"' . checked( $this->subscribe2_options['admin_email'], 'unsubs', false ) . ' />' . "\r\n";
213
- echo __( 'Unsubscriptions', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
214
echo '<label><input type="radio" name="admin_email" value="both"' . checked( $this->subscribe2_options['admin_email'], 'both', false ) . ' />' . "\r\n";
215
- echo __( 'Both', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
216
echo '<label><input type="radio" name="admin_email" value="none"' . checked( $this->subscribe2_options['admin_email'], 'none', false ) . ' />' . "\r\n";
217
- echo __( 'Neither', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
218
219
- echo __( 'Include theme CSS stylesheet in HTML notifications', 'subscribe2' ) . ': ';
220
echo '<label><input type="radio" name="stylesheet" value="yes"' . checked( $this->subscribe2_options['stylesheet'], 'yes', false ) . ' /> ';
221
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
222
echo '<label><input type="radio" name="stylesheet" value="no"' . checked( $this->subscribe2_options['stylesheet'], 'no', false ) . ' /> ';
223
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
224
225
- echo __( 'Send Emails for Pages', 'subscribe2' ) . ': ';
226
echo '<label><input type="radio" name="pages" value="yes"' . checked( $this->subscribe2_options['pages'], 'yes', false ) . ' /> ';
227
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
228
echo '<label><input type="radio" name="pages" value="no"' . checked( $this->subscribe2_options['pages'], 'no', false ) . ' /> ';
229
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
230
- $s2_post_types = apply_filters( 's2_post_types', null );
231
if ( ! empty( $s2_post_types ) ) {
232
- $types = '';
233
- echo __( 'Subscribe2 will send email notifications for the following custom post types', 'subscribe2' ) . ': <strong>';
234
- foreach ( $s2_post_types as $s2_post_type ) {
235
- ( '' === $types ) ? $types = ucwords( $s2_post_type ) : $types .= ', ' . ucwords( $s2_post_type );
236
}
237
- echo $types . '</strong><br /><br />' . "\r\n";
238
}
239
- echo __( 'Send Emails for Password Protected Posts', 'subscribe2' ) . ': ';
240
echo '<label><input type="radio" name="password" value="yes"' . checked( $this->subscribe2_options['password'], 'yes', false ) . ' /> ';
241
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
242
echo '<label><input type="radio" name="password" value="no"' . checked( $this->subscribe2_options['password'], 'no', false ) . ' /> ';
243
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
244
- echo __( 'Send Emails for Private Posts', 'subscribe2' ) . ': ';
245
echo '<label><input type="radio" name="private" value="yes"' . checked( $this->subscribe2_options['private'], 'yes', false ) . ' /> ';
246
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
247
echo '<label><input type="radio" name="private" value="no"' . checked( $this->subscribe2_options['private'], 'no', false ) . ' /> ';
248
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
249
if ( 'never' !== $this->subscribe2_options['email_freq'] ) {
250
- echo __( 'Include Sticky Posts at the top of all Digest Notifications', 'subscribe2' ) . ': ';
251
echo '<label><input type="radio" name="stickies" value="yes"' . checked( $this->subscribe2_options['stickies'], 'yes', false ) . ' /> ';
252
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
253
echo '<label><input type="radio" name="stickies" value="no"' . checked( $this->subscribe2_options['stickies'], 'no', false ) . ' /> ';
254
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
255
}
256
- echo __( 'Send Email From', 'subscribe2' ) . ': ';
257
echo '<label>' . "\r\n";
258
$this->admin_dropdown( true );
259
- echo '</label><br /><br />' . "\r\n";
260
if ( function_exists( 'wp_schedule_event' ) ) {
261
- echo __( 'Send Emails', 'subscribe2' ) . ': <br /><br />' . "\r\n";
262
$this->display_digest_choices();
263
- echo '<p>' . __( 'For digest notifications, date order for posts is', 'subscribe2' ) . ': ' . "\r\n";
264
echo '<label><input type="radio" name="cron_order" value="desc"' . checked( $this->subscribe2_options['cron_order'], 'desc', false ) . ' /> ';
265
- echo __( 'Descending', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
266
echo '<label><input type="radio" name="cron_order" value="asc"' . checked( $this->subscribe2_options['cron_order'], 'asc', false ) . ' /> ';
267
- echo __( 'Ascending', 'subscribe2' ) . '</label></p>' . "\r\n";
268
}
269
- echo __( 'Add Tracking Parameters to the Permalink', 'subscribe2' ) . ': ';
270
- echo '<input type="text" name="tracking" value="' . stripslashes( $this->subscribe2_options['tracking'] ) . '" size="50" /> ';
271
- echo '<br />' . __( 'eg. utm_source=subscribe2&amp;utm_medium=email&amp;utm_campaign=postnotify&amp;utm_id={ID}&amp;utm_title={TITLE}', 'subscribe2' ) . "\r\n";
272
echo '</p>' . "\r\n";
273
echo '</div>' . "\r\n";
274
break;
@@ -279,48 +281,54 @@ switch ( $current_tab ) {
279
echo '<p>' . "\r\n";
280
echo '<table style="width: 100%; border-collapse: separate; border-spacing: 5px; *border-collapse: expression(\'separate\', cellSpacing = \'5px\');" class="editform">' . "\r\n";
281
echo '<tr><td style="vertical-align: top; height: 350px; min-height: 350px;">';
282
- echo __( 'Notification email (must not be empty)', 'subscribe2' ) . ':<br />' . "\r\n";
283
- echo __( 'Subject Line', 'subscribe2' ) . ': ';
284
- echo '<input type="text" name="notification_subject" value="' . stripslashes( $this->subscribe2_options['notification_subject'] ) . '" size="45" />';
285
- echo '<br />' . "\r\n";
286
- echo '<textarea rows="9" cols="60" name="mailtext" style="width:95%;">' . stripslashes( $this->subscribe2_options['mailtext'] ) . '</textarea>' . "\r\n";
287
echo '</td><td style="vertical-align: top;" rowspan="3">';
288
- echo '<p class="submit"><input type="submit" class="button-secondary" name="preview" value="' . __( 'Send Email Preview', 'subscribe2' ) . '" /></p>' . "\r\n";
289
- echo '<h3>' . __( 'Message substitutions', 'subscribe2' ) . '</h3>' . "\r\n";
290
echo '<dl>';
291
- 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";
292
- echo '<dt><b>{BLOGNAME}</b></dt><dd>' . get_option( 'blogname' ) . '</dd>' . "\r\n";
293
- echo '<dt><b>{BLOGLINK}</b></dt><dd>' . get_option( 'home' ) . '</dd>' . "\r\n";
294
- echo '<dt><b>{TITLE}</b></dt><dd>' . __( "the post's title<br />(<i>for per-post emails only</i>)", 'subscribe2' ) . '</dd>' . "\r\n";
295
- echo '<dt><b>{TITLETEXT}</b></dt><dd>' . __( "the post's unformatted title <br />(<i>for per-post emails only</i>)", 'subscribe2' ) . '</dd>' . "\r\n";
296
- 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";
297
- 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";
298
- echo '<dt><b>{TABLE}</b></dt><dd>' . __( 'a list of post titles<br />(<i>for digest emails only</i>)', 'subscribe2' ) . '</dd>' . "\r\n";
299
- echo '<dt><b>{TABLELINKS}</b></dt><dd>' . __( 'a list of post titles followed by links to the articles<br />(<i>for digest emails only</i>)', 'subscribe2' ) . '</dd>' . "\r\n";
300
- echo '<dt><b>{REFERENCELINKS}</b></dt><dd>' . __( 'a reference style list of links at the end of the email with corresponding numbers in the content<br />(<i>for the full content plain text per-post email only</i>)', 'subscribe2' ) . '</dd>' . "\r\n";
301
- echo '<dt><b>{PERMALINK}</b></dt><dd>' . __( "the post's permalink<br />(<i>for per-post emails only</i>)", 'subscribe2' ) . '</dd>' . "\r\n";
302
- echo '<dt><b>{TINYLINK}</b></dt><dd>' . __( "the post's permalink after conversion by TinyURL", 'subscribe2' ) . '</dd>' . "\r\n";
303
- echo '<dt><b>{PERMAURL}</b></dt><dd>' . __( "the post's unformatted permalink<br />(<i>for per-post emails only</i>)", 'subscribe2' ) . '</dd>' . "\r\n";
304
- 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";
305
- 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";
306
- echo '<dt><b>{MYNAME}</b></dt><dd>' . __( "the admin or post author's name", 'subscribe2' ) . '</dd>' . "\r\n";
307
- echo '<dt><b>{EMAIL}</b></dt><dd>' . __( "the admin or post author's email", 'subscribe2' ) . ' </dd>' . "\r\n";
308
- echo '<dt><b>{AUTHORNAME}</b></dt><dd>' . __( "the post author's name", 'subscribe2' ) . '</dd>' . "\r\n";
309
- 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";
310
- 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";
311
- echo '<dt><b>{CATS}</b></dt><dd>' . __( "the post's assigned categories", 'subscribe2' ) . "</dd>\r\n";
312
- echo '<dt><b>{TAGS}</b></dt><dd>' . __( "the post's assigned Tags", 'subscribe2' ) . "</dd>\r\n";
313
- 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";
314
echo '</dl></td></tr><tr><td style="vertical-align: top; height: 350px; min-height: 350px;">';
315
- echo __( 'Subscribe / Unsubscribe confirmation email', 'subscribe2' ) . ':<br />' . "\r\n";
316
- echo __( 'Subject Line', 'subscribe2' ) . ': ';
317
- echo '<input type="text" name="confirm_subject" value="' . stripslashes( $this->subscribe2_options['confirm_subject'] ) . '" size="45" /><br />' . "\r\n";
318
- echo '<textarea rows="9" cols="60" name="confirm_email" style="width:95%;">' . stripslashes( $this->subscribe2_options['confirm_email'] ) . '</textarea>' . "\r\n";
319
echo '</td></tr><tr><td style="vertical-align: top; height: 350px; min-height: 350px;">';
320
- echo __( 'Reminder email to Unconfirmed Subscribers', 'subscribe2' ) . ':<br />' . "\r\n";
321
- echo __( 'Subject Line', 'subscribe2' ) . ': ';
322
- echo '<input type="text" name="remind_subject" value="' . stripslashes( $this->subscribe2_options['remind_subject'] ) . '" size="45" /><br />' . "\r\n";
323
- echo '<textarea rows="9" cols="60" name="remind_email" style="width:95%;">' . stripslashes( $this->subscribe2_options['remind_email'] ) . '</textarea><br /><br />' . "\r\n";
324
echo '</td></tr></table>' . "\r\n";
325
echo '</div>' . "\r\n";
326
break;
@@ -333,22 +341,22 @@ switch ( $current_tab ) {
333
// compulsory categories
334
echo '<div class="s2_admin" id="s2_compulsory_categories">' . "\r\n";
335
echo '<input type="hidden" name="registered_users_tab" value="options" />' . "\r\n";
336
- echo '<h3>' . __( 'Compulsory Categories', 'subscribe2' ) . '</h3>' . "\r\n";
337
echo '<p>' . "\r\n";
338
- echo '<strong><em style="color: red">' . __( 'Compulsory categories will be checked by default for Registered Subscribers', 'subscribe2' ) . '</em></strong><br />' . "\r\n";
339
echo '</p>';
340
$s2_forms->display_category_form( explode( ',', $this->subscribe2_options['compulsory'] ), 1, array(), 'compulsory' );
341
echo "</div>\r\n";
342
343
// excluded categories
344
echo '<div class="s2_admin" id="s2_excluded_categories">' . "\r\n";
345
- echo '<h3>' . __( 'Excluded Categories', 'subscribe2' ) . '</h3>' . "\r\n";
346
echo '<p>';
347
- 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";
348
echo '</p>';
349
$s2_forms->display_category_form( explode( ',', $this->subscribe2_options['exclude'] ), 1, array(), 'exclude' );
350
echo '<p style="text-align: center;"><label><input type="checkbox" name="reg_override" value="1"' . checked( $this->subscribe2_options['reg_override'], '1', false ) . ' /> ';
351
- echo __( 'Allow registered users to subscribe to excluded categories?', 'subscribe2' ) . '</label></p>' . "\r\n";
352
echo '</div>' . "\r\n";
353
354
// excluded post formats
@@ -356,9 +364,9 @@ switch ( $current_tab ) {
356
if ( false !== $formats ) {
357
// excluded formats
358
echo '<div class="s2_admin" id="s2_excluded_formats">' . "\r\n";
359
- echo '<h3>' . __( 'Excluded Formats', 'subscribe2' ) . '</h3>' . "\r\n";
360
echo '<p>';
361
- 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";
362
echo '</p>';
363
$this->display_format_form( $formats, explode( ',', $this->subscribe2_options['exclude_formats'] ) );
364
echo '</div>' . "\r\n";
@@ -366,74 +374,74 @@ switch ( $current_tab ) {
366
367
//Auto Subscription for new registrations
368
echo '<div class="s2_admin" id="s2_autosubscribe_settings">' . "\r\n";
369
- echo '<h3>' . __( 'Auto-Subscribe', 'subscribe2' ) . '</h3>' . "\r\n";
370
echo '<p>' . "\r\n";
371
- echo __( 'Subscribe new users registering with your blog', 'subscribe2' ) . ':<br />' . "\r\n";
372
if ( defined( 'S2GDPR' ) && ( ( true === S2GDPR && 'yes' === $this->subscribe2_options['autosub'] ) || ( false === S2GDPR ) ) ) {
373
echo '<label><input type="radio" name="autosub" value="yes"' . checked( $this->subscribe2_options['autosub'], 'yes', false ) . ' /> ';
374
- echo __( 'Automatically', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
375
}
376
echo '<label><input type="radio" name="autosub" value="wpreg"' . checked( $this->subscribe2_options['autosub'], 'wpreg', false ) . ' /> ';
377
- echo __( 'Display option on Registration Form', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
378
echo '<label><input type="radio" name="autosub" value="no"' . checked( $this->subscribe2_options['autosub'], 'no', false ) . ' /> ';
379
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
380
- echo __( 'Auto-subscribe includes any excluded categories', 'subscribe2' ) . ':<br />' . "\r\n";
381
echo '<label><input type="radio" name="newreg_override" value="yes"' . checked( $this->subscribe2_options['newreg_override'], 'yes', false ) . ' /> ';
382
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
383
echo '<label><input type="radio" name="newreg_override" value="no"' . checked( $this->subscribe2_options['newreg_override'], 'no', false ) . ' /> ';
384
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
385
if ( defined( 'S2GDPR' ) && ( ( true === S2GDPR && 'yes' === $this->subscribe2_options['wpregdef'] ) || ( false === S2GDPR ) ) ) {
386
- echo __( 'Registration Form option is checked by default', 'subscribe2' ) . ':<br />' . "\r\n";
387
echo '<label><input type="radio" name="wpregdef" value="yes"' . checked( $this->subscribe2_options['wpregdef'], 'yes', false ) . ' /> ';
388
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
389
echo '<label><input type="radio" name="wpregdef" value="no"' . checked( $this->subscribe2_options['wpregdef'], 'no', false ) . ' /> ';
390
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
391
}
392
- echo __( 'Auto-subscribe users to receive email as', 'subscribe2' ) . ': <br />' . "\r\n";
393
echo '<label><input type="radio" name="autoformat" value="html"' . checked( $this->subscribe2_options['autoformat'], 'html', false ) . ' /> ';
394
- echo __( 'HTML - Full', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
395
echo '<label><input type="radio" name="autoformat" value="html_excerpt"' . checked( $this->subscribe2_options['autoformat'], 'html_excerpt', false ) . ' /> ';
396
- echo __( 'HTML - Excerpt', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
397
echo '<label><input type="radio" name="autoformat" value="post"' . checked( $this->subscribe2_options['autoformat'], 'post', false ) . ' /> ';
398
- echo __( 'Plain Text - Full', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
399
echo '<label><input type="radio" name="autoformat" value="excerpt"' . checked( $this->subscribe2_options['autoformat'], 'excerpt', false ) . ' /> ';
400
- echo __( 'Plain Text - Excerpt', 'subscribe2' ) . '</label><br /><br />';
401
- echo __( 'Registered Users have the option to auto-subscribe to new categories', 'subscribe2' ) . ': <br />' . "\r\n";
402
echo '<label><input type="radio" name="show_autosub" value="yes"' . checked( $this->subscribe2_options['show_autosub'], 'yes', false ) . ' /> ';
403
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
404
echo '<label><input type="radio" name="show_autosub" value="no"' . checked( $this->subscribe2_options['show_autosub'], 'no', false ) . ' /> ';
405
- echo __( 'No', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
406
echo '<label><input type="radio" name="show_autosub" value="exclude"' . checked( $this->subscribe2_options['show_autosub'], 'exclude', false ) . ' /> ';
407
- echo __( 'New categories are immediately excluded', 'subscribe2' ) . '</label><br /><br />';
408
if ( defined( 'S2GDPR' ) && ( ( true === S2GDPR && 'yes' === $this->subscribe2_options['autosub_def'] ) || ( false === S2GDPR ) ) ) {
409
- echo __( 'Option for Registered Users to auto-subscribe to new categories is checked by default', 'subscribe2' ) . ': <br />' . "\r\n";
410
echo '<label><input type="radio" name="autosub_def" value="yes"' . checked( $this->subscribe2_options['autosub_def'], 'yes', false ) . ' /> ';
411
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
412
echo '<label><input type="radio" name="autosub_def" value="no"' . checked( $this->subscribe2_options['autosub_def'], 'no', false ) . ' /> ';
413
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />';
414
}
415
// Hide these options if using Jetpack Comments
416
if ( ! class_exists( 'Jetpack_Comments' ) ) {
417
- echo __( 'Display checkbox to allow subscriptions from the comment form', 'subscribe2' ) . ': <br />' . "\r\n";
418
echo '<label><input type="radio" name="comment_subs" value="before"' . checked( $this->subscribe2_options['comment_subs'], 'before', false ) . ' /> ';
419
- echo __( 'Before the Comment Submit button', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
420
echo '<label><input type="radio" name="comment_subs" value="after"' . checked( $this->subscribe2_options['comment_subs'], 'after', false ) . ' /> ';
421
- echo __( 'After the Comment Submit button', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
422
echo '<label><input type="radio" name="comment_subs" value="no"' . checked( $this->subscribe2_options['comment_subs'], 'no', false ) . ' /> ';
423
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />';
424
if ( defined( 'S2GDPR' ) && ( ( true === S2GDPR && 'yes' === $this->subscribe2_options['comment_def'] ) || ( false === S2GDPR ) ) ) {
425
- echo __( 'Comment form checkbox is checked by default', 'subscribe2' ) . ': <br />' . "\r\n";
426
echo '<label><input type="radio" name="comment_def" value="yes"' . checked( $this->subscribe2_options['comment_def'], 'yes', false ) . ' /> ';
427
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
428
echo '<label><input type="radio" name="comment_def" value="no"' . checked( $this->subscribe2_options['comment_def'], 'no', false ) . ' /> ';
429
- echo __( 'No', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
430
}
431
}
432
- echo __( 'Show one-click subscription on profile page', 'subscribe2' ) . ':<br />' . "\r\n";
433
echo '<label><input type="radio" name="one_click_profile" value="yes"' . checked( $this->subscribe2_options['one_click_profile'], 'yes', false ) . ' /> ';
434
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
435
echo '<label><input type="radio" name="one_click_profile" value="no"' . checked( $this->subscribe2_options['one_click_profile'], 'no', false ) . ' /> ';
436
- echo __( 'No', 'subscribe2' ) . '</label>' . "\r\n";
437
echo '</p></div>' . "\r\n";
438
break;
439
@@ -444,39 +452,36 @@ switch ( $current_tab ) {
444
echo '<p>' . "\r\n";
445
446
// WordPress page ID where subscribe2 token is used
447
- echo __( 'Set default Subscribe2 page as', 'subscribe2' ) . ': ';
448
- echo '<select name="s2page">' . "\r\n";
449
- echo '<option value="0">' . __( 'Select a page', 'subscribe2' ) . '</option>' . "\r\n";
450
$this->pages_dropdown( $this->subscribe2_options['s2page'] );
451
- echo '</select>' . "\r\n";
452
453
// show link to WordPress page in meta
454
- echo '<br /><br /><label><input type="checkbox" name="show_meta" value="1"' . checked( $this->subscribe2_options['show_meta'], '1', false ) . ' /> ';
455
- echo __( 'Show a link to your subscription page in "meta"?', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
456
457
// show QuickTag button
458
echo '<label><input type="checkbox" name="show_button" value="1"' . checked( $this->subscribe2_options['show_button'], '1', false ) . ' /> ';
459
- echo __( 'Show the Subscribe2 button on the Write toolbar?', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
460
461
// enable popup style form
462
echo '<label><input type="checkbox" name="ajax" value="1"' . checked( $this->subscribe2_options['ajax'], '1', false ) . ' /> ';
463
- echo __( 'Enable popup style subscription form?', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
464
465
// show Widget
466
echo '<label><input type="checkbox" name="widget" value="1"' . checked( $this->subscribe2_options['widget'], '1', false ) . ' /> ';
467
- echo __( 'Enable Subscribe2 Widget?', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
468
469
// show Counter Widget
470
echo '<label><input type="checkbox" name="counterwidget" value="1"' . checked( $this->subscribe2_options['counterwidget'], '1', false ) . ' /> ';
471
- echo __( 'Enable Subscribe2 Counter Widget?', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
472
473
// s2_meta checked by default
474
echo '<label><input type="checkbox" name="s2meta_default" value="1"' . checked( $this->subscribe2_options['s2meta_default'], '1', false ) . ' /> ';
475
- echo __( 'Disable email notifications is checked by default on authoring pages?', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
476
477
// Subscription form for Registered Users on Frontend
478
echo '<label><input type="checkbox" name="js_ip_updater" value="1"' . checked( $this->subscribe2_options['js_ip_updater'], '1', false ) . ' /> ';
479
- echo __( 'Use javascript to update IP address in Subscribe2 HTML form data? (useful if caching is enabled)', 'subscribe2' ) . '</label>' . "\r\n";
480
echo '</p>';
481
echo '</div>' . "\r\n";
482
break;
@@ -484,31 +489,29 @@ switch ( $current_tab ) {
484
case 'misc':
485
//barred domains
486
echo '<div class="s2_admin" id="s2_barred_domains">' . "\r\n";
487
- echo '<h3>' . __( 'Barred Domains', 'subscribe2' ) . '</h3>' . "\r\n";
488
echo '<p>' . "\r\n";
489
- echo __( 'Enter domains to bar for public subscriptions, wildcards (*) and exceptions (!) are allowed', 'subscribe2' ) . '<br />' . "\r\n";
490
- echo __( 'Use a new line for each entry and omit the "@" symbol, for example !email.com, hotmail.com, yahoo.*', 'subscribe2' );
491
- echo "\r\n" . '<br /><textarea style="width: 98%;" rows="4" cols="60" name="barred">' . esc_textarea( $this->subscribe2_options['barred'] ) . '</textarea>';
492
echo '</p>';
493
- echo '<h3>' . __( 'Links', 'subscribe2' ) . '</h3>' . "\r\n";
494
- echo '<a href="http://wordpress.org/plugins/subscribe2/">' . __( 'Plugin Site', 'subscribe2' ) . '</a><br />';
495
- echo '<a href="http://wordpress.org/support/plugin/subscribe2">' . __( 'Plugin Forum', 'subscribe2' ) . '</a><br />';
496
- echo '<a href="http://subscribe2.wordpress.com/">' . __( 'Plugin Blog', 'subscribe2' ) . '</a><br />';
497
- 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>';
498
echo '</div>' . "\r\n";
499
break;
500
501
}
502
// submit
503
- echo '<p class="submit" style="text-align: center"><input type="submit" class="button-primary" name="submit" value="' . __( 'Submit', 'subscribe2' ) . '" /></p>';
504
505
if ( 'misc' === $current_tab ) {
506
// reset
507
- echo '<h3>' . __( 'Reset to Default Settings', 'subscribe2' ) . '</h3>' . "\r\n";
508
- 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";
509
echo '<p class="submit" style="text-align: center">';
510
- echo '<input type="submit" id="deletepost" name="reset" value="' . __( 'RESET', 'subscribe2' ) .
511
- '" /></p>';
512
}
513
echo '</form></div>' . "\r\n";
514
8
// was anything POSTed?
9
if ( isset( $_POST['s2_admin'] ) ) {
10
if ( false === wp_verify_nonce( $_REQUEST['_wpnonce'], 'subscribe2-options_subscribers' . S2VERSION ) ) {
11
+ die( '<p>' . esc_html__( 'Security error! Your request cannot be completed.', 'subscribe2' ) . '</p>' );
12
}
13
14
if ( isset( $_POST['reset'] ) ) {
16
global $s2_upgrade;
17
$s2_upgrade = new S2_Upgrade();
18
$s2_upgrade->reset();
19
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Options reset!', 'subscribe2' ) . '</strong></p></div>';
20
} elseif ( isset( $_POST['preview'] ) ) {
21
global $user_email, $post;
22
$this->preview_email = true;
27
} else {
28
do_action( 's2_digest_preview', $user_email );
29
}
30
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Preview message(s) sent to logged in user', 'subscribe2' ) . '</strong></p></div>';
31
} elseif ( isset( $_POST['resend'] ) ) {
32
$stickies = get_option( 'sticky_posts' );
33
if ( ! empty( $this->subscribe2_options['last_s2cron'] ) || ( 'yes' === $this->subscribe2_options['stickies'] && ! empty( $stickies ) ) ) {
34
do_action( 's2_digest_resend', 'resend' );
35
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Attempt made to resend the Digest Notification email', 'subscribe2' ) . '</strong></p></div>';
36
} else {
37
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'The Digest Notification email contained no post information. No email was sent', 'subscribe2' ) . '</strong></p></div>';
38
}
39
} elseif ( isset( $_POST['submit'] ) ) {
40
foreach ( $_POST as $key => $value ) {
47
// check box entries
48
( isset( $_POST[ $key ] ) && '1' === $_POST[ $key ] ) ? $this->subscribe2_options[ $key ] = '1' : $this->subscribe2_options[ $key ] = '0';
49
} elseif ( 'appearance_tab' === $key ) {
50
+ $options = array( 'show_meta', 'show_button', 'ajax', 'widget', 'counterwidget', 's2meta_default', 'js_ip_updater' );
51
foreach ( $options as $option ) {
52
if ( ! isset( $_POST[ $option ] ) ) {
53
$this->subscribe2_options[ $option ] = '0';
117
}
118
}
119
120
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Options saved!', 'subscribe2' ) . '</strong></p></div>';
121
update_option( 'subscribe2_options', $this->subscribe2_options );
122
}
123
}
125
// send error message if no WordPress page exists
126
$page_id = $wpdb->get_var( "SELECT ID FROM `{$wpdb->prefix}posts` WHERE post_type='page' AND post_status='publish' LIMIT 1" );
127
if ( empty( $page_id ) ) {
128
+ echo '<div id="page_message" class="error"><p class="s2_error"><strong>' . esc_html__( 'You must create a WordPress page for this plugin to work correctly.', 'subscribe2' ) . '</strong></p></div>';
129
}
130
131
// display error message for GDPR
132
if ( defined( 'S2GDPR' ) && true === S2GDPR ) {
133
if ( 'yes' === $this->subscribe2_options['autosub'] || 'yes' === $this->subscribe2_options['wpregdef'] || 'yes' === $this->subscribe2_options['autosub_def'] || 'yes' === $this->subscribe2_options['comment_def'] ) {
134
+ echo '<div id="gdpr_message" class="error"><p class="s2_error"><strong>' . esc_html__( 'Your Settings may breach GDPR', 'subscribe2' ) . '</strong></p></div>';
135
}
136
}
137
150
$template_link = '<a href="' . admin_url( 'admin.php?page=s2_settings&tab=templates' ) . '">' . __( 'Modify your template', 'subscribe2' ) . '</a>';
151
if ( false !== $disallowed ) {
152
$disallowed_keywords = __( 'Your chosen email type (per-post or digest) does not support the following keywords:', 'subscribe2' );
153
+ echo '<div id="keyword_message" class="error"><p class="s2_error"><strong>' . esc_html( $disallowed_keywords ) . '</strong><br>' . esc_html( implode( ', ', $disallowed ) ) . '<br>' . wp_kses_post( $template_link ) . '</p></div>';
154
}
155
156
// send error message if sender email address is off-domain
163
list( $user, $sender_domain ) = explode( '@', $sender, 2 );
164
if ( ! stristr( esc_html( $_SERVER['SERVER_NAME'] ), $sender_domain ) && 'author' !== $this->subscribe2_options['sender'] && '0' === $this->subscribe2_options['dismiss_sender_warning'] ) {
165
// Translators: Warning message
166
+ echo wp_kses_post( '<div id="sender_message" class="error notice is-dismissible"><p class="s2_error"><strong>' . sprintf( __( 'You appear to be sending notifications from %1$s, which has a different domain name than your blog server %2$s. This may result in failed emails.', 'subscribe2' ), $sender, $_SERVER['SERVER_NAME'] ) . '</strong></p></div>' );
167
}
168
169
// detect or define which tab we are in
171
172
// show our form
173
echo '<div class="wrap">';
174
+ echo '<h1>' . esc_html__( 'Settings', 'subscribe2' ) . '</h1>' . "\r\n";
175
$s2tabs = array(
176
'email' => __( 'Email Settings', 'subscribe2' ),
177
'templates' => __( 'Templates', 'subscribe2' ),
182
echo '<h2 class="nav-tab-wrapper">';
183
foreach ( $s2tabs as $tab_key => $tab_caption ) {
184
$active = ( $current_tab === $tab_key ) ? 'nav-tab-active' : '';
185
+ echo '<a class="nav-tab ' . esc_attr( $active ) . '" href="?page=s2_settings&amp;tab=' . esc_html( $tab_key ) . '">' . esc_html( $tab_caption ) . '</a>';
186
}
187
echo '</h2>';
188
191
wp_nonce_field( 'subscribe2-options_subscribers' . S2VERSION );
192
193
echo '<input type="hidden" name="s2_admin" value="options" />' . "\r\n";
194
+ echo '<input type="hidden" id="jsbcclimit" value="' . esc_attr( $this->subscribe2_options['bcclimit'] ) . '" />';
195
196
switch ( $current_tab ) {
197
case 'email':
198
// settings for outgoing emails
199
echo '<div class="s2_admin" id="s2_notification_settings">' . "\r\n";
200
echo '<p>' . "\r\n";
201
+ echo wp_kses_post( 'Restrict the number of <strong>recipients per email</strong> to (0 for unlimited)', 'subscribe2' ) . ': ';
202
+ echo '<span id="s2bcclimit_1"><span id="s2bcclimit" style="background-color: #FFFBCC">' . esc_html( $this->subscribe2_options['bcclimit'] ) . '</span> ';
203
+ echo '<a href="#" onclick="s2Show(\'bcclimit\'); return false;">' . esc_html__( 'Edit', 'subscribe2' ) . '</a></span>' . "\r\n";
204
echo '<span id="s2bcclimit_2">' . "\r\n";
205
+ echo '<input type="text" name="bcclimit" value="' . esc_attr( $this->subscribe2_options['bcclimit'] ) . '" size="3" />' . "\r\n";
206
+ echo '<a href="#" onclick="s2Update(\'bcclimit\'); return false;">' . esc_html__( 'Update', 'subscribe2' ) . '</a>' . "\r\n";
207
+ echo '<a href="#" onclick="s2Revert(\'bcclimit\'); return false;">' . esc_html__( 'Revert', 'subscribe2' ) . '</a></span>' . "\n";
208
209
+ echo '<br><br>' . esc_html__( 'Send Admins notifications for new', 'subscribe2' ) . ': ';
210
echo '<label><input type="radio" name="admin_email" value="subs"' . checked( $this->subscribe2_options['admin_email'], 'subs', false ) . ' />' . "\r\n";
211
+ echo esc_html__( 'Subscriptions', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
212
echo '<label><input type="radio" name="admin_email" value="unsubs"' . checked( $this->subscribe2_options['admin_email'], 'unsubs', false ) . ' />' . "\r\n";
213
+ echo esc_html__( 'Unsubscriptions', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
214
echo '<label><input type="radio" name="admin_email" value="both"' . checked( $this->subscribe2_options['admin_email'], 'both', false ) . ' />' . "\r\n";
215
+ echo esc_html__( 'Both', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
216
echo '<label><input type="radio" name="admin_email" value="none"' . checked( $this->subscribe2_options['admin_email'], 'none', false ) . ' />' . "\r\n";
217
+ echo esc_html__( 'Neither', 'subscribe2' ) . '</label><br><br>' . "\r\n";
218
219
+ echo esc_html__( 'Include theme CSS stylesheet in HTML notifications', 'subscribe2' ) . ': ';
220
echo '<label><input type="radio" name="stylesheet" value="yes"' . checked( $this->subscribe2_options['stylesheet'], 'yes', false ) . ' /> ';
221
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
222
echo '<label><input type="radio" name="stylesheet" value="no"' . checked( $this->subscribe2_options['stylesheet'], 'no', false ) . ' /> ';
223
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>' . "\r\n";
224
225
+ echo esc_html__( 'Send Emails for Pages', 'subscribe2' ) . ': ';
226
echo '<label><input type="radio" name="pages" value="yes"' . checked( $this->subscribe2_options['pages'], 'yes', false ) . ' /> ';
227
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
228
echo '<label><input type="radio" name="pages" value="no"' . checked( $this->subscribe2_options['pages'], 'no', false ) . ' /> ';
229
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>' . "\r\n";
230
+
231
+ $s2_post_types = apply_filters( 's2_post_types', array() );
232
if ( ! empty( $s2_post_types ) ) {
233
+ if ( ! empty( $s2_post_types ) ) {
234
+ echo esc_html__( 'Subscribe2 will send email notifications for the following custom post types', 'subscribe2' ) . ': ';
235
+ echo '<strong>' . esc_html( implode( ', ', $s2_post_types ) ) . '</strong><br><br>' . "\r\n";
236
}
237
}
238
+
239
+ echo esc_html__( 'Send Emails for Password Protected Posts', 'subscribe2' ) . ': ';
240
echo '<label><input type="radio" name="password" value="yes"' . checked( $this->subscribe2_options['password'], 'yes', false ) . ' /> ';
241
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
242
echo '<label><input type="radio" name="password" value="no"' . checked( $this->subscribe2_options['password'], 'no', false ) . ' /> ';
243
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>' . "\r\n";
244
+ echo esc_html__( 'Send Emails for Private Posts', 'subscribe2' ) . ': ';
245
echo '<label><input type="radio" name="private" value="yes"' . checked( $this->subscribe2_options['private'], 'yes', false ) . ' /> ';
246
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
247
echo '<label><input type="radio" name="private" value="no"' . checked( $this->subscribe2_options['private'], 'no', false ) . ' /> ';
248
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>' . "\r\n";
249
if ( 'never' !== $this->subscribe2_options['email_freq'] ) {
250
+ echo esc_html__( 'Include Sticky Posts at the top of all Digest Notifications', 'subscribe2' ) . ': ';
251
echo '<label><input type="radio" name="stickies" value="yes"' . checked( $this->subscribe2_options['stickies'], 'yes', false ) . ' /> ';
252
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
253
echo '<label><input type="radio" name="stickies" value="no"' . checked( $this->subscribe2_options['stickies'], 'no', false ) . ' /> ';
254
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>' . "\r\n";
255
}
256
+ echo esc_html__( 'Send Email From', 'subscribe2' ) . ': ';
257
echo '<label>' . "\r\n";
258
$this->admin_dropdown( true );
259
+ echo '</label><br><br>' . "\r\n";
260
if ( function_exists( 'wp_schedule_event' ) ) {
261
+ echo esc_html__( 'Send Emails', 'subscribe2' ) . ': <br>' . "\r\n";
262
$this->display_digest_choices();
263
+ }
264
+ if ( 'never' !== $this->subscribe2_options['email_freq'] ) {
265
+ echo '<p>' . esc_html__( 'For digest notifications, date order for posts is', 'subscribe2' ) . ': ' . "\r\n";
266
echo '<label><input type="radio" name="cron_order" value="desc"' . checked( $this->subscribe2_options['cron_order'], 'desc', false ) . ' /> ';
267
+ echo esc_html__( 'Descending', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
268
echo '<label><input type="radio" name="cron_order" value="asc"' . checked( $this->subscribe2_options['cron_order'], 'asc', false ) . ' /> ';
269
+ echo esc_html__( 'Ascending', 'subscribe2' ) . '</label></p>' . "\r\n";
270
}
271
+ echo esc_html__( 'Add Tracking Parameters to the Permalink', 'subscribe2' ) . ': ';
272
+ echo '<input type="text" name="tracking" value="' . esc_attr( $this->subscribe2_options['tracking'] ) . '" size="50" /> ';
273
+ echo '<br>' . esc_html__( 'eg. utm_source=subscribe2&amp;utm_medium=email&amp;utm_campaign=postnotify&amp;utm_id={ID}&amp;utm_title={TITLE}', 'subscribe2' ) . "\r\n";
274
echo '</p>' . "\r\n";
275
echo '</div>' . "\r\n";
276
break;
281
echo '<p>' . "\r\n";
282
echo '<table style="width: 100%; border-collapse: separate; border-spacing: 5px; *border-collapse: expression(\'separate\', cellSpacing = \'5px\');" class="editform">' . "\r\n";
283
echo '<tr><td style="vertical-align: top; height: 350px; min-height: 350px;">';
284
+ echo esc_html__( 'Notification email (must not be empty)', 'subscribe2' ) . ':<br>' . "\r\n";
285
+ echo esc_html__( 'Subject Line', 'subscribe2' ) . ': ';
286
+ echo '<input type="text" name="notification_subject" value="' . esc_attr( $this->subscribe2_options['notification_subject'] ) . '" size="45" />';
287
+ echo '<br>' . "\r\n";
288
+ echo '<textarea rows="9" cols="60" name="mailtext" style="width:95%;">' . esc_textarea( stripslashes( $this->subscribe2_options['mailtext'] ) ) . '</textarea>' . "\r\n";
289
echo '</td><td style="vertical-align: top;" rowspan="3">';
290
+ echo '<p class="submit"><input type="submit" class="button-secondary" name="preview" value="' . esc_html__( 'Send Email Preview', 'subscribe2' ) . '" /></p>' . "\r\n";
291
+ echo '<h3>' . esc_html__( 'Message substitutions', 'subscribe2' ) . '</h3>' . "\r\n";
292
echo '<dl>';
293
+ echo '<dt><b><em style="color: red">' . esc_html__( 'IF THE FOLLOWING KEYWORDS ARE ALSO IN YOUR POST THEY WILL BE SUBSTITUTED', 'subscribe2' ) . '</em></b></dt><dd></dd>' . "\r\n";
294
+ echo '<dt><b>{BLOGNAME}</b></dt><dd>' . esc_html( get_option( 'blogname' ) ) . '</dd>' . "\r\n";
295
+ echo '<dt><b>{BLOGLINK}</b></dt><dd>' . esc_html( get_option( 'home' ) ) . '</dd>' . "\r\n";
296
+ echo '<dt><b>{TITLE}</b></dt><dd>' . wp_kses_post( __( "the post's title<br>(<i>for per-post emails only</i>)", 'subscribe2' ) ) . '</dd>' . "\r\n";
297
+ echo '<dt><b>{TITLETEXT}</b></dt><dd>' . wp_kses_post( __( "the post's unformatted title <br>(<i>for per-post emails only</i>)", 'subscribe2' ) ) . '</dd>' . "\r\n";
298
+ echo '<dt><b>{POST}</b></dt><dd>' . wp_kses_post( __( "the excerpt or the entire post<br>(<i>based on the subscriber's preferences</i>)", 'subscribe2' ) ) . '</dd>' . "\r\n";
299
+ echo '<dt><b>{POSTTIME}</b></dt><dd>' . wp_kses_post( __( 'the excerpt of the post and the time it was posted<br>(<i>for digest emails only</i>)', 'subscribe2' ) ) . '</dd>' . "\r\n";
300
+ echo '<dt><b>{TABLE}</b></dt><dd>' . wp_kses_post( __( 'a list of post titles<br>(<i>for digest emails only</i>)', 'subscribe2' ) ) . '</dd>' . "\r\n";
301
+ echo '<dt><b>{TABLELINKS}</b></dt><dd>' . wp_kses_post( __( 'a list of post titles followed by links to the articles<br>(<i>for digest emails only</i>)', 'subscribe2' ) ) . '</dd>' . "\r\n";
302
+ echo '<dt><b>{REFERENCELINKS}</b></dt><dd>' . wp_kses_post( __( 'a reference style list of links at the end of the email with corresponding numbers in the content<br>(<i>for the full content plain text per-post email only</i>)', 'subscribe2' ) ) . '</dd>' . "\r\n";
303
+ echo '<dt><b>{PERMALINK}</b></dt><dd>' . wp_kses_post( __( "the post's permalink<br>(<i>for per-post emails only</i>)", 'subscribe2' ) ) . '</dd>' . "\r\n";
304
+ echo '<dt><b>{TINYLINK}</b></dt><dd>' . esc_html__( "the post's permalink after conversion by TinyURL", 'subscribe2' ) . '</dd>' . "\r\n";
305
+ echo '<dt><b>{PERMAURL}</b></dt><dd>' . wp_kses_post( __( "the post's unformatted permalink<br>(<i>for per-post emails only</i>)", 'subscribe2' ) ) . '</dd>' . "\r\n";
306
+ echo '<dt><b>{DATE}</b></dt><dd>' . wp_kses_post( __( 'the date the post was made<br>(<i>for per-post emails only</i>)', 'subscribe2' ) ) . '</dd>' . "\r\n";
307
+ echo '<dt><b>{TIME}</b></dt><dd>' . wp_kses_post( __( 'the time the post was made<br>(<i>for per-post emails only</i>)', 'subscribe2' ) ) . '</dd>' . "\r\n";
308
+ echo '<dt><b>{MYNAME}</b></dt><dd>' . esc_html__( "the admin or post author's name", 'subscribe2' ) . '</dd>' . "\r\n";
309
+ echo '<dt><b>{EMAIL}</b></dt><dd>' . esc_html__( "the admin or post author's email", 'subscribe2' ) . ' </dd>' . "\r\n";
310
+ echo '<dt><b>{AUTHORNAME}</b></dt><dd>' . esc_html__( "the post author's name", 'subscribe2' ) . '</dd>' . "\r\n";
311
+ echo '<dt><b>{LINK}</b></dt><dd>' . wp_kses_post( __( 'the generated link to confirm a request<br>(<i>only used in the confirmation email template</i>)', 'subscribe2' ) ) . '</dd>' . "\r\n";
312
+ if ( 1 === $this->subscribe2_options['bcclimit'] ) {
313
+ echo '<dt><b>{UNSUBLINK}</b></dt><dd>' . wp_kses_post( __( 'a generated unsubscribe link<br>(<i>only used in the email notification template</i>)', 'subscribe2' ) ) . '</dd>' . "\r\n";
314
+ }
315
+ echo '<dt><b>{ACTION}</b></dt><dd>' . wp_kses_post( __( 'Action performed by LINK in confirmation email<br>(<i>only used in the confirmation email template</i>)', 'subscribe2' ) ) . '</dd>' . "\r\n";
316
+ echo '<dt><b>{CATS}</b></dt><dd>' . esc_html__( "the post's assigned categories", 'subscribe2' ) . '</dd>' . "\r\n";
317
+ echo '<dt><b>{TAGS}</b></dt><dd>' . esc_html__( "the post's assigned Tags", 'subscribe2' ) . '</dd>' . "\r\n";
318
+ echo '<dt><b>{COUNT}</b></dt><dd>' . wp_kses_post( __( 'the number of posts included in the digest email<br>(<i>for digest emails only</i>)', 'subscribe2' ) ) . '</dd>' . "\r\n";
319
+ if ( current_theme_supports( 'post-thumbnails' ) ) {
320
+ echo '<dt><b>{IMAGE}</b></dt><dd>' . esc_html__( "the post's featured image", 'subscribe2' ) . '</dd>' . "\r\n";
321
+ }
322
echo '</dl></td></tr><tr><td style="vertical-align: top; height: 350px; min-height: 350px;">';
323
+ echo esc_html__( 'Subscribe / Unsubscribe confirmation email', 'subscribe2' ) . ':<br>' . "\r\n";
324
+ echo esc_html__( 'Subject Line', 'subscribe2' ) . ': ';
325
+ echo '<input type="text" name="confirm_subject" value="' . esc_attr( $this->subscribe2_options['confirm_subject'] ) . '" size="45" /><br>' . "\r\n";
326
+ echo '<textarea rows="9" cols="60" name="confirm_email" style="width:95%;">' . esc_textarea( stripslashes( $this->subscribe2_options['confirm_email'] ) ) . '</textarea>' . "\r\n";
327
echo '</td></tr><tr><td style="vertical-align: top; height: 350px; min-height: 350px;">';
328
+ echo esc_html__( 'Reminder email to Unconfirmed Subscribers', 'subscribe2' ) . ':<br>' . "\r\n";
329
+ echo esc_html__( 'Subject Line', 'subscribe2' ) . ': ';
330
+ echo '<input type="text" name="remind_subject" value="' . esc_attr( $this->subscribe2_options['remind_subject'] ) . '" size="45" /><br>' . "\r\n";
331
+ echo '<textarea rows="9" cols="60" name="remind_email" style="width:95%;">' . esc_textarea( stripslashes( $this->subscribe2_options['remind_email'] ) ) . '</textarea><br><br>' . "\r\n";
332
echo '</td></tr></table>' . "\r\n";
333
echo '</div>' . "\r\n";
334
break;
341
// compulsory categories
342
echo '<div class="s2_admin" id="s2_compulsory_categories">' . "\r\n";
343
echo '<input type="hidden" name="registered_users_tab" value="options" />' . "\r\n";
344
+ echo '<h3>' . esc_html__( 'Compulsory Categories', 'subscribe2' ) . '</h3>' . "\r\n";
345
echo '<p>' . "\r\n";
346
+ echo '<strong><em style="color: red">' . esc_html__( 'Compulsory categories will be checked by default for Registered Subscribers', 'subscribe2' ) . '</em></strong><br>' . "\r\n";
347
echo '</p>';
348
$s2_forms->display_category_form( explode( ',', $this->subscribe2_options['compulsory'] ), 1, array(), 'compulsory' );
349
echo "</div>\r\n";
350
351
// excluded categories
352
echo '<div class="s2_admin" id="s2_excluded_categories">' . "\r\n";
353
+ echo '<h3>' . esc_html__( 'Excluded Categories', 'subscribe2' ) . '</h3>' . "\r\n";
354
echo '<p>';
355
+ echo '<strong><em style="color: red">' . esc_html__( 'Posts assigned to any Excluded Category do not generate notifications and are not included in digest notifications', 'subscribe2' ) . '</em></strong><br>' . "\r\n";
356
echo '</p>';
357
$s2_forms->display_category_form( explode( ',', $this->subscribe2_options['exclude'] ), 1, array(), 'exclude' );
358
echo '<p style="text-align: center;"><label><input type="checkbox" name="reg_override" value="1"' . checked( $this->subscribe2_options['reg_override'], '1', false ) . ' /> ';
359
+ echo esc_html__( 'Allow registered users to subscribe to excluded categories?', 'subscribe2' ) . '</label></p>' . "\r\n";
360
echo '</div>' . "\r\n";
361
362
// excluded post formats
364
if ( false !== $formats ) {
365
// excluded formats
366
echo '<div class="s2_admin" id="s2_excluded_formats">' . "\r\n";
367
+ echo '<h3>' . esc_html__( 'Excluded Formats', 'subscribe2' ) . '</h3>' . "\r\n";
368
echo '<p>';
369
+ echo '<strong><em style="color: red">' . esc_html__( 'Posts assigned to any Excluded Format do not generate notifications and are not included in digest notifications', 'subscribe2' ) . '</em></strong><br>' . "\r\n";
370
echo '</p>';
371
$this->display_format_form( $formats, explode( ',', $this->subscribe2_options['exclude_formats'] ) );
372
echo '</div>' . "\r\n";
374
375
//Auto Subscription for new registrations
376
echo '<div class="s2_admin" id="s2_autosubscribe_settings">' . "\r\n";
377
+ echo '<h3>' . esc_html__( 'Auto-Subscribe', 'subscribe2' ) . '</h3>' . "\r\n";
378
echo '<p>' . "\r\n";
379
+ echo esc_html__( 'Subscribe new users registering with your blog', 'subscribe2' ) . ':<br>' . "\r\n";
380
if ( defined( 'S2GDPR' ) && ( ( true === S2GDPR && 'yes' === $this->subscribe2_options['autosub'] ) || ( false === S2GDPR ) ) ) {
381
echo '<label><input type="radio" name="autosub" value="yes"' . checked( $this->subscribe2_options['autosub'], 'yes', false ) . ' /> ';
382
+ echo esc_html__( 'Automatically', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
383
}
384
echo '<label><input type="radio" name="autosub" value="wpreg"' . checked( $this->subscribe2_options['autosub'], 'wpreg', false ) . ' /> ';
385
+ echo esc_html__( 'Display option on Registration Form', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
386
echo '<label><input type="radio" name="autosub" value="no"' . checked( $this->subscribe2_options['autosub'], 'no', false ) . ' /> ';
387
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>' . "\r\n";
388
+ echo esc_html__( 'Auto-subscribe includes any excluded categories', 'subscribe2' ) . ':<br>' . "\r\n";
389
echo '<label><input type="radio" name="newreg_override" value="yes"' . checked( $this->subscribe2_options['newreg_override'], 'yes', false ) . ' /> ';
390
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
391
echo '<label><input type="radio" name="newreg_override" value="no"' . checked( $this->subscribe2_options['newreg_override'], 'no', false ) . ' /> ';
392
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>' . "\r\n";
393
if ( defined( 'S2GDPR' ) && ( ( true === S2GDPR && 'yes' === $this->subscribe2_options['wpregdef'] ) || ( false === S2GDPR ) ) ) {
394
+ echo esc_html__( 'Registration Form option is checked by default', 'subscribe2' ) . ':<br>' . "\r\n";
395
echo '<label><input type="radio" name="wpregdef" value="yes"' . checked( $this->subscribe2_options['wpregdef'], 'yes', false ) . ' /> ';
396
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
397
echo '<label><input type="radio" name="wpregdef" value="no"' . checked( $this->subscribe2_options['wpregdef'], 'no', false ) . ' /> ';
398
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>' . "\r\n";
399
}
400
+ echo esc_html__( 'Auto-subscribe users to receive email as', 'subscribe2' ) . ': <br>' . "\r\n";
401
echo '<label><input type="radio" name="autoformat" value="html"' . checked( $this->subscribe2_options['autoformat'], 'html', false ) . ' /> ';
402
+ echo esc_html__( 'HTML - Full', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
403
echo '<label><input type="radio" name="autoformat" value="html_excerpt"' . checked( $this->subscribe2_options['autoformat'], 'html_excerpt', false ) . ' /> ';
404
+ echo esc_html__( 'HTML - Excerpt', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
405
echo '<label><input type="radio" name="autoformat" value="post"' . checked( $this->subscribe2_options['autoformat'], 'post', false ) . ' /> ';
406
+ echo esc_html__( 'Plain Text - Full', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
407
echo '<label><input type="radio" name="autoformat" value="excerpt"' . checked( $this->subscribe2_options['autoformat'], 'excerpt', false ) . ' /> ';
408
+ echo esc_html__( 'Plain Text - Excerpt', 'subscribe2' ) . '</label><br><br>';
409
+ echo esc_html__( 'Registered Users have the option to auto-subscribe to new categories', 'subscribe2' ) . ': <br>' . "\r\n";
410
echo '<label><input type="radio" name="show_autosub" value="yes"' . checked( $this->subscribe2_options['show_autosub'], 'yes', false ) . ' /> ';
411
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
412
echo '<label><input type="radio" name="show_autosub" value="no"' . checked( $this->subscribe2_options['show_autosub'], 'no', false ) . ' /> ';
413
+ echo esc_html__( 'No', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
414
echo '<label><input type="radio" name="show_autosub" value="exclude"' . checked( $this->subscribe2_options['show_autosub'], 'exclude', false ) . ' /> ';
415
+ echo esc_html__( 'New categories are immediately excluded', 'subscribe2' ) . '</label><br><br>';
416
if ( defined( 'S2GDPR' ) && ( ( true === S2GDPR && 'yes' === $this->subscribe2_options['autosub_def'] ) || ( false === S2GDPR ) ) ) {
417
+ echo esc_html__( 'Option for Registered Users to auto-subscribe to new categories is checked by default', 'subscribe2' ) . ': <br>' . "\r\n";
418
echo '<label><input type="radio" name="autosub_def" value="yes"' . checked( $this->subscribe2_options['autosub_def'], 'yes', false ) . ' /> ';
419
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
420
echo '<label><input type="radio" name="autosub_def" value="no"' . checked( $this->subscribe2_options['autosub_def'], 'no', false ) . ' /> ';
421
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>';
422
}
423
// Hide these options if using Jetpack Comments
424
if ( ! class_exists( 'Jetpack_Comments' ) ) {
425
+ echo esc_html__( 'Display checkbox to allow subscriptions from the comment form', 'subscribe2' ) . ': <br>' . "\r\n";
426
echo '<label><input type="radio" name="comment_subs" value="before"' . checked( $this->subscribe2_options['comment_subs'], 'before', false ) . ' /> ';
427
+ echo esc_html__( 'Before the Comment Submit button', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
428
echo '<label><input type="radio" name="comment_subs" value="after"' . checked( $this->subscribe2_options['comment_subs'], 'after', false ) . ' /> ';
429
+ echo esc_html__( 'After the Comment Submit button', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
430
echo '<label><input type="radio" name="comment_subs" value="no"' . checked( $this->subscribe2_options['comment_subs'], 'no', false ) . ' /> ';
431
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>';
432
if ( defined( 'S2GDPR' ) && ( ( true === S2GDPR && 'yes' === $this->subscribe2_options['comment_def'] ) || ( false === S2GDPR ) ) ) {
433
+ echo esc_html__( 'Comment form checkbox is checked by default', 'subscribe2' ) . ': <br>' . "\r\n";
434
echo '<label><input type="radio" name="comment_def" value="yes"' . checked( $this->subscribe2_options['comment_def'], 'yes', false ) . ' /> ';
435
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
436
echo '<label><input type="radio" name="comment_def" value="no"' . checked( $this->subscribe2_options['comment_def'], 'no', false ) . ' /> ';
437
+ echo esc_html__( 'No', 'subscribe2' ) . '</label><br><br>' . "\r\n";
438
}
439
}
440
+ echo esc_html__( 'Show one-click subscription on profile page', 'subscribe2' ) . ':<br>' . "\r\n";
441
echo '<label><input type="radio" name="one_click_profile" value="yes"' . checked( $this->subscribe2_options['one_click_profile'], 'yes', false ) . ' /> ';
442
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;';
443
echo '<label><input type="radio" name="one_click_profile" value="no"' . checked( $this->subscribe2_options['one_click_profile'], 'no', false ) . ' /> ';
444
+ echo esc_html__( 'No', 'subscribe2' ) . '</label>' . "\r\n";
445
echo '</p></div>' . "\r\n";
446
break;
447
452
echo '<p>' . "\r\n";
453
454
// WordPress page ID where subscribe2 token is used
455
+ echo esc_html__( 'Set default Subscribe2 page as', 'subscribe2' ) . ': ';
456
$this->pages_dropdown( $this->subscribe2_options['s2page'] );
457
458
// show link to WordPress page in meta
459
+ echo '<br><br><label><input type="checkbox" name="show_meta" value="1"' . checked( $this->subscribe2_options['show_meta'], '1', false ) . ' /> ';
460
+ echo esc_html__( 'Show a link to your subscription page in "meta"?', 'subscribe2' ) . '</label><br><br>' . "\r\n";
461
462
// show QuickTag button
463
echo '<label><input type="checkbox" name="show_button" value="1"' . checked( $this->subscribe2_options['show_button'], '1', false ) . ' /> ';
464
+ echo esc_html__( 'Show the Subscribe2 button on the Write toolbar?', 'subscribe2' ) . '</label><br><br>' . "\r\n";
465
466
// enable popup style form
467
echo '<label><input type="checkbox" name="ajax" value="1"' . checked( $this->subscribe2_options['ajax'], '1', false ) . ' /> ';
468
+ echo esc_html__( 'Enable popup style subscription form?', 'subscribe2' ) . '</label><br><br>' . "\r\n";
469
470
// show Widget
471
echo '<label><input type="checkbox" name="widget" value="1"' . checked( $this->subscribe2_options['widget'], '1', false ) . ' /> ';
472
+ echo esc_html__( 'Enable Subscribe2 Widget?', 'subscribe2' ) . '</label><br><br>' . "\r\n";
473
474
// show Counter Widget
475
echo '<label><input type="checkbox" name="counterwidget" value="1"' . checked( $this->subscribe2_options['counterwidget'], '1', false ) . ' /> ';
476
+ echo esc_html__( 'Enable Subscribe2 Counter Widget?', 'subscribe2' ) . '</label><br><br>' . "\r\n";
477
478
// s2_meta checked by default
479
echo '<label><input type="checkbox" name="s2meta_default" value="1"' . checked( $this->subscribe2_options['s2meta_default'], '1', false ) . ' /> ';
480
+ echo esc_html__( 'Disable email notifications is checked by default on authoring pages?', 'subscribe2' ) . '</label><br><br>' . "\r\n";
481
482
// Subscription form for Registered Users on Frontend
483
echo '<label><input type="checkbox" name="js_ip_updater" value="1"' . checked( $this->subscribe2_options['js_ip_updater'], '1', false ) . ' /> ';
484
+ echo esc_html__( 'Use javascript to update IP address in Subscribe2 HTML form data? (useful if caching is enabled)', 'subscribe2' ) . '</label>' . "\r\n";
485
echo '</p>';
486
echo '</div>' . "\r\n";
487
break;
489
case 'misc':
490
//barred domains
491
echo '<div class="s2_admin" id="s2_barred_domains">' . "\r\n";
492
+ echo '<h3>' . esc_html__( 'Barred Domains', 'subscribe2' ) . '</h3>' . "\r\n";
493
echo '<p>' . "\r\n";
494
+ echo esc_html__( 'Enter domains to bar for public subscriptions, wildcards (*) and exceptions (!) are allowed', 'subscribe2' ) . '<br>' . "\r\n";
495
+ echo esc_html__( 'Use a new line for each entry and omit the "@" symbol, for example !email.com, hotmail.com, yahoo.*', 'subscribe2' );
496
+ echo "\r\n" . '<br><textarea style="width: 98%;" rows="4" cols="60" name="barred">' . esc_textarea( $this->subscribe2_options['barred'] ) . '</textarea>';
497
echo '</p>';
498
+ echo '<h3>' . esc_html__( 'Links', 'subscribe2' ) . '</h3>' . "\r\n";
499
+ echo '<a href="http://wordpress.org/plugins/subscribe2/">' . esc_html__( 'Plugin Site', 'subscribe2' ) . '</a><br>';
500
+ echo '<a href="http://wordpress.org/support/plugin/subscribe2">' . esc_html__( 'Plugin Forum', 'subscribe2' ) . '</a><br>';
501
+ echo '<a href="http://subscribe2.wordpress.com/">' . esc_html__( 'Plugin Blog', 'subscribe2' ) . '</a><br>';
502
echo '</div>' . "\r\n";
503
break;
504
505
}
506
// submit
507
+ echo '<p class="submit" style="text-align: center"><input type="submit" class="button-primary" name="submit" value="' . esc_attr( __( 'Submit', 'subscribe2' ) ) . '" /></p>';
508
509
if ( 'misc' === $current_tab ) {
510
// reset
511
+ echo '<h3>' . esc_html__( 'Reset to Default Settings', 'subscribe2' ) . '</h3>' . "\r\n";
512
+ echo '<p>' . esc_html__( '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";
513
echo '<p class="submit" style="text-align: center">';
514
+ echo '<input type="submit" class="button" id="deletepost" name="reset" value="' . esc_attr( __( 'RESET', 'subscribe2' ) ) . '" /></p>';
515
}
516
echo '</form></div>' . "\r\n";
517
admin/subscribers.php CHANGED
@@ -17,19 +17,14 @@ if ( ! class_exists( 'WP_List_Table' ) ) {
17
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
}
19
if ( ! class_exists( 'Subscribe2_List_Table' ) ) {
20
- if ( version_compare( $GLOBALS['wp_version'], '4.3', '<' ) ) {
21
- require_once S2PATH . 'classes/class-s2-list-table-legacy.php';
22
- $s2_list_table = new S2_List_Table_Legacy();
23
- } else {
24
- require_once S2PATH . 'classes/class-s2-list-table.php';
25
- $s2_list_table = new S2_List_Table();
26
- }
27
}
28
29
// was anything POSTed ?
30
if ( isset( $_POST['s2_admin'] ) ) {
31
if ( false === wp_verify_nonce( $_REQUEST['_wpnonce'], 'bulk-' . $s2_list_table->_args['plural'] ) ) {
32
- die( '<p>' . __( 'Security error! Your request cannot be completed.', 'subscribe2' ) . '</p>' );
33
}
34
35
if ( ! empty( $_POST['addresses'] ) ) {
@@ -54,64 +49,64 @@ if ( isset( $_POST['s2_admin'] ) ) {
54
continue;
55
}
56
$this->add( $clean_email, true );
57
- $message = '<div id="message" class="updated fade"><p><strong>' . __( 'Address(es) subscribed!', 'subscribe2' ) . '</strong></p></div>';
58
} elseif ( isset( $_POST['unsubscribe'] ) ) {
59
if ( false === $this->is_public( $clean_email ) || $this->is_registered( $clean_email ) ) {
60
( '' === $unsub_error ) ? $unsub_error = "$clean_email" : $unsub_error .= ", $clean_email";
61
continue;
62
}
63
$this->delete( $clean_email );
64
- $message = '<div id="message" class="updated fade"><p><strong>' . __( 'Address(es) unsubscribed!', 'subscribe2' ) . '</strong></p></div>';
65
}
66
}
67
}
68
if ( '' !== $reg_sub_error ) {
69
- echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following are already Registered Subscribers', 'subscribe2' ) . ':<br />' . esc_html( $reg_sub_error ) . '</strong></p></div>';
70
}
71
if ( '' !== $pub_sub_error ) {
72
- echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following are already Public Subscribers', 'subscribe2' ) . ':<br />' . esc_html( $pub_sub_error ) . '</strong></p></div>';
73
}
74
if ( '' !== $unsub_error ) {
75
- echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following were not in the database', 'subscribe2' ) . ':<br /> ' . esc_html( $unsub_error ) . '</strong></p></div>';
76
}
77
if ( '' !== $email_error ) {
78
- echo '<div id="message" class="error"><p><strong>' . __( 'Some emails were not processed, the following were invalid email addresses', 'subscribe2' ) . ':<br /> ' . esc_html( $email_error ) . '</strong></p></div>';
79
}
80
if ( '' !== $message ) {
81
- echo $message;
82
}
83
$_POST['what'] = 'confirmed';
84
} elseif ( isset( $_POST['remind'] ) ) {
85
$this->remind( $_POST['reminderemails'] );
86
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'Reminder Email(s) Sent!', 'subscribe2' ) . '</strong></p></div>';
87
} elseif ( isset( $_POST['sub_categories'] ) && 'subscribe' === $_POST['manage'] ) {
88
if ( isset( $_REQUEST['subscriber'] ) ) {
89
$this->subscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['category'] );
90
} else {
91
$this->subscribe_registered_users( $_POST['exportcsv'], $_POST['category'] );
92
}
93
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'Registered Users Subscribed!', 'subscribe2' ) . '</strong></p></div>';
94
} elseif ( isset( $_POST['sub_categories'] ) && 'unsubscribe' === $_POST['manage'] ) {
95
if ( isset( $_REQUEST['subscriber'] ) ) {
96
$this->unsubscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['category'] );
97
} else {
98
$this->unsubscribe_registered_users( $_POST['exportcsv'], $_POST['category'] );
99
}
100
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'Registered Users Unsubscribed!', 'subscribe2' ) . '</strong></p></div>';
101
} elseif ( isset( $_POST['sub_format'] ) ) {
102
if ( isset( $_REQUEST['subscriber'] ) ) {
103
$this->format_change( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['format'] );
104
} else {
105
$this->format_change( $_POST['exportcsv'], $_POST['format'] );
106
}
107
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'Format updated for Selected Registered Users!', 'subscribe2' ) . '</strong></p></div>';
108
} elseif ( isset( $_POST['sub_digest'] ) ) {
109
if ( isset( $_REQUEST['subscriber'] ) ) {
110
$this->digest_change( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['sub_category'] );
111
} else {
112
$this->digest_change( $_POST['exportcsv'], $_POST['sub_category'] );
113
}
114
- echo '<div id="message" class="updated fade"><p><strong>' . __( 'Digest Subscription updated for Selected Registered Users!', 'subscribe2' ) . '</strong></p></div>';
115
}
116
}
117
@@ -196,7 +191,7 @@ $s2_list_table->prepare_items();
196
197
// show our form
198
echo '<div class="wrap">';
199
- echo '<h1>' . __( 'Subscribers', 'subscribe2' ) . '</h1>' . "\r\n";
200
$s2tabs = array(
201
'public' => __( 'Public Subscribers', 'subscribe2' ),
202
'registered' => __( 'Registered Subscribers', 'subscribe2' ),
@@ -204,7 +199,7 @@ $s2tabs = array(
204
echo '<h2 class="nav-tab-wrapper">';
205
foreach ( $s2tabs as $tab_key => $tab_caption ) {
206
$active = ( $current_tab === $tab_key ) ? 'nav-tab-active' : '';
207
- echo '<a class="nav-tab ' . $active . '" href="?page=s2_tools&amp;tab=' . $tab_key . '">' . $tab_caption . '</a>';
208
}
209
echo '</h2>';
210
echo '<form method="post">' . "\r\n";
@@ -214,18 +209,18 @@ switch ( $current_tab ) {
214
case 'public':
215
echo '<input type="hidden" id="s2_location" name="s2_location" value="public" />' . "\r\n";
216
echo '<div class="s2_admin" id="s2_add_subscribers">' . "\r\n";
217
- echo '<h2>' . __( 'Add/Remove Subscribers', 'subscribe2' ) . '</h2>' . "\r\n";
218
- echo '<p>' . __( 'Enter addresses, one per line or comma-separated', 'subscribe2' ) . '<br />' . "\r\n";
219
echo '<textarea rows="2" cols="80" name="addresses"></textarea></p>' . "\r\n";
220
echo '<input type="hidden" name="s2_admin" />' . "\r\n";
221
- echo '<p class="submit" style="border-top: none;"><input type="submit" class="button-primary" name="subscribe" value="' . __( 'Subscribe', 'subscribe2' ) . '" />';
222
- echo '&nbsp;<input type="submit" class="button-primary" name="unsubscribe" value="' . __( 'Unsubscribe', 'subscribe2' ) . '" /></p>' . "\r\n";
223
echo '</div>' . "\r\n";
224
225
// subscriber lists
226
echo '<div class="s2_admin" id="s2_current_subscribers">' . "\r\n";
227
- echo '<h2>' . __( 'Current Subscribers', 'subscribe2' ) . '</h2>' . "\r\n";
228
- echo '<br />';
229
$cats = $this->all_cats();
230
$cat_ids = array();
231
foreach ( $cats as $category ) {
@@ -237,15 +232,15 @@ switch ( $current_tab ) {
237
case 'registered':
238
echo '<input type="hidden" id="s2_location" name="s2_location" value="registered" />' . "\r\n";
239
echo '<div class="s2_admin" id="s2_add_subscribers">' . "\r\n";
240
- echo '<h2>' . __( 'Add/Remove Subscribers', 'subscribe2' ) . '</h2>' . "\r\n";
241
- echo '<p class="submit" style="border-top: none;"><a class="button-primary" href="' . admin_url( 'user-new.php' ) . '">' . __( 'Add Registered User', 'subscribe2' ) . '</a></p>' . "\r\n";
242
243
echo "</div>\r\n";
244
245
// subscriber lists
246
echo '<div class="s2_admin" id="s2_current_subscribers">' . "\r\n";
247
- echo '<h2>' . __( 'Current Subscribers', 'subscribe2' ) . '</h2>' . "\r\n";
248
- echo '<br />';
249
$exclude = array( 'all', 'public', 'confirmed', 'unconfirmed' );
250
break;
251
}
@@ -256,8 +251,8 @@ echo '<td style="width: 50%; text-align: left;">';
256
$this->display_subscriber_dropdown( $what, __( 'Filter', 'subscribe2' ), $exclude );
257
echo '</td>' . "\r\n";
258
if ( $reminderform ) {
259
- echo '<td style="width: 25%; text-align: right;"><input type="hidden" name="reminderemails" value="' . $reminderemails . '" />' . "\r\n";
260
- echo '<input type="submit" class="button-secondary" name="remind" value="' . __( 'Send Reminder Email', 'subscribe2' ) . '" /></td>' . "\r\n";
261
} else {
262
echo '<td style="width: 25%;"></td>';
263
}
@@ -270,8 +265,8 @@ if ( ! empty( $subscribers ) ) {
270
( '' === $exportcsv ) ? $exportcsv = $subscriber['user_email'] : $exportcsv .= ",\r\n" . $subscriber['user_email'];
271
}
272
}
273
- echo '<td style="width: 25%; text-align: right;"><input type="hidden" name="exportcsv" value="' . $exportcsv . '" />' . "\r\n";
274
- echo '<input type="submit" class="button-secondary" name="csv" value="' . __( 'Save Emails to CSV File', 'subscribe2' ) . '" /></td>' . "\r\n";
275
} else {
276
echo '<td style="width: 25%;"></td>';
277
}
@@ -285,7 +280,7 @@ echo '</div>' . "\r\n";
285
// show bulk management form if filtered in some Registered Users
286
if ( 'registered' === $current_tab ) {
287
echo '<div class="s2_admin" id="s2_bulk_manage">' . "\r\n";
288
- echo '<h2>' . __( 'Bulk Management', 'subscribe2' ) . '</h2>' . "\r\n";
289
if ( 'never' === $this->subscribe2_options['email_freq'] ) {
290
$categories = array();
291
if ( isset( $_POST['category'] ) ) {
@@ -299,36 +294,36 @@ if ( 'registered' === $current_tab ) {
299
if ( isset( $_POST['format'] ) ) {
300
$format = $_POST['format'];
301
}
302
- echo __( 'Preferences for Registered Users selected above can be changed using this section.', 'subscribe2' ) . '<br />' . "\r\n";
303
- echo '<strong><em style="color: red">' . __( 'Consider User Privacy as changes cannot be undone', 'subscribe2' ) . '</em></strong><br />' . "\r\n";
304
- echo '<br />' . __( 'Action to perform', 'subscribe2' ) . ':' . "\r\n";
305
- echo '<label><input type="radio" name="manage" value="subscribe"' . checked( $manage, 'subscribe', false ) . ' /> ' . __( 'Subscribe', 'subscribe2' ) . '</label>&nbsp;&nbsp;' . "\r\n";
306
- echo '<label><input type="radio" name="manage" value="unsubscribe"' . checked( $manage, 'unsubscribe', false ) . ' /> ' . __( 'Unsubscribe', 'subscribe2' ) . '</label><br /><br />' . "\r\n";
307
if ( '1' === $this->subscribe2_options['reg_override'] ) {
308
$s2_forms->display_category_form( $categories, 1 );
309
} else {
310
$s2_forms->display_category_form( $categories, 0 );
311
}
312
- echo '<p class="submit"><button class="button-primary" name="sub_categories" onclick="return bmCheck();">' . __( 'Bulk Update Categories', 'subscribe2' ) . '</button></p>';
313
- echo '<br />' . __( 'Send email as', 'subscribe2' ) . ':' . "\r\n";
314
- echo '<label><input type="radio" name="format" value="html"' . checked( $format, 'html', false ) . ' /> ' . __( 'HTML - Full', 'subscribe2' ) . '</label>&nbsp;&nbsp;' . "\r\n";
315
- echo '<label><input type="radio" name="format" value="html_excerpt"' . checked( $format, 'html_excerpt', false ) . ' /> ' . __( 'HTML - Excerpt', 'subscribe2' ) . '</label>&nbsp;&nbsp;' . "\r\n";
316
- echo '<label><input type="radio" name="format" value="post"' . checked( $format, 'post', false ) . ' /> ' . __( 'Plain Text - Full', 'subscribe2' ) . '</label>&nbsp;&nbsp;' . "\r\n";
317
- echo '<label><input type="radio" name="format" value="excerpt"' . checked( $format, 'excerpt', false ) . '/> ' . __( 'Plain Text - Excerpt', 'subscribe2' ) . '</label>' . "\r\n";
318
- echo '<p class="submit"><button class="button-primary" name="sub_format" onclick="return bmCheck();">' . __( 'Bulk Update Format', 'subscribe2' ) . '</button></p>';
319
} else {
320
$sub_cats = '';
321
if ( isset( $_POST['sub_category'] ) ) {
322
$sub_cats = $_POST['sub_category'];
323
}
324
- echo __( 'Preferences for Registered Users selected above can be changed using this section.', 'subscribe2' ) . "<br />\r\n";
325
- echo '<strong><em style="color: red">' . __( 'Consider User Privacy as changes cannot be undone.', 'subscribe2' ) . '</em></strong><br />' . "\r\n";
326
- echo '<br />' . __( 'Subscribe Selected Users to receive a periodic digest notification', 'subscribe2' ) . ':' . "\r\n";
327
echo '<label><input type="radio" name="sub_category" value="digest"' . checked( $sub_cats, 'digest', false ) . ' /> ';
328
- echo __( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;' . "\r\n";
329
echo '<label><input type="radio" name="sub_category" value="-1"' . checked( $sub_cats, '-1', false ) . ' /> ';
330
- echo __( 'No', 'subscribe2' ) . '</label>';
331
- echo '<p class="submit"><button class="button-primary" name="sub_digest" onclick="return bmCheck();">' . __( 'Bulk Update Digest Subscription', 'subscribe2' ) . '</button></p>';
332
}
333
echo '</div>' . "\r\n";
334
}
17
require_once ABSPATH . 'wp-admin/includes/class-wp-list-table.php';
18
}
19
if ( ! class_exists( 'Subscribe2_List_Table' ) ) {
20
+ require_once S2PATH . 'classes/class-s2-list-table.php';
21
+ $s2_list_table = new S2_List_Table();
22
}
23
24
// was anything POSTed ?
25
if ( isset( $_POST['s2_admin'] ) ) {
26
if ( false === wp_verify_nonce( $_REQUEST['_wpnonce'], 'bulk-' . $s2_list_table->_args['plural'] ) ) {
27
+ die( '<p>' . esc_html__( 'Security error! Your request cannot be completed.', 'subscribe2' ) . '</p>' );
28
}
29
30
if ( ! empty( $_POST['addresses'] ) ) {
49
continue;
50
}
51
$this->add( $clean_email, true );
52
+ $message = __( 'Address(es) subscribed!', 'subscribe2' );
53
} elseif ( isset( $_POST['unsubscribe'] ) ) {
54
if ( false === $this->is_public( $clean_email ) || $this->is_registered( $clean_email ) ) {
55
( '' === $unsub_error ) ? $unsub_error = "$clean_email" : $unsub_error .= ", $clean_email";
56
continue;
57
}
58
$this->delete( $clean_email );
59
+ $message = __( 'Address(es) unsubscribed!', 'subscribe2' );
60
}
61
}
62
}
63
if ( '' !== $reg_sub_error ) {
64
+ echo '<div id="message" class="error"><p><strong>' . esc_html__( 'Some emails were not processed, the following are already Registered Subscribers', 'subscribe2' ) . ':<br>' . esc_html( $reg_sub_error ) . '</strong></p></div>';
65
}
66
if ( '' !== $pub_sub_error ) {
67
+ echo '<div id="message" class="error"><p><strong>' . esc_html__( 'Some emails were not processed, the following are already Public Subscribers', 'subscribe2' ) . ':<br>' . esc_html( $pub_sub_error ) . '</strong></p></div>';
68
}
69
if ( '' !== $unsub_error ) {
70
+ echo '<div id="message" class="error"><p><strong>' . esc_html__( 'Some emails were not processed, the following were not in the database', 'subscribe2' ) . ':<br> ' . esc_html( $unsub_error ) . '</strong></p></div>';
71
}
72
if ( '' !== $email_error ) {
73
+ echo '<div id="message" class="error"><p><strong>' . esc_html__( 'Some emails were not processed, the following were invalid email addresses', 'subscribe2' ) . ':<br> ' . esc_html( $email_error ) . '</strong></p></div>';
74
}
75
if ( '' !== $message ) {
76
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html( $message ) . '</strong></p></div>';
77
}
78
$_POST['what'] = 'confirmed';
79
} elseif ( isset( $_POST['remind'] ) ) {
80
$this->remind( $_POST['reminderemails'] );
81
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Reminder Email(s) Sent!', 'subscribe2' ) . '</strong></p></div>';
82
} elseif ( isset( $_POST['sub_categories'] ) && 'subscribe' === $_POST['manage'] ) {
83
if ( isset( $_REQUEST['subscriber'] ) ) {
84
$this->subscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['category'] );
85
} else {
86
$this->subscribe_registered_users( $_POST['exportcsv'], $_POST['category'] );
87
}
88
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Registered Users Subscribed!', 'subscribe2' ) . '</strong></p></div>';
89
} elseif ( isset( $_POST['sub_categories'] ) && 'unsubscribe' === $_POST['manage'] ) {
90
if ( isset( $_REQUEST['subscriber'] ) ) {
91
$this->unsubscribe_registered_users( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['category'] );
92
} else {
93
$this->unsubscribe_registered_users( $_POST['exportcsv'], $_POST['category'] );
94
}
95
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Registered Users Unsubscribed!', 'subscribe2' ) . '</strong></p></div>';
96
} elseif ( isset( $_POST['sub_format'] ) ) {
97
if ( isset( $_REQUEST['subscriber'] ) ) {
98
$this->format_change( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['format'] );
99
} else {
100
$this->format_change( $_POST['exportcsv'], $_POST['format'] );
101
}
102
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Format updated for Selected Registered Users!', 'subscribe2' ) . '</strong></p></div>';
103
} elseif ( isset( $_POST['sub_digest'] ) ) {
104
if ( isset( $_REQUEST['subscriber'] ) ) {
105
$this->digest_change( implode( ",\r\n", $_REQUEST['subscriber'] ), $_POST['sub_category'] );
106
} else {
107
$this->digest_change( $_POST['exportcsv'], $_POST['sub_category'] );
108
}
109
+ echo '<div id="message" class="updated fade"><p><strong>' . esc_html__( 'Digest Subscription updated for Selected Registered Users!', 'subscribe2' ) . '</strong></p></div>';
110
}
111
}
112
191
192
// show our form
193
echo '<div class="wrap">';
194
+ echo '<h1>' . esc_html__( 'Subscribers', 'subscribe2' ) . '</h1>' . "\r\n";
195
$s2tabs = array(
196
'public' => __( 'Public Subscribers', 'subscribe2' ),
197
'registered' => __( 'Registered Subscribers', 'subscribe2' ),
199
echo '<h2 class="nav-tab-wrapper">';
200
foreach ( $s2tabs as $tab_key => $tab_caption ) {
201
$active = ( $current_tab === $tab_key ) ? 'nav-tab-active' : '';
202
+ echo '<a class="nav-tab ' . esc_attr( $active ) . '" href="' . esc_url( '?page=s2_tools&amp;tab=' . $tab_key ) . '">' . esc_html( $tab_caption ) . '</a>';
203
}
204
echo '</h2>';
205
echo '<form method="post">' . "\r\n";
209
case 'public':
210
echo '<input type="hidden" id="s2_location" name="s2_location" value="public" />' . "\r\n";
211
echo '<div class="s2_admin" id="s2_add_subscribers">' . "\r\n";
212
+ echo '<h2>' . esc_html__( 'Add/Remove Subscribers', 'subscribe2' ) . '</h2>' . "\r\n";
213
+ echo '<p>' . esc_html__( 'Enter addresses, one per line or comma-separated', 'subscribe2' ) . '<br>' . "\r\n";
214
echo '<textarea rows="2" cols="80" name="addresses"></textarea></p>' . "\r\n";
215
echo '<input type="hidden" name="s2_admin" />' . "\r\n";
216
+ echo '<p class="submit" style="border-top: none;"><input type="submit" class="button-primary" name="subscribe" value="' . esc_attr( __( 'Subscribe', 'subscribe2' ) ) . '" />';
217
+ echo '&nbsp;<input type="submit" class="button-primary" name="unsubscribe" value="' . esc_attr( __( 'Unsubscribe', 'subscribe2' ) ) . '" /></p>' . "\r\n";
218
echo '</div>' . "\r\n";
219
220
// subscriber lists
221
echo '<div class="s2_admin" id="s2_current_subscribers">' . "\r\n";
222
+ echo '<h2>' . esc_html__( 'Current Subscribers', 'subscribe2' ) . '</h2>' . "\r\n";
223
+ echo '<br>';
224
$cats = $this->all_cats();
225
$cat_ids = array();
226
foreach ( $cats as $category ) {
232
case 'registered':
233
echo '<input type="hidden" id="s2_location" name="s2_location" value="registered" />' . "\r\n";
234
echo '<div class="s2_admin" id="s2_add_subscribers">' . "\r\n";
235
+ echo '<h2>' . esc_html__( 'Add/Remove Subscribers', 'subscribe2' ) . '</h2>' . "\r\n";
236
+ echo '<p class="submit" style="border-top: none;"><a class="button-primary" href="' . esc_url( admin_url( 'user-new.php' ) ) . '">' . esc_html__( 'Add Registered User', 'subscribe2' ) . '</a></p>' . "\r\n";
237
238
echo "</div>\r\n";
239
240
// subscriber lists
241
echo '<div class="s2_admin" id="s2_current_subscribers">' . "\r\n";
242
+ echo '<h2>' . esc_html__( 'Current Subscribers', 'subscribe2' ) . '</h2>' . "\r\n";
243
+ echo '<br>';
244
$exclude = array( 'all', 'public', 'confirmed', 'unconfirmed' );
245
break;
246
}
251
$this->display_subscriber_dropdown( $what, __( 'Filter', 'subscribe2' ), $exclude );
252
echo '</td>' . "\r\n";
253
if ( $reminderform ) {
254
+ echo '<td style="width: 25%; text-align: right;"><input type="hidden" name="reminderemails" value="' . esc_attr( $reminderemails ) . '" />' . "\r\n";
255
+ echo '<input type="submit" class="button-secondary" name="remind" value="' . esc_attr( __( 'Send Reminder Email', 'subscribe2' ) ) . '" /></td>' . "\r\n";
256
} else {
257
echo '<td style="width: 25%;"></td>';
258
}
265
( '' === $exportcsv ) ? $exportcsv = $subscriber['user_email'] : $exportcsv .= ",\r\n" . $subscriber['user_email'];
266
}
267
}
268
+ echo '<td style="width: 25%; text-align: right;"><input type="hidden" name="exportcsv" value="' . esc_attr( $exportcsv ) . '" />' . "\r\n";
269
+ echo '<input type="submit" class="button-secondary" name="csv" value="' . esc_attr( __( 'Save Emails to CSV File', 'subscribe2' ) ) . '" /></td>' . "\r\n";
270
} else {
271
echo '<td style="width: 25%;"></td>';
272
}
280
// show bulk management form if filtered in some Registered Users
281
if ( 'registered' === $current_tab ) {
282
echo '<div class="s2_admin" id="s2_bulk_manage">' . "\r\n";
283
+ echo '<h2>' . esc_html__( 'Bulk Management', 'subscribe2' ) . '</h2>' . "\r\n";
284
if ( 'never' === $this->subscribe2_options['email_freq'] ) {
285
$categories = array();
286
if ( isset( $_POST['category'] ) ) {
294
if ( isset( $_POST['format'] ) ) {
295
$format = $_POST['format'];
296
}
297
+ echo esc_html__( 'Preferences for Registered Users selected above can be changed using this section.', 'subscribe2' ) . '<br>' . "\r\n";
298
+ echo '<strong><em style="color: red">' . esc_html__( 'Consider User Privacy as changes cannot be undone', 'subscribe2' ) . '</em></strong><br>' . "\r\n";
299
+ echo '<br>' . esc_html__( 'Action to perform', 'subscribe2' ) . ':' . "\r\n";
300
+ echo '<label><input type="radio" name="manage" value="subscribe"' . checked( $manage, 'subscribe', false ) . ' /> ' . esc_html__( 'Subscribe', 'subscribe2' ) . '</label>&nbsp;&nbsp;' . "\r\n";
301
+ echo '<label><input type="radio" name="manage" value="unsubscribe"' . checked( $manage, 'unsubscribe', false ) . ' /> ' . esc_html__( 'Unsubscribe', 'subscribe2' ) . '</label><br><br>' . "\r\n";
302
if ( '1' === $this->subscribe2_options['reg_override'] ) {
303
$s2_forms->display_category_form( $categories, 1 );
304
} else {
305
$s2_forms->display_category_form( $categories, 0 );
306
}
307
+ echo '<p class="submit"><button class="button-primary" name="sub_categories" onclick="return bmCheck();">' . esc_html__( 'Bulk Update Categories', 'subscribe2' ) . '</button></p>';
308
+ echo '<br>' . esc_html__( 'Send email as', 'subscribe2' ) . ':' . "\r\n";
309
+ echo '<label><input type="radio" name="format" value="html"' . checked( $format, 'html', false ) . ' /> ' . esc_html__( 'HTML - Full', 'subscribe2' ) . '</label>&nbsp;&nbsp;' . "\r\n";
310
+ echo '<label><input type="radio" name="format" value="html_excerpt"' . checked( $format, 'html_excerpt', false ) . ' /> ' . esc_html__( 'HTML - Excerpt', 'subscribe2' ) . '</label>&nbsp;&nbsp;' . "\r\n";
311
+ echo '<label><input type="radio" name="format" value="post"' . checked( $format, 'post', false ) . ' /> ' . esc_html__( 'Plain Text - Full', 'subscribe2' ) . '</label>&nbsp;&nbsp;' . "\r\n";
312
+ echo '<label><input type="radio" name="format" value="excerpt"' . checked( $format, 'excerpt', false ) . '/> ' . esc_html__( 'Plain Text - Excerpt', 'subscribe2' ) . '</label>' . "\r\n";
313
+ echo '<p class="submit"><button class="button-primary" name="sub_format" onclick="return bmCheck();">' . esc_html__( 'Bulk Update Format', 'subscribe2' ) . '</button></p>';
314
} else {
315
$sub_cats = '';
316
if ( isset( $_POST['sub_category'] ) ) {
317
$sub_cats = $_POST['sub_category'];
318
}
319
+ echo esc_html__( 'Preferences for Registered Users selected above can be changed using this section.', 'subscribe2' ) . "<br>\r\n";
320
+ echo '<strong><em style="color: red">' . esc_html__( 'Consider User Privacy as changes cannot be undone.', 'subscribe2' ) . '</em></strong><br>' . "\r\n";
321
+ echo '<br>' . esc_html__( 'Subscribe Selected Users to receive a periodic digest notification', 'subscribe2' ) . ':' . "\r\n";
322
echo '<label><input type="radio" name="sub_category" value="digest"' . checked( $sub_cats, 'digest', false ) . ' /> ';
323
+ echo esc_html__( 'Yes', 'subscribe2' ) . '</label>&nbsp;&nbsp;' . "\r\n";
324
echo '<label><input type="radio" name="sub_category" value="-1"' . checked( $sub_cats, '-1', false ) . ' /> ';
325
+ echo esc_html__( 'No', 'subscribe2' ) . '</label>';
326
+ echo '<p class="submit"><button class="button-primary" name="sub_digest" onclick="return bmCheck();">' . esc_html__( 'Bulk Update Digest Subscription', 'subscribe2' ) . '</button></p>';
327
}
328
echo '</div>' . "\r\n";
329
}
admin/your-subscriptions.php CHANGED
@@ -10,7 +10,7 @@ $s2_forms->init();
10
// was anything POSTed?
11
if ( isset( $_POST['s2_admin'] ) && 'user' === $_POST['s2_admin'] ) {
12
if ( false === wp_verify_nonce( $_REQUEST['_wpnonce'], 'subscribe2-user_subscribers' . S2VERSION ) ) {
13
- die( '<p>' . __( 'Security error! Your request cannot be completed.', 'subscribe2' ) . '</p>' );
14
}
15
do_action( 's2_subscription_submit' );
16
}
@@ -23,9 +23,9 @@ $userid = $s2_forms->get_userid();
23
$user = get_userdata( $userid );
24
25
if ( $userid === $user_ID ) {
26
- echo '<h1>' . __( 'Your Notification Settings', 'subscribe2' ) . "</h1>\r\n";
27
} else {
28
- echo '<h1>' . __( 'Notification Settings for user:', 'subscribe2' ) . ' <span style="color: red;">' . $user->display_name . '</span></h1>' . "\r\n";
29
}
30
31
@@ -37,7 +37,7 @@ echo '<p>';
37
do_action( 's2_subscription_form', $userid );
38
39
// submit
40
- echo '<p class="submit"><input type="submit" class="button-primary" name="submit" value="' . __( 'Update Preferences', 'subscribe2' ) . ' &raquo;" /></p>';
41
echo '</form>' . "\r\n";
42
43
echo '</div>' . "\r\n";
10
// was anything POSTed?
11
if ( isset( $_POST['s2_admin'] ) && 'user' === $_POST['s2_admin'] ) {
12
if ( false === wp_verify_nonce( $_REQUEST['_wpnonce'], 'subscribe2-user_subscribers' . S2VERSION ) ) {
13
+ die( '<p>' . esc_html__( 'Security error! Your request cannot be completed.', 'subscribe2' ) . '</p>' );
14
}
15
do_action( 's2_subscription_submit' );
16
}
23
$user = get_userdata( $userid );
24
25
if ( $userid === $user_ID ) {
26
+ echo '<h1>' . esc_html__( 'Your Notification Settings', 'subscribe2' ) . "</h1>\r\n";
27
} else {
28
+ echo '<h1>' . esc_html__( 'Notification Settings for user:', 'subscribe2' ) . ' <span style="color: red;">' . esc_html( $user->display_name ) . '</span></h1>' . "\r\n";
29
}
30
31
37
do_action( 's2_subscription_form', $userid );
38
39
// submit
40
+ echo '<p class="submit"><input type="submit" class="button-primary" name="submit" value="' . esc_attr( __( 'Update Preferences', 'subscribe2' ) ) . ' &raquo;" /></p>';
41
echo '</form>' . "\r\n";
42
43
echo '</div>' . "\r\n";
classes/class-s2-admin.php CHANGED
@@ -135,7 +135,7 @@ class S2_Admin extends S2_Core {
135
'id' => 's2-settings-help4',
136
'title' => __( 'Registered Users', 'subscribe2' ),
137
'content' => '<p>' . __( 'This section allows settings that apply to Registered Subscribers to be configured.', 'subscribe2' ) .
138
- '</p><p>' . __( 'Categories can be made compulsory so emails are always sent for posts in these categories. They can also be excludes so that emails are not generated. Excluded categories take precedence over Compulsory categories.', 'subscribe2' ) .
139
'</p><p>' . __( 'A set of default settings for new users can also be specified using the Auto Subscribe section. Settings specified here will be applied to any newly created user accounts while Subscribe2 is activated.', 'subscribe2' ) . '</p>',
140
)
141
);
@@ -148,21 +148,11 @@ class S2_Admin extends S2_Core {
148
'</p><p>' . __( 'The email over ride check box can be set to be automatically checked for every new post and page from here to, this may be useful if you will only want to send very occasional notifications for specific posts. You can then uncheck this box just before you publish your content.', 'subscribe2' ) . '</p>',
149
)
150
);
151
- $screen->add_help_tab(
152
- array(
153
- 'id' => 's2-settings-help6',
154
- 'title' => __( 'ReCaptcha', 'subscribe2' ),
155
- 'content' => '<p>' . __( 'This section holds site and secret keys for using Google ReCaptcha.', 'subscribe2' ) .
156
- '</p><p>' . __( 'V2 ReCaptcha takes precedence over Invisible ReCaptcha. To use Invisible ReCaptcha, leave the V2 ReCaptcha key fields empty.', 'subscribe2' ) .
157
- '</p><p>' . __( 'Both key files needs populating for V2 ReCaptcha or Invisible ReCaptcha, failure to complete both fields will result in ReCaptcha not working.', 'subscribe2' ) . '</p>',
158
- )
159
- );
160
$screen->add_help_tab(
161
array(
162
'id' => 's2-settings-help7',
163
'title' => __( 'Miscellaneous', 'subscribe2' ),
164
'content' => '<p>' . __( 'This section contains a place to bar specified domains from becoming Public Subscribers and links to help and support pages.', 'subscribe2' ) .
165
- '</p><p>' . __( 'In the paid Subscribe2 HTML version there is also a place here to enter a license code so that updates can be accessed automatically.', 'subscribe2' ) .
166
'</p>',
167
)
168
);
@@ -257,7 +247,6 @@ class S2_Admin extends S2_Core {
257
public function plugin_links( $links, $file ) {
258
if ( S2DIR . 'subscribe2.php' === $file ) {
259
$links[] = '<a href="admin.php?page=s2_settings">' . __( 'Settings', 'subscribe2' ) . '</a>';
260
- $links[] = '<a href="https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&amp;hosted_button_id=2387904"><b>' . __( 'Donate', 'subscribe2' ) . '</b></a>';
261
}
262
return $links;
263
}
@@ -316,12 +305,7 @@ class S2_Admin extends S2_Core {
316
* Add buttons for Rich Text Editor
317
*/
318
public function mce_plugin( $arr ) {
319
- if ( version_compare( $this->wp_release, '3.9', '<' ) ) {
320
- $path = S2URL . 'tinymce/editor-plugin3' . $this->script_debug . '.js';
321
- } else {
322
- $path = S2URL . 'tinymce/editor-plugin4' . $this->script_debug . '.js';
323
- }
324
- $arr['subscribe2'] = $path;
325
return $arr;
326
}
327
@@ -413,8 +397,8 @@ class S2_Admin extends S2_Core {
413
public function s2_override_meta() {
414
global $post_ID;
415
$s2mail = get_post_meta( $post_ID, '_s2mail', true );
416
- echo '<input type="hidden" name="s2meta_nonce" id="s2meta_nonce" value="' . wp_create_nonce( wp_hash( plugin_basename( __FILE__ ) ) ) . '" />';
417
- echo __( 'Check here to disable sending of an email notification for this post/page', 'subscribe2' );
418
echo '&nbsp;&nbsp;<input type="checkbox" name="s2_meta_field" value="no"';
419
if ( 'no' === $s2mail || ( '1' === $this->subscribe2_options['s2meta_default'] && '' === $s2mail ) ) {
420
echo ' checked="checked"';
@@ -451,8 +435,8 @@ class S2_Admin extends S2_Core {
451
* Meta preview box code
452
*/
453
public function s2_preview_meta() {
454
- echo '<p>' . __( 'Send preview email of this post to currently logged in user:', 'subscribe2' ) . '</p>' . "\r\n";
455
- echo '<input class="button" name="s2_preview" type="submit" value="' . __( 'Send Preview', 'subscribe2' ) . '" />' . "\r\n";
456
}
457
458
/**
@@ -464,7 +448,11 @@ class S2_Admin extends S2_Core {
464
return;
465
}
466
global $post, $current_user;
467
- $this->publish( $post, $current_user->user_email );
468
}
469
}
470
@@ -472,8 +460,8 @@ class S2_Admin extends S2_Core {
472
* Meta resend box code
473
*/
474
public function s2_resend_meta() {
475
- echo '<p>' . __( 'Resend the notification email of this post to current subscribers:', 'subscribe2' ) . '</p>' . "\r\n";
476
- echo '<input class="button" name="s2_resend" type="submit" value="' . __( 'Resend Notification', 'subscribe2' ) . '" />' . "\r\n";
477
}
478
479
/**
@@ -605,7 +593,7 @@ class S2_Admin extends S2_Core {
605
$j = 0;
606
echo '<table style="width: 100%; border-collapse: separate; border-spacing: 2px; *border-collapse: expression(\'separate\', cellSpacing = \'2px\');" class="editform">' . "\r\n";
607
echo '<tr><td style="text-align: left;" colspan="2">' . "\r\n";
608
- echo '<label><input type="checkbox" name="checkall" value="checkall_format" /> ' . __( 'Select / Unselect All', 'subscribe2' ) . '</label>' . "\r\n";
609
echo '</td></tr>' . "\r\n";
610
echo '<tr style="vertical-align: top;"><td style="width: 50%; text-align: left">' . "\r\n";
611
foreach ( $formats[0] as $format ) {
@@ -615,17 +603,17 @@ class S2_Admin extends S2_Core {
615
}
616
617
if ( 0 === $j ) {
618
- echo '<label><input class="checkall_format" type="checkbox" name="format[]" value="' . $format . '"';
619
if ( in_array( $format, $selected, true ) ) {
620
echo ' checked="checked"';
621
}
622
- echo ' /> ' . ucwords( $format ) . '</label><br />' . "\r\n";
623
} else {
624
- echo '<label><input class="checkall_format" type="checkbox" name="format[]" value="' . $format . '"';
625
if ( in_array( $format, $selected, true ) ) {
626
echo ' checked="checked"';
627
}
628
- echo ' /> ' . ucwords( $format ) . '</label><br />' . "\r\n";
629
}
630
$i++;
631
}
@@ -701,11 +689,11 @@ class S2_Admin extends S2_Core {
701
continue;
702
}
703
704
- echo '<option value="' . $whom . '"';
705
if ( $whom === $selected ) {
706
echo ' selected="selected" ';
707
}
708
- echo '>' . $display . ' (' . ( $count[ $whom ] ) . ')</option>' . "\r\n";
709
}
710
711
if ( 'public' !== $current_tab && $count['registered'] > 0 && 'never' === $this->subscribe2_options['email_freq'] ) {
@@ -713,17 +701,17 @@ class S2_Admin extends S2_Core {
713
if ( in_array( (string) $cat->term_id, $exclude, true ) ) {
714
continue;
715
}
716
- echo '<option value="' . $cat->term_id . '"';
717
if ( $cat->term_id === $selected ) {
718
echo ' selected="selected" ';
719
}
720
- echo '> &nbsp;&nbsp;' . $cat->name . '&nbsp;(' . $count[ $cat->name ] . ') </option>' . "\r\n";
721
}
722
}
723
724
echo '</select>';
725
if ( false !== $submit ) {
726
- echo '&nbsp;<input type="submit" class="button-secondary" value="' . $submit . '" />' . "\r\n";
727
}
728
}
729
@@ -763,15 +751,27 @@ class S2_Admin extends S2_Core {
763
$admins = array_merge( $author, $admins );
764
}
765
766
- echo '<select name="sender">' . "\r\n";
767
foreach ( $admins as $admin ) {
768
- echo '<option value="' . $admin->ID . '"';
769
if ( $admin->ID === $this->subscribe2_options['sender'] ) {
770
- echo ' selected="selected"';
771
}
772
- echo '>' . $admin->display_name . '</option>' . "\r\n";
773
}
774
- echo '</select>' . "\r\n";
775
}
776
777
/**
@@ -782,7 +782,7 @@ class S2_Admin extends S2_Core {
782
global $wpdb;
783
$cron_file = ABSPATH . 'wp-cron.php';
784
if ( ! is_readable( $cron_file ) ) {
785
- echo '<strong><em style="color: red">' . __( 'The WordPress cron functions may be disabled on this server. Digest notifications may not work.', 'subscribe2' ) . '</em></strong><br />' . "\r\n";
786
}
787
$scheduled_time = wp_next_scheduled( 's2_digest_cron' );
788
$offset = get_option( 'gmt_offset' ) * 60 * 60;
@@ -807,43 +807,43 @@ class S2_Admin extends S2_Core {
807
$schedule_sorted[ $key ] = $schedule[ $key ];
808
}
809
foreach ( $schedule_sorted as $key => $value ) {
810
- echo '<label><input type="radio" name="email_freq" value="' . $key . '"' . checked( $this->subscribe2_options['email_freq'], $key, false ) . ' />';
811
- echo ' ' . $value['display'] . '</label><br />' . "\r\n";
812
}
813
if ( $scheduled_time ) {
814
$date_format = get_option( 'date_format' );
815
$time_format = get_option( 'time_format' );
816
- echo '<p>' . __( 'Current UTC time is', 'subscribe2' ) . ': ' . "\r\n";
817
- echo '<strong>' . date_i18n( $date_format . ' @ ' . $time_format, false, 'gmt' ) . '</strong></p>' . "\r\n";
818
- echo '<p>' . __( 'Current blog time is', 'subscribe2' ) . ': ' . "\r\n";
819
- echo '<strong>' . date_i18n( $date_format . ' @ ' . $time_format ) . '</strong></p>' . "\r\n";
820
- echo '<p>' . __( 'Next email notification will be sent when your blog time is after', 'subscribe2' ) . ': ' . "\r\n";
821
- echo '<input type="hidden" id="jscrondate" value="' . date_i18n( $date_format, $scheduled_time + $offset ) . '" />';
822
- echo '<input type="hidden" id="jscrontime" value="' . date_i18n( $time_format, $scheduled_time + $offset ) . '" />';
823
- echo '<span id="s2cron_1"><span id="s2crondate" style="background-color: #FFFBCC">' . date_i18n( $date_format, $scheduled_time + $offset ) . '</span>';
824
- echo ' @ <span id="s2crontime" style="background-color: #FFFBCC">' . date_i18n( $time_format, $scheduled_time + $offset ) . '</span> ';
825
- echo '<a href="#" onclick="s2Show(\'cron\'); return false;">' . __( 'Edit', 'subscribe2' ) . '</a></span>' . "\r\n";
826
echo '<span id="s2cron_2">' . "\r\n";
827
- echo '<input id="s2datepicker" name="crondate" value="' . date_i18n( $date_format, $scheduled_time + $offset ) . '">' . "\r\n";
828
$hours = array( '12:00 am', '1:00 am', '2:00 am', '3:00 am', '4:00 am', '5:00 am', '6:00 am', '7:00 am', '8:00 am', '9:00 am', '10:00 am', '11:00 am', '12:00 pm', '1:00 pm', '2:00 pm', '3:00 pm', '4:00 pm', '5:00 pm', '6:00 pm', '7:00 pm', '8:00 pm', '9:00 pm', '10:00 pm', '11:00 pm' );
829
$current_hour = intval( date_i18n( 'G', $scheduled_time + $offset ) );
830
echo '<select name="crontime">' . "\r\n";
831
foreach ( $hours as $key => $value ) {
832
- echo '<option value="' . $key . '"';
833
if ( ! empty( $scheduled_time ) && $key === $current_hour ) {
834
echo ' selected="selected"';
835
}
836
- echo '>' . $value . '</option>' . "\r\n";
837
}
838
echo '</select>' . "\r\n";
839
- echo '<a href="#" onclick="s2CronUpdate(\'cron\'); return false;">' . __( 'Update', 'subscribe2' ) . '</a>' . "\r\n";
840
- echo '<a href="#" onclick="s2CronRevert(\'cron\'); return false;">' . __( 'Revert', 'subscribe2' ) . '</a></span>' . "\r\n";
841
if ( ! empty( $this->subscribe2_options['last_s2cron'] ) ) {
842
- echo '<p>' . __( 'Attempt to resend the last Digest Notification email', 'subscribe2' ) . ': ';
843
- echo '<input type="submit" class="button-secondary" name="resend" value="' . __( 'Resend Digest', 'subscribe2' ) . '" /></p>' . "\r\n";
844
}
845
} else {
846
- echo '<br />';
847
}
848
}
849
@@ -856,7 +856,8 @@ class S2_Admin extends S2_Core {
856
return;
857
}
858
859
- $option = '';
860
foreach ( $pages as $page ) {
861
$option .= '<option value="' . $page->ID . '"';
862
if ( $page->ID === $s2page ) {
@@ -871,8 +872,19 @@ class S2_Admin extends S2_Core {
871
}
872
$option .= $page->post_title . '</option>' . "\r\n";
873
}
874
875
- echo $option;
876
}
877
878
/**
@@ -1116,11 +1128,11 @@ class S2_Admin extends S2_Core {
1116
* Show form for one-click subscription on user profile page
1117
*/
1118
public function one_click_profile_form( $user ) {
1119
- echo '<h3>' . __( 'Email subscription', 'subscribe2' ) . '</h3>' . "\r\n";
1120
echo '<table class="form-table">' . "\r\n";
1121
- echo '<tr><th scope="row">' . __( 'Subscribe / Unsubscribe', 'subscribe2' ) . '</th>' . "\r\n";
1122
- echo '<td><label><input type="checkbox" name="sub2-one-click-subscribe" value="1" ' . checked( ! get_user_meta( $user->ID, $this->get_usermeta_keyname( 's2_subscribed' ), true ), false, false ) . ' /> ' . __( 'Receive notifications', 'subscribe2' ) . '</label><br />' . "\r\n";
1123
- echo '<span class="description">' . __( 'Check if you want to receive email notification when new posts are published', 'subscribe2' ) . '</span>' . "\r\n";
1124
echo '</td></tr></table>' . "\r\n";
1125
}
1126
@@ -1159,4 +1171,13 @@ class S2_Admin extends S2_Core {
1159
$this->subscribe2_cron( '', 'resend' );
1160
}
1161
}
1162
}
135
'id' => 's2-settings-help4',
136
'title' => __( 'Registered Users', 'subscribe2' ),
137
'content' => '<p>' . __( 'This section allows settings that apply to Registered Subscribers to be configured.', 'subscribe2' ) .
138
+ '</p><p>' . __( 'Categories can be made compulsory so emails are always sent to Public and Registered Subscribers for posts in these categories. They can also be excluded so that emails are not generated for Subscribers. Registered Subscribers can be allowed to bypass category exclusions. Excluded categories take precedence over Compulsory categories.', 'subscribe2' ) .
139
'</p><p>' . __( 'A set of default settings for new users can also be specified using the Auto Subscribe section. Settings specified here will be applied to any newly created user accounts while Subscribe2 is activated.', 'subscribe2' ) . '</p>',
140
)
141
);
148
'</p><p>' . __( 'The email over ride check box can be set to be automatically checked for every new post and page from here to, this may be useful if you will only want to send very occasional notifications for specific posts. You can then uncheck this box just before you publish your content.', 'subscribe2' ) . '</p>',
149
)
150
);
151
$screen->add_help_tab(
152
array(
153
'id' => 's2-settings-help7',
154
'title' => __( 'Miscellaneous', 'subscribe2' ),
155
'content' => '<p>' . __( 'This section contains a place to bar specified domains from becoming Public Subscribers and links to help and support pages.', 'subscribe2' ) .
156
'</p>',
157
)
158
);
247
public function plugin_links( $links, $file ) {
248
if ( S2DIR . 'subscribe2.php' === $file ) {
249
$links[] = '<a href="admin.php?page=s2_settings">' . __( 'Settings', 'subscribe2' ) . '</a>';
250
}
251
return $links;
252
}
305
* Add buttons for Rich Text Editor
306
*/
307
public function mce_plugin( $arr ) {
308
+ $arr['subscribe2'] = S2URL . 'tinymce/editor-plugin4' . $this->script_debug . '.js';
309
return $arr;
310
}
311
397
public function s2_override_meta() {
398
global $post_ID;
399
$s2mail = get_post_meta( $post_ID, '_s2mail', true );
400
+ echo '<input type="hidden" name="s2meta_nonce" id="s2meta_nonce" value="' . esc_attr( wp_create_nonce( wp_hash( plugin_basename( __FILE__ ) ) ) ) . '" />';
401
+ echo esc_html__( 'Check here to disable sending of an email notification for this post/page', 'subscribe2' );
402
echo '&nbsp;&nbsp;<input type="checkbox" name="s2_meta_field" value="no"';
403
if ( 'no' === $s2mail || ( '1' === $this->subscribe2_options['s2meta_default'] && '' === $s2mail ) ) {
404
echo ' checked="checked"';
435
* Meta preview box code
436
*/
437
public function s2_preview_meta() {
438
+ echo '<p>' . esc_html__( 'Send preview email of this post to currently logged in user:', 'subscribe2' ) . '</p>' . "\r\n";
439
+ echo '<input class="button" name="s2_preview" type="submit" value="' . esc_attr( __( 'Send Preview', 'subscribe2' ) ) . '" />' . "\r\n";
440
}
441
442
/**
448
return;
449
}
450
global $post, $current_user;
451
+ if ( 'never' !== $this->subscribe2_options['email_freq'] ) {
452
+ $this->subscribe2_cron( $current_user->user_email );
453
+ } else {
454
+ $this->publish( $post, $current_user->user_email );
455
+ }
456
}
457
}
458
460
* Meta resend box code
461
*/
462
public function s2_resend_meta() {
463
+ echo '<p>' . esc_html__( 'Resend the notification email of this post to current subscribers:', 'subscribe2' ) . '</p>' . "\r\n";
464
+ echo '<input class="button" name="s2_resend" type="submit" value="' . esc_attr( __( 'Resend Notification', 'subscribe2' ) ) . '" />' . "\r\n";
465
}
466
467
/**
593
$j = 0;
594
echo '<table style="width: 100%; border-collapse: separate; border-spacing: 2px; *border-collapse: expression(\'separate\', cellSpacing = \'2px\');" class="editform">' . "\r\n";
595
echo '<tr><td style="text-align: left;" colspan="2">' . "\r\n";
596
+ echo '<label><input type="checkbox" name="checkall" value="checkall_format" /> ' . esc_html__( 'Select / Unselect All', 'subscribe2' ) . '</label>' . "\r\n";
597
echo '</td></tr>' . "\r\n";
598
echo '<tr style="vertical-align: top;"><td style="width: 50%; text-align: left">' . "\r\n";
599
foreach ( $formats[0] as $format ) {
603
}
604
605
if ( 0 === $j ) {
606
+ echo '<label><input class="checkall_format" type="checkbox" name="format[]" value="' . esc_attr( $format ) . '"';
607
if ( in_array( $format, $selected, true ) ) {
608
echo ' checked="checked"';
609
}
610
+ echo ' /> ' . esc_html( ucwords( $format ) ) . '</label><br>' . "\r\n";
611
} else {
612
+ echo '<label><input class="checkall_format" type="checkbox" name="format[]" value="' . esc_attr( $format ) . '"';
613
if ( in_array( $format, $selected, true ) ) {
614
echo ' checked="checked"';
615
}
616
+ echo ' /> ' . esc_html( ucwords( $format ) ) . '</label><br>' . "\r\n";
617
}
618
$i++;
619
}
689
continue;
690
}
691
692
+ echo '<option value="' . esc_attr( $whom ) . '"';
693
if ( $whom === $selected ) {
694
echo ' selected="selected" ';
695
}
696
+ echo '>' . esc_html( $display ) . ' (' . esc_html( $count[ $whom ] ) . ')</option>' . "\r\n";
697
}
698
699
if ( 'public' !== $current_tab && $count['registered'] > 0 && 'never' === $this->subscribe2_options['email_freq'] ) {
701
if ( in_array( (string) $cat->term_id, $exclude, true ) ) {
702
continue;
703
}
704
+ echo '<option value="' . esc_attr( $cat->term_id ) . '"';
705
if ( $cat->term_id === $selected ) {
706
echo ' selected="selected" ';
707
}
708
+ echo '> &nbsp;&nbsp;' . esc_html( $cat->name ) . '&nbsp;(' . esc_html( $count[ $cat->name ] ) . ') </option>' . "\r\n";
709
}
710
}
711
712
echo '</select>';
713
if ( false !== $submit ) {
714
+ echo '&nbsp;<input type="submit" class="button-secondary" value="' . esc_attr( $submit ) . '" />' . "\r\n";
715
}
716
}
717
751
$admins = array_merge( $author, $admins );
752
}
753
754
+ $option = '<select name="sender">' . "\r\n";
755
foreach ( $admins as $admin ) {
756
+ $option .= '<option value="' . $admin->ID . '"';
757
if ( $admin->ID === $this->subscribe2_options['sender'] ) {
758
+ $option .= ' selected="selected"';
759
}
760
+ $option .= '>' . $admin->display_name . '</option>' . "\r\n";
761
}
762
+ $option .= '</select>' . "\r\n";
763
+
764
+ $allowed_tags = array(
765
+ 'select' => array(
766
+ 'name' => true,
767
+ ),
768
+ 'option' => array(
769
+ 'value' => true,
770
+ 'selected' => true,
771
+ ),
772
+ );
773
+
774
+ echo wp_kses( $option, $allowed_tags );
775
}
776
777
/**
782
global $wpdb;
783
$cron_file = ABSPATH . 'wp-cron.php';
784
if ( ! is_readable( $cron_file ) ) {
785
+ echo '<strong><em style="color: red">' . esc_html__( 'The WordPress cron functions may be disabled on this server. Digest notifications may not work.', 'subscribe2' ) . '</em></strong><br>' . "\r\n";
786
}
787
$scheduled_time = wp_next_scheduled( 's2_digest_cron' );
788
$offset = get_option( 'gmt_offset' ) * 60 * 60;
807
$schedule_sorted[ $key ] = $schedule[ $key ];
808
}
809
foreach ( $schedule_sorted as $key => $value ) {
810
+ echo '<label><input type="radio" name="email_freq" value="' . esc_attr( $key ) . '"' . checked( $this->subscribe2_options['email_freq'], $key, false ) . ' />';
811
+ echo ' ' . esc_html( $value['display'] ) . '</label><br>' . "\r\n";
812
}
813
if ( $scheduled_time ) {
814
$date_format = get_option( 'date_format' );
815
$time_format = get_option( 'time_format' );
816
+ echo '<p>' . esc_html__( 'Current UTC time is', 'subscribe2' ) . ': ' . "\r\n";
817
+ echo '<strong>' . esc_html( date_i18n( $date_format . ' @ ' . $time_format, false, 'gmt' ) ) . '</strong></p>' . "\r\n";
818
+ echo '<p>' . esc_html__( 'Current blog time is', 'subscribe2' ) . ': ' . "\r\n";
819
+ echo '<strong>' . esc_html( date_i18n( $date_format . ' @ ' . $time_format ) ) . '</strong></p>' . "\r\n";
820
+ echo '<p>' . esc_html__( 'Next email notification will be sent when your blog time is after', 'subscribe2' ) . ': ' . "\r\n";
821
+ echo '<input type="hidden" id="jscrondate" value="' . esc_attr( date_i18n( $date_format, $scheduled_time + $offset ) ) . '" />';
822
+ echo '<input type="hidden" id="jscrontime" value="' . esc_attr( date_i18n( $time_format, $scheduled_time + $offset ) ) . '" />';
823
+ echo '<span id="s2cron_1"><span id="s2crondate" style="background-color: #FFFBCC">' . esc_html( date_i18n( $date_format, $scheduled_time + $offset ) ) . '</span>';
824
+ echo ' @ <span id="s2crontime" style="background-color: #FFFBCC">' . esc_html( date_i18n( $time_format, $scheduled_time + $offset ) ) . '</span> ';
825
+ echo '<a href="#" onclick="s2Show(\'cron\'); return false;">' . esc_html__( 'Edit', 'subscribe2' ) . '</a></span>' . "\r\n";
826
echo '<span id="s2cron_2">' . "\r\n";
827
+ echo '<input id="s2datepicker" name="crondate" value="' . esc_attr( date_i18n( $date_format, $scheduled_time + $offset ) ) . '">' . "\r\n";
828
$hours = array( '12:00 am', '1:00 am', '2:00 am', '3:00 am', '4:00 am', '5:00 am', '6:00 am', '7:00 am', '8:00 am', '9:00 am', '10:00 am', '11:00 am', '12:00 pm', '1:00 pm', '2:00 pm', '3:00 pm', '4:00 pm', '5:00 pm', '6:00 pm', '7:00 pm', '8:00 pm', '9:00 pm', '10:00 pm', '11:00 pm' );
829
$current_hour = intval( date_i18n( 'G', $scheduled_time + $offset ) );
830
echo '<select name="crontime">' . "\r\n";
831
foreach ( $hours as $key => $value ) {
832
+ echo '<option value="' . esc_attr( $key ) . '"';
833
if ( ! empty( $scheduled_time ) && $key === $current_hour ) {
834
echo ' selected="selected"';
835
}
836
+ echo '>' . esc_html( $value ) . '</option>' . "\r\n";
837
}
838
echo '</select>' . "\r\n";
839
+ echo '<a href="#" onclick="s2CronUpdate(\'cron\'); return false;">' . esc_html__( 'Update', 'subscribe2' ) . '</a>' . "\r\n";
840
+ echo '<a href="#" onclick="s2CronRevert(\'cron\'); return false;">' . esc_html__( 'Revert', 'subscribe2' ) . '</a></span>' . "\r\n";
841
if ( ! empty( $this->subscribe2_options['last_s2cron'] ) ) {
842
+ echo '<p>' . esc_html__( 'Attempt to resend the last Digest Notification email', 'subscribe2' ) . ': ';
843
+ echo '<input type="submit" class="button-secondary" name="resend" value="' . esc_attr( __( 'Resend Digest', 'subscribe2' ) ) . '" /></p>' . "\r\n";
844
}
845
} else {
846
+ echo '<br>';
847
}
848
}
849
856
return;
857
}
858
859
+ $option = '<select name="s2page">' . "\r\n";
860
+ $option .= '<option value="0">' . __( 'Select a page', 'subscribe2' ) . '</option>' . "\r\n";
861
foreach ( $pages as $page ) {
862
$option .= '<option value="' . $page->ID . '"';
863
if ( $page->ID === $s2page ) {
872
}
873
$option .= $page->post_title . '</option>' . "\r\n";
874
}
875
+ $option .= '</select>' . "\r\n";
876
877
+ $allowed_tags = array(
878
+ 'select' => array(
879
+ 'name' => true,
880
+ ),
881
+ 'option' => array(
882
+ 'value' => true,
883
+ 'selected' => true,
884
+ ),
885
+ );
886
+
887
+ echo wp_kses( $option, $allowed_tags );
888
}
889
890
/**
1128
* Show form for one-click subscription on user profile page
1129
*/
1130
public function one_click_profile_form( $user ) {
1131
+ echo '<h3>' . esc_html__( 'Email subscription', 'subscribe2' ) . '</h3>' . "\r\n";
1132
echo '<table class="form-table">' . "\r\n";
1133
+ echo '<tr><th scope="row">' . esc_html__( 'Subscribe / Unsubscribe', 'subscribe2' ) . '</th>' . "\r\n";
1134
+ echo '<td><label><input type="checkbox" name="sub2-one-click-subscribe" value="1" ' . checked( ! get_user_meta( $user->ID, $this->get_usermeta_keyname( 's2_subscribed' ), true ), false, false ) . ' /> ' . esc_html__( 'Receive notifications', 'subscribe2' ) . '</label><br>' . "\r\n";
1135
+ echo '<span class="description">' . esc_html__( 'Check if you want to receive email notification when new posts are published', 'subscribe2' ) . '</span>' . "\r\n";
1136
echo '</td></tr></table>' . "\r\n";
1137
}
1138
1171
$this->subscribe2_cron( '', 'resend' );
1172
}
1173
}
1174
+
1175
+ /**
1176
+ * Uninstall hook
1177
+ */
1178
+ public function s2_uninstall() {
1179
+ require_once S2PATH . 'classes/class-s2-uninstall.php';
1180
+ $s2_uninstall = new S2_Uninstall();
1181
+ $s2_uninstall->uninstall();
1182
+ }
1183
}
classes/class-s2-ajax.php CHANGED
@@ -10,6 +10,7 @@ class S2_Ajax {
10
add_action( 'wp_ajax_nopriv_subscribe2_form', array( &$this, 's2_ajax_form_handler' ) );
11
add_action( 'wp_ajax_nopriv_subscribe2_submit', array( &$this, 's2_ajax_submit_handler' ) );
12
add_filter( 's2_ajax_form', array( &$this, 's2_ajax_form_class' ), 1 );
13
14
global $s2_frontend;
15
require_once S2PATH . 'classes/class-s2-core.php';
@@ -58,7 +59,34 @@ class S2_Ajax {
58
global $s2_frontend;
59
$content = $s2_frontend->shortcode( $atts );
60
$content = apply_filters( 's2_ajax_form', $content );
61
- echo $content;
62
exit();
63
}
64
@@ -67,13 +95,13 @@ class S2_Ajax {
67
*/
68
public function s2_ajax_submit_handler() {
69
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 's2_ajax_form_nonce' ) ) {
70
- echo '<p>' . __( 'There was an error validating your request. Please try again later.', 'subscribe2' ) . '</p>';
71
wp_die();
72
}
73
$data = $_POST['data'];
74
if ( ( isset( $data['firstname'] ) && '' !== $data['firstname'] ) || ( isset( $data['lastname'] ) && '' !== $data['lastname'] ) || ( isset( $data['uri'] ) && 'http://' !== $data['uri'] ) ) {
75
// looks like some invisible-to-user fields were changed; falsely report success
76
- echo '<p>' . __( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
77
wp_die();
78
}
79
@@ -81,21 +109,21 @@ class S2_Ajax {
81
$s2_frontend->email = $s2_frontend->sanitize_email( $data['email'] );
82
$s2_frontend->ip = $data['ip'];
83
if ( false === $s2_frontend->validate_email( $s2_frontend->email ) ) {
84
- echo '<p>' . __( 'Sorry, but that does not look like an email address to me.', 'subscribe2' ) . '</p>';
85
} elseif ( $s2_frontend->is_barred( $s2_frontend->email ) ) {
86
- echo '<p>' . __( 'Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2' ) . '</p>';
87
} else {
88
if ( is_int( $s2_frontend->lockout ) && $s2_frontend->lockout > 0 ) {
89
$date = gmdate( 'H:i:s.u', $s2_frontend->lockout );
90
$ips = $wpdb->get_col( $wpdb->prepare( "SELECT ip FROM $wpdb->subscribe2 WHERE date = CURDATE() AND time > SUBTIME(CURTIME(), %s)", $date ) );
91
if ( in_array( $s2_frontend->ip, $ips, true ) ) {
92
- echo '<p>' . __( 'Slow down, you move too fast.', 'subscribe2' ) . '</p>';
93
}
94
}
95
$check = $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM $wpdb->users WHERE user_email = %s", $s2_frontend->email ) );
96
if ( null !== $check ) {
97
// Translators: Link to login page
98
- printf( __( 'To manage your subscription options please <a href="%1$s">login.</a>', 'subscribe2' ), get_option( 'siteurl' ) . '/wp-login.php' );
99
}
100
if ( 'subscribe' === $data['button'] ) {
101
if ( '1' !== $s2_frontend->is_public( $s2_frontend->email ) ) {
@@ -103,23 +131,23 @@ class S2_Ajax {
103
$s2_frontend->add( $s2_frontend->email );
104
$status = $s2_frontend->send_confirm( 'add' );
105
if ( $status ) {
106
- echo '<p>' . __( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
107
} else {
108
- echo '<p>' . __( 'Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2' ) . '</p>';
109
}
110
} else {
111
// they're already subscribed
112
- echo '<p>' . __( 'That email address is already subscribed.', 'subscribe2' ) . '</p>';
113
}
114
} elseif ( 'unsubscribe' === $data['button'] ) {
115
if ( false === $s2_frontend->is_public( $s2_frontend->email ) ) {
116
- echo '<p>' . __( 'That email address is not subscribed.', 'subscribe2' ) . '</p>';
117
} else {
118
$status = $s2_frontend->send_confirm( 'del' );
119
if ( $status ) {
120
- echo '<p>' . __( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
121
} else {
122
- echo '<p>' . __( 'Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2' ) . '</p>';
123
}
124
}
125
}
@@ -135,4 +163,12 @@ class S2_Ajax {
135
$content = str_replace( 'wp-login.php"', 'wp-login.php" style="text-decoration: underline;"', $content );
136
return $content;
137
}
138
}
10
add_action( 'wp_ajax_nopriv_subscribe2_form', array( &$this, 's2_ajax_form_handler' ) );
11
add_action( 'wp_ajax_nopriv_subscribe2_submit', array( &$this, 's2_ajax_submit_handler' ) );
12
add_filter( 's2_ajax_form', array( &$this, 's2_ajax_form_class' ), 1 );
13
+ add_filter( 'safe_style_css', array( &$this, 's2_safe_css' ) );
14
15
global $s2_frontend;
16
require_once S2PATH . 'classes/class-s2-core.php';
59
global $s2_frontend;
60
$content = $s2_frontend->shortcode( $atts );
61
$content = apply_filters( 's2_ajax_form', $content );
62
+
63
+ $allowed_tags = array(
64
+ 'form' => array(
65
+ 'action' => true,
66
+ 'id' => true,
67
+ 'method' => true,
68
+ 'name' => true,
69
+ ),
70
+ 'span' => array(
71
+ 'style' => true,
72
+ ),
73
+ 'label' => array(
74
+ 'for' => true,
75
+ ),
76
+ 'input' => array(
77
+ 'id' => true,
78
+ 'name' => true,
79
+ 'onblur' => true,
80
+ 'onfocus' => true,
81
+ 'size' => true,
82
+ 'type' => true,
83
+ 'value' => true,
84
+ ),
85
+ 'p' => true,
86
+ 'br' => true,
87
+ );
88
+
89
+ echo wp_kses( $content, $allowed_tags );
90
exit();
91
}
92
95
*/
96
public function s2_ajax_submit_handler() {
97
if ( ! isset( $_POST['nonce'] ) || ! wp_verify_nonce( $_POST['nonce'], 's2_ajax_form_nonce' ) ) {
98
+ echo '<p>' . esc_html__( 'There was an error validating your request. Please try again later.', 'subscribe2' ) . '</p>';
99
wp_die();
100
}
101
$data = $_POST['data'];
102
if ( ( isset( $data['firstname'] ) && '' !== $data['firstname'] ) || ( isset( $data['lastname'] ) && '' !== $data['lastname'] ) || ( isset( $data['uri'] ) && 'http://' !== $data['uri'] ) ) {
103
// looks like some invisible-to-user fields were changed; falsely report success
104
+ echo '<p>' . esc_html__( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
105
wp_die();
106
}
107
109
$s2_frontend->email = $s2_frontend->sanitize_email( $data['email'] );
110
$s2_frontend->ip = $data['ip'];
111
if ( false === $s2_frontend->validate_email( $s2_frontend->email ) ) {
112
+ echo '<p>' . esc_html__( 'Sorry, but that does not look like an email address to me.', 'subscribe2' ) . '</p>';
113
} elseif ( $s2_frontend->is_barred( $s2_frontend->email ) ) {
114
+ echo '<p>' . esc_html__( 'Sorry, email addresses at that domain are currently barred due to spam, please use an alternative email address.', 'subscribe2' ) . '</p>';
115
} else {
116
if ( is_int( $s2_frontend->lockout ) && $s2_frontend->lockout > 0 ) {
117
$date = gmdate( 'H:i:s.u', $s2_frontend->lockout );
118
$ips = $wpdb->get_col( $wpdb->prepare( "SELECT ip FROM $wpdb->subscribe2 WHERE date = CURDATE() AND time > SUBTIME(CURTIME(), %s)", $date ) );
119
if ( in_array( $s2_frontend->ip, $ips, true ) ) {
120
+ echo '<p>' . esc_html__( 'Slow down, you move too fast.', 'subscribe2' ) . '</p>';
121
}
122
}
123
$check = $wpdb->get_var( $wpdb->prepare( "SELECT user_email FROM $wpdb->users WHERE user_email = %s", $s2_frontend->email ) );
124
if ( null !== $check ) {
125
// Translators: Link to login page
126
+ printf( wp_kses_post( __( 'To manage your subscription options please <a href="%1$s">login.</a>', 'subscribe2' ) ), esc_url( get_option( 'siteurl' ) . '/wp-login.php' ) );
127
}
128
if ( 'subscribe' === $data['button'] ) {
129
if ( '1' !== $s2_frontend->is_public( $s2_frontend->email ) ) {
131
$s2_frontend->add( $s2_frontend->email );
132
$status = $s2_frontend->send_confirm( 'add' );
133
if ( $status ) {
134
+ echo '<p>' . esc_html__( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
135
} else {
136
+ echo '<p>' . esc_html__( 'Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2' ) . '</p>';
137
}
138
} else {
139
// they're already subscribed
140
+ echo '<p>' . esc_html__( 'That email address is already subscribed.', 'subscribe2' ) . '</p>';
141
}
142
} elseif ( 'unsubscribe' === $data['button'] ) {
143
if ( false === $s2_frontend->is_public( $s2_frontend->email ) ) {
144
+ echo '<p>' . esc_html__( 'That email address is not subscribed.', 'subscribe2' ) . '</p>';
145
} else {
146
$status = $s2_frontend->send_confirm( 'del' );
147
if ( $status ) {
148
+ echo '<p>' . esc_html__( 'A confirmation message is on its way!', 'subscribe2' ) . '</p>';
149
} else {
150
+ echo '<p>' . esc_html__( 'Sorry, there seems to be an error on the server. Please try again later.', 'subscribe2' ) . '</p>';
151
}
152
}
153
}
163
$content = str_replace( 'wp-login.php"', 'wp-login.php" style="text-decoration: underline;"', $content );
164
return $content;
165
}
166
+
167
+ /**
168
+ * Add display attribute to safe CSS
169
+ */
170
+ public function s2_safe_css( $style_attributes ) {
171
+ $style_attributes[] = 'display';
172
+ return $style_attributes;
173
+ }
174
}
classes/class-s2-block-editor.php CHANGED
@@ -120,7 +120,12 @@ class S2_Block_Editor {
120
return false;
121
}
122
123
- $mysubscribe2->publish( $post, $current_user->user_email );
124
return true;
125
}
126
120
return false;
121
}
122
123
+ if ( 'never' !== $this->subscribe2_options['email_freq'] ) {
124
+ $mysubscribe2->subscribe2_cron( $current_user->user_email );
125
+ } else {
126
+ $mysubscribe2->publish( $post, $current_user->user_email );
127
+ }
128
+
129
return true;
130
}
131
classes/class-s2-core.php CHANGED
@@ -461,9 +461,17 @@ class S2_Core {
461
$plaintext = $post->post_content;
462
$plaintext = strip_shortcodes( $plaintext );
463
464
- $plaintext = preg_replace( '/<s[^>]*>(.*)<\/s>/Ui', '', $plaintext );
465
- $plaintext = preg_replace( '/<strike[^>]*>(.*)<\/strike>/Ui', '', $plaintext );
466
- $plaintext = preg_replace( '/<del[^>]*>(.*)<\/del>/Ui', '', $plaintext );
467
$excerpttext = $plaintext;
468
469
if ( strstr( $mailtext, '{REFERENCELINKS}' ) ) {
@@ -534,9 +542,9 @@ class S2_Core {
534
// prepare mail body texts
535
$plain_excerpt_body = str_replace( '{POST}', $excerpt, $mailtext );
536
$plain_body = str_replace( '{POST}', $plaintext, $mailtext );
537
- $html_body = str_replace( "\r\n", "<br />\r\n", $mailtext );
538
$html_body = str_replace( '{POST}', $content, $html_body );
539
- $html_excerpt_body = str_replace( "\r\n", "<br />\r\n", $mailtext );
540
$html_excerpt_body = str_replace( '{POST}', $html_excerpt, $html_excerpt_body );
541
542
if ( '' !== $preview ) {
@@ -1241,12 +1249,12 @@ class S2_Core {
1241
}
1242
if ( 'wpreg' === $this->subscribe2_options['autosub'] ) {
1243
echo '<p><label>';
1244
- echo __( 'Check here to Subscribe to email notifications for new posts', 'subscribe2' ) . ':<br />' . "\r\n";
1245
echo '<input type="checkbox" name="reg_subscribe"' . checked( $this->subscribe2_options['wpregdef'], 'yes', false ) . ' />';
1246
echo '</label></p>' . "\r\n";
1247
} elseif ( 'yes' === $this->subscribe2_options['autosub'] ) {
1248
echo '<p><center>' . "\r\n";
1249
- echo __( 'By registering with this blog you are also agreeing to receive email notifications for new posts but you can unsubscribe at anytime', 'subscribe2' ) . '.<br />' . "\r\n";
1250
echo '</center></p>' . "\r\n";
1251
}
1252
}
@@ -1279,7 +1287,7 @@ class S2_Core {
1279
if ( 'before' === $this->subscribe2_options['comment_subs'] ) {
1280
return $comment_meta_form . $submit_field;
1281
} else {
1282
- return $submit_field . '<br />' . $comment_meta_form;
1283
}
1284
}
1285
@@ -1471,8 +1479,13 @@ class S2_Core {
1471
$posts = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL
1472
}
1473
} else {
1474
- // we are sending a preview
1475
- $posts = get_posts( 'numberposts=1' );
1476
}
1477
1478
// Collect sticky posts if desired
@@ -1517,14 +1530,14 @@ class S2_Core {
1517
$this->post_count = count( $posts );
1518
$s2_taxonomies = apply_filters( 's2_taxonomies', array( 'category' ) );
1519
1520
- foreach ( $posts as $post ) {
1521
// keep an array of post ids and skip if we've already done it once
1522
- if ( in_array( $post->ID, $ids, true ) ) {
1523
continue;
1524
}
1525
- $ids[] = $post->ID;
1526
$post_cats = wp_get_object_terms(
1527
- $post->ID,
1528
$s2_taxonomies,
1529
array(
1530
'fields' => 'ids',
@@ -1538,7 +1551,7 @@ class S2_Core {
1538
if ( '' === $preview ) {
1539
// Pages are put into category 1 so make sure we don't exclude
1540
// pages if category 1 is excluded
1541
- if ( 'page' !== $post->post_type ) {
1542
// is the current post assigned to any categories
1543
// which should not generate a notification email?
1544
foreach ( explode( ',', $this->subscribe2_options['exclude'] ) as $cat ) {
@@ -1549,18 +1562,18 @@ class S2_Core {
1549
}
1550
// is the current post set by the user to
1551
// not generate a notification email?
1552
- $s2mail = get_post_meta( $post->ID, '_s2mail', true );
1553
if ( 'no' === strtolower( trim( $s2mail ) ) ) {
1554
$check = true;
1555
}
1556
// is the current post private
1557
// and should this not generate a notification email?
1558
- if ( 'no' === $this->subscribe2_options['password'] && '' !== $post->post_password ) {
1559
$check = true;
1560
}
1561
// is the post assigned a format that should
1562
// not be included in the notification email?
1563
- $post_format = get_post_format( $post->ID );
1564
$excluded_formats = explode( ',', $this->subscribe2_options['exclude_formats'] );
1565
if ( false !== $post_format && in_array( $post_format, $excluded_formats, true ) ) {
1566
$check = true;
@@ -1574,18 +1587,18 @@ class S2_Core {
1574
}
1575
// is the current post set by the user to
1576
// not generate a notification email?
1577
- $s2mail = get_post_meta( $post->ID, '_s2mail', true );
1578
if ( 'no' === strtolower( trim( $s2mail ) ) ) {
1579
$check = true;
1580
}
1581
// is the current post private
1582
// and should this not generate a notification email?
1583
- if ( 'no' === $this->subscribe2_options['password'] && '' !== $post->post_password ) {
1584
$check = true;
1585
}
1586
// is the post assigned a format that should
1587
// not be included in the notification email?
1588
- $post_format = get_post_format( $post->ID );
1589
$excluded_formats = explode( ',', $this->subscribe2_options['exclude_formats'] );
1590
if ( false !== $post_format && in_array( $post_format, $excluded_formats, true ) ) {
1591
$check = true;
@@ -1596,15 +1609,15 @@ class S2_Core {
1596
continue;
1597
}
1598
1599
- $digest_post_ids[] = $post->ID;
1600
1601
- $post_title = html_entity_decode( $post->post_title, ENT_QUOTES );
1602
( '' === $table ) ? $table .= '* ' . $post_title : $table .= "\r\n* " . $post_title;
1603
( '' === $tablelinks ) ? $tablelinks .= '* ' . $post_title : $tablelinks .= "\r\n* " . $post_title;
1604
$message_post .= $post_title;
1605
$message_posttime .= $post_title;
1606
if ( strstr( $mailtext, '{AUTHORNAME}' ) ) {
1607
- $author = get_userdata( $post->post_author );
1608
if ( '' !== $author->display_name ) {
1609
$message_post .= ' (' . __( 'Author', 'subscribe2' ) . ': ' . html_entity_decode( apply_filters( 'the_author', $author->display_name ), ENT_QUOTES ) . ')';
1610
$message_posttime .= ' (' . __( 'Author', 'subscribe2' ) . ': ' . html_entity_decode( apply_filters( 'the_author', $author->display_name ), ENT_QUOTES ) . ')';
@@ -1613,9 +1626,9 @@ class S2_Core {
1613
$message_post .= "\r\n";
1614
$message_posttime .= "\r\n";
1615
1616
- $message_posttime .= __( 'Posted on', 'subscribe2' ) . ': ' . mysql2date( $datetime, $post->post_date ) . "\r\n";
1617
if ( strstr( $mailtext, '{TINYLINK}' ) ) {
1618
- $tinylink = wp_safe_remote_get( 'http://tinyurl.com/api-create.php?url=' . rawurlencode( $this->get_tracking_link( get_permalink( $post->ID ) ) ) );
1619
} else {
1620
$tinylink = false;
1621
}
@@ -1624,16 +1637,16 @@ class S2_Core {
1624
$message_post .= $tinylink . "\r\n";
1625
$message_posttime .= $tinylink . "\r\n";
1626
} else {
1627
- $tablelinks .= "\r\n" . $this->get_tracking_link( get_permalink( $post->ID ) ) . "\r\n";
1628
- $message_post .= $this->get_tracking_link( get_permalink( $post->ID ) ) . "\r\n";
1629
- $message_posttime .= $this->get_tracking_link( get_permalink( $post->ID ) ) . "\r\n";
1630
}
1631
1632
if ( strstr( $mailtext, '{CATS}' ) ) {
1633
$post_cat_names = implode(
1634
', ',
1635
wp_get_object_terms(
1636
- $post->ID,
1637
$s2_taxonomies,
1638
array(
1639
'fields' => 'names',
@@ -1647,7 +1660,7 @@ class S2_Core {
1647
$post_tag_names = implode(
1648
', ',
1649
wp_get_post_tags(
1650
- $post->ID,
1651
array(
1652
'fields' => 'names',
1653
)
@@ -1661,12 +1674,12 @@ class S2_Core {
1661
$message_post .= "\r\n";
1662
$message_posttime .= "\r\n";
1663
1664
- ( ! empty( $post->post_excerpt ) ) ? $excerpt = trim( $post->post_excerpt ) : $excerpt = '';
1665
if ( '' === $excerpt ) {
1666
- $excerpt = apply_filters( 'the_content', $post->post_content );
1667
// no excerpt, is there a <!--more--> ?
1668
- if ( false !== strpos( $post->post_content, '<!--more-->' ) ) {
1669
- list($excerpt, $more) = explode( '<!--more-->', $post->post_content, 2 );
1670
$excerpt = wp_strip_all_tags( $excerpt );
1671
$excerpt = strip_shortcodes( $excerpt );
1672
} else {
@@ -1981,8 +1994,11 @@ class S2_Core {
1981
// subscriber page options handler
1982
add_filter( 'set-screen-option', array( &$this, 'subscribers_set_screen_option' ), 10, 3 );
1983
1984
- // MailOptin admin notices
1985
- require_once S2PATH . 'classes/class-mo-admin-notice.php';
1986
1987
// capture CSV export
1988
if ( isset( $_POST['s2_admin'] ) && isset( $_POST['csv'] ) ) {
@@ -1992,7 +2008,7 @@ class S2_Core {
1992
header( "Content-Disposition: attachment; filename=subscribe2_users_$date.csv" );
1993
header( 'Pragma: no-cache' );
1994
header( 'Expires: 0' );
1995
- echo $this->prepare_export( $_POST['exportcsv'] );
1996
exit( 0 );
1997
}
1998
} else {
461
$plaintext = $post->post_content;
462
$plaintext = strip_shortcodes( $plaintext );
463
464
+ $plaintext = preg_replace( '/<s[^>]*>(.*)<\/s>/Ui', '', $plaintext );
465
+ $plaintext = preg_replace( '/<strike[^>]*>(.*)<\/strike>/Ui', '', $plaintext );
466
+ $plaintext = preg_replace( '/<del[^>]*>(.*)<\/del>/Ui', '', $plaintext );
467
+
468
+ // Fix for how the Block Editor stores lists
469
+ if ( true === $this->block_editor ) {
470
+ $plaintext = str_replace( '</li><', "</li>\n<", $plaintext );
471
+ }
472
+
473
+ // Add filter here so $plaintext can be filtered to correct for layout needs
474
+ $plaintext = apply_filters( 's2_plaintext', $plaintext );
475
$excerpttext = $plaintext;
476
477
if ( strstr( $mailtext, '{REFERENCELINKS}' ) ) {
542
// prepare mail body texts
543
$plain_excerpt_body = str_replace( '{POST}', $excerpt, $mailtext );
544
$plain_body = str_replace( '{POST}', $plaintext, $mailtext );
545
+ $html_body = str_replace( "\r\n", "<br>\r\n", $mailtext );
546
$html_body = str_replace( '{POST}', $content, $html_body );
547
+ $html_excerpt_body = str_replace( "\r\n", "<br>\r\n", $mailtext );
548
$html_excerpt_body = str_replace( '{POST}', $html_excerpt, $html_excerpt_body );
549
550
if ( '' !== $preview ) {
1249
}
1250
if ( 'wpreg' === $this->subscribe2_options['autosub'] ) {
1251
echo '<p><label>';
1252
+ echo esc_html__( 'Check here to Subscribe to email notifications for new posts', 'subscribe2' ) . ':<br>' . "\r\n";
1253
echo '<input type="checkbox" name="reg_subscribe"' . checked( $this->subscribe2_options['wpregdef'], 'yes', false ) . ' />';
1254
echo '</label></p>' . "\r\n";
1255
} elseif ( 'yes' === $this->subscribe2_options['autosub'] ) {
1256
echo '<p><center>' . "\r\n";
1257
+ echo esc_html__( 'By registering with this blog you are also agreeing to receive email notifications for new posts but you can unsubscribe at anytime', 'subscribe2' ) . '.<br>' . "\r\n";
1258
echo '</center></p>' . "\r\n";
1259
}
1260
}
1287
if ( 'before' === $this->subscribe2_options['comment_subs'] ) {
1288
return $comment_meta_form . $submit_field;
1289
} else {
1290
+ return $submit_field . '<br>' . $comment_meta_form;
1291
}
1292
}
1293
1479
$posts = $wpdb->get_results( $sql ); // phpcs:ignore WordPress.DB.PreparedSQL
1480
}
1481
} else {
1482
+ // we are sending a preview, use global if possible otherwise get last post
1483
+ global $post;
1484
+ if ( empty( $post ) ) {
1485
+ $posts = get_posts( 'numberposts=1' );
1486
+ } else {
1487
+ $posts = array( $post );
1488
+ }
1489
}
1490
1491
// Collect sticky posts if desired
1530
$this->post_count = count( $posts );
1531
$s2_taxonomies = apply_filters( 's2_taxonomies', array( 'category' ) );
1532
1533
+ foreach ( $posts as $digest_post ) {
1534
// keep an array of post ids and skip if we've already done it once
1535
+ if ( in_array( $digest_post->ID, $ids, true ) ) {
1536
continue;
1537
}
1538
+ $ids[] = $digest_post->ID;
1539
$post_cats = wp_get_object_terms(
1540
+ $digest_post->ID,
1541
$s2_taxonomies,
1542
array(
1543
'fields' => 'ids',
1551
if ( '' === $preview ) {
1552
// Pages are put into category 1 so make sure we don't exclude
1553
// pages if category 1 is excluded
1554
+ if ( 'page' !== $digest_post->post_type ) {
1555
// is the current post assigned to any categories
1556
// which should not generate a notification email?
1557
foreach ( explode( ',', $this->subscribe2_options['exclude'] ) as $cat ) {
1562
}
1563
// is the current post set by the user to
1564
// not generate a notification email?
1565
+ $s2mail = get_post_meta( $digest_post->ID, '_s2mail', true );
1566
if ( 'no' === strtolower( trim( $s2mail ) ) ) {
1567
$check = true;
1568
}
1569
// is the current post private
1570
// and should this not generate a notification email?
1571
+ if ( 'no' === $this->subscribe2_options['password'] && '' !== $digest_post->post_password ) {
1572
$check = true;
1573
}
1574
// is the post assigned a format that should
1575
// not be included in the notification email?
1576
+ $post_format = get_post_format( $digest_post->ID );
1577
$excluded_formats = explode( ',', $this->subscribe2_options['exclude_formats'] );
1578
if ( false !== $post_format && in_array( $post_format, $excluded_formats, true ) ) {
1579
$check = true;
1587
}
1588
// is the current post set by the user to
1589
// not generate a notification email?
1590
+ $s2mail = get_post_meta( $digest_post->ID, '_s2mail', true );
1591
if ( 'no' === strtolower( trim( $s2mail ) ) ) {
1592
$check = true;
1593
}
1594
// is the current post private
1595
// and should this not generate a notification email?
1596
+ if ( 'no' === $this->subscribe2_options['password'] && '' !== $digest_post->post_password ) {
1597
$check = true;
1598
}
1599
// is the post assigned a format that should
1600
// not be included in the notification email?
1601
+ $post_format = get_post_format( $digest_post->ID );
1602
$excluded_formats = explode( ',', $this->subscribe2_options['exclude_formats'] );
1603
if ( false !== $post_format && in_array( $post_format, $excluded_formats, true ) ) {
1604
$check = true;
1609
continue;
1610
}
1611
1612
+ $digest_post_ids[] = $digest_post->ID;
1613
1614
+ $post_title = html_entity_decode( $digest_post->post_title, ENT_QUOTES );
1615
( '' === $table ) ? $table .= '* ' . $post_title : $table .= "\r\n* " . $post_title;
1616
( '' === $tablelinks ) ? $tablelinks .= '* ' . $post_title : $tablelinks .= "\r\n* " . $post_title;
1617
$message_post .= $post_title;
1618
$message_posttime .= $post_title;
1619
if ( strstr( $mailtext, '{AUTHORNAME}' ) ) {
1620
+ $author = get_userdata( $digest_post->post_author );
1621
if ( '' !== $author->display_name ) {
1622
$message_post .= ' (' . __( 'Author', 'subscribe2' ) . ': ' . html_entity_decode( apply_filters( 'the_author', $author->display_name ), ENT_QUOTES ) . ')';
1623
$message_posttime .= ' (' . __( 'Author', 'subscribe2' ) . ': ' . html_entity_decode( apply_filters( 'the_author', $author->display_name ), ENT_QUOTES ) . ')';
1626
$message_post .= "\r\n";
1627
$message_posttime .= "\r\n";
1628
1629
+ $message_posttime .= __( 'Posted on', 'subscribe2' ) . ': ' . mysql2date( $datetime, $digest_post->post_date ) . "\r\n";
1630
if ( strstr( $mailtext, '{TINYLINK}' ) ) {
1631
+ $tinylink = wp_safe_remote_get( 'http://tinyurl.com/api-create.php?url=' . rawurlencode( $this->get_tracking_link( get_permalink( $digest_post->ID ) ) ) );
1632
} else {
1633
$tinylink = false;
1634
}
1637
$message_post .= $tinylink . "\r\n";
1638
$message_posttime .= $tinylink . "\r\n";
1639
} else {
1640
+ $tablelinks .= "\r\n" . $this->get_tracking_link( get_permalink( $digest_post->ID ) ) . "\r\n";
1641
+ $message_post .= $this->get_tracking_link( get_permalink( $digest_post->ID ) ) . "\r\n";
1642
+ $message_posttime .= $this->get_tracking_link( get_permalink( $digest_post->ID ) ) . "\r\n";
1643
}
1644
1645
if ( strstr( $mailtext, '{CATS}' ) ) {
1646
$post_cat_names = implode(
1647
', ',
1648
wp_get_object_terms(
1649
+ $digest_post->ID,
1650
$s2_taxonomies,
1651
array(
1652
'fields' => 'names',
1660
$post_tag_names = implode(
1661
', ',
1662
wp_get_post_tags(
1663
+ $digest_post->ID,
1664
array(
1665
'fields' => 'names',
1666
)
1674
$message_post .= "\r\n";
1675
$message_posttime .= "\r\n";
1676
1677
+ ( ! empty( $digest_post->post_excerpt ) ) ? $excerpt = trim( $digest_post->post_excerpt ) : $excerpt = '';
1678
if ( '' === $excerpt ) {
1679
+ $excerpt = apply_filters( 'the_content', $digest_post->post_content );
1680
// no excerpt, is there a <!--more--> ?
1681
+ if ( false !== strpos( $digest_post->post_content, '<!--more-->' ) ) {
1682
+ list($excerpt, $more) = explode( '<!--more-->', $digest_post->post_content, 2 );
1683
$excerpt = wp_strip_all_tags( $excerpt );
1684
$excerpt = strip_shortcodes( $excerpt );
1685
} else {
1994
// subscriber page options handler
1995
add_filter( 'set-screen-option', array( &$this, 'subscribers_set_screen_option' ), 10, 3 );
1996
1997
+ // MailOptin admin notices
1998
+ require_once S2PATH . 'classes/class-mo-admin-notice.php';
1999
+
2000
+ // register uninstall functions
2001
+ register_uninstall_hook( S2PLUGIN, array( 'S2_Admin', 's2_uninstall' ) );
2002
2003
// capture CSV export
2004
if ( isset( $_POST['s2_admin'] ) && isset( $_POST['csv'] ) ) {
2008
header( "Content-Disposition: attachment; filename=subscribe2_users_$date.csv" );
2009
header( 'Pragma: no-cache' );
2010
header( 'Expires: 0' );
2011
+ echo esc_html( $this->prepare_export( $_POST['exportcsv'] ) );
2012
exit( 0 );
2013
}
2014
} else {
classes/class-s2-counter-widget.php CHANGED
@@ -28,18 +28,18 @@ class S2_Counter_Widget extends WP_Widget {
28
$s2w_height = empty( $instance['s2w_height'] ) ? '16' : $instance['s2w_height'];
29
$s2w_font = empty( $instance['s2w_font'] ) ? '11' : $instance['s2w_font'];
30
31
- echo $args['before_widget'];
32
if ( ! empty( $title ) ) {
33
- echo $args['before_title'] . $title . $args['after_title'];
34
}
35
global $mysubscribe2;
36
$registered = $mysubscribe2->get_registered();
37
$confirmed = $mysubscribe2->get_public();
38
$count = ( count( $registered ) + count( $confirmed ) );
39
- echo '<ul><div style="text-align:center; background-color:' . $s2w_bg . '; color:' . $s2w_fg . '; width:' . $s2w_width . 'px; height:' . $s2w_height . 'px; font:' . $s2w_font . 'pt Verdana, Arial, Helvetica, sans-serif; vertical-align:middle; padding:3px; border:1px solid #444;">';
40
- echo $count;
41
echo '</div></ul>';
42
- echo $args['after_widget'];
43
}
44
45
/**
@@ -99,9 +99,9 @@ class S2_Counter_Widget extends WP_Widget {
99
echo '<fieldset>' . "\r\n";
100
echo '<legend>' . esc_html__( 'Color Scheme', 'subscribe2' ) . '</legend>' . "\r\n";
101
echo '<label>' . "\r\n";
102
- echo '<input type="text" name="' . esc_attr( $this->get_field_name( 's2w_bg' ) ) . '" id="' . esc_attr( $this->get_field_id( 's2w_bg' ) ) . '" maxlength="6" value="' . esc_attr( $s2w_bg ) . '" class="colorpickerField" style="width:60px;" /> ' . esc_html__( 'Body', 'subscribe2' ) . '</label><br />' . "\r\n";
103
echo '<label>' . "\r\n";
104
- echo '<input type="text" name="' . esc_attr( $this->get_field_name( 's2w_fg' ) ) . '" id="' . esc_attr( $this->get_field_id( 's2w_fg' ) ) . '" maxlength="6" value="' . esc_attr( $s2w_fg ) . '" class="colorpickerField" style="width:60px;" /> ' . esc_html__( 'Text', 'subscribe2' ) . '</label><br />' . "\r\n";
105
echo '<div class="s2_colorpicker" id ="' . esc_attr( $this->get_field_id( 's2_colorpicker' ) ) . '"></div>';
106
echo '</fieldset>';
107
28
$s2w_height = empty( $instance['s2w_height'] ) ? '16' : $instance['s2w_height'];
29
$s2w_font = empty( $instance['s2w_font'] ) ? '11' : $instance['s2w_font'];
30
31
+ echo wp_kses_post( $args['before_widget'] );
32
if ( ! empty( $title ) ) {
33
+ echo wp_kses_post( $args['before_title'] ) . esc_html( $title ) . wp_kses_post( $args['after_title'] );
34
}
35
global $mysubscribe2;
36
$registered = $mysubscribe2->get_registered();
37
$confirmed = $mysubscribe2->get_public();
38
$count = ( count( $registered ) + count( $confirmed ) );
39
+ echo wp_kses_post( '<ul><div style="text-align:center; background-color:' . $s2w_bg . '; color:' . $s2w_fg . '; width:' . $s2w_width . 'px; height:' . $s2w_height . 'px; font:' . $s2w_font . 'pt Verdana, Arial, Helvetica, sans-serif; vertical-align:middle; padding:3px; border:1px solid #444;">' );
40
+ echo esc_html( $count );
41
echo '</div></ul>';
42
+ echo wp_kses_post( $args['after_widget'] );
43
}
44
45
/**
99
echo '<fieldset>' . "\r\n";
100
echo '<legend>' . esc_html__( 'Color Scheme', 'subscribe2' ) . '</legend>' . "\r\n";
101
echo '<label>' . "\r\n";
102
+ echo '<input type="text" name="' . esc_attr( $this->get_field_name( 's2w_bg' ) ) . '" id="' . esc_attr( $this->get_field_id( 's2w_bg' ) ) . '" maxlength="6" value="' . esc_attr( $s2w_bg ) . '" class="colorpickerField" style="width:60px;" /> ' . esc_html__( 'Body', 'subscribe2' ) . '</label><br>' . "\r\n";
103
echo '<label>' . "\r\n";
104
+ echo '<input type="text" name="' . esc_attr( $this->get_field_name( 's2w_fg' ) ) . '" id="' . esc_attr( $this->get_field_id( 's2w_fg' ) ) . '" maxlength="6" value="' . esc_attr( $s2w_fg ) . '" class="colorpickerField" style="width:60px;" /> ' . esc_html__( 'Text', 'subscribe2' ) . '</label><br>' . "\r\n";
105
echo '<div class="s2_colorpicker" id ="' . esc_attr( $this->get_field_id( 's2_colorpicker' ) ) . '"></div>';
106
echo '</fieldset>';
107
classes/class-s2-form-widget.php CHANGED
@@ -53,21 +53,20 @@ class S2_Form_Widget extends WP_Widget {
53
$nowrap = ' wrap="false"';
54
}
55
$shortcode = '[subscribe2' . $hide . $postid . $size . $nojs . $noantispam . $nowrap . ' widget="true"]';
56
- echo $args['before_widget'];
57
if ( ! empty( $title ) ) {
58
- echo $args['before_title'] . esc_attr( $title ) . $args['after_title'];
59
}
60
echo '<div class="' . esc_attr( $div ) . '">';
61
- $content = do_shortcode( $shortcode );
62
if ( ! empty( $widgetprecontent ) ) {
63
- echo wp_kses( $widgetprecontent, 'post' );
64
}
65
- echo $content;
66
if ( ! empty( $widgetpostcontent ) ) {
67
- echo wp_kses( $widgetpostcontent, 'post' );
68
}
69
echo '</div>';
70
- echo $args['after_widget'];
71
}
72
73
/**
@@ -141,22 +140,22 @@ class S2_Form_Widget extends WP_Widget {
141
$sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type='page' AND post_status='publish'";
142
143
echo '<div>' . "\r\n";
144
- echo '<p><label for="' . esc_attr( $this->get_field_id( 'title' ) ) . '">' . __( 'Title', 'subscribe2' ) . ':' . "\r\n";
145
echo '<input class="widefat" id="' . esc_attr( $this->get_field_id( 'title' ) ) . '" name="' . esc_attr( $this->get_field_name( 'title' ) ) . '" type="text" value="' . esc_attr( $title ) . '" /></label></p>' . "\r\n";
146
- echo '<p><label for="' . esc_attr( $this->get_field_id( 'div' ) ) . '">' . __( 'Div class name', 'subscribe2' ) . ':' . "\r\n";
147
echo '<input class="widefat" id="' . esc_attr( $this->get_field_id( 'div' ) ) . '" name="' . esc_attr( $this->get_field_name( 'div' ) ) . '" type="text" value="' . esc_attr( $div ) . '" /></label></p>' . "\r\n";
148
echo '<p><label for="' . esc_attr( $this->get_field_id( 'widgetprecontent' ) ) . '">' . esc_html__( 'Pre-Content', 'subscribe2' ) . ':' . "\r\n";
149
echo '<textarea class="widefat" id="' . esc_attr( $this->get_field_id( 'widgetprecontent' ) ) . '" name="' . esc_attr( $this->get_field_name( 'widgetprecontent' ) ) . '" rows="2" cols="25">' . esc_attr( $widgetprecontent ) . '</textarea></label></p>' . "\r\n";
150
- echo '<p><label for="' . esc_attr( $this->get_field_id( 'widgetpostcontent' ) ) . '">' . __( 'Post-Content', 'subscribe2' ) . ':' . "\r\n";
151
echo '<textarea class="widefat" id="' . esc_attr( $this->get_field_id( 'widgetpostcontent' ) ) . '" name="' . esc_attr( $this->get_field_name( 'widgetpostcontent' ) ) . '" rows="2" cols="25">' . esc_attr( $widgetpostcontent ) . '</textarea></label></p>' . "\r\n";
152
echo '<p><label for="' . esc_attr( $this->get_field_id( 'size' ) ) . '">' . esc_html__( 'Text Box Size', 'subscribe2' ) . ':' . "\r\n";
153
echo '<input class="widefat" id="' . esc_attr( $this->get_field_id( 'size' ) ) . '" name="' . esc_attr( $this->get_field_name( 'size' ) ) . '" type="text" value="' . esc_attr( $size ) . '" /></label></p>' . "\r\n";
154
- echo '<p>' . __( 'Display options', 'subscribe2' ) . ':<br />' . "\r\n";
155
echo '<label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'complete"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'complete" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="none"' . checked( 'none', $hidebutton, false ) . '/> ' . esc_html__( 'Show complete form', 'subscribe2' ) . '</label>' . "\r\n";
156
- echo '<br /><label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'subscribe"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'subscribe" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="subscribe"' . checked( 'subscribe', $hidebutton, false ) . '/> ' . esc_html__( 'Hide Subscribe button', 'subscribe2' ) . '</label>' . "\r\n";
157
- echo '<br /><label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'unsubscribe"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'unsubscribe" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="unsubscribe"' . checked( 'unsubscribe', $hidebutton, false ) . '/> ' . esc_html__( 'Hide Unsubscribe button', 'subscribe2' ) . '</label>' . "\r\n";
158
if ( '1' === $mysubscribe2->subscribe2_options['ajax'] ) {
159
- echo '<br /><label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'ajax"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'ajax" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="link"' . checked( 'link', $hidebutton, false ) . '/> ' . esc_html__( 'Show as link', 'subscribe2' ) . '</label>' . "\r\n";
160
}
161
echo '</p>' . "\r\n";
162
echo '<p><label for="' . esc_attr( $this->get_field_id( 'postto' ) ) . '">' . esc_html__( 'Post form content to page', 'subscribe2' ) . ':' . "\r\n";
53
$nowrap = ' wrap="false"';
54
}
55
$shortcode = '[subscribe2' . $hide . $postid . $size . $nojs . $noantispam . $nowrap . ' widget="true"]';
56
+ echo wp_kses_post( $args['before_widget'] );
57
if ( ! empty( $title ) ) {
58
+ echo wp_kses_post( $args['before_title'] ) . esc_attr( $title ) . wp_kses_post( $args['after_title'] );
59
}
60
echo '<div class="' . esc_attr( $div ) . '">';
61
if ( ! empty( $widgetprecontent ) ) {
62
+ echo wp_kses_post( $widgetprecontent );
63
}
64
+ echo do_shortcode( $shortcode );
65
if ( ! empty( $widgetpostcontent ) ) {
66
+ echo wp_kses_post( $widgetpostcontent );
67
}
68
echo '</div>';
69
+ echo wp_kses_post( $args['after_widget'] );
70
}
71
72
/**
140
$sql = "SELECT ID, post_title FROM $wpdb->posts WHERE post_type='page' AND post_status='publish'";
141
142
echo '<div>' . "\r\n";
143
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'title' ) ) . '">' . esc_html__( 'Title', 'subscribe2' ) . ':' . "\r\n";
144
echo '<input class="widefat" id="' . esc_attr( $this->get_field_id( 'title' ) ) . '" name="' . esc_attr( $this->get_field_name( 'title' ) ) . '" type="text" value="' . esc_attr( $title ) . '" /></label></p>' . "\r\n";
145
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'div' ) ) . '">' . esc_html__( 'Div class name', 'subscribe2' ) . ':' . "\r\n";
146
echo '<input class="widefat" id="' . esc_attr( $this->get_field_id( 'div' ) ) . '" name="' . esc_attr( $this->get_field_name( 'div' ) ) . '" type="text" value="' . esc_attr( $div ) . '" /></label></p>' . "\r\n";
147
echo '<p><label for="' . esc_attr( $this->get_field_id( 'widgetprecontent' ) ) . '">' . esc_html__( 'Pre-Content', 'subscribe2' ) . ':' . "\r\n";
148
echo '<textarea class="widefat" id="' . esc_attr( $this->get_field_id( 'widgetprecontent' ) ) . '" name="' . esc_attr( $this->get_field_name( 'widgetprecontent' ) ) . '" rows="2" cols="25">' . esc_attr( $widgetprecontent ) . '</textarea></label></p>' . "\r\n";
149
+ echo '<p><label for="' . esc_attr( $this->get_field_id( 'widgetpostcontent' ) ) . '">' . esc_html__( 'Post-Content', 'subscribe2' ) . ':' . "\r\n";
150
echo '<textarea class="widefat" id="' . esc_attr( $this->get_field_id( 'widgetpostcontent' ) ) . '" name="' . esc_attr( $this->get_field_name( 'widgetpostcontent' ) ) . '" rows="2" cols="25">' . esc_attr( $widgetpostcontent ) . '</textarea></label></p>' . "\r\n";
151
echo '<p><label for="' . esc_attr( $this->get_field_id( 'size' ) ) . '">' . esc_html__( 'Text Box Size', 'subscribe2' ) . ':' . "\r\n";
152
echo '<input class="widefat" id="' . esc_attr( $this->get_field_id( 'size' ) ) . '" name="' . esc_attr( $this->get_field_name( 'size' ) ) . '" type="text" value="' . esc_attr( $size ) . '" /></label></p>' . "\r\n";
153
+ echo '<p>' . esc_html__( 'Display options', 'subscribe2' ) . ':<br>' . "\r\n";
154
echo '<label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'complete"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'complete" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="none"' . checked( 'none', $hidebutton, false ) . '/> ' . esc_html__( 'Show complete form', 'subscribe2' ) . '</label>' . "\r\n";
155
+ echo '<br><label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'subscribe"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'subscribe" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="subscribe"' . checked( 'subscribe', $hidebutton, false ) . '/> ' . esc_html__( 'Hide Subscribe button', 'subscribe2' ) . '</label>' . "\r\n";
156
+ echo '<br><label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'unsubscribe"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'unsubscribe" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="unsubscribe"' . checked( 'unsubscribe', $hidebutton, false ) . '/> ' . esc_html__( 'Hide Unsubscribe button', 'subscribe2' ) . '</label>' . "\r\n";
157
if ( '1' === $mysubscribe2->subscribe2_options['ajax'] ) {
158
+ echo '<br><label for="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'ajax"><input id="' . esc_attr( $this->get_field_id( 'hidebutton' ) ) . 'ajax" name="' . esc_attr( $this->get_field_name( 'hidebutton' ) ) . '" type="radio" value="link"' . checked( 'link', $hidebutton, false ) . '/> ' . esc_html__( 'Show as link', 'subscribe2' ) . '</label>' . "\r\n";
159
}
160
echo '</p>' . "\r\n";
161
echo '<p><label for="' . esc_attr( $this->get_field_id( 'postto' ) ) . '">' . esc_html__( 'Post form content to page', 'subscribe2' ) . ':' . "\r\n";
classes/class-s2-forms.php CHANGED
<
@@ -14,11 +14,11 @@ class S2_Forms {
14
public function get_userid() {
15
if ( isset( $_GET['id'] ) ) {
16
if ( ! current_user_can( apply_filters( 's2_capability', 'manage_options', 'manage' ) ) ) {
17
- die( '<p>' . __( 'Permission error! Your request cannot be completed.', 'subscribe2' ) . '</p>' );
18
}
19
if ( is_multisite() ) {
20
if ( ! is_user_member_of_blog( $_GET['id'], get_current_blog_id() ) ) {
21
- die( '<p>' . __( 'Permission error! Your request cannot be completed.', 'subscribe2' ) . '</p>' );
22
} else {
23
$userid = (int) $_GET['id'];
24
}
@@ -43,30 +43,30 @@ class S2_Forms {
43
44
echo '<input type="hidden" name="s2_admin" value="user" />';
45
if ( 'never' === $mysubscribe2->subscribe2_options['email_freq'] ) {
46
- echo __( 'Receive email as', 'subscribe2' ) . ': &nbsp;&nbsp;';