Edit File by line

Deprecated: str_replace(): Passing null to parameter #2 ($replace) of type array|string is deprecated in /home/sportsfever/public_html/filemanger/function.php on line 93
/home/sportsfe.../httpdocs/clone/wp-conte.../plugins/wordfenc.../views/dashboar...
File: option-howgetips.php
<?php
[0] Fix | Delete
if (!defined('WORDFENCE_VERSION')) { exit; }
[1] Fix | Delete
/**
[2] Fix | Delete
* Presents the global option howGetIPs with a value select menu and text area (hidden by default) for trusted proxies.
[3] Fix | Delete
*/
[4] Fix | Delete
[5] Fix | Delete
$selectOptions = array(
[6] Fix | Delete
array('value' => '', 'label' => esc_html__('Let Wordfence use the most secure method to get visitor IP addresses. Prevents spoofing and works with most sites.', 'wordfence') . ' <strong>' . esc_html__('(Recommended)', 'wordfence') . '</strong>'),
[7] Fix | Delete
array('value' => 'REMOTE_ADDR', 'label' => esc_html__('Use PHP\'s built in REMOTE_ADDR and don\'t use anything else. Very secure if this is compatible with your site.', 'wordfence')),
[8] Fix | Delete
array('value' => 'HTTP_X_FORWARDED_FOR', 'label' => esc_html__('Use the X-Forwarded-For HTTP header. Only use if you have a front-end proxy or spoofing may result.', 'wordfence')),
[9] Fix | Delete
array('value' => 'HTTP_X_REAL_IP', 'label' => esc_html__('Use the X-Real-IP HTTP header. Only use if you have a front-end proxy or spoofing may result.', 'wordfence')),
[10] Fix | Delete
array('value' => 'HTTP_CF_CONNECTING_IP', 'label' => esc_html__('Use the Cloudflare "CF-Connecting-IP" HTTP header to get a visitor IP. Only use if you\'re using Cloudflare.', 'wordfence')),
[11] Fix | Delete
);
[12] Fix | Delete
?>
[13] Fix | Delete
<ul class="wf-flex-vertical wf-flex-full-width">
[14] Fix | Delete
<li>
[15] Fix | Delete
<ul id="wf-option-howGetIPs" class="wf-option wf-option-howgetips" data-option="howGetIPs" data-original-value="<?php echo esc_attr(wfConfig::get('howGetIPs')); ?>" data-text-area-option="howGetIPs_trusted_proxies" data-original-text-area-value="<?php echo esc_attr(wfConfig::get('howGetIPs_trusted_proxies')); ?>">
[16] Fix | Delete
<li class="wf-option-spacer"></li>
[17] Fix | Delete
<li class="wf-option-content">
[18] Fix | Delete
<ul class="wf-flex-vertical wf-flex-align-left">
[19] Fix | Delete
<li class="wf-option-title"><?php esc_html_e('How does Wordfence get IPs', 'wordfence'); ?> <a href="<?php echo wfSupportController::esc_supportURL(wfSupportController::ITEM_DASHBOARD_OPTION_HOW_GET_IPS); ?>" target="_blank" rel="noopener noreferrer" class="wf-inline-help"><i class="wf-fa wf-fa-question-circle-o" aria-hidden="true"></i><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a></li>
[20] Fix | Delete
<li>
[21] Fix | Delete
<ul class="wf-flex-vertical wf-flex-align-left">
[22] Fix | Delete
<li class="wf-padding-add-left">
[23] Fix | Delete
<ul class="wf-flex-vertical wf-flex-align-left" role="radiogroup">
[24] Fix | Delete
<?php foreach ($selectOptions as $o): ?>
[25] Fix | Delete
<li class="wf-padding-add-top-small"><input type="radio" class="wf-option-radio" name="wf-howgetIPs" value="<?php echo esc_attr($o['value']); ?>" id="wf-howgetIPs-<?php echo esc_attr(preg_replace('/[^a-z0-9]/i', '-', $o['value'])); ?>"<?php if ($o['value'] == wfConfig::get('howGetIPs')) { echo ' checked'; } ?>><label for="wf-howgetIPs-<?php echo esc_attr(preg_replace('/[^a-z0-9]/i', '-', $o['value'])); ?>">&nbsp;&nbsp;</label><?php echo $o['label']; ?></li>
[26] Fix | Delete
<?php endforeach; ?>
[27] Fix | Delete
</ul>
[28] Fix | Delete
</li>
[29] Fix | Delete
<li class="wf-option-howgetips-details wf-padding-add-top-small">
[30] Fix | Delete
<div class="wf-left"><?php esc_html_e('Detected IP(s):', 'wordfence') ?> <span id="howGetIPs-preview-all"><?php echo wfUtils::getIPPreview(); ?></span></div>
[31] Fix | Delete
<div class="wf-left"><?php esc_html_e('Your IP with this setting:', 'wordfence') ?> <span id="howGetIPs-preview-single"><?php echo wfUtils::getIP(); ?></span></div>
[32] Fix | Delete
<div class="wf-left"><a href="#" id="howGetIPs-trusted-proxies-show" role="button">+ <?php esc_html_e('Edit trusted proxies', 'wordfence') ?></a></div>
[33] Fix | Delete
</li>
[34] Fix | Delete
</ul>
[35] Fix | Delete
</li>
[36] Fix | Delete
</ul>
[37] Fix | Delete
</li>
[38] Fix | Delete
<!-- <li class="wf-option-disclosure"><svg width="12px" height="12px" viewBox="0 0 12 12"><path id="disclosure-closed" d="M 6 0 l 6 6 -6 6 0 -12" fill="#777"/></svg></li> -->
[39] Fix | Delete
</ul>
[40] Fix | Delete
</li>
[41] Fix | Delete
<li id="howGetIPs-trusted-proxies">
[42] Fix | Delete
<ul id="wf-option-howGetIPs-trusted-proxies" class="wf-option wf-option-textarea" data-text-option="howGetIPs_trusted_proxies" data-original-text-value="<?php echo esc_attr(wfConfig::get('howGetIPs_trusted_proxies')); ?>">
[43] Fix | Delete
<li class="wf-option-spacer"></li>
[44] Fix | Delete
<li class="wf-option-content">
[45] Fix | Delete
<ul>
[46] Fix | Delete
<li class="wf-option-title">
[47] Fix | Delete
<ul class="wf-flex-vertical wf-flex-align-left">
[48] Fix | Delete
<li><?php esc_html_e('Trusted Proxies', 'wordfence'); ?></li>
[49] Fix | Delete
<li class="wf-option-subtitle"><?php esc_html_e('These IPs (or CIDR ranges) will be ignored when determining the requesting IP via the X-Forwarded-For HTTP header. Enter one IP or CIDR range per line.', 'wordfence'); ?></li>
[50] Fix | Delete
</ul>
[51] Fix | Delete
</li>
[52] Fix | Delete
<li class="wf-option-textarea">
[53] Fix | Delete
<textarea spellcheck="false" autocapitalize="none" autocomplete="off" name="howGetIPs_trusted_proxies"><?php echo esc_html(wfConfig::get('howGetIPs_trusted_proxies')); ?></textarea>
[54] Fix | Delete
</li>
[55] Fix | Delete
</ul>
[56] Fix | Delete
</li>
[57] Fix | Delete
</ul>
[58] Fix | Delete
</li>
[59] Fix | Delete
<li id="howGetIPs-trusted-proxy-preset">
[60] Fix | Delete
<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')); ?>">
[61] Fix | Delete
<li class="wf-option-spacer"></li>
[62] Fix | Delete
<li class="wf-option-content">
[63] Fix | Delete
<ul>
[64] Fix | Delete
<li class="wf-option-title">
[65] Fix | Delete
<ul class="wf-flex-vertical wf-flex-align-left">
[66] Fix | Delete
<li><span id="wf-option-howGetIPs-trusted-proxy-preset-label"><?php esc_html_e('Trusted Proxy Preset', 'wordfence'); ?></span></li>
[67] Fix | Delete
<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>
[68] Fix | Delete
</ul>
[69] Fix | Delete
</li>
[70] Fix | Delete
<li class="wf-option-select">
[71] Fix | Delete
<?php
[72] Fix | Delete
$presets = wfConfig::getJSON('ipResolutionList', array());
[73] Fix | Delete
if (!is_array($presets)) {
[74] Fix | Delete
$presets = array();
[75] Fix | Delete
}
[76] Fix | Delete
$keys = array_keys($presets); asort($keys);
[77] Fix | Delete
?>
[78] Fix | Delete
<select<?php echo (!empty($presets) ? '' : ' disabled'); ?> aria-labelledby="wf-option-howGetIPs-trusted-proxy-preset-label">
[79] Fix | Delete
<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>
[80] Fix | Delete
<?php foreach ($keys as $k): ?>
[81] Fix | Delete
<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>
[82] Fix | Delete
<?php endforeach; ?>
[83] Fix | Delete
</select>
[84] Fix | Delete
</li>
[85] Fix | Delete
</ul>
[86] Fix | Delete
</li>
[87] Fix | Delete
</ul>
[88] Fix | Delete
</li>
[89] Fix | Delete
</ul>
[90] Fix | Delete
<script type="application/javascript">
[91] Fix | Delete
(function($) {
[92] Fix | Delete
$(function() {
[93] Fix | Delete
var updateIPPreview = function() {
[94] Fix | Delete
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) {
[95] Fix | Delete
if (ret && ret.ok) {
[96] Fix | Delete
$('#howGetIPs-preview-all').html(ret.ipAll);
[97] Fix | Delete
$('#howGetIPs-preview-single').html(ret.ip);
[98] Fix | Delete
}
[99] Fix | Delete
else {
[100] Fix | Delete
//TODO: implementing testing whether or not this setting will lock them out and show the error saying that they'd lock themselves out
[101] Fix | Delete
}
[102] Fix | Delete
});
[103] Fix | Delete
};
[104] Fix | Delete
[105] Fix | Delete
$('input[name="wf-howgetIPs"]').on('change', function() {
[106] Fix | Delete
var optionElement = $(this).closest('.wf-option.wf-option-howgetips');
[107] Fix | Delete
var option = optionElement.data('option');
[108] Fix | Delete
var value = $('input[name="wf-howgetIPs"]:checked').val();
[109] Fix | Delete
[110] Fix | Delete
var originalValue = optionElement.data('originalValue');
[111] Fix | Delete
if (originalValue == value) {
[112] Fix | Delete
delete WFAD.pendingChanges[option];
[113] Fix | Delete
}
[114] Fix | Delete
else {
[115] Fix | Delete
WFAD.pendingChanges[option] = value;
[116] Fix | Delete
}
[117] Fix | Delete
[118] Fix | Delete
WFAD.updatePendingChanges();
[119] Fix | Delete
[120] Fix | Delete
updateIPPreview();
[121] Fix | Delete
});
[122] Fix | Delete
[123] Fix | Delete
var coalescingUpdateTimer;
[124] Fix | Delete
$('#howGetIPs-trusted-proxies textarea').on('change paste keyup', function() {
[125] Fix | Delete
var e = this;
[126] Fix | Delete
[127] Fix | Delete
setTimeout(function() {
[128] Fix | Delete
clearTimeout(coalescingUpdateTimer);
[129] Fix | Delete
coalescingUpdateTimer = setTimeout(updateIPPreview, 1000);
[130] Fix | Delete
[131] Fix | Delete
var optionElement = $(e).closest('.wf-option.wf-option-textarea');
[132] Fix | Delete
var option = optionElement.data('textOption');
[133] Fix | Delete
var value = $(e).val();
[134] Fix | Delete
[135] Fix | Delete
var originalValue = optionElement.data('originalTextValue');
[136] Fix | Delete
if (originalValue == value) {
[137] Fix | Delete
delete WFAD.pendingChanges[option];
[138] Fix | Delete
}
[139] Fix | Delete
else {
[140] Fix | Delete
WFAD.pendingChanges[option] = value;
[141] Fix | Delete
}
[142] Fix | Delete
[143] Fix | Delete
WFAD.updatePendingChanges();
[144] Fix | Delete
}, 4);
[145] Fix | Delete
});
[146] Fix | Delete
[147] Fix | Delete
$('#howGetIPs-trusted-proxy-preset').on('change', function() {
[148] Fix | Delete
var e = this;
[149] Fix | Delete
[150] Fix | Delete
setTimeout(function() {
[151] Fix | Delete
clearTimeout(coalescingUpdateTimer);
[152] Fix | Delete
coalescingUpdateTimer = setTimeout(updateIPPreview, 1000);
[153] Fix | Delete
[154] Fix | Delete
var optionElement = $(e).find('.wf-option.wf-option-select');
[155] Fix | Delete
var option = optionElement.data('textOption');
[156] Fix | Delete
var value = $(e).find('select').val();
[157] Fix | Delete
[158] Fix | Delete
var originalValue = optionElement.data('originalTextValue');
[159] Fix | Delete
if (originalValue == value) {
[160] Fix | Delete
delete WFAD.pendingChanges[option];
[161] Fix | Delete
}
[162] Fix | Delete
else {
[163] Fix | Delete
WFAD.pendingChanges[option] = value;
[164] Fix | Delete
}
[165] Fix | Delete
[166] Fix | Delete
WFAD.updatePendingChanges();
[167] Fix | Delete
}, 4);
[168] Fix | Delete
});
[169] Fix | Delete
[170] Fix | Delete
$(window).on('wfOptionsReset', function() {
[171] Fix | Delete
$('input[name="wf-howgetIPs"]').each(function() {
[172] Fix | Delete
var optionElement = $(this).closest('.wf-option.wf-option-howgetips');
[173] Fix | Delete
var option = optionElement.data('option');
[174] Fix | Delete
var originalValue = optionElement.data('originalValue');
[175] Fix | Delete
[176] Fix | Delete
$(this).prop('checked', originalValue == $(this).attr('value'));
[177] Fix | Delete
});
[178] Fix | Delete
[179] Fix | Delete
$('#howGetIPs-trusted-proxies textarea').each(function() {
[180] Fix | Delete
var optionElement = $(this).closest('.wf-option.wf-option-textarea');
[181] Fix | Delete
var originalValue = optionElement.data('originalTextAreaValue');
[182] Fix | Delete
$(this).val(originalValue);
[183] Fix | Delete
});
[184] Fix | Delete
[185] Fix | Delete
updateIPPreview();
[186] Fix | Delete
});
[187] Fix | Delete
[188] Fix | Delete
$('#howGetIPs-trusted-proxies-show').each(function() {
[189] Fix | Delete
$(this).on('keydown', function(e) {
[190] Fix | Delete
if (e.keyCode == 32) {
[191] Fix | Delete
e.preventDefault();
[192] Fix | Delete
e.stopPropagation();
[193] Fix | Delete
[194] Fix | Delete
$(this).trigger('click');
[195] Fix | Delete
}
[196] Fix | Delete
});
[197] Fix | Delete
[198] Fix | Delete
$(this).on('click', function(e) {
[199] Fix | Delete
e.preventDefault();
[200] Fix | Delete
e.stopPropagation();
[201] Fix | Delete
[202] Fix | Delete
var isActive = $('#howGetIPs-trusted-proxies').hasClass('wf-active');
[203] Fix | Delete
if (isActive) {
[204] Fix | Delete
$('#howGetIPs-trusted-proxies').slideUp({
[205] Fix | Delete
always: function() {
[206] Fix | Delete
$('#howGetIPs-trusted-proxies').removeClass('wf-active');
[207] Fix | Delete
}
[208] Fix | Delete
});
[209] Fix | Delete
[210] Fix | Delete
$('#howGetIPs-trusted-proxy-preset').slideUp({
[211] Fix | Delete
always: function() {
[212] Fix | Delete
$('#howGetIPs-trusted-proxy-preset').removeClass('wf-active');
[213] Fix | Delete
}
[214] Fix | Delete
});
[215] Fix | Delete
}
[216] Fix | Delete
else {
[217] Fix | Delete
$(this).parent().slideUp();
[218] Fix | Delete
$('#howGetIPs-trusted-proxies').slideDown({
[219] Fix | Delete
always: function() {
[220] Fix | Delete
$('#howGetIPs-trusted-proxies').addClass('wf-active');
[221] Fix | Delete
}
[222] Fix | Delete
});
[223] Fix | Delete
[224] Fix | Delete
$('#howGetIPs-trusted-proxy-preset').slideDown({
[225] Fix | Delete
always: function() {
[226] Fix | Delete
$('#howGetIPs-trusted-proxy-preset').addClass('wf-active');
[227] Fix | Delete
}
[228] Fix | Delete
});
[229] Fix | Delete
}
[230] Fix | Delete
});
[231] Fix | Delete
});
[232] Fix | Delete
});
[233] Fix | Delete
})(jQuery);
[234] Fix | Delete
</script>
[235] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function