PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.2.4
CloudSecure WP Security v1.2.4
1.4.10 1.4.9 trunk 0.9.0 1.0.2 1.1.0 1.1.1 1.1.2 1.1.3 1.2.0 1.2.1 1.2.2 1.2.3 1.2.4 1.2.5 1.2.6 1.2.7 1.3.1 1.3.10 1.3.11 1.3.12 1.3.13 1.3.14 1.3.15 1.3.16 1.3.17 1.3.18 1.3.19 1.3.2 1.3.20 1.3.21 1.3.22 1.3.23 1.3.24 1.3.3 1.3.4 1.3.5 1.3.6 1.3.7 1.3.8 1.3.9 1.4.0 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.4.8
cloudsecure-wp-security / modules / admin / disable-xmlrpc.php
cloudsecure-wp-security / modules / admin Last commit date
captcha.php 2 years ago common.php 2 years ago dashboard.php 2 years ago disable-author-query.php 2 years ago disable-login.php 2 years ago disable-restapi.php 2 years ago disable-xmlrpc.php 2 years ago login-log-table.php 2 years ago login-log.php 2 years ago login-notification.php 2 years ago rename-login-page.php 2 years ago restrict-admin-page.php 2 years ago server-error-notification.php 2 years ago server-error-table.php 2 years ago two-factor-authentication-registration.php 2 years ago two-factor-authentication.php 2 years ago unify-messages.php 2 years ago update-notice.php 2 years ago
disable-xmlrpc.php
135 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class CloudSecureWP_Admin_Disable_XMLRPC extends CloudSecureWP_Admin_Common {
8 private $disable_xmlrpc;
9 private $constant_settings;
10
11 function __construct( array $info, CloudSecureWP_Disable_XMLRPC $disable_xmlrpc ) {
12 parent::__construct( $info );
13 $this->disable_xmlrpc = $disable_xmlrpc;
14 $this->constant_settings = $this->disable_xmlrpc->get_constant_settings();
15 $this->prepare_view_data();
16 $this->render();
17 }
18
19 /**
20 * 画面表示用のデータを準備
21 */
22 public function prepare_view_data(): void {
23 $this->datas = $this->disable_xmlrpc->get_settings();
24
25 if ( ! empty( $_POST ) && check_admin_referer( $this->disable_xmlrpc->get_feature_key() . '_csrf' ) ) {
26
27 foreach ( $this->datas as $key => $val ) {
28
29 switch ( $key ) {
30 case 'disable_xmlrpc':
31 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
32 if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) {
33 $this->errors[] = '有効・無効の値が不正です';
34 }
35
36 if ( ! $this->check_environment() ) {
37 $tmp = 'f';
38 }
39
40 $this->datas[ $key ] = $tmp;
41 break;
42
43 case 'disable_xmlrpc_type':
44 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
45 if ( ! $this->is_selected( $tmp, $this->constant_settings['disable_xmlrpc_type'] ) ) {
46 $this->errors[] = '無効化種別の値が不正です';
47 }
48 $this->datas[ $key ] = $tmp;
49 break;
50 }
51 }
52
53 if ( empty( $this->errors ) ) {
54
55 $this->disable_xmlrpc->save_settings( $this->datas );
56
57 if ( 't' === $this->datas['disable_xmlrpc'] ) {
58 if ( $this->datas['disable_xmlrpc_type'] === $this->constant_settings['disable_xmlrpc_type'][0] ) {
59 if ( $this->disable_xmlrpc->remove_htaccess() ) {
60 $this->messages[] = 'ピンバック無効化機能が有効になりました。';
61 } else {
62 $this->errors[] = self::MESSAGES['error_htaccess_update'];
63 $this->errors[] = 'XML-RPC無効化機能が無効になりました。';
64
65 $this->datas['disable_xmlrpc'] = 'f';
66 $this->disable_xmlrpc->save_settings( $this->datas );
67 }
68 } elseif ( $this->datas['disable_xmlrpc_type'] === $this->constant_settings['disable_xmlrpc_type'][1] ) {
69
70 if ( $this->disable_xmlrpc->update_htaccess() ) {
71 $this->messages[] = 'XML-RPC無効化機能が有効になりました。';
72 } else {
73 $this->errors[] = self::MESSAGES['error_htaccess_update'];
74 $this->errors[] = 'XML-RPC無効化機能が無効になりました。';
75
76 $this->datas['disable_xmlrpc'] = 'f';
77 $this->disable_xmlrpc->save_settings( $this->datas );
78 }
79 }
80 } elseif ( $this->disable_xmlrpc->remove_htaccess() ) {
81 $this->messages[] = 'XML-RPC無効化機能が無効になりました。';
82 } else {
83 $this->errors[] = self::MESSAGES['error_htaccess_update'];
84 }
85 }
86 }
87
88 $this->datas = $this->get_checked( $this->datas, array( 'disable_xmlrpc', 'disable_xmlrpc_type' ) );
89 }
90
91 /**
92 * デスクリプション
93 */
94 protected function admin_description(): void {
95 ?>
96 <div class="title-block mb-12">
97 <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank" href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/disable_xmlrpc.php">こちら</a></p>
98 <h1 class="title-block-title">XML-RPC無効化</h1>
99 </div>
100 <div class="title-bottom-text">
101 XML-RPC機能、またはピンバック機能を無効にし、XML-RPC経由での不正ログインを防ぎます。
102 </div>
103 <?php
104 }
105
106 /**
107 * ページコンテンツ
108 */
109 protected function page(): void {
110 ?>
111 <form method="post">
112 <div class="enabled-or-disabled">
113 <input class="enabled-or-disabled__btn" id="enabled" type="radio" name="disable_xmlrpc" value="t" <?php echo esc_html( $this->datas['disable_xmlrpc_t'] ?? '' ); ?> /><label for="enabled">有効</label>
114 <input class="enabled-or-disabled__btn" id="disabled" type="radio" name="disable_xmlrpc" value="f" <?php echo esc_html( $this->datas['disable_xmlrpc_f'] ?? '' ); ?> /><label for="disabled">無効</label>
115 </div>
116 <div class="box">
117 <div class="box-bottom">
118 <div class="box-row flex-start">
119 <div class="box-row-title not-label">無効化種別</div>
120 <div class="box-row-content radio-btns">
121 <input type="radio" class="circle-radio" id="pin-pack" name="disable_xmlrpc_type" value="<?php echo esc_attr( $this->constant_settings['disable_xmlrpc_type'][0] ); ?>" <?php echo esc_html( $this->datas[ 'disable_xmlrpc_type_' . $this->constant_settings['disable_xmlrpc_type'][0] ] ?? '' ); ?> /><label for="pin-pack">ピンバック無効</label><br />
122 <input type="radio" class="circle-radio" id="xmlrpc" name="disable_xmlrpc_type" value="<?php echo esc_attr( $this->constant_settings['disable_xmlrpc_type'][1] ); ?>" <?php echo esc_html( $this->datas[ 'disable_xmlrpc_type_' . $this->constant_settings['disable_xmlrpc_type'][1] ] ?? '' ); ?> /><label for="xmlrpc">XML-RPC無効</label>
123 </div>
124 </div>
125 </div>
126 </div>
127 <div id="submit-btn-area">
128 <?php $this->nonce_wp( $this->disable_xmlrpc->get_feature_key() ); ?>
129 <?php $this->submit_button_wp(); ?>
130 </div>
131 </form>
132 <?php
133 }
134 }
135