Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion css/spbc-settings.min.css

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions css/src/spbc-settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,8 @@
left: 0;
top: 0;
text-align: center;
z-index: 1;
pointer-events: none;
}
.spbc_progressbar_counter span{
vertical-align: sub;
Expand Down
2 changes: 2 additions & 0 deletions inc/spbc-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,8 @@ function spbc_admin_init()
add_action('wp_ajax_spbc_scanner__pause', 'spbc_scanner__pause');
add_action('wp_ajax_spbc_scanner__resume', 'spbc_scanner__resume');
add_action('wp_ajax_spbc_scanner__getScannerStatus', 'spbc_scanner__getScannerStatus');
add_action('wp_ajax_spbc_scanner__ackRuntimeError', 'spbc_scanner__ackRuntimeError');
add_action('wp_ajax_spbc_scanner__debug_log', 'spbc_scanner__debug_log');
add_action('wp_ajax_spbc_scanner__last_scan_info', array(ScannerAjaxEndpoints::class, 'getLastScanInfo'));

// Scanner buttons
Expand Down
346 changes: 246 additions & 100 deletions inc/spbc-scanner.php

Large diffs are not rendered by default.

62 changes: 60 additions & 2 deletions inc/spbc-settings.php
Original file line number Diff line number Diff line change
Expand Up @@ -1711,8 +1711,12 @@ function spbc_field_scanner()
// return;
}

if ( function_exists('spbc_scanner__healLastScan') ) {
spbc_scanner__healLastScan();
}

echo '<div id="spbc_scan_accordion">';
if ( ! empty($spbc->data['scanner']['last_scan'])) {
if ( function_exists('spbc_scanner__hasCompletedScan') ? spbc_scanner__hasCompletedScan() : ! empty($spbc->data['scanner']['last_scan']) ) {
spbc_field_scanner__show_accordion(true);
}
echo '</div>';
Expand All @@ -1721,10 +1725,11 @@ function spbc_field_scanner()
echo spbc_field_scanner__log();

// Scan results log
if ( ! empty($spbc->data['scanner']['last_scan'])) {
if ( function_exists('spbc_scanner__hasCompletedScan') ? spbc_scanner__hasCompletedScan() : ! empty($spbc->data['scanner']['last_scan']) ) {
echo ScanningLogFacade::render();
}

// Clear/copy links: hidden until the scan log block is shown.
echo ScanningLogFacade::renderLogActions();

echo '<br>';
Expand Down Expand Up @@ -4303,6 +4308,59 @@ function spbc_scanner__cure_log_data_prepare(&$table)
}
}

/**
* Last/next scan info sentence. Same wording and date format as on master (PHP date + site TZ).
*
* @param bool $direct_call
* @return string
*/
function spbc_scanner__last_scan_info($direct_call = false)
{
global $spbc;

if ( ! $direct_call ) {
spbc_check_ajax_referer('spbc_secret_nonce', 'security');
}

if ( function_exists('spbc_scanner__healLastScan') ) {
spbc_scanner__healLastScan();
}

$last_scan = function_exists('spbc_scanner__completedScanTimestamp')
? spbc_scanner__completedScanTimestamp()
: ( ! empty($spbc->data['scanner']['last_scan']) ? (int) $spbc->data['scanner']['last_scan'] : 0);
$has_completed = function_exists('spbc_scanner__hasCompletedScan')
? spbc_scanner__hasCompletedScan()
: $last_scan > 0;

if ( $has_completed ) {
$files_total = isset($spbc->data['scanner']['files_total'])
? (int) $spbc->data['scanner']['files_total']
: (isset($spbc->data['scanner']['last_scan_amount']) ? (int) $spbc->data['scanner']['last_scan_amount'] : 0);
$scanned_total = isset($spbc->data['scanner']['scanned_total'])
? (int) $spbc->data['scanner']['scanned_total']
: 0;
$output = sprintf(
__('The last scan of this website was on %s, website total files*: %d, files scanned**: %d.', 'security-malware-firewall'),
$last_scan > 0 ? date('M d, Y H:i:s', $last_scan) : __('recently', 'security-malware-firewall'),
$files_total,
$scanned_total
);
if ($spbc->settings['scanner__outbound_links']) {
$count_outbound_links = (string) spbc__get_count_outbound_links();
$output .= sprintf(' ' . __('Outbound links found: %s.', 'security-malware-firewall'), $count_outbound_links);
}
} else {
$output = __('Website hasn\'t been scanned yet.', 'security-malware-firewall');
}

if ( ! $direct_call ) {
wp_send_json_success($output . spbc_get_next_scan_launch_time_text());
}

return $output . spbc_get_next_scan_launch_time_text();
}

/**
* Get the string with next scan time description.
* - "The next automatic scan is scheduled on %s."
Expand Down
2,332 changes: 1,157 additions & 1,175 deletions js/public/spbct-react-bundle.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/spbc-scanner-plugin.min.js

Large diffs are not rendered by default.

Loading
Loading