multi language support
support for small devices
This commit is contained in:
		@@ -1,47 +1,56 @@
 | 
			
		||||
<?php
 | 
			
		||||
function updateBlockOrAllowList($postVars)
 | 
			
		||||
 | 
			
		||||
use Bdp\Modules\LimitLoginAttempts\Controllers\OptionsPage as LimitLoginAttemptsOptions;
 | 
			
		||||
 | 
			
		||||
function updateBlockOrAllowList(array $postVars)
 | 
			
		||||
{
 | 
			
		||||
    $listType = $postVars['save_kompass_balist_list_type'];
 | 
			
		||||
 | 
			
		||||
    $saveIPList = [];
 | 
			
		||||
    if (isset($postVars['listElements'])) {
 | 
			
		||||
        foreach ($postVars['listElements'] as $curIp) {
 | 
			
		||||
            $curIp = trim($curIp);
 | 
			
		||||
            if ($curIp !== '') {
 | 
			
		||||
                $saveIPList[] = $curIp;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (count($postVars['new_ips']) == 1) {
 | 
			
		||||
if (count($postVars['new_ips']) == 1) {
 | 
			
		||||
        foreach (explode(PHP_EOL, $postVars['new_ips'][0]) as $newIp) {
 | 
			
		||||
            $newIp = trim($newIp);
 | 
			
		||||
            if ('' !== $newIp) {
 | 
			
		||||
                $saveIPList[] = $newIp;
 | 
			
		||||
                if ($listType == 'blocklist') {
 | 
			
		||||
                    LimitLoginAttemptsOptions::addToBlocklist($newIp);
 | 
			
		||||
                } else {
 | 
			
		||||
                    LimitLoginAttemptsOptions::addToAllowlist($newIp);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    update_option('kompass_limit_login_' . $listType, $saveIPList);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function kompass_print_block_allow_form($listType) {
 | 
			
		||||
function kompass_print_block_allow_form(string $listType) {
 | 
			
		||||
    $elements = get_option('kompass_limit_login_' . $listType, []);
 | 
			
		||||
 | 
			
		||||
     ?>
 | 
			
		||||
 | 
			
		||||
    <input type="hidden" name="save_kompass_balist_list_type" value="<?= $listType; ?>" />
 | 
			
		||||
 | 
			
		||||
    <?php
 | 
			
		||||
    foreach ($elements as $currentIp) {
 | 
			
		||||
        ?>
 | 
			
		||||
        <p>
 | 
			
		||||
            <input type="text" name="listElements[]" value="<?= $currentIp ?>" style="width: 350px;" /><br />
 | 
			
		||||
            <label style="cursor: default; color: #a0a0a0; fot-size: 9pt; font-style: italic"><?= __('Zum Löschen frei lassen', BDP_LV_PLUGIN_SLUG); ?></label>
 | 
			
		||||
        </p>
 | 
			
		||||
    <p style="width: 100%; text-align: right">
 | 
			
		||||
        <input type="text" id="searchInput"
 | 
			
		||||
               onkeyup="searchTable('myTable', this)"
 | 
			
		||||
               placeholder="<?=__('Search for ip address', BDP_LV_PLUGIN_SLUG); ?>">
 | 
			
		||||
    </p>
 | 
			
		||||
    <table class="wp-list-table widefat fixed striped table-view-list" id="myTable">
 | 
			
		||||
        <thead>
 | 
			
		||||
        <tr>
 | 
			
		||||
            <th scope="col" class="manage-column column-name"><?= __('IP address', BDP_LV_PLUGIN_SLUG); ?></th>
 | 
			
		||||
            <th style="width: 100px;" class="manage-column column-name"><?= __('Actions', BDP_LV_PLUGIN_SLUG); ?></th>
 | 
			
		||||
        </tr>
 | 
			
		||||
        </thead>
 | 
			
		||||
        <tbody>
 | 
			
		||||
        <?php
 | 
			
		||||
    }
 | 
			
		||||
    ?>
 | 
			
		||||
            foreach ($elements as $currentIp) {
 | 
			
		||||
                echo '<tr>';
 | 
			
		||||
                echo '<td>' . $currentIp  .'</td>';
 | 
			
		||||
                echo '<td><a href="admin.php?page=bdp-kompass-limit-login-attempts&action=removeFromList' .
 | 
			
		||||
                    '&list=' . $listType . '&ip=' . base64_encode($currentIp) . '">'
 | 
			
		||||
                    . __('Delete', BDP_LV_PLUGIN_SLUG) . '</a></td>';
 | 
			
		||||
                echo '</tr>';
 | 
			
		||||
            }
 | 
			
		||||
        ?>
 | 
			
		||||
        </tbody>
 | 
			
		||||
    </table>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    </div>
 | 
			
		||||
    <div class="kompass_setting_box">
 | 
			
		||||
        <h3><?= __('IP-Adresse hinzufügen', BDP_LV_PLUGIN_SLUG); ?></h3>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user