Version Description
Download this release
Release Info
| Developer | Asif2BD |
| Plugin | |
| Version | 2.1.0 |
| Comparing to | |
| See all releases | |
Code changes from version 2.0.2 to 2.1.0
- assets/css/style.css +17 -16
- disable-comments.php +196 -121
- includes/class-plugin-usage-tracker.php +30 -16
- includes/cli.php +4 -0
- languages/disable-comments.pot +191 -127
- readme.txt +9 -3
- views/partials/_delete.php +4 -1
- views/partials/_disable.php +33 -4
- views/settings.php +2 -2
assets/css/style.css
CHANGED
|
@@ -2276,31 +2276,31 @@ button.button__instagram.hover__highlight:hover .icon {
|
|
| 2276 |
opacity: 0;
|
| 2277 |
transition: all 0.3s ease;
|
| 2278 |
}
|
| 2279 |
-
.disable__comment__option .disable_option .
|
| 2280 |
margin-bottom: 10px;
|
| 2281 |
}
|
| 2282 |
-
.disable__comment__option .disable_option .
|
| 2283 |
display: none;
|
| 2284 |
}
|
| 2285 |
-
.disable__comment__option .disable_option .
|
| 2286 |
color: #22282d;
|
| 2287 |
}
|
| 2288 |
-
.disable__comment__option .disable_option .
|
| 2289 |
background: #05cb6b;
|
| 2290 |
}
|
| 2291 |
-
.disable__comment__option .disable_option .
|
| 2292 |
left: 23px;
|
| 2293 |
}
|
| 2294 |
-
.disable__comment__option .disable_option .
|
| 2295 |
left: 5px;
|
| 2296 |
}
|
| 2297 |
-
.disable__comment__option .disable_option .
|
| 2298 |
display: block;
|
| 2299 |
}
|
| 2300 |
-
.disable__comment__option .disable_option .
|
| 2301 |
display: none;
|
| 2302 |
}
|
| 2303 |
-
.disable__comment__option .disable_option .
|
| 2304 |
font-size: 16px;
|
| 2305 |
font-weight: 500;
|
| 2306 |
color: #687b95;
|
|
@@ -2309,11 +2309,11 @@ button.button__instagram.hover__highlight:hover .icon {
|
|
| 2309 |
align-items: center;
|
| 2310 |
}
|
| 2311 |
@media (max-width: 479.98px) {
|
| 2312 |
-
.disable__comment__option .disable_option .
|
| 2313 |
font-size: 14px;
|
| 2314 |
}
|
| 2315 |
}
|
| 2316 |
-
.disable__comment__option .disable_option .
|
| 2317 |
flex: 0 0 35px;
|
| 2318 |
height: 16px;
|
| 2319 |
width: 35px;
|
|
@@ -2331,11 +2331,11 @@ button.button__instagram.hover__highlight:hover .icon {
|
|
| 2331 |
transition: all 0.3s ease;
|
| 2332 |
}
|
| 2333 |
@media (max-width: 479.98px) {
|
| 2334 |
-
.disable__comment__option .disable_option .
|
| 2335 |
font-size: 10px;
|
| 2336 |
}
|
| 2337 |
}
|
| 2338 |
-
.disable__comment__option .disable_option .
|
| 2339 |
position: absolute;
|
| 2340 |
top: 4px;
|
| 2341 |
left: 4px;
|
|
@@ -2346,13 +2346,13 @@ button.button__instagram.hover__highlight:hover .icon {
|
|
| 2346 |
content: "";
|
| 2347 |
transition: all 0.3s ease;
|
| 2348 |
}
|
| 2349 |
-
.disable__comment__option .disable_option .
|
| 2350 |
position: absolute;
|
| 2351 |
top: 2px;
|
| 2352 |
left: 16px;
|
| 2353 |
transition: all 0.3s ease;
|
| 2354 |
}
|
| 2355 |
-
.disable__comment__option .disable_option .
|
| 2356 |
display: none;
|
| 2357 |
}
|
| 2358 |
.disable__comment__option .disable_option .delete__feedback {
|
|
@@ -2980,4 +2980,5 @@ button.button__instagram.hover__highlight:hover .icon {
|
|
| 2980 |
.dc-quick__setup__wrap .button__group .button.button--sm {
|
| 2981 |
width: unset;
|
| 2982 |
}
|
| 2983 |
-
}
|
|
|
| 2276 |
opacity: 0;
|
| 2277 |
transition: all 0.3s ease;
|
| 2278 |
}
|
| 2279 |
+
.disable__comment__option .disable_option .dissable__switch__item {
|
| 2280 |
margin-bottom: 10px;
|
| 2281 |
}
|
| 2282 |
+
.disable__comment__option .disable_option .dissable__switch__item input {
|
| 2283 |
display: none;
|
| 2284 |
}
|
| 2285 |
+
.disable__comment__option .disable_option .dissable__switch__item input:checked ~ label {
|
| 2286 |
color: #22282d;
|
| 2287 |
}
|
| 2288 |
+
.disable__comment__option .disable_option .dissable__switch__item input:checked ~ label .switch {
|
| 2289 |
background: #05cb6b;
|
| 2290 |
}
|
| 2291 |
+
.disable__comment__option .disable_option .dissable__switch__item input:checked ~ label .switch:before {
|
| 2292 |
left: 23px;
|
| 2293 |
}
|
| 2294 |
+
.disable__comment__option .disable_option .dissable__switch__item input:checked ~ label .switch .switch__text {
|
| 2295 |
left: 5px;
|
| 2296 |
}
|
| 2297 |
+
.disable__comment__option .disable_option .dissable__switch__item input:checked ~ label .switch .switch__text.on {
|
| 2298 |
display: block;
|
| 2299 |
}
|
| 2300 |
+
.disable__comment__option .disable_option .dissable__switch__item input:checked ~ label .switch .switch__text.off {
|
| 2301 |
display: none;
|
| 2302 |
}
|
| 2303 |
+
.disable__comment__option .disable_option .dissable__switch__item label {
|
| 2304 |
font-size: 16px;
|
| 2305 |
font-weight: 500;
|
| 2306 |
color: #687b95;
|
| 2309 |
align-items: center;
|
| 2310 |
}
|
| 2311 |
@media (max-width: 479.98px) {
|
| 2312 |
+
.disable__comment__option .disable_option .dissable__switch__item label {
|
| 2313 |
font-size: 14px;
|
| 2314 |
}
|
| 2315 |
}
|
| 2316 |
+
.disable__comment__option .disable_option .dissable__switch__item label .switch {
|
| 2317 |
flex: 0 0 35px;
|
| 2318 |
height: 16px;
|
| 2319 |
width: 35px;
|
| 2331 |
transition: all 0.3s ease;
|
| 2332 |
}
|
| 2333 |
@media (max-width: 479.98px) {
|
| 2334 |
+
.disable__comment__option .disable_option .dissable__switch__item label .switch {
|
| 2335 |
font-size: 10px;
|
| 2336 |
}
|
| 2337 |
}
|
| 2338 |
+
.disable__comment__option .disable_option .dissable__switch__item label .switch:before {
|
| 2339 |
position: absolute;
|
| 2340 |
top: 4px;
|
| 2341 |
left: 4px;
|
| 2346 |
content: "";
|
| 2347 |
transition: all 0.3s ease;
|
| 2348 |
}
|
| 2349 |
+
.disable__comment__option .disable_option .dissable__switch__item label .switch .switch__text {
|
| 2350 |
position: absolute;
|
| 2351 |
top: 2px;
|
| 2352 |
left: 16px;
|
| 2353 |
transition: all 0.3s ease;
|
| 2354 |
}
|
| 2355 |
+
.disable__comment__option .disable_option .dissable__switch__item label .switch .switch__text.on {
|
| 2356 |
display: none;
|
| 2357 |
}
|
| 2358 |
.disable__comment__option .disable_option .delete__feedback {
|
| 2980 |
.dc-quick__setup__wrap .button__group .button.button--sm {
|
| 2981 |
width: unset;
|
| 2982 |
}
|
| 2983 |
+
}
|
| 2984 |
+
/*# sourceMappingURL=style.css.map */
|
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.0
|
| 8 |
* Author: WPDeveloper
|
| 9 |
* Author URI: https://wpdeveloper.net
|
| 10 |
* License: GPL-3.0+
|
|
@@ -37,7 +37,7 @@ class Disable_Comments
|
|
| 37 |
|
| 38 |
function __construct()
|
| 39 |
{
|
| 40 |
-
define('DC_VERSION', '2.0
|
| 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/');
|
|
@@ -48,8 +48,6 @@ class Disable_Comments
|
|
| 48 |
add_action('wp_ajax_disable_comments_save_settings', array($this, 'disable_comments_settings'));
|
| 49 |
add_action('wp_ajax_disable_comments_delete_comments', array($this, 'delete_comments_settings'));
|
| 50 |
|
| 51 |
-
add_action( 'wp_ajax_optin_wizard_action_disable_comments', array( $this, 'wizard_action' ) );
|
| 52 |
-
|
| 53 |
// Including cli.php
|
| 54 |
if (defined('WP_CLI') && WP_CLI) {
|
| 55 |
add_action('init', array($this, 'enable_cli'), 9999);
|
|
@@ -59,11 +57,18 @@ class Disable_Comments
|
|
| 59 |
$this->networkactive = (is_multisite() && array_key_exists(plugin_basename(__FILE__), (array) get_site_option('active_sitewide_plugins')));
|
| 60 |
$this->is_CLI = defined('WP_CLI') && WP_CLI;
|
| 61 |
|
|
|
|
| 62 |
// Load options.
|
| 63 |
-
if ($this->networkactive) {
|
| 64 |
$this->options = get_site_option('disable_comments_options', array());
|
| 65 |
} else {
|
| 66 |
$this->options = get_option('disable_comments_options', array());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 67 |
}
|
| 68 |
|
| 69 |
// If it looks like first run, check compat.
|
|
@@ -71,6 +76,8 @@ class Disable_Comments
|
|
| 71 |
$this->check_compatibility();
|
| 72 |
}
|
| 73 |
|
|
|
|
|
|
|
| 74 |
// Upgrade DB if necessary.
|
| 75 |
$this->check_db_upgrades();
|
| 76 |
|
|
@@ -86,19 +93,6 @@ class Disable_Comments
|
|
| 86 |
require_once DC_PLUGIN_ROOT_PATH . "/includes/cli.php";
|
| 87 |
new Disable_Comment_Command($this);
|
| 88 |
}
|
| 89 |
-
/**
|
| 90 |
-
* Optin Added
|
| 91 |
-
*
|
| 92 |
-
* @since 2.0.0.
|
| 93 |
-
*/
|
| 94 |
-
public function wizard_action(){
|
| 95 |
-
if( $this->tracker instanceof DisableComments_Plugin_Tracker ) {
|
| 96 |
-
$allow_tracking = get_option( 'wpins_allow_tracking', [] );
|
| 97 |
-
update_option('wpins_allow_tracking', array_merge( $allow_tracking, ['disable-comments' => 'disable-comments'] ));
|
| 98 |
-
$this->tracker->force_tracking();
|
| 99 |
-
$this->tracker->update_block_notice( 'disable-comments' );
|
| 100 |
-
}
|
| 101 |
-
}
|
| 102 |
|
| 103 |
public function admin_notice(){
|
| 104 |
if( $this->tracker instanceof DisableComments_Plugin_Tracker ) {
|
|
@@ -106,7 +100,7 @@ class Disable_Comments
|
|
| 106 |
return;
|
| 107 |
}
|
| 108 |
$current_screen = get_current_screen()->id;
|
| 109 |
-
$hascaps = $this->networkactive
|
| 110 |
if( ! in_array( $current_screen, ['settings_page_disable_comments_settings', 'settings_page_disable_comments_settings-network']) && $hascaps ) {
|
| 111 |
$this->tracker->notice();
|
| 112 |
}
|
|
@@ -136,6 +130,7 @@ class Disable_Comments
|
|
| 136 |
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
| 137 |
deactivate_plugins(__FILE__);
|
| 138 |
if (isset($_GET['action']) && ($_GET['action'] == 'activate' || $_GET['action'] == 'error_scrape')) {
|
|
|
|
| 139 |
exit(sprintf(__('Disable Comments requires WordPress version %s or greater.', 'disable-comments'), '4.7'));
|
| 140 |
}
|
| 141 |
}
|
|
@@ -171,9 +166,10 @@ class Disable_Comments
|
|
| 171 |
|
| 172 |
private function update_options()
|
| 173 |
{
|
| 174 |
-
if ($this->networkactive) {
|
|
|
|
| 175 |
update_site_option('disable_comments_options', $this->options);
|
| 176 |
-
} else
|
| 177 |
update_option('disable_comments_options', $this->options);
|
| 178 |
}
|
| 179 |
}
|
|
@@ -185,7 +181,7 @@ class Disable_Comments
|
|
| 185 |
{
|
| 186 |
$types = $this->options['disabled_post_types'];
|
| 187 |
// Not all extra_post_types might be registered on this particular site.
|
| 188 |
-
if ($this->networkactive) {
|
| 189 |
foreach ((array) $this->options['extra_post_types'] as $extra) {
|
| 190 |
if (post_type_exists($extra)) {
|
| 191 |
$types[] = $extra;
|
|
@@ -259,7 +255,7 @@ class Disable_Comments
|
|
| 259 |
add_filter('comments_open', array($this, 'filter_comment_status'), 20, 2);
|
| 260 |
add_filter('pings_open', array($this, 'filter_comment_status'), 20, 2);
|
| 261 |
add_filter('get_comments_number', array($this, 'filter_comments_number'), 20, 2);
|
| 262 |
-
} elseif (is_admin() && !$this->
|
| 263 |
/**
|
| 264 |
* It is possible that $disabled_post_types is empty if other
|
| 265 |
* plugins have disabled comments. Hence we also check for
|
|
@@ -272,11 +268,11 @@ class Disable_Comments
|
|
| 272 |
// Filters for the admin only.
|
| 273 |
if (is_admin()) {
|
| 274 |
add_action( 'all_admin_notices', array( $this, 'admin_notice' ) );
|
| 275 |
-
if ($this->networkactive) {
|
| 276 |
add_action('network_admin_menu', array($this, 'settings_menu'));
|
| 277 |
add_action('network_admin_menu', array($this, 'tools_menu'));
|
| 278 |
add_filter('network_admin_plugin_action_links', array($this, 'plugin_actions_links'), 10, 2);
|
| 279 |
-
}
|
| 280 |
add_action('admin_menu', array($this, 'settings_menu'));
|
| 281 |
add_action('admin_menu', array($this, 'tools_menu'));
|
| 282 |
add_filter('plugin_action_links', array($this, 'plugin_actions_links'), 10, 2);
|
|
@@ -305,15 +301,15 @@ class Disable_Comments
|
|
| 305 |
}
|
| 306 |
}
|
| 307 |
|
| 308 |
-
public function get_option( $key, $default = false ){
|
| 309 |
-
|
| 310 |
-
}
|
| 311 |
-
public function update_option( $option, $value ){
|
| 312 |
-
|
| 313 |
-
}
|
| 314 |
-
public function delete_option( $option ){
|
| 315 |
-
|
| 316 |
-
}
|
| 317 |
|
| 318 |
/**
|
| 319 |
* Replace the theme's comment template with a blank one.
|
|
@@ -339,6 +335,17 @@ class Disable_Comments
|
|
| 339 |
return dirname(__FILE__) . '/views/comments.php';
|
| 340 |
}
|
| 341 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 342 |
|
| 343 |
/**
|
| 344 |
* Remove the X-Pingback HTTP header
|
|
@@ -471,6 +478,7 @@ class Disable_Comments
|
|
| 471 |
$names[$type] = get_post_type_object($type)->labels->name;
|
| 472 |
}
|
| 473 |
|
|
|
|
| 474 |
echo '<div class="notice notice-warning"><p>' . sprintf(__('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.', 'disable-comments'), implode(__(', ', 'disable-comments'), $names)) . '</p></div>';
|
| 475 |
}
|
| 476 |
}
|
|
@@ -480,7 +488,7 @@ class Disable_Comments
|
|
| 480 |
*/
|
| 481 |
private function settings_page_url()
|
| 482 |
{
|
| 483 |
-
$base = $this->networkactive ? network_admin_url('settings.php') : admin_url('options-general.php');
|
| 484 |
return add_query_arg('page', DC_PLUGIN_SLUG, $base);
|
| 485 |
}
|
| 486 |
|
|
@@ -489,7 +497,7 @@ class Disable_Comments
|
|
| 489 |
*/
|
| 490 |
private function tools_page_url()
|
| 491 |
{
|
| 492 |
-
$base = $this->networkactive ? network_admin_url('settings.php') : admin_url('tools.php');
|
| 493 |
return add_query_arg('page', 'disable_comments_tools', $base);
|
| 494 |
}
|
| 495 |
|
|
@@ -499,9 +507,10 @@ class Disable_Comments
|
|
| 499 |
if (strpos(get_current_screen()->id, 'settings_page_disable_comments_settings') === 0) {
|
| 500 |
return;
|
| 501 |
}
|
| 502 |
-
$hascaps = $this->networkactive
|
| 503 |
if ($hascaps) {
|
| 504 |
$this->setup_notice_flag = true;
|
|
|
|
| 505 |
echo '<div class="notice dc-text__block disable__comment__alert mb30"><img height="30" src="'. DC_ASSETS_URI .'img/icon-logo.png" alt=""><p>' . sprintf(__('The <strong>Disable Comments</strong> 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>';
|
| 506 |
}
|
| 507 |
}
|
|
@@ -602,9 +611,9 @@ class Disable_Comments
|
|
| 602 |
public function settings_menu()
|
| 603 |
{
|
| 604 |
$title = _x('Disable Comments', 'settings menu title', 'disable-comments');
|
| 605 |
-
if ($this->networkactive) {
|
| 606 |
add_submenu_page('settings.php', $title, $title, 'manage_network_plugins', DC_PLUGIN_SLUG, array($this, 'settings_page'));
|
| 607 |
-
}
|
| 608 |
add_submenu_page('options-general.php', $title, $title, 'manage_options', DC_PLUGIN_SLUG, array($this, 'settings_page'));
|
| 609 |
}
|
| 610 |
}
|
|
@@ -613,9 +622,9 @@ class Disable_Comments
|
|
| 613 |
{
|
| 614 |
$title = __('Delete Comments', 'disable-comments');
|
| 615 |
$hook = '';
|
| 616 |
-
if ($this->networkactive) {
|
| 617 |
$hook = add_submenu_page('settings.php', $title, $title, 'manage_network_plugins', 'disable_comments_tools', array($this, 'tools_page'));
|
| 618 |
-
}
|
| 619 |
$hook = add_submenu_page('tools.php', $title, $title, 'manage_options', 'disable_comments_tools', array($this, 'tools_page'));
|
| 620 |
}
|
| 621 |
add_action('load-' . $hook, array($this, 'redirectToMainSettingsPage'));
|
|
@@ -630,10 +639,38 @@ class Disable_Comments
|
|
| 630 |
public function get_all_comments_number()
|
| 631 |
{
|
| 632 |
global $wpdb;
|
| 633 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 634 |
}
|
| 635 |
|
| 636 |
-
public function get_all_comment_types()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 637 |
{
|
| 638 |
global $wpdb;
|
| 639 |
$commenttypes = array();
|
|
@@ -651,10 +688,10 @@ class Disable_Comments
|
|
| 651 |
return $commenttypes;
|
| 652 |
}
|
| 653 |
|
| 654 |
-
public function get_all_post_types()
|
| 655 |
{
|
| 656 |
$typeargs = array('public' => true);
|
| 657 |
-
if ($this->networkactive) {
|
| 658 |
$typeargs['_builtin'] = true; // stick to known types for network.
|
| 659 |
}
|
| 660 |
$types = get_post_types($typeargs, 'objects');
|
|
@@ -704,10 +741,14 @@ class Disable_Comments
|
|
| 704 |
} else {
|
| 705 |
$formArray = (isset($_POST['data']) ? $this->form_data_modify($_POST['data']) : []);
|
| 706 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 707 |
if (isset($formArray['mode'])) {
|
| 708 |
$this->options['remove_everywhere'] = (sanitize_text_field($formArray['mode']) == 'remove_everywhere');
|
| 709 |
}
|
| 710 |
-
$post_types = $this->get_all_post_types();
|
| 711 |
|
| 712 |
if ($this->options['remove_everywhere']) {
|
| 713 |
$disabled_post_types = array_keys($post_types);
|
|
@@ -719,15 +760,21 @@ class Disable_Comments
|
|
| 719 |
$this->options['disabled_post_types'] = $disabled_post_types;
|
| 720 |
|
| 721 |
// Extra custom post types.
|
| 722 |
-
if ($this->networkactive &&
|
| 723 |
$extra_post_types = array_filter(array_map('sanitize_key', explode(',', $formArray['extra_post_types'])));
|
| 724 |
$this->options['extra_post_types'] = array_diff($extra_post_types, array_keys($post_types)); // Make sure we don't double up builtins.
|
| 725 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
| 726 |
// xml rpc
|
| 727 |
$this->options['remove_xmlrpc_comments'] = (isset($formArray['remove_xmlrpc_comments']) ? intval($formArray['remove_xmlrpc_comments']) : ($this->is_CLI && isset($this->options['remove_xmlrpc_comments']) ? $this->options['remove_xmlrpc_comments'] : 0));
|
| 728 |
// rest api comments
|
| 729 |
$this->options['remove_rest_API_comments'] = (isset($formArray['remove_rest_API_comments']) ? intval($formArray['remove_rest_API_comments']) : ($this->is_CLI && isset($this->options['remove_rest_API_comments']) ? $this->options['remove_rest_API_comments'] : 0));
|
| 730 |
|
|
|
|
|
|
|
| 731 |
// save settings
|
| 732 |
$this->update_options();
|
| 733 |
}
|
|
@@ -737,100 +784,128 @@ class Disable_Comments
|
|
| 737 |
}
|
| 738 |
}
|
| 739 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 740 |
public function delete_comments_settings($_args = array())
|
| 741 |
{
|
|
|
|
| 742 |
$log = '';
|
| 743 |
-
$deletedPostTypeNames = [];
|
| 744 |
$nonce = (isset($_POST['nonce']) ? $_POST['nonce'] : '');
|
| 745 |
-
|
| 746 |
|
| 747 |
-
|
| 748 |
-
|
| 749 |
-
|
| 750 |
-
$
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 751 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 752 |
|
| 753 |
-
|
| 754 |
-
|
| 755 |
-
|
| 756 |
-
|
| 757 |
-
|
| 758 |
-
|
| 759 |
-
|
| 760 |
-
|
| 761 |
-
|
| 762 |
-
|
| 763 |
-
|
| 764 |
-
|
| 765 |
-
|
| 766 |
-
|
| 767 |
-
|
| 768 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 769 |
} else {
|
| 770 |
wp_send_json_error(array('message' => __('Internal error occured. Please try again later.', 'disable-comments')));
|
| 771 |
wp_die();
|
| 772 |
}
|
| 773 |
-
}
|
| 774 |
-
|
| 775 |
-
|
| 776 |
-
|
| 777 |
-
|
| 778 |
-
|
| 779 |
-
|
| 780 |
-
|
| 781 |
-
|
| 782 |
-
|
| 783 |
-
|
| 784 |
-
|
| 785 |
-
|
| 786 |
-
|
| 787 |
-
$wpdb->query("DELETE cmeta FROM $wpdb->commentmeta cmeta INNER JOIN $wpdb->comments comments ON cmeta.comment_id=comments.comment_ID INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '$delete_post_type'");
|
| 788 |
-
$wpdb->query("DELETE comments FROM $wpdb->comments comments INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '$delete_post_type'");
|
| 789 |
-
$wpdb->query("UPDATE $wpdb->posts SET comment_count = 0 WHERE post_author != 0 AND post_type = '$delete_post_type'");
|
| 790 |
|
| 791 |
-
|
| 792 |
-
|
| 793 |
-
|
| 794 |
-
|
|
|
|
|
|
|
| 795 |
|
| 796 |
-
$
|
| 797 |
-
$
|
| 798 |
-
$
|
| 799 |
}
|
| 800 |
-
} elseif ($formArray['delete_mode'] == 'selected_delete_comment_types') {
|
| 801 |
-
$delete_comment_types = empty($formArray['delete_comment_types']) ? array() : (array) $formArray['delete_comment_types'];
|
| 802 |
-
$delete_comment_types = array_intersect($delete_comment_types, array_keys($commenttypes));
|
| 803 |
-
|
| 804 |
-
if (!empty($delete_comment_types)) {
|
| 805 |
-
// Loop through comment_types and remove comments/meta and set posts comment_count to 0.
|
| 806 |
-
foreach ($delete_comment_types as $delete_comment_type) {
|
| 807 |
-
$wpdb->query("DELETE cmeta FROM $wpdb->commentmeta cmeta INNER JOIN $wpdb->comments comments ON cmeta.comment_id=comments.comment_ID WHERE comments.comment_type = '$delete_comment_type'");
|
| 808 |
-
$wpdb->query("DELETE comments FROM $wpdb->comments comments WHERE comments.comment_type = '$delete_comment_type'");
|
| 809 |
-
$deletedPostTypeNames[] = $commenttypes[$delete_comment_type];
|
| 810 |
-
}
|
| 811 |
-
|
| 812 |
-
// Update comment_count on post_types
|
| 813 |
-
foreach ($types as $key => $value) {
|
| 814 |
-
$comment_count = $wpdb->get_var("SELECT COUNT(comments.comment_ID) FROM $wpdb->comments comments INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '$key'");
|
| 815 |
-
$wpdb->query("UPDATE $wpdb->posts SET comment_count = $comment_count WHERE post_author != 0 AND post_type = '$key'");
|
| 816 |
-
}
|
| 817 |
|
| 818 |
-
|
| 819 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 820 |
|
| 821 |
-
|
|
|
|
|
|
|
|
|
|
| 822 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 823 |
}
|
| 824 |
}
|
| 825 |
}
|
| 826 |
-
|
| 827 |
-
$message = (count($deletedPostTypeNames) == 0 ? $log . '.' : $log . ' for ' . implode(", ", $deletedPostTypeNames) . '.');
|
| 828 |
-
if (!$this->is_CLI) {
|
| 829 |
-
wp_send_json_success(array('message' => $message));
|
| 830 |
-
wp_die();
|
| 831 |
-
} else {
|
| 832 |
-
return $log;
|
| 833 |
-
}
|
| 834 |
}
|
| 835 |
|
| 836 |
private function discussion_settings_allowed()
|
| 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.1.0
|
| 8 |
* Author: WPDeveloper
|
| 9 |
* Author URI: https://wpdeveloper.net
|
| 10 |
* License: GPL-3.0+
|
| 37 |
|
| 38 |
function __construct()
|
| 39 |
{
|
| 40 |
+
define('DC_VERSION', '2.1.0');
|
| 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/');
|
| 48 |
add_action('wp_ajax_disable_comments_save_settings', array($this, 'disable_comments_settings'));
|
| 49 |
add_action('wp_ajax_disable_comments_delete_comments', array($this, 'delete_comments_settings'));
|
| 50 |
|
|
|
|
|
|
|
| 51 |
// Including cli.php
|
| 52 |
if (defined('WP_CLI') && WP_CLI) {
|
| 53 |
add_action('init', array($this, 'enable_cli'), 9999);
|
| 57 |
$this->networkactive = (is_multisite() && array_key_exists(plugin_basename(__FILE__), (array) get_site_option('active_sitewide_plugins')));
|
| 58 |
$this->is_CLI = defined('WP_CLI') && WP_CLI;
|
| 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 |
} else {
|
| 65 |
$this->options = get_option('disable_comments_options', array());
|
| 66 |
+
$not_configured = empty($this->options) || empty($this->options['settings_saved']);
|
| 67 |
+
|
| 68 |
+
if(is_multisite() && $not_configured && $this->sitewide_settings == '1'){
|
| 69 |
+
$this->options = get_site_option('disable_comments_options', array());
|
| 70 |
+
$this->options['is_network_options'] = true;
|
| 71 |
+
}
|
| 72 |
}
|
| 73 |
|
| 74 |
// If it looks like first run, check compat.
|
| 76 |
$this->check_compatibility();
|
| 77 |
}
|
| 78 |
|
| 79 |
+
$this->options['sitewide_settings'] = ($this->sitewide_settings == '1');
|
| 80 |
+
|
| 81 |
// Upgrade DB if necessary.
|
| 82 |
$this->check_db_upgrades();
|
| 83 |
|
| 93 |
require_once DC_PLUGIN_ROOT_PATH . "/includes/cli.php";
|
| 94 |
new Disable_Comment_Command($this);
|
| 95 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 96 |
|
| 97 |
public function admin_notice(){
|
| 98 |
if( $this->tracker instanceof DisableComments_Plugin_Tracker ) {
|
| 100 |
return;
|
| 101 |
}
|
| 102 |
$current_screen = get_current_screen()->id;
|
| 103 |
+
$hascaps = $this->networkactive && is_network_admin() ? current_user_can('manage_network_plugins') : current_user_can('manage_options');
|
| 104 |
if( ! in_array( $current_screen, ['settings_page_disable_comments_settings', 'settings_page_disable_comments_settings-network']) && $hascaps ) {
|
| 105 |
$this->tracker->notice();
|
| 106 |
}
|
| 130 |
require_once(ABSPATH . 'wp-admin/includes/plugin.php');
|
| 131 |
deactivate_plugins(__FILE__);
|
| 132 |
if (isset($_GET['action']) && ($_GET['action'] == 'activate' || $_GET['action'] == 'error_scrape')) {
|
| 133 |
+
// translators: %s: WordPress version no.
|
| 134 |
exit(sprintf(__('Disable Comments requires WordPress version %s or greater.', 'disable-comments'), '4.7'));
|
| 135 |
}
|
| 136 |
}
|
| 166 |
|
| 167 |
private function update_options()
|
| 168 |
{
|
| 169 |
+
if ($this->networkactive && !empty($this->options['is_network_admin']) && $this->options['is_network_admin']) {
|
| 170 |
+
unset($this->options['is_network_admin']);
|
| 171 |
update_site_option('disable_comments_options', $this->options);
|
| 172 |
+
} else{
|
| 173 |
update_option('disable_comments_options', $this->options);
|
| 174 |
}
|
| 175 |
}
|
| 181 |
{
|
| 182 |
$types = $this->options['disabled_post_types'];
|
| 183 |
// Not all extra_post_types might be registered on this particular site.
|
| 184 |
+
if ($this->networkactive && !empty($this->options['extra_post_types'])) {
|
| 185 |
foreach ((array) $this->options['extra_post_types'] as $extra) {
|
| 186 |
if (post_type_exists($extra)) {
|
| 187 |
$types[] = $extra;
|
| 255 |
add_filter('comments_open', array($this, 'filter_comment_status'), 20, 2);
|
| 256 |
add_filter('pings_open', array($this, 'filter_comment_status'), 20, 2);
|
| 257 |
add_filter('get_comments_number', array($this, 'filter_comments_number'), 20, 2);
|
| 258 |
+
} elseif (is_admin() && !$this->is_configured()) {
|
| 259 |
/**
|
| 260 |
* It is possible that $disabled_post_types is empty if other
|
| 261 |
* plugins have disabled comments. Hence we also check for
|
| 268 |
// Filters for the admin only.
|
| 269 |
if (is_admin()) {
|
| 270 |
add_action( 'all_admin_notices', array( $this, 'admin_notice' ) );
|
| 271 |
+
if ($this->networkactive && is_network_admin()) {
|
| 272 |
add_action('network_admin_menu', array($this, 'settings_menu'));
|
| 273 |
add_action('network_admin_menu', array($this, 'tools_menu'));
|
| 274 |
add_filter('network_admin_plugin_action_links', array($this, 'plugin_actions_links'), 10, 2);
|
| 275 |
+
} elseif(!$this->networkactive || $this->options['sitewide_settings']) {
|
| 276 |
add_action('admin_menu', array($this, 'settings_menu'));
|
| 277 |
add_action('admin_menu', array($this, 'tools_menu'));
|
| 278 |
add_filter('plugin_action_links', array($this, 'plugin_actions_links'), 10, 2);
|
| 301 |
}
|
| 302 |
}
|
| 303 |
|
| 304 |
+
// public function get_option( $key, $default = false ){
|
| 305 |
+
// return $this->networkactive ? get_site_option( $key, $default ) : get_option( $key, $default );
|
| 306 |
+
// }
|
| 307 |
+
// public function update_option( $option, $value ){
|
| 308 |
+
// return $this->networkactive ? update_site_option( $option, $value ) : update_option( $option, $value );
|
| 309 |
+
// }
|
| 310 |
+
// public function delete_option( $option ){
|
| 311 |
+
// return $this->networkactive ? delete_site_option( $option ) : delete_option( $option );
|
| 312 |
+
// }
|
| 313 |
|
| 314 |
/**
|
| 315 |
* Replace the theme's comment template with a blank one.
|
| 335 |
return dirname(__FILE__) . '/views/comments.php';
|
| 336 |
}
|
| 337 |
|
| 338 |
+
public function is_xmlrpc_rest(){
|
| 339 |
+
// remove create comment via xmlrpc
|
| 340 |
+
if (isset($this->options['remove_xmlrpc_comments']) && intval($this->options['remove_xmlrpc_comments']) === 1) {
|
| 341 |
+
return true;
|
| 342 |
+
}
|
| 343 |
+
// rest API Comment Block
|
| 344 |
+
if (isset($this->options['remove_rest_API_comments']) && intval($this->options['remove_rest_API_comments']) === 1) {
|
| 345 |
+
return true;
|
| 346 |
+
}
|
| 347 |
+
return false;
|
| 348 |
+
}
|
| 349 |
|
| 350 |
/**
|
| 351 |
* Remove the X-Pingback HTTP header
|
| 478 |
$names[$type] = get_post_type_object($type)->labels->name;
|
| 479 |
}
|
| 480 |
|
| 481 |
+
// translators: %s: disabled post types.
|
| 482 |
echo '<div class="notice notice-warning"><p>' . sprintf(__('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.', 'disable-comments'), implode(__(', ', 'disable-comments'), $names)) . '</p></div>';
|
| 483 |
}
|
| 484 |
}
|
| 488 |
*/
|
| 489 |
private function settings_page_url()
|
| 490 |
{
|
| 491 |
+
$base = $this->networkactive && is_network_admin() ? network_admin_url('settings.php') : admin_url('options-general.php');
|
| 492 |
return add_query_arg('page', DC_PLUGIN_SLUG, $base);
|
| 493 |
}
|
| 494 |
|
| 497 |
*/
|
| 498 |
private function tools_page_url()
|
| 499 |
{
|
| 500 |
+
$base = $this->networkactive && is_network_admin() ? network_admin_url('settings.php') : admin_url('tools.php');
|
| 501 |
return add_query_arg('page', 'disable_comments_tools', $base);
|
| 502 |
}
|
| 503 |
|
| 507 |
if (strpos(get_current_screen()->id, 'settings_page_disable_comments_settings') === 0) {
|
| 508 |
return;
|
| 509 |
}
|
| 510 |
+
$hascaps = $this->networkactive && is_network_admin() ? current_user_can('manage_network_plugins') : current_user_can('manage_options');
|
| 511 |
if ($hascaps) {
|
| 512 |
$this->setup_notice_flag = true;
|
| 513 |
+
// translators: %s: URL to Disabled Comment settings page.
|
| 514 |
echo '<div class="notice dc-text__block disable__comment__alert mb30"><img height="30" src="'. DC_ASSETS_URI .'img/icon-logo.png" alt=""><p>' . sprintf(__('The <strong>Disable Comments</strong> 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>';
|
| 515 |
}
|
| 516 |
}
|
| 611 |
public function settings_menu()
|
| 612 |
{
|
| 613 |
$title = _x('Disable Comments', 'settings menu title', 'disable-comments');
|
| 614 |
+
if ($this->networkactive && is_network_admin()) {
|
| 615 |
add_submenu_page('settings.php', $title, $title, 'manage_network_plugins', DC_PLUGIN_SLUG, array($this, 'settings_page'));
|
| 616 |
+
} elseif(!$this->networkactive || $this->options['sitewide_settings']) {
|
| 617 |
add_submenu_page('options-general.php', $title, $title, 'manage_options', DC_PLUGIN_SLUG, array($this, 'settings_page'));
|
| 618 |
}
|
| 619 |
}
|
| 622 |
{
|
| 623 |
$title = __('Delete Comments', 'disable-comments');
|
| 624 |
$hook = '';
|
| 625 |
+
if ($this->networkactive && is_network_admin()) {
|
| 626 |
$hook = add_submenu_page('settings.php', $title, $title, 'manage_network_plugins', 'disable_comments_tools', array($this, 'tools_page'));
|
| 627 |
+
} elseif(!$this->networkactive || $this->options['sitewide_settings']) {
|
| 628 |
$hook = add_submenu_page('tools.php', $title, $title, 'manage_options', 'disable_comments_tools', array($this, 'tools_page'));
|
| 629 |
}
|
| 630 |
add_action('load-' . $hook, array($this, 'redirectToMainSettingsPage'));
|
| 639 |
public function get_all_comments_number()
|
| 640 |
{
|
| 641 |
global $wpdb;
|
| 642 |
+
if ( is_network_admin() && function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
|
| 643 |
+
$count = 0;
|
| 644 |
+
$sites = get_sites();
|
| 645 |
+
foreach ( $sites as $site ) {
|
| 646 |
+
switch_to_blog( $site->blog_id );
|
| 647 |
+
$count += $wpdb->get_var("SELECT count(comment_id) from $wpdb->comments");
|
| 648 |
+
restore_current_blog();
|
| 649 |
+
}
|
| 650 |
+
return $count;
|
| 651 |
+
}
|
| 652 |
+
else{
|
| 653 |
+
return $wpdb->get_var("SELECT count(comment_id) from $wpdb->comments");
|
| 654 |
+
}
|
| 655 |
}
|
| 656 |
|
| 657 |
+
public function get_all_comment_types(){
|
| 658 |
+
if($this->networkactive && is_network_admin()){
|
| 659 |
+
$comment_types = [];
|
| 660 |
+
$sites = get_sites();
|
| 661 |
+
foreach ( $sites as $site ) {
|
| 662 |
+
switch_to_blog( $site->blog_id );
|
| 663 |
+
$comment_types = array_merge($this->_get_all_comment_types(), $comment_types);
|
| 664 |
+
restore_current_blog();
|
| 665 |
+
}
|
| 666 |
+
return $comment_types;
|
| 667 |
+
}
|
| 668 |
+
else{
|
| 669 |
+
return $this->_get_all_comment_types();
|
| 670 |
+
}
|
| 671 |
+
|
| 672 |
+
}
|
| 673 |
+
public function _get_all_comment_types()
|
| 674 |
{
|
| 675 |
global $wpdb;
|
| 676 |
$commenttypes = array();
|
| 688 |
return $commenttypes;
|
| 689 |
}
|
| 690 |
|
| 691 |
+
public function get_all_post_types($network = false)
|
| 692 |
{
|
| 693 |
$typeargs = array('public' => true);
|
| 694 |
+
if ($network || $this->networkactive && is_network_admin()) {
|
| 695 |
$typeargs['_builtin'] = true; // stick to known types for network.
|
| 696 |
}
|
| 697 |
$types = get_post_types($typeargs, 'objects');
|
| 741 |
} else {
|
| 742 |
$formArray = (isset($_POST['data']) ? $this->form_data_modify($_POST['data']) : []);
|
| 743 |
}
|
| 744 |
+
$this->options = [];
|
| 745 |
+
|
| 746 |
+
$this->options['is_network_admin'] = isset($formArray['is_network_admin']) && $formArray['is_network_admin'] == '1' ? true : false;
|
| 747 |
+
|
| 748 |
if (isset($formArray['mode'])) {
|
| 749 |
$this->options['remove_everywhere'] = (sanitize_text_field($formArray['mode']) == 'remove_everywhere');
|
| 750 |
}
|
| 751 |
+
$post_types = $this->get_all_post_types($this->options['is_network_admin']);
|
| 752 |
|
| 753 |
if ($this->options['remove_everywhere']) {
|
| 754 |
$disabled_post_types = array_keys($post_types);
|
| 760 |
$this->options['disabled_post_types'] = $disabled_post_types;
|
| 761 |
|
| 762 |
// Extra custom post types.
|
| 763 |
+
if ($this->networkactive && isset($formArray['extra_post_types'])) {
|
| 764 |
$extra_post_types = array_filter(array_map('sanitize_key', explode(',', $formArray['extra_post_types'])));
|
| 765 |
$this->options['extra_post_types'] = array_diff($extra_post_types, array_keys($post_types)); // Make sure we don't double up builtins.
|
| 766 |
}
|
| 767 |
+
|
| 768 |
+
if(isset($formArray['sitewide_settings'])){
|
| 769 |
+
update_site_option('disable_comments_sitewide_settings', $formArray['sitewide_settings']);
|
| 770 |
+
}
|
| 771 |
// xml rpc
|
| 772 |
$this->options['remove_xmlrpc_comments'] = (isset($formArray['remove_xmlrpc_comments']) ? intval($formArray['remove_xmlrpc_comments']) : ($this->is_CLI && isset($this->options['remove_xmlrpc_comments']) ? $this->options['remove_xmlrpc_comments'] : 0));
|
| 773 |
// rest api comments
|
| 774 |
$this->options['remove_rest_API_comments'] = (isset($formArray['remove_rest_API_comments']) ? intval($formArray['remove_rest_API_comments']) : ($this->is_CLI && isset($this->options['remove_rest_API_comments']) ? $this->options['remove_rest_API_comments'] : 0));
|
| 775 |
|
| 776 |
+
$this->options['db_version'] = self::DB_VERSION;
|
| 777 |
+
$this->options['settings_saved'] = true;
|
| 778 |
// save settings
|
| 779 |
$this->update_options();
|
| 780 |
}
|
| 784 |
}
|
| 785 |
}
|
| 786 |
|
| 787 |
+
public function is_configured(){
|
| 788 |
+
$disabled_post_types = $this->get_disabled_post_types();
|
| 789 |
+
|
| 790 |
+
if(empty($disabled_post_types) && empty($this->options['remove_everywhere']) && empty($this->options['remove_rest_API_comments']) && empty($this->options['remove_xmlrpc_comments'])){
|
| 791 |
+
return false;
|
| 792 |
+
}
|
| 793 |
+
return true;
|
| 794 |
+
}
|
| 795 |
+
|
| 796 |
public function delete_comments_settings($_args = array())
|
| 797 |
{
|
| 798 |
+
global $deletedPostTypeNames;
|
| 799 |
$log = '';
|
|
|
|
| 800 |
$nonce = (isset($_POST['nonce']) ? $_POST['nonce'] : '');
|
| 801 |
+
$formArray = $this->form_data_modify($_POST['data']);
|
| 802 |
|
| 803 |
+
if (($this->is_CLI && !empty($_args)) || wp_verify_nonce($nonce, 'disable_comments_save_settings')) {
|
| 804 |
+
if ( !empty($formArray['is_network_admin']) && function_exists( 'get_sites' ) && class_exists( 'WP_Site_Query' ) ) {
|
| 805 |
+
$sites = get_sites();
|
| 806 |
+
foreach ( $sites as $site ) {
|
| 807 |
+
switch_to_blog( $site->blog_id );
|
| 808 |
+
$log = $this->delete_comments($_args);
|
| 809 |
+
restore_current_blog();
|
| 810 |
+
}
|
| 811 |
+
}
|
| 812 |
+
else{
|
| 813 |
+
$log = $this->delete_comments($_args);
|
| 814 |
}
|
| 815 |
+
}
|
| 816 |
+
// message
|
| 817 |
+
$deletedPostTypeNames = array_unique((array) $deletedPostTypeNames);
|
| 818 |
+
$message = (count($deletedPostTypeNames) == 0 ? $log . '.' : $log . ' for ' . implode(", ", $deletedPostTypeNames) . '.');
|
| 819 |
+
if (!$this->is_CLI) {
|
| 820 |
+
wp_send_json_success(array('message' => $message));
|
| 821 |
+
wp_die();
|
| 822 |
+
} else {
|
| 823 |
+
return $log;
|
| 824 |
+
}
|
| 825 |
+
}
|
| 826 |
|
| 827 |
+
private function delete_comments($_args){
|
| 828 |
+
global $wpdb;
|
| 829 |
+
global $deletedPostTypeNames;
|
| 830 |
+
if (!empty($_args)) {
|
| 831 |
+
$formArray = wp_parse_args($_args);
|
| 832 |
+
} else {
|
| 833 |
+
$formArray = $this->form_data_modify($_POST['data']);
|
| 834 |
+
}
|
| 835 |
+
|
| 836 |
+
$types = $this->get_all_post_types(!empty($formArray['is_network_admin']));
|
| 837 |
+
$commenttypes = $this->get_all_comment_types();
|
| 838 |
+
$log = "";
|
| 839 |
+
// comments delete
|
| 840 |
+
if (isset($formArray['delete_mode'])) {
|
| 841 |
+
if ($formArray['delete_mode'] == 'delete_everywhere') {
|
| 842 |
+
if ($wpdb->query("TRUNCATE $wpdb->commentmeta") != false) {
|
| 843 |
+
if ($wpdb->query("TRUNCATE $wpdb->comments") != false) {
|
| 844 |
+
$wpdb->query("UPDATE $wpdb->posts SET comment_count = 0");
|
| 845 |
+
$wpdb->query("OPTIMIZE TABLE $wpdb->commentmeta");
|
| 846 |
+
$wpdb->query("OPTIMIZE TABLE $wpdb->comments");
|
| 847 |
+
$log = __('All comments has been deleted', 'disable-comments');
|
| 848 |
} else {
|
| 849 |
wp_send_json_error(array('message' => __('Internal error occured. Please try again later.', 'disable-comments')));
|
| 850 |
wp_die();
|
| 851 |
}
|
| 852 |
+
} else {
|
| 853 |
+
wp_send_json_error(array('message' => __('Internal error occured. Please try again later.', 'disable-comments')));
|
| 854 |
+
wp_die();
|
| 855 |
+
}
|
| 856 |
+
} elseif ($formArray['delete_mode'] == 'selected_delete_types') {
|
| 857 |
+
$delete_post_types = empty($formArray['delete_types']) ? array() : (array) $formArray['delete_types'];
|
| 858 |
+
$delete_post_types = array_intersect($delete_post_types, array_keys($types));
|
| 859 |
+
|
| 860 |
+
// Extra custom post types.
|
| 861 |
+
if ($this->networkactive && !empty($formArray['delete_extra_post_types'])) {
|
| 862 |
+
$delete_extra_post_types = array_filter(array_map('sanitize_key', explode(',', $formArray['delete_extra_post_types'])));
|
| 863 |
+
$delete_extra_post_types = array_diff($delete_extra_post_types, array_keys($types)); // Make sure we don't double up builtins.
|
| 864 |
+
$delete_post_types = array_merge($delete_post_types, $delete_extra_post_types);
|
| 865 |
+
}
|
|
|
|
|
|
|
|
|
|
| 866 |
|
| 867 |
+
if (!empty($delete_post_types)) {
|
| 868 |
+
// Loop through post_types and remove comments/meta and set posts comment_count to 0.
|
| 869 |
+
foreach ($delete_post_types as $delete_post_type) {
|
| 870 |
+
$wpdb->query("DELETE cmeta FROM $wpdb->commentmeta cmeta INNER JOIN $wpdb->comments comments ON cmeta.comment_id=comments.comment_ID INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '$delete_post_type'");
|
| 871 |
+
$wpdb->query("DELETE comments FROM $wpdb->comments comments INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '$delete_post_type'");
|
| 872 |
+
$wpdb->query("UPDATE $wpdb->posts SET comment_count = 0 WHERE post_author != 0 AND post_type = '$delete_post_type'");
|
| 873 |
|
| 874 |
+
$post_type_object = get_post_type_object($delete_post_type);
|
| 875 |
+
$post_type_label = $post_type_object ? $post_type_object->labels->name : $delete_post_type;
|
| 876 |
+
$deletedPostTypeNames[] = $post_type_label;
|
| 877 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 878 |
|
| 879 |
+
$wpdb->query("OPTIMIZE TABLE $wpdb->commentmeta");
|
| 880 |
+
$wpdb->query("OPTIMIZE TABLE $wpdb->comments");
|
| 881 |
+
$log = __('All comments has been deleted', 'disable-comments');
|
| 882 |
+
}
|
| 883 |
+
} elseif ($formArray['delete_mode'] == 'selected_delete_comment_types') {
|
| 884 |
+
$delete_comment_types = empty($formArray['delete_comment_types']) ? array() : (array) $formArray['delete_comment_types'];
|
| 885 |
+
$delete_comment_types = array_intersect($delete_comment_types, array_keys($commenttypes));
|
| 886 |
+
|
| 887 |
+
if (!empty($delete_comment_types)) {
|
| 888 |
+
// Loop through comment_types and remove comments/meta and set posts comment_count to 0.
|
| 889 |
+
foreach ($delete_comment_types as $delete_comment_type) {
|
| 890 |
+
$wpdb->query("DELETE cmeta FROM $wpdb->commentmeta cmeta INNER JOIN $wpdb->comments comments ON cmeta.comment_id=comments.comment_ID WHERE comments.comment_type = '$delete_comment_type'");
|
| 891 |
+
$wpdb->query("DELETE comments FROM $wpdb->comments comments WHERE comments.comment_type = '$delete_comment_type'");
|
| 892 |
+
$deletedPostTypeNames[] = $commenttypes[$delete_comment_type];
|
| 893 |
+
}
|
| 894 |
|
| 895 |
+
// Update comment_count on post_types
|
| 896 |
+
foreach ($types as $key => $value) {
|
| 897 |
+
$comment_count = $wpdb->get_var("SELECT COUNT(comments.comment_ID) FROM $wpdb->comments comments INNER JOIN $wpdb->posts posts ON comments.comment_post_ID=posts.ID WHERE posts.post_type = '$key'");
|
| 898 |
+
$wpdb->query("UPDATE $wpdb->posts SET comment_count = $comment_count WHERE post_author != 0 AND post_type = '$key'");
|
| 899 |
}
|
| 900 |
+
|
| 901 |
+
$wpdb->query("OPTIMIZE TABLE $wpdb->commentmeta");
|
| 902 |
+
$wpdb->query("OPTIMIZE TABLE $wpdb->comments");
|
| 903 |
+
|
| 904 |
+
$log = __('All comments has been deleted', 'disable-comments');
|
| 905 |
}
|
| 906 |
}
|
| 907 |
}
|
| 908 |
+
return $log;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 909 |
}
|
| 910 |
|
| 911 |
private function discussion_settings_allowed()
|
includes/class-plugin-usage-tracker.php
CHANGED
|
@@ -20,11 +20,11 @@ if( ! class_exists('DisableComments_Plugin_Tracker') ) :
|
|
| 20 |
/**
|
| 21 |
* WP Insights Version
|
| 22 |
*/
|
| 23 |
-
const WPINS_VERSION = '3.0.
|
| 24 |
/**
|
| 25 |
* API URL
|
| 26 |
*/
|
| 27 |
-
const API_URL = 'https://us-east1-wpinsight-saas.cloudfunctions.net/
|
| 28 |
/**
|
| 29 |
* Installed Plugin File
|
| 30 |
*
|
|
@@ -69,7 +69,7 @@ if( ! class_exists('DisableComments_Plugin_Tracker') ) :
|
|
| 69 |
$this->disabled_wp_cron = defined('DISABLE_WP_CRON') && DISABLE_WP_CRON == true;
|
| 70 |
$this->enable_self_cron = $this->disabled_wp_cron == true ? true : false;
|
| 71 |
|
| 72 |
-
$this->event_hook
|
| 73 |
|
| 74 |
$this->require_optin = isset( $args['opt_in'] ) ? $args['opt_in'] : true;
|
| 75 |
$this->include_goodbye_form = isset( $args['goodbye_form'] ) ? $args['goodbye_form'] : true;
|
|
@@ -342,7 +342,9 @@ if( ! class_exists('DisableComments_Plugin_Tracker') ) :
|
|
| 342 |
}
|
| 343 |
$current_user = wp_get_current_user();
|
| 344 |
$email = $current_user->user_email;
|
| 345 |
-
$
|
|
|
|
|
|
|
| 346 |
}
|
| 347 |
$body['marketing_method'] = $this->marketing;
|
| 348 |
$body['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
|
|
@@ -440,13 +442,18 @@ if( ! class_exists('DisableComments_Plugin_Tracker') ) :
|
|
| 440 |
/**
|
| 441 |
* Get SITE ID
|
| 442 |
*/
|
| 443 |
-
$site_id_key
|
| 444 |
-
$site_id
|
| 445 |
-
$failed_data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 446 |
/**
|
| 447 |
* Send Initial Data to API
|
| 448 |
*/
|
| 449 |
-
if( $site_id == false && $this->item_id !== false ) {
|
| 450 |
if( isset( $_SERVER['REMOTE_ADDR'] ) && ! empty( $_SERVER['REMOTE_ADDR'] && $_SERVER['REMOTE_ADDR'] != '127.0.0.1' ) ) {
|
| 451 |
$country_request = wp_remote_get( 'http://ip-api.com/json/'. $_SERVER['REMOTE_ADDR'] .'?fields=country');
|
| 452 |
if( ! is_wp_error( $country_request ) && $country_request['response']['code'] == 200 ) {
|
|
@@ -456,7 +463,7 @@ if( ! class_exists('DisableComments_Plugin_Tracker') ) :
|
|
| 456 |
}
|
| 457 |
|
| 458 |
$body['plugin_slug'] = $this->plugin_name;
|
| 459 |
-
$body['url'] =
|
| 460 |
$body['item_id'] = $this->item_id;
|
| 461 |
|
| 462 |
$request = $this->remote_post( $body );
|
|
@@ -464,6 +471,7 @@ if( ! class_exists('DisableComments_Plugin_Tracker') ) :
|
|
| 464 |
$retrieved_body = json_decode( wp_remote_retrieve_body( $request ), true );
|
| 465 |
if( is_array( $retrieved_body ) && isset( $retrieved_body['siteId'] ) ) {
|
| 466 |
update_option( $site_id_key, $retrieved_body['siteId'] );
|
|
|
|
| 467 |
update_option( "wpins_{$this->plugin_name}_{$retrieved_body['siteId']}", $body );
|
| 468 |
}
|
| 469 |
} else {
|
|
@@ -471,7 +479,7 @@ if( ! class_exists('DisableComments_Plugin_Tracker') ) :
|
|
| 471 |
}
|
| 472 |
}
|
| 473 |
|
| 474 |
-
$site_id_data_key
|
| 475 |
$site_id_data_failed_key = "wpins_{$this->plugin_name}_{$site_id}_send_failed";
|
| 476 |
|
| 477 |
if( $site_id != false ) {
|
|
@@ -484,9 +492,12 @@ if( ! class_exists('DisableComments_Plugin_Tracker') ) :
|
|
| 484 |
}
|
| 485 |
|
| 486 |
if( ! empty( $failed_data ) && $site_id != false ) {
|
| 487 |
-
$failed_data['plugin_slug']
|
| 488 |
-
$failed_data['url']
|
| 489 |
-
$failed_data['site_id']
|
|
|
|
|
|
|
|
|
|
| 490 |
|
| 491 |
$request = $this->remote_post( $failed_data );
|
| 492 |
if( ! is_wp_error( $request ) ) {
|
|
@@ -497,9 +508,12 @@ if( ! class_exists('DisableComments_Plugin_Tracker') ) :
|
|
| 497 |
}
|
| 498 |
|
| 499 |
if( ! empty( $diff_data ) && $site_id != false && empty( $failed_data ) ) {
|
| 500 |
-
$diff_data['plugin_slug']
|
| 501 |
-
$diff_data['url']
|
| 502 |
-
$diff_data['site_id']
|
|
|
|
|
|
|
|
|
|
| 503 |
|
| 504 |
$request = $this->remote_post( $diff_data );
|
| 505 |
if( is_wp_error( $request ) ) {
|
| 20 |
/**
|
| 21 |
* WP Insights Version
|
| 22 |
*/
|
| 23 |
+
const WPINS_VERSION = '3.0.1';
|
| 24 |
/**
|
| 25 |
* API URL
|
| 26 |
*/
|
| 27 |
+
const API_URL = 'https://us-east1-wpinsight-saas.cloudfunctions.net/process-plugin-data';
|
| 28 |
/**
|
| 29 |
* Installed Plugin File
|
| 30 |
*
|
| 69 |
$this->disabled_wp_cron = defined('DISABLE_WP_CRON') && DISABLE_WP_CRON == true;
|
| 70 |
$this->enable_self_cron = $this->disabled_wp_cron == true ? true : false;
|
| 71 |
|
| 72 |
+
$this->event_hook = 'put_do_weekly_action';
|
| 73 |
|
| 74 |
$this->require_optin = isset( $args['opt_in'] ) ? $args['opt_in'] : true;
|
| 75 |
$this->include_goodbye_form = isset( $args['goodbye_form'] ) ? $args['goodbye_form'] : true;
|
| 342 |
}
|
| 343 |
$current_user = wp_get_current_user();
|
| 344 |
$email = $current_user->user_email;
|
| 345 |
+
if( is_email( $email ) ) {
|
| 346 |
+
$body['email'] = $email;
|
| 347 |
+
}
|
| 348 |
}
|
| 349 |
$body['marketing_method'] = $this->marketing;
|
| 350 |
$body['server'] = isset( $_SERVER['SERVER_SOFTWARE'] ) ? $_SERVER['SERVER_SOFTWARE'] : '';
|
| 442 |
/**
|
| 443 |
* Get SITE ID
|
| 444 |
*/
|
| 445 |
+
$site_id_key = "wpins_{$this->plugin_name}_site_id";
|
| 446 |
+
$site_id = get_option( $site_id_key, false );
|
| 447 |
+
$failed_data = [];
|
| 448 |
+
$site_url = get_bloginfo( 'url' );
|
| 449 |
+
$original_site_url = get_option( "wpins_{$this->plugin_name}_original_url", false );
|
| 450 |
+
if( $original_site_url === false && version_compare( $body['wpins_version'], '3.0.1', '==' ) ) {
|
| 451 |
+
$site_id = false;
|
| 452 |
+
}
|
| 453 |
/**
|
| 454 |
* Send Initial Data to API
|
| 455 |
*/
|
| 456 |
+
if( $site_id == false && $this->item_id !== false && $original_site_url === false ) {
|
| 457 |
if( isset( $_SERVER['REMOTE_ADDR'] ) && ! empty( $_SERVER['REMOTE_ADDR'] && $_SERVER['REMOTE_ADDR'] != '127.0.0.1' ) ) {
|
| 458 |
$country_request = wp_remote_get( 'http://ip-api.com/json/'. $_SERVER['REMOTE_ADDR'] .'?fields=country');
|
| 459 |
if( ! is_wp_error( $country_request ) && $country_request['response']['code'] == 200 ) {
|
| 463 |
}
|
| 464 |
|
| 465 |
$body['plugin_slug'] = $this->plugin_name;
|
| 466 |
+
$body['url'] = $site_url;
|
| 467 |
$body['item_id'] = $this->item_id;
|
| 468 |
|
| 469 |
$request = $this->remote_post( $body );
|
| 471 |
$retrieved_body = json_decode( wp_remote_retrieve_body( $request ), true );
|
| 472 |
if( is_array( $retrieved_body ) && isset( $retrieved_body['siteId'] ) ) {
|
| 473 |
update_option( $site_id_key, $retrieved_body['siteId'] );
|
| 474 |
+
update_option( "wpins_{$this->plugin_name}_original_url", $site_url );
|
| 475 |
update_option( "wpins_{$this->plugin_name}_{$retrieved_body['siteId']}", $body );
|
| 476 |
}
|
| 477 |
} else {
|
| 479 |
}
|
| 480 |
}
|
| 481 |
|
| 482 |
+
$site_id_data_key = "wpins_{$this->plugin_name}_{$site_id}";
|
| 483 |
$site_id_data_failed_key = "wpins_{$this->plugin_name}_{$site_id}_send_failed";
|
| 484 |
|
| 485 |
if( $site_id != false ) {
|
| 492 |
}
|
| 493 |
|
| 494 |
if( ! empty( $failed_data ) && $site_id != false ) {
|
| 495 |
+
$failed_data['plugin_slug'] = $this->plugin_name;
|
| 496 |
+
$failed_data['url'] = $site_url;
|
| 497 |
+
$failed_data['site_id'] = $site_id;
|
| 498 |
+
if( $original_site_url != false ) {
|
| 499 |
+
$failed_data['original_url'] = $original_site_url;
|
| 500 |
+
}
|
| 501 |
|
| 502 |
$request = $this->remote_post( $failed_data );
|
| 503 |
if( ! is_wp_error( $request ) ) {
|
| 508 |
}
|
| 509 |
|
| 510 |
if( ! empty( $diff_data ) && $site_id != false && empty( $failed_data ) ) {
|
| 511 |
+
$diff_data['plugin_slug'] = $this->plugin_name;
|
| 512 |
+
$diff_data['url'] = $site_url;
|
| 513 |
+
$diff_data['site_id'] = $site_id;
|
| 514 |
+
if( $original_site_url != false ) {
|
| 515 |
+
$diff_data['original_url'] = $original_site_url;
|
| 516 |
+
}
|
| 517 |
|
| 518 |
$request = $this->remote_post( $diff_data );
|
| 519 |
if( is_wp_error( $request ) ) {
|
includes/cli.php
CHANGED
|
@@ -124,13 +124,16 @@ wp disable-comments delete --comment-types=comment "
|
|
| 124 |
$disable_comments_settings['mode'] = 'selected_types';
|
| 125 |
$_types = array_map('trim', explode(',', $types));
|
| 126 |
$disabled_post_types = $this->dc_instance->get_disabled_post_types();
|
|
|
|
| 127 |
$new_msg = sprintf( __( 'Comments disabled for %s. ', 'disable-comments' ), $types );
|
| 128 |
if(!empty($add)){
|
| 129 |
$_types = array_unique(array_merge($disabled_post_types, $_types));
|
|
|
|
| 130 |
$new_msg = sprintf( __( 'Comments disabled for %s. ', 'disable-comments' ), $types );
|
| 131 |
}
|
| 132 |
if(!empty($remove)){
|
| 133 |
$_types = array_diff($disabled_post_types, $_types);
|
|
|
|
| 134 |
$new_msg = sprintf( __( 'Comments enabled for %s. ', 'disable-comments' ), $types );
|
| 135 |
}
|
| 136 |
|
|
@@ -141,6 +144,7 @@ wp disable-comments delete --comment-types=comment "
|
|
| 141 |
// for network.
|
| 142 |
if(!empty($extra_post_types)){
|
| 143 |
$disable_comments_settings['extra_post_types'] = $extra_post_types;
|
|
|
|
| 144 |
$msg .= sprintf( __( 'Custom post types: %s. ', 'disable-comments' ), $extra_post_types );
|
| 145 |
}
|
| 146 |
|
| 124 |
$disable_comments_settings['mode'] = 'selected_types';
|
| 125 |
$_types = array_map('trim', explode(',', $types));
|
| 126 |
$disabled_post_types = $this->dc_instance->get_disabled_post_types();
|
| 127 |
+
// translators: %s: post types to be disabled
|
| 128 |
$new_msg = sprintf( __( 'Comments disabled for %s. ', 'disable-comments' ), $types );
|
| 129 |
if(!empty($add)){
|
| 130 |
$_types = array_unique(array_merge($disabled_post_types, $_types));
|
| 131 |
+
// translators: %s: post types to be disabled
|
| 132 |
$new_msg = sprintf( __( 'Comments disabled for %s. ', 'disable-comments' ), $types );
|
| 133 |
}
|
| 134 |
if(!empty($remove)){
|
| 135 |
$_types = array_diff($disabled_post_types, $_types);
|
| 136 |
+
// translators: %s: post types to be enabled
|
| 137 |
$new_msg = sprintf( __( 'Comments enabled for %s. ', 'disable-comments' ), $types );
|
| 138 |
}
|
| 139 |
|
| 144 |
// for network.
|
| 145 |
if(!empty($extra_post_types)){
|
| 146 |
$disable_comments_settings['extra_post_types'] = $extra_post_types;
|
| 147 |
+
// translators: %s: post types to be disabled in network
|
| 148 |
$msg .= sprintf( __( 'Custom post types: %s. ', 'disable-comments' ), $extra_post_types );
|
| 149 |
}
|
| 150 |
|
languages/disable-comments.pot
CHANGED
|
@@ -1,170 +1,164 @@
|
|
| 1 |
-
# Copyright (C)
|
| 2 |
-
# This file is distributed under the
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
-
"Project-Id-Version: Disable Comments 2.0
|
| 6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/disable-comments\n"
|
| 7 |
-
"
|
| 8 |
-
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 9 |
"MIME-Version: 1.0\n"
|
| 10 |
-
"Content-Type: text/plain; charset=
|
| 11 |
"Content-Transfer-Encoding: 8bit\n"
|
| 12 |
-
"
|
| 13 |
-
"
|
| 14 |
-
"
|
| 15 |
-
"
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
#. Author of the plugin
|
| 31 |
-
msgid "WPDeveloper"
|
| 32 |
-
msgstr ""
|
| 33 |
-
|
| 34 |
-
#. Author URI of the plugin
|
| 35 |
-
msgid "https://wpdeveloper.net"
|
| 36 |
-
msgstr ""
|
| 37 |
-
|
| 38 |
-
#: disable-comments.php:127
|
| 39 |
msgid "Want to help make Disable Comments even better?"
|
| 40 |
msgstr ""
|
| 41 |
|
| 42 |
-
#: disable-comments.php:
|
| 43 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
msgstr ""
|
| 45 |
|
| 46 |
-
#: disable-comments.php:
|
|
|
|
| 47 |
msgid "Disable Comments requires WordPress version %s or greater."
|
| 48 |
msgstr ""
|
| 49 |
|
| 50 |
-
#: disable-comments.php:
|
| 51 |
-
#: disable-comments.php:514
|
| 52 |
-
#: disable-comments.php:521
|
| 53 |
msgid "Comments are closed."
|
| 54 |
msgstr ""
|
| 55 |
|
| 56 |
-
#: disable-comments.php:
|
| 57 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 58 |
msgstr ""
|
| 59 |
|
| 60 |
-
#: disable-comments.php:
|
| 61 |
msgid ", "
|
| 62 |
msgstr ""
|
| 63 |
|
| 64 |
-
#: disable-comments.php:
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
msgstr ""
|
| 67 |
|
| 68 |
-
#: disable-comments.php:
|
| 69 |
-
#: views/partials/_disable.php:3
|
| 70 |
msgid "Settings"
|
| 71 |
msgstr ""
|
| 72 |
|
| 73 |
-
#: disable-comments.php:595
|
| 74 |
-
msgid "Tools"
|
| 75 |
-
msgstr ""
|
| 76 |
-
|
| 77 |
#: disable-comments.php:604
|
| 78 |
-
|
| 79 |
-
msgid "Disable Comments"
|
| 80 |
msgstr ""
|
| 81 |
|
| 82 |
-
#: disable-comments.php:
|
| 83 |
-
#: views/partials/_delete.php:51
|
| 84 |
-
#: views/settings.php:12
|
| 85 |
msgid "Delete Comments"
|
| 86 |
msgstr ""
|
| 87 |
|
| 88 |
-
#: disable-comments.php:
|
| 89 |
msgid "Default (no type)"
|
| 90 |
msgstr ""
|
| 91 |
|
| 92 |
-
#: disable-comments.php:
|
| 93 |
msgid "Saved"
|
| 94 |
msgstr ""
|
| 95 |
|
| 96 |
-
#: disable-comments.php:
|
| 97 |
-
#: disable-comments.php:798
|
| 98 |
-
#: disable-comments.php:821
|
| 99 |
msgid "All comments has been deleted"
|
| 100 |
msgstr ""
|
| 101 |
|
| 102 |
-
#: disable-comments.php:
|
| 103 |
-
#: disable-comments.php:770
|
| 104 |
msgid "Internal error occured. Please try again later."
|
| 105 |
msgstr ""
|
| 106 |
|
| 107 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 108 |
-
msgid "
|
|
|
|
|
|
|
| 109 |
msgstr ""
|
| 110 |
|
| 111 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 112 |
msgid "What we collect."
|
| 113 |
msgstr ""
|
| 114 |
|
| 115 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 116 |
msgid "Sure, I'd like to help"
|
| 117 |
msgstr ""
|
| 118 |
|
| 119 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 120 |
msgid "No Thanks."
|
| 121 |
msgstr ""
|
| 122 |
|
| 123 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 124 |
msgid "Sorry to see you go"
|
| 125 |
msgstr ""
|
| 126 |
|
| 127 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 128 |
-
msgid "
|
|
|
|
|
|
|
| 129 |
msgstr ""
|
| 130 |
|
| 131 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 132 |
msgid "I no longer need the plugin"
|
| 133 |
msgstr ""
|
| 134 |
|
| 135 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 136 |
msgid "I found a better plugin"
|
| 137 |
msgstr ""
|
| 138 |
|
| 139 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 140 |
msgid "Please share which plugin"
|
| 141 |
msgstr ""
|
| 142 |
|
| 143 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 144 |
msgid "I couldn't get the plugin to work"
|
| 145 |
msgstr ""
|
| 146 |
|
| 147 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 148 |
msgid "It's a temporary deactivation"
|
| 149 |
msgstr ""
|
| 150 |
|
| 151 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 152 |
msgid "Other"
|
| 153 |
msgstr ""
|
| 154 |
|
| 155 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 156 |
msgid "Please share the reason"
|
| 157 |
msgstr ""
|
| 158 |
|
| 159 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 160 |
msgid "Submitting form"
|
| 161 |
msgstr ""
|
| 162 |
|
| 163 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 164 |
msgid "Submit and Deactivate"
|
| 165 |
msgstr ""
|
| 166 |
|
| 167 |
-
#: includes/class-plugin-usage-tracker.php:
|
| 168 |
msgid "Just Deactivate"
|
| 169 |
msgstr ""
|
| 170 |
|
|
@@ -172,38 +166,41 @@ msgstr ""
|
|
| 172 |
msgid "Comments is disabled everywhere. "
|
| 173 |
msgstr ""
|
| 174 |
|
| 175 |
-
#: includes/cli.php:
|
| 176 |
-
|
| 177 |
msgid "Comments disabled for %s. "
|
| 178 |
msgstr ""
|
| 179 |
|
| 180 |
-
#: includes/cli.php:
|
|
|
|
| 181 |
msgid "Comments enabled for %s. "
|
| 182 |
msgstr ""
|
| 183 |
|
| 184 |
-
#: includes/cli.php:
|
|
|
|
| 185 |
msgid "Custom post types: %s. "
|
| 186 |
msgstr ""
|
| 187 |
|
| 188 |
-
#: includes/cli.php:
|
| 189 |
msgid "Disable Comments via XML-RPC. "
|
| 190 |
msgstr ""
|
| 191 |
|
| 192 |
-
#: includes/cli.php:
|
| 193 |
msgid "Disable Comments via REST API. "
|
| 194 |
msgstr ""
|
| 195 |
|
| 196 |
-
#: views/partials/_delete.php:6
|
| 197 |
-
#: views/partials/_disable.php:
|
| 198 |
msgid "Note:"
|
| 199 |
msgstr ""
|
| 200 |
|
| 201 |
#: views/partials/_delete.php:6
|
| 202 |
-
msgid "
|
|
|
|
|
|
|
| 203 |
msgstr ""
|
| 204 |
|
| 205 |
-
#: views/partials/_delete.php:9
|
| 206 |
-
#: views/partials/_disable.php:7
|
| 207 |
msgid "Everywhere:"
|
| 208 |
msgstr ""
|
| 209 |
|
|
@@ -211,10 +208,8 @@ msgstr ""
|
|
| 211 |
msgid "Permanently delete all comments on your WordPress website"
|
| 212 |
msgstr ""
|
| 213 |
|
| 214 |
-
#: views/partials/_delete.php:10
|
| 215 |
-
#: views/partials/_delete.php:33
|
| 216 |
-
#: views/partials/_delete.php:46
|
| 217 |
-
#: views/partials/_disable.php:8
|
| 218 |
msgid "Warnings:"
|
| 219 |
msgstr ""
|
| 220 |
|
|
@@ -226,18 +221,22 @@ msgstr ""
|
|
| 226 |
msgid "On Certain Post Types:"
|
| 227 |
msgstr ""
|
| 228 |
|
| 229 |
-
#: views/partials/_delete.php:29
|
| 230 |
-
|
| 231 |
-
|
|
|
|
|
|
|
|
|
|
| 232 |
msgstr ""
|
| 233 |
|
| 234 |
-
#: views/partials/_delete.php:30
|
| 235 |
-
#: views/partials/_disable.php:27
|
| 236 |
msgid "Custom post types:"
|
| 237 |
msgstr ""
|
| 238 |
|
| 239 |
#: views/partials/_delete.php:33
|
| 240 |
-
msgid "
|
|
|
|
|
|
|
| 241 |
msgstr ""
|
| 242 |
|
| 243 |
#: views/partials/_delete.php:37
|
|
@@ -245,68 +244,95 @@ msgid "Delete Certain Comment Types:"
|
|
| 245 |
msgstr ""
|
| 246 |
|
| 247 |
#: views/partials/_delete.php:46
|
| 248 |
-
msgid "
|
|
|
|
|
|
|
|
|
|
| 249 |
msgstr ""
|
| 250 |
|
| 251 |
#: views/partials/_delete.php:48
|
| 252 |
msgid "Total Comments:"
|
| 253 |
msgstr ""
|
| 254 |
|
| 255 |
-
#: views/partials/_delete.php:
|
| 256 |
msgid "No comments are available for deletion."
|
| 257 |
msgstr ""
|
| 258 |
|
| 259 |
#: views/partials/_disable.php:4
|
| 260 |
-
msgid "
|
|
|
|
|
|
|
| 261 |
msgstr ""
|
| 262 |
|
| 263 |
-
#: views/partials/_disable.php:
|
| 264 |
-
|
|
|
|
| 265 |
msgstr ""
|
| 266 |
|
| 267 |
-
#: views/partials/_disable.php:
|
| 268 |
-
|
|
|
|
| 269 |
msgstr ""
|
| 270 |
|
| 271 |
-
#: views/partials/_disable.php:
|
| 272 |
-
msgid "
|
|
|
|
|
|
|
| 273 |
msgstr ""
|
| 274 |
|
| 275 |
-
#: views/partials/_disable.php:
|
| 276 |
-
msgid "
|
|
|
|
|
|
|
| 277 |
msgstr ""
|
| 278 |
|
| 279 |
-
#: views/partials/_disable.php:
|
| 280 |
-
msgid "Disable
|
| 281 |
msgstr ""
|
| 282 |
|
| 283 |
-
#: views/partials/_disable.php:
|
| 284 |
-
msgid "
|
|
|
|
|
|
|
| 285 |
msgstr ""
|
| 286 |
|
| 287 |
-
#: views/partials/_disable.php:
|
| 288 |
-
|
| 289 |
-
msgid "On"
|
| 290 |
msgstr ""
|
| 291 |
|
| 292 |
-
#: views/partials/_disable.php:
|
| 293 |
-
|
| 294 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 295 |
msgstr ""
|
| 296 |
|
| 297 |
-
#: views/partials/_disable.php:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 298 |
msgid "Disable Comments via XML-RPC"
|
| 299 |
msgstr ""
|
| 300 |
|
| 301 |
-
#: views/partials/_disable.php:
|
| 302 |
msgid "Disable Comments via REST API"
|
| 303 |
msgstr ""
|
| 304 |
|
| 305 |
-
#: views/partials/_disable.php:
|
| 306 |
-
msgid "
|
|
|
|
|
|
|
| 307 |
msgstr ""
|
| 308 |
|
| 309 |
-
#: views/partials/_disable.php:
|
| 310 |
msgid "Save Changes"
|
| 311 |
msgstr ""
|
| 312 |
|
|
@@ -365,3 +391,41 @@ msgstr ""
|
|
| 365 |
#: views/settings.php:6
|
| 366 |
msgid "Version"
|
| 367 |
msgstr ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Copyright (C) 2021 WPDeveloper
|
| 2 |
+
# This file is distributed under the GPL-3.0+.
|
| 3 |
msgid ""
|
| 4 |
msgstr ""
|
| 5 |
+
"Project-Id-Version: Disable Comments 2.1.0\n"
|
| 6 |
"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/disable-comments\n"
|
| 7 |
+
"POT-Creation-Date: 2021-02-08 05:33: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"
|
| 11 |
+
"PO-Revision-Date: 2021-MO-DA HO:MI+ZONE\n"
|
| 12 |
+
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
|
| 13 |
+
"Language-Team: LANGUAGE <LL@li.org>\n"
|
| 14 |
+
"Language: en\n"
|
| 15 |
+
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
|
| 16 |
+
"X-Poedit-Country: United States\n"
|
| 17 |
+
"X-Poedit-SourceCharset: UTF-8\n"
|
| 18 |
+
"X-Poedit-KeywordsList: "
|
| 19 |
+
"__;_e;_x:1,2c;_ex:1,2c;_n:1,2;_nx:1,2,4c;_n_noop:1,2;_nx_noop:1,2,3c;esc_"
|
| 20 |
+
"attr__;esc_html__;esc_attr_e;esc_html_e;esc_attr_x:1,2c;esc_html_x:1,2c;\n"
|
| 21 |
+
"X-Poedit-Basepath: ../\n"
|
| 22 |
+
"X-Poedit-SearchPath-0: .\n"
|
| 23 |
+
"X-Poedit-Bookmarks: \n"
|
| 24 |
+
"X-Textdomain-Support: yes\n"
|
| 25 |
+
"X-Generator: grunt-wp-i18n 1.0.3\n"
|
| 26 |
+
|
| 27 |
+
#: disable-comments.php:121
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
msgid "Want to help make Disable Comments even better?"
|
| 29 |
msgstr ""
|
| 30 |
|
| 31 |
+
#: disable-comments.php:122
|
| 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 "
|
| 35 |
+
"send you the discount coupon. This data lets us make sure this plugin "
|
| 36 |
+
"always stays compatible with the most popular plugins and themes. No spam, "
|
| 37 |
+
"I promise."
|
| 38 |
msgstr ""
|
| 39 |
|
| 40 |
+
#: disable-comments.php:134
|
| 41 |
+
#. translators: %s: WordPress version no.
|
| 42 |
msgid "Disable Comments requires WordPress version %s or greater."
|
| 43 |
msgstr ""
|
| 44 |
|
| 45 |
+
#: disable-comments.php:379 disable-comments.php:523 disable-comments.php:530
|
|
|
|
|
|
|
| 46 |
msgid "Comments are closed."
|
| 47 |
msgstr ""
|
| 48 |
|
| 49 |
+
#: disable-comments.php:482
|
| 50 |
+
#. translators: %s: disabled post types.
|
| 51 |
+
msgid ""
|
| 52 |
+
"Note: The <em>Disable Comments</em> plugin is currently active, and "
|
| 53 |
+
"comments are completely disabled on: %s. Many of the settings below will "
|
| 54 |
+
"not be applicable for those post types."
|
| 55 |
msgstr ""
|
| 56 |
|
| 57 |
+
#: disable-comments.php:482
|
| 58 |
msgid ", "
|
| 59 |
msgstr ""
|
| 60 |
|
| 61 |
+
#: disable-comments.php:514
|
| 62 |
+
#. translators: %s: URL to Disabled Comment settings page.
|
| 63 |
+
msgid ""
|
| 64 |
+
"The <strong>Disable Comments</strong> plugin is active, but isn't "
|
| 65 |
+
"configured to do anything yet. Visit the <a href=\"%s\">configuration "
|
| 66 |
+
"page</a> to choose which post types to disable comments on."
|
| 67 |
msgstr ""
|
| 68 |
|
| 69 |
+
#: disable-comments.php:603 views/partials/_disable.php:3
|
|
|
|
| 70 |
msgid "Settings"
|
| 71 |
msgstr ""
|
| 72 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
#: disable-comments.php:604
|
| 74 |
+
msgid "Tools"
|
|
|
|
| 75 |
msgstr ""
|
| 76 |
|
| 77 |
+
#: disable-comments.php:623 views/partials/_delete.php:54
|
|
|
|
|
|
|
| 78 |
msgid "Delete Comments"
|
| 79 |
msgstr ""
|
| 80 |
|
| 81 |
+
#: disable-comments.php:682
|
| 82 |
msgid "Default (no type)"
|
| 83 |
msgstr ""
|
| 84 |
|
| 85 |
+
#: disable-comments.php:782
|
| 86 |
msgid "Saved"
|
| 87 |
msgstr ""
|
| 88 |
|
| 89 |
+
#: disable-comments.php:847 disable-comments.php:881 disable-comments.php:904
|
|
|
|
|
|
|
| 90 |
msgid "All comments has been deleted"
|
| 91 |
msgstr ""
|
| 92 |
|
| 93 |
+
#: disable-comments.php:849 disable-comments.php:853
|
|
|
|
| 94 |
msgid "Internal error occured. Please try again later."
|
| 95 |
msgstr ""
|
| 96 |
|
| 97 |
+
#: includes/class-plugin-usage-tracker.php:378
|
| 98 |
+
msgid ""
|
| 99 |
+
"We can't detect any plugin information. This is most probably because you "
|
| 100 |
+
"have not included the code in the plugin main file."
|
| 101 |
msgstr ""
|
| 102 |
|
| 103 |
+
#: includes/class-plugin-usage-tracker.php:651
|
| 104 |
msgid "What we collect."
|
| 105 |
msgstr ""
|
| 106 |
|
| 107 |
+
#: includes/class-plugin-usage-tracker.php:652
|
| 108 |
msgid "Sure, I'd like to help"
|
| 109 |
msgstr ""
|
| 110 |
|
| 111 |
+
#: includes/class-plugin-usage-tracker.php:653
|
| 112 |
msgid "No Thanks."
|
| 113 |
msgstr ""
|
| 114 |
|
| 115 |
+
#: includes/class-plugin-usage-tracker.php:746
|
| 116 |
msgid "Sorry to see you go"
|
| 117 |
msgstr ""
|
| 118 |
|
| 119 |
+
#: includes/class-plugin-usage-tracker.php:747
|
| 120 |
+
msgid ""
|
| 121 |
+
"Before you deactivate the plugin, would you quickly give us your reason for "
|
| 122 |
+
"doing so?"
|
| 123 |
msgstr ""
|
| 124 |
|
| 125 |
+
#: includes/class-plugin-usage-tracker.php:750
|
| 126 |
msgid "I no longer need the plugin"
|
| 127 |
msgstr ""
|
| 128 |
|
| 129 |
+
#: includes/class-plugin-usage-tracker.php:752
|
| 130 |
msgid "I found a better plugin"
|
| 131 |
msgstr ""
|
| 132 |
|
| 133 |
+
#: includes/class-plugin-usage-tracker.php:753
|
| 134 |
msgid "Please share which plugin"
|
| 135 |
msgstr ""
|
| 136 |
|
| 137 |
+
#: includes/class-plugin-usage-tracker.php:755
|
| 138 |
msgid "I couldn't get the plugin to work"
|
| 139 |
msgstr ""
|
| 140 |
|
| 141 |
+
#: includes/class-plugin-usage-tracker.php:756
|
| 142 |
msgid "It's a temporary deactivation"
|
| 143 |
msgstr ""
|
| 144 |
|
| 145 |
+
#: includes/class-plugin-usage-tracker.php:758
|
| 146 |
msgid "Other"
|
| 147 |
msgstr ""
|
| 148 |
|
| 149 |
+
#: includes/class-plugin-usage-tracker.php:759
|
| 150 |
msgid "Please share the reason"
|
| 151 |
msgstr ""
|
| 152 |
|
| 153 |
+
#: includes/class-plugin-usage-tracker.php:801
|
| 154 |
msgid "Submitting form"
|
| 155 |
msgstr ""
|
| 156 |
|
| 157 |
+
#: includes/class-plugin-usage-tracker.php:859
|
| 158 |
msgid "Submit and Deactivate"
|
| 159 |
msgstr ""
|
| 160 |
|
| 161 |
+
#: includes/class-plugin-usage-tracker.php:859
|
| 162 |
msgid "Just Deactivate"
|
| 163 |
msgstr ""
|
| 164 |
|
| 166 |
msgid "Comments is disabled everywhere. "
|
| 167 |
msgstr ""
|
| 168 |
|
| 169 |
+
#: includes/cli.php:128 includes/cli.php:132
|
| 170 |
+
#. translators: %s: post types to be disabled
|
| 171 |
msgid "Comments disabled for %s. "
|
| 172 |
msgstr ""
|
| 173 |
|
| 174 |
+
#: includes/cli.php:137
|
| 175 |
+
#. translators: %s: post types to be enabled
|
| 176 |
msgid "Comments enabled for %s. "
|
| 177 |
msgstr ""
|
| 178 |
|
| 179 |
+
#: includes/cli.php:148
|
| 180 |
+
#. translators: %s: post types to be disabled in network
|
| 181 |
msgid "Custom post types: %s. "
|
| 182 |
msgstr ""
|
| 183 |
|
| 184 |
+
#: includes/cli.php:153
|
| 185 |
msgid "Disable Comments via XML-RPC. "
|
| 186 |
msgstr ""
|
| 187 |
|
| 188 |
+
#: includes/cli.php:157
|
| 189 |
msgid "Disable Comments via REST API. "
|
| 190 |
msgstr ""
|
| 191 |
|
| 192 |
+
#: views/partials/_delete.php:6 views/partials/_disable.php:19
|
| 193 |
+
#: views/partials/_disable.php:25 views/partials/_disable.php:56
|
| 194 |
msgid "Note:"
|
| 195 |
msgstr ""
|
| 196 |
|
| 197 |
#: views/partials/_delete.php:6
|
| 198 |
+
msgid ""
|
| 199 |
+
"These settings will permanently delete comments for your entire website, or "
|
| 200 |
+
"for specific posts and comment types."
|
| 201 |
msgstr ""
|
| 202 |
|
| 203 |
+
#: views/partials/_delete.php:9 views/partials/_disable.php:32
|
|
|
|
| 204 |
msgid "Everywhere:"
|
| 205 |
msgstr ""
|
| 206 |
|
| 208 |
msgid "Permanently delete all comments on your WordPress website"
|
| 209 |
msgstr ""
|
| 210 |
|
| 211 |
+
#: views/partials/_delete.php:10 views/partials/_delete.php:33
|
| 212 |
+
#: views/partials/_delete.php:46 views/partials/_disable.php:33
|
|
|
|
|
|
|
| 213 |
msgid "Warnings:"
|
| 214 |
msgstr ""
|
| 215 |
|
| 221 |
msgid "On Certain Post Types:"
|
| 222 |
msgstr ""
|
| 223 |
|
| 224 |
+
#: views/partials/_delete.php:29 views/partials/_disable.php:52
|
| 225 |
+
msgid ""
|
| 226 |
+
"Only the built-in post types appear above. If you want to disable comments "
|
| 227 |
+
"on other custom post types on the entire network, you can supply a "
|
| 228 |
+
"comma-separated list of post types below (use the slug that identifies the "
|
| 229 |
+
"post type)."
|
| 230 |
msgstr ""
|
| 231 |
|
| 232 |
+
#: views/partials/_delete.php:30 views/partials/_disable.php:53
|
|
|
|
| 233 |
msgid "Custom post types:"
|
| 234 |
msgstr ""
|
| 235 |
|
| 236 |
#: views/partials/_delete.php:33
|
| 237 |
+
msgid ""
|
| 238 |
+
"This will remove existing comment entries for the selected post type(s) in "
|
| 239 |
+
"the database and cannot be reverted without a database backups."
|
| 240 |
msgstr ""
|
| 241 |
|
| 242 |
#: views/partials/_delete.php:37
|
| 244 |
msgstr ""
|
| 245 |
|
| 246 |
#: views/partials/_delete.php:46
|
| 247 |
+
msgid ""
|
| 248 |
+
"Deleting comments by comment type will remove existing comment entries of "
|
| 249 |
+
"the selected comment type(s) in the database and cannot be reverted without "
|
| 250 |
+
"a database backup."
|
| 251 |
msgstr ""
|
| 252 |
|
| 253 |
#: views/partials/_delete.php:48
|
| 254 |
msgid "Total Comments:"
|
| 255 |
msgstr ""
|
| 256 |
|
| 257 |
+
#: views/partials/_delete.php:192
|
| 258 |
msgid "No comments are available for deletion."
|
| 259 |
msgstr ""
|
| 260 |
|
| 261 |
#: views/partials/_disable.php:4
|
| 262 |
+
msgid ""
|
| 263 |
+
"Configure the settings below to disable comments globally or on specific "
|
| 264 |
+
"types of posts."
|
| 265 |
msgstr ""
|
| 266 |
|
| 267 |
+
#: views/partials/_disable.php:14 views/partials/_disable.php:68
|
| 268 |
+
#: views/partials/_disable.php:78
|
| 269 |
+
msgid "On"
|
| 270 |
msgstr ""
|
| 271 |
|
| 272 |
+
#: views/partials/_disable.php:15 views/partials/_disable.php:69
|
| 273 |
+
#: views/partials/_disable.php:79
|
| 274 |
+
msgid "Off"
|
| 275 |
msgstr ""
|
| 276 |
|
| 277 |
+
#: views/partials/_disable.php:19
|
| 278 |
+
msgid ""
|
| 279 |
+
"If you enable site wise settings, You need to configure your Disable "
|
| 280 |
+
"Comments settings individually on every website in the network."
|
| 281 |
msgstr ""
|
| 282 |
|
| 283 |
+
#: views/partials/_disable.php:25
|
| 284 |
+
msgid ""
|
| 285 |
+
"This site will be controlled by the network admin until you click the "
|
| 286 |
+
"\"Save Changes\" button."
|
| 287 |
msgstr ""
|
| 288 |
|
| 289 |
+
#: views/partials/_disable.php:32
|
| 290 |
+
msgid "Disable comments globally on your entire website"
|
| 291 |
msgstr ""
|
| 292 |
|
| 293 |
+
#: views/partials/_disable.php:33
|
| 294 |
+
msgid ""
|
| 295 |
+
"This will disable comments from every page and post on your website. Use "
|
| 296 |
+
"this setting if you do not want to show comments anywhere."
|
| 297 |
msgstr ""
|
| 298 |
|
| 299 |
+
#: views/partials/_disable.php:37
|
| 300 |
+
msgid "On Specific Post Types:"
|
|
|
|
| 301 |
msgstr ""
|
| 302 |
|
| 303 |
+
#: views/partials/_disable.php:56
|
| 304 |
+
msgid ""
|
| 305 |
+
"Disabling comments will also disable trackbacks and pingbacks. All "
|
| 306 |
+
"comment-related fields will also be hidden from the edit/quick-edit screens "
|
| 307 |
+
"of the affected posts. These settings cannot be overridden for individual "
|
| 308 |
+
"posts. Comments will be visible on all other post types."
|
| 309 |
+
msgstr ""
|
| 310 |
+
|
| 311 |
+
#: views/partials/_disable.php:60
|
| 312 |
+
msgid "Disable Comments With API"
|
| 313 |
msgstr ""
|
| 314 |
|
| 315 |
+
#: views/partials/_disable.php:61
|
| 316 |
+
msgid ""
|
| 317 |
+
"You can disable comments made on your website using WordPress "
|
| 318 |
+
"specifications."
|
| 319 |
+
msgstr ""
|
| 320 |
+
|
| 321 |
+
#: views/partials/_disable.php:71
|
| 322 |
msgid "Disable Comments via XML-RPC"
|
| 323 |
msgstr ""
|
| 324 |
|
| 325 |
+
#: views/partials/_disable.php:80
|
| 326 |
msgid "Disable Comments via REST API"
|
| 327 |
msgstr ""
|
| 328 |
|
| 329 |
+
#: views/partials/_disable.php:84
|
| 330 |
+
msgid ""
|
| 331 |
+
"Turning on these settings will disable any comments made on your website "
|
| 332 |
+
"via XML-RPC or REST API specifications."
|
| 333 |
msgstr ""
|
| 334 |
|
| 335 |
+
#: views/partials/_disable.php:88
|
| 336 |
msgid "Save Changes"
|
| 337 |
msgstr ""
|
| 338 |
|
| 391 |
#: views/settings.php:6
|
| 392 |
msgid "Version"
|
| 393 |
msgstr ""
|
| 394 |
+
|
| 395 |
+
#. Plugin Name of the plugin/theme
|
| 396 |
+
msgid "Disable Comments"
|
| 397 |
+
msgstr ""
|
| 398 |
+
|
| 399 |
+
#. Plugin URI of the plugin/theme
|
| 400 |
+
msgid "https://wordpress.org/plugins/disable-comments/"
|
| 401 |
+
msgstr ""
|
| 402 |
+
|
| 403 |
+
#. Description of the plugin/theme
|
| 404 |
+
msgid ""
|
| 405 |
+
"Allows administrators to globally disable comments on their site. Comments "
|
| 406 |
+
"can be disabled according to post type. You could bulk delete comments "
|
| 407 |
+
"using Tools."
|
| 408 |
+
msgstr ""
|
| 409 |
+
|
| 410 |
+
#. Author of the plugin/theme
|
| 411 |
+
msgid "WPDeveloper"
|
| 412 |
+
msgstr ""
|
| 413 |
+
|
| 414 |
+
#. Author URI of the plugin/theme
|
| 415 |
+
msgid "https://wpdeveloper.net"
|
| 416 |
+
msgstr ""
|
| 417 |
+
|
| 418 |
+
#: disable-comments.php:613
|
| 419 |
+
msgctxt "settings menu title"
|
| 420 |
+
msgid "Disable Comments"
|
| 421 |
+
msgstr ""
|
| 422 |
+
|
| 423 |
+
#: views/settings.php:9
|
| 424 |
+
msgctxt "Tab Name"
|
| 425 |
+
msgid "Disable Comments"
|
| 426 |
+
msgstr ""
|
| 427 |
+
|
| 428 |
+
#: views/settings.php:12
|
| 429 |
+
msgctxt "Tab Name"
|
| 430 |
+
msgid "Delete Comments"
|
| 431 |
+
msgstr ""
|
readme.txt
CHANGED
|
@@ -5,7 +5,7 @@ Tags: comments, delete comments, disable, disable comments, stop spam, remove co
|
|
| 5 |
Requires at least: 5.0
|
| 6 |
Tested up to: 5.6
|
| 7 |
Requires PHP: 5.6
|
| 8 |
-
Stable tag: 2.0
|
| 9 |
License: GPL-3.0-or-later
|
| 10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
| 11 |
|
|
@@ -137,7 +137,7 @@ Visit [WPDeveloper](https://wpdeveloper.net/) to learn more about how to do bett
|
|
| 137 |
|
| 138 |
This is because your theme is not checking the comment status of posts in the correct way.
|
| 139 |
|
| 140 |
-
You may like to point your theme's author to [this explanation](
|
| 141 |
|
| 142 |
= How can I remove the text that says "comments are closed" at the bottom of articles where comments are disabled? =
|
| 143 |
|
|
@@ -169,6 +169,12 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/)
|
|
| 169 |
and this project adheres to [Semantic Versioning](http://semver.org/).
|
| 170 |
This will be maiintained from August 19, 2020 - @asif2bd
|
| 171 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 172 |
= [2.0.2] - 2020-12-01 =
|
| 173 |
* Removed: Quick Setup Wizard
|
| 174 |
* Improved: Redirection settings page after activation.
|
|
@@ -327,4 +333,4 @@ This will be maiintained from August 19, 2020 - @asif2bd
|
|
| 327 |
|
| 328 |
== Upgrade Notice ==
|
| 329 |
|
| 330 |
-
|
| 5 |
Requires at least: 5.0
|
| 6 |
Tested up to: 5.6
|
| 7 |
Requires PHP: 5.6
|
| 8 |
+
Stable tag: 2.1.0
|
| 9 |
License: GPL-3.0-or-later
|
| 10 |
License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
| 11 |
|
| 137 |
|
| 138 |
This is because your theme is not checking the comment status of posts in the correct way.
|
| 139 |
|
| 140 |
+
You may like to point your theme's author to [this explanation](https://wpdeveloper.net/wordpress-posts-have-comments-allowed/) of what they are doing wrong, and how to fix it.
|
| 141 |
|
| 142 |
= How can I remove the text that says "comments are closed" at the bottom of articles where comments are disabled? =
|
| 143 |
|
| 169 |
and this project adheres to [Semantic Versioning](http://semver.org/).
|
| 170 |
This will be maiintained from August 19, 2020 - @asif2bd
|
| 171 |
|
| 172 |
+
= [2.1.0] - 2021-02-08 =
|
| 173 |
+
* New Feature: Site wise settings in Multisite Network
|
| 174 |
+
* Added: Some strings localization
|
| 175 |
+
* Fixed: Delete Comments in Multisite
|
| 176 |
+
* Few minor bug fix and improvement
|
| 177 |
+
|
| 178 |
= [2.0.2] - 2020-12-01 =
|
| 179 |
* Removed: Quick Setup Wizard
|
| 180 |
* Improved: Redirection settings page after activation.
|
| 333 |
|
| 334 |
== Upgrade Notice ==
|
| 335 |
|
| 336 |
+
Minor Update: Few minor bug fix and improvement
|
views/partials/_delete.php
CHANGED
|
@@ -22,7 +22,7 @@
|
|
| 22 |
</div>';
|
| 23 |
}
|
| 24 |
?>
|
| 25 |
-
<?php if ($this->networkactive) :
|
| 26 |
$extradeletetypes = implode(', ', (array) $this->options['extra_post_types']);
|
| 27 |
?>
|
| 28 |
<p class="indent" id="extradeletetypes">
|
|
@@ -47,6 +47,9 @@
|
|
| 47 |
</div>
|
| 48 |
<h4 class="total-comments"><?php _e('Total Comments:', 'disable-comments'); ?> <?php echo $this->get_all_comments_number(); ?></h4>
|
| 49 |
</div>
|
|
|
|
|
|
|
|
|
|
| 50 |
<!-- save -->
|
| 51 |
<button class="button button__delete"><?php _e('Delete Comments', 'disable-comments'); ?></button>
|
| 52 |
<?php
|
| 22 |
</div>';
|
| 23 |
}
|
| 24 |
?>
|
| 25 |
+
<?php if ($this->networkactive && is_network_admin()) :
|
| 26 |
$extradeletetypes = implode(', ', (array) $this->options['extra_post_types']);
|
| 27 |
?>
|
| 28 |
<p class="indent" id="extradeletetypes">
|
| 47 |
</div>
|
| 48 |
<h4 class="total-comments"><?php _e('Total Comments:', 'disable-comments'); ?> <?php echo $this->get_all_comments_number(); ?></h4>
|
| 49 |
</div>
|
| 50 |
+
<?php if(is_network_admin()):?>
|
| 51 |
+
<input type="hidden" name="is_network_admin" value="1">
|
| 52 |
+
<?php endif;?>
|
| 53 |
<!-- save -->
|
| 54 |
<button class="button button__delete"><?php _e('Delete Comments', 'disable-comments'); ?></button>
|
| 55 |
<?php
|
views/partials/_disable.php
CHANGED
|
@@ -2,6 +2,31 @@
|
|
| 2 |
<div class="disable__comment__option mb50">
|
| 3 |
<h3 class="title"><?php _e('Settings', 'disable-comments'); ?></h3>
|
| 4 |
<p class="subtitle"><?php _e('Configure the settings below to disable comments globally or on specific types of posts.', 'disable-comments'); ?></p>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 5 |
<div class="disable_option dc-text__block mb30 mt30">
|
| 6 |
<input type="radio" id="remove_everywhere" name="mode" value="<?php echo esc_attr('remove_everywhere') ?>" <?php checked($this->options['remove_everywhere']); ?> />
|
| 7 |
<label for="remove_everywhere"><?php _e('Everywhere:', 'disable-comments'); ?> <span><?php _e('Disable comments globally on your entire website', 'disable-comments'); ?></span></label>
|
|
@@ -15,16 +40,17 @@
|
|
| 15 |
$types = $this->get_all_post_types();
|
| 16 |
foreach ($types as $key => $value) {
|
| 17 |
echo '<div class="remove__checklist__item">
|
| 18 |
-
<input type="checkbox" id="remove__checklist__item-' . $key . '" name="disabled_types[]" value="' . esc_attr($key) . '" ' . checked(in_array($key, $this->
|
| 19 |
<label for="remove__checklist__item-' . $key . '">' . $value->labels->name . '</label>
|
| 20 |
</div>';
|
| 21 |
}
|
| 22 |
?>
|
| 23 |
-
<?php if ($this->networkactive) :
|
|
|
|
| 24 |
$extradisabletypes = implode(', ', (array) $this->options['extra_post_types']);
|
| 25 |
?>
|
| 26 |
-
<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'); ?>
|
| 27 |
-
<br /><label><?php _e('Custom post types:', 'disable-comments');
|
| 28 |
<?php endif; ?>
|
| 29 |
</div>
|
| 30 |
<p class="subtitle"><span class="danger"><?php _e('Note:', 'disable-comments'); ?></span> <?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. Comments will be visible on all other post types.', 'disable-comments'); ?></p>
|
|
@@ -60,4 +86,7 @@
|
|
| 60 |
</div>
|
| 61 |
<!-- save -->
|
| 62 |
<button class="button button__success"><?php _e('Save Changes', 'disable-comments'); ?></button>
|
|
|
|
|
|
|
|
|
|
| 63 |
</form>
|
| 2 |
<div class="disable__comment__option mb50">
|
| 3 |
<h3 class="title"><?php _e('Settings', 'disable-comments'); ?></h3>
|
| 4 |
<p class="subtitle"><?php _e('Configure the settings below to disable comments globally or on specific types of posts.', 'disable-comments'); ?></p>
|
| 5 |
+
|
| 6 |
+
<?php if(is_network_admin()):?>
|
| 7 |
+
<div class="disable_option dc-text__block mb30 mt30">
|
| 8 |
+
<div class="dissable__switch__item">
|
| 9 |
+
<input type="hidden" name="sitewide_settings"value="0">
|
| 10 |
+
<input type="checkbox" name="sitewide_settings" id="sitewide_settings" value="1" <?php checked($this->options['sitewide_settings']); ?> >
|
| 11 |
+
|
| 12 |
+
<label for="sitewide_settings">
|
| 13 |
+
<span class="switch">
|
| 14 |
+
<span class="switch__text on"><?php _e('On', 'disable-comments'); ?></span>
|
| 15 |
+
<span class="switch__text off"><?php _e('Off', 'disable-comments'); ?></span>
|
| 16 |
+
</span>
|
| 17 |
+
Enable site wise settings.
|
| 18 |
+
</label>
|
| 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 |
+
<?php elseif($this->options['sitewide_settings'] && !empty($this->options['is_network_options'])):?>
|
| 23 |
+
<div class="disable_option dc-text__block mb30 mt30">
|
| 24 |
+
<div>
|
| 25 |
+
<p class="disable__option__description"><span class="danger"><?php _e('Note:', 'disable-comments'); ?></span> <?php _e('This site will be controlled by the network admin until you click the "Save Changes" button.', 'disable-comments'); ?></p>
|
| 26 |
+
</div>
|
| 27 |
+
</div>
|
| 28 |
+
<?php endif;?>
|
| 29 |
+
|
| 30 |
<div class="disable_option dc-text__block mb30 mt30">
|
| 31 |
<input type="radio" id="remove_everywhere" name="mode" value="<?php echo esc_attr('remove_everywhere') ?>" <?php checked($this->options['remove_everywhere']); ?> />
|
| 32 |
<label for="remove_everywhere"><?php _e('Everywhere:', 'disable-comments'); ?> <span><?php _e('Disable comments globally on your entire website', 'disable-comments'); ?></span></label>
|
| 40 |
$types = $this->get_all_post_types();
|
| 41 |
foreach ($types as $key => $value) {
|
| 42 |
echo '<div class="remove__checklist__item">
|
| 43 |
+
<input type="checkbox" id="remove__checklist__item-' . $key . '" name="disabled_types[]" value="' . esc_attr($key) . '" ' . checked(in_array($key, $this->get_disabled_post_types()), true, false) . '>
|
| 44 |
<label for="remove__checklist__item-' . $key . '">' . $value->labels->name . '</label>
|
| 45 |
</div>';
|
| 46 |
}
|
| 47 |
?>
|
| 48 |
+
<?php if ($this->networkactive && is_network_admin()) :
|
| 49 |
+
$this->options['extra_post_types'] = empty($this->options['extra_post_types']) ? [] : $this->options['extra_post_types'];
|
| 50 |
$extradisabletypes = implode(', ', (array) $this->options['extra_post_types']);
|
| 51 |
?>
|
| 52 |
+
<p class="indent subtitle" 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'); ?>
|
| 53 |
+
<br /><label><strong><?php _e('Custom post types:', 'disable-comments'); ?></strong> <input type="text" name="extra_post_types" size="30" value="<?php echo esc_attr($extradisabletypes); ?>" /></label></p>
|
| 54 |
<?php endif; ?>
|
| 55 |
</div>
|
| 56 |
<p class="subtitle"><span class="danger"><?php _e('Note:', 'disable-comments'); ?></span> <?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. Comments will be visible on all other post types.', 'disable-comments'); ?></p>
|
| 86 |
</div>
|
| 87 |
<!-- save -->
|
| 88 |
<button class="button button__success"><?php _e('Save Changes', 'disable-comments'); ?></button>
|
| 89 |
+
<?php if(is_network_admin()):?>
|
| 90 |
+
<input type="hidden" name="is_network_admin" value="1">
|
| 91 |
+
<?php endif;?>
|
| 92 |
</form>
|
views/settings.php
CHANGED
|
@@ -6,10 +6,10 @@
|
|
| 6 |
<p class="plugin__version"><?php echo _e('Version', 'disable-comments') . ' ' . DC_VERSION; ?></p>
|
| 7 |
<ul class="disable__comment__nav">
|
| 8 |
<li id="disableCommentsNav" class="disable__comment__nav__item">
|
| 9 |
-
<a href="#disableComments" class="disable__comment__nav__link active"><?php
|
| 10 |
</li>
|
| 11 |
<li id="deleteCommentsNav" class="disable__comment__nav__item">
|
| 12 |
-
<a href="#deleteComments" class="disable__comment__nav__link"><?php
|
| 13 |
</li>
|
| 14 |
</ul>
|
| 15 |
</div>
|
| 6 |
<p class="plugin__version"><?php echo _e('Version', 'disable-comments') . ' ' . DC_VERSION; ?></p>
|
| 7 |
<ul class="disable__comment__nav">
|
| 8 |
<li id="disableCommentsNav" class="disable__comment__nav__item">
|
| 9 |
+
<a href="#disableComments" class="disable__comment__nav__link active"><?php _ex('Disable Comments', 'Tab Name','disable-comments'); ?></a>
|
| 10 |
</li>
|
| 11 |
<li id="deleteCommentsNav" class="disable__comment__nav__item">
|
| 12 |
+
<a href="#deleteComments" class="disable__comment__nav__link"><?php _ex('Delete Comments', 'Tab Name', 'disable-comments'); ?></a>
|
| 13 |
</li>
|
| 14 |
</ul>
|
| 15 |
</div>
|
