PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.2.6
CloudSecure WP Security v1.2.6
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 / login-notification.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
login-notification.php
147 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class CloudSecureWP_Admin_Login_Notification extends CloudSecureWP_Admin_Common {
8 private $login_notification;
9
10 function __construct( array $info, CloudSecureWP_Login_Notification $login_notification ) {
11 parent::__construct( $info );
12 $this->login_notification = $login_notification;
13 $this->prepare_view_data();
14 $this->render();
15 }
16
17 /**
18 * 画面表示用のデータを準備
19 */
20 public function prepare_view_data(): void {
21 $this->datas = $this->login_notification->get_settings();
22
23 if ( ! empty( $_POST ) && check_admin_referer( $this->login_notification->get_feature_key() . '_csrf' ) ) {
24
25 foreach ( $this->datas as $key => $val ) {
26
27 switch ( $key ) {
28 case 'login_notification':
29 $tmp = sanitize_text_field( $_POST[ $key ] ?? '' );
30 if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) {
31 $this->errors[] = '有効・無効の値が不正です';
32 }
33
34 if ( ! $this->check_environment() ) {
35 $tmp = 'f';
36 }
37
38 $this->datas[ $key ] = $tmp;
39 break;
40
41 case 'login_notification_subject':
42 $tmp = stripslashes( sanitize_textarea_field( $_POST[ $key ] ?? '' ) );
43 if ( ! $tmp ) {
44 $this->errors[] = '件名を�
45 �力してください';
46 }
47 $this->datas[ $key ] = $tmp;
48 break;
49
50 case 'login_notification_body':
51 $tmp = stripslashes( sanitize_textarea_field( $_POST[ $key ] ?? '' ) );
52 if ( ! $tmp ) {
53 $this->errors[] = '本文を�
54 �力してください';
55 }
56 $this->datas[ $key ] = $tmp;
57 break;
58
59 case 'login_notification_admin_only':
60 $tmp = sanitize_text_field( $_POST[ $key ] ?? 'f' );
61 if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) {
62 $this->errors[] = '管理�
63 のみ通知の値が不正です';
64 }
65 $this->datas[ $key ] = $tmp;
66 break;
67 }
68 }
69
70 if ( empty( $this->errors ) ) {
71 if ( 't' === $this->datas['login_notification'] ) {
72 $this->messages[] = 'ログイン通知機能が有効になりました。';
73 } else {
74 $this->messages[] = 'ログイン通知機能が無効になりました。';
75 }
76
77 $this->login_notification->save_settings( $this->datas );
78 }
79 }
80
81 $this->datas = $this->get_checked( $this->datas, array( 'login_notification', 'login_notification_admin_only' ) );
82 }
83
84 /**
85 * デスクリプション
86 */
87 protected function admin_description(): void {
88 ?>
89 <div class="title-block mb-12">
90 <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank" href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/login_notification.php">こちら</a></p>
91 <h1 class="title-block-title">ログイン通知</h1>
92 </div>
93 <div class="title-bottom-text">
94 ログインがあったとき、ユーザーにメールで通知します。
95 </div>
96 <?php
97 }
98
99 /**
100 * ページコンテンツ
101 */
102 protected function page(): void {
103 ?>
104 <form method="post">
105 <div class="enabled-or-disabled">
106 <input class="enabled-or-disabled__btn" id="enabled" type="radio" name="login_notification" value="t" <?php echo esc_html( $this->datas['login_notification_t'] ?? '' ); ?> /><label for="enabled">有効</label>
107 <input class="enabled-or-disabled__btn" id="disabled" type="radio" name="login_notification" value="f" <?php echo esc_html( $this->datas['login_notification_f'] ?? '' ); ?> /><label for="disabled">無効</label>
108 </div>
109 <div class="box">
110 <div class="box-bottom">
111 <div class="box-row flex-start">
112 <div class="box-row-title not-label pt-12">
113 サブジェクト
114 </div>
115 <div class="box-row-content">
116 <input style="width:100%;" type="text" name="login_notification_subject" value="<?php echo esc_attr( sanitize_text_field( $this->datas['login_notification_subject'] ) ); ?>" />
117 </div>
118 </div>
119 <div class="box-row flex-start">
120 <div class="box-row-title not-label pt-12">
121 メール本文
122 </div>
123 <div class="box-row-content">
124 <textarea class="login-notification-textarea" style="width:100%; height:148px;" name="login_notification_body"><?php echo esc_textarea( $this->datas['login_notification_body'] ); ?></textarea>
125 </div>
126 </div>
127 <div class="box-row flex-start">
128 <div class="box-row-title not-label">
129 受信�
130
131 </div>
132 <div class="box-row-content ">
133 <input id="receiver-checkbox" class="checkbox" type="checkbox" name="login_notification_admin_only" value="t" <?php echo esc_html( $this->datas['login_notification_admin_only_t'] ?? '' ); ?> /><label for="receiver-checkbox">管理�
134 のみ通知</label>
135 </div>
136 </div>
137 </div>
138 </div>
139 <div id="submit-btn-area">
140 <?php $this->nonce_wp( $this->login_notification->get_feature_key() ); ?>
141 <?php $this->submit_button_wp(); ?>
142 </div>
143 </form>
144 <?php
145 }
146 }
147