Support for site verification codes
This commit is contained in:
		
							
								
								
									
										28
									
								
								components/partials/checkbox-option.php
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								components/partials/checkbox-option.php
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,28 @@
 | 
			
		||||
<?php
 | 
			
		||||
function kompass_print_checkbox(string $settingName) {
 | 
			
		||||
    $currentSetting = get_option($settingName, []);
 | 
			
		||||
    if (!is_array($currentSetting)) {
 | 
			
		||||
        $currentSetting = [$currentSetting];
 | 
			
		||||
    }
 | 
			
		||||
    $options = ['kompass_limit_login_lockout_notify' => [
 | 
			
		||||
        'email' => __('E-Mail to site admin', BDP_LV_PLUGIN_SLUG)
 | 
			
		||||
        ],
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    if(!isset($options[$settingName])) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $setting = $options[$settingName];
 | 
			
		||||
    foreach ($setting as $radioOption => $optionText) {
 | 
			
		||||
        $isChecked = in_array($radioOption, $currentSetting) ? 'checked ' : '' ;
 | 
			
		||||
 | 
			
		||||
        echo '<input ' .
 | 
			
		||||
            $isChecked .
 | 
			
		||||
            'type="checkbox" 
 | 
			
		||||
            name="' . $settingName . '[]" 
 | 
			
		||||
            value="' . $radioOption . '"
 | 
			
		||||
            id="setting_' . $settingName . '_' . $radioOption . '" />' .
 | 
			
		||||
            '<label for="setting_' . $settingName . '_' . $radioOption . '">' . $optionText . '</label><br />';
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
		Reference in New Issue
	
	Block a user