PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.2.3
CloudSecure WP Security v1.2.3
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 / update-notice.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
update-notice.php
162 lines
1 <?php
2
3 class CloudSecureWP_Admin_Update_Notice extends CloudSecureWP_Admin_Common {
4 private $update_notice;
5 private $constant_settings;
6
7 function __construct( array $info, CloudSecureWP_Update_Notice $update_notice ) {
8 parent::__construct( $info );
9 $this->update_notice = $update_notice;
10 $this->constant_settings = $this->update_notice->get_constant_settings();
11 $this->prepare_view_data();
12 $this->render();
13 }
14
15 /**
16 * 画面表示用のデータを準備
17 */
18 public function prepare_view_data(): void {
19 $this->datas = $this->update_notice->get_settings();
20 $flag_cron_error = false;
21
22 if ( ! empty( $_POST ) && check_admin_referer( $this->update_notice->get_feature_key() . '_csrf' ) ) {
23
24 foreach ( $this->datas as $key => $val ) {
25
26 switch ( $key ) {
27 case 'update_notice':
28 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
29 if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) {
30 $this->errors[] = '有効・無効の値が不正です';
31 }
32
33 if ( ! $this->check_environment() ) {
34 $tmp = 'f';
35 }
36
37 if ( 't' === $tmp ) {
38 $cron_error = $this->update_notice->check_cron_error();
39
40 if ( '' !== $cron_error ) {
41 $this->errors[] = $cron_error;
42 $tmp = 'f';
43 $flag_cron_error = true;
44 }
45 }
46
47 $this->datas[ $key ] = $tmp;
48 break;
49
50 case 'update_notice_wp':
51 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
52 if ( ! $this->is_selected( $tmp, $this->constant_settings['update_notice_wp'] ) ) {
53 $this->errors[] = 'WordPressアップデートの値が不正です';
54 }
55 $this->datas[ $key ] = $tmp;
56 break;
57
58 case 'update_notice_plugin':
59 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
60 if ( ! $this->is_selected( $tmp, $this->constant_settings['update_notice_plugin'] ) ) {
61 $this->errors[] = 'プラグインアップデートの値が不正です';
62 }
63 $this->datas[ $key ] = $tmp;
64 break;
65
66 case 'update_notice_theme':
67 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
68 if ( ! $this->is_selected( $tmp, $this->constant_settings['update_notice_theme'] ) ) {
69 $this->errors[] = 'テーマアップデートの値が不正です';
70 }
71 $this->datas[ $key ] = $tmp;
72 break;
73 }
74 }
75
76 if ( empty( $this->errors ) ) {
77 if ( 't' === $this->datas['update_notice'] ) {
78 $this->messages[] = 'アップデート通知機能が有効になりました。';
79 $this->update_notice->set_cron();
80 } else {
81 $this->messages[] = 'アップデート通知機能が無効になりました。';
82 $this->update_notice->remove_cron();
83 $this->datas['update_notice_last_notice'] = $this->update_notice->get_last_notice_default();
84 }
85
86 $this->update_notice->save_settings( $this->datas );
87
88 } elseif ( $flag_cron_error === true ) {
89 $this->update_notice->remove_cron();
90 $this->update_notice->save_settings( $this->datas );
91 }
92 }
93
94 $this->datas = $this->get_checked( $this->datas, array( 'update_notice', 'update_notice_wp', 'update_notice_plugin', 'update_notice_theme' ) );
95 }
96
97 /**
98 * デスクリプション
99 */
100 protected function admin_description(): void {
101 ?>
102 <div class="title-block mb-12">
103 <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank" href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/update_notification.php">こちら</a></p>
104 <h1 class="title-block-title">アップデート通知</h1>
105 </div>
106 <div class="title-bottom-text">
107 WordPress、プラグイン、テーマの更新が�
108 要になったとき、管理�
109 にメールで通知します。<br />
110 更新の確認は24時間ごとに行われます。<br />
111 <strong>※「/cron.php」へのhttpアクセスが発生するため、アクセスできない環境では機能を有効化できません。<br />
112  Basic認証(ベーシック認証 / 基本認証)を設定している場合など、ご注意ください。</strong>
113 </div>
114 <?php
115 }
116
117 /**
118 * ページコンテンツ
119 */
120 protected function page(): void {
121 ?>
122 <form method="post">
123 <div class="enabled-or-disabled">
124 <input class="enabled-or-disabled__btn" id="enabled" type="radio" name="update_notice" value="t" <?php echo esc_html( $this->datas['update_notice_t'] ?? '' ); ?> /><label for="enabled">有効</label>
125 <input class="enabled-or-disabled__btn" id="disabled" type="radio" name="update_notice" value="f" <?php echo esc_html( $this->datas['update_notice_f'] ?? '' ); ?> /><label for="disabled">無効</label>
126 </div>
127 <div class="box">
128 <div class="box-bottom">
129 <div class="box-row flex-start">
130 <div class="box-row-title not-label">WordPressアップデート</div>
131 <div class="box-row-content radio-btns">
132 <input type="radio" class="circle-radio" id="update_notice_wp-off" name="update_notice_wp" value="<?php echo esc_attr( $this->constant_settings['update_notice_wp'][0] ); ?>" <?php echo esc_html( $this->datas[ 'update_notice_wp_' . $this->constant_settings['update_notice_wp'][0] ] ?? '' ); ?> /><label for="update_notice_wp-off"><?php echo esc_html( $this->constant_settings['update_notice_wp'][0] ); ?> 通知しない</label><br />
133 <input type="radio" class="circle-radio" id="update_notice_wp-on" name="update_notice_wp" value="<?php echo esc_attr( $this->constant_settings['update_notice_wp'][1] ); ?>" <?php echo esc_html( $this->datas[ 'update_notice_wp_' . $this->constant_settings['update_notice_wp'][1] ] ?? '' ); ?> /><label for="update_notice_wp-on"><?php echo esc_html( $this->constant_settings['update_notice_wp'][1] ); ?> 通知する</label><br />
134 </div>
135 </div>
136 <div class="box-row flex-start">
137 <div class="box-row-title not-label">プラグインアップデート</div>
138 <div class="box-row-content radio-btns">
139 <input type="radio" id="update_notice_plugin-off" class="circle-radio" name="update_notice_plugin" value="<?php echo esc_attr( $this->constant_settings['update_notice_plugin'][0] ); ?>" <?php echo esc_html( $this->datas[ 'update_notice_plugin_' . $this->constant_settings['update_notice_plugin'][0] ] ?? '' ); ?> /><label for="update_notice_plugin-off"><?php echo esc_html( $this->constant_settings['update_notice_plugin'][0] ); ?> 通知しない</label><br />
140 <input type="radio" id="update_notice_plugin-all-on" class="circle-radio" name="update_notice_plugin" value="<?php echo esc_attr( $this->constant_settings['update_notice_plugin'][1] ); ?>" <?php echo esc_html( $this->datas[ 'update_notice_plugin_' . $this->constant_settings['update_notice_plugin'][1] ] ?? '' ); ?> /><label for="update_notice_plugin-all-on"><?php echo esc_html( $this->constant_settings['update_notice_plugin'][1] ); ?> すべて通知する</label><br />
141 <input type="radio" id="update_notice_plugin-exclusive-on" class="circle-radio" name="update_notice_plugin" value="<?php echo esc_attr( $this->constant_settings['update_notice_plugin'][2] ); ?>" <?php echo esc_html( $this->datas[ 'update_notice_plugin_' . $this->constant_settings['update_notice_plugin'][2] ] ?? '' ); ?> /><label for="update_notice_plugin-exclusive-on"><?php echo esc_html( $this->constant_settings['update_notice_plugin'][2] ); ?> 有効化されたプラグインのみ通知する</label>
142 </div>
143 </div>
144 <div class="box-row flex-start">
145 <div class="box-row-title not-label">テーマアップデート</div>
146 <div class="box-row-content radio-btns">
147 <input type="radio" id="update_notice_theme-off" class="circle-radio" name="update_notice_theme" value="<?php echo esc_attr( $this->constant_settings['update_notice_theme'][0] ); ?>" <?php echo esc_html( $this->datas[ 'update_notice_theme_' . $this->constant_settings['update_notice_theme'][0] ] ?? '' ); ?> /><label for="update_notice_theme-off"><?php echo esc_html( $this->constant_settings['update_notice_theme'][0] ); ?> 通知しない</label><br />
148 <input type="radio" id="update_notice_theme-all-on" class="circle-radio" name="update_notice_theme" value="<?php echo esc_attr( $this->constant_settings['update_notice_theme'][1] ); ?>" <?php echo esc_html( $this->datas[ 'update_notice_theme_' . $this->constant_settings['update_notice_theme'][1] ] ?? '' ); ?> /><label for="update_notice_theme-all-on"><?php echo esc_html( $this->constant_settings['update_notice_theme'][1] ); ?> すべて通知する</label><br />
149 <input type="radio" id="update_notice_theme-exclusive-on" class="circle-radio" name="update_notice_theme" value="<?php echo esc_attr( $this->constant_settings['update_notice_theme'][2] ); ?>" <?php echo esc_html( $this->datas[ 'update_notice_theme_' . $this->constant_settings['update_notice_theme'][2] ] ?? '' ); ?> /><label for="update_notice_theme-exclusive-on"><?php echo esc_html( $this->constant_settings['update_notice_theme'][2] ); ?> 有効化されたテーマのみ通知する</label>
150 </div>
151 </div>
152 </div>
153 </div>
154 <div id="submit-btn-area">
155 <?php $this->nonce_wp( $this->update_notice->get_feature_key() ); ?>
156 <?php $this->submit_button_wp(); ?>
157 </div>
158 </form>
159 <?php
160 }
161 }
162