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/scanner
File: scan-scheduling.php
<?php
[0] Fix | Delete
if (!defined('WORDFENCE_VERSION')) { exit; }
[1] Fix | Delete
/**
[2] Fix | Delete
* Displays the scan scheduling controls.
[3] Fix | Delete
*/
[4] Fix | Delete
?>
[5] Fix | Delete
<li>
[6] Fix | Delete
<?php
[7] Fix | Delete
echo wfView::create('options/option-switch', array(
[8] Fix | Delete
'optionName' => 'scheduledScansEnabled',
[9] Fix | Delete
'value' => wfConfig::get('scheduledScansEnabled') ? '1': '0',
[10] Fix | Delete
'title' => __('Schedule Wordfence Scans', 'wordfence'),
[11] Fix | Delete
'states' => array(
[12] Fix | Delete
array('value' => '0', 'label' => __('Disabled', 'wordfence')),
[13] Fix | Delete
array('value' => '1', 'label' => __('Enabled', 'wordfence')),
[14] Fix | Delete
),
[15] Fix | Delete
'helpLink' => wfSupportController::supportURL(wfSupportController::ITEM_SCAN_SCHEDULING),
[16] Fix | Delete
))->render();
[17] Fix | Delete
?>
[18] Fix | Delete
</li>
[19] Fix | Delete
<li>
[20] Fix | Delete
<ul class="wf-scan-scheduling" data-option="schedMode" data-original-value="<?php echo esc_attr($scanner->schedulingMode()); ?>">
[21] Fix | Delete
<li>
[22] Fix | Delete
<ul class="wf-option wf-option-scan-schedule-mode<?php if (!$scanner->isEnabled()) { echo ' wf-disabled'; } ?>" data-option-value="<?php echo esc_attr(wfScanner::SCAN_SCHEDULING_MODE_AUTOMATIC); ?>">
[23] Fix | Delete
<li class="wf-option-radio-container" role="radiogroup">
[24] Fix | Delete
<input class="wf-option-radio" type="radio" name="wf-scheduling-mode" id="wf-scheduling-mode-automatic" value="<?php echo esc_attr(wfScanner::SCAN_SCHEDULING_MODE_AUTOMATIC); ?>" <?php echo ($scanner->schedulingMode() == wfScanner::SCAN_SCHEDULING_MODE_AUTOMATIC ? ' checked' : ''); ?><?php if (!$scanner->isEnabled()) { echo ' disabled'; } ?> aria-labelledby="wf-scheduling-mode-automatic-label">
[25] Fix | Delete
<label for="wf-scheduling-mode-automatic"></label>
[26] Fix | Delete
</li>
[27] Fix | Delete
<li id="wf-scheduling-mode-automatic-label" class="wf-option-title"><?php esc_html_e('Let Wordfence choose when to scan my site (recommended)', 'wordfence'); ?></li>
[28] Fix | Delete
</ul>
[29] Fix | Delete
</li>
[30] Fix | Delete
<li>
[31] Fix | Delete
<ul class="wf-option wf-option-scan-schedule-mode<?php if (!wfConfig::p()) { echo ' wf-option-premium'; } ?><?php if (!$scanner->isEnabled()) { echo ' wf-disabled'; } ?>" data-option-value="<?php echo esc_attr(wfScanner::SCAN_SCHEDULING_MODE_MANUAL); ?>" data-show=".wf-scan-scheduling-manual">
[32] Fix | Delete
<li class="wf-option-radio-container">
[33] Fix | Delete
<input class="wf-option-radio" type="radio" name="wf-scheduling-mode" id="wf-scheduling-mode-manual" value="<?php echo esc_attr(wfScanner::SCAN_SCHEDULING_MODE_MANUAL); ?>" <?php echo ($scanner->schedulingMode() == wfScanner::SCAN_SCHEDULING_MODE_MANUAL ? ' checked' : ''); ?><?php if (!wfConfig::p() || !$scanner->isEnabled()) { echo ' disabled'; } ?> aria-labelledby="wf-scheduling-mode-manual-label">
[34] Fix | Delete
<label for="wf-scheduling-mode-manual"></label>
[35] Fix | Delete
</li>
[36] Fix | Delete
<li id="wf-scheduling-mode-manual-label" class="wf-option-title"><?php esc_html_e('Manually schedule scans', 'wordfence'); ?><?php if (!wfConfig::p()) { ?>&nbsp;&nbsp;<a href="https://www.wordfence.com/gnl1optionUpgrade/wordfence-signup/" target="_blank" rel="noopener noreferrer" class="wf-premium-link"><?php esc_html_e('Premium Feature', 'wordfence'); ?><span class="screen-reader-text"> (<?php esc_html_e('opens in new tab', 'wordfence') ?>)</span></a><?php } ?></li>
[37] Fix | Delete
</ul>
[38] Fix | Delete
<ul class="wf-scan-scheduling-manual<?php echo ($scanner->schedulingMode() == wfScanner::SCAN_SCHEDULING_MODE_MANUAL ? ' wf-active' : ''); ?>">
[39] Fix | Delete
<li>
[40] Fix | Delete
<strong class="wf-scan-scheduling-manual-presets-label">Shortcuts</strong>
[41] Fix | Delete
<ul class="wf-scan-scheduling-manual-presets wf-overflow-x-auto-xs" data-option-name="manualScanType" data-original-value="<?php echo esc_attr(wfConfig::get('manualScanType')); ?>" role="radiogroup">
[42] Fix | Delete
<li class="wf-nowrap <?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_ONCE_DAILY ? 'wf-active' : ''); ?>" data-option-value="<?php echo esc_attr(wfScanner::MANUAL_SCHEDULING_ONCE_DAILY); ?>" data-show=".wf-scan-scheduling-manual-preset-options" data-hide=".wf-scan-scheduling-manual-custom-options" role="radio" aria-checked="<?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_ONCE_DAILY ? 'true' : 'false'); ?>" tabindex="0"><?php esc_html_e('Once Daily', 'wordfence'); ?></li>
[43] Fix | Delete
<li class="wf-nowrap <?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_TWICE_DAILY ? 'wf-active' : ''); ?>" data-option-value="<?php echo esc_attr(wfScanner::MANUAL_SCHEDULING_TWICE_DAILY); ?>" data-show=".wf-scan-scheduling-manual-preset-options" data-hide=".wf-scan-scheduling-manual-custom-options" role="radio" aria-checked="<?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_TWICE_DAILY ? 'true' : 'false'); ?>" tabindex="0"><?php esc_html_e('Twice Daily', 'wordfence'); ?></li>
[44] Fix | Delete
<li class="wf-nowrap <?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_EVERY_OTHER_DAY ? 'wf-active' : ''); ?>" data-option-value="<?php echo esc_attr(wfScanner::MANUAL_SCHEDULING_EVERY_OTHER_DAY); ?>" data-show=".wf-scan-scheduling-manual-preset-options" data-hide=".wf-scan-scheduling-manual-custom-options" role="radio" aria-checked="<?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_EVERY_OTHER_DAY ? 'true' : 'false'); ?>" tabindex="0"><?php esc_html_e('Every Other Day', 'wordfence'); ?></li>
[45] Fix | Delete
<li class="wf-nowrap <?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_WEEKDAYS ? 'wf-active' : ''); ?>" data-option-value="<?php echo esc_attr(wfScanner::MANUAL_SCHEDULING_WEEKDAYS); ?>" data-show=".wf-scan-scheduling-manual-preset-options" data-hide=".wf-scan-scheduling-manual-custom-options" role="radio" aria-checked="<?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_WEEKDAYS ? 'true' : 'false'); ?>" tabindex="0"><?php esc_html_e('Weekdays', 'wordfence'); ?></li>
[46] Fix | Delete
<li class="wf-nowrap <?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_WEEKENDS ? 'wf-active' : ''); ?>" data-option-value="<?php echo esc_attr(wfScanner::MANUAL_SCHEDULING_WEEKENDS); ?>" data-show=".wf-scan-scheduling-manual-preset-options" data-hide=".wf-scan-scheduling-manual-custom-options" role="radio" aria-checked="<?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_WEEKENDS ? 'true' : 'false'); ?>" tabindex="0"><?php esc_html_e('Weekends', 'wordfence'); ?></li>
[47] Fix | Delete
<li class="wf-nowrap <?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_ODD_DAYS_WEEKENDS ? 'wf-active' : ''); ?>" data-option-value="<?php echo esc_attr(wfScanner::MANUAL_SCHEDULING_ODD_DAYS_WEEKENDS); ?>" data-show=".wf-scan-scheduling-manual-preset-options" data-hide=".wf-scan-scheduling-manual-custom-options" role="radio" aria-checked="<?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_ODD_DAYS_WEEKENDS ? 'true' : 'false'); ?>" tabindex="0"><?php esc_html_e('Odd Days & Weekends', 'wordfence'); ?></li>
[48] Fix | Delete
<li class="wf-nowrap <?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_CUSTOM ? 'wf-active' : ''); ?>" data-option-value="<?php echo esc_attr(wfScanner::MANUAL_SCHEDULING_CUSTOM); ?>" data-show=".wf-scan-scheduling-manual-custom-options" data-hide=".wf-scan-scheduling-manual-preset-options" role="radio" aria-checked="<?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_CUSTOM ? 'true' : 'false'); ?>" tabindex="0"><?php esc_html_e('Custom', 'wordfence'); ?></li>
[49] Fix | Delete
</ul>
[50] Fix | Delete
<script type="application/javascript">
[51] Fix | Delete
(function($) {
[52] Fix | Delete
$(function() {
[53] Fix | Delete
$('.wf-option-scan-schedule-mode').each(function() {
[54] Fix | Delete
$(this).find('.wf-option-radio').on('keydown', function(e) {
[55] Fix | Delete
if (e.keyCode == 32) {
[56] Fix | Delete
e.preventDefault();
[57] Fix | Delete
e.stopPropagation();
[58] Fix | Delete
[59] Fix | Delete
$(this).trigger('click');
[60] Fix | Delete
}
[61] Fix | Delete
});
[62] Fix | Delete
[63] Fix | Delete
$(this).find('.wf-option-radio').on('click', function(e) {
[64] Fix | Delete
var optionElement = $(this).closest('.wf-option');
[65] Fix | Delete
if (optionElement.hasClass('wf-option-premium') || optionElement.hasClass('wf-disabled')) {
[66] Fix | Delete
return;
[67] Fix | Delete
}
[68] Fix | Delete
[69] Fix | Delete
var groupElement = $(this).closest('.wf-scan-scheduling');
[70] Fix | Delete
var option = groupElement.data('option');
[71] Fix | Delete
var value = false;
[72] Fix | Delete
var isActive = $(this).is(':checked');
[73] Fix | Delete
if (isActive) {
[74] Fix | Delete
groupElement.find('.wf-option-scan-schedule-mode').each(function() {
[75] Fix | Delete
var toHide = $(this).data('show');
[76] Fix | Delete
if (toHide) {
[77] Fix | Delete
$(toHide).removeClass('wf-active');
[78] Fix | Delete
}
[79] Fix | Delete
});
[80] Fix | Delete
[81] Fix | Delete
value = optionElement.data('optionValue');
[82] Fix | Delete
var toShow = optionElement.data('show');
[83] Fix | Delete
if (toShow) {
[84] Fix | Delete
$(toShow).addClass('wf-active');
[85] Fix | Delete
}
[86] Fix | Delete
}
[87] Fix | Delete
[88] Fix | Delete
var originalValue = groupElement.data('originalValue');
[89] Fix | Delete
if (originalValue == value) {
[90] Fix | Delete
delete WFAD.pendingChanges[option];
[91] Fix | Delete
}
[92] Fix | Delete
else {
[93] Fix | Delete
WFAD.pendingChanges[option] = value;
[94] Fix | Delete
}
[95] Fix | Delete
[96] Fix | Delete
WFAD.updatePendingChanges();
[97] Fix | Delete
});
[98] Fix | Delete
});
[99] Fix | Delete
[100] Fix | Delete
$('.wf-scan-scheduling-manual-presets > li').each(function(index, element) {
[101] Fix | Delete
$(element).on('keydown', function(e) {
[102] Fix | Delete
if (e.keyCode == 32) {
[103] Fix | Delete
e.preventDefault();
[104] Fix | Delete
e.stopPropagation();
[105] Fix | Delete
[106] Fix | Delete
$(this).trigger('click');
[107] Fix | Delete
}
[108] Fix | Delete
});
[109] Fix | Delete
[110] Fix | Delete
$(element).on('click', function(e) {
[111] Fix | Delete
e.preventDefault();
[112] Fix | Delete
e.stopPropagation();
[113] Fix | Delete
[114] Fix | Delete
var control = $(this).closest('ul');
[115] Fix | Delete
var optionName = control.data('optionName');
[116] Fix | Delete
var originalValue = control.data('originalValue');
[117] Fix | Delete
var value = $(this).data('optionValue');
[118] Fix | Delete
[119] Fix | Delete
control.find('li').each(function() {
[120] Fix | Delete
$(this).toggleClass('wf-active', value == $(this).data('optionValue')).attr('aria-checked', value == $(this).data('optionValue') ? 'true' : 'false');
[121] Fix | Delete
});
[122] Fix | Delete
[123] Fix | Delete
var toShow = $(this).data('show');
[124] Fix | Delete
if (toShow) {
[125] Fix | Delete
$(toShow).addClass('wf-active');
[126] Fix | Delete
}
[127] Fix | Delete
[128] Fix | Delete
var toHide = $(this).data('hide');
[129] Fix | Delete
if (toHide) {
[130] Fix | Delete
$(toHide).removeClass('wf-active');
[131] Fix | Delete
}
[132] Fix | Delete
[133] Fix | Delete
if (originalValue == value) {
[134] Fix | Delete
delete WFAD.pendingChanges[optionName];
[135] Fix | Delete
}
[136] Fix | Delete
else {
[137] Fix | Delete
WFAD.pendingChanges[optionName] = value;
[138] Fix | Delete
}
[139] Fix | Delete
[140] Fix | Delete
WFAD.updatePendingChanges();
[141] Fix | Delete
});
[142] Fix | Delete
});
[143] Fix | Delete
[144] Fix | Delete
$('.wf-option[data-option-name="scheduledScansEnabled"]').on('change', function() {
[145] Fix | Delete
var scheduledScansEnabled = !!$('.wf-option[data-option-name="scheduledScansEnabled"] .wf-switch li.wf-active').data('optionValue');
[146] Fix | Delete
$('.wf-option-scan-schedule-mode').toggleClass('wf-disabled', !scheduledScansEnabled);
[147] Fix | Delete
$('.wf-option-scan-schedule-mode .wf-option-radio').prop('disabled', !scheduledScansEnabled);
[148] Fix | Delete
});
[149] Fix | Delete
[150] Fix | Delete
$(window).on('wfOptionsReset', function() {
[151] Fix | Delete
$('.wf-option-scan-schedule-mode').each(function() {
[152] Fix | Delete
var groupElement = $(this).closest('.wf-scan-scheduling');
[153] Fix | Delete
var originalValue = groupElement.data('originalValue');
[154] Fix | Delete
var option = groupElement.data('option');
[155] Fix | Delete
var value = $(this).data('optionValue');
[156] Fix | Delete
[157] Fix | Delete
$(this).find('.wf-option-radio').prop('checked', value == originalValue);
[158] Fix | Delete
var toHideShow = $(this).data('show');
[159] Fix | Delete
if (toHideShow) {
[160] Fix | Delete
$(toHideShow).toggleClass('wf-active', value == originalValue);
[161] Fix | Delete
}
[162] Fix | Delete
});
[163] Fix | Delete
[164] Fix | Delete
$('.wf-scan-scheduling-manual-presets').each(function() {
[165] Fix | Delete
var originalValue = $(this).data('originalValue');
[166] Fix | Delete
$(this).find('li').each(function() {
[167] Fix | Delete
$(this).toggleClass('wf-active', originalValue == $(this).data('optionValue')).attr('aria-checked', originalValue == $(this).data('optionValue') ? 'true' : 'false');
[168] Fix | Delete
if (originalValue == $(this).data('optionValue')) {
[169] Fix | Delete
var toShow = $(this).data('show');
[170] Fix | Delete
if (toShow) {
[171] Fix | Delete
$(toShow).addClass('wf-active');
[172] Fix | Delete
}
[173] Fix | Delete
[174] Fix | Delete
var toHide = $(this).data('hide');
[175] Fix | Delete
if (toHide) {
[176] Fix | Delete
$(toHide).removeClass('wf-active');
[177] Fix | Delete
}
[178] Fix | Delete
}
[179] Fix | Delete
});
[180] Fix | Delete
});
[181] Fix | Delete
});
[182] Fix | Delete
});
[183] Fix | Delete
})(jQuery);
[184] Fix | Delete
</script>
[185] Fix | Delete
</li>
[186] Fix | Delete
<li class="wf-scan-scheduling-manual-preset-options<?php echo ($scanner->manualSchedulingType() != wfScanner::MANUAL_SCHEDULING_CUSTOM ? ' wf-active' : ''); ?>">
[187] Fix | Delete
<ul class="wf-option wf-option-select" data-select-option="schedStartHour" data-original-select-value="<?php echo esc_attr($scanner->manualSchedulingStartHour()); ?>">
[188] Fix | Delete
<li class="wf-option-title"><span class="wf-hidden-xs"><?php esc_html_e('Use preferred start time', 'wordfence'); ?></span><span class="wf-visible-xs"><?php esc_html_e('Start time', 'wordfence'); ?></span></li>
[189] Fix | Delete
<li class="wf-option-select">
[190] Fix | Delete
<select<?php echo (!(!wfConfig::p() && isset($premium) && $premium) ? '' : ' disabled'); ?> data-preferred-width="100px">
[191] Fix | Delete
<?php
[192] Fix | Delete
$selectOptions = array();
[193] Fix | Delete
for ($i = 1; $i <= 24; $i++) {
[194] Fix | Delete
$label = $i . ':00 ';
[195] Fix | Delete
if ($i > 12) {
[196] Fix | Delete
$label = ($i - 12) . ':00 ';
[197] Fix | Delete
}
[198] Fix | Delete
[199] Fix | Delete
if ($i < 12 || $i > 23) {
[200] Fix | Delete
$label .= __('AM', 'wordfence');
[201] Fix | Delete
}
[202] Fix | Delete
else {
[203] Fix | Delete
$label .= __('PM', 'wordfence');
[204] Fix | Delete
}
[205] Fix | Delete
[206] Fix | Delete
$selectOptions[] = array('label' => $label, 'value' => $i);
[207] Fix | Delete
}
[208] Fix | Delete
[209] Fix | Delete
foreach ($selectOptions as $o):
[210] Fix | Delete
?>
[211] Fix | Delete
<option class="wf-option-select-option" value="<?php echo esc_attr($o['value']); ?>"<?php if ($o['value'] == $scanner->manualSchedulingStartHour()) { echo ' selected'; } ?>><?php echo esc_html($o['label']); ?></option>
[212] Fix | Delete
<?php endforeach; ?>
[213] Fix | Delete
</select>
[214] Fix | Delete
</li>
[215] Fix | Delete
</ul>
[216] Fix | Delete
</li>
[217] Fix | Delete
<li class="wf-scan-scheduling-manual-custom-options wf-overflow-x-auto-xs<?php echo ($scanner->manualSchedulingType() == wfScanner::MANUAL_SCHEDULING_CUSTOM ? ' wf-active' : ''); ?>">
[218] Fix | Delete
<table class="wf-scan-schedule" data-original-value="<?php echo esc_attr(@json_encode($scanner->customSchedule(), JSON_FORCE_OBJECT)); ?>">
[219] Fix | Delete
<?php
[220] Fix | Delete
$daysOfWeek = array(
[221] Fix | Delete
array(1, __('Monday', 'wordfence')),
[222] Fix | Delete
array(2, __('Tuesday', 'wordfence')),
[223] Fix | Delete
array(3, __('Wednesday', 'wordfence')),
[224] Fix | Delete
array(4, __('Thursday', 'wordfence')),
[225] Fix | Delete
array(5, __('Friday', 'wordfence')),
[226] Fix | Delete
array(6, __('Saturday', 'wordfence')),
[227] Fix | Delete
array(0, __('Sunday', 'wordfence')),
[228] Fix | Delete
);
[229] Fix | Delete
$sched = $scanner->customSchedule();
[230] Fix | Delete
foreach ($daysOfWeek as $d) :
[231] Fix | Delete
list($dayNumber, $dayName) = $d;
[232] Fix | Delete
?>
[233] Fix | Delete
<tr class="wf-visible-xs">
[234] Fix | Delete
<th><?php echo esc_html($dayName); ?></th>
[235] Fix | Delete
</tr>
[236] Fix | Delete
<tr class="wf-schedule-day" data-day="<?php echo $dayNumber; ?>">
[237] Fix | Delete
<th class="wf-hidden-xs"><?php echo $dayName; ?></th>
[238] Fix | Delete
<td>
[239] Fix | Delete
<div class="wf-schedule-times-wrapper">
[240] Fix | Delete
<div class="wf-schedule-period"><?php esc_html_e('AM', 'wordfence'); ?></div>
[241] Fix | Delete
<ul class="wf-schedule-times">
[242] Fix | Delete
<?php
[243] Fix | Delete
for ($h = 0; $h < 12; $h++) {
[244] Fix | Delete
$active = (isset($sched[$dayNumber]) && $sched[$dayNumber][$h] ? ' wf-active' : '');
[245] Fix | Delete
echo '<li class="wf-schedule-time' . $active . '" data-hour="' . $h . '" role="checkbox" aria-checked="' . (empty($active) ? 'false' : 'true') . '" tabindex="0">' . str_pad($h, 2, '0', STR_PAD_LEFT) . '</li>';
[246] Fix | Delete
}
[247] Fix | Delete
?>
[248] Fix | Delete
</ul>
[249] Fix | Delete
</div>
[250] Fix | Delete
<div class="wf-schedule-times-wrapper">
[251] Fix | Delete
<div class="wf-schedule-period"><?php esc_html_e('PM', 'wordfence'); ?></div>
[252] Fix | Delete
<ul class="wf-schedule-times">
[253] Fix | Delete
<?php
[254] Fix | Delete
for ($i = 0; $i < 12; $i++) {
[255] Fix | Delete
$h = $i;
[256] Fix | Delete
if ($h == 0) { $h = 12; }
[257] Fix | Delete
$active = (isset($sched[$dayNumber]) && $sched[$dayNumber][$i + 12] ? ' wf-active' : '');
[258] Fix | Delete
echo '<li class="wf-schedule-time' . $active . '" data-hour="' . ($i + 12) . '" role="checkbox" aria-checked="' . (empty($active) ? 'false' : 'true') . '" tabindex="0">' . str_pad($h, 2, '0', STR_PAD_LEFT) . '</li>';
[259] Fix | Delete
}
[260] Fix | Delete
?>
[261] Fix | Delete
</ul>
[262] Fix | Delete
</div>
[263] Fix | Delete
</td>
[264] Fix | Delete
</tr>
[265] Fix | Delete
<?php endforeach; ?>
[266] Fix | Delete
</table>
[267] Fix | Delete
<script type="application/javascript">
[268] Fix | Delete
(function($) {
[269] Fix | Delete
$(function() {
[270] Fix | Delete
$('.wf-schedule-time').on('keydown', function(e) {
[271] Fix | Delete
if (e.keyCode == 32) {
[272] Fix | Delete
e.preventDefault();
[273] Fix | Delete
e.stopPropagation();
[274] Fix | Delete
[275] Fix | Delete
$(this).trigger('click');
[276] Fix | Delete
}
[277] Fix | Delete
});
[278] Fix | Delete
[279] Fix | Delete
$('.wf-schedule-time').on('click', function(e) {
[280] Fix | Delete
e.preventDefault();
[281] Fix | Delete
e.stopPropagation();
[282] Fix | Delete
[283] Fix | Delete
var isActive = $(this).hasClass('wf-active');
[284] Fix | Delete
$(this).toggleClass('wf-active', !isActive).attr('aria-checked', !isActive ? 'true' : 'false');
[285] Fix | Delete
var originalValue = $('.wf-scan-schedule').data('originalValue');
[286] Fix | Delete
var customSchedule = WFAD.pendingChanges['scanSched'];
[287] Fix | Delete
if (!customSchedule) {
[288] Fix | Delete
customSchedule = JSON.parse(JSON.stringify(originalValue));
[289] Fix | Delete
}
[290] Fix | Delete
[291] Fix | Delete
var day = $(this).closest('.wf-schedule-day').data('day');
[292] Fix | Delete
var hour = $(this).data('hour');
[293] Fix | Delete
customSchedule[day][hour] = isActive ? 0 : 1;
[294] Fix | Delete
[295] Fix | Delete
var isOriginal = true;
[296] Fix | Delete
var dayKeys = Object.keys(originalValue);
[297] Fix | Delete
scheduleEqualityCheck:
[298] Fix | Delete
for (var i = 0; i < dayKeys.length; i++) {
[299] Fix | Delete
var d = dayKeys[i];
[300] Fix | Delete
var originalDay = originalValue[d];
[301] Fix | Delete
var currentDay = customSchedule[d];
[302] Fix | Delete
var hourKeys = Object.keys(originalDay);
[303] Fix | Delete
for (var n = 0; n < hourKeys.length; n++) {
[304] Fix | Delete
var h = hourKeys[n];
[305] Fix | Delete
if (originalDay[h] != currentDay[h]) {
[306] Fix | Delete
isOriginal = false;
[307] Fix | Delete
break scheduleEqualityCheck;
[308] Fix | Delete
}
[309] Fix | Delete
}
[310] Fix | Delete
}
[311] Fix | Delete
[312] Fix | Delete
if (isOriginal) {
[313] Fix | Delete
delete WFAD.pendingChanges['scanSched'];
[314] Fix | Delete
}
[315] Fix | Delete
else {
[316] Fix | Delete
WFAD.pendingChanges['scanSched'] = customSchedule;
[317] Fix | Delete
}
[318] Fix | Delete
[319] Fix | Delete
WFAD.updatePendingChanges();
[320] Fix | Delete
});
[321] Fix | Delete
[322] Fix | Delete
$(window).on('wfOptionsReset', function() {
[323] Fix | Delete
var originalValue = $('.wf-scan-schedule').data('originalValue');
[324] Fix | Delete
$('.wf-schedule-time').each(function() {
[325] Fix | Delete
var day = $(this).closest('.wf-schedule-day').data('day');
[326] Fix | Delete
var hour = $(this).data('hour');
[327] Fix | Delete
$(this).toggleClass('wf-active', !!originalValue[day][hour]).attr('aria-checked', !!originalValue[day][hour] ? 'true' : 'false');
[328] Fix | Delete
});
[329] Fix | Delete
});
[330] Fix | Delete
});
[331] Fix | Delete
})(jQuery);
[332] Fix | Delete
</script>
[333] Fix | Delete
</li>
[334] Fix | Delete
</ul>
[335] Fix | Delete
</li>
[336] Fix | Delete
</ul>
[337] Fix | Delete
</li>
[338] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function