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
unify-messages.php
86 lines
| 1 | <?php |
| 2 | |
| 3 | class CloudSecureWP_Admin_Unify_Messages extends CloudSecureWP_Admin_Common { |
| 4 | private $unify_messages; |
| 5 | |
| 6 | function __construct( array $info, CloudSecureWP_Unify_Messages $unify_messages ) { |
| 7 | parent::__construct( $info ); |
| 8 | $this->unify_messages = $unify_messages; |
| 9 | $this->prepare_view_data(); |
| 10 | $this->render(); |
| 11 | } |
| 12 | |
| 13 | /** |
| 14 | * 画面表示用のデータを準備 |
| 15 | */ |
| 16 | public function prepare_view_data(): void { |
| 17 | $this->datas = $this->unify_messages->get_settings(); |
| 18 | |
| 19 | if ( ! empty( $_POST ) && check_admin_referer( $this->unify_messages->get_feature_key() . '_csrf' ) ) { |
| 20 | |
| 21 | foreach ( $this->datas as $key => $val ) { |
| 22 | |
| 23 | switch ( $key ) { |
| 24 | case 'unify_messages': |
| 25 | $tmp = sanitize_text_field( $_POST[ $key ] ?? '' ); |
| 26 | if ( ! $this->is_selected( $tmp, self::TF_VALIES ) ) { |
| 27 | $this->errors[] = '有効・無効の値が不正です'; |
| 28 | } |
| 29 | |
| 30 | if ( ! $this->check_environment() ) { |
| 31 | $tmp = 'f'; |
| 32 | } |
| 33 | |
| 34 | $this->datas[ $key ] = $tmp; |
| 35 | break; |
| 36 | } |
| 37 | } |
| 38 | |
| 39 | if ( empty( $this->errors ) ) { |
| 40 | if ( 't' === $this->datas['unify_messages'] ) { |
| 41 | $this->messages[] = 'ログインエラーメッセージ統一機能が有効になりました。'; |
| 42 | } else { |
| 43 | $this->messages[] = 'ログインエラーメッセージ統一機能が無効になりました。'; |
| 44 | } |
| 45 | |
| 46 | $this->unify_messages->save_settings( $this->datas ); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | $this->datas = $this->get_checked( $this->datas, array( 'unify_messages' ) ); |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * デスクリプション |
| 55 | */ |
| 56 | protected function admin_description(): void { |
| 57 | ?> |
| 58 | <div class="title-block mb-12"> |
| 59 | <h1 class="title-block-title">ログインエラーメッセージ統一</h1> |
| 60 | <p class="title-block-small-text">この機能のマニュアルは<a class="title-block-link" target="_blank" href="https://wpplugin.cloudsecure.ne.jp/cloudsecure_wp_security/unify_messages.php">こちら</a></p> |
| 61 | </div> |
| 62 | <div class="title-bottom-text"> |
| 63 | ログインに関するエラーメッセージについて、ユーザー名、パスワード、画像認証のどれを間違えても同一のメッセージを表示します。 |
| 64 | </div> |
| 65 | <?php |
| 66 | } |
| 67 | |
| 68 | /** |
| 69 | * ページコンテンツ |
| 70 | */ |
| 71 | protected function page(): void { |
| 72 | ?> |
| 73 | <form method="post"> |
| 74 | <div class="enabled-or-disabled"> |
| 75 | <input class="enabled-or-disabled__btn" id="enabled" type="radio" name="unify_messages" value="t" <?php echo esc_html( $this->datas['unify_messages_t'] ?? '' ); ?> /><label for="enabled">有効</label> |
| 76 | <input class="enabled-or-disabled__btn" id="disabled" type="radio" name="unify_messages" value="f" <?php echo esc_html( $this->datas['unify_messages_f'] ?? '' ); ?> /><label for="disabled">無効</label> |
| 77 | </div> |
| 78 | <div id="submit-btn-area"> |
| 79 | <?php $this->nonce_wp( $this->unify_messages->get_feature_key() ); ?> |
| 80 | <?php $this->submit_button_wp(); ?> |
| 81 | </div> |
| 82 | </form> |
| 83 | <?php |
| 84 | } |
| 85 | } |
| 86 |