Disable Comments - Version 2.2.2

Version Description

Download this release

Release Info

Developer wpdevteam
Plugin Icon 128x128 Disable Comments
Version 2.2.2
Comparing to
See all releases

Code changes from version 2.2.1 to 2.2.2

assets/css/style.css CHANGED
@@ -2267,6 +2267,12 @@ button.button__instagram.hover__highlight:hover .icon {
2267
  .disable__comment__option .disable_option .delete__checklist.disabled__sites .delete__checklist__item {
2268
  flex: 0 1 200px;
2269
  }
 
 
 
 
 
 
2270
  .disable__comment__option .disable_option .delete__checklist .delete__checklist__item {
2271
  flex: 0 0 130px;
2272
  margin-right: 10px;
@@ -2320,6 +2326,12 @@ button.button__instagram.hover__highlight:hover .icon {
2320
  .disable__comment__option .disable_option .remove__checklist.disabled__sites .remove__checklist__item {
2321
  flex: 0 1 200px;
2322
  }
 
 
 
 
 
 
2323
  .disable__comment__option .disable_option .remove__checklist .remove__checklist__item {
2324
  flex: 0 0 130px;
2325
  margin-right: 10px;
2267
  .disable__comment__option .disable_option .delete__checklist.disabled__sites .delete__checklist__item {
2268
  flex: 0 1 200px;
2269
  }
2270
+ .disable__comment__option .disable_option .delete__checklist.disabled__sites .delete__checklist__item:nth-child(1) {
2271
+ flex-basis: 100%;
2272
+ }
2273
+ .disable__comment__option .disable_option .delete__checklist.disabled__sites .delete__checklist__item:nth-child(1) label {
2274
+ display: inline-block;
2275
+ }
2276
  .disable__comment__option .disable_option .delete__checklist .delete__checklist__item {
2277
  flex: 0 0 130px;
2278
  margin-right: 10px;
2326
  .disable__comment__option .disable_option .remove__checklist.disabled__sites .remove__checklist__item {
2327
  flex: 0 1 200px;
2328
  }
2329
+ .disable__comment__option .disable_option .remove__checklist.disabled__sites .remove__checklist__item:nth-child(1) {
2330
+ flex-basis: 100%;
2331
+ }
2332
+ .disable__comment__option .disable_option .remove__checklist.disabled__sites .remove__checklist__item:nth-child(1) label {
2333
+ display: inline-block;
2334
+ }
2335
  .disable__comment__option .disable_option .remove__checklist .remove__checklist__item {
2336
  flex: 0 0 130px;
2337
  margin-right: 10px;
assets/js/disable-comments-settings-scripts.js CHANGED
@@ -220,4 +220,33 @@ jQuery(document).ready(function ($) {
220
  // jQuery(this).off(e);
221
  saveBtn.addClass('form-dirty');
222
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
223
  });
220
  // jQuery(this).off(e);
221
  saveBtn.addClass('form-dirty');
222
  });
223
+ jQuery("#deleteCommentSettings .check-all, #disableCommentSaveSettings .check-all").on('change', function(){
224
+ var checked = jQuery(this).is(':checked');
225
+ var sites_option = jQuery(this).closest('.sites_option')
226
+ var site_option = sites_option.find('.site_option')
227
+ site_option.prop('checked', checked);
228
+ });
229
+
230
+ var countSelected = function(sites_option){
231
+ var site_option = sites_option.find('.site_option')
232
+ var totalChecked = 0;
233
+ site_option.each(function(){
234
+ if(jQuery(this).is(':checked')){
235
+ totalChecked++;
236
+ }
237
+ });
238
+
239
+ if(totalChecked){
240
+ sites_option.find('.check-all').addClass('semi-checked');
241
+ }
242
+ sites_option.find('.check-all').prop('checked', totalChecked == site_option.length);
243
+ sites_option.find('.check-all+label small').text(`(${totalChecked} selected)`)
244
+ }
245
+
246
+ jQuery("#deleteCommentSettings .sites_option, #disableCommentSaveSettings .sites_option").on('change', function(){
247
+ var sites_option = jQuery(this).closest('.sites_option')
248
+ countSelected(sites_option);
249
+ });
250
+ countSelected(jQuery("#deleteCommentSettings .sites_option"));
251
+ countSelected(jQuery("#disableCommentSaveSettings .sites_option"));
252
  });
disable-comments.php CHANGED
@@ -4,7 +4,7 @@
4
  * Plugin Name: Disable Comments
5
  * Plugin URI: https://wordpress.org/plugins/disable-comments/
6
  * Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. You could bulk delete comments using Tools.
7
- * Version: 2.2.1
8
  * Author: WPDeveloper
9
  * Author URI: https://wpdeveloper.net
10
  * License: GPL-3.0+
@@ -21,7 +21,7 @@ if (!defined('ABSPATH')) {
21
 
22
  class Disable_Comments
23
  {
24
- const DB_VERSION = 6;
25
  private static $instance = null;
26
  private $options;
27
  public $networkactive;
@@ -37,7 +37,7 @@ class Disable_Comments
37
 
38
  function __construct()
39
  {
40
- define('DC_VERSION', '2.2.1');
41
  define('DC_PLUGIN_SLUG', 'disable_comments_settings');
42
  define('DC_PLUGIN_ROOT_PATH', dirname(__FILE__));
43
  define('DC_PLUGIN_VIEWS_PATH', DC_PLUGIN_ROOT_PATH . '/views/');
@@ -59,27 +59,23 @@ class Disable_Comments
59
 
60
  $this->sitewide_settings = get_site_option('disable_comments_sitewide_settings', false);
61
  // Load options.
62
- if ($this->networkactive && (is_network_admin() || $this->sitewide_settings !== '1')) {
63
  $this->options = get_site_option('disable_comments_options', array());
64
- if(!isset($this->options['disabled_sites'])){
65
- $sites = get_sites([
66
- 'number' => 0,
67
- ]);
68
- $this->options['disabled_sites'] = array_map(function($site){
69
- return $site->blog_id;
70
- }, $sites);
71
- }
72
  $blog_id = get_current_blog_id();
73
  if(
74
- !is_network_admin() && (
75
  empty($this->options['disabled_sites']) ||
76
- !in_array($blog_id, $this->options['disabled_sites'])
 
77
  )
78
  ){
79
  $this->options = [
80
  'remove_everywhere' => false,
81
  'disabled_post_types' => array(),
82
  'extra_post_types' => array(),
 
83
  'remove_xmlrpc_comments' => 0,
84
  'remove_rest_API_comments' => 0,
85
  'settings_saved' => true,
@@ -111,6 +107,13 @@ class Disable_Comments
111
 
112
  add_action( 'wp_loaded', [ $this, 'start_plugin_usage_tracking'] );
113
  }
 
 
 
 
 
 
 
114
  /**
115
  * Enable CLI
116
  * @since 2.0.0
@@ -166,6 +169,9 @@ class Disable_Comments
166
  {
167
  $old_ver = isset($this->options['db_version']) ? $this->options['db_version'] : 0;
168
  if ($old_ver < self::DB_VERSION) {
 
 
 
169
  if ($old_ver < 2) {
170
  // upgrade options from version 0.2.1 or earlier to 0.3.
171
  $this->options['disabled_post_types'] = get_option('disable_comments_post_types', array());
@@ -178,6 +184,17 @@ class Disable_Comments
178
  unset($this->options[$v]);
179
  }
180
  }
 
 
 
 
 
 
 
 
 
 
 
181
 
182
  foreach (array('remove_everywhere', 'extra_post_types') as $v) {
183
  if (!isset($this->options[$v])) {
@@ -200,6 +217,30 @@ class Disable_Comments
200
  }
201
  }
202
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
203
  /**
204
  * Get an array of disabled post type.
205
  */
@@ -682,7 +723,7 @@ class Disable_Comments
682
  }
683
 
684
  public function get_all_comment_types(){
685
- if($this->networkactive && is_network_admin()){
686
  $comment_types = [];
687
  $sites = get_sites([
688
  'number' => 0,
@@ -770,12 +811,23 @@ class Disable_Comments
770
  } else {
771
  $formArray = (isset($_POST['data']) ? $this->form_data_modify($_POST['data']) : []);
772
  }
 
773
  $this->options = [];
774
 
775
  $this->options['is_network_admin'] = isset($formArray['is_network_admin']) && $formArray['is_network_admin'] == '1' ? true : false;
776
 
777
- if(!empty($formArray['disabled_sites'])){
778
- $this->options['disabled_sites'] = $formArray['disabled_sites'];
 
 
 
 
 
 
 
 
 
 
779
  }
780
 
781
  if (isset($formArray['mode'])) {
@@ -839,6 +891,7 @@ class Disable_Comments
839
  'number' => 0,
840
  ]);
841
  foreach ( $sites as $site ) {
 
842
  if( !empty($formArray['disabled_sites']) && in_array($site->blog_id, $formArray['disabled_sites'])){
843
  switch_to_blog( $site->blog_id );
844
  $log = $this->delete_comments($_args);
4
  * Plugin Name: Disable Comments
5
  * Plugin URI: https://wordpress.org/plugins/disable-comments/
6
  * Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type. You could bulk delete comments using Tools.
7
+ * Version: 2.2.2
8
  * Author: WPDeveloper
9
  * Author URI: https://wpdeveloper.net
10
  * License: GPL-3.0+
21
 
22
  class Disable_Comments
23
  {
24
+ const DB_VERSION = 7;
25
  private static $instance = null;
26
  private $options;
27
  public $networkactive;
37
 
38
  function __construct()
39
  {
40
+ define('DC_VERSION', '2.2.2');
41
  define('DC_PLUGIN_SLUG', 'disable_comments_settings');
42
  define('DC_PLUGIN_ROOT_PATH', dirname(__FILE__));
43
  define('DC_PLUGIN_VIEWS_PATH', DC_PLUGIN_ROOT_PATH . '/views/');
59
 
60
  $this->sitewide_settings = get_site_option('disable_comments_sitewide_settings', false);
61
  // Load options.
62
+ if ($this->networkactive && ($this->is_network_admin() || $this->sitewide_settings !== '1')) {
63
  $this->options = get_site_option('disable_comments_options', array());
64
+ $this->options['disabled_sites'] = $this->get_disabled_sites();
65
+
 
 
 
 
 
 
66
  $blog_id = get_current_blog_id();
67
  if(
68
+ !$this->is_network_admin() && (
69
  empty($this->options['disabled_sites']) ||
70
+ // if site disabled
71
+ empty($this->options['disabled_sites']["site_$blog_id"])
72
  )
73
  ){
74
  $this->options = [
75
  'remove_everywhere' => false,
76
  'disabled_post_types' => array(),
77
  'extra_post_types' => array(),
78
+ 'disabled_sites' => array(),
79
  'remove_xmlrpc_comments' => 0,
80
  'remove_rest_API_comments' => 0,
81
  'settings_saved' => true,
107
 
108
  add_action( 'wp_loaded', [ $this, 'start_plugin_usage_tracking'] );
109
  }
110
+
111
+ public function is_network_admin(){
112
+ if (is_network_admin() || defined('DOING_AJAX') && DOING_AJAX && is_multisite() && preg_match('#^'.network_admin_url().'#i',$_SERVER['HTTP_REFERER'])) {
113
+ return true;
114
+ }
115
+ return false;
116
+ }
117
  /**
118
  * Enable CLI
119
  * @since 2.0.0
169
  {
170
  $old_ver = isset($this->options['db_version']) ? $this->options['db_version'] : 0;
171
  if ($old_ver < self::DB_VERSION) {
172
+ if($this->networkactive){
173
+ $this->options['is_network_admin'] = true;
174
+ }
175
  if ($old_ver < 2) {
176
  // upgrade options from version 0.2.1 or earlier to 0.3.
177
  $this->options['disabled_post_types'] = get_option('disable_comments_post_types', array());
184
  unset($this->options[$v]);
185
  }
186
  }
187
+ if ($old_ver < 7 && function_exists( 'get_sites' )) {
188
+ $this->options['disabled_sites'] = [];
189
+ $dc_options = get_site_option('disable_comments_options', array());
190
+ $disabled_sites = isset($dc_options['disabled_sites']) ? $dc_options['disabled_sites'] : [];
191
+
192
+ foreach(get_sites(['number' => 0]) as $blog){
193
+ $blog_id = $blog->blog_id;
194
+ $this->options['disabled_sites']["site_$blog_id"] = in_array($blog_id, $disabled_sites);
195
+ }
196
+ $this->options['disabled_sites'] = $this->get_disabled_sites();
197
+ }
198
 
199
  foreach (array('remove_everywhere', 'extra_post_types') as $v) {
200
  if (!isset($this->options[$v])) {
217
  }
218
  }
219
 
220
+ public function get_disabled_sites(){
221
+ $this->options['disabled_sites'] = isset($this->options['disabled_sites']) ? $this->options['disabled_sites'] : [];
222
+ $disabled_sites = ['all' => true];
223
+ foreach(get_sites(['number' => 0]) as $blog){
224
+ $disabled_sites["site_{$blog->blog_id}"] = true;
225
+ }
226
+ $this->options['disabled_sites'] = wp_parse_args($this->options['disabled_sites'], $disabled_sites);
227
+ $disabled_sites = $this->options['disabled_sites'];
228
+ unset($disabled_sites['all']);
229
+ if(in_array(false, $disabled_sites)){
230
+ $this->options['disabled_sites']['all'] = false;
231
+ }
232
+ else{
233
+ $this->options['disabled_sites']['all'] = true;
234
+ }
235
+ return $this->options['disabled_sites'];
236
+ }
237
+
238
+ // public function get_disabled_count(){
239
+ // $disabled_sites = isset($this->options['disabled_sites']) ? $this->options['disabled_sites'] : [];
240
+ // unset($disabled_sites['all']);
241
+ // return array_sum($disabled_sites);
242
+ // }
243
+
244
  /**
245
  * Get an array of disabled post type.
246
  */
723
  }
724
 
725
  public function get_all_comment_types(){
726
+ if($this->networkactive && is_network_admin() && function_exists( 'get_sites' )){
727
  $comment_types = [];
728
  $sites = get_sites([
729
  'number' => 0,
811
  } else {
812
  $formArray = (isset($_POST['data']) ? $this->form_data_modify($_POST['data']) : []);
813
  }
814
+ $old_options = $this->options;
815
  $this->options = [];
816
 
817
  $this->options['is_network_admin'] = isset($formArray['is_network_admin']) && $formArray['is_network_admin'] == '1' ? true : false;
818
 
819
+ if(!empty($this->options['is_network_admin']) && function_exists('get_sites') && empty($formArray['sitewide_settings'])){
820
+ $formArray['disabled_sites'] = isset($formArray['disabled_sites']) ? $formArray['disabled_sites'] : [];
821
+ $this->options['disabled_sites'] = [
822
+ 'all' => in_array('all', $formArray['disabled_sites']),
823
+ ];
824
+ foreach (get_sites(['number' => false]) as $key => $site) {
825
+ $blog_id = "site_{$site->blog_id}";
826
+ $this->options['disabled_sites'][$blog_id] = in_array($blog_id, $formArray['disabled_sites']);
827
+ }
828
+ }
829
+ elseif(!empty($this->options['is_network_admin']) && !empty($formArray['sitewide_settings'])){
830
+ $this->options['disabled_sites'] = $old_options['disabled_sites'];
831
  }
832
 
833
  if (isset($formArray['mode'])) {
891
  'number' => 0,
892
  ]);
893
  foreach ( $sites as $site ) {
894
+ // $formArray['disabled_sites'] ids don't include "site_" prefix.
895
  if( !empty($formArray['disabled_sites']) && in_array($site->blog_id, $formArray['disabled_sites'])){
896
  switch_to_blog( $site->blog_id );
897
  $log = $this->delete_comments($_args);
languages/disable-comments.pot CHANGED
@@ -2,9 +2,9 @@
2
  # This file is distributed under the GPL-3.0+.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Disable Comments 2.2.1\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/disable-comments\n"
7
- "POT-Creation-Date: 2021-09-26 11:49:56+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
@@ -24,11 +24,11 @@ msgstr ""
24
  "X-Textdomain-Support: yes\n"
25
  "X-Generator: grunt-wp-i18n 1.0.3\n"
26
 
27
- #: disable-comments.php:147
28
  msgid "Want to help make Disable Comments even better?"
29
  msgstr ""
30
 
31
- #: disable-comments.php:148
32
  msgid ""
33
  "We collect non-sensitive diagnostic data and plugin usage information. Your "
34
  "site URL, WordPress & PHP version, plugins & themes and email address to "
@@ -37,16 +37,16 @@ msgid ""
37
  "I promise."
38
  msgstr ""
39
 
40
- #: disable-comments.php:160
41
  #. translators: %s: WordPress version no.
42
  msgid "Disable Comments requires WordPress version %s or greater."
43
  msgstr ""
44
 
45
- #: disable-comments.php:405 disable-comments.php:548 disable-comments.php:555
46
  msgid "Comments are closed."
47
  msgstr ""
48
 
49
- #: disable-comments.php:507
50
  #. translators: %s: disabled post types.
51
  msgid ""
52
  "Note: The <em>Disable Comments</em> plugin is currently active, and "
@@ -54,11 +54,11 @@ msgid ""
54
  "not be applicable for those post types."
55
  msgstr ""
56
 
57
- #: disable-comments.php:507
58
  msgid ", "
59
  msgstr ""
60
 
61
- #: disable-comments.php:539
62
  #. translators: %s: URL to Disabled Comment settings page.
63
  msgid ""
64
  "The <strong>Disable Comments</strong> plugin is active, but isn't "
@@ -66,31 +66,31 @@ msgid ""
66
  "page</a> to choose which post types to disable comments on."
67
  msgstr ""
68
 
69
- #: disable-comments.php:628 views/partials/_disable.php:3
70
  msgid "Settings"
71
  msgstr ""
72
 
73
- #: disable-comments.php:629
74
  msgid "Tools"
75
  msgstr ""
76
 
77
- #: disable-comments.php:648 views/partials/_delete.php:80
78
  msgid "Delete Comments"
79
  msgstr ""
80
 
81
- #: disable-comments.php:711
82
  msgid "Default (no type)"
83
  msgstr ""
84
 
85
- #: disable-comments.php:815
86
  msgid "Saved"
87
  msgstr ""
88
 
89
- #: disable-comments.php:884 disable-comments.php:918 disable-comments.php:941
90
  msgid "All comments have been deleted"
91
  msgstr ""
92
 
93
- #: disable-comments.php:886 disable-comments.php:890
94
  msgid "Internal error occured. Please try again later."
95
  msgstr ""
96
 
@@ -189,44 +189,44 @@ msgstr ""
189
  msgid "Disable Comments via REST API. "
190
  msgstr ""
191
 
192
- #: views/partials/_delete.php:28 views/partials/_delete.php:32
193
- #: views/partials/_disable.php:19 views/partials/_disable.php:41
194
- #: views/partials/_disable.php:46 views/partials/_disable.php:77
195
  msgid "Note:"
196
  msgstr ""
197
 
198
- #: views/partials/_delete.php:28
199
  msgid "Select your sub-sites where you want to delete comments."
200
  msgstr ""
201
 
202
- #: views/partials/_delete.php:32
203
  msgid ""
204
  "These settings will permanently delete comments for your entire website, or "
205
  "for specific posts and comment types."
206
  msgstr ""
207
 
208
- #: views/partials/_delete.php:35 views/partials/_disable.php:53
209
  msgid "Everywhere:"
210
  msgstr ""
211
 
212
- #: views/partials/_delete.php:35
213
  msgid "Permanently delete all comments on your WordPress website"
214
  msgstr ""
215
 
216
- #: views/partials/_delete.php:36 views/partials/_delete.php:59
217
- #: views/partials/_delete.php:72 views/partials/_disable.php:54
218
  msgid "Warnings:"
219
  msgstr ""
220
 
221
- #: views/partials/_delete.php:36
222
  msgid "This will permanently delete comments everywhere on your website."
223
  msgstr ""
224
 
225
- #: views/partials/_delete.php:40
226
  msgid "On Certain Post Types:"
227
  msgstr ""
228
 
229
- #: views/partials/_delete.php:55 views/partials/_disable.php:73
230
  msgid ""
231
  "Only the built-in post types appear above. If you want to disable comments "
232
  "on other custom post types on the entire network, you can supply a "
@@ -234,32 +234,32 @@ msgid ""
234
  "post type)."
235
  msgstr ""
236
 
237
- #: views/partials/_delete.php:56 views/partials/_disable.php:74
238
  msgid "Custom post types:"
239
  msgstr ""
240
 
241
- #: views/partials/_delete.php:59
242
  msgid ""
243
  "This will remove existing comment entries for the selected post type(s) in "
244
  "the database and cannot be reverted without a database backups."
245
  msgstr ""
246
 
247
- #: views/partials/_delete.php:63
248
  msgid "Delete Certain Comment Types:"
249
  msgstr ""
250
 
251
- #: views/partials/_delete.php:72
252
  msgid ""
253
  "Deleting comments by comment type will remove existing comment entries of "
254
  "the selected comment type(s) in the database and cannot be reverted without "
255
  "a database backup."
256
  msgstr ""
257
 
258
- #: views/partials/_delete.php:74
259
  msgid "Total Comments:"
260
  msgstr ""
261
 
262
- #: views/partials/_delete.php:218
263
  msgid "No comments are available for deletion."
264
  msgstr ""
265
 
@@ -269,13 +269,13 @@ msgid ""
269
  "types of posts."
270
  msgstr ""
271
 
272
- #: views/partials/_disable.php:14 views/partials/_disable.php:89
273
- #: views/partials/_disable.php:99
274
  msgid "On"
275
  msgstr ""
276
 
277
- #: views/partials/_disable.php:15 views/partials/_disable.php:90
278
- #: views/partials/_disable.php:100
279
  msgid "Off"
280
  msgstr ""
281
 
@@ -285,33 +285,33 @@ msgid ""
285
  "Comments” settings individually on every website in the network."
286
  msgstr ""
287
 
288
- #: views/partials/_disable.php:41
289
  msgid ""
290
  "Enable Site Wise settings if you want to configure “Disable Comments” "
291
  "settings individually on every website."
292
  msgstr ""
293
 
294
- #: views/partials/_disable.php:46
295
  msgid ""
296
  "This site will be controlled by the network admin until you click the "
297
  "\"Save Changes\" button."
298
  msgstr ""
299
 
300
- #: views/partials/_disable.php:53
301
  msgid "Disable comments globally on your entire website"
302
  msgstr ""
303
 
304
- #: views/partials/_disable.php:54
305
  msgid ""
306
  "This will disable comments from every page and post on your website. Use "
307
  "this setting if you do not want to show comments anywhere."
308
  msgstr ""
309
 
310
- #: views/partials/_disable.php:58
311
  msgid "On Specific Post Types:"
312
  msgstr ""
313
 
314
- #: views/partials/_disable.php:77
315
  msgid ""
316
  "Disabling comments will also disable trackbacks and pingbacks. All "
317
  "comment-related fields will also be hidden from the edit/quick-edit screens "
@@ -319,31 +319,31 @@ msgid ""
319
  "posts. Comments will be visible on all other post types."
320
  msgstr ""
321
 
322
- #: views/partials/_disable.php:81
323
  msgid "Disable Comments With API"
324
  msgstr ""
325
 
326
- #: views/partials/_disable.php:82
327
  msgid ""
328
  "You can disable comments made on your website using WordPress "
329
  "specifications."
330
  msgstr ""
331
 
332
- #: views/partials/_disable.php:92
333
  msgid "Disable Comments via XML-RPC"
334
  msgstr ""
335
 
336
- #: views/partials/_disable.php:101
337
  msgid "Disable Comments via REST API"
338
  msgstr ""
339
 
340
- #: views/partials/_disable.php:105
341
  msgid ""
342
  "Turning on these settings will disable any comments made on your website "
343
  "via XML-RPC or REST API specifications."
344
  msgstr ""
345
 
346
- #: views/partials/_disable.php:110
347
  msgid "Save Changes"
348
  msgstr ""
349
 
@@ -426,7 +426,7 @@ msgstr ""
426
  msgid "https://wpdeveloper.net"
427
  msgstr ""
428
 
429
- #: disable-comments.php:638
430
  msgctxt "settings menu title"
431
  msgid "Disable Comments"
432
  msgstr ""
2
  # This file is distributed under the GPL-3.0+.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Disable Comments 2.2.2\n"
6
  "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/disable-comments\n"
7
+ "POT-Creation-Date: 2021-10-05 04:44:47+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=utf-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
24
  "X-Textdomain-Support: yes\n"
25
  "X-Generator: grunt-wp-i18n 1.0.3\n"
26
 
27
+ #: disable-comments.php:150
28
  msgid "Want to help make Disable Comments even better?"
29
  msgstr ""
30
 
31
+ #: disable-comments.php:151
32
  msgid ""
33
  "We collect non-sensitive diagnostic data and plugin usage information. Your "
34
  "site URL, WordPress & PHP version, plugins & themes and email address to "
37
  "I promise."
38
  msgstr ""
39
 
40
+ #: disable-comments.php:163
41
  #. translators: %s: WordPress version no.
42
  msgid "Disable Comments requires WordPress version %s or greater."
43
  msgstr ""
44
 
45
+ #: disable-comments.php:446 disable-comments.php:589 disable-comments.php:596
46
  msgid "Comments are closed."
47
  msgstr ""
48
 
49
+ #: disable-comments.php:548
50
  #. translators: %s: disabled post types.
51
  msgid ""
52
  "Note: The <em>Disable Comments</em> plugin is currently active, and "
54
  "not be applicable for those post types."
55
  msgstr ""
56
 
57
+ #: disable-comments.php:548
58
  msgid ", "
59
  msgstr ""
60
 
61
+ #: disable-comments.php:580
62
  #. translators: %s: URL to Disabled Comment settings page.
63
  msgid ""
64
  "The <strong>Disable Comments</strong> plugin is active, but isn't "
66
  "page</a> to choose which post types to disable comments on."
67
  msgstr ""
68
 
69
+ #: disable-comments.php:669 views/partials/_disable.php:3
70
  msgid "Settings"
71
  msgstr ""
72
 
73
+ #: disable-comments.php:670
74
  msgid "Tools"
75
  msgstr ""
76
 
77
+ #: disable-comments.php:689 views/partials/_delete.php:84
78
  msgid "Delete Comments"
79
  msgstr ""
80
 
81
+ #: disable-comments.php:752
82
  msgid "Default (no type)"
83
  msgstr ""
84
 
85
+ #: disable-comments.php:867
86
  msgid "Saved"
87
  msgstr ""
88
 
89
+ #: disable-comments.php:937 disable-comments.php:971 disable-comments.php:994
90
  msgid "All comments have been deleted"
91
  msgstr ""
92
 
93
+ #: disable-comments.php:939 disable-comments.php:943
94
  msgid "Internal error occured. Please try again later."
95
  msgstr ""
96
 
189
  msgid "Disable Comments via REST API. "
190
  msgstr ""
191
 
192
+ #: views/partials/_delete.php:32 views/partials/_delete.php:36
193
+ #: views/partials/_disable.php:19 views/partials/_disable.php:48
194
+ #: views/partials/_disable.php:53 views/partials/_disable.php:84
195
  msgid "Note:"
196
  msgstr ""
197
 
198
+ #: views/partials/_delete.php:32
199
  msgid "Select your sub-sites where you want to delete comments."
200
  msgstr ""
201
 
202
+ #: views/partials/_delete.php:36
203
  msgid ""
204
  "These settings will permanently delete comments for your entire website, or "
205
  "for specific posts and comment types."
206
  msgstr ""
207
 
208
+ #: views/partials/_delete.php:39 views/partials/_disable.php:60
209
  msgid "Everywhere:"
210
  msgstr ""
211
 
212
+ #: views/partials/_delete.php:39
213
  msgid "Permanently delete all comments on your WordPress website"
214
  msgstr ""
215
 
216
+ #: views/partials/_delete.php:40 views/partials/_delete.php:63
217
+ #: views/partials/_delete.php:76 views/partials/_disable.php:61
218
  msgid "Warnings:"
219
  msgstr ""
220
 
221
+ #: views/partials/_delete.php:40
222
  msgid "This will permanently delete comments everywhere on your website."
223
  msgstr ""
224
 
225
+ #: views/partials/_delete.php:44
226
  msgid "On Certain Post Types:"
227
  msgstr ""
228
 
229
+ #: views/partials/_delete.php:59 views/partials/_disable.php:80
230
  msgid ""
231
  "Only the built-in post types appear above. If you want to disable comments "
232
  "on other custom post types on the entire network, you can supply a "
234
  "post type)."
235
  msgstr ""
236
 
237
+ #: views/partials/_delete.php:60 views/partials/_disable.php:81
238
  msgid "Custom post types:"
239
  msgstr ""
240
 
241
+ #: views/partials/_delete.php:63
242
  msgid ""
243
  "This will remove existing comment entries for the selected post type(s) in "
244
  "the database and cannot be reverted without a database backups."
245
  msgstr ""
246
 
247
+ #: views/partials/_delete.php:67
248
  msgid "Delete Certain Comment Types:"
249
  msgstr ""
250
 
251
+ #: views/partials/_delete.php:76
252
  msgid ""
253
  "Deleting comments by comment type will remove existing comment entries of "
254
  "the selected comment type(s) in the database and cannot be reverted without "
255
  "a database backup."
256
  msgstr ""
257
 
258
+ #: views/partials/_delete.php:78
259
  msgid "Total Comments:"
260
  msgstr ""
261
 
262
+ #: views/partials/_delete.php:222
263
  msgid "No comments are available for deletion."
264
  msgstr ""
265
 
269
  "types of posts."
270
  msgstr ""
271
 
272
+ #: views/partials/_disable.php:14 views/partials/_disable.php:96
273
+ #: views/partials/_disable.php:106
274
  msgid "On"
275
  msgstr ""
276
 
277
+ #: views/partials/_disable.php:15 views/partials/_disable.php:97
278
+ #: views/partials/_disable.php:107
279
  msgid "Off"
280
  msgstr ""
281
 
285
  "Comments” settings individually on every website in the network."
286
  msgstr ""
287
 
288
+ #: views/partials/_disable.php:48
289
  msgid ""
290
  "Enable Site Wise settings if you want to configure “Disable Comments” "
291
  "settings individually on every website."
292
  msgstr ""
293
 
294
+ #: views/partials/_disable.php:53
295
  msgid ""
296
  "This site will be controlled by the network admin until you click the "
297
  "\"Save Changes\" button."
298
  msgstr ""
299
 
300
+ #: views/partials/_disable.php:60
301
  msgid "Disable comments globally on your entire website"
302
  msgstr ""
303
 
304
+ #: views/partials/_disable.php:61
305
  msgid ""
306
  "This will disable comments from every page and post on your website. Use "
307
  "this setting if you do not want to show comments anywhere."
308
  msgstr ""
309
 
310
+ #: views/partials/_disable.php:65
311
  msgid "On Specific Post Types:"
312
  msgstr ""
313
 
314
+ #: views/partials/_disable.php:84
315
  msgid ""
316
  "Disabling comments will also disable trackbacks and pingbacks. All "
317
  "comment-related fields will also be hidden from the edit/quick-edit screens "
319
  "posts. Comments will be visible on all other post types."
320
  msgstr ""
321
 
322
+ #: views/partials/_disable.php:88
323
  msgid "Disable Comments With API"
324
  msgstr ""
325
 
326
+ #: views/partials/_disable.php:89
327
  msgid ""
328
  "You can disable comments made on your website using WordPress "
329
  "specifications."
330
  msgstr ""
331
 
332
+ #: views/partials/_disable.php:99
333
  msgid "Disable Comments via XML-RPC"
334
  msgstr ""
335
 
336
+ #: views/partials/_disable.php:108
337
  msgid "Disable Comments via REST API"
338
  msgstr ""
339
 
340
+ #: views/partials/_disable.php:112
341
  msgid ""
342
  "Turning on these settings will disable any comments made on your website "
343
  "via XML-RPC or REST API specifications."
344
  msgstr ""
345
 
346
+ #: views/partials/_disable.php:117
347
  msgid "Save Changes"
348
  msgstr ""
349
 
426
  msgid "https://wpdeveloper.net"
427
  msgstr ""
428
 
429
+ #: disable-comments.php:679
430
  msgctxt "settings menu title"
431
  msgid "Disable Comments"
432
  msgstr ""
readme.txt CHANGED
@@ -1,11 +1,11 @@
1
- === Disable Comments - Remove Comments & Protect From Spam ===
2
  Contributors: Asif2BD, priyomukul, wpdevteam, re_enter_rupok, tusharimran, alimuzzamanalim, solarissmoke, garrett-eclipse
3
  Donate link: https://wpdeveloper.net/
4
- Tags: comments, delete comments, disable comments, spam comment, disable, stop spam, remove comments, anti spam, disable xml-rpc, hide comment, XML-RPC, REST-API, WP-CLI
5
  Requires at least: 5.0
6
  Tested up to: 5.8
7
  Requires PHP: 5.6
8
- Stable tag: 2.2.1
9
  License: GPL-3.0-or-later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
@@ -13,7 +13,7 @@ Allows administrators to globally disable comments on their site. Comments can b
13
 
14
  == Description ==
15
 
16
- = Disable Comments - Remove Comments & Protect From Spam =
17
 
18
  Instantly allow or disallow comments from any post type in WordPress (Pages, Posts, or Media) to stop the spammers and gain complete control over your full website. WP-CLI Support & Control comments via XML-RPC and REST-API too!
19
 
@@ -44,6 +44,7 @@ https://www.youtube.com/watch?v=J9AteKzQpPs
44
  * Stop spam comments entirely from the site with one click.
45
  * **[New]** Delete comments by type.
46
  * **[New]** Disable comments via [XML-RPC](https://wpdeveloper.net/docs/how-to-disable-comments-made-via-xml-rpc/) & [REST-API](https://wpdeveloper.net/docs/how-to-disable-comments-made-via-rest-api/)
 
47
 
48
  https://www.youtube.com/watch?v=FBq3-W-p-DM
49
 
@@ -190,6 +191,10 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
190
  and this project adheres to [Semantic Versioning](http://semver.org/).
191
  This will be maiintained from August 19, 2020 - @asif2bd
192
 
 
 
 
 
193
  = [2.2.1] - 2021-09-26 =
194
  * Fixed: 100+ subsites limit issue in multisite network
195
 
@@ -370,4 +375,4 @@ This will be maiintained from August 19, 2020 - @asif2bd
370
 
371
  == Upgrade Notice ==
372
 
373
- [Minor Update] 100+ subsites limit issue in multisite network
1
+ === Disable Comments - Remove Comments & Stop Spam [Multi-Site Support] ===
2
  Contributors: Asif2BD, priyomukul, wpdevteam, re_enter_rupok, tusharimran, alimuzzamanalim, solarissmoke, garrett-eclipse
3
  Donate link: https://wpdeveloper.net/
4
+ Tags: comments, delete comments, disable comments, spam comment, disable, stop spam, remove comments, anti spam, disable xml-rpc, hide comment, XML-RPC, REST-API, WP-CLI, multi-site support
5
  Requires at least: 5.0
6
  Tested up to: 5.8
7
  Requires PHP: 5.6
8
+ Stable tag: 2.2.2
9
  License: GPL-3.0-or-later
10
  License URI: https://www.gnu.org/licenses/gpl-3.0.html
11
 
13
 
14
  == Description ==
15
 
16
+ = Disable Comments - Remove Comments & Stop Spam [Multi-Site Support] =
17
 
18
  Instantly allow or disallow comments from any post type in WordPress (Pages, Posts, or Media) to stop the spammers and gain complete control over your full website. WP-CLI Support & Control comments via XML-RPC and REST-API too!
19
 
44
  * Stop spam comments entirely from the site with one click.
45
  * **[New]** Delete comments by type.
46
  * **[New]** Disable comments via [XML-RPC](https://wpdeveloper.net/docs/how-to-disable-comments-made-via-xml-rpc/) & [REST-API](https://wpdeveloper.net/docs/how-to-disable-comments-made-via-rest-api/)
47
+ * **[New]** Fully Multi-site Network supported.
48
 
49
  https://www.youtube.com/watch?v=FBq3-W-p-DM
50
 
191
  and this project adheres to [Semantic Versioning](http://semver.org/).
192
  This will be maiintained from August 19, 2020 - @asif2bd
193
 
194
+ = [2.2.2] - 2021-10-05 =
195
+ * Added: "Select All" checkbox for subsites selection in a multisite network.
196
+ * Few minor bug fixes and improvement.
197
+
198
  = [2.2.1] - 2021-09-26 =
199
  * Fixed: 100+ subsites limit issue in multisite network
200
 
375
 
376
  == Upgrade Notice ==
377
 
378
+ [Minor Update] Few minor bug fixes and improvement.
views/partials/_delete.php CHANGED
@@ -6,11 +6,15 @@
6
 
7
  <div class="disable__comment__option mb50">
8
  <?php if(is_network_admin()):?>
9
- <div class="disable_option dc-text__block mb30 mt30">
10
  <h3>Delete comments in the following sites:</h3>
11
  <div class="disabled__sites delete__checklist">
12
  <?php
13
- $disabled_site_options = isset($this->options['disabled_sites']) ? $this->options['disabled_sites'] : [];
 
 
 
 
14
  $sub_sites = get_sites([
15
  'number' => 0,
16
  ]);
@@ -19,7 +23,7 @@
19
  $blog = get_blog_details($sub_site_id);
20
  echo
21
  "<div class='delete__checklist__item'>
22
- <input type='checkbox' id='delete__checklist__item-$sub_site_id' name='disabled_sites[]' value='$sub_site_id' checked='checked'>
23
  <label for='delete__checklist__item-$sub_site_id'>{$blog->blogname}</label>
24
  </div>";
25
  }
6
 
7
  <div class="disable__comment__option mb50">
8
  <?php if(is_network_admin()):?>
9
+ <div class="disable_option sites_option dc-text__block mb30 mt30">
10
  <h3>Delete comments in the following sites:</h3>
11
  <div class="disabled__sites delete__checklist">
12
  <?php
13
+ echo "
14
+ <div class='delete__checklist__item'>
15
+ <input type='checkbox' class='check-all' id='delete__checklist__check__all' data-list='delete__checklist__item' checked >
16
+ <label for='delete__checklist__check__all'><b>Select All</b> <small>(0 selected)</small></label>
17
+ </div><br />";
18
  $sub_sites = get_sites([
19
  'number' => 0,
20
  ]);
23
  $blog = get_blog_details($sub_site_id);
24
  echo
25
  "<div class='delete__checklist__item'>
26
+ <input type='checkbox' id='delete__checklist__item-$sub_site_id' class='site_option' name='disabled_sites[]' value='$sub_site_id' checked='checked'>
27
  <label for='delete__checklist__item-$sub_site_id'>{$blog->blogname}</label>
28
  </div>";
29
  }
views/partials/_disable.php CHANGED
@@ -19,7 +19,7 @@
19
  <p class="disable__option__description"><span class="danger"><?php _e('Note:', 'disable-comments'); ?></span> <?php _e('If you enable Site Wise settings, you need to configure your “Disable Comments” settings individually on every website in the network.', 'disable-comments'); ?></p>
20
  </div>
21
  </div>
22
- <div class="disable_option dc-text__block mb30 mt30">
23
  <h3>Disable comments in the following sites:</h3>
24
  <div class="disabled__sites remove__checklist">
25
  <?php
@@ -27,12 +27,19 @@
27
  $sub_sites = get_sites([
28
  'number' => 0,
29
  ]);
 
 
 
 
 
 
 
30
  foreach ( $sub_sites as $sub_site ) {
31
  $sub_site_id = $sub_site->blog_id;
32
  $blog = get_blog_details($sub_site_id);
33
  echo
34
  "<div class='remove__checklist__item'>
35
- <input type='checkbox' id='remove__checklist__item-$sub_site_id' name='disabled_sites[]' value='$sub_site_id'" . checked(in_array($sub_site_id, $disabled_site_options), true, false) . ">
36
  <label for='remove__checklist__item-$sub_site_id'>{$blog->blogname}</label>
37
  </div>";
38
  }
19
  <p class="disable__option__description"><span class="danger"><?php _e('Note:', 'disable-comments'); ?></span> <?php _e('If you enable Site Wise settings, you need to configure your “Disable Comments” settings individually on every website in the network.', 'disable-comments'); ?></p>
20
  </div>
21
  </div>
22
+ <div class="disable_option sites_option dc-text__block mb30 mt30">
23
  <h3>Disable comments in the following sites:</h3>
24
  <div class="disabled__sites remove__checklist">
25
  <?php
27
  $sub_sites = get_sites([
28
  'number' => 0,
29
  ]);
30
+ echo "
31
+ <div class='remove__checklist__item'>
32
+ <input type='checkbox' class='check-all' id='disabled__sites__check__all' data-list='remove__checklist__item' name='disabled_sites[]' value='all' " .
33
+ checked(!empty($disabled_site_options['all']), true, false) . ">
34
+ <label for='disabled__sites__check__all'><b>Select All</b> <small>(0 selected)</small></label>
35
+ </div>";
36
+
37
  foreach ( $sub_sites as $sub_site ) {
38
  $sub_site_id = $sub_site->blog_id;
39
  $blog = get_blog_details($sub_site_id);
40
  echo
41
  "<div class='remove__checklist__item'>
42
+ <input type='checkbox' id='remove__checklist__item-$sub_site_id' class='site_option' name='disabled_sites[]' value='site_$sub_site_id'" . checked(!empty($disabled_site_options["site_$sub_site_id"]), true, false) . ">
43
  <label for='remove__checklist__item-$sub_site_id'>{$blog->blogname}</label>
44
  </div>";
45
  }