PluginProbe ʕ •ᴥ•ʔ
CloudSecure WP Security / 1.4.9
CloudSecure WP Security v1.4.9
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 / unify-messages.php
cloudsecure-wp-security / modules Last commit date
admin 1 month ago cli 2 months ago lib 3 months ago captcha.php 3 months ago cloudsecure-wp.php 1 month ago common.php 2 months ago config.php 2 years ago disable-access-system-file.php 4 months ago disable-author-query.php 2 years ago disable-login.php 2 months ago disable-restapi.php 2 months ago disable-xmlrpc.php 1 year ago htaccess.php 3 months ago login-log.php 2 months ago login-notification.php 1 year ago rename-login-page.php 3 months ago restrict-admin-page.php 3 months ago server-error-notification.php 2 months ago two-factor-authentication.php 1 month ago unify-messages.php 2 years ago update-notice.php 7 months ago waf-engine.php 1 month ago waf.php 1 month ago
unify-messages.php
101 lines
1 <?php
2
3 if ( ! defined( 'ABSPATH' ) ) {
4 exit;
5 }
6
7 class CloudSecureWP_Unify_Messages extends CloudSecureWP_Common {
8 private const KEY_FEATURE = 'unify_messages';
9 private const ERROR_MESSAGE = '�
10 �力に誤りがあります';
11
12 private $config;
13 private $disable_login;
14
15 function __construct( array $info, CloudSecureWP_Config $config, CloudSecureWP_Disable_Login $disable_login ) {
16 parent::__construct( $info );
17 $this->config = $config;
18 $this->disable_login = $disable_login;
19 }
20
21 /**
22 * 機能毎のKEY取得
23 *
24 * @return string
25 */
26 public function get_feature_key(): string {
27 return self::KEY_FEATURE;
28 }
29
30 /**
31 * 有効無効判定
32 *
33 * @return bool
34 */
35 public function is_enabled(): bool {
36 return $this->config->get( $this->get_feature_key() ) === 't' ? true : false;
37 }
38
39 /**
40 * 初期設定値取得
41 *
42 * @return array
43 */
44 public function get_default(): array {
45 return array( self::KEY_FEATURE => $this->check_environment() ? 't' : 'f' );
46 }
47
48 /**
49 * 設定値取得
50 */
51 public function get_settings(): array {
52 $settings = array();
53 $default = $this->get_default();
54
55 foreach ( $default as $key => $val ) {
56 $settings[ $key ] = $this->config->get( $key );
57 }
58
59 return $settings;
60 }
61
62 /**
63 * 設定値保存
64 *
65 * @param array $settings
66 * @return void
67 */
68 public function save_settings( $settings ): void {
69 $default = $this->get_default();
70
71 foreach ( $default as $key => $val ) {
72 $this->config->set( $key, $settings[ $key ] ?? '' );
73 }
74
75 $this->config->save();
76 }
77
78 public function login_errors( $error ) {
79 return self::ERROR_MESSAGE;
80 }
81
82 /**
83 * 有効化
84 *
85 * @return void
86 */
87 public function activate(): void {
88 $this->save_settings( $this->get_default() );
89 }
90
91 /**
92 * 無効化
93 *
94 * @return void
95 */
96 public function deactivate(): void {
97 $this->config->set( $this->get_feature_key(), 'f' );
98 $this->config->save();
99 }
100 }
101