rebase from live enviornment
This commit is contained in:
@@ -58,12 +58,42 @@ $selectOptions = array(
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li id="howGetIPs-trusted-proxy-preset">
|
||||
<ul id="wf-option-howGetIPs-trusted-proxy-preset" class="wf-option wf-option-select" data-text-option="howGetIPs_trusted_proxy_preset" data-original-text-value="<?php echo esc_attr(wfConfig::get('howGetIPs_trusted_proxy_preset')); ?>">
|
||||
<li class="wf-option-spacer"></li>
|
||||
<li class="wf-option-content">
|
||||
<ul>
|
||||
<li class="wf-option-title">
|
||||
<ul class="wf-flex-vertical wf-flex-align-left">
|
||||
<li><span id="wf-option-howGetIPs-trusted-proxy-preset-label"><?php esc_html_e('Trusted Proxy Preset', 'wordfence'); ?></span></li>
|
||||
<li class="wf-option-subtitle"><?php esc_html_e('In addition to the above list, the IPs (or CIDR ranges) in the selected preset will be ignored when determining the requesting IP via the X-Forwarded-For HTTP header.', 'wordfence'); ?></li>
|
||||
</ul>
|
||||
</li>
|
||||
<li class="wf-option-select">
|
||||
<?php
|
||||
$presets = wfConfig::getJSON('ipResolutionList', array());
|
||||
if (!is_array($presets)) {
|
||||
$presets = array();
|
||||
}
|
||||
$keys = array_keys($presets); asort($keys);
|
||||
?>
|
||||
<select<?php echo (!empty($presets) ? '' : ' disabled'); ?> aria-labelledby="wf-option-howGetIPs-trusted-proxy-preset-label">
|
||||
<option class="wf-option-select-option" value=""<?php if (!in_array(wfConfig::get('howGetIPs_trusted_proxy_preset'), $keys)) { echo ' selected'; } ?>><?php esc_html_e('None', 'wordfence'); ?></option>
|
||||
<?php foreach ($keys as $k): ?>
|
||||
<option class="wf-option-select-option" value="<?php echo esc_attr($k); ?>"<?php if ($k == wfConfig::get('howGetIPs_trusted_proxy_preset')) { echo ' selected'; } ?>><?php echo esc_html($presets[$k]['name']); ?></option>
|
||||
<?php endforeach; ?>
|
||||
</select>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
</li>
|
||||
</ul>
|
||||
<script type="application/javascript">
|
||||
(function($) {
|
||||
$(function() {
|
||||
var updateIPPreview = function() {
|
||||
WFAD.updateIPPreview({howGetIPs: $('input[name="wf-howgetIPs"]:checked').val(), 'howGetIPs_trusted_proxies': $('#howGetIPs-trusted-proxies textarea').val()}, function(ret) {
|
||||
WFAD.updateIPPreview({howGetIPs: $('input[name="wf-howgetIPs"]:checked').val(), 'howGetIPs_trusted_proxies': $('#howGetIPs-trusted-proxies textarea').val(), 'howGetIPs_trusted_proxy_preset': $('#howGetIPs-trusted-proxy-preset select').val()}, function(ret) {
|
||||
if (ret && ret.ok) {
|
||||
$('#howGetIPs-preview-all').html(ret.ipAll);
|
||||
$('#howGetIPs-preview-single').html(ret.ip);
|
||||
@@ -116,6 +146,29 @@ $selectOptions = array(
|
||||
}, 4);
|
||||
});
|
||||
|
||||
$('#howGetIPs-trusted-proxy-preset').on('change', function() {
|
||||
var e = this;
|
||||
|
||||
setTimeout(function() {
|
||||
clearTimeout(coalescingUpdateTimer);
|
||||
coalescingUpdateTimer = setTimeout(updateIPPreview, 1000);
|
||||
|
||||
var optionElement = $(e).find('.wf-option.wf-option-select');
|
||||
var option = optionElement.data('textOption');
|
||||
var value = $(e).find('select').val();
|
||||
|
||||
var originalValue = optionElement.data('originalTextValue');
|
||||
if (originalValue == value) {
|
||||
delete WFAD.pendingChanges[option];
|
||||
}
|
||||
else {
|
||||
WFAD.pendingChanges[option] = value;
|
||||
}
|
||||
|
||||
WFAD.updatePendingChanges();
|
||||
}, 4);
|
||||
});
|
||||
|
||||
$(window).on('wfOptionsReset', function() {
|
||||
$('input[name="wf-howgetIPs"]').each(function() {
|
||||
var optionElement = $(this).closest('.wf-option.wf-option-howgetips');
|
||||
@@ -155,6 +208,12 @@ $selectOptions = array(
|
||||
$('#howGetIPs-trusted-proxies').removeClass('wf-active');
|
||||
}
|
||||
});
|
||||
|
||||
$('#howGetIPs-trusted-proxy-preset').slideUp({
|
||||
always: function() {
|
||||
$('#howGetIPs-trusted-proxy-preset').removeClass('wf-active');
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
$(this).parent().slideUp();
|
||||
@@ -163,6 +222,12 @@ $selectOptions = array(
|
||||
$('#howGetIPs-trusted-proxies').addClass('wf-active');
|
||||
}
|
||||
});
|
||||
|
||||
$('#howGetIPs-trusted-proxy-preset').slideDown({
|
||||
always: function() {
|
||||
$('#howGetIPs-trusted-proxy-preset').addClass('wf-active');
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user