PluginProbe ʕ •ᴥ•ʔ
Disable Comments / 1.0.0
Disable Comments v1.0.0
1.0.26 1.0.27 1.0.3 1.0.4 1.0.5 1.0.6 1.0.7 1.0.8 1.0.9 trunk 1.0.0 1.0.1 1.0.10 1.0.11 1.0.12 1.0.13 1.0.14 1.0.15 1.0.16 1.0.17 1.0.18 1.0.19 1.0.2 1.0.20 1.0.21 1.0.22 1.0.23 1.0.24 1.0.25
disable-comments-rb / options.php
disable-comments-rb Last commit date
languages 9 years ago class_rb_disable-comments.php 9 years ago disable-comments-rb.php 9 years ago options.php 9 years ago readme.txt 9 years ago
options.php
65 lines
1 <?php
2 /*
3 * RB Disable Comments
4 * Version: 1.0.0 - 88347
5 * Author: RBS
6 * Date: Thu, 01 Jun 2017 11:42:22 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-admin' );
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
29 $disabled_post_types = array_intersect( $disabled_post_types, array_keys( $types ) );
30
31
32 $this->options['disabled_post_types'] = $disabled_post_types;
33
34 $this->save_options();
35 }
36 ?>
37 <style> .indent {padding-left: 2em} </style>
38 <div class="wrap">
39 <h1><?php _e( 'Robo Disable Comments') ?></h1>
40 <form action="" method="post" id="disable-comments">
41 <ul>
42 <li>
43 <label for="remove_everywhere">
44 <input type="radio" id="remove_everywhere" name="mode" value="remove_everywhere" <?php checked( $this->options['remove_everywhere'] );?> />
45 <strong>
46 <?php _e( 'Disable all comments'); ?>
47 </strong>
48 </label>
49 </li>
50 <li>
51 <label for="rb_disable_comments_off">
52 <input type="radio" id="rb_disable_comments_off" name="mode" value="rb_disable_comments_off" <?php checked( !$this->options['remove_everywhere'] );?> />
53 <strong>
54 <?php _e( 'Enable'); ?>
55 </strong>
56 </label>
57 </li>
58 </ul>
59 <?php wp_nonce_field( 'disable-comments-admin' ); ?>
60 <p class="submit">
61 <input class="button-primary" type="submit" name="submit" value="<?php _e( 'Save Changes') ?>">
62 </p>
63 </form>
64 </div>
65