PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.1.0
CloudSecure WP Security v1.1.0
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
157 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
21 if ( ! empty( $_POST ) && check_admin_referer( $this->update_notice->get_feature_key() . '_csrf' ) ) {
22
23 foreach ( $this->datas as $key => $val ) {
24
25 switch ( $key ) {
26 case 'update_notice':
27 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
28 if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) {
29 $this->errors[] = '有効・無効の値が不正です';
30 }
31
32 if ( ! $this->check_environment() ) {
33 $tmp = 'f';
34 }
35
36 if ( 't' === $tmp ) {
37 $cron_error = $this->update_notice->check_cron_error();
38
39 if ( '' !== $cron_error ) {
40 $this->errors[] = $cron_error;
41 $tmp = 'f';
42 $this->update_notice->remove_cron();
43 }
44 }
45
46 $this->datas[ $key ] = $tmp;
47 break;
48
49 case 'update_notice_wp':
50 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
51 if ( ! $this->is_selected( $tmp, $this->constant_settings['update_notice_wp'] ) ) {
52 $this->errors[] = 'WordPressアップデートの値が不正です';
53 }
54 $this->datas[ $key ] = $tmp;
55 break;
56
57 case 'update_notice_plugin':
58 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
59 if ( ! $this->is_selected( $tmp, $this->constant_settings['update_notice_plugin'] ) ) {
60 $this->errors[] = 'プラグインアップデートの値が不正です';
61 }
62 $this->datas[ $key ] = $tmp;
63 break;
64
65 case 'update_notice_theme':
66 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
67 if ( ! $this->is_selected( $tmp, $this->constant_settings['update_notice_theme'] ) ) {
68 $this->errors[] = 'テーマアップデートの値が不正です';
69 }
70 $this->datas[ $key ] = $tmp;
71 break;
72 }
73 }
74
75 if ( empty( $this->errors ) ) {
76 if ( 't' === $this->datas['update_notice'] ) {
77 $this->messages[] = 'アップデート通知機能が有効になりました。';
78 $this->update_notice->set_cron();
79 } else {
80 $this->messages[] = 'アップデート通知機能が無効になりました。';
81 $this->update_notice->remove_cron();
82 $this->datas['update_notice_last_notice'] = $this->update_notice->get_last_notice_default();
83 }
84
85 $this->update_notice->save_settings( $this->datas );
86 }
87 }
88
89 $this->datas = $this->get_checked( $this->datas, array( 'update_notice', 'update_notice_wp', 'update_notice_plugin', 'update_notice_theme' ) );
90 }
91
92 /**
93 * デスクリプション
94 */
95 protected function admin_description(): void {
96 ?>
97 <div class="title-block mb-12">
98 <h1 class="title-block-title">アップデート通知</h1>
99 <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>
100 </div>
101 <div class="title-bottom-text">
102 WordPress、プラグイン、テーマの更新が�
103 要になったとき、管理�
104 にメールで通知します。<br />
105 更新の確認は24時間ごとに行われます。<br />
106 <strong>※「/cron.php」へのhttpアクセスが発生するため、アクセスできない環境では機能を有効化できません。<br />
107  Basic認証(ベーシック認証 / 基本認証)を設定している場合など、ご注意ください。</strong>
108 </div>
109 <?php
110 }
111
112 /**
113 * ページコンテンツ
114 */
115 protected function page(): void {
116 ?>
117 <form method="post">
118 <div class="enabled-or-disabled">
119 <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>
120 <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>
121 </div>
122 <div class="box">
123 <div class="box-bottom">
124 <div class="box-row flex-start">
125 <div class="box-row-title not-label">WordPressアップデート</div>
126 <div class="box-row-content radio-btns">
127 <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 />
128 <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 />
129 </div>
130 </div>
131 <div class="box-row flex-start">
132 <div class="box-row-title not-label">プラグインアップデート</div>
133 <div class="box-row-content radio-btns">
134 <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 />
135 <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 />
136 <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>
137 </div>
138 </div>
139 <div class="box-row flex-start">
140 <div class="box-row-title not-label">テーマアップデート</div>
141 <div class="box-row-content radio-btns">
142 <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 />
143 <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 />
144 <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>
145 </div>
146 </div>
147 </div>
148 </div>
149 <div id="submit-btn-area">
150 <?php $this->nonce_wp( $this->update_notice->get_feature_key() ); ?>
151 <?php $this->submit_button_wp(); ?>
152 </div>
153 </form>
154 <?php
155 }
156 }
157