2024-02-26 14:47:51 +01:00
|
|
|
<?php
|
2024-03-02 15:09:07 +01:00
|
|
|
function kompass_print_radio(string $settingName) {
|
|
|
|
$currentSetting = get_option($settingName, '');
|
2024-02-26 14:47:51 +01:00
|
|
|
$options = [
|
|
|
|
'kompass_limit_login_client_type' => [
|
2024-03-02 15:09:07 +01:00
|
|
|
'REMOTE_ADDR' => __('Direct connection', BDP_LV_PLUGIN_SLUG),
|
|
|
|
'HTTP_X_FORWARDED_FOR' => __('Behind a proxy', BDP_LV_PLUGIN_SLUG)
|
2024-02-26 14:47:51 +01:00
|
|
|
],
|
|
|
|
'kompass_limit_login_cookies' => [
|
2024-03-02 15:09:07 +01:00
|
|
|
true => __('Yes', BDP_LV_PLUGIN_SLUG),
|
|
|
|
false => __('No', BDP_LV_PLUGIN_SLUG)
|
2024-02-26 14:47:51 +01:00
|
|
|
],
|
|
|
|
'kompass_password_minimal_strength' => [
|
2024-03-02 15:09:07 +01:00
|
|
|
'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)
|
2024-02-26 14:47:51 +01:00
|
|
|
]
|
|
|
|
];
|
|
|
|
|
|
|
|
if(!isset($options[$settingName])) {
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
$setting = $options[$settingName];
|
|
|
|
foreach ($setting as $radioOption => $optionText) {
|
|
|
|
$isChecked = $currentSetting == $radioOption ? 'checked ' : '' ;
|
|
|
|
echo '<input
|
|
|
|
' . $isChecked .
|
|
|
|
' type="radio"
|
|
|
|
name="' . $settingName . '"
|
|
|
|
value="' . $radioOption . '"
|
|
|
|
id="setting_' . $settingName . '_' . $radioOption . '" />' .
|
2024-03-02 15:09:07 +01:00
|
|
|
'<label for="setting_' . $settingName . '_' . $radioOption . '">' . $optionText . '</label><br />';
|
2024-02-26 14:47:51 +01:00
|
|
|
}
|
|
|
|
}
|