Subscribe To Comments Reloaded - Version 220608

Version Description

Download this release

Release Info

Developer wpkube
Plugin Icon 128x128 Subscribe To Comments Reloaded
Version 220608
Comparing to
See all releases

Code changes from version 220523 to 220608

includes/js/admin/subs_management.js CHANGED
@@ -1,290 +1,301 @@
1
- ( function($){
2
- $(document).ready(function(){
3
-
4
- var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
5
- var oldsre_input = $("form#mass_update_address_form input[name='oldsre']");
6
- var sre_input = $("form#mass_update_address_form input[name='sre']");
7
-
8
-
9
- oldsre_input.focus(function(){
10
- if (oldsre_input.val() == "<?php _e( 'email address', 'subscribe-to-comments-reloaded' ) ?>")
11
- {
12
- oldsre_input.val("");
13
- }
14
- oldsre_input.css("color","#000");
15
- });
16
-
17
- oldsre_input.blur(function(){
18
- if (oldsre_input.val() == "")
19
- {
20
- oldsre_input.val("<?php _e( 'email address', 'subscribe-to-comments-reloaded' ) ?>");
21
- oldsre_input.css("color","#ccc");
22
- }
23
- });
24
-
25
- sre_input.focus(function(){
26
- if (sre_input.val() == "<?php _e( 'optional - new email address', 'subscribe-to-comments-reloaded' ) ?>")
27
- {
28
- sre_input.val("");
29
- }
30
- sre_input.css("color","#000");
31
- });
32
-
33
- sre_input.blur(function(){
34
- if (sre_input.val() == "")
35
- {
36
- sre_input.val("<?php _e( 'optional - new email address', 'subscribe-to-comments-reloaded' ) ?>");
37
- sre_input.css("color","#ccc");
38
- }
39
- });
40
-
41
- $("form#mass_update_address_form").submit(function(){
42
- var old_email = $.trim( $("form#mass_update_address_form input[name='oldsre']").val() );
43
- var email = $.trim( $("form#mass_update_address_form input[name='sre']").val() );
44
- var missing_fields = [];
45
-
46
- if( old_email == "<?php _e( 'email address', 'subscribe-to-comments-reloaded' ) ?>" || old_email == "")
47
- {
48
- missing_fields.push(
49
- {
50
- message: "<?php _e( 'Missing information', 'subscribe-to-comments-reloaded' ) ?>",
51
- field: "oldsre"
52
- } );
53
- }
54
- else if( ! emailRegex.test(old_email) ) // check valid email
55
- {
56
- missing_fields.push(
57
- {
58
- message: "<?php _e( 'Invalid email address.', 'subscribe-to-comments-reloaded' ) ?>",
59
- field: "oldsre"
60
- } );
61
- }
62
-
63
- var missing_fields_size = missing_fields.length;
64
-
65
- if( missing_fields_size > 0 )
66
- {
67
-
68
- for( var i = 0; i < missing_fields_size; i++ )
69
- {
70
- var field_obj = missing_fields[i];
71
- $("form#mass_update_address_form .validate-error-text-" + field_obj.field).text(field_obj.message).show();
72
- $("form#mass_update_address_form input[name='"+ field_obj.field +"']").addClass("validate-error-field");
73
- }
74
-
75
- return false;
76
- }
77
- else
78
- {
79
- var answer = confirm('Please remember: this operation cannot be undone. Are you sure you want to proceed?');
80
- // var answer = confirm('<?php _e( 'Please remember: this operation cannot be undone. Are you sure you want to proceed?', 'subscribe-to-comments-reloaded' ) ?>');
81
- if( ! answer )
82
- {
83
- return false;
84
- }
85
- }
86
-
87
-
88
- });
89
- // Add New Subscription
90
- var stcr_post_id_input = $("form#add_new_subscription input[name='srp']");
91
- var sre_input = $("form#add_new_subscription input[name='sre']");
92
-
93
- stcr_post_id_input.blur(function(){
94
- if( $.isNumeric(stcr_post_id_input.val() ) ) // check numeric value
95
- {
96
- $(this).removeClass("validate-error-field");
97
- $("form#add_new_subscription .validate-error-text-srp").hide();
98
- }
99
- });
100
-
101
- sre_input.blur(function(){
102
- if( emailRegex.test(sre_input.val() ) ) // check email value
103
- {
104
- $(this).removeClass("validate-error-field");
105
- $("form#add_new_subscription .validate-error-text-sre").hide();
106
- }
107
- });
108
-
109
- $("form#add_new_subscription").submit(function(){
110
- var post_id = $.trim(stcr_post_id_input.val());
111
- var email = $.trim(sre_input.val());
112
- var missing_fields = [];
113
-
114
- if( post_id == "")
115
- {
116
- missing_fields.push(
117
- {
118
- message: "<?php _e( 'Missing information', 'subscribe-to-comments-reloaded' ) ?>",
119
- field: "srp"
120
- } );
121
- }
122
- else if( ! $.isNumeric(post_id) ) // check numeric value
123
- {
124
- missing_fields.push(
125
- {
126
- message: "<?php _e( 'Enter a numeric Post ID.', 'subscribe-to-comments-reloaded' ) ?>",
127
- field: "srp"
128
- } );
129
- }
130
-
131
- if( email == "")
132
- {
133
- missing_fields.push(
134
- {
135
- message: "<?php _e( 'Missing email information', 'subscribe-to-comments-reloaded' ) ?>",
136
- field: "sre"
137
- } );
138
- }
139
- else if( ! emailRegex.test(email) ) // check valid email
140
- {
141
- missing_fields.push(
142
- {
143
- message: "<?php _e( 'Invalid email address.', 'subscribe-to-comments-reloaded' ) ?>",
144
- field: "sre"
145
- } );
146
- }
147
-
148
- var missing_fields_size = missing_fields.length;
149
-
150
- if( missing_fields_size > 0 )
151
- {
152
-
153
- for( var i = 0; i < missing_fields_size; i++ )
154
- {
155
- var field_obj = missing_fields[i];
156
- $("form#add_new_subscription .validate-error-text-" + field_obj.field).text(field_obj.message).show();
157
- $("form#add_new_subscription input[name='"+ field_obj.field +"']").addClass("validate-error-field");
158
- }
159
-
160
- return false;
161
- }
162
- });
163
-
164
- var search_input = $("form#search_subscriptions_form input[name='srv']");
165
-
166
- $("form#search_subscriptions_form").submit(function(){
167
- var search_value = $.trim(search_input.val());
168
-
169
- if( search_value == "")
170
- {
171
- search_input.val("<?php _e( 'Please enter a value', 'subscribe-to-comments-reloaded' ) ?>");
172
- search_input.addClass("validate-error-field");
173
-
174
- return false;
175
- }
176
- });
177
-
178
- search_input.focus(function(){
179
- if( search_input.val() == "<?php _e( 'Please enter a value', 'subscribe-to-comments-reloaded' ) ?>" )
180
- {
181
- search_input.val("");
182
- }
183
- });
184
-
185
- search_input.blur(function(){
186
- if( $.trim(search_input.val() ) != "" )
187
- {
188
- $(this).removeClass("validate-error-field");
189
- }
190
- });
191
- });
192
-
193
- // More info action
194
- $('div.more-info').on("click", function( event ) {
195
- event.preventDefault();
196
- var info_panel = $( this ).data( "infopanel" );
197
- info_panel = "." + info_panel;
198
-
199
- $( ".postbox-mass").css("overflow","hidden");
200
-
201
- if( $( info_panel ).hasClass( "hidden") )
202
- {
203
- $( info_panel ).slideDown( "fast" );
204
- $( info_panel).removeClass( "hidden" );
205
- }
206
- else
207
- {
208
- $( info_panel ).slideUp( "fast" );
209
- $( info_panel).addClass( "hidden" );
210
- }
211
- });
212
-
213
- var subscribers_table = $("table.subscribers-table");
214
- var lang_text_direction = stcr_i18n.langTextDirection;
215
- var dataTablesDOM = '<"float-left"f><"float-right"l>t<ip>';
216
-
217
- // Check the text direction and set the correct DataTables dir.
218
- if ( lang_text_direction === "rtl" )
219
- {
220
- dataTablesDOM = '<"float-right"f><"float-left"l>t<"float-right"i><"float-left"p>';
221
- }
222
-
223
- var subscribers_table_dt = subscribers_table.DataTable( {
224
- columns: [ { sortable: false }, null, null, null, null],
225
- dom: dataTablesDOM,
226
- responsive: {
227
- details: true,
228
- type: 'column'
229
- },
230
- columnDefs: [
231
- { responsivePriority: 1, targets: 0 },
232
- { responsivePriority: 2, targets: 3 },
233
- { responsivePriority: 3, targets: 4 }
234
- ],
235
- language: stcr_i18n
236
- });
237
-
238
- subscribers_table.removeClass("stcr-hidden");
239
- $(".subs-spinner").hide();
240
- // card-body
241
- var massUpdateSubsCollapse = $('.mass-update-subs .fa-caret-down'),
242
- massUpdateSubsCollapseState = true,
243
- addNewSubsCollapse = $('.add-new-subs .fa-caret-down'),
244
- addNewSubsCollapseState = true;
245
-
246
- $('.mass-update-subs h6').on('click', function () {
247
-
248
- if ( massUpdateSubsCollapseState )
249
- {
250
- $(this).parent().find(".card-text").removeClass("stcr-hidden").addClass("original-card-padding");
251
-
252
- massUpdateSubsCollapse.removeClass("fa-caret-down").addClass("fa-caret-up");
253
- massUpdateSubsCollapseState = false;
254
- }
255
- else if ( ! massUpdateSubsCollapseState)
256
- {
257
- $(this).parent().find(".card-text").addClass("stcr-hidden").removeClass("original-card-padding");
258
-
259
- massUpdateSubsCollapse.removeClass("fa-caret-up").addClass("fa-caret-down");
260
- massUpdateSubsCollapseState = true;
261
- }
262
- });
263
-
264
- $('.add-new-subs h6').on('click', function () {
265
-
266
- if ( addNewSubsCollapseState )
267
- {
268
- $(this).parent().find(".card-text").removeClass("stcr-hidden").addClass("original-card-padding");
269
-
270
- addNewSubsCollapse.removeClass("fa-caret-down").addClass("fa-caret-up");
271
- addNewSubsCollapseState = false;
272
- }
273
- else if ( ! addNewSubsCollapseState)
274
- {
275
- $(this).parent().find(".card-text").addClass("stcr-hidden").removeClass("original-card-padding");
276
-
277
- addNewSubsCollapse.removeClass("fa-caret-up").addClass("fa-caret-down");
278
- addNewSubsCollapseState = true;
279
- }
280
- });
281
- // Handle the checkbox selection
282
- subscribers_table.find("thead tr th").on("click","#stcr_select_all",function () {
283
-
284
- var table_rows = subscribers_table_dt.rows({ 'search': 'applied' }).nodes();
285
- $('input[type="checkbox"]', table_rows).prop('checked', this.checked);
286
-
287
- });
288
-
289
-
290
- } )( jQuery );
 
 
 
 
 
 
 
 
 
 
 
1
+ ( function($){
2
+ $(document).ready(function(){
3
+
4
+ var emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
5
+ var oldsre_input = $("form#mass_update_address_form input[name='oldsre']");
6
+ var sre_input = $("form#mass_update_address_form input[name='sre']");
7
+
8
+
9
+ oldsre_input.focus(function(){
10
+ if (oldsre_input.val() == "<?php _e( 'email address', 'subscribe-to-comments-reloaded' ) ?>")
11
+ {
12
+ oldsre_input.val("");
13
+ }
14
+ oldsre_input.css("color","#000");
15
+ });
16
+
17
+ oldsre_input.blur(function(){
18
+ if (oldsre_input.val() == "")
19
+ {
20
+ oldsre_input.val("<?php _e( 'email address', 'subscribe-to-comments-reloaded' ) ?>");
21
+ oldsre_input.css("color","#ccc");
22
+ }
23
+ });
24
+
25
+ sre_input.focus(function(){
26
+ if (sre_input.val() == "<?php _e( 'optional - new email address', 'subscribe-to-comments-reloaded' ) ?>")
27
+ {
28
+ sre_input.val("");
29
+ }
30
+ sre_input.css("color","#000");
31
+ });
32
+
33
+ sre_input.blur(function(){
34
+ if (sre_input.val() == "")
35
+ {
36
+ sre_input.val("<?php _e( 'optional - new email address', 'subscribe-to-comments-reloaded' ) ?>");
37
+ sre_input.css("color","#ccc");
38
+ }
39
+ });
40
+
41
+ $("form#mass_update_address_form").submit(function(){
42
+ var old_email = $.trim( $("form#mass_update_address_form input[name='oldsre']").val() );
43
+ var email = $.trim( $("form#mass_update_address_form input[name='sre']").val() );
44
+ var missing_fields = [];
45
+
46
+ if( old_email == "<?php _e( 'email address', 'subscribe-to-comments-reloaded' ) ?>" || old_email == "")
47
+ {
48
+ missing_fields.push(
49
+ {
50
+ message: "<?php _e( 'Missing information', 'subscribe-to-comments-reloaded' ) ?>",
51
+ field: "oldsre"
52
+ } );
53
+ }
54
+ else if( ! emailRegex.test(old_email) ) // check valid email
55
+ {
56
+ missing_fields.push(
57
+ {
58
+ message: "<?php _e( 'Invalid email address.', 'subscribe-to-comments-reloaded' ) ?>",
59
+ field: "oldsre"
60
+ } );
61
+ }
62
+
63
+ var missing_fields_size = missing_fields.length;
64
+
65
+ if( missing_fields_size > 0 )
66
+ {
67
+
68
+ for( var i = 0; i < missing_fields_size; i++ )
69
+ {
70
+ var field_obj = missing_fields[i];
71
+ $("form#mass_update_address_form .validate-error-text-" + field_obj.field).text(field_obj.message).show();
72
+ $("form#mass_update_address_form input[name='"+ field_obj.field +"']").addClass("validate-error-field");
73
+ }
74
+
75
+ return false;
76
+ }
77
+ else
78
+ {
79
+ var answer = confirm('Please remember: this operation cannot be undone. Are you sure you want to proceed?');
80
+ // var answer = confirm('<?php _e( 'Please remember: this operation cannot be undone. Are you sure you want to proceed?', 'subscribe-to-comments-reloaded' ) ?>');
81
+ if( ! answer )
82
+ {
83
+ return false;
84
+ }
85
+ }
86
+
87
+
88
+ });
89
+ // Add New Subscription
90
+ var stcr_post_id_input = $("form#add_new_subscription input[name='srp']");
91
+ var sre_input = $("form#add_new_subscription textarea[name='sre']");
92
+
93
+ stcr_post_id_input.blur(function(){
94
+ if( $.isNumeric(stcr_post_id_input.val() ) ) // check numeric value
95
+ {
96
+ $(this).removeClass("validate-error-field");
97
+ $("form#add_new_subscription .validate-error-text-srp").hide();
98
+ }
99
+ });
100
+
101
+ sre_input.blur(function(){
102
+ var sre_input_array = sre_input.val().replaceAll( ' ', '' );
103
+ sre_input_array = sre_input_array.split( ',' );
104
+ $.each( sre_input_array, function( index, value ) {
105
+ if( emailRegex.test( value ) ) // check email value
106
+ {
107
+ $(sre_input).removeClass("validate-error-field");
108
+ $("form#add_new_subscription .validate-error-text-sre").hide();
109
+ }
110
+ } );
111
+ });
112
+
113
+ $("form#add_new_subscription").submit(function(){
114
+ var post_id = $.trim(stcr_post_id_input.val());
115
+ var email = $.trim(sre_input.val());
116
+ var missing_fields = [];
117
+
118
+ if( post_id == "")
119
+ {
120
+ missing_fields.push(
121
+ {
122
+ message: "<?php _e( 'Missing information', 'subscribe-to-comments-reloaded' ) ?>",
123
+ field: "srp"
124
+ } );
125
+ }
126
+ else if( ! $.isNumeric(post_id) ) // check numeric value
127
+ {
128
+ missing_fields.push(
129
+ {
130
+ message: "<?php _e( 'Enter a numeric Post ID.', 'subscribe-to-comments-reloaded' ) ?>",
131
+ field: "srp"
132
+ } );
133
+ }
134
+
135
+ if( email == "")
136
+ {
137
+ missing_fields.push(
138
+ {
139
+ message: "<?php _e( 'Missing email information', 'subscribe-to-comments-reloaded' ) ?>",
140
+ field: "sre"
141
+ } );
142
+ }
143
+ else {
144
+ var email_submit = email.replaceAll( ' ', '' );
145
+ email_submit = email_submit.split( ',' );
146
+ $.each( email_submit, function( index, value ) {
147
+ if( ! emailRegex.test(value) ) // check valid email
148
+ {
149
+ missing_fields.push(
150
+ {
151
+ message: "<?php _e( 'Invalid email address.', 'subscribe-to-comments-reloaded' ) ?>",
152
+ field: "sre"
153
+ } );
154
+ }
155
+ } );
156
+
157
+ }
158
+
159
+ var missing_fields_size = missing_fields.length;
160
+
161
+ if( missing_fields_size > 0 )
162
+ {
163
+
164
+ for( var i = 0; i < missing_fields_size; i++ )
165
+ {
166
+ var field_obj = missing_fields[i];
167
+ $("form#add_new_subscription .validate-error-text-" + field_obj.field).text(field_obj.message).show();
168
+ $("form#add_new_subscription input[name='"+ field_obj.field +"']").addClass("validate-error-field");
169
+ }
170
+
171
+ return false;
172
+ }
173
+ });
174
+
175
+ var search_input = $("form#search_subscriptions_form input[name='srv']");
176
+
177
+ $("form#search_subscriptions_form").submit(function(){
178
+ var search_value = $.trim(search_input.val());
179
+
180
+ if( search_value == "")
181
+ {
182
+ search_input.val("<?php _e( 'Please enter a value', 'subscribe-to-comments-reloaded' ) ?>");
183
+ search_input.addClass("validate-error-field");
184
+
185
+ return false;
186
+ }
187
+ });
188
+
189
+ search_input.focus(function(){
190
+ if( search_input.val() == "<?php _e( 'Please enter a value', 'subscribe-to-comments-reloaded' ) ?>" )
191
+ {
192
+ search_input.val("");
193
+ }
194
+ });
195
+
196
+ search_input.blur(function(){
197
+ if( $.trim(search_input.val() ) != "" )
198
+ {
199
+ $(this).removeClass("validate-error-field");
200
+ }
201
+ });
202
+ });
203
+
204
+ // More info action
205
+ $('div.more-info').on("click", function( event ) {
206
+ event.preventDefault();
207
+ var info_panel = $( this ).data( "infopanel" );
208
+ info_panel = "." + info_panel;
209
+
210
+ $( ".postbox-mass").css("overflow","hidden");
211
+
212
+ if( $( info_panel ).hasClass( "hidden") )
213
+ {
214
+ $( info_panel ).slideDown( "fast" );
215
+ $( info_panel).removeClass( "hidden" );
216
+ }
217
+ else
218
+ {
219
+ $( info_panel ).slideUp( "fast" );
220
+ $( info_panel).addClass( "hidden" );
221
+ }
222
+ });
223
+
224
+ var subscribers_table = $("table.subscribers-table");
225
+ var lang_text_direction = stcr_i18n.langTextDirection;
226
+ var dataTablesDOM = '<"float-left"f><"float-right"l>t<ip>';
227
+
228
+ // Check the text direction and set the correct DataTables dir.
229
+ if ( lang_text_direction === "rtl" )
230
+ {
231
+ dataTablesDOM = '<"float-right"f><"float-left"l>t<"float-right"i><"float-left"p>';
232
+ }
233
+
234
+ var subscribers_table_dt = subscribers_table.DataTable( {
235
+ columns: [ { sortable: false }, null, null, null, null],
236
+ dom: dataTablesDOM,
237
+ responsive: {
238
+ details: true,
239
+ type: 'column'
240
+ },
241
+ columnDefs: [
242
+ { responsivePriority: 1, targets: 0 },
243
+ { responsivePriority: 2, targets: 3 },
244
+ { responsivePriority: 3, targets: 4 }
245
+ ],
246
+ language: stcr_i18n
247
+ });
248
+
249
+ subscribers_table.removeClass("stcr-hidden");
250
+ $(".subs-spinner").hide();
251
+ // card-body
252
+ var massUpdateSubsCollapse = $('.mass-update-subs .fa-caret-down'),
253
+ massUpdateSubsCollapseState = true,
254
+ addNewSubsCollapse = $('.add-new-subs .fa-caret-down'),
255
+ addNewSubsCollapseState = true;
256
+
257
+ $('.mass-update-subs h6').on('click', function () {
258
+
259
+ if ( massUpdateSubsCollapseState )
260
+ {
261
+ $(this).parent().find(".card-text").removeClass("stcr-hidden").addClass("original-card-padding");
262
+
263
+ massUpdateSubsCollapse.removeClass("fa-caret-down").addClass("fa-caret-up");
264
+ massUpdateSubsCollapseState = false;
265
+ }
266
+ else if ( ! massUpdateSubsCollapseState)
267
+ {
268
+ $(this).parent().find(".card-text").addClass("stcr-hidden").removeClass("original-card-padding");
269
+
270
+ massUpdateSubsCollapse.removeClass("fa-caret-up").addClass("fa-caret-down");
271
+ massUpdateSubsCollapseState = true;
272
+ }
273
+ });
274
+
275
+ $('.add-new-subs h6').on('click', function () {
276
+
277
+ if ( addNewSubsCollapseState )
278
+ {
279
+ $(this).parent().find(".card-text").removeClass("stcr-hidden").addClass("original-card-padding");
280
+
281
+ addNewSubsCollapse.removeClass("fa-caret-down").addClass("fa-caret-up");
282
+ addNewSubsCollapseState = false;
283
+ }
284
+ else if ( ! addNewSubsCollapseState)
285
+ {
286
+ $(this).parent().find(".card-text").addClass("stcr-hidden").removeClass("original-card-padding");
287
+
288
+ addNewSubsCollapse.removeClass("fa-caret-up").addClass("fa-caret-down");
289
+ addNewSubsCollapseState = true;
290
+ }
291
+ });
292
+ // Handle the checkbox selection
293
+ subscribers_table.find("thead tr th").on("click","#stcr_select_all",function () {
294
+
295
+ var table_rows = subscribers_table_dt.rows({ 'search': 'applied' }).nodes();
296
+ $('input[type="checkbox"]', table_rows).prop('checked', this.checked);
297
+
298
+ });
299
+
300
+
301
+ } )( jQuery );
options/panel1-business-logic.php CHANGED
@@ -30,8 +30,13 @@ switch ( $action ) {
30
  exit();
31
  }
32
 
33
- $stcr_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $stcr_post_email );
34
- $valid_post_id = $wp_subscribe_reloaded->stcr->utils->check_valid_number( $post_id );
 
 
 
 
 
35
 
36
  if ( $stcr_post_email === false )
37
  {
@@ -44,10 +49,12 @@ switch ( $action ) {
44
  break;
45
  }
46
 
47
- $wp_subscribe_reloaded->stcr->add_subscription( $post_id, $stcr_post_email, $status );
 
48
 
49
- if ( strpos( $status, 'C' ) !== false ) {
50
- $wp_subscribe_reloaded->stcr->confirmation_email( $post_id, $email );
 
51
  }
52
 
53
  echo '<div class="updated"><p>' . esc_html__( 'Subscription added.', 'subscribe-to-comments-reloaded' ) . '</p></div>';
30
  exit();
31
  }
32
 
33
+ $subscriber_post_email = explode( ',', $stcr_post_email );
34
+
35
+ foreach ( $subscriber_post_email as $subscriber_email ) {
36
+ $stcr_post_email = $wp_subscribe_reloaded->stcr->utils->check_valid_email( $subscriber_email );
37
+ }
38
+
39
+ $valid_post_id = $wp_subscribe_reloaded->stcr->utils->check_valid_number( $post_id );
40
 
41
  if ( $stcr_post_email === false )
42
  {
49
  break;
50
  }
51
 
52
+ foreach ( $subscriber_post_email as $subscriber_email ) {
53
+ $wp_subscribe_reloaded->stcr->add_subscription( $post_id, $subscriber_email, $status );
54
 
55
+ if ( strpos( $status, 'C' ) !== false ) {
56
+ $wp_subscribe_reloaded->stcr->confirmation_email( $post_id, $subscriber_email );
57
+ }
58
  }
59
 
60
  echo '<div class="updated"><p>' . esc_html__( 'Subscription added.', 'subscribe-to-comments-reloaded' ) . '</p></div>';
options/stcr_manage_subscriptions.php CHANGED
@@ -111,7 +111,7 @@ if ( is_readable( trailingslashit( dirname( STCR_PLUGIN_FILE ) ) . 'options/pane
111
  </tr>
112
  <tr>
113
  <td><?php esc_html_e( 'Email', 'subscribe-to-comments-reloaded' ) ?></td>
114
- <td><input class="form-control form-controls-font" type='text' size='30' name='sre' value='' ></td>
115
  <td><span class="validate-error-text validate-error-text-sre stcr-hidden "></span></td>
116
  </tr>
117
  <tr>
111
  </tr>
112
  <tr>
113
  <td><?php esc_html_e( 'Email', 'subscribe-to-comments-reloaded' ) ?></td>
114
+ <td><textarea name='sre' class="form-control form-controls-font" cols="10" rows="6"></textarea></td>
115
  <td><span class="validate-error-text validate-error-text-sre stcr-hidden "></span></td>
116
  </tr>
117
  <tr>
options/stcr_notifications.php CHANGED
@@ -89,7 +89,7 @@ wp_print_scripts( 'quicktags' );
89
 
90
  <div class="form-group row">
91
  <label for="from_name" class="col-sm-3 col-form-label text-right">
92
- <?php esc_html_e( 'Sender email address', 'subscribe-to-comments-reloaded' ) ?></label>
93
  <div class="col-sm-7">
94
  <input type="text" name="options[from_name]" id="from_name"
95
  class="form-control form-control-input-8"
89
 
90
  <div class="form-group row">
91
  <label for="from_name" class="col-sm-3 col-form-label text-right">
92
+ <?php esc_html_e( 'Sender name', 'subscribe-to-comments-reloaded' ) ?></label>
93
  <div class="col-sm-7">
94
  <input type="text" name="options[from_name]" id="from_name"
95
  class="form-control form-control-input-8"
readme.txt CHANGED
@@ -6,8 +6,8 @@ Plugin URI: http://subscribe-reloaded.com/
6
  Requires at least: 4.0
7
  Requires PHP: 5.6
8
  Requires MySQL: 5.6
9
- Tested up to: 5.9
10
- Stable tag: 220523
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
@@ -95,6 +95,10 @@ Just go to the Options Panel and click the generate button. By generating a new
95
  7. Manage the subscriptions on the Frontend Side.
96
 
97
  == Changelog ==
 
 
 
 
98
  = v220523 =
99
  * **Fix** Minor fixes
100
 
6
  Requires at least: 4.0
7
  Requires PHP: 5.6
8
  Requires MySQL: 5.6
9
+ Tested up to: 6.0
10
+ Stable tag: 220608
11
  License: GPLv2 or later
12
  License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
 
95
  7. Manage the subscriptions on the Frontend Side.
96
 
97
  == Changelog ==
98
+ = v220608 =
99
+ * **New** The "Add Subscription" option in the admin panel now allows multiple email addresses to be added at once.
100
+ * **Fix** Force the redirect URL to be the same domain as the website
101
+
102
  = v220523 =
103
  * **Fix** Minor fixes
104
 
subscribe-to-comments-reloaded.php CHANGED
@@ -2,7 +2,7 @@
2
  /**
3
  * Plugin Name: Subscribe to Comments Reloaded
4
  * Description: Subscribe to Comments Reloaded is a robust plugin that enables commenters to sign up for e-mail notifications. It includes a full-featured subscription manager that your commenters can use to unsubscribe to certain posts or suspend all notifications.
5
- * Version: 220523
6
  * Author: WPKube
7
  * Author URI: http://wpkube.com/
8
  * License: GPL-2.0+
2
  /**
3
  * Plugin Name: Subscribe to Comments Reloaded
4
  * Description: Subscribe to Comments Reloaded is a robust plugin that enables commenters to sign up for e-mail notifications. It includes a full-featured subscription manager that your commenters can use to unsubscribe to certain posts or suspend all notifications.
5
+ * Version: 220608
6
  * Author: WPKube
7
  * Author URI: http://wpkube.com/
8
  * License: GPL-2.0+
templates/author.php CHANGED
@@ -66,6 +66,35 @@ echo "<p>" . wp_kses( $message, wp_kses_allowed_html( 'post' ) ) . "</p>";
66
  '-C' => esc_html__( "Active", 'subscribe-to-comments-reloaded')
67
  );
68
  if ( is_array( $subscriptions ) && ! empty( $subscriptions ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
69
  echo '<h1 id="subscribe-reloaded-title-p">' . esc_html__( 'Title', 'subscribe-to-comments-reloaded' ) . ': <strong>' . esc_html( $target_post->post_title ) . '</strong></h1>'; // $target_post comes from wp_subscribe_reloaded\subscribe_reloaded_manage
70
 
71
  echo "<table class='stcr-subscription-list'><thead><tr>
@@ -114,6 +143,81 @@ if ( is_array( $subscriptions ) && ! empty( $subscriptions ) ) {
114
  ?>
115
  </fieldset>
116
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  <script type="text/javascript">
118
 
119
  function stcrCheckAll(e) {
66
  '-C' => esc_html__( "Active", 'subscribe-to-comments-reloaded')
67
  );
68
  if ( is_array( $subscriptions ) && ! empty( $subscriptions ) ) {
69
+ $total_subscriptions = count( $subscriptions );
70
+ $subscriptions_per_page = 200;
71
+ $subscriptions_total_pages = ceil( $total_subscriptions / $subscriptions_per_page );
72
+ $subscriptions_pagenum = isset( $_REQUEST['subscription_paged'] ) ? absint( $_REQUEST['subscription_paged'] ) : 1; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
73
+ $subscriptions_offset = ( $subscriptions_pagenum - 1 ) * $subscriptions_per_page;
74
+ $subscriptions = array_slice( $subscriptions, $subscriptions_offset, $subscriptions_per_page );
75
+
76
+ $disable_first = false;
77
+ $disable_last = false;
78
+ $disable_prev = false;
79
+ $disable_next = false;
80
+
81
+ if ( 1 == $subscriptions_pagenum ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
82
+ $disable_first = true;
83
+ $disable_prev = true;
84
+ }
85
+
86
+ if ( $subscriptions_total_pages == $subscriptions_pagenum ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
87
+ $disable_last = true;
88
+ $disable_next = true;
89
+ }
90
+
91
+ // For generating new url.
92
+ $removable_query_args = array( 'post_permalink' );
93
+ $server_http_host = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
94
+ $server_request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
95
+ $current_url = set_url_scheme( 'http://' . $server_http_host . $server_request_uri );
96
+ $current_url = remove_query_arg( $removable_query_args, $current_url );
97
+
98
  echo '<h1 id="subscribe-reloaded-title-p">' . esc_html__( 'Title', 'subscribe-to-comments-reloaded' ) . ': <strong>' . esc_html( $target_post->post_title ) . '</strong></h1>'; // $target_post comes from wp_subscribe_reloaded\subscribe_reloaded_manage
99
 
100
  echo "<table class='stcr-subscription-list'><thead><tr>
143
  ?>
144
  </fieldset>
145
  </form>
146
+
147
+ <div class="stcr-pagination-links">
148
+ <?php
149
+ // For first disable.
150
+ if ( $disable_first ) {
151
+ echo '<span class="disabled" aria-hidden="true">&laquo;</span>';
152
+ } else {
153
+ printf(
154
+ '<a class="first-page" href="%s"><span aria-hidden="true">%s</span></a>',
155
+ esc_url( remove_query_arg( 'subscription_paged', $current_url ) ),
156
+ '&laquo;'
157
+ );
158
+ }
159
+
160
+ // For previous disable.
161
+ if ( $disable_prev ) {
162
+ echo '<span class="disabled" aria-hidden="true">&lsaquo;</span>';
163
+ } else {
164
+ printf(
165
+ '<a class="prev-page" href="%s"><span aria-hidden="true">%s</span></a>',
166
+ esc_url( add_query_arg( array( 'post_permalink' => $post_permalink, 'subscription_paged' => max( 1, $subscriptions_pagenum - 1 ) ), $current_url ) ),
167
+ '&lsaquo;'
168
+ );
169
+ }
170
+
171
+ // For page numbers.
172
+ echo '<span class="stcr-subscriptions-management-links">';
173
+ for ( $number = 1; $number <= $subscriptions_total_pages; $number ++ ) {
174
+ if ( $number === $subscriptions_pagenum ) {
175
+ printf(
176
+ '<span aria-current="page" class="page-numbers current">%s</span>',
177
+ esc_attr( number_format_i18n( $number ) )
178
+ );
179
+ $dots = true;
180
+ } else {
181
+ if ( $number <= 1 || ( $subscriptions_pagenum && $number >= $subscriptions_pagenum - 2 && $number <= $subscriptions_pagenum + 2 ) || $number > $subscriptions_total_pages - 1 ) {
182
+ printf(
183
+ '<a class="page-numbers" href="%s">%s</a>',
184
+ /** This filter is documented in wp-includes/general-template.php */
185
+ esc_url( add_query_arg( array( 'post_permalink' => $post_permalink, 'subscription_paged' => $number ), $current_url ) ),
186
+ esc_attr( number_format_i18n( $number ) )
187
+ );
188
+ $dots = true;
189
+ } elseif ( $dots ) {
190
+ echo '<span class="page-numbers dots">' . __( '&hellip;', 'subscribe-to-comments-reloaded' ) . '</span>';
191
+ $dots = false;
192
+ }
193
+ }
194
+ }
195
+ echo '</span>';
196
+
197
+ // For next disable.
198
+ if ( $disable_next ) {
199
+ echo '<span class="disabled" aria-hidden="true">&rsaquo;</span>';
200
+ } else {
201
+ printf(
202
+ '<a class="next-page" href="%s"><span aria-hidden="true">%s</span></a>',
203
+ esc_url( add_query_arg( array( 'post_permalink' => $post_permalink, 'subscription_paged' => min( $subscriptions_total_pages, $subscriptions_pagenum + 1 ) ), $current_url ) ),
204
+ '&rsaquo;'
205
+ );
206
+ }
207
+
208
+ // For last disable.
209
+ if ( $disable_last ) {
210
+ echo '<span class="disabled" aria-hidden="true">&raquo;</span>';
211
+ } else {
212
+ printf(
213
+ "<a class='last-page' href='%s'><span aria-hidden='true'>%s</span></a>",
214
+ esc_url( add_query_arg( array( 'post_permalink' => $post_permalink, 'subscription_paged' => $subscriptions_total_pages ), $current_url ) ),
215
+ '&raquo;'
216
+ );
217
+ }
218
+ ?>
219
+ </div>
220
+
221
  <script type="text/javascript">
222
 
223
  function stcrCheckAll(e) {
templates/confirm.php CHANGED
@@ -17,6 +17,10 @@ if (array_key_exists('post_permalink', $_GET)) {
17
  }
18
  }
19
 
 
 
 
 
20
  // update status of subscription to confirmed
21
  $wp_subscribe_reloaded->stcr->update_subscription_status( $post_ID, $email, '-C' );
22
 
17
  }
18
  }
19
 
20
+ if ( strpos( $post_permalink, home_url( '/' ) ) === false ) {
21
+ $post_permalink = home_url( '/' );
22
+ }
23
+
24
  // update status of subscription to confirmed
25
  $wp_subscribe_reloaded->stcr->update_subscription_status( $post_ID, $email, '-C' );
26
 
templates/request-management-link.php CHANGED
@@ -84,6 +84,10 @@ if ( array_key_exists('post_permalink', $_GET ) ) {
84
  }
85
  }
86
 
 
 
 
 
87
  // challenge question
88
  $challenge_question_state = get_option( 'subscribe_reloaded_use_challenge_question', 'no' );
89
  $challenge_question = get_option( 'subscribe_reloaded_challenge_question', 'What is 1 + 2?' );
84
  }
85
  }
86
 
87
+ if ( strpos( $post_permalink, home_url( '/' ) ) === false ) {
88
+ $post_permalink = home_url( '/' );
89
+ }
90
+
91
  // challenge question
92
  $challenge_question_state = get_option( 'subscribe_reloaded_use_challenge_question', 'no' );
93
  $challenge_question = get_option( 'subscribe_reloaded_challenge_question', 'What is 1 + 2?' );
templates/user.php CHANGED
@@ -16,6 +16,10 @@ if (array_key_exists('post_permalink', $_GET))
16
  }
17
  }
18
 
 
 
 
 
19
  ob_start();
20
 
21
  if ( ! empty( $_POST['post_list'] ) ) {
@@ -78,6 +82,35 @@ echo "<p>" . wp_kses( $message, wp_kses_allowed_html( 'post' ) ) . "</p>";
78
  '-C' => esc_html__( "Active", 'subscribe-to-comments-reloaded')
79
  );
80
  if ( is_array( $subscriptions ) && ! empty( $subscriptions ) ) {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  echo '<p id="subscribe-reloaded-email-p">' . esc_html__( 'Email to manage', 'subscribe-to-comments-reloaded' ) . ': <strong>' . esc_html( $email ) . '</strong></p>';
82
 
83
  echo "<table class='stcr-subscription-list'><thead><tr>
@@ -149,6 +182,81 @@ if ( is_array( $subscriptions ) && ! empty( $subscriptions ) ) {
149
  ?>
150
  </fieldset>
151
  </form>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
152
  <script type="text/javascript">
153
 
154
  function stcrCheckAll(e) {
16
  }
17
  }
18
 
19
+ if ( strpos( $post_permalink, home_url( '/' ) ) === false ) {
20
+ $post_permalink = home_url( '/' );
21
+ }
22
+
23
  ob_start();
24
 
25
  if ( ! empty( $_POST['post_list'] ) ) {
82
  '-C' => esc_html__( "Active", 'subscribe-to-comments-reloaded')
83
  );
84
  if ( is_array( $subscriptions ) && ! empty( $subscriptions ) ) {
85
+ $total_subscriptions = count( $subscriptions );
86
+ $subscriptions_per_page = 200;
87
+ $subscriptions_total_pages = ceil( $total_subscriptions / $subscriptions_per_page );
88
+ $subscriptions_pagenum = isset( $_REQUEST['subscription_paged'] ) ? absint( $_REQUEST['subscription_paged'] ) : 1; // phpcs:ignore WordPress.Security.NonceVerification.Recommended
89
+ $subscriptions_offset = ( $subscriptions_pagenum - 1 ) * $subscriptions_per_page;
90
+ $subscriptions = array_slice( $subscriptions, $subscriptions_offset, $subscriptions_per_page );
91
+
92
+ $disable_first = false;
93
+ $disable_last = false;
94
+ $disable_prev = false;
95
+ $disable_next = false;
96
+
97
+ if ( 1 == $subscriptions_pagenum ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
98
+ $disable_first = true;
99
+ $disable_prev = true;
100
+ }
101
+
102
+ if ( $subscriptions_total_pages == $subscriptions_pagenum ) { // phpcs:ignore WordPress.PHP.StrictComparisons.LooseComparison
103
+ $disable_last = true;
104
+ $disable_next = true;
105
+ }
106
+
107
+ // For generating new url.
108
+ $removable_query_args = array( 'post_permalink' );
109
+ $server_http_host = isset( $_SERVER['HTTP_HOST'] ) ? sanitize_text_field( wp_unslash( $_SERVER['HTTP_HOST'] ) ) : '';
110
+ $server_request_uri = isset( $_SERVER['REQUEST_URI'] ) ? sanitize_text_field( wp_unslash( $_SERVER['REQUEST_URI'] ) ) : '';
111
+ $current_url = set_url_scheme( 'http://' . $server_http_host . $server_request_uri );
112
+ $current_url = remove_query_arg( $removable_query_args, $current_url );
113
+
114
  echo '<p id="subscribe-reloaded-email-p">' . esc_html__( 'Email to manage', 'subscribe-to-comments-reloaded' ) . ': <strong>' . esc_html( $email ) . '</strong></p>';
115
 
116
  echo "<table class='stcr-subscription-list'><thead><tr>
182
  ?>
183
  </fieldset>
184
  </form>
185
+
186
+ <div class="stcr-pagination-links">
187
+ <?php
188
+ // For first disable.
189
+ if ( $disable_first ) {
190
+ echo '<span class="disabled" aria-hidden="true">&laquo;</span>';
191
+ } else {
192
+ printf(
193
+ '<a class="first-page" href="%s"><span aria-hidden="true">%s</span></a>',
194
+ esc_url( remove_query_arg( 'subscription_paged', $current_url ) ),
195
+ '&laquo;'
196
+ );
197
+ }
198
+
199
+ // For previous disable.
200
+ if ( $disable_prev ) {
201
+ echo '<span class="disabled" aria-hidden="true">&lsaquo;</span>';
202
+ } else {
203
+ printf(
204
+ '<a class="prev-page" href="%s"><span aria-hidden="true">%s</span></a>',
205
+ esc_url( add_query_arg( array( 'post_permalink' => $post_permalink, 'subscription_paged' => max( 1, $subscriptions_pagenum - 1 ) ), $current_url ) ),
206
+ '&lsaquo;'
207
+ );
208
+ }
209
+
210
+ // For page numbers.
211
+ echo '<span class="stcr-subscriptions-management-links">';
212
+ for ( $number = 1; $number <= $subscriptions_total_pages; $number ++ ) {
213
+ if ( $number === $subscriptions_pagenum ) {
214
+ printf(
215
+ '<span aria-current="page" class="page-numbers current">%s</span>',
216
+ esc_attr( number_format_i18n( $number ) )
217
+ );
218
+ $dots = true;
219
+ } else {
220
+ if ( $number <= 1 || ( $subscriptions_pagenum && $number >= $subscriptions_pagenum - 2 && $number <= $subscriptions_pagenum + 2 ) || $number > $subscriptions_total_pages - 1 ) {
221
+ printf(
222
+ '<a class="page-numbers" href="%s">%s</a>',
223
+ /** This filter is documented in wp-includes/general-template.php */
224
+ esc_url( add_query_arg( array( 'post_permalink' => $post_permalink, 'subscription_paged' => $number ), $current_url ) ),
225
+ esc_attr( number_format_i18n( $number ) )
226
+ );
227
+ $dots = true;
228
+ } elseif ( $dots ) {
229
+ echo '<span class="page-numbers dots">' . __( '&hellip;', 'subscribe-to-comments-reloaded' ) . '</span>';
230
+ $dots = false;
231
+ }
232
+ }
233
+ }
234
+ echo '</span>';
235
+
236
+ // For next disable.
237
+ if ( $disable_next ) {
238
+ echo '<span class="disabled" aria-hidden="true">&rsaquo;</span>';
239
+ } else {
240
+ printf(
241
+ '<a class="next-page" href="%s"><span aria-hidden="true">%s</span></a>',
242
+ esc_url( add_query_arg( array( 'post_permalink' => $post_permalink, 'subscription_paged' => min( $subscriptions_total_pages, $subscriptions_pagenum + 1 ) ), $current_url ) ),
243
+ '&rsaquo;'
244
+ );
245
+ }
246
+
247
+ // For last disable.
248
+ if ( $disable_last ) {
249
+ echo '<span class="disabled" aria-hidden="true">&raquo;</span>';
250
+ } else {
251
+ printf(
252
+ "<a class='last-page' href='%s'><span aria-hidden='true'>%s</span></a>",
253
+ esc_url( add_query_arg( array( 'post_permalink' => $post_permalink, 'subscription_paged' => $subscriptions_total_pages ), $current_url ) ),
254
+ '&raquo;'
255
+ );
256
+ }
257
+ ?>
258
+ </div>
259
+
260
  <script type="text/javascript">
261
 
262
  function stcrCheckAll(e) {
wp_subscribe_reloaded.php CHANGED
@@ -8,7 +8,7 @@ if ( ! function_exists( 'add_action' ) ) {
8
  }
9
 
10
  // globals
11
- define( __NAMESPACE__.'\\VERSION','220523' );
12
  define( __NAMESPACE__.'\\DEVELOPMENT', false );
13
  define( __NAMESPACE__.'\\SLUG', "subscribe-to-comments-reloaded" );
14
 
8
  }
9
 
10
  // globals
11
+ define( __NAMESPACE__.'\\VERSION','220608' );
12
  define( __NAMESPACE__.'\\DEVELOPMENT', false );
13
  define( __NAMESPACE__.'\\SLUG', "subscribe-to-comments-reloaded" );
14