Disable Comments - Version 1.2

Version Description

  • Allow network administrators to disable comments on custom post types across the whole network.
Download this release

Release Info

Developer solarissmoke
Plugin Icon 128x128 Disable Comments
Version 1.2
Comparing to
See all releases

Code changes from version 1.1.1 to 1.2

disable-comments.php CHANGED
@@ -3,7 +3,7 @@
3
  Plugin Name: Disable Comments
4
  Plugin URI: http://wordpress.org/extend/plugins/disable-comments/
5
  Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type.
6
- Version: 1.1.1
7
  Author: Samir Shah
8
  Author URI: http://rayofsolaris.net/
9
  License: GPL2
@@ -15,7 +15,7 @@ if( !defined( 'ABSPATH' ) )
15
  exit;
16
 
17
  class Disable_Comments {
18
- const db_version = 5;
19
  private $options;
20
  private $networkactive;
21
  private $modified_types = array();
@@ -23,13 +23,13 @@ class Disable_Comments {
23
  function __construct() {
24
  // are we network activated?
25
  $this->networkactive = ( is_multisite() && array_key_exists( plugin_basename( __FILE__ ), (array) get_site_option( 'active_sitewide_plugins' ) ) );
26
-
27
  // load options
28
  $this->options = $this->networkactive ? get_site_option( 'disable_comments_options', array() ) : get_option( 'disable_comments_options', array() );
29
-
30
  // load language files
31
  load_plugin_textdomain( 'disable-comments', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
32
-
33
  // If it looks like first run, check compat
34
  if ( empty( $this->options ) && version_compare( $GLOBALS['wp_version'], '3.4', '<' ) ) {
35
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
@@ -37,7 +37,7 @@ class Disable_Comments {
37
  if ( isset( $_GET['action'] ) && ( $_GET['action'] == 'activate' || $_GET['action'] == 'error_scrape' ) )
38
  exit( sprintf( __( 'Disable Comments requires WordPress version %s or greater.', 'disable-comments' ), '3.3' ) );
39
  }
40
-
41
  $old_ver = isset( $this->options['db_version'] ) ? $this->options['db_version'] : 0;
42
  if( $old_ver < self::db_version ) {
43
  if( $old_ver < 2 ) {
@@ -52,39 +52,42 @@ class Disable_Comments {
52
  unset( $this->options[$v] );
53
  }
54
 
55
- foreach( array( 'remove_everywhere', 'permanent' ) as $v )
56
- if( !isset( $this->options[$v] ) )
57
  $this->options[$v] = false;
 
 
58
 
59
  $this->options['db_version'] = self::db_version;
60
  $this->update_options();
61
  }
62
-
63
  // these need to happen now
64
  if( $this->options['remove_everywhere'] ) {
65
  add_action( 'widgets_init', array( $this, 'disable_rc_widget' ) );
66
  add_filter( 'wp_headers', array( $this, 'filter_wp_headers' ) );
67
  add_action( 'template_redirect', array( $this, 'filter_query' ), 9 ); // before redirect_canonical
68
-
69
  // Admin bar filtering has to happen here since WP 3.6
70
  add_action( 'template_redirect', array( $this, 'filter_admin_bar' ) );
71
  add_action( 'admin_init', array( $this, 'filter_admin_bar' ) );
72
  }
73
-
74
  // these can happen later
75
- add_action( 'wp_loaded', array( $this, 'setup_filters' ) );
76
  }
77
-
78
  private function update_options() {
79
  if( $this->networkactive )
80
  update_site_option( 'disable_comments_options', $this->options );
81
  else
82
  update_option( 'disable_comments_options', $this->options );
83
  }
84
-
85
  function setup_filters(){
86
- if( !empty( $this->options['disabled_post_types'] ) ) {
87
- foreach( $this->options['disabled_post_types'] as $type ) {
 
88
  // we need to know what native support was for later
89
  if( post_type_supports( $type, 'comments' ) ) {
90
  $this->modified_types[] = $type;
@@ -120,7 +123,7 @@ class Disable_Comments {
120
  add_action( 'edit_form_advanced', array( $this, 'edit_form_inputs' ) );
121
  add_action( 'edit_page_form', array( $this, 'edit_form_inputs' ) );
122
  }
123
-
124
  if( $this->options['remove_everywhere'] ) {
125
  add_action( 'admin_menu', array( $this, 'filter_admin_menu' ), 9999 ); // do this as late as possible
126
  add_action( 'admin_head', array( $this, 'hide_dashboard_bits' ) );
@@ -135,11 +138,13 @@ class Disable_Comments {
135
  }
136
 
137
  function check_comment_template() {
138
- if( is_singular() && ( $this->options['remove_everywhere'] || in_array( get_post_type(), $this->options['disabled_post_types'] ) ) ) {
139
  // Kill the comments template. This will deal with themes that don't check comment stati properly!
140
  add_filter( 'comments_template', array( $this, 'dummy_comments_template' ), 20 );
141
  // Remove comment-reply script for themes that include it indiscriminately
142
  wp_deregister_script( 'comment-reply' );
 
 
143
  }
144
  }
145
 
@@ -151,7 +156,7 @@ class Disable_Comments {
151
  unset( $headers['X-Pingback'] );
152
  return $headers;
153
  }
154
-
155
  function filter_query() {
156
  if( is_comment_feed() ) {
157
  if( isset( $_GET['feed'] ) ) {
@@ -163,7 +168,7 @@ class Disable_Comments {
163
  redirect_canonical();
164
  }
165
  }
166
-
167
  function filter_admin_bar() {
168
  if( is_admin_bar_showing() ) {
169
  // Remove comments links from admin bar
@@ -173,7 +178,7 @@ class Disable_Comments {
173
  add_action( 'admin_bar_menu', array( $this, 'remove_network_comment_links' ), 500 );
174
  }
175
  }
176
-
177
  function remove_network_comment_links( $wp_admin_bar ) {
178
  if( $this->networkactive ) {
179
  foreach( (array) $wp_admin_bar->user->blogs as $blog )
@@ -184,7 +189,7 @@ class Disable_Comments {
184
  $wp_admin_bar->remove_menu( 'blog-' . get_current_blog_id() . '-c' );
185
  }
186
  }
187
-
188
  function edit_form_inputs() {
189
  global $post;
190
  // Without a dicussion meta box, comment_status will be set to closed on new/updated posts
@@ -192,11 +197,12 @@ class Disable_Comments {
192
  echo '<input type="hidden" name="comment_status" value="' . $post->comment_status . '" /><input type="hidden" name="ping_status" value="' . $post->ping_status . '" />';
193
  }
194
  }
195
-
196
  function discussion_notice(){
197
- if( get_current_screen()->id == 'options-discussion' && !empty( $this->options['disabled_post_types'] ) ) {
 
198
  $names = array();
199
- foreach( $this->options['disabled_post_types'] as $type )
200
  $names[$type] = get_post_type_object( $type )->labels->name;
201
  ?>
202
  <script>
@@ -207,7 +213,7 @@ jQuery(document).ready(function($){
207
  <?php
208
  }
209
  }
210
-
211
  /**
212
  * Return context-aware settings page URL
213
  */
@@ -215,7 +221,7 @@ jQuery(document).ready(function($){
215
  $base = $this->networkactive ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );
216
  return add_query_arg( 'page', 'disable_comments_settings', $base );
217
  }
218
-
219
  function setup_notice(){
220
  if( strpos( get_current_screen()->id, 'settings_page_disable_comments_settings' ) === 0 )
221
  return;
@@ -223,8 +229,8 @@ jQuery(document).ready(function($){
223
  if( $hascaps )
224
  echo '<div class="updated fade"><p>' . sprintf( __( 'The <em>Disable Comments</em> plugin is active, but isn\'t configured to do anything yet. Visit the <a href="%s">configuration page</a> to choose which post types to disable comments on.', 'disable-comments'), esc_attr( $this->settings_page_url() ) ) . '</p></div>';
225
  }
226
-
227
- function filter_admin_menu(){
228
  global $pagenow;
229
 
230
  if ( $pagenow == 'comment.php' || $pagenow == 'edit-comments.php' || $pagenow == 'options-discussion.php' )
@@ -233,16 +239,16 @@ jQuery(document).ready(function($){
233
  remove_menu_page( 'edit-comments.php' );
234
  remove_submenu_page( 'options-general.php', 'options-discussion.php' );
235
  }
236
-
237
  function filter_dashboard(){
238
  remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
239
  }
240
-
241
  function hide_dashboard_bits(){
242
  if( 'dashboard' == get_current_screen()->id )
243
  add_action( 'admin_print_footer_scripts', array( $this, 'dashboard_js' ) );
244
  }
245
-
246
  function dashboard_js(){
247
  if( version_compare( $GLOBALS['wp_version'], '3.8', '<' ) ) {
248
  // getting hold of the discussion box is tricky. The table_discussion class is used for other things in multisite
@@ -252,17 +258,17 @@ jQuery(document).ready(function($){
252
  echo '<script> jQuery(function($){ $("#dashboard_right_now .comment-count, #latest-comments").hide(); }); </script>';
253
  }
254
  }
255
-
256
  function filter_comment_status( $open, $post_id ) {
257
  $post = get_post( $post_id );
258
- return ( $this->options['remove_everywhere'] || in_array( $post->post_type, $this->options['disabled_post_types'] ) ) ? false : $open;
259
  }
260
-
261
  function disable_rc_widget() {
262
  // This widget has been removed from the Dashboard in WP 3.8 and can be removed in a future version
263
  unregister_widget( 'WP_Widget_Recent_Comments' );
264
  }
265
-
266
  function set_plugin_meta( $links, $file ) {
267
  static $plugin;
268
  $plugin = plugin_basename( __FILE__ );
@@ -271,7 +277,7 @@ jQuery(document).ready(function($){
271
  }
272
  return $links;
273
  }
274
-
275
  /**
276
  * Add links to Settings page
277
  */
@@ -279,7 +285,7 @@ jQuery(document).ready(function($){
279
  static $plugin;
280
  $plugin = plugin_basename( __FILE__ );
281
  if( $file == $plugin && current_user_can('manage_options') ) {
282
- array_unshift(
283
  $links,
284
  sprintf( '<a href="%s">%s</a>', esc_attr( $this->settings_page_url() ), __( 'Settings' ) )
285
  );
@@ -295,11 +301,12 @@ jQuery(document).ready(function($){
295
  else
296
  add_submenu_page( 'options-general.php', $title, $title, 'manage_options', 'disable_comments_settings', array( $this, 'settings_page' ) );
297
  }
298
-
299
  function settings_page() {
300
  $typeargs = array( 'public' => true );
301
- if( $this->networkactive )
302
  $typeargs['_builtin'] = true; // stick to known types for network
 
303
  $types = get_post_types( $typeargs, 'objects' );
304
  foreach( array_keys( $types ) as $type ) {
305
  if( ! in_array( $type, $this->modified_types ) && ! post_type_supports( $type, 'comments' ) ) // the type doesn't support comments anyway
@@ -307,36 +314,42 @@ jQuery(document).ready(function($){
307
  }
308
 
309
  $persistent_allowed = $this->persistent_mode_allowed();
310
-
311
  if ( isset( $_POST['submit'] ) ) {
312
  check_admin_referer( 'disable-comments-admin' );
313
  $this->options['remove_everywhere'] = ( $_POST['mode'] == 'remove_everywhere' );
314
-
315
  if( $this->options['remove_everywhere'] )
316
  $disabled_post_types = array_keys( $types );
317
  else
318
  $disabled_post_types = empty( $_POST['disabled_types'] ) ? array() : (array) $_POST['disabled_types'];
319
 
320
  $disabled_post_types = array_intersect( $disabled_post_types, array_keys( $types ) );
321
-
322
  // entering permanent mode, or post types have changed
323
  if( $persistent_allowed && !empty( $_POST['permanent'] ) && ( !$this->options['permanent'] || $disabled_post_types != $this->options['disabled_post_types'] ) )
324
  $this->enter_permanent_mode();
325
-
326
  $this->options['disabled_post_types'] = $disabled_post_types;
327
  $this->options['permanent'] = $persistent_allowed && isset( $_POST['permanent'] );
328
-
 
 
 
 
 
 
329
  $this->update_options();
330
  $cache_message = WP_CACHE ? ' <strong>' . __( 'If a caching/performance plugin is active, please invalidate its cache to ensure that changes are reflected immediately.' ) . '</strong>' : '';
331
  echo '<div id="message" class="updated"><p>' . __( 'Options updated. Changes to the Admin Menu and Admin Bar will not appear until you leave or reload this page.', 'disable-comments' ) . $cache_message . '</p></div>';
332
- }
333
  ?>
334
  <style> .indent {padding-left: 2em} </style>
335
  <div class="wrap">
336
  <?php screen_icon( 'plugins' ); ?>
337
  <h2><?php _e( 'Disable Comments', 'disable-comments') ?></h2>
338
- <?php
339
- if( $this->networkactive )
340
  echo '<div class="updated"><p>' . __( '<em>Disable Comments</em> is Network Activated. The settings below will affect <strong>all sites</strong> in this network.', 'disable-comments') . '</p></div>';
341
  if( WP_CACHE )
342
  echo '<div class="updated"><p>' . __( "It seems that a caching/performance plugin is active on this site. Please manually invalidate that plugin's cache after making any changes to the settings below.", 'disable-comments') . '</p></div>';
@@ -351,6 +364,10 @@ jQuery(document).ready(function($){
351
  <ul class="indent" id="listoftypes">
352
  <?php foreach( $types as $k => $v ) echo "<li><label for='post-type-$k'><input type='checkbox' name='disabled_types[]' value='$k' ". checked( in_array( $k, $this->options['disabled_post_types'] ), true, false ) ." id='post-type-$k'> {$v->labels->name}</label></li>";?>
353
  </ul>
 
 
 
 
354
  <p class="indent"><?php _e( 'Disabling comments will also disable trackbacks and pingbacks. All comment-related fields will also be hidden from the edit/quick-edit screens of the affected posts. These settings cannot be overridden for individual posts.', 'disable-comments') ?></p>
355
  </li>
356
  </ul>
@@ -374,19 +391,20 @@ jQuery(document).ready(function($){
374
  <script>
375
  jQuery(document).ready(function($){
376
  function disable_comments_uihelper(){
 
377
  if( $("#remove_everywhere").is(":checked") )
378
- $("#listoftypes").css("color", "#888").find(":input").attr("disabled", true );
379
  else
380
- $("#listoftypes").css("color", "#000").find(":input").attr("disabled", false );
381
  }
382
-
383
  $("#disable-comments :input").change(function(){
384
  $("#message").slideUp();
385
  disable_comments_uihelper();
386
  });
387
-
388
  disable_comments_uihelper();
389
-
390
  $("#permanent").change( function() {
391
  if( $(this).is(":checked") && ! confirm(<?php echo json_encode( sprintf( __( '%s: Selecting this option will make persistent changes to your database. Are you sure you want to enable it?', 'disable-comments'), __( 'Warning', 'disable-comments' ) ) );?>) )
392
  $(this).attr("checked", false );
@@ -395,18 +413,18 @@ jQuery(document).ready(function($){
395
  </script>
396
  <?php
397
  }
398
-
399
  private function enter_permanent_mode() {
400
- $types = $this->options['disabled_post_types'];
401
  if( empty( $types ) )
402
  return;
403
-
404
  global $wpdb;
405
 
406
  if( $this->networkactive ) {
407
  // NOTE: this can be slow on large networks!
408
  $blogs = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND deleted = '0'", $wpdb->siteid ) );
409
-
410
  foreach ( $blogs as $id ) {
411
  switch_to_blog( $id );
412
  $this->close_comments_in_db( $types );
@@ -417,17 +435,35 @@ jQuery(document).ready(function($){
417
  $this->close_comments_in_db( $types );
418
  }
419
  }
420
-
421
  private function close_comments_in_db( $types ){
422
  global $wpdb;
423
  $bits = implode( ', ', array_pad( array(), count( $types ), '%s' ) );
424
  $wpdb->query( $wpdb->prepare( "UPDATE `$wpdb->posts` SET `comment_status` = 'closed', ping_status = 'closed' WHERE `post_type` IN ( $bits )", $types ) );
425
  }
426
-
427
  private function persistent_mode_allowed() {
428
  return apply_filters( 'disable_comments_allow_persistent_mode', true );
429
  }
430
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
431
  function single_site_deactivate() {
432
  // for single sites, delete the options upon deactivation, not uninstall
433
  delete_option( 'disable_comments_options' );
3
  Plugin Name: Disable Comments
4
  Plugin URI: http://wordpress.org/extend/plugins/disable-comments/
5
  Description: Allows administrators to globally disable comments on their site. Comments can be disabled according to post type.
6
+ Version: 1.2
7
  Author: Samir Shah
8
  Author URI: http://rayofsolaris.net/
9
  License: GPL2
15
  exit;
16
 
17
  class Disable_Comments {
18
+ const db_version = 6;
19
  private $options;
20
  private $networkactive;
21
  private $modified_types = array();
23
  function __construct() {
24
  // are we network activated?
25
  $this->networkactive = ( is_multisite() && array_key_exists( plugin_basename( __FILE__ ), (array) get_site_option( 'active_sitewide_plugins' ) ) );
26
+
27
  // load options
28
  $this->options = $this->networkactive ? get_site_option( 'disable_comments_options', array() ) : get_option( 'disable_comments_options', array() );
29
+
30
  // load language files
31
  load_plugin_textdomain( 'disable-comments', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
32
+
33
  // If it looks like first run, check compat
34
  if ( empty( $this->options ) && version_compare( $GLOBALS['wp_version'], '3.4', '<' ) ) {
35
  require_once( ABSPATH . 'wp-admin/includes/plugin.php' );
37
  if ( isset( $_GET['action'] ) && ( $_GET['action'] == 'activate' || $_GET['action'] == 'error_scrape' ) )
38
  exit( sprintf( __( 'Disable Comments requires WordPress version %s or greater.', 'disable-comments' ), '3.3' ) );
39
  }
40
+
41
  $old_ver = isset( $this->options['db_version'] ) ? $this->options['db_version'] : 0;
42
  if( $old_ver < self::db_version ) {
43
  if( $old_ver < 2 ) {
52
  unset( $this->options[$v] );
53
  }
54
 
55
+ foreach( array( 'remove_everywhere', 'permanent', 'extra_post_types' ) as $v ) {
56
+ if( !isset( $this->options[$v] ) ) {
57
  $this->options[$v] = false;
58
+ }
59
+ }
60
 
61
  $this->options['db_version'] = self::db_version;
62
  $this->update_options();
63
  }
64
+
65
  // these need to happen now
66
  if( $this->options['remove_everywhere'] ) {
67
  add_action( 'widgets_init', array( $this, 'disable_rc_widget' ) );
68
  add_filter( 'wp_headers', array( $this, 'filter_wp_headers' ) );
69
  add_action( 'template_redirect', array( $this, 'filter_query' ), 9 ); // before redirect_canonical
70
+
71
  // Admin bar filtering has to happen here since WP 3.6
72
  add_action( 'template_redirect', array( $this, 'filter_admin_bar' ) );
73
  add_action( 'admin_init', array( $this, 'filter_admin_bar' ) );
74
  }
75
+
76
  // these can happen later
77
+ add_action( 'wp_loaded', array( $this, 'setup_filters' ) );
78
  }
79
+
80
  private function update_options() {
81
  if( $this->networkactive )
82
  update_site_option( 'disable_comments_options', $this->options );
83
  else
84
  update_option( 'disable_comments_options', $this->options );
85
  }
86
+
87
  function setup_filters(){
88
+ $disabled_post_types = $this->get_disabled_post_types();
89
+ if( !empty( $disabled_post_types ) ) {
90
+ foreach( $disabled_post_types as $type ) {
91
  // we need to know what native support was for later
92
  if( post_type_supports( $type, 'comments' ) ) {
93
  $this->modified_types[] = $type;
123
  add_action( 'edit_form_advanced', array( $this, 'edit_form_inputs' ) );
124
  add_action( 'edit_page_form', array( $this, 'edit_form_inputs' ) );
125
  }
126
+
127
  if( $this->options['remove_everywhere'] ) {
128
  add_action( 'admin_menu', array( $this, 'filter_admin_menu' ), 9999 ); // do this as late as possible
129
  add_action( 'admin_head', array( $this, 'hide_dashboard_bits' ) );
138
  }
139
 
140
  function check_comment_template() {
141
+ if( is_singular() && ( $this->options['remove_everywhere'] || $this->is_post_type_disabled( get_post_type() ) ) ) {
142
  // Kill the comments template. This will deal with themes that don't check comment stati properly!
143
  add_filter( 'comments_template', array( $this, 'dummy_comments_template' ), 20 );
144
  // Remove comment-reply script for themes that include it indiscriminately
145
  wp_deregister_script( 'comment-reply' );
146
+ // feed_links_extra inserts a comments RSS link
147
+ remove_action( 'wp_head', 'feed_links_extra', 3 );
148
  }
149
  }
150
 
156
  unset( $headers['X-Pingback'] );
157
  return $headers;
158
  }
159
+
160
  function filter_query() {
161
  if( is_comment_feed() ) {
162
  if( isset( $_GET['feed'] ) ) {
168
  redirect_canonical();
169
  }
170
  }
171
+
172
  function filter_admin_bar() {
173
  if( is_admin_bar_showing() ) {
174
  // Remove comments links from admin bar
178
  add_action( 'admin_bar_menu', array( $this, 'remove_network_comment_links' ), 500 );
179
  }
180
  }
181
+
182
  function remove_network_comment_links( $wp_admin_bar ) {
183
  if( $this->networkactive ) {
184
  foreach( (array) $wp_admin_bar->user->blogs as $blog )
189
  $wp_admin_bar->remove_menu( 'blog-' . get_current_blog_id() . '-c' );
190
  }
191
  }
192
+
193
  function edit_form_inputs() {
194
  global $post;
195
  // Without a dicussion meta box, comment_status will be set to closed on new/updated posts
197
  echo '<input type="hidden" name="comment_status" value="' . $post->comment_status . '" /><input type="hidden" name="ping_status" value="' . $post->ping_status . '" />';
198
  }
199
  }
200
+
201
  function discussion_notice(){
202
+ $disabled_post_types = $this->get_disabled_post_types();
203
+ if( get_current_screen()->id == 'options-discussion' && !empty( $disabled_post_types ) ) {
204
  $names = array();
205
+ foreach( $disabled_post_types as $type )
206
  $names[$type] = get_post_type_object( $type )->labels->name;
207
  ?>
208
  <script>
213
  <?php
214
  }
215
  }
216
+
217
  /**
218
  * Return context-aware settings page URL
219
  */
221
  $base = $this->networkactive ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' );
222
  return add_query_arg( 'page', 'disable_comments_settings', $base );
223
  }
224
+
225
  function setup_notice(){
226
  if( strpos( get_current_screen()->id, 'settings_page_disable_comments_settings' ) === 0 )
227
  return;
229
  if( $hascaps )
230
  echo '<div class="updated fade"><p>' . sprintf( __( 'The <em>Disable Comments</em> plugin is active, but isn\'t configured to do anything yet. Visit the <a href="%s">configuration page</a> to choose which post types to disable comments on.', 'disable-comments'), esc_attr( $this->settings_page_url() ) ) . '</p></div>';
231
  }
232
+
233
+ function filter_admin_menu(){
234
  global $pagenow;
235
 
236
  if ( $pagenow == 'comment.php' || $pagenow == 'edit-comments.php' || $pagenow == 'options-discussion.php' )
239
  remove_menu_page( 'edit-comments.php' );
240
  remove_submenu_page( 'options-general.php', 'options-discussion.php' );
241
  }
242
+
243
  function filter_dashboard(){
244
  remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' );
245
  }
246
+
247
  function hide_dashboard_bits(){
248
  if( 'dashboard' == get_current_screen()->id )
249
  add_action( 'admin_print_footer_scripts', array( $this, 'dashboard_js' ) );
250
  }
251
+
252
  function dashboard_js(){
253
  if( version_compare( $GLOBALS['wp_version'], '3.8', '<' ) ) {
254
  // getting hold of the discussion box is tricky. The table_discussion class is used for other things in multisite
258
  echo '<script> jQuery(function($){ $("#dashboard_right_now .comment-count, #latest-comments").hide(); }); </script>';
259
  }
260
  }
261
+
262
  function filter_comment_status( $open, $post_id ) {
263
  $post = get_post( $post_id );
264
+ return ( $this->options['remove_everywhere'] || $this->is_post_type_disabled( $post->post_type ) ) ? false : $open;
265
  }
266
+
267
  function disable_rc_widget() {
268
  // This widget has been removed from the Dashboard in WP 3.8 and can be removed in a future version
269
  unregister_widget( 'WP_Widget_Recent_Comments' );
270
  }
271
+
272
  function set_plugin_meta( $links, $file ) {
273
  static $plugin;
274
  $plugin = plugin_basename( __FILE__ );
277
  }
278
  return $links;
279
  }
280
+
281
  /**
282
  * Add links to Settings page
283
  */
285
  static $plugin;
286
  $plugin = plugin_basename( __FILE__ );
287
  if( $file == $plugin && current_user_can('manage_options') ) {
288
+ array_unshift(
289
  $links,
290
  sprintf( '<a href="%s">%s</a>', esc_attr( $this->settings_page_url() ), __( 'Settings' ) )
291
  );
301
  else
302
  add_submenu_page( 'options-general.php', $title, $title, 'manage_options', 'disable_comments_settings', array( $this, 'settings_page' ) );
303
  }
304
+
305
  function settings_page() {
306
  $typeargs = array( 'public' => true );
307
+ if( $this->networkactive ) {
308
  $typeargs['_builtin'] = true; // stick to known types for network
309
+ }
310
  $types = get_post_types( $typeargs, 'objects' );
311
  foreach( array_keys( $types ) as $type ) {
312
  if( ! in_array( $type, $this->modified_types ) && ! post_type_supports( $type, 'comments' ) ) // the type doesn't support comments anyway
314
  }
315
 
316
  $persistent_allowed = $this->persistent_mode_allowed();
317
+
318
  if ( isset( $_POST['submit'] ) ) {
319
  check_admin_referer( 'disable-comments-admin' );
320
  $this->options['remove_everywhere'] = ( $_POST['mode'] == 'remove_everywhere' );
321
+
322
  if( $this->options['remove_everywhere'] )
323
  $disabled_post_types = array_keys( $types );
324
  else
325
  $disabled_post_types = empty( $_POST['disabled_types'] ) ? array() : (array) $_POST['disabled_types'];
326
 
327
  $disabled_post_types = array_intersect( $disabled_post_types, array_keys( $types ) );
328
+
329
  // entering permanent mode, or post types have changed
330
  if( $persistent_allowed && !empty( $_POST['permanent'] ) && ( !$this->options['permanent'] || $disabled_post_types != $this->options['disabled_post_types'] ) )
331
  $this->enter_permanent_mode();
332
+
333
  $this->options['disabled_post_types'] = $disabled_post_types;
334
  $this->options['permanent'] = $persistent_allowed && isset( $_POST['permanent'] );
335
+
336
+ // Extra custom post types
337
+ if( $this->networkactive && !empty( $_POST['extra_post_types'] ) ) {
338
+ $extra_post_types = array_filter( array_map( 'sanitize_key', explode( ',', $_POST['extra_post_types'] ) ) );
339
+ $this->options['extra_post_types'] = array_diff( $extra_post_types, array_keys( $types ) ); // Make sure we don't double up builtins
340
+ }
341
+
342
  $this->update_options();
343
  $cache_message = WP_CACHE ? ' <strong>' . __( 'If a caching/performance plugin is active, please invalidate its cache to ensure that changes are reflected immediately.' ) . '</strong>' : '';
344
  echo '<div id="message" class="updated"><p>' . __( 'Options updated. Changes to the Admin Menu and Admin Bar will not appear until you leave or reload this page.', 'disable-comments' ) . $cache_message . '</p></div>';
345
+ }
346
  ?>
347
  <style> .indent {padding-left: 2em} </style>
348
  <div class="wrap">
349
  <?php screen_icon( 'plugins' ); ?>
350
  <h2><?php _e( 'Disable Comments', 'disable-comments') ?></h2>
351
+ <?php
352
+ if( $this->networkactive )
353
  echo '<div class="updated"><p>' . __( '<em>Disable Comments</em> is Network Activated. The settings below will affect <strong>all sites</strong> in this network.', 'disable-comments') . '</p></div>';
354
  if( WP_CACHE )
355
  echo '<div class="updated"><p>' . __( "It seems that a caching/performance plugin is active on this site. Please manually invalidate that plugin's cache after making any changes to the settings below.", 'disable-comments') . '</p></div>';
364
  <ul class="indent" id="listoftypes">
365
  <?php foreach( $types as $k => $v ) echo "<li><label for='post-type-$k'><input type='checkbox' name='disabled_types[]' value='$k' ". checked( in_array( $k, $this->options['disabled_post_types'] ), true, false ) ." id='post-type-$k'> {$v->labels->name}</label></li>";?>
366
  </ul>
367
+ <?php if( $this->networkactive ) :?>
368
+ <p class="indent" id="extratypes"><?php _e( 'Only the built-in post types appear above. If you want to disable comments on other custom post types on the entire network, you can supply a comma-separated list of post types below (use the slug that identifies the post type).', 'disable-comments' ); ?>
369
+ <br /><label>Custom post types: <input type="text" name="extra_post_types" size="30" value="<?php echo implode( ', ', (array) $this->options['extra_post_types'] ); ?>" /></label></p>
370
+ <?php endif; ?>
371
  <p class="indent"><?php _e( 'Disabling comments will also disable trackbacks and pingbacks. All comment-related fields will also be hidden from the edit/quick-edit screens of the affected posts. These settings cannot be overridden for individual posts.', 'disable-comments') ?></p>
372
  </li>
373
  </ul>
391
  <script>
392
  jQuery(document).ready(function($){
393
  function disable_comments_uihelper(){
394
+ var indiv_bits = $("#listoftypes, #extratypes");
395
  if( $("#remove_everywhere").is(":checked") )
396
+ indiv_bits.css("color", "#888").find(":input").attr("disabled", true );
397
  else
398
+ indiv_bits.css("color", "#000").find(":input").attr("disabled", false );
399
  }
400
+
401
  $("#disable-comments :input").change(function(){
402
  $("#message").slideUp();
403
  disable_comments_uihelper();
404
  });
405
+
406
  disable_comments_uihelper();
407
+
408
  $("#permanent").change( function() {
409
  if( $(this).is(":checked") && ! confirm(<?php echo json_encode( sprintf( __( '%s: Selecting this option will make persistent changes to your database. Are you sure you want to enable it?', 'disable-comments'), __( 'Warning', 'disable-comments' ) ) );?>) )
410
  $(this).attr("checked", false );
413
  </script>
414
  <?php
415
  }
416
+
417
  private function enter_permanent_mode() {
418
+ $types = $this->get_disabled_post_types();
419
  if( empty( $types ) )
420
  return;
421
+
422
  global $wpdb;
423
 
424
  if( $this->networkactive ) {
425
  // NOTE: this can be slow on large networks!
426
  $blogs = $wpdb->get_col( $wpdb->prepare( "SELECT blog_id FROM $wpdb->blogs WHERE site_id = %d AND public = '1' AND archived = '0' AND deleted = '0'", $wpdb->siteid ) );
427
+
428
  foreach ( $blogs as $id ) {
429
  switch_to_blog( $id );
430
  $this->close_comments_in_db( $types );
435
  $this->close_comments_in_db( $types );
436
  }
437
  }
438
+
439
  private function close_comments_in_db( $types ){
440
  global $wpdb;
441
  $bits = implode( ', ', array_pad( array(), count( $types ), '%s' ) );
442
  $wpdb->query( $wpdb->prepare( "UPDATE `$wpdb->posts` SET `comment_status` = 'closed', ping_status = 'closed' WHERE `post_type` IN ( $bits )", $types ) );
443
  }
444
+
445
  private function persistent_mode_allowed() {
446
  return apply_filters( 'disable_comments_allow_persistent_mode', true );
447
  }
448
 
449
+ /* This function should only be used inside an individual site context */
450
+ private function get_disabled_post_types() {
451
+ $types = $this->options['disabled_post_types'];
452
+ // Not all extra_post_types might be registered on this particular site
453
+ if( $this->networkactive ) {
454
+ foreach( (array) $this->options['extra_post_types'] as $extra ) {
455
+ if( post_type_exists( $extra ) ) {
456
+ $types[] = $extra;
457
+ }
458
+ }
459
+ }
460
+ return $types;
461
+ }
462
+
463
+ private function is_post_type_disabled( $type ) {
464
+ return in_array( $type, $this->get_disabled_post_types() );
465
+ }
466
+
467
  function single_site_deactivate() {
468
  // for single sites, delete the options upon deactivation, not uninstall
469
  delete_option( 'disable_comments_options' );
languages/disable-comments-es_ES.mo ADDED
Binary file
languages/disable-comments-es_ES.po ADDED
@@ -0,0 +1,110 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013 Disable Comments
2
+ # This file is distributed under the same license as the Disable Comments package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Disable Comments 0.9.1\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/disable-comments\n"
7
+ "POT-Creation-Date: 2013-06-19 05:01:50+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-10-14 09:39+0100\n"
12
+ "Last-Translator: David Bravo <dbravo@dimensionmultimedia.com>\n"
13
+ "Language-Team: Dimensión multimedia <dbravo@dimensionmultimedia.com>\n"
14
+ "Plural-Forms: s\n"
15
+ "X-Poedit-Language: Spanish\n"
16
+ "X-Poedit-Country: SPAIN\n"
17
+ "X-Poedit-SourceCharset: utf-8\n"
18
+
19
+ #: disable-comments.php:38
20
+ msgid "Disable Comments requires WordPress version %s or greater."
21
+ msgstr "Es necesario una versión de WordPress %s o superior para Desactivar Comentarios."
22
+
23
+ #: disable-comments.php:169
24
+ msgid "Note: The <em>Disable Comments</em> plugin is currently active, and comments are completely disabled on: %s. Many of the settings below will not be applicable for those post types."
25
+ msgstr "Nota: El plugin <em>Desactivar Comentarios</em> está activo actualmente, y los comentarios están completamente desactivados en: %s. Muchos de los parámetros de abajo no serán aplicables para estos tipos de entradas."
26
+
27
+ #: disable-comments.php:169
28
+ msgid ", "
29
+ msgstr ","
30
+
31
+ #: disable-comments.php:183
32
+ msgid "The <em>Disable Comments</em> plugin is active, but isn't configured to do anything yet. Visit the <a href=\"%s\">configuration page</a> to choose which post types to disable comments on."
33
+ msgstr "El plugin <em>Desactivar Comentarios</em> está activo, pero no está configurado para hacer nada aún. Visita la <a href=\"%s\">página de configuración</a> para elegir en qué tipo de entradas quieres deshabilitar los comentarios."
34
+
35
+ #: disable-comments.php:225
36
+ #: disable-comments.php:269
37
+ msgid "Disable Comments"
38
+ msgstr "Desactivar Comentarios"
39
+
40
+ #: disable-comments.php:262
41
+ msgid "If a caching/performance plugin is active, please invalidate its cache to ensure that changes are reflected immediately."
42
+ msgstr "Si hay activo un plugin de cacheo/rendimiento, por faror, invalida su caché para asegurarte de que los cambios se reflejan inmediatamente."
43
+
44
+ #: disable-comments.php:263
45
+ msgid "Options updated. Changes to the Admin Menu and Admin Bar will not appear until you leave or reload this page."
46
+ msgstr "Opciones actualizadas. Los cambios del Menú de Administración o de la Barra de Administración no aparecerán hasta que abandones o recargues esta página."
47
+
48
+ #: disable-comments.php:272
49
+ msgid "<em>Disable Comments</em> is Network Activated. The settings below will affect <strong>all sites</strong> in this network."
50
+ msgstr "<em>Desactivar Comentarios</em> está Activado en Red. Los parámetros de abajo afectarán a <strong>todos los sitios</strong> de esta red."
51
+
52
+ #: disable-comments.php:274
53
+ msgid "It seems that a caching/performance plugin is active on this site. Please manually invalidate that plugin's cache after making any changes to the settings below."
54
+ msgstr "Parece que hay un plugin de caché/rendimiento activo en este sitio. Por favor, invalida manualmente la caché de ese plugin tras hacer cualquier cambio en los parámetros de abajo."
55
+
56
+ #: disable-comments.php:278
57
+ msgid "Everywhere"
58
+ msgstr "En todos los sitios"
59
+
60
+ #: disable-comments.php:278
61
+ msgid "Disable all comment-related controls and settings in WordPress."
62
+ msgstr "Deshabilitar todos los controles y configuraciones relacionadas con comentarios de WordPress."
63
+
64
+ #: disable-comments.php:279
65
+ msgid "%s: This option is global and will affect your entire site. Use it only if you want to disable comments <em>everywhere</em>. A complete description of what this option does is <a href=\"%s\" target=\"_blank\">available here</a>."
66
+ msgstr "%s: Esta opción es global y afectará a todo tu sitio. Utilízala sólo si quieres deshabilitar los comentarios <em>en todos los sitios</em>. Puedes encontrar una descripción completa sobre lo que hace esta opción <a href=\"%s\" target=\"_blank\">aquí</a>."
67
+
68
+ #: disable-comments.php:279
69
+ #: disable-comments.php:295
70
+ #: disable-comments.php:297
71
+ #: disable-comments.php:325
72
+ msgid "Warning"
73
+ msgstr "Aviso"
74
+
75
+ #: disable-comments.php:281
76
+ msgid "On certain post types"
77
+ msgstr "En determinados tipos de entradas"
78
+
79
+ #: disable-comments.php:286
80
+ msgid "Disabling comments will also disable trackbacks and pingbacks. All comment-related fields will also be hidden from the edit/quick-edit screens of the affected posts. These settings cannot be overridden for individual posts."
81
+ msgstr "Deshabilitando los comentarios tambien deshabilitará los trackbacks y pingbacks. Todos los campos relacionados con comentarios también serán ocultados desde las pantallas de edición y edición rápida de las entradas afectadas. Estos parámetros no pueden ser sobreescritos para entradas individuales."
82
+
83
+ #: disable-comments.php:289
84
+ msgid "Other options"
85
+ msgstr "Otras opciones"
86
+
87
+ #: disable-comments.php:294
88
+ msgid "Use persistent mode"
89
+ msgstr "Usar modo persistente"
90
+
91
+ #: disable-comments.php:295
92
+ msgid "%s: <strong>This will make persistent changes to your database &mdash; comments will remain closed even if you later disable the plugin!</strong> You should not use it if you only want to disable comments temporarily. Please <a href=\"%s\" target=\"_blank\">read the FAQ</a> before selecting this option."
93
+ msgstr "%s: <strong>Esto hará cambios permanentes a tu base de datos &mdash; ¡los comentarios permanecerán cerrados incluso si después desactivas el plugin! No deberías utilizar esta opción si sólo quieres deshabilitar los comentarios temporalmente. Por favor, <a href=\"%s\" target=\"_blank\">consulta las FAQ</a> antes de seleccionar esta opción. "
94
+
95
+ #: disable-comments.php:297
96
+ msgid "%s: Entering persistent mode on large multi-site networks requires a large number of database queries and can take a while. Use with caution!"
97
+ msgstr "%s: Activar el modo permanente en redes multisitio grandes requiere un gran número de peticiones a la base de datos y puede tardar un buen rato. ¡Utilízalo con precaución!"
98
+
99
+ #: disable-comments.php:300
100
+ msgid "Persistent mode has been manually disabled. See the <a href=\"%s\" target=\"_blank\">FAQ</a> for more information."
101
+ msgstr "El modo permanente ha sido manualmente deshabilitado. Por favor, consulta las <a href=\"%s\" target=\"_blank\">FAQ</a> para más información."
102
+
103
+ #: disable-comments.php:305
104
+ msgid "Save Changes"
105
+ msgstr "Guardar Cambios"
106
+
107
+ #: disable-comments.php:325
108
+ msgid "%s: Selecting this option will make persistent changes to your database. Are you sure you want to enable it?"
109
+ msgstr "%s: Selecionando esta opción hará cambios permanentes en tu base de datos. ¿Estás seguro de querer habilitarlo?"
110
+
languages/disable-comments-vi.mo ADDED
Binary file
languages/disable-comments-vi.po ADDED
@@ -0,0 +1,172 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Copyright (C) 2013 Disable Comments
2
+ # This file is distributed under the same license as the Disable Comments package.
3
+ msgid ""
4
+ msgstr ""
5
+ "Project-Id-Version: Disable Comments 0.9.1\n"
6
+ "Report-Msgid-Bugs-To: http://wordpress.org/tag/disable-comments\n"
7
+ "POT-Creation-Date: 2013-06-19 05:01:50+00:00\n"
8
+ "MIME-Version: 1.0\n"
9
+ "Content-Type: text/plain; charset=UTF-8\n"
10
+ "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-01-13 23:54+0700\n"
12
+ "Last-Translator: Vietnamese WPress-based blog | http://rongsay.info "
13
+ "<me@rongsay.info>\n"
14
+ "Language-Team: Vietnamese WPress-based blog | http://rongsay.info "
15
+ "<me@rongsay.info>\n"
16
+ "X-Generator: Poedit 1.5.7\n"
17
+
18
+ #: disable-comments.php:38
19
+ msgid "Disable Comments requires WordPress version %s or greater."
20
+ msgstr "Vô hiệu hóa ý kiến yêu cầu phiên bản WordPress %s hoặc cao hơn."
21
+
22
+ #: disable-comments.php:169
23
+ msgid ""
24
+ "Note: The <em>Disable Comments</em> plugin is currently active, and comments "
25
+ "are completely disabled on: %s. Many of the settings below will not be "
26
+ "applicable for those post types."
27
+ msgstr ""
28
+ "Lưu ý: <em>Vô hiệu hóa ý kiến</em> hiện đang hoạt động, và ý kiến bị vô hiệu "
29
+ "hoá hoàn toàn ở các: %s. Nhiều trong số các cài đặt dưới đây sẽ không được "
30
+ "áp dụng cho những loại post type đó."
31
+
32
+ #: disable-comments.php:169
33
+ msgid ", "
34
+ msgstr ", "
35
+
36
+ #: disable-comments.php:183
37
+ msgid ""
38
+ "The <em>Disable Comments</em> plugin is active, but isn't configured to do "
39
+ "anything yet. Visit the <a href=\"%s\">configuration page</a> to choose "
40
+ "which post types to disable comments on."
41
+ msgstr ""
42
+ "<Em> vô hiệu hóa ý kiến </em> hoạt động, nhưng không cấu hình để làm bất cứ "
43
+ "điều gì được nêu ra. Truy cập vào các <a href=\"%s\"> Trang cấu hình </a> "
44
+ "chọn các post type cần vô hiệu hóa ý kiến."
45
+
46
+ #: disable-comments.php:225 disable-comments.php:269
47
+ msgid "Disable Comments"
48
+ msgstr "Vô hiệu hóa ý kiến"
49
+
50
+ #: disable-comments.php:262
51
+ msgid ""
52
+ "If a caching/performance plugin is active, please invalidate its cache to "
53
+ "ensure that changes are reflected immediately."
54
+ msgstr ""
55
+ "Nếu một plugin bộ nhớ đệm (cache) hoạt động, xin vui lòng tắt bộ nhớ cache "
56
+ "của nó để đảm bảo rằng những thay đổi được thi hành ngay lập tức."
57
+
58
+ #: disable-comments.php:263
59
+ msgid ""
60
+ "Options updated. Changes to the Admin Menu and Admin Bar will not appear "
61
+ "until you leave or reload this page."
62
+ msgstr ""
63
+ "Tùy chọn Cập Nhật. Thay đổi trình đơn Admin và Admin Bar sẽ không xuất hiện "
64
+ "cho đến khi bạn nạp lại trang này."
65
+
66
+ #: disable-comments.php:272
67
+ msgid ""
68
+ "<em>Disable Comments</em> is Network Activated. The settings below will "
69
+ "affect <strong>all sites</strong> in this network."
70
+ msgstr ""
71
+ "<em> vô hiệu hóa ý kiến </em> kích hoạt trong toàn Network. Thiết đặt dưới "
72
+ "đây sẽ ảnh hưởng đến Tất cả trang web trong mạng này."
73
+
74
+ #: disable-comments.php:274
75
+ msgid ""
76
+ "It seems that a caching/performance plugin is active on this site. Please "
77
+ "manually invalidate that plugin's cache after making any changes to the "
78
+ "settings below."
79
+ msgstr ""
80
+ "Có vẻ như một plugin bộ nhớ đệm/hiệu suất đang hoạt động trên trang web này. "
81
+ "Tắt bộ nhớ cache plugin đó sau khi thực hiện bất kỳ thay đổi các thiết đặt "
82
+ "dưới đây."
83
+
84
+ #: disable-comments.php:278
85
+ msgid "Everywhere"
86
+ msgstr "Ở mọi nơi"
87
+
88
+ #: disable-comments.php:278
89
+ msgid "Disable all comment-related controls and settings in WordPress."
90
+ msgstr ""
91
+ "Vô hiệu hoá tất cả các liên quan đến bình luận điều khiển và thiết lập trong "
92
+ "WordPress."
93
+
94
+ #: disable-comments.php:279
95
+ msgid ""
96
+ "%s: This option is global and will affect your entire site. Use it only if "
97
+ "you want to disable comments <em>everywhere</em>. A complete description of "
98
+ "what this option does is <a href=\"%s\" target=\"_blank\">available here</a>."
99
+ msgstr ""
100
+ "%s: Tùy chọn này là toàn cầu và sẽ ảnh hưởng đến toàn bộ trang web của bạn. "
101
+ "Sử dụng nó chỉ nếu bạn muốn vô hiệu hóa ý kiến <em> ở khắp mọi nơi </em>. "
102
+ "Một mô tả đầy đủ về những gì tùy chọn này hiện <a href =\"%s\" target="
103
+ "\"_blank\"> có sẵn ở đây </a>."
104
+
105
+ #: disable-comments.php:279 disable-comments.php:295 disable-comments.php:297
106
+ #: disable-comments.php:325
107
+ msgid "Warning"
108
+ msgstr "Cảnh báo"
109
+
110
+ #: disable-comments.php:281
111
+ msgid "On certain post types"
112
+ msgstr "Trên một số loại post type"
113
+
114
+ #: disable-comments.php:286
115
+ msgid ""
116
+ "Disabling comments will also disable trackbacks and pingbacks. All comment-"
117
+ "related fields will also be hidden from the edit/quick-edit screens of the "
118
+ "affected posts. These settings cannot be overridden for individual posts."
119
+ msgstr ""
120
+ "Vô hiệu hóa ý kiến cũng vô hiệu hóa trackbacks và pingbacks. Tất cả các lĩnh "
121
+ "vực liên quan đến bình luận cũng sẽ được ẩn từ màn hình chỉnh sửa/nhanh "
122
+ "chóng-chỉnh sửa các bài viết bị ảnh hưởng. Các thiết đặt này không thể được "
123
+ "ghi đè cho bài đăng riêng lẻ."
124
+
125
+ #: disable-comments.php:289
126
+ msgid "Other options"
127
+ msgstr "Lựa chọn khác"
128
+
129
+ #: disable-comments.php:294
130
+ msgid "Use persistent mode"
131
+ msgstr "Sử dụng chế độ liên tục"
132
+
133
+ #: disable-comments.php:295
134
+ msgid ""
135
+ "%s: <strong>This will make persistent changes to your database &mdash; "
136
+ "comments will remain closed even if you later disable the plugin!</strong> "
137
+ "You should not use it if you only want to disable comments temporarily. "
138
+ "Please <a href=\"%s\" target=\"_blank\">read the FAQ</a> before selecting "
139
+ "this option."
140
+ msgstr ""
141
+ "%s: Điều này sẽ làm thay đổi liên tục cơ sở dữ liệu của bạn & mdash; ý kiến "
142
+ "sẽ vẫn đóng ngay cả khi bạn vô hiệu hóa plugin! Bạn không nên sử dụng nếu "
143
+ "bạn chỉ muốn vô hiệu hóa ý kiến tạm thời. Xin vui lòng <a href =\"%s\" "
144
+ "target=\"_blank\"> đọc FAQ </a> trước khi chọn tùy chọn này."
145
+
146
+ #: disable-comments.php:297
147
+ msgid ""
148
+ "%s: Entering persistent mode on large multi-site networks requires a large "
149
+ "number of database queries and can take a while. Use with caution!"
150
+ msgstr ""
151
+ "%s: Nhập chế độ liên tục trên nhiều trang web lớn đòi hỏi một số lượng truy "
152
+ "vấn cơ sở dữ liệu lớn và có thể mất một lúc. Sử dụng thận trọng!"
153
+
154
+ #: disable-comments.php:300
155
+ msgid ""
156
+ "Persistent mode has been manually disabled. See the <a href=\"%s\" target="
157
+ "\"_blank\">FAQ</a> for more information."
158
+ msgstr ""
159
+ "Chế độ liên tục đã bị vô hiệu theo cách thủ công. Xem các <a href = \"%s\" "
160
+ "target=\"_blank\"> FAQ </a> cho biết thêm thông tin."
161
+
162
+ #: disable-comments.php:305
163
+ msgid "Save Changes"
164
+ msgstr "Lưu thay đổi"
165
+
166
+ #: disable-comments.php:325
167
+ msgid ""
168
+ "%s: Selecting this option will make persistent changes to your database. Are "
169
+ "you sure you want to enable it?"
170
+ msgstr ""
171
+ "%s: Chọn tùy chọn này sẽ thực hiện liên tục thay đổi cơ sở dữ liệu của bạn. "
172
+ "Bạn có chắc bạn muốn bật nó?"
languages/disable-comments.pot CHANGED
@@ -1,14 +1,14 @@
1
- # Copyright (C) 2013 Disable Comments
2
  # This file is distributed under the same license as the Disable Comments package.
3
  msgid ""
4
  msgstr ""
5
- "Project-Id-Version: Disable Comments 0.9.1\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/disable-comments\n"
7
- "POT-Creation-Date: 2013-06-19 05:01:50+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
- "PO-Revision-Date: 2013-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
@@ -16,87 +16,95 @@ msgstr ""
16
  msgid "Disable Comments requires WordPress version %s or greater."
17
  msgstr ""
18
 
19
- #: disable-comments.php:169
20
  msgid "Note: The <em>Disable Comments</em> plugin is currently active, and comments are completely disabled on: %s. Many of the settings below will not be applicable for those post types."
21
  msgstr ""
22
 
23
- #: disable-comments.php:169
24
  msgid ", "
25
  msgstr ""
26
 
27
- #: disable-comments.php:183
28
  msgid "The <em>Disable Comments</em> plugin is active, but isn't configured to do anything yet. Visit the <a href=\"%s\">configuration page</a> to choose which post types to disable comments on."
29
  msgstr ""
30
 
31
- #: disable-comments.php:225 disable-comments.php:269
 
 
 
 
 
 
 
 
32
  msgid "Disable Comments"
33
  msgstr ""
34
 
35
- #: disable-comments.php:262
36
  msgid "If a caching/performance plugin is active, please invalidate its cache to ensure that changes are reflected immediately."
37
  msgstr ""
38
 
39
- #: disable-comments.php:263
40
  msgid "Options updated. Changes to the Admin Menu and Admin Bar will not appear until you leave or reload this page."
41
  msgstr ""
42
 
43
- #: disable-comments.php:272
44
  msgid "<em>Disable Comments</em> is Network Activated. The settings below will affect <strong>all sites</strong> in this network."
45
  msgstr ""
46
 
47
- #: disable-comments.php:274
48
  msgid "It seems that a caching/performance plugin is active on this site. Please manually invalidate that plugin's cache after making any changes to the settings below."
49
  msgstr ""
50
 
51
- #: disable-comments.php:278
52
  msgid "Everywhere"
53
  msgstr ""
54
 
55
- #: disable-comments.php:278
56
  msgid "Disable all comment-related controls and settings in WordPress."
57
  msgstr ""
58
 
59
- #: disable-comments.php:279
60
  msgid "%s: This option is global and will affect your entire site. Use it only if you want to disable comments <em>everywhere</em>. A complete description of what this option does is <a href=\"%s\" target=\"_blank\">available here</a>."
61
  msgstr ""
62
 
63
- #: disable-comments.php:279 disable-comments.php:295 disable-comments.php:297
64
- #: disable-comments.php:325
65
  msgid "Warning"
66
  msgstr ""
67
 
68
- #: disable-comments.php:281
69
  msgid "On certain post types"
70
  msgstr ""
71
 
72
- #: disable-comments.php:286
 
 
 
 
73
  msgid "Disabling comments will also disable trackbacks and pingbacks. All comment-related fields will also be hidden from the edit/quick-edit screens of the affected posts. These settings cannot be overridden for individual posts."
74
  msgstr ""
75
 
76
- #: disable-comments.php:289
77
  msgid "Other options"
78
  msgstr ""
79
 
80
- #: disable-comments.php:294
81
  msgid "Use persistent mode"
82
  msgstr ""
83
 
84
- #: disable-comments.php:295
85
  msgid "%s: <strong>This will make persistent changes to your database &mdash; comments will remain closed even if you later disable the plugin!</strong> You should not use it if you only want to disable comments temporarily. Please <a href=\"%s\" target=\"_blank\">read the FAQ</a> before selecting this option."
86
  msgstr ""
87
 
88
- #: disable-comments.php:297
89
  msgid "%s: Entering persistent mode on large multi-site networks requires a large number of database queries and can take a while. Use with caution!"
90
  msgstr ""
91
 
92
- #: disable-comments.php:300
93
- msgid "Persistent mode has been manually disabled. See the <a href=\"%s\" target=\"_blank\">FAQ</a> for more information."
94
- msgstr ""
95
-
96
- #: disable-comments.php:305
97
  msgid "Save Changes"
98
  msgstr ""
99
 
100
- #: disable-comments.php:325
101
  msgid "%s: Selecting this option will make persistent changes to your database. Are you sure you want to enable it?"
102
  msgstr ""
1
+ # Copyright (C) 2014 Disable Comments
2
  # This file is distributed under the same license as the Disable Comments package.
3
  msgid ""
4
  msgstr ""
5
+ "Project-Id-Version: Disable Comments 1.2\n"
6
  "Report-Msgid-Bugs-To: http://wordpress.org/tag/disable-comments\n"
7
+ "POT-Creation-Date: 2014-10-26 04:54:23+00:00\n"
8
  "MIME-Version: 1.0\n"
9
  "Content-Type: text/plain; charset=UTF-8\n"
10
  "Content-Transfer-Encoding: 8bit\n"
11
+ "PO-Revision-Date: 2014-MO-DA HO:MI+ZONE\n"
12
  "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13
  "Language-Team: LANGUAGE <LL@li.org>\n"
14
 
16
  msgid "Disable Comments requires WordPress version %s or greater."
17
  msgstr ""
18
 
19
+ #: disable-comments.php:210
20
  msgid "Note: The <em>Disable Comments</em> plugin is currently active, and comments are completely disabled on: %s. Many of the settings below will not be applicable for those post types."
21
  msgstr ""
22
 
23
+ #: disable-comments.php:210
24
  msgid ", "
25
  msgstr ""
26
 
27
+ #: disable-comments.php:230
28
  msgid "The <em>Disable Comments</em> plugin is active, but isn't configured to do anything yet. Visit the <a href=\"%s\">configuration page</a> to choose which post types to disable comments on."
29
  msgstr ""
30
 
31
+ #: disable-comments.php:237
32
+ msgid "Comments are closed."
33
+ msgstr ""
34
+
35
+ #: disable-comments.php:290
36
+ msgid "Settings"
37
+ msgstr ""
38
+
39
+ #: disable-comments.php:298 disable-comments.php:350
40
  msgid "Disable Comments"
41
  msgstr ""
42
 
43
+ #: disable-comments.php:343
44
  msgid "If a caching/performance plugin is active, please invalidate its cache to ensure that changes are reflected immediately."
45
  msgstr ""
46
 
47
+ #: disable-comments.php:344
48
  msgid "Options updated. Changes to the Admin Menu and Admin Bar will not appear until you leave or reload this page."
49
  msgstr ""
50
 
51
+ #: disable-comments.php:353
52
  msgid "<em>Disable Comments</em> is Network Activated. The settings below will affect <strong>all sites</strong> in this network."
53
  msgstr ""
54
 
55
+ #: disable-comments.php:355
56
  msgid "It seems that a caching/performance plugin is active on this site. Please manually invalidate that plugin's cache after making any changes to the settings below."
57
  msgstr ""
58
 
59
+ #: disable-comments.php:359
60
  msgid "Everywhere"
61
  msgstr ""
62
 
63
+ #: disable-comments.php:359
64
  msgid "Disable all comment-related controls and settings in WordPress."
65
  msgstr ""
66
 
67
+ #: disable-comments.php:360
68
  msgid "%s: This option is global and will affect your entire site. Use it only if you want to disable comments <em>everywhere</em>. A complete description of what this option does is <a href=\"%s\" target=\"_blank\">available here</a>."
69
  msgstr ""
70
 
71
+ #: disable-comments.php:360 disable-comments.php:380 disable-comments.php:382
72
+ #: disable-comments.php:409
73
  msgid "Warning"
74
  msgstr ""
75
 
76
+ #: disable-comments.php:362
77
  msgid "On certain post types"
78
  msgstr ""
79
 
80
+ #: disable-comments.php:368
81
+ msgid "Only the built-in post types appear above. If you want to disable comments on other custom post types on the entire network, you can supply a comma-separated list of post types below (use the slug that identifies the post type)."
82
+ msgstr ""
83
+
84
+ #: disable-comments.php:371
85
  msgid "Disabling comments will also disable trackbacks and pingbacks. All comment-related fields will also be hidden from the edit/quick-edit screens of the affected posts. These settings cannot be overridden for individual posts."
86
  msgstr ""
87
 
88
+ #: disable-comments.php:374
89
  msgid "Other options"
90
  msgstr ""
91
 
92
+ #: disable-comments.php:379
93
  msgid "Use persistent mode"
94
  msgstr ""
95
 
96
+ #: disable-comments.php:380
97
  msgid "%s: <strong>This will make persistent changes to your database &mdash; comments will remain closed even if you later disable the plugin!</strong> You should not use it if you only want to disable comments temporarily. Please <a href=\"%s\" target=\"_blank\">read the FAQ</a> before selecting this option."
98
  msgstr ""
99
 
100
+ #: disable-comments.php:382
101
  msgid "%s: Entering persistent mode on large multi-site networks requires a large number of database queries and can take a while. Use with caution!"
102
  msgstr ""
103
 
104
+ #: disable-comments.php:388
 
 
 
 
105
  msgid "Save Changes"
106
  msgstr ""
107
 
108
+ #: disable-comments.php:409
109
  msgid "%s: Selecting this option will make persistent changes to your database. Are you sure you want to enable it?"
110
  msgstr ""
readme.txt CHANGED
@@ -16,11 +16,11 @@ Additionally, comment-related items can be removed from the Dashboard, Widgets,
16
 
17
  **Important note**: Use this plugin if you don't want comments at all on your site (or on certain post types). Don't use it if you want to selectively disable comments on individual posts - WordPress lets you do that anyway. If you don't know how to disable comments on individual posts, there are instructions in [the FAQ](http://wordpress.org/extend/plugins/disable-comments/faq/).
18
 
19
- If you come across any bugs or have suggestions, please use the plugin support forum or contact me at [rayofsolaris.net](http://rayofsolaris.net). I can't fix it if I don't know it's broken! Please check the [FAQ](http://wordpress.org/extend/plugins/disable-comments/faq/) for common issues.
20
 
21
  Want to contribute? Here's the [GitHub development repository](https://github.com/solarissmoke/disable-comments).
22
 
23
- Thanks to the following people for contributing translations of this plugin: French - [Murat](http://wptheme.fr), German - [Christian Foellmann](http://foe-services.de), Indonesian - [Nasrulhaq Muiz](http://al-badar.net), Russian - [Elvis](http://turkenichev.ru), Vietamese - Rong Say.
24
 
25
  == Frequently Asked Questions ==
26
 
@@ -74,6 +74,9 @@ The plugin provides the option to **completely disable the commenting feature in
74
 
75
  == Changelog ==
76
 
 
 
 
77
  = 1.1.1 =
78
  * Fix PHP warning when active_sitewide_plugins option doesn't contain expected data type.
79
 
16
 
17
  **Important note**: Use this plugin if you don't want comments at all on your site (or on certain post types). Don't use it if you want to selectively disable comments on individual posts - WordPress lets you do that anyway. If you don't know how to disable comments on individual posts, there are instructions in [the FAQ](http://wordpress.org/extend/plugins/disable-comments/faq/).
18
 
19
+ If you come across any bugs or have suggestions, please use the plugin support forum. I can't fix it if I don't know it's broken! Please check the [FAQ](http://wordpress.org/extend/plugins/disable-comments/faq/) for common issues.
20
 
21
  Want to contribute? Here's the [GitHub development repository](https://github.com/solarissmoke/disable-comments).
22
 
23
+ A [must-use version](https://github.com/solarissmoke/disable-comments-mu) of the plugin is also available.
24
 
25
  == Frequently Asked Questions ==
26
 
74
 
75
  == Changelog ==
76
 
77
+ = 1.2 =
78
+ * Allow network administrators to disable comments on custom post types across the whole network.
79
+
80
  = 1.1.1 =
81
  * Fix PHP warning when active_sitewide_plugins option doesn't contain expected data type.
82