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: block-list.php
<?php
[0] Fix | Delete
if (!defined('WORDFENCE_VERSION')) { exit; }
[1] Fix | Delete
/**
[2] Fix | Delete
* Presents the list of blocks.
[3] Fix | Delete
*
[4] Fix | Delete
*/
[5] Fix | Delete
?>
[6] Fix | Delete
<div class="wf-row">
[7] Fix | Delete
<div class="wf-col-xs-12">
[8] Fix | Delete
<div class="wf-flex-horizontal wf-flex-full-width wf-add-bottom-small">
[9] Fix | Delete
<h3 class="wf-no-top wf-no-bottom"><?php echo wp_kses(sprintf(/* translators: Site URL */ __('Current blocks<span class="wf-hidden-xs"> for %s</span>', 'wordfence'), preg_replace('/^https?:\/\//i', '', wfUtils::wpSiteURL())), array('span'=>array('class'=>array()))); ?></h3>
[10] Fix | Delete
<div class="wf-right">
[11] Fix | Delete
<div class="wf-inline-block">
[12] Fix | Delete
<ul class="wf-option wf-option-toggled-boolean-switch wf-option-no-spacing" data-option="displayAutomaticBlocks" data-enabled-value="1" data-disabled-value="0" data-original-value="<?php echo wfConfig::get('displayAutomaticBlocks') ? 1 : 0; ?>">
[13] Fix | Delete
<li class="wf-boolean-switch<?php echo wfConfig::get('displayAutomaticBlocks') ? ' wf-active' : ''; ?>"><a href="#" class="wf-boolean-switch-handle"></a></li>
[14] Fix | Delete
<li class="wf-option-title wf-padding-add-left wf-no-right wf-padding-no-right">
[15] Fix | Delete
<?php echo wp_kses(__('Show<span class="wf-hidden-xs"> Wordfence</span> Automatic<span class="wf-hidden-xs"> Blocks</span>', 'wordfence'), array('span'=>array('class'=>array()))); ?>
[16] Fix | Delete
</li>
[17] Fix | Delete
</ul>
[18] Fix | Delete
</div>
[19] Fix | Delete
</div>
[20] Fix | Delete
</div>
[21] Fix | Delete
</div>
[22] Fix | Delete
</div>
[23] Fix | Delete
<div class="wf-row">
[24] Fix | Delete
<div class="wf-col-xs-12">
[25] Fix | Delete
<div class="wf-row">
[26] Fix | Delete
<div class="wf-col-xs-12">
[27] Fix | Delete
<div class="wf-block wf-block-no-header wf-active">
[28] Fix | Delete
<div class="wf-block-content wf-padding-add-top-large wf-padding-add-bottom-large">
[29] Fix | Delete
<ul class="wf-flex-horizontal wf-flex-vertical-xs wf-flex-full-width wf-flex-grow-all wf-no-top">
[30] Fix | Delete
<li class="wf-padding-add-bottom-xs">
[31] Fix | Delete
<ul class="wf-flex-horizontal wf-flex-full-width wf-flex-grow-first wf-no-top">
[32] Fix | Delete
<li><input type="text" placeholder="<?php esc_attr_e('Filter by Type, Detail, or Reason', 'wordfence'); ?>" id="wf-blocks-filter-field" class="wf-input-text"></li>
[33] Fix | Delete
<li class="wf-padding-add-left-medium"><a href="#" id="wf-blocks-apply-filter" class="wf-btn wf-btn-callout wf-btn-default" role="button"><?php esc_html_e('Filter', 'wordfence'); ?></a>&nbsp;&nbsp;<a href="<?php echo wfSupportController::esc_supportURL(wfSupportController::ITEM_FIREWALL_BLOCKING_FILTER); ?>" 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>
[34] Fix | Delete
</ul>
[35] Fix | Delete
</li>
[36] Fix | Delete
<li class="wf-right wf-flex-vertical-xs">
[37] Fix | Delete
<a href="#" id="blocks-bulk-unblock" class="wf-btn wf-btn-callout wf-btn-default" role="button"><?php esc_html_e('Unblock', 'wordfence'); ?></a>&nbsp;&nbsp;<a href="#" id="blocks-bulk-make-permanent" class="wf-btn wf-btn-callout wf-btn-default"><?php esc_html_e('Make Permanent', 'wordfence'); ?></a>&nbsp;&nbsp;<a href="<?php echo wfUtils::siteURLRelative(); ?>?_wfsf=blockedIPs&amp;nonce=<?php echo wp_create_nonce('wp-ajax'); ?>" id="blocks-export-ips" class="wf-btn wf-btn-callout wf-btn-default"><?php echo wp_kses(/* translators: word order may be altered as long as HTML remains around "All IPs" */ __('Export<span class="wf-hidden-xs"> All IPs</span>', 'wordfence'), array('span'=>array('class'=>array()))); ?></a>
[38] Fix | Delete
</li>
[39] Fix | Delete
</ul>
[40] Fix | Delete
<div class="wf-block wf-block-no-padding wf-block-no-header wf-active wf-no-bottom wf-overflow-y-auto-xs">
[41] Fix | Delete
<div class="wf-block-content">
[42] Fix | Delete
<div id="wf-blocks-wrapper"></div>
[43] Fix | Delete
</div>
[44] Fix | Delete
</div>
[45] Fix | Delete
</div>
[46] Fix | Delete
</div>
[47] Fix | Delete
</div>
[48] Fix | Delete
</div>
[49] Fix | Delete
</div>
[50] Fix | Delete
</div> <!-- end block list -->
[51] Fix | Delete
<script type="text/x-jquery-template" id="wf-blocks-tmpl">
[52] Fix | Delete
<div class="wf-blocks-table-container">
[53] Fix | Delete
<table class="wf-striped-table wf-blocks-table">
[54] Fix | Delete
<thead>
[55] Fix | Delete
</thead>
[56] Fix | Delete
<tbody>
[57] Fix | Delete
</tbody>
[58] Fix | Delete
<tfoot>
[59] Fix | Delete
</tfoot>
[60] Fix | Delete
</table>
[61] Fix | Delete
</div>
[62] Fix | Delete
</script>
[63] Fix | Delete
<script type="text/x-jquery-template" id="wf-blocks-columns-tmpl">
[64] Fix | Delete
<tr class="wf-blocks-columns">
[65] Fix | Delete
<th style="width: 2%;text-align: center"><div class="wf-blocks-bulk-select wf-option-checkbox"><i class="wf-ion-ios-checkmark-empty" aria-hidden="true"></i></div></th>
[66] Fix | Delete
<th data-column="type" class="wf-sortable wf-unsorted"><?php esc_html_e('Block Type', 'wordfence'); ?> <i class="wf-sorted-ascending wf-ion-android-arrow-dropup" aria-hidden="true"></i><i class="wf-sorted-descending wf-ion-android-arrow-dropdown" aria-hidden="true"></i></th>
[67] Fix | Delete
<th data-column="detail" class="wf-sortable wf-unsorted"><?php esc_html_e('Detail', 'wordfence'); ?> <i class="wf-sorted-ascending wf-ion-android-arrow-dropup" aria-hidden="true"></i><i class="wf-sorted-descending wf-ion-android-arrow-dropdown" aria-hidden="true"></i></th>
[68] Fix | Delete
<th data-column="ruleAdded" class="wf-sortable wf-unsorted"><?php esc_html_e('Rule Added', 'wordfence'); ?> <i class="wf-sorted-ascending wf-ion-android-arrow-dropup" aria-hidden="true"></i><i class="wf-sorted-descending wf-ion-android-arrow-dropdown" aria-hidden="true"></i></th>
[69] Fix | Delete
<th data-column="reason" class="wf-sortable wf-unsorted"><?php esc_html_e('Reason', 'wordfence'); ?> <i class="wf-sorted-ascending wf-ion-android-arrow-dropup" aria-hidden="true"></i><i class="wf-sorted-descending wf-ion-android-arrow-dropdown" aria-hidden="true"></i></th>
[70] Fix | Delete
<th data-column="expiration" class="wf-sortable wf-unsorted"><?php esc_html_e('Expiration', 'wordfence'); ?> <i class="wf-sorted-ascending wf-ion-android-arrow-dropup" aria-hidden="true"></i><i class="wf-sorted-descending wf-ion-android-arrow-dropdown" aria-hidden="true"></i></th>
[71] Fix | Delete
<th data-column="blockCount" class="wf-sortable wf-unsorted"><?php esc_html_e('Block Count', 'wordfence'); ?> <i class="wf-sorted-ascending wf-ion-android-arrow-dropup" aria-hidden="true"></i><i class="wf-sorted-descending wf-ion-android-arrow-dropdown" aria-hidden="true"></i></th>
[72] Fix | Delete
<th data-column="lastAttempt" class="wf-sortable wf-unsorted"><?php esc_html_e('Last Attempt', 'wordfence'); ?> <i class="wf-sorted-ascending wf-ion-android-arrow-dropup" aria-hidden="true"></i><i class="wf-sorted-descending wf-ion-android-arrow-dropdown" aria-hidden="true"></i></th>
[73] Fix | Delete
</tr>
[74] Fix | Delete
</script>
[75] Fix | Delete
<script type="text/x-jquery-template" id="wf-no-blocks-tmpl">
[76] Fix | Delete
<tr id="wf-no-blocks">
[77] Fix | Delete
<td colspan="8"><?php esc_html_e('No blocks are currently active.', 'wordfence'); ?></td>
[78] Fix | Delete
</tr>
[79] Fix | Delete
</script>
[80] Fix | Delete
<script type="text/x-jquery-template" id="wf-no-filtered-blocks-tmpl">
[81] Fix | Delete
<tr id="wf-no-blocks">
[82] Fix | Delete
<td colspan="8"><?php esc_html_e('No blocks match the current filter.', 'wordfence'); ?></td>
[83] Fix | Delete
</tr>
[84] Fix | Delete
</script>
[85] Fix | Delete
<script type="text/x-jquery-template" id="wf-blocks-loading-tmpl">
[86] Fix | Delete
<tr id="wf-blocks-loading">
[87] Fix | Delete
<td colspan="8" class="wf-center wf-padding-add-top wf-padding-add-bottom">
[88] Fix | Delete
<?php
[89] Fix | Delete
echo wfView::create('common/indeterminate-progress', array(
[90] Fix | Delete
'size' => 50,
[91] Fix | Delete
))->render();
[92] Fix | Delete
?>
[93] Fix | Delete
</td>
[94] Fix | Delete
</tr>
[95] Fix | Delete
</script>
[96] Fix | Delete
<script type="text/x-jquery-template" id="wf-block-row-tmpl">
[97] Fix | Delete
<tr class="wf-block-record" data-id="${id}" data-expiration="${expiration}">
[98] Fix | Delete
<td style="text-align: center;"><div class="wf-blocks-table-bulk-checkbox wf-option-checkbox"><i class="wf-ion-ios-checkmark-empty" aria-hidden="true"></i></div></td>
[99] Fix | Delete
<td data-column="type" data-sort="${typeSort}">${typeDisplay}</td>
[100] Fix | Delete
<td data-column="detail" data-sort="${detailSort}">${detailDisplay}{{if (editable)}}&nbsp;<a href="#" class="wf-block-edit" data-edit-type="${editType}" data-edit-values="${editValues}" role="button"><i class="wf-ion-edit" aria-hidden="true"></i></a>{{/if}}</td>
[101] Fix | Delete
<td data-column="ruleAdded" data-sort="${ruleAddedSort}">${ruleAddedDisplay}</td>
[102] Fix | Delete
<td data-column="reason" data-sort="${reasonSort}">${reasonDisplay}</td>
[103] Fix | Delete
<td data-column="expiration" data-sort="${expirationSort}">${expirationDisplay}</td>
[104] Fix | Delete
<td data-column="blockCount" data-sort="${blockCountSort}">${blockCountDisplay}</td>
[105] Fix | Delete
<td data-column="lastAttempt" data-sort="${lastAttemptSort}">${lastAttemptDisplay}</td>
[106] Fix | Delete
</tr>
[107] Fix | Delete
</script>
[108] Fix | Delete
<script type="application/javascript">
[109] Fix | Delete
(function($) {
[110] Fix | Delete
WFAD.blockHeaderCheckboxAction = function(checkbox) { //Top-level checkboxes
[111] Fix | Delete
$('.wf-blocks-bulk-select.wf-option-checkbox').toggleClass('wf-checked');
[112] Fix | Delete
var checked = $(checkbox).hasClass('wf-checked');
[113] Fix | Delete
$('.wf-blocks-table-bulk-checkbox.wf-option-checkbox').toggleClass('wf-checked', checked);
[114] Fix | Delete
$(window).trigger('wordfenceUpdateBlockButtons');
[115] Fix | Delete
};
[116] Fix | Delete
[117] Fix | Delete
[118] Fix | Delete
$(window).on('wordfenceRefreshBlockList', function(e, payload, append) {
[119] Fix | Delete
if (!payload.hasOwnProperty('loading')) {
[120] Fix | Delete
payload['loading'] = false;
[121] Fix | Delete
}
[122] Fix | Delete
[123] Fix | Delete
//Create table if needed
[124] Fix | Delete
var table = $(".wf-blocks-table-container");
[125] Fix | Delete
if (table.length == 0) {
[126] Fix | Delete
var wrapperTemplate = $('#wf-blocks-tmpl').tmpl();
[127] Fix | Delete
$('#wf-blocks-wrapper').append(wrapperTemplate);
[128] Fix | Delete
table = $(".wf-blocks-table-container");
[129] Fix | Delete
}
[130] Fix | Delete
[131] Fix | Delete
if (!append) {
[132] Fix | Delete
table.find('.wf-block-record').remove();
[133] Fix | Delete
}
[134] Fix | Delete
[135] Fix | Delete
//Create header if needed
[136] Fix | Delete
if (table.find('thead > .wf-blocks-columns').length == 0) {
[137] Fix | Delete
table.find('thead').append($('#wf-blocks-columns-tmpl').tmpl());
[138] Fix | Delete
table.find('thead .wf-blocks-bulk-select.wf-option-checkbox').on('click', function(e) {
[139] Fix | Delete
e.preventDefault();
[140] Fix | Delete
e.stopPropagation();
[141] Fix | Delete
WFAD.blockHeaderCheckboxAction($(this));
[142] Fix | Delete
});
[143] Fix | Delete
table.find('thead > .wf-blocks-columns > .wf-sortable').on('click', function(e, initialState) {
[144] Fix | Delete
e.preventDefault();
[145] Fix | Delete
e.stopPropagation();
[146] Fix | Delete
[147] Fix | Delete
var column = $(this).data('column');
[148] Fix | Delete
if ($(this).hasClass('wf-sorted-ascending')) {
[149] Fix | Delete
table.find('.wf-blocks-columns > .wf-sortable.wf-sorted-ascending').each(function() {
[150] Fix | Delete
$(this).removeClass('wf-sorted-ascending');
[151] Fix | Delete
$(this).addClass('wf-sorted-descending');
[152] Fix | Delete
});
[153] Fix | Delete
if (!initialState) {
[154] Fix | Delete
WFAD.sortColumn = column;
[155] Fix | Delete
WFAD.sortDirection = 'descending';
[156] Fix | Delete
$(window).trigger('wordfenceLoadBlocks', [true]);
[157] Fix | Delete
}
[158] Fix | Delete
}
[159] Fix | Delete
else if ($(this).hasClass('wf-sorted-descending')) {
[160] Fix | Delete
table.find('.wf-blocks-columns > .wf-sortable.wf-sorted-descending').each(function() {
[161] Fix | Delete
$(this).removeClass('wf-sorted-descending');
[162] Fix | Delete
$(this).addClass('wf-sorted-ascending');
[163] Fix | Delete
});
[164] Fix | Delete
if (!initialState) {
[165] Fix | Delete
WFAD.sortColumn = column;
[166] Fix | Delete
WFAD.sortDirection = 'ascending';
[167] Fix | Delete
$(window).trigger('wordfenceLoadBlocks', [true]);
[168] Fix | Delete
}
[169] Fix | Delete
}
[170] Fix | Delete
else {
[171] Fix | Delete
table.find('.wf-blocks-columns > .wf-sortable').removeClass('wf-sorted-descending').removeClass('wf-sorted-ascending').addClass('wf-unsorted');
[172] Fix | Delete
var column = $(this).data('column');
[173] Fix | Delete
$(this).removeClass('wf-unsorted').addClass('wf-sorted-ascending');
[174] Fix | Delete
table.find('tfoot > .wf-blocks-columns > .wf-sortable[data-column="' + column + '"]').removeClass('wf-unsorted').addClass('wf-sorted-ascending');
[175] Fix | Delete
if (!initialState) {
[176] Fix | Delete
WFAD.sortColumn = column;
[177] Fix | Delete
WFAD.sortDirection = 'ascending';
[178] Fix | Delete
$(window).trigger('wordfenceLoadBlocks', [true]);
[179] Fix | Delete
}
[180] Fix | Delete
}
[181] Fix | Delete
});
[182] Fix | Delete
}
[183] Fix | Delete
[184] Fix | Delete
//Create or remove footer if needed
[185] Fix | Delete
var loadedBlockCount = $('.wf-block-record').length + payload['blocks'].length;
[186] Fix | Delete
if (loadedBlockCount > 5 && table.find('tfoot > .wf-blocks-columns').length == 0) {
[187] Fix | Delete
table.find('tfoot').append($('#wf-blocks-columns-tmpl').tmpl());
[188] Fix | Delete
table.find('tfoot .wf-blocks-bulk-select.wf-option-checkbox').on('click', function(e) {
[189] Fix | Delete
e.preventDefault();
[190] Fix | Delete
e.stopPropagation();
[191] Fix | Delete
WFAD.blockHeaderCheckboxAction($(this));
[192] Fix | Delete
});
[193] Fix | Delete
table.find('tfoot > .wf-blocks-columns > .wf-sortable').on('click', function(e, initialState) {
[194] Fix | Delete
e.preventDefault();
[195] Fix | Delete
e.stopPropagation();
[196] Fix | Delete
[197] Fix | Delete
var column = $(this).data('column');
[198] Fix | Delete
if ($(this).hasClass('wf-sorted-ascending')) {
[199] Fix | Delete
table.find('.wf-blocks-columns > .wf-sortable.wf-sorted-ascending').each(function() {
[200] Fix | Delete
$(this).removeClass('wf-sorted-ascending');
[201] Fix | Delete
$(this).addClass('wf-sorted-descending');
[202] Fix | Delete
});
[203] Fix | Delete
if (!initialState) {
[204] Fix | Delete
WFAD.sortColumn = column;
[205] Fix | Delete
WFAD.sortDirection = 'descending';
[206] Fix | Delete
$(window).trigger('wordfenceLoadBlocks', [true]);
[207] Fix | Delete
}
[208] Fix | Delete
}
[209] Fix | Delete
else if ($(this).hasClass('wf-sorted-descending')) {
[210] Fix | Delete
table.find('.wf-blocks-columns > .wf-sortable.wf-sorted-descending').each(function() {
[211] Fix | Delete
$(this).removeClass('wf-sorted-descending');
[212] Fix | Delete
$(this).addClass('wf-sorted-ascending');
[213] Fix | Delete
});
[214] Fix | Delete
if (!initialState) {
[215] Fix | Delete
WFAD.sortColumn = column;
[216] Fix | Delete
WFAD.sortDirection = 'ascending';
[217] Fix | Delete
$(window).trigger('wordfenceLoadBlocks', [true]);
[218] Fix | Delete
}
[219] Fix | Delete
}
[220] Fix | Delete
else {
[221] Fix | Delete
table.find('.wf-blocks-columns > .wf-sortable').removeClass('wf-sorted-descending').removeClass('wf-sorted-ascending').addClass('wf-unsorted');
[222] Fix | Delete
$(this).removeClass('wf-unsorted').addClass('wf-sorted-ascending');
[223] Fix | Delete
table.find('thead > .wf-blocks-columns > .wf-sortable[data-column="' + column + '"]').removeClass('wf-unsorted').addClass('wf-sorted-ascending');
[224] Fix | Delete
if (!initialState) {
[225] Fix | Delete
WFAD.sortColumn = column;
[226] Fix | Delete
WFAD.sortDirection = 'ascending';
[227] Fix | Delete
$(window).trigger('wordfenceLoadBlocks', [true]);
[228] Fix | Delete
}
[229] Fix | Delete
}
[230] Fix | Delete
});
[231] Fix | Delete
}
[232] Fix | Delete
else if (loadedBlockCount > 5) {
[233] Fix | Delete
//Do nothing
[234] Fix | Delete
}
[235] Fix | Delete
else {
[236] Fix | Delete
table.find('tfoot > .wf-blocks-columns').remove();
[237] Fix | Delete
}
[238] Fix | Delete
[239] Fix | Delete
//Add row(s)
[240] Fix | Delete
$('#wf-blocks-loading').remove();
[241] Fix | Delete
if (!append && payload['blocks'].length == 0) {
[242] Fix | Delete
if (!payload['loading'] && $('#wf-no-blocks').length == 0) {
[243] Fix | Delete
if (!!WFAD.blocksFilter) {
[244] Fix | Delete
table.find('tbody').append($('#wf-no-filtered-blocks-tmpl').tmpl());
[245] Fix | Delete
}
[246] Fix | Delete
else {
[247] Fix | Delete
table.find('tbody').append($('#wf-no-blocks-tmpl').tmpl());
[248] Fix | Delete
}
[249] Fix | Delete
}
[250] Fix | Delete
}
[251] Fix | Delete
else {
[252] Fix | Delete
$('#wf-no-blocks').remove();
[253] Fix | Delete
for (var i = 0; i < payload['blocks'].length; i++) {
[254] Fix | Delete
var row = $('#wf-block-row-tmpl').tmpl(payload['blocks'][i]);
[255] Fix | Delete
[256] Fix | Delete
row.find('.wf-blocks-table-bulk-checkbox.wf-option-checkbox').on('click', function() { //Individual checkboxes
[257] Fix | Delete
e.preventDefault();
[258] Fix | Delete
e.stopPropagation();
[259] Fix | Delete
[260] Fix | Delete
$(this).toggleClass('wf-checked');
[261] Fix | Delete
$(window).trigger('wordfenceUpdateBulkSelect');
[262] Fix | Delete
$(window).trigger('wordfenceUpdateBlockButtons');
[263] Fix | Delete
});
[264] Fix | Delete
[265] Fix | Delete
row.find('.wf-block-edit').on('click', function(e) {
[266] Fix | Delete
e.preventDefault();
[267] Fix | Delete
e.stopPropagation();
[268] Fix | Delete
[269] Fix | Delete
var editType = $(this).data('editType');
[270] Fix | Delete
$('#wf-block-type > li > a[data-value="' + editType + '"]').trigger('click');
[271] Fix | Delete
if ($('#wf-block-parameters-title').offset().top < $(window).scrollTop()) {
[272] Fix | Delete
$("body,html").animate({
[273] Fix | Delete
scrollTop: $('#wf-block-parameters-title').offset().top
[274] Fix | Delete
}, 800);
[275] Fix | Delete
}
[276] Fix | Delete
});
[277] Fix | Delete
[278] Fix | Delete
var reasonDisplayChunks = payload['blocks'][i]['reasonDisplay'].split(/\s+/);
[279] Fix | Delete
for (var n = 0; n < reasonDisplayChunks.length; n++) {
[280] Fix | Delete
if (reasonDisplayChunks[n].length >= 50) {
[281] Fix | Delete
row.find('[data-column="reason"]').addClass('wf-split-word');
[282] Fix | Delete
break;
[283] Fix | Delete
}
[284] Fix | Delete
}
[285] Fix | Delete
[286] Fix | Delete
var existing = table.find('tbody tr[data-id="' + payload['blocks'][i]['id'] + '"]');
[287] Fix | Delete
if (existing.length > 0) {
[288] Fix | Delete
existing.replaceWith(row);
[289] Fix | Delete
}
[290] Fix | Delete
else {
[291] Fix | Delete
table.find('tbody').append(row);
[292] Fix | Delete
}
[293] Fix | Delete
}
[294] Fix | Delete
}
[295] Fix | Delete
[296] Fix | Delete
try {
[297] Fix | Delete
$('#wf-blocks-wrapper').data('hasCountryBlock', JSON.parse(payload.hasCountryBlock));
[298] Fix | Delete
}
[299] Fix | Delete
catch (e) {
[300] Fix | Delete
$('#wf-blocks-wrapper').data('hasCountryBlock', '');
[301] Fix | Delete
}
[302] Fix | Delete
[303] Fix | Delete
if (table.find('.wf-blocks-columns > .wf-sortable.wf-sorted-ascending, .wf-blocks-columns > .wf-sortable.wf-sorted-descending').length == 0) {
[304] Fix | Delete
table.find('thead > .wf-blocks-columns > .wf-sortable[data-column="ruleAdded"]').addClass('wf-sorted-ascending').trigger('click', [true]);
[305] Fix | Delete
}
[306] Fix | Delete
[307] Fix | Delete
$(window).trigger('wordfenceUpdateBlockButtons');
[308] Fix | Delete
});
[309] Fix | Delete
[310] Fix | Delete
$(window).on('wordfenceUpdateBlockButtons', function() {
[311] Fix | Delete
var totalCount = $('.wf-blocks-table-bulk-checkbox.wf-option-checkbox').length;
[312] Fix | Delete
var checked = $('.wf-blocks-table-bulk-checkbox.wf-option-checkbox.wf-checked');
[313] Fix | Delete
var allowUnblock = false;
[314] Fix | Delete
var allowMakeForever = false;
[315] Fix | Delete
for (var i = 0; i < checked.length; i++) {
[316] Fix | Delete
var tr = $(checked[i]).closest('tr');
[317] Fix | Delete
if (tr.is(':visible')) {
[318] Fix | Delete
allowUnblock = true;
[319] Fix | Delete
if (tr.data('expiration') > 0) {
[320] Fix | Delete
allowMakeForever = true;
[321] Fix | Delete
}
[322] Fix | Delete
}
[323] Fix | Delete
}
[324] Fix | Delete
[325] Fix | Delete
$('#blocks-bulk-unblock').toggleClass('wf-disabled', !allowUnblock);
[326] Fix | Delete
$('#blocks-bulk-make-permanent').toggleClass('wf-disabled', !allowMakeForever);
[327] Fix | Delete
$('#blocks-export-ips').toggleClass('wf-disabled', (totalCount == 0));
[328] Fix | Delete
});
[329] Fix | Delete
[330] Fix | Delete
$(window).on('wordfenceUpdateBulkSelect', function() {
[331] Fix | Delete
var totalCount = $('.wf-blocks-table-bulk-checkbox.wf-option-checkbox:visible').length;
[332] Fix | Delete
var checkedCount = $('.wf-blocks-table-bulk-checkbox.wf-option-checkbox.wf-checked:visible').length;
[333] Fix | Delete
$('.wf-blocks-bulk-select.wf-option-checkbox:visible').toggleClass('wf-checked', (totalCount > 0 && checkedCount == totalCount));
[334] Fix | Delete
});
[335] Fix | Delete
[336] Fix | Delete
$(window).on('wordfenceLoadBlocks', function(e, reload) {
[337] Fix | Delete
var offset = reload ? 0 : $('.wf-block-record').length;
[338] Fix | Delete
[339] Fix | Delete
WFAD.loadingBlocks = true;
[340] Fix | Delete
WFAD.ajax('wordfence_getBlocks', {offset: offset, sortColumn: WFAD.sortColumn, sortDirection: WFAD.sortDirection, blocksFilter: WFAD.blocksFilter}, function(res) {
[341] Fix | Delete
$(window).trigger('wordfenceRefreshBlockList', [res, !reload]);
[342] Fix | Delete
WFAD.loadingBlocks = false;
[343] Fix | Delete
});
[344] Fix | Delete
});
[345] Fix | Delete
[346] Fix | Delete
$(function() {
[347] Fix | Delete
WFAD.sortColumn = 'ruleAdded';
[348] Fix | Delete
WFAD.sortDirection = 'descending';
[349] Fix | Delete
[350] Fix | Delete
$(window).trigger('wordfenceRefreshBlockList', [{blocks: [], loading: true}, false]);
[351] Fix | Delete
$(window).trigger('wordfenceLoadBlocks', [true]);
[352] Fix | Delete
[353] Fix | Delete
var issuesWrapper = $('#wf-blocks-wrapper');
[354] Fix | Delete
var hasScrolled = false;
[355] Fix | Delete
$(window).on('scroll', function() {
[356] Fix | Delete
var win = $(this);
[357] Fix | Delete
var currentScrollBottom = win.scrollTop() + window.innerHeight;
[358] Fix | Delete
var scrollThreshold = issuesWrapper.outerHeight() + issuesWrapper.offset().top;
[359] Fix | Delete
if (hasScrolled && !WFAD.loadingBlocks && currentScrollBottom >= scrollThreshold) {
[360] Fix | Delete
hasScrolled = false;
[361] Fix | Delete
$(window).trigger('wordfenceLoadBlocks', [false]);
[362] Fix | Delete
}
[363] Fix | Delete
else if (currentScrollBottom < scrollThreshold) {
[364] Fix | Delete
hasScrolled = true;
[365] Fix | Delete
}
[366] Fix | Delete
});
[367] Fix | Delete
[368] Fix | Delete
$('#wf-blocks-filter-field').on('keypress', function(e) {
[369] Fix | Delete
if (e.which == 13) {
[370] Fix | Delete
$('#wf-blocks-apply-filter').trigger('click');
[371] Fix | Delete
return false;
[372] Fix | Delete
}
[373] Fix | Delete
}).on('change paste keyup', function() {
[374] Fix | Delete
setTimeout(function() {
[375] Fix | Delete
var currentValue = $('#wf-blocks-filter-field').val() || '';
[376] Fix | Delete
if (!WFAD.blocksFilter) {
[377] Fix | Delete
$('#wf-blocks-apply-filter').text('<?php esc_html_e('Filter', 'wordfence'); ?>').data('filterMode', '');
[378] Fix | Delete
}
[379] Fix | Delete
else if (currentValue == '' || currentValue == WFAD.blocksFilter) {
[380] Fix | Delete
$('#wf-blocks-apply-filter').text('<?php esc_html_e('Clear Filter', 'wordfence'); ?>').data('filterMode', 'filtered');
[381] Fix | Delete
}
[382] Fix | Delete
else {
[383] Fix | Delete
$('#wf-blocks-apply-filter').text('<?php esc_html_e('Change Filter', 'wordfence'); ?>').data('filterMode', 'pendingChange');
[384] Fix | Delete
}
[385] Fix | Delete
}, 4);
[386] Fix | Delete
});
[387] Fix | Delete
[388] Fix | Delete
$('#wf-blocks-apply-filter').on('click', function(e) {
[389] Fix | Delete
e.preventDefault();
[390] Fix | Delete
e.stopPropagation();
[391] Fix | Delete
[392] Fix | Delete
var mode = $('#wf-blocks-apply-filter').data('filterMode') || '';
[393] Fix | Delete
if (mode != 'filtered') {
[394] Fix | Delete
WFAD.blocksFilter = $('#wf-blocks-filter-field').val() || '';
[395] Fix | Delete
}
[396] Fix | Delete
else {
[397] Fix | Delete
WFAD.blocksFilter = '';
[398] Fix | Delete
$('#wf-blocks-filter-field').val('')
[399] Fix | Delete
}
[400] Fix | Delete
[401] Fix | Delete
$('#wf-blocks-filter-field').trigger('keyup');
[402] Fix | Delete
$(window).trigger('wordfenceLoadBlocks', [true]);
[403] Fix | Delete
});
[404] Fix | Delete
[405] Fix | Delete
$('#blocks-bulk-unblock').on('click', function(e) {
[406] Fix | Delete
e.preventDefault();
[407] Fix | Delete
e.stopPropagation();
[408] Fix | Delete
[409] Fix | Delete
var totalCount = $('.wf-blocks-table-bulk-checkbox.wf-option-checkbox:visible').length;
[410] Fix | Delete
var checked = $('.wf-blocks-table-bulk-checkbox.wf-option-checkbox.wf-checked:visible');
[411] Fix | Delete
var checkedCount = checked.length;
[412] Fix | Delete
var removingCountryBlock = false;
[413] Fix | Delete
var blockIDs = [];
[414] Fix | Delete
var rows = [];
[415] Fix | Delete
for (var i = 0; i < checked.length; i++) {
[416] Fix | Delete
var tr = $(checked[i]).closest('tr');
[417] Fix | Delete
rows.push(tr);
[418] Fix | Delete
blockIDs.push(tr.data('id'));
[419] Fix | Delete
[420] Fix | Delete
if (tr.find('td[data-column="type"]').data('sort') == <?php echo (int) wfBlock::TYPE_COUNTRY; ?>) {
[421] Fix | Delete
removingCountryBlock = true;
[422] Fix | Delete
}
[423] Fix | Delete
}
[424] Fix | Delete
[425] Fix | Delete
var prompt = $('#wfTmpl_unblockPrompt').tmpl({count: checkedCount});
[426] Fix | Delete
var promptHTML = $("<div />").append(prompt).html();
[427] Fix | Delete
WFAD.colorboxHTML('400px', promptHTML, {overlayClose: false, closeButton: false, className: 'wf-modal', onComplete: function() {
[428] Fix | Delete
$('#wf-blocking-prompt-cancel').on('click', function(e) {
[429] Fix | Delete
e.preventDefault();
[430] Fix | Delete
e.stopPropagation();
[431] Fix | Delete
[432] Fix | Delete
WFAD.colorboxClose();
[433] Fix | Delete
});
[434] Fix | Delete
[435] Fix | Delete
$('#wf-blocking-prompt-unblock').on('click', function(e) {
[436] Fix | Delete
e.preventDefault();
[437] Fix | Delete
e.stopPropagation();
[438] Fix | Delete
[439] Fix | Delete
WFAD.loadingBlocks = true;
[440] Fix | Delete
WFAD.ajax('wordfence_deleteBlocks', {blocks: JSON.stringify(blockIDs), sortColumn: WFAD.sortColumn, sortDirection: WFAD.sortDirection, blocksFilter: WFAD.blocksFilter}, function(res) {
[441] Fix | Delete
WFAD.loadingBlocks = false;
[442] Fix | Delete
if (totalCount == checkedCount) {
[443] Fix | Delete
$(window).trigger('wordfenceRefreshBlockList', [res, false]); //Everything deleted, just reload it
[444] Fix | Delete
}
[445] Fix | Delete
else {
[446] Fix | Delete
for (var i = 0; i < rows.length; i++) {
[447] Fix | Delete
$(rows[i]).remove();
[448] Fix | Delete
}
[449] Fix | Delete
[450] Fix | Delete
if (removingCountryBlock) {
[451] Fix | Delete
$('#wf-blocks-wrapper').data('hasCountryBlock', '');
[452] Fix | Delete
}
[453] Fix | Delete
[454] Fix | Delete
$(window).trigger('wordfenceUpdateBulkSelect');
[455] Fix | Delete
$(window).trigger('wordfenceUpdateBlockButtons');
[456] Fix | Delete
}
[457] Fix | Delete
[458] Fix | Delete
WFAD.colorboxClose();
[459] Fix | Delete
});
[460] Fix | Delete
});
[461] Fix | Delete
}});
[462] Fix | Delete
});
[463] Fix | Delete
[464] Fix | Delete
$('#blocks-bulk-make-permanent').on('click', function(e) {
[465] Fix | Delete
e.preventDefault();
[466] Fix | Delete
e.stopPropagation();
[467] Fix | Delete
[468] Fix | Delete
var checked = $('.wf-blocks-table-bulk-checkbox.wf-option-checkbox.wf-checked:visible');
[469] Fix | Delete
var updateIDs = [];
[470] Fix | Delete
for (var i = 0; i < checked.length; i++) {
[471] Fix | Delete
var tr = $(checked[i]).closest('tr');
[472] Fix | Delete
if (tr.is(':visible')) {
[473] Fix | Delete
updateIDs.push(tr.data('id'));
[474] Fix | Delete
}
[475] Fix | Delete
}
[476] Fix | Delete
[477] Fix | Delete
WFAD.loadingBlocks = true;
[478] Fix | Delete
WFAD.ajax('wordfence_makePermanentBlocks', {updates: JSON.stringify(updateIDs), sortColumn: WFAD.sortColumn, sortDirection: WFAD.sortDirection, blocksFilter: WFAD.blocksFilter}, function(res) {
[479] Fix | Delete
WFAD.loadingBlocks = false;
[480] Fix | Delete
$(window).trigger('wordfenceRefreshBlockList', [res, false]);
[481] Fix | Delete
});
[482] Fix | Delete
});
[483] Fix | Delete
[484] Fix | Delete
$('.wf-option.wf-option-toggled-boolean-switch[data-option="displayAutomaticBlocks"]').on('change', function() {
[485] Fix | Delete
delete WFAD.pendingChanges['displayAutomaticBlocks'];
[486] Fix | Delete
var isOn = $(this).find('.wf-boolean-switch').hasClass('wf-active');
[487] Fix | Delete
WFAD.setOption($(this).data('option'), (isOn ? $(this).data('enabledValue') : $(this).data('disabledValue')), function() {
[488] Fix | Delete
$(window).trigger('wordfenceLoadBlocks', [true]);
[489] Fix | Delete
});
[490] Fix | Delete
});
[491] Fix | Delete
});
[492] Fix | Delete
})(jQuery);
[493] Fix | Delete
</script>
[494] Fix | Delete
<script type="text/x-jquery-template" id="wfTmpl_unblockPrompt">
[495] Fix | Delete
<?php
[496] Fix | Delete
echo wfView::create('common/modal-prompt', array(
[497] Fix | Delete
'title' => __('Unblocking', 'wordfence'),
[498] Fix | Delete
'message' => '{{if count == 1}}' . __('Are you sure you want to stop blocking the selected IP, range, or country?', 'wordfence') . ' {{else}}' . __('Are you sure you want to stop blocking the ${count} selected IPs, ranges, and countries?', 'wordfence') . '{{/if}}',
[499] Fix | Delete
12
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function