<?php
function kompass_print_radio($settingName) {
    $currentSetting = get_option($settingName);
    $options = [
        'kompass_limit_login_client_type' => [
            'REMOTE_ADDR' => 'Direkte Verbrindung',
            'HTTP_X_FORWARDED_FOR' => 'Hinter einem Proxy'
        ],
        'kompass_limit_login_cookies' => [
            true => 'Ja',
            false => 'Nein'
        ],
        'kompass_password_minimal_strength' => [
            '1' => 'Alle Passwörter erlauben',
            '2' => 'Mittelstarke Passwörter',
            '3' => 'Nur Starke Passwörter'
        ]
    ];

    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 . '" />' .
            '<label for="setting_' . $settingName . '_' . $radioOption . '">' . $optionText . '</label> &nbsp; ';
    }
}
