disable-comments-rb
Last commit date
assets
4 years ago
languages
4 years ago
class_rb_disable-comments.php
4 years ago
disable-comments-rb.php
4 years ago
information.php
4 years ago
options.php
4 years ago
readme.txt
4 years ago
screenshot-1.png
4 years ago
screenshot-2.png
4 years ago
options.php
66 lines
| 1 | <?php |
| 2 | /* |
| 3 | * RB Disable Comments |
| 4 | * Version: 1.0.9 - 38451 |
| 5 | * Author: RBS |
| 6 | * Date: 03 02 2020 12:11:29 GMT |
| 7 | */ |
| 8 | |
| 9 | if( !defined('WPINC') || !defined("ABSPATH") ){ |
| 10 | die(); |
| 11 | } |
| 12 | |
| 13 | $types = get_post_types( array( 'public' => true ), 'objects' ); |
| 14 | foreach( array_keys( $types ) as $type ) { |
| 15 | if( ! in_array( $type, $this->modified_types ) && ! post_type_supports( $type, 'comments' ) ) |
| 16 | unset( $types[$type] ); |
| 17 | } |
| 18 | |
| 19 | if ( isset( $_POST['submit'] ) ) { |
| 20 | check_admin_referer( 'disable-comments-rb-options' ); |
| 21 | $this->options['remove_everywhere'] = ( $_POST['mode'] == 'remove_everywhere' ); |
| 22 | |
| 23 | if( $this->options['remove_everywhere'] ) |
| 24 | $disabled_post_types = array_keys( $types ); |
| 25 | else |
| 26 | $disabled_post_types = array() ; |
| 27 | |
| 28 | $disabled_post_types = array_intersect( $disabled_post_types, array_keys( $types ) ); |
| 29 | |
| 30 | $this->options['disabled_post_types'] = $disabled_post_types; |
| 31 | |
| 32 | $this->save_options(); |
| 33 | } |
| 34 | ?> |
| 35 | <style> .indent {padding-left: 2em} </style> |
| 36 | <div class="wrap"> |
| 37 | <h1><?php _e( 'Disable Comments RB', 'disable-comments-rb'); ?></h1> |
| 38 | <p> |
| 39 | <?php _e('Here you can configure your disabled comments tools. Section with all configuration settings of this tool.', 'disable-comments-rb') ;?> |
| 40 | </p> |
| 41 | <form action="" method="post" id="disable-comments"> |
| 42 | <ul> |
| 43 | <li> |
| 44 | <label for="remove_everywhere"> |
| 45 | <input type="radio" id="remove_everywhere" name="mode" value="remove_everywhere" <?php checked( isset($this->options['remove_everywhere']) && $this->options['remove_everywhere'] );?> /> |
| 46 | <strong> |
| 47 | <?php _e( 'Disable all comments', 'disable-comments-rb'); ?> |
| 48 | </strong> |
| 49 | </label> |
| 50 | </li> |
| 51 | <li> |
| 52 | <label for="rb_disable_comments_off"> |
| 53 | <input type="radio" id="rb_disable_comments_off" name="mode" value="rb_disable_comments_off" <?php checked( !isset($this->options['remove_everywhere']) || !$this->options['remove_everywhere'] );?> /> |
| 54 | <strong> |
| 55 | <?php _e( 'Enable all Comments (comments on entire site will be turned on)', 'disable-comments-rb'); ?> |
| 56 | </strong> |
| 57 | </label> |
| 58 | </li> |
| 59 | </ul> |
| 60 | <?php wp_nonce_field( 'disable-comments-rb-options' ); ?> |
| 61 | <p class="submit"> |
| 62 | <input class="button-primary" type="submit" name="submit" value="<?php _e( 'Save Changes', 'disable-comments-rb') ?>"> |
| 63 | </p> |
| 64 | </form> |
| 65 | </div> |
| 66 |