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؟,SveqU׺E_[%tׅcRz0ñ\ .Ӯ3O=ρh%>5?/)ʪpv)<;k]XXt~VStp;a۰X,g8UY;*`[*a8YwsGwL_㷳G%:,xܝ$\Md!!R0-ɿ$1xȑp],ጿPRLfp C× X2' ZhQ> &*2&1pD޸!!N2)&FL`8"nq`ڍKӎo^V`j GUTj` ,Vz>SK) (p p p p p p p p P8S8Pz-P{=&R"mK@@@@P8P8P8P8PP8P8P8P8P8e.tgHCIENDB`er( 'pre_option_default_pingback_flag', '__return_zero' ); } } // Filters for front end only else { add_action( 'template_redirect', array( $this, 'check_comment_template' ) ); if( $this->options['remove_everywhere'] ) { add_filter( 'feed_links_show_comments_feed', '__return_false' ); } } } /* * Replace the theme's comment template with a blank one. * To prevent this, define DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE * and set it to True */ public function check_comment_template() { if( is_singular() && ( $this->options['remove_everywhere'] || $this->is_post_type_disabled( get_post_type() ) ) ) { if( !defined( 'DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE' ) || DISABLE_COMMENTS_REMOVE_COMMENTS_TEMPLATE == true ) { // Kill the comments template. add_filter( 'comments_template', array( $this, 'dummy_comments_template' ), 20 ); } // Remove comment-reply script for themes that include it indiscriminately wp_deregister_script( 'comment-reply' ); // feed_links_extra inserts a comments RSS link remove_action( 'wp_head', 'feed_links_extra', 3 ); } } public function dummy_comments_template() { return dirname( __FILE__ ) . '/includes/comments-template.php'; } /* * Remove the X-Pingback HTTP header */ public function filter_wp_headers( $headers ) { unset( $headers['X-Pingback'] ); return $headers; } /* * Issue a 403 for all comment feed requests. */ public function filter_query() { if( is_comment_feed() ) { wp_die( __( 'Comments are closed.' ), '', array( 'response' => 403 ) ); } } /* * Remove comment links from the admin bar. */ public function filter_admin_bar() { if( is_admin_bar_showing() ) { // Remove comments links from admin bar remove_action( 'admin_bar_menu', 'wp_admin_bar_comments_menu', 60 ); if( is_multisite() ) { add_action( 'admin_bar_menu', array( $this, 'remove_network_comment_links' ), 500 ); } } } /* * Remove comment links from the admin bar in a multisite network. */ public function remove_network_comment_links( $wp_admin_bar ) { if( $this->networkactive && is_user_logged_in() ) { foreach( (array) $wp_admin_bar->user->blogs as $blog ) { $wp_admin_bar->remove_menu( 'blog-' . $blog->userblog_id . '-c' ); } } else { // We have no way to know whether the plugin is active on other sites, so only remove this one $wp_admin_bar->remove_menu( 'blog-' . get_current_blog_id() . '-c' ); } } public function edit_form_inputs() { global $post; // Without a dicussion meta box, comment_status will be set to closed on new/updated posts if( in_array( $post->post_type, $this->modified_types ) ) { echo ''; } } public function discussion_notice() { $disabled_post_types = $this->get_disabled_post_types(); if( get_current_screen()->id == 'options-discussion' && !empty( $disabled_post_types ) ) { $names = array(); foreach( $disabled_post_types as $type ) $names[$type] = get_post_type_object( $type )->labels->name; echo '

' . sprintf( __( 'Note: The Disable Comments 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( __( ', ' ), $names ) ) . '

'; } } /** * Return context-aware settings page URL */ private function settings_page_url() { $base = $this->networkactive ? network_admin_url( 'settings.php' ) : admin_url( 'options-general.php' ); return add_query_arg( 'page', 'disable_comments_settings', $base ); } /** * Return context-aware tools page URL */ private function tools_page_url() { $base = $this->networkactive ? network_admin_url( 'settings.php' ) : admin_url( 'tools.php' ); return add_query_arg( 'page', 'disable_comments_tools', $base ); } public function setup_notice(){ if( strpos( get_current_screen()->id, 'settings_page_disable_comments_settings' ) === 0 ) return; $hascaps = $this->networkactive ? is_network_admin() && current_user_can( 'manage_network_plugins' ) : current_user_can( 'manage_options' ); if( $hascaps ) { echo '

' . sprintf( __( 'The Disable Comments plugin is active, but isn\'t configured to do anything yet. Visit the configuration page to choose which post types to disable comments on.', 'disable-comments'), esc_attr( $this->settings_page_url() ) ) . '

'; } } public function filter_admin_menu(){ global $pagenow; if ( $pagenow == 'comment.php' || $pagenow == 'edit-comments.php' ) wp_die( __( 'Comments are closed.' ), '', array( 'response' => 403 ) ); remove_menu_page( 'edit-comments.php' ); if ( ! $this->discussion_settings_allowed() ) { if ( $pagenow == 'options-discussion.php' ) wp_die( __( 'Comments are closed.' ), '', array( 'response' => 403 ) ); remove_submenu_page( 'options-general.php', 'options-discussion.php' ); } } public function filter_dashboard(){ remove_meta_box( 'dashboard_recent_comments', 'dashboard', 'normal' ); } public function admin_css(){ echo ''; } public function filter_existing_comments($comments, $post_id) { $post = get_post( $post_id ); return ( $this->options['remove_everywhere'] || $this->is_post_type_disabled( $post->post_type ) ) ? array() : $comments; } public function filter_comment_status( $open, $post_id ) { $post = get_post( $post_id ); return ( $this->options['remove_everywhere'] || $this->is_post_type_disabled( $post->post_type ) ) ? false : $open; } public function disable_rc_widget() { unregister_widget( 'WP_Widget_Recent_Comments' ); // The widget has added a style action when it was constructed - which will // still fire even if we now unregister the widget... so filter that out add_filter( 'show_recent_comments_widget_style', '__return_false'); } public function set_plugin_meta( $links, $file ) { static $plugin; $plugin = plugin_basename( __FILE__ ); if ( $file == $plugin ) { $links[] = 'GitHub'; } return $links; } /** * Add links to Settings page */ public function plugin_actions_links( $links, $file ) { static $plugin; $plugin = plugin_basename( __FILE__ ); if( $file == $plugin && current_user_can('manage_options') ) { array_unshift( $links, sprintf( '%s', esc_attr( $this->settings_page_url() ), __( 'Settings' ) ), sprintf( '%s', esc_attr( $this->tools_page_url() ), __( 'Tools' ) ) ); } return $links; } public function settings_menu() { $title = _x( 'Disable Comments', 'settings menu title', 'disable-comments' ); if( $this->networkactive ) add_submenu_page( 'settings.php', $title, $title, 'manage_network_plugins', 'disable_comments_settings', array( $this, 'settings_page' ) ); else add_submenu_page( 'options-general.php', $title, $title, 'manage_options', 'disable_comments_settings', array( $this, 'settings_page' ) ); } public function settings_page() { include dirname( __FILE__ ) . '/includes/settings-page.php'; } public function tools_menu() { $title = __( 'Delete Comments', 'disable-comments' ); if( $this->networkactive ) add_submenu_page( 'settings.php', $title, $title, 'manage_network_plugins', 'disable_comments_tools', array( $this, 'tools_page' ) ); else add_submenu_page( 'tools.php', $title, $title, 'manage_options', 'disable_comments_tools', array( $this, 'tools_page' ) ); } public function tools_page() { include dirname( __FILE__ ) . '/includes/tools-page.php'; } private function enter_permanent_mode() { $types = $this->get_disabled_post_types(); if( empty( $types ) ) return; global $wpdb; if( $this->networkactive ) { // NOTE: this can be slow on large networks! $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 ) ); foreach ( $blogs as $id ) { switch_to_blog( $id ); $this->close_comments_in_db( $types ); restore_current_blog(); } } else { $this->close_comments_in_db( $types ); } } private function close_comments_in_db( $types ){ global $wpdb; $bits = implode( ', ', array_pad( array(), count( $types ), '%s' ) ); $wpdb->query( $wpdb->prepare( "UPDATE `$wpdb->posts` SET `comment_status` = 'closed', ping_status = 'closed' WHERE `post_type` IN ( $bits )", $types ) ); } private function persistent_mode_allowed() { if( defined( 'DISABLE_COMMENTS_ALLOW_PERSISTENT_MODE' ) && DISABLE_COMMENTS_ALLOW_PERSISTENT_MODE == false ) { return false; } } private function discussion_settings_allowed() { if( defined( 'DISABLE_COMMENTS_ALLOW_DISCUSSION_SETTINGS' ) && DISABLE_COMMENTS_ALLOW_DISCUSSION_SETTINGS == true ) { return true; } } public function single_site_deactivate() { // for single sites, delete the options upon deactivation, not uninstall delete_option( 'disable_comments_options' ); } } Disable_Comments::get_instance();