captcha.php
1 year ago
common.php
1 year ago
dashboard.php
2 months ago
disable-access-system-file.php
7 months ago
disable-author-query.php
1 year ago
disable-login.php
1 year ago
disable-restapi.php
1 year ago
disable-xmlrpc.php
1 year ago
login-log-table.php
3 months ago
login-log.php
1 year ago
login-notification.php
1 year ago
rename-login-page.php
1 month ago
restrict-admin-page.php
1 year ago
server-error-notification.php
2 months ago
server-error-table.php
1 year ago
two-factor-authentication-registration.php
2 months ago
two-factor-authentication.php
2 months ago
unify-messages.php
1 year ago
update-notice.php
2 months ago
waf-table.php
1 year ago
waf.php
2 months ago
unify-messages.php
96 lines
| 1 | <?php |
| 2 | |
| 3 | if ( ! defined( 'ABSPATH' ) ) { |
| 4 | exit; |
| 5 | } |
| 6 | |
| 7 | class CloudSecureWP_Admin_Unify_Messages extends CloudSecureWP_Admin_Common { |
| 8 | private $unify_messages; |
| 9 | |
| 10 | function __construct( array $info, CloudSecureWP_Unify_Messages $unify_messages ) { |
| 11 | parent::__construct( $info ); |
| 12 | $this->unify_messages = $unify_messages; |
| 13 | $this->prepare_view_data(); |
| 14 | $this->render(); |
| 15 | } |
| 16 | |
| 17 | /** |
| 18 | * 画面表示用のデータを準備 |
| 19 | */ |
| 20 | public function prepare_view_data(): void { |
| 21 | $this->datas = $this->unify_messages->get_settings(); |
| 22 | |
| 23 | if ( ! empty( $_POST ) && check_admin_referer( $this->unify_messages->get_feature_key() . '_csrf' ) ) { |
| 24 | |
| 25 | foreach ( $this->datas as $key => $val ) { |
| 26 | |
| 27 | switch ( $key ) { |
| 28 | case 'unify_messages': |
| 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 | } |
| 42 | |
| 43 | if ( empty( $this->errors ) ) { |
| 44 | if ( 't' === $this->datas['unify_messages'] ) { |
| 45 | $this->messages[] = 'ログインエラーメッセージ統一機能が有効になりました。'; |
| 46 | } else { |
| 47 | $this->messages[] = 'ログインエラーメッセージ統一機能が無効になりました。'; |
| 48 | } |
| 49 | |
| 50 | $this->unify_messages->save_settings( $this->datas ); |
| 51 | } |
| 52 | } |
| 53 | |
| 54 | $this->datas = $this->get_checked( $this->datas, array( 'unify_messages' ) ); |
| 55 | } |
| 56 | |
| 57 | /** |
| 58 | * デスクリプション |
| 59 | */ |
| 60 | protected function admin_description(): void { |
| 61 | ?> |
| 62 | <nav> |
| 63 | <ul class="breadcrumb"> |
| 64 | <li class="breadcrumb__list"><a href="?page=cloudsecurewp">ダッシュボード</a></li> |
| 65 | <li class="breadcrumb__list">ログインエラーメッセージ統一</li> |
| 66 | </ul> |
| 67 | </nav> |
| 68 | <div class="title-block mb-12"> |
| 69 | <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> |
| 70 | <h1 class="title-block-title">ログインエラーメッセージ統一</h1> |
| 71 | </div> |
| 72 | <div class="title-bottom-text"> |
| 73 | ログインに関するエラーメッセージについて、ユーザー名、パスワード、画像認証のどれを間違えても同一のメッセージを表示します。 |
| 74 | </div> |
| 75 | <?php |
| 76 | } |
| 77 | |
| 78 | /** |
| 79 | * ページコンテンツ |
| 80 | */ |
| 81 | protected function page(): void { |
| 82 | ?> |
| 83 | <form method="post"> |
| 84 | <div class="enabled-or-disabled"> |
| 85 | <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> |
| 86 | <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> |
| 87 | </div> |
| 88 | <div id="submit-btn-area"> |
| 89 | <?php $this->nonce_wp( $this->unify_messages->get_feature_key() ); ?> |
| 90 | <?php $this->submit_button_wp(); ?> |
| 91 | </div> |
| 92 | </form> |
| 93 | <?php |
| 94 | } |
| 95 | } |
| 96 |