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/wp-conte.../plugins/wordfenc.../views/blocking
File: blocking-create.php
<?php
[0] Fix | Delete
if (!defined('WORDFENCE_VERSION')) { exit; }
[1] Fix | Delete
[2] Fix | Delete
$wfBlockRange = filter_input(INPUT_GET, 'wfBlockRange', FILTER_DEFAULT, FILTER_REQUIRE_SCALAR);
[3] Fix | Delete
?>
[4] Fix | Delete
<ul class="wf-block-list wf-block-list-vertical">
[5] Fix | Delete
<li class="wf-flex-vertical wf-padding-add-top wf-padding-add-bottom">
[6] Fix | Delete
<table id="wf-create-block" class="wf-option">
[7] Fix | Delete
<tr>
[8] Fix | Delete
<th class="wf-right wf-padding-add-right"><?php echo wp_kses(__('<span class="wf-hidden-xs">Block </span>Type', 'wordfence'), array('span'=>array('class'=>array()))); ?></th>
[9] Fix | Delete
<td class="wf-block-type">
[10] Fix | Delete
<ul id="wf-block-type" class="wf-nav wf-nav-pills wf-nav-pills-bordered wf-nav-pills-connected">
[11] Fix | Delete
<li><a href="#" data-value="ip-address" data-new-button="<?php echo esc_attr(wp_kses(/* translators: word order may be altered as long as HTML remains around "this IP Address" */ __('Block<span class="wf-hidden-xs"> this IP Address</span>', 'wordfence'), array('span' => array('class' => array())))); ?>" role="button"><?php echo wp_kses(/* translators: word order may be altered as long as HTML remains around "Address" */ __('IP<span class="wf-hidden-xs"> Address</span>', 'wordfence'), array( 'span' => array( 'class' => array() ))); ?></a></li>
[12] Fix | Delete
<li><a href="#" data-value="country" data-new-button="<?php echo esc_attr(wp_kses(/* translators: word order may be altered as long as HTML remains around "the Selected Countries" */ __('Block<span class="wf-hidden-xs"> the Selected Countries</span>', 'wordfence'), array('span' => array('class' => array())))); ?>" data-edit-button="<?php echo esc_attr(wp_kses(/* translators: word order may be reversed as long as HTML remains around "Block" */ __('Update<span class="wf-hidden-xs"> Block</span>', 'wordfence'), array('span' => array('class' => array())))); ?>" role="button"><?php esc_html_e('Country', 'wordfence'); ?></a></li>
[13] Fix | Delete
<li<?php echo $wfBlockRange ? ' class="wf-active"' : '' ?>><a href="#" data-value="custom-pattern" data-new-button="<?php echo esc_attr(wp_kses(/* translators: word order may be altered as long as HTML remains around "Visitors Matching this Pattern" */ __('Block<span class="wf-hidden-xs"> Visitors Matching this Pattern</span>', 'wordfence'), array('span' => array('class' => array())))); ?>" role="button"><?php echo wp_kses(/* translators: word order may be reversed as long as HTML remains around "Custom" */ __('<span class="wf-hidden-xs">Custom </span>Pattern', 'wordfence'), array('span'=>array('class'=>array()))); ?></a></li>
[14] Fix | Delete
</ul>
[15] Fix | Delete
<script type="application/javascript">
[16] Fix | Delete
(function($) {
[17] Fix | Delete
WFAD.updateCreateBlockPattern = function() {
[18] Fix | Delete
var active = $('#wf-block-type > li.wf-active a').data('value');
[19] Fix | Delete
[20] Fix | Delete
var duration = Date.parse('t + ' + $('#wf-block-duration').val());
[21] Fix | Delete
if (duration === null || !$('#wf-block-duration').val() || $('#wf-block-duration').val() == 'forever') {
[22] Fix | Delete
duration = 0;
[23] Fix | Delete
}
[24] Fix | Delete
else {
[25] Fix | Delete
duration = (Date.now().getTime() - duration.getTime()) / 1000;
[26] Fix | Delete
}
[27] Fix | Delete
[28] Fix | Delete
var allowCreation = duration >= 0 && !!$('#wf-block-reason').val();
[29] Fix | Delete
if (active == 'ip-address') {
[30] Fix | Delete
allowCreation = allowCreation && $('#wf-block-ip').val() && WFAD.isValidIP($('#wf-block-ip').val());
[31] Fix | Delete
}
[32] Fix | Delete
else if (active == 'country') {
[33] Fix | Delete
var countries = $('#wf-block-country-countries').val() || [];
[34] Fix | Delete
allowCreation = allowCreation && ($('#wf-block-country-login .wf-option-checkbox').hasClass('wf-checked') || $('#wf-block-country-site .wf-option-checkbox').hasClass('wf-checked')) && countries.length > 0;
[35] Fix | Delete
}
[36] Fix | Delete
else if (active == 'custom-pattern') {
[37] Fix | Delete
allowCreation = allowCreation && (($('#wf-block-ip-range').val() && WFAD.parseIPRange($('#wf-block-ip-range').val())) || $('#wf-block-hostname').val() || $('#wf-block-user-agent').val() || $('#wf-block-referrer').val());
[38] Fix | Delete
}
[39] Fix | Delete
[40] Fix | Delete
$('#wf-block-add-save').toggleClass('wf-disabled', !allowCreation);
[41] Fix | Delete
};
[42] Fix | Delete
[43] Fix | Delete
$(function() {
[44] Fix | Delete
$('#wf-block-type a').on('click', function(e) {
[45] Fix | Delete
e.preventDefault();
[46] Fix | Delete
e.stopPropagation();
[47] Fix | Delete
[48] Fix | Delete
$('#wf-block-type > li').removeClass('wf-active');
[49] Fix | Delete
$(this).closest('li').addClass('wf-active');
[50] Fix | Delete
[51] Fix | Delete
$('#wf-block-duration, #wf-block-reason, #wf-block-ip, #wf-block-ip-range, #wf-block-hostname, #wf-block-user-agent, #wf-block-referrer').val('');
[52] Fix | Delete
[53] Fix | Delete
var title = $('#wf-block-parameters-title').data('newTitle');
[54] Fix | Delete
var saveButton = $('#wf-block-type > li.wf-active a').data('newButton');
[55] Fix | Delete
var active = $('#wf-block-type > li.wf-active a').data('value');
[56] Fix | Delete
if (active == 'ip-address') {
[57] Fix | Delete
$('.wf-block-add-country, .wf-block-add-pattern').hide();
[58] Fix | Delete
$('.wf-block-add-ip').show();
[59] Fix | Delete
}
[60] Fix | Delete
else if (active == 'country') {
[61] Fix | Delete
$('.wf-block-add-ip, .wf-block-add-pattern').hide();
[62] Fix | Delete
$('.wf-block-add-country').show();
[63] Fix | Delete
[64] Fix | Delete
$('#wf-block-reason').val('<?php esc_attr_e('Country Blocking', 'wordfence'); ?>');
[65] Fix | Delete
[66] Fix | Delete
if (!!$('#wf-blocks-wrapper').data('hasCountryBlock')) {
[67] Fix | Delete
title = $('#wf-block-parameters-title').data('editTitle');
[68] Fix | Delete
saveButton = $('#wf-block-type > li.wf-active a').data('editButton');
[69] Fix | Delete
[70] Fix | Delete
var editValues = $('#wf-blocks-wrapper').data('hasCountryBlock');
[71] Fix | Delete
$('.wf-block-edit').first().closest('tr').addClass('wf-editing');
[72] Fix | Delete
$('#wf-block-reason').val(editValues.reason);
[73] Fix | Delete
$('#wf-block-country-login .wf-option-checkbox').toggleClass('wf-checked', !!editValues.blockLogin);
[74] Fix | Delete
$('#wf-block-country-site .wf-option-checkbox').toggleClass('wf-checked', !!editValues.blockSite);
[75] Fix | Delete
$('#wf-block-country-countries').val(editValues.countries).trigger('change');
[76] Fix | Delete
}
[77] Fix | Delete
else {
[78] Fix | Delete
$('#wf-block-country-login .wf-option-checkbox').toggleClass('wf-checked', true);
[79] Fix | Delete
$('#wf-block-country-site .wf-option-checkbox').toggleClass('wf-checked', true);
[80] Fix | Delete
$('#wf-block-country-countries').val([]).trigger('change');
[81] Fix | Delete
}
[82] Fix | Delete
}
[83] Fix | Delete
else if (active == 'custom-pattern') {
[84] Fix | Delete
$('.wf-block-add-ip, .wf-block-add-country').hide();
[85] Fix | Delete
$('.wf-block-add-pattern').show();
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
$('#wf-block-parameters-title').text(title);
[89] Fix | Delete
$('#wf-block-add-save').html(saveButton);
[90] Fix | Delete
[91] Fix | Delete
$('.wf-block-add-common').show();
[92] Fix | Delete
});
[93] Fix | Delete
[94] Fix | Delete
$('#wf-block-type .wf-active a').triggerHandler('click');
[95] Fix | Delete
[96] Fix | Delete
<?php if ($wfBlockRange): ?>
[97] Fix | Delete
$('#wf-block-ip-range').val('<?php echo esc_attr($wfBlockRange); ?>');
[98] Fix | Delete
<?php endif; ?>
[99] Fix | Delete
[100] Fix | Delete
$('#wf-block-reason, #wf-block-ip, #wf-block-ip-range, #wf-block-hostname, #wf-block-user-agent, #wf-block-referrer').on('change paste keyup', function() {
[101] Fix | Delete
setTimeout(function() {
[102] Fix | Delete
WFAD.updateCreateBlockPattern();
[103] Fix | Delete
}, 4);
[104] Fix | Delete
});
[105] Fix | Delete
});
[106] Fix | Delete
})(jQuery);
[107] Fix | Delete
</script>
[108] Fix | Delete
</td>
[109] Fix | Delete
</tr>
[110] Fix | Delete
<tr class="" style="display: none;">
[111] Fix | Delete
<th class="wf-right wf-padding-add-right"><?php esc_html_e('Block Duration', 'wordfence'); ?></th>
[112] Fix | Delete
<td class="wf-option-text">
[113] Fix | Delete
<input id="wf-block-duration" type="text" placeholder="<?php esc_attr_e('Enter a duration (default is forever)', 'wordfence'); ?>">
[114] Fix | Delete
<script type="application/javascript">
[115] Fix | Delete
<?php
[116] Fix | Delete
$locale = get_locale();
[117] Fix | Delete
$locale = preg_replace('/_/', '-', $locale);
[118] Fix | Delete
$localizedDateJS = wfDateLocalization::localizationForLanguage($locale);
[119] Fix | Delete
if ($localizedDateJS === false) {
[120] Fix | Delete
$localizedDateJS = wfDateLocalization::localizationForLanguage('en-US');
[121] Fix | Delete
}
[122] Fix | Delete
echo $localizedDateJS;
[123] Fix | Delete
?>
[124] Fix | Delete
</script>
[125] Fix | Delete
<?php if (false): ?><script type="application/javascript" src="<?php echo esc_attr(wfUtils::getBaseURL() . 'js/date.js'); ?>"></script><?php endif; ?>
[126] Fix | Delete
</td>
[127] Fix | Delete
</tr>
[128] Fix | Delete
<?php if (wfConfig::get('isPaid')): ?>
[129] Fix | Delete
<tr class="wf-block-add-country" style="display: none;">
[130] Fix | Delete
<th class="wf-right wf-padding-add-right wf-padding-add-top-small"><?php echo wp_kses(__('<span class="wf-hidden-xs">What to </span>Block', 'wordfence'), array('span'=>array('class'=>array()))); ?></th>
[131] Fix | Delete
<td class="wf-padding-add-top-small wf-form-field">
[132] Fix | Delete
<div class="wf-option-checkboxes">
[133] Fix | Delete
<ul id="wf-block-country-login">
[134] Fix | Delete
<li class="wf-option-checkbox wf-checked"><i class="wf-ion-ios-checkmark-empty" aria-hidden="true"></i></li>
[135] Fix | Delete
<li class="wf-option-title"><?php esc_html_e('Login Form', 'wordfence'); ?></li>
[136] Fix | Delete
</ul>
[137] Fix | Delete
<ul id="wf-block-country-site">
[138] Fix | Delete
<li class="wf-option-checkbox wf-checked"><i class="wf-ion-ios-checkmark-empty" aria-hidden="true"></i></li>
[139] Fix | Delete
<li class="wf-option-title"><?php echo wp_kses(__('<span class="wf-hidden-xs">Block access to the rest of the site</span><span class="wf-visible-xs">Rest of site</span>', 'wordfence'), array('span'=>array('class'=>array()))); ?></li>
[140] Fix | Delete
</ul>
[141] Fix | Delete
</div>
[142] Fix | Delete
</td>
[143] Fix | Delete
</tr>
[144] Fix | Delete
<tr class="wf-block-add-country" style="display: none;">
[145] Fix | Delete
<th class="wf-right wf-padding-add-right wf-padding-add-top-small"></th>
[146] Fix | Delete
<td class="wf-padding-add-top-small wf-form-field">
[147] Fix | Delete
<em><?php echo wp_kses(sprintf(/* translators: Support URL */ __('If you use Google Ads, blocking countries from accessing the entire site is not recommended. <a href="%s" target="_blank" rel="noopener noreferrer">Learn More<span class="screen-reader-text"> (opens in new tab)</span></a>', 'wordfence'), wfSupportController::supportURL(wfSupportController::ITEM_FIREWALL_BLOCKING_FULL_SITE)), array('a'=>array('href'=>array(), 'target'=>array(), 'rel'=>array()), 'span'=>array('class'=>array()))); ?></em>
[148] Fix | Delete
</td>
[149] Fix | Delete
</tr>
[150] Fix | Delete
<tr class="wf-block-add-country" style="display: none;">
[151] Fix | Delete
<th class="wf-right wf-padding-add-right wf-padding-add-top-small"><?php echo wp_kses(/* translators: word order may be altered as long as HTML remains around "to Block" */ __('Countries<span class="wf-hidden-xs"> to Block</span>', 'wordfence'), array('span'=>array('class'=>array()))); ?><br><a href="#" id="wf-block-country-countries-popup" role="button"><?php echo wp_kses(/* translators: word order may be reversed as long as HTML remains around "from List" */ __('Pick<span class="wf-hidden-xs"> from List</span>', 'wordfence'), array('span'=>array('class'=>array()))); ?></a></th>
[152] Fix | Delete
<td class="wf-option-text wf-padding-add-top-small">
[153] Fix | Delete
<select id="wf-block-country-countries" multiple>
[154] Fix | Delete
<?php
[155] Fix | Delete
require(WORDFENCE_PATH . 'lib/wfBulkCountries.php'); /** @var array $wfBulkCountries */
[156] Fix | Delete
asort($wfBulkCountries);
[157] Fix | Delete
foreach ($wfBulkCountries as $code => $name):
[158] Fix | Delete
?>
[159] Fix | Delete
<option value="<?php echo esc_attr($code); ?>"><?php echo esc_html($name); ?></option>
[160] Fix | Delete
<?php endforeach; ?>
[161] Fix | Delete
</select>
[162] Fix | Delete
</td>
[163] Fix | Delete
</tr>
[164] Fix | Delete
<tr class="wf-block-add-country" style="display: none;">
[165] Fix | Delete
<th class="wf-right wf-padding-add-right wf-padding-add-top-small"></th>
[166] Fix | Delete
<td class="wf-option-text wf-padding-add-top-small">
[167] Fix | Delete
<div id="wf-block-country-countries-tags"></div>
[168] Fix | Delete
</td>
[169] Fix | Delete
</tr>
[170] Fix | Delete
<?php else: ?>
[171] Fix | Delete
<tr class="wf-block-add-country" style="display: none;">
[172] Fix | Delete
<td colspan="2">
[173] Fix | Delete
<ul class="wf-flex-vertical">
[174] Fix | Delete
<li><h3><?php esc_html_e('Put Geographic Protection In Place With Country Blocking', 'wordfence'); ?></h3></li>
[175] Fix | Delete
<li><p class="wf-no-top"><?php esc_html_e('Wordfence country blocking is designed to stop an attack, prevent content theft, or end malicious activity that originates from a geographic region in less than 1/300,000th of a second. Blocking countries who are regularly creating failed logins, a large number of page not found errors, and are clearly engaged in malicious activity is an effective way to protect your site during an attack.', 'wordfence'); ?></p></li>
[176] Fix | Delete
<li><?php echo wfView::create('blocking/country-block-map')->render(); ?></li>
[177] Fix | Delete
<li><a class="wf-btn wf-btn-primary wf-btn-callout-subtle" href="https://www.wordfence.com/gnl1countryBlockUpgrade/wordfence-signup/" target="_blank" rel="noopener noreferrer"><?php esc_html_e('Upgrade to Premium', 'wordfence'); ?><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a></li>
[178] Fix | Delete
</ul>
[179] Fix | Delete
</td>
[180] Fix | Delete
</tr>
[181] Fix | Delete
<?php endif; ?>
[182] Fix | Delete
<tr class="wf-block-add-ip" style="display: none;">
[183] Fix | Delete
<th class="wf-right wf-padding-add-right wf-padding-add-top-small"><?php echo wp_kses(__('IP<span class="wf-hidden-xs"> Address to Block</span>', 'wordfence'), array('span'=>array('class'=>array()))); ?></th>
[184] Fix | Delete
<td class="wf-option-text wf-padding-add-top-small"><input id="wf-block-ip" type="text" placeholder="<?php esc_attr_e('Enter an IP address', 'wordfence'); ?>"></td>
[185] Fix | Delete
</tr>
[186] Fix | Delete
<tr class="wf-block-add-pattern" style="display: none;">
[187] Fix | Delete
<th class="wf-right wf-padding-add-right wf-padding-add-top-small"><?php echo wp_kses(__('IP<span class="wf-hidden-xs"> Address</span> Range', 'wordfence'), array('span'=>array('class'=>array()))); ?></th>
[188] Fix | Delete
<td class="wf-option-text wf-padding-add-top-small"><input id="wf-block-ip-range" type="text" placeholder="<?php esc_attr_e('e.g., 192.168.200.200 - 192.168.200.220 or 192.168.200.0/24', 'wordfence'); ?>"></td>
[189] Fix | Delete
</tr>
[190] Fix | Delete
<tr class="wf-block-add-pattern" style="display: none;">
[191] Fix | Delete
<th class="wf-right wf-padding-add-right wf-padding-add-top-small"><?php esc_html_e('Hostname', 'wordfence'); ?></th>
[192] Fix | Delete
<td class="wf-option-text wf-padding-add-top-small"><input id="wf-block-hostname" type="text" placeholder="<?php esc_attr_e('e.g., *.amazonaws.com or *.linode.com', 'wordfence'); ?>"></td>
[193] Fix | Delete
</tr>
[194] Fix | Delete
<tr class="wf-block-add-pattern" style="display: none;">
[195] Fix | Delete
<th class="wf-right wf-padding-add-right wf-padding-add-top-small"><?php echo wp_kses(__('<span class="wf-hidden-xs">Browser </span>User Agent', 'wordfence'), array('span'=>array('class'=>array()))); ?></th>
[196] Fix | Delete
<td class="wf-option-text wf-padding-add-top-small"><input id="wf-block-user-agent" type="text" placeholder="<?php esc_attr_e('e.g., *badRobot*, *MSIE*, or *browserSuffix', 'wordfence'); ?>"></td>
[197] Fix | Delete
</tr>
[198] Fix | Delete
<tr class="wf-block-add-pattern" style="display: none;">
[199] Fix | Delete
<th class="wf-right wf-padding-add-right wf-padding-add-top-small"><?php esc_html_e('Referrer', 'wordfence'); ?></th>
[200] Fix | Delete
<td class="wf-option-text wf-padding-add-top-small"><input id="wf-block-referrer" type="text" placeholder="<?php esc_attr_e('e.g., *badwebsite.example.com*', 'wordfence'); ?>"></td>
[201] Fix | Delete
</tr>
[202] Fix | Delete
<tr class="wf-block-add-ip wf-block-add-pattern" style="display: none;">
[203] Fix | Delete
<th class="wf-right wf-padding-add-right wf-padding-add-top-small"><?php echo wp_kses(__('<span class="wf-hidden-xs">Block </span>Reason', 'wordfence'), array('span'=>array('class'=>array()))); ?><span class="wf-red-dark">*</span></th>
[204] Fix | Delete
<td class="wf-option-text wf-padding-add-top-small"><input id="wf-block-reason" type="text" placeholder="<?php esc_attr_e('Enter a reason', 'wordfence'); ?>" maxlength="50"></td>
[205] Fix | Delete
</tr>
[206] Fix | Delete
</table>
[207] Fix | Delete
</li>
[208] Fix | Delete
<li class="<?php echo (wfConfig::get('isPaid') ? 'wf-block-add-common' : 'wf-block-add-ip wf-block-add-pattern'); ?>" style="display: none;">
[209] Fix | Delete
<div class="wf-right wf-padding-add-top wf-padding-add-bottom">
[210] Fix | Delete
<a id="wf-block-add-cancel" class="wf-btn wf-btn-default wf-btn-callout-subtle" href="#" role="button"><?php esc_html_e('Cancel', 'wordfence'); ?></a>&nbsp;&nbsp;<a id="wf-block-add-save" class="wf-btn wf-btn-primary wf-btn-callout-subtle wf-disabled" href="#"><?php echo wp_kses(/* translators: word order may be altered as long as HTML remains around "Visitors Matching this" */ __('Block<span class="wf-hidden-xs"> Visitors Matching this</span> Pattern', 'wordfence'), array('span'=>array('class'=>array()))); ?></a>
[211] Fix | Delete
<script type="application/javascript">
[212] Fix | Delete
(function($) {
[213] Fix | Delete
$(function() {
[214] Fix | Delete
$('.wf-option-checkboxes .wf-option-checkbox').each(function() {
[215] Fix | Delete
$(this).on('click', function(e) {
[216] Fix | Delete
e.preventDefault();
[217] Fix | Delete
e.stopPropagation();
[218] Fix | Delete
[219] Fix | Delete
$(this).toggleClass('wf-checked');
[220] Fix | Delete
WFAD.updateCreateBlockPattern();
[221] Fix | Delete
});
[222] Fix | Delete
});
[223] Fix | Delete
[224] Fix | Delete
$('#wf-block-country-countries').wfselect2({
[225] Fix | Delete
tags: true,
[226] Fix | Delete
tokenSeparators: [',', ' '],
[227] Fix | Delete
placeholder: "Hit enter to add",
[228] Fix | Delete
width: 'element',
[229] Fix | Delete
minimumResultsForSearch: 1,
[230] Fix | Delete
minimumInputLength: 2,
[231] Fix | Delete
selectOnClose: false,
[232] Fix | Delete
createTag: function (params) {
[233] Fix | Delete
return null; //No custom tags
[234] Fix | Delete
},
[235] Fix | Delete
sorter: function(results) {
[236] Fix | Delete
var term = $('#wf-block-country-countries').data('wfselect2').$container.find('.wfselect2-search__field').val();
[237] Fix | Delete
if (term) {
[238] Fix | Delete
var escapedTerm = term.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&');
[239] Fix | Delete
var termRegex = new RegExp('^' + escapedTerm, 'i');
[240] Fix | Delete
return results.sort(function(a, b) {
[241] Fix | Delete
var aPrefix = termRegex.test(a.text);
[242] Fix | Delete
var bPrefix = termRegex.test(b.text);
[243] Fix | Delete
if (aPrefix && !bPrefix) { return -1; }
[244] Fix | Delete
if (!aPrefix && bPrefix) { return 1; }
[245] Fix | Delete
return a.text.localeCompare(b.text);
[246] Fix | Delete
});
[247] Fix | Delete
}
[248] Fix | Delete
return results;
[249] Fix | Delete
}
[250] Fix | Delete
}).on('change', function () {
[251] Fix | Delete
var selected = $(this).find('option:selected');
[252] Fix | Delete
var container = $('#wf-block-country-countries-tags');
[253] Fix | Delete
[254] Fix | Delete
var list = $('<ul>');
[255] Fix | Delete
selected.each(function(index, value) {
[256] Fix | Delete
var li = $('<li class="wf-tag-selected' + (index > 4 && !container.data('expanded') ? ' wf-hidden' : '') + '"><a class="wf-destroy-tag-selected">×</a>' + $(value).text() + '</li>');
[257] Fix | Delete
li.children('a.wf-destroy-tag-selected')
[258] Fix | Delete
.off('click.wfselect2-copy')
[259] Fix | Delete
.on('click.wfselect2-copy', function(e) {
[260] Fix | Delete
var opt = $(this).data('wfselect2-opt');
[261] Fix | Delete
opt.prop('selected', false);
[262] Fix | Delete
opt.parents('select').trigger('change');
[263] Fix | Delete
}).data('wfselect2-opt', $(value));
[264] Fix | Delete
list.append(li);
[265] Fix | Delete
});
[266] Fix | Delete
[267] Fix | Delete
if (selected.length > 5) {
[268] Fix | Delete
if (!container.data('expanded')) {
[269] Fix | Delete
list.append($('<li class="wf-tags-show-hide-more"><a href="#" role="button">and ' + (selected.length - 5) + ' more...' + '</a></li>'));
[270] Fix | Delete
}
[271] Fix | Delete
else {
[272] Fix | Delete
list.append($('<li class="wf-tags-show-hide-more"><a href="#" role="button">Hide' + '</a></li>'));
[273] Fix | Delete
}
[274] Fix | Delete
}
[275] Fix | Delete
[276] Fix | Delete
container.html('').append(list);
[277] Fix | Delete
[278] Fix | Delete
$('.wf-tags-show-hide-more').on('click', function(e) {
[279] Fix | Delete
e.preventDefault();
[280] Fix | Delete
e.stopPropagation();
[281] Fix | Delete
[282] Fix | Delete
var expanded = !!container.data('expanded');
[283] Fix | Delete
$('.wf-tag-selected').slice(5).toggleClass('wf-hidden', expanded);
[284] Fix | Delete
container.data('expanded', !expanded);
[285] Fix | Delete
[286] Fix | Delete
$(this).find('a').text(expanded ? 'and ' + (selected.length - 5) + ' more...' : 'Hide');
[287] Fix | Delete
});
[288] Fix | Delete
[289] Fix | Delete
WFAD.updateCreateBlockPattern();
[290] Fix | Delete
}).triggerHandler('change');
[291] Fix | Delete
[292] Fix | Delete
if ($('#wf-block-country-countries').length > 0) {
[293] Fix | Delete
$('#wf-block-country-countries').data('wfselect2').$container.addClass('wf-select2-placeholder-fix wf-select2-hide-tags');
[294] Fix | Delete
}
[295] Fix | Delete
[296] Fix | Delete
$('#wf-block-country-countries-popup').on('click', function(e) {
[297] Fix | Delete
e.preventDefault();
[298] Fix | Delete
e.stopPropagation();
[299] Fix | Delete
[300] Fix | Delete
var content = $('#wfTmpl_countrySelector').tmpl();
[301] Fix | Delete
$(content).find('#wf-country-selector-confirm').text($('#wf-block-add-save').text());
[302] Fix | Delete
[303] Fix | Delete
var modal = $(content);
[304] Fix | Delete
var countries = {};
[305] Fix | Delete
var currentSelection = $('#wf-block-country-countries').val() || [];
[306] Fix | Delete
for (var i = 0; i < currentSelection.length; i++) {
[307] Fix | Delete
countries[currentSelection[i]] = 1;
[308] Fix | Delete
modal.find('li[data-country="' + currentSelection[i] + '"]').addClass('wf-active');
[309] Fix | Delete
}
[310] Fix | Delete
modal.data('countries', countries);
[311] Fix | Delete
[312] Fix | Delete
$.wfDrawer({
[313] Fix | Delete
width: WFAD.isSmallScreen ? '320px' : '800px',
[314] Fix | Delete
content: content,
[315] Fix | Delete
onComplete: function() {
[316] Fix | Delete
var updateCount = function() {
[317] Fix | Delete
var count = $('.wf-blocked-countries li.wf-active').length;
[318] Fix | Delete
$('#wf-country-selector-count').text(count + (count == 1 ? ' Country Selected' : ' Countries Selected'));
[319] Fix | Delete
};
[320] Fix | Delete
updateCount();
[321] Fix | Delete
[322] Fix | Delete
$('.wf-blocked-countries a').on('click', function(e) {
[323] Fix | Delete
e.preventDefault();
[324] Fix | Delete
e.stopPropagation();
[325] Fix | Delete
[326] Fix | Delete
$(this).closest('li').trigger('click');
[327] Fix | Delete
});
[328] Fix | Delete
[329] Fix | Delete
$('.wf-blocked-countries li').on('click', function(e) {
[330] Fix | Delete
e.preventDefault();
[331] Fix | Delete
e.stopPropagation();
[332] Fix | Delete
[333] Fix | Delete
var modal = $('#wf-country-selector');
[334] Fix | Delete
var countries = modal.data('countries');
[335] Fix | Delete
var country = $(this).data('country');
[336] Fix | Delete
[337] Fix | Delete
$(this).toggleClass('wf-active');
[338] Fix | Delete
if ($(this).hasClass('wf-active')) {
[339] Fix | Delete
countries[country] = 1;
[340] Fix | Delete
}
[341] Fix | Delete
else {
[342] Fix | Delete
delete countries[country];
[343] Fix | Delete
}
[344] Fix | Delete
[345] Fix | Delete
modal.data('countries', countries);
[346] Fix | Delete
updateCount();
[347] Fix | Delete
});
[348] Fix | Delete
[349] Fix | Delete
$('#wf-country-selector-block-all').on('click', function(e) {
[350] Fix | Delete
e.preventDefault();
[351] Fix | Delete
e.stopPropagation();
[352] Fix | Delete
[353] Fix | Delete
var modal = $('#wf-country-selector');
[354] Fix | Delete
var countries = {};
[355] Fix | Delete
modal.find('li[data-country]').addClass('wf-active').each(function() {
[356] Fix | Delete
countries[$(this).data('country')] = 1;
[357] Fix | Delete
});
[358] Fix | Delete
[359] Fix | Delete
modal.data('countries', countries);
[360] Fix | Delete
updateCount();
[361] Fix | Delete
});
[362] Fix | Delete
[363] Fix | Delete
$('#wf-country-selector-unblock-all').on('click', function(e) {
[364] Fix | Delete
e.preventDefault();
[365] Fix | Delete
e.stopPropagation();
[366] Fix | Delete
[367] Fix | Delete
var modal = $('#wf-country-selector');
[368] Fix | Delete
modal.data('countries', {});
[369] Fix | Delete
modal.find('li[data-country]').removeClass('wf-active');
[370] Fix | Delete
updateCount();
[371] Fix | Delete
});
[372] Fix | Delete
[373] Fix | Delete
$('.wf-country-selector-section-options li a').on('click', function(e) {
[374] Fix | Delete
e.preventDefault();
[375] Fix | Delete
e.stopPropagation();
[376] Fix | Delete
[377] Fix | Delete
$(this).closest('li').trigger('click');
[378] Fix | Delete
});
[379] Fix | Delete
[380] Fix | Delete
$('.wf-country-selector-section-options li').on('click', function(e) {
[381] Fix | Delete
e.preventDefault();
[382] Fix | Delete
e.stopPropagation();
[383] Fix | Delete
[384] Fix | Delete
var letter = $(this).find('a').data('letter');
[385] Fix | Delete
var scrollTarget = $('.wf-blocked-countries[data-letter="' + letter + '"]');
[386] Fix | Delete
$('.wf-country-selector-inner-wrapper').animate({
[387] Fix | Delete
scrollTop: $('.wf-country-selector-inner-wrapper').scrollTop() + scrollTarget.offset().top - $('.wf-country-selector-inner-wrapper').offset().top
[388] Fix | Delete
}, 500);
[389] Fix | Delete
});
[390] Fix | Delete
[391] Fix | Delete
$('#wf-country-selector-cancel').on('click', function(e) { //Commits but doesn't save
[392] Fix | Delete
e.preventDefault();
[393] Fix | Delete
e.stopPropagation();
[394] Fix | Delete
[395] Fix | Delete
var modal = $('#wf-country-selector');
[396] Fix | Delete
var countries = Object.keys(modal.data('countries')) || [];
[397] Fix | Delete
$('#wf-block-country-countries').val(countries).trigger('change');
[398] Fix | Delete
[399] Fix | Delete
$.wfDrawer.close()
[400] Fix | Delete
});
[401] Fix | Delete
[402] Fix | Delete
$('#wf-country-selector-confirm').on('click', function(e) { //Commits and saves
[403] Fix | Delete
e.preventDefault();
[404] Fix | Delete
e.stopPropagation();
[405] Fix | Delete
[406] Fix | Delete
var modal = $('#wf-country-selector');
[407] Fix | Delete
var countries = Object.keys(modal.data('countries')) || [];
[408] Fix | Delete
$('#wf-block-country-countries').val(countries).trigger('change');
[409] Fix | Delete
$('#wf-block-add-save').trigger('click');
[410] Fix | Delete
[411] Fix | Delete
$.wfDrawer.close()
[412] Fix | Delete
});
[413] Fix | Delete
}});
[414] Fix | Delete
});
[415] Fix | Delete
[416] Fix | Delete
$('#wf-block-add-cancel').on('click', function(e) {
[417] Fix | Delete
e.preventDefault();
[418] Fix | Delete
e.stopPropagation();
[419] Fix | Delete
[420] Fix | Delete
$('.wf-blocks-table > tbody > tr').removeClass('wf-editing');
[421] Fix | Delete
$('#wf-block-parameters-title').text($('#wf-block-parameters-title').data('newTitle'));
[422] Fix | Delete
$('#wf-block-type > li').removeClass('wf-active');
[423] Fix | Delete
$('.wf-block-add-common, .wf-block-add-ip, .wf-block-add-country, .wf-block-add-pattern').hide();
[424] Fix | Delete
$('#wf-block-duration, #wf-block-reason, #wf-block-ip, #wf-block-ip-range, #wf-block-hostname, #wf-block-user-agent, #wf-block-referrer').val('');
[425] Fix | Delete
});
[426] Fix | Delete
[427] Fix | Delete
$('#wf-block-add-save').on('click', function(e) {
[428] Fix | Delete
var selectedCountries = $('#wf-block-country-countries').val() || [];
[429] Fix | Delete
var blockSite = $('#wf-block-country-site .wf-option-checkbox').hasClass('wf-checked') ? 1 : 0;
[430] Fix | Delete
var button = $(this);
[431] Fix | Delete
var includesUs = false;
[432] Fix | Delete
for (var index in selectedCountries) {
[433] Fix | Delete
if (selectedCountries[index] === 'US') {
[434] Fix | Delete
includesUs = true;
[435] Fix | Delete
break;
[436] Fix | Delete
}
[437] Fix | Delete
}
[438] Fix | Delete
if (includesUs && blockSite && !button.data('acknowledged')) {
[439] Fix | Delete
var modal = $("#wfTmpl_blockUnitedStatesPrompt").tmpl();
[440] Fix | Delete
var modalHtml = $("<div>").append(modal).html();
[441] Fix | Delete
WFAD.colorboxHTML(
[442] Fix | Delete
WFAD.isSmallScreen ? '300px' : '400px',
[443] Fix | Delete
modalHtml,
[444] Fix | Delete
{
[445] Fix | Delete
onComplete: function() {
[446] Fix | Delete
$('#wf-us-blocking-prompt-cancel').on('click', function(e) {
[447] Fix | Delete
e.preventDefault();
[448] Fix | Delete
e.stopPropagation();
[449] Fix | Delete
WFAD.colorboxClose();
[450] Fix | Delete
});
[451] Fix | Delete
$('#wf-us-blocking-prompt-continue').on('click', function(e) {
[452] Fix | Delete
e.preventDefault();
[453] Fix | Delete
e.stopPropagation();
[454] Fix | Delete
button.data('acknowledged', true);
[455] Fix | Delete
WFAD.colorboxClose();
[456] Fix | Delete
button.trigger('click');
[457] Fix | Delete
});
[458] Fix | Delete
},
[459] Fix | Delete
className: 'wf-modal',
[460] Fix | Delete
closeButton: false,
[461] Fix | Delete
overlayClose: false
[462] Fix | Delete
}
[463] Fix | Delete
);
[464] Fix | Delete
return;
[465] Fix | Delete
}
[466] Fix | Delete
button.data('acknowledged', false);
[467] Fix | Delete
e.preventDefault();
[468] Fix | Delete
e.stopPropagation();
[469] Fix | Delete
[470] Fix | Delete
var active = $('#wf-block-type > li.wf-active a').data('value');
[471] Fix | Delete
var payload = {type: active};
[472] Fix | Delete
[473] Fix | Delete
payload['duration'] = Date.parse('t + ' + $('#wf-block-duration').val());
[474] Fix | Delete
if (payload['duration'] === null || !$('#wf-block-duration').val() || $('#wf-block-duration').val() == 'forever') {
[475] Fix | Delete
payload['duration'] = 0;
[476] Fix | Delete
}
[477] Fix | Delete
else {
[478] Fix | Delete
payload['duration'] = (Date.now().getTime() - payload['duration'].getTime()) / 1000;
[479] Fix | Delete
}
[480] Fix | Delete
[481] Fix | Delete
payload['reason'] = $('#wf-block-reason').val();
[482] Fix | Delete
if (active == 'ip-address') {
[483] Fix | Delete
payload['ip'] = $('#wf-block-ip').val();
[484] Fix | Delete
}
[485] Fix | Delete
else if (active == 'country') {
[486] Fix | Delete
payload['blockLogin'] = $('#wf-block-country-login .wf-option-checkbox').hasClass('wf-checked') ? 1 : 0;
[487] Fix | Delete
payload['blockSite'] = blockSite;
[488] Fix | Delete
payload['countries'] = selectedCountries;
[489] Fix | Delete
}
[490] Fix | Delete
else if (active == 'custom-pattern') {
[491] Fix | Delete
payload['ipRange'] = $('#wf-block-ip-range').val();
[492] Fix | Delete
payload['hostname'] = $('#wf-block-hostname').val();
[493] Fix | Delete
payload['userAgent'] = $('#wf-block-user-agent').val();
[494] Fix | Delete
payload['referrer'] = $('#wf-block-referrer').val();
[495] Fix | Delete
}
[496] Fix | Delete
[497] Fix | Delete
WFAD.loadingBlocks = true;
[498] Fix | Delete
WFAD.ajax('wordfence_createBlock', {payload: JSON.stringify(payload), sortColumn: WFAD.sortColumn, sortDirection: WFAD.sortDirection, blocksFilter: WFAD.blocksFilter}, function(res) {
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function