PluginProbe
DoLogin Security / trunk
DoLogin Security vtrunk
5.0.10 4.8.3 trunk 1.0 1.1 1.1.1 1.2 1.2.1 1.2.2 1.3 1.3.1 1.3.2 1.3.3 1.3.4 1.3.5 1.4 1.4.1 1.4.2 1.4.3 1.4.4 1.4.5 1.4.6 1.4.7 1.5 1.6 All 64 releases
dologin / src / lang.cls.php

lang.cls.php in DoLogin Security trunk, at src/lang.cls.php

202 lines 5.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Language class
4 *
5 * @since 1.0
6 */
7 namespace dologin;
8
9 defined( 'WPINC' ) || exit;
10
11 class Lang extends Instance {
12 /**
13 * Init hook
14 *
15 * @since 1.4.7
16 */
17 public function init() {
18 add_action( 'plugins_loaded', array( $this, 'plugins_loaded' ) );
19 }
20
21 /**
22 * Plugin loaded hooks
23 *
24 * @since 1.4.7
25 */
26 public function plugins_loaded() {
27 // phpcs:ignore PluginCheck.CodeAnalysis.DiscouragedFunctions.load_plugin_textdomainFound -- kept for backward compatibility with WordPress < 4.6 (plugin supports WP 4.0).
28 load_plugin_textdomain( 'dologin', false, 'dologin/lang/' );
29 }
30
31 /**
32 * Format the translated remaining-attempts message around one replacement.
33 */
34 private static function _remaining_attempts( $replacement ) {
35 /* translators: %s: number of remaining login attempts. */
36 return sprintf( __( '%s attempt(s) remaining.', 'dologin' ), $replacement );
37 }
38
39 /**
40 * Return the localized text for a message tag.
41 */
42 public static function text( $tag, $num = null ) {
43 switch ( $tag ) {
44 case 'not_2fa_set_user':
45 $msg = __( 'No 2FA set under this user profile.', 'dologin' );
46 break;
47
48 case 'empty_u_p':
49 $msg = __( 'Empty username/password.', 'dologin' );
50 break;
51
52 case 'auth_failed':
53 $msg = __( 'Invalid username/password.', 'dologin' );
54 break;
55
56 case 'not_in_whitelist':
57 $msg = __( 'Your IP is not in the whitelist.', 'dologin' );
58 break;
59
60 case 'in_blacklist':
61 $msg = __( 'Your IP is in the blacklist.', 'dologin' );
62 break;
63
64 case 'max_retries_hit':
65 $msg = __( 'Too many failed login attempts. Please try later.', 'dologin' );
66 break;
67
68 case 'under_protected':
69 $msg = __( 'ON', 'dologin' );
70 break;
71
72 case 'max_retries':
73 $msg = self::_remaining_attempts( (int) $num );
74 break;
75
76 case 'dynamic_code_missing':
77 $msg = __( 'Dynamic code is required.', 'dologin' );
78 break;
79
80 case 'dynamic_code_wrong':
81 $msg = __( 'Dynamic code is not correct.', 'dologin' );
82 break;
83
84 case 'captcha_missing':
85 $msg = __( 'Please complete the Cloudflare Turnstile verification.', 'dologin' );
86 break;
87
88 // @see https://developers.cloudflare.com/turnstile/get-started/server-side-validation/
89 case 'missing-input-response':
90 $msg = __( 'The response parameter is missing.', 'dologin' );
91 break;
92
93 case 'invalid-input-response':
94 $msg = __( 'The response parameter is invalid or malformed.', 'dologin' );
95 break;
96
97 case 'missing-input-secret':
98 $msg = __( 'The secret parameter is missing.', 'dologin' );
99 break;
100
101 case 'invalid-input-secret':
102 $msg = __( 'The secret parameter is invalid or malformed.', 'dologin' );
103 break;
104
105 case 'bad-request':
106 $msg = __( 'The request is invalid or malformed.', 'dologin' );
107 break;
108
109 case 'timeout-or-duplicate':
110 $msg = __( 'The response is no longer valid: either is too old or has been used previously.', 'dologin' );
111 break;
112
113 case 'captcha_transport_error':
114 case 'captcha_service_error':
115 case 'error':
116 case 'internal-error':
117 $msg = __( 'Cloudflare Turnstile verification is temporarily unavailable. Please try again.', 'dologin' );
118 break;
119
120 case 'dologin_kl_sso_required':
121 $msg = __( 'KeyLockr SSO is required to log in to this site.', 'dologin' );
122 break;
123
124 case 'dologin_ip_denied':
125 $msg = __( 'Login is not allowed from your IP address.', 'dologin' );
126 break;
127
128 case 'dologin_rate_limited':
129 $msg = __( 'Too many failed login attempts. Please try again later.', 'dologin' );
130 break;
131
132 case 'dologin_link_invalid':
133 case 'dologin_invalid_root_record':
134 $msg = __( 'This login link is invalid.', 'dologin' );
135 break;
136
137 case 'dologin_link_used':
138 $msg = __( 'This login link has already been used or disabled.', 'dologin' );
139 break;
140
141 case 'dologin_link_expired':
142 $msg = __( 'This login link has expired.', 'dologin' );
143 break;
144
145 case 'dologin_sodium_unavailable':
146 $msg = __( 'Secure login is temporarily unavailable. Please contact the site administrator.', 'dologin' );
147 break;
148
149 case 'dologin_token_generation_failed':
150 $msg = __( 'Unable to create a secure login token. Please try again.', 'dologin' );
151 break;
152
153 case 'dologin_invalid_token_record':
154 case 'dologin_site_token_invalid':
155 $msg = __( 'This site connection token is invalid.', 'dologin' );
156 break;
157
158 case 'dologin_site_token_missing':
159 $msg = __( 'Enter a child-site connection token.', 'dologin' );
160 break;
161
162 case 'dologin_site_connection_failed':
163 $msg = __( 'Unable to connect to the child site. Check the connection token and try again.', 'dologin' );
164 break;
165
166 case 'dologin_site_clock_mismatch':
167 $msg = __( 'The root and child site clocks are too far apart to complete the connection.', 'dologin' );
168 break;
169
170 case 'dologin_site_same_url':
171 $msg = __( 'A site cannot connect to itself.', 'dologin' );
172 break;
173
174 case 'dologin_site_already_connected':
175 $msg = __( 'This root site is already connected for the selected user.', 'dologin' );
176 break;
177
178 case 'dologin_token_expired':
179 $msg = __( 'This site connection token has expired.', 'dologin' );
180 break;
181
182 case 'dologin_token_used':
183 $msg = __( 'This site connection token has already been used.', 'dologin' );
184 break;
185
186 default:
187 $msg = __( 'Unable to complete this request. Please try again.', 'dologin' );
188 break;
189 }
190
191 return $msg;
192 }
193
194 public static function msg( $tag, $num = null ) {
195 $msg = 'max_retries' === $tag
196 ? self::_remaining_attempts( '<strong>' . (int) $num . '</strong>' )
197 : self::text( $tag, $num );
198
199 return '<strong>' . __( 'DoLogin Security', 'dologin' ) . '</strong>: ' . $msg;
200 }
201 }
202