multi language support

support for small devices
This commit is contained in:
2024-03-02 15:09:07 +01:00
parent 4d479cedaf
commit b3b58ce103
14 changed files with 613 additions and 339 deletions

View File

@ -1,12 +1,11 @@
<?php
function kompass_print_checkbox($settingName) {
function kompass_print_checkbox(string $settingName) {
$currentSetting = get_option($settingName, []);
if (!is_array($currentSetting)) {
$currentSetting = [$currentSetting];
}
if (!is_array($currentSetting)) {
$currentSetting = [$currentSetting];
}
$options = ['kompass_limit_login_lockout_notify' => [
'email' => 'E-Mail an Administrator'
'email' => __('E-Mail to site admin', BDP_LV_PLUGIN_SLUG)
],
];
@ -16,7 +15,7 @@ function kompass_print_checkbox($settingName) {
$setting = $options[$settingName];
foreach ($setting as $radioOption => $optionText) {
$isChecked = in_array($radioOption, $currentSetting) ? 'checked ' : '' ;
$isChecked = in_array($radioOption, $currentSetting) ? 'checked ' : '' ;
echo '<input ' .
$isChecked .

View File

@ -1,19 +1,19 @@
<?php
function kompass_print_radio($settingName) {
$currentSetting = get_option($settingName);
function kompass_print_radio(string $settingName) {
$currentSetting = get_option($settingName, '');
$options = [
'kompass_limit_login_client_type' => [
'REMOTE_ADDR' => 'Direkte Verbrindung',
'HTTP_X_FORWARDED_FOR' => 'Hinter einem Proxy'
'REMOTE_ADDR' => __('Direct connection', BDP_LV_PLUGIN_SLUG),
'HTTP_X_FORWARDED_FOR' => __('Behind a proxy', BDP_LV_PLUGIN_SLUG)
],
'kompass_limit_login_cookies' => [
true => 'Ja',
false => 'Nein'
true => __('Yes', BDP_LV_PLUGIN_SLUG),
false => __('No', BDP_LV_PLUGIN_SLUG)
],
'kompass_password_minimal_strength' => [
'1' => 'Alle Passwörter erlauben',
'2' => 'Mittelstarke Passwörter',
'3' => 'Nur Starke Passwörter'
'1' => __('Allow all password strengths', BDP_LV_PLUGIN_SLUG),
'2' => __('At least passwords with medium strength', BDP_LV_PLUGIN_SLUG),
'3' => __('Only allow strong passwords', BDP_LV_PLUGIN_SLUG)
]
];
@ -30,6 +30,6 @@ function kompass_print_radio($settingName) {
name="' . $settingName . '"
value="' . $radioOption . '"
id="setting_' . $settingName . '_' . $radioOption . '" />' .
'<label for="setting_' . $settingName . '_' . $radioOption . '">' . $optionText . '</label> &nbsp; ';
'<label for="setting_' . $settingName . '_' . $radioOption . '">' . $optionText . '</label><br />';
}
}

View File

@ -1,18 +1,18 @@
<?php
function kompass_print_tab_header($activeTab = 'tab1')
function kompass_print_tab_header(string $activeTab = 'tab1')
{
$baseUrl = 'admin.php?page=bdp-kompass-limit-login-attempts&tab=';
return '<h2 class="nav-tab-wrapper">'.
'<a href="' . $baseUrl . 'tab1" class="nav-tab ' . ($activeTab == 'tab1' ? 'nav-tab-active' : '') . '">
Optionen
</a>'.
'<a href="' . $baseUrl . 'tab2" class="nav-tab ' . ($activeTab == 'tab2' ? 'nav-tab-active' : '') .'">
Blocklist
</a>'.
'<a href="' . $baseUrl . 'tab3" class="nav-tab ' . ($activeTab == 'tab3' ? 'nav-tab-active' : '') .'">
Allowlist
</a>'.
'<a href="' . $baseUrl . 'tab4" class="nav-tab ' . ($activeTab == 'tab4' ? 'nav-tab-active' : '') .'">
Gesperrte IPs
</a></h2>';
'<a href="' . $baseUrl . 'tab1" class="nav-tab ' . ($activeTab == 'tab1' ? 'nav-tab-active' : '') . '">' .
__('Options', BDP_LV_PLUGIN_SLUG) .
'</a>'.
'<a href="' . $baseUrl . 'tab2" class="nav-tab ' . ($activeTab == 'tab2' ? 'nav-tab-active' : '') .'">' .
__('Blocklist', BDP_LV_PLUGIN_SLUG) .
'</a>'.
'<a href="' . $baseUrl . 'tab3" class="nav-tab ' . ($activeTab == 'tab3' ? 'nav-tab-active' : '') .'">' .
__('Allowlist', BDP_LV_PLUGIN_SLUG) .
'</a>'.
'<a href="' . $baseUrl . 'tab4" class="nav-tab ' . ($activeTab == 'tab4' ? 'nav-tab-active' : '') .'">' .
__('Blocked IP addresses', BDP_LV_PLUGIN_SLUG) .
'</a></h2>';
}