PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.1.1
CloudSecure WP Security v1.1.1
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
130 lines
1 <?php
2 class CloudSecureWP_Admin_Disable_XMLRPC extends CloudSecureWP_Admin_Common {
3 private $disable_xmlrpc;
4 private $constant_settings;
5
6 function __construct( array $info, CloudSecureWP_Disable_XMLRPC $disable_xmlrpc ) {
7 parent::__construct( $info );
8 $this->disable_xmlrpc = $disable_xmlrpc;
9 $this->constant_settings = $this->disable_xmlrpc->get_constant_settings();
10 $this->prepare_view_data();
11 $this->render();
12 }
13
14 /**
15 * 画面表示用のデータを準備
16 */
17 public function prepare_view_data(): void {
18 $this->datas = $this->disable_xmlrpc->get_settings();
19
20 if ( ! empty( $_POST ) && check_admin_referer( $this->disable_xmlrpc->get_feature_key() . '_csrf' ) ) {
21
22 foreach ( $this->datas as $key => $val ) {
23
24 switch ( $key ) {
25 case 'disable_xmlrpc':
26 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
27 if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) {
28 $this->errors[] = '有効・無効の値が不正です';
29 }
30
31 if ( ! $this->check_environment() ) {
32 $tmp = 'f';
33 }
34
35 $this->datas[ $key ] = $tmp;
36 break;
37
38 case 'disable_xmlrpc_type':
39 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
40 if ( ! $this->is_selected( $tmp, $this->constant_settings['disable_xmlrpc_type'] ) ) {
41 $this->errors[] = '無効化種別の値が不正です';
42 }
43 $this->datas[ $key ] = $tmp;
44 break;
45 }
46 }
47
48 if ( empty( $this->errors ) ) {
49
50 $this->disable_xmlrpc->save_settings( $this->datas );
51
52 if ( 't' === $this->datas['disable_xmlrpc'] ) {
53 if ( $this->datas['disable_xmlrpc_type'] === $this->constant_settings['disable_xmlrpc_type'][0] ) {
54 if ( $this->disable_xmlrpc->remove_htaccess() ) {
55 $this->messages[] = 'ピンバックの無効化が有効になりました。';
56 } else {
57 $this->errors[] = self::MESSAGES['error_htaccess_update'];
58 $this->errors[] = 'XML-RPC無効化機能が無効になりました。';
59
60 $this->datas['disable_xmlrpc'] = 'f';
61 $this->disable_xmlrpc->save_settings( $this->datas );
62 }
63 } elseif ( $this->datas['disable_xmlrpc_type'] === $this->constant_settings['disable_xmlrpc_type'][1] ) {
64
65 if ( $this->disable_xmlrpc->update_htaccess() ) {
66 $this->messages[] = 'XML-RPC無効化機能が有効になりました。';
67 } else {
68 $this->errors[] = self::MESSAGES['error_htaccess_update'];
69 $this->errors[] = 'XML-RPC無効化機能が無効になりました。';
70
71 $this->datas['disable_xmlrpc'] = 'f';
72 $this->disable_xmlrpc->save_settings( $this->datas );
73 }
74 }
75 } elseif ( $this->disable_xmlrpc->remove_htaccess() ) {
76 $this->messages[] = 'XML-RPC無効化機能が無効になりました。';
77 } else {
78 $this->errors[] = self::MESSAGES['error_htaccess_update'];
79 }
80 }
81 }
82
83 $this->datas = $this->get_checked( $this->datas, array( 'disable_xmlrpc', 'disable_xmlrpc_type' ) );
84 }
85
86 /**
87 * デスクリプション
88 */
89 protected function admin_description(): void {
90 ?>
91 <div class="title-block mb-12">
92 <h1 class="title-block-title">XML-RPC無効化</h1>
93 <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>
94 </div>
95 <div class="title-bottom-text">
96 XML-RPC機能、またはピンバック機能を無効にし、XML-RPC経由での不正ログインを防ぎます。
97 </div>
98 <?php
99 }
100
101 /**
102 * ページコンテンツ
103 */
104 protected function page(): void {
105 ?>
106 <form method="post">
107 <div class="enabled-or-disabled">
108 <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>
109 <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>
110 </div>
111 <div class="box">
112 <div class="box-bottom">
113 <div class="box-row flex-start">
114 <div class="box-row-title not-label">無効化種別</div>
115 <div class="box-row-content radio-btns">
116 <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 />
117 <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>
118 </div>
119 </div>
120 </div>
121 </div>
122 <div id="submit-btn-area">
123 <?php $this->nonce_wp( $this->disable_xmlrpc->get_feature_key() ); ?>
124 <?php $this->submit_button_wp(); ?>
125 </div>
126 </form>
127 <?php
128 }
129 }
130