| 1 |
<?php |
| 2 |
|
| 3 |
use Dev4Press\v43\Core\Quick\File; |
| 4 |
use Dev4Press\v43\Core\Quick\Sanitize; |
| 5 |
|
| 6 |
if ( ! defined( 'ABSPATH' ) ) { |
| 7 |
exit; |
| 8 |
} |
| 9 |
|
| 10 |
$list = sweeppress_settings()->list_statistics(); |
| 11 |
$period = isset( $_GET['period'] ) ? Sanitize::slug( $_GET['period'] ) : ''; // phpcs:ignore WordPress.Security.NonceVerification |
| 12 |
|
| 13 |
if ( ! isset( $list[ $period ] ) ) { |
| 14 |
$period = ''; |
| 15 |
} |
| 16 |
|
| 17 |
$statistics = sweeppress_settings()->get_statistics( $period ); |
| 18 |
|
| 19 |
?> |
| 20 |
<div class="d4p-content"> |
| 21 |
<?php if ( ! isset( $statistics['sweepers'] ) ) { ?> |
| 22 |
<p><?php esc_html_e( 'There is no data to show here.', 'sweeppress' ); ?></p> |
| 23 |
<?php } else { ?> |
| 24 |
<div class="d4p-group"> |
| 25 |
<h3><?php esc_html_e( 'Basic Statistics', 'sweeppress' ); ?></h3> |
| 26 |
<div class="d4p-group-inner"> |
| 27 |
<dl> |
| 28 |
<dt><?php esc_html_e( 'Period', 'sweeppress' ); ?></dt> |
| 29 |
<dd><?php echo esc_html( $statistics['label'] ); ?></dd> |
| 30 |
</dl> |
| 31 |
<hr/> |
| 32 |
<dl> |
| 33 |
<dt><?php esc_html_e( 'Sources', 'sweeppress' ); ?></dt> |
| 34 |
<dd> |
| 35 |
<?php echo esc_html__( 'Quick', 'sweeppress' ) . ': ' . absint( $statistics['quick'] ); ?><br/> |
| 36 |
<?php echo esc_html__( 'Sweep', 'sweeppress' ) . ': ' . absint( $statistics['panel'] ); ?><br/> |
| 37 |
<?php echo esc_html__( 'Scheduler', 'sweeppress' ) . ': ' . absint( $statistics['scheduler'] ); ?> |
| 38 |
<br/> |
| 39 |
<?php echo esc_html__( 'Auto', 'sweeppress' ) . ': ' . absint( $statistics['auto'] ); ?><br/> |
| 40 |
<?php echo esc_html__( 'CLI', 'sweeppress' ) . ': ' . absint( $statistics['cli'] ); ?><br/> |
| 41 |
<?php echo esc_html__( 'REST', 'sweeppress' ) . ': ' . absint( $statistics['rest'] ); ?> |
| 42 |
</dd> |
| 43 |
</dl> |
| 44 |
<hr/> |
| 45 |
<dl> |
| 46 |
<dt><?php esc_html_e( 'Sweepers Run', 'sweeppress' ); ?></dt> |
| 47 |
<dd><?php echo absint( $statistics['jobs'] ); ?></dd> |
| 48 |
<dt><?php esc_html_e( 'Sweeper Tasks Run', 'sweeppress' ); ?></dt> |
| 49 |
<dd><?php echo absint( $statistics['tasks'] ); ?></dd> |
| 50 |
<dt><?php esc_html_e( 'Records Removed', 'sweeppress' ); ?></dt> |
| 51 |
<dd><?php echo absint( $statistics['records'] ); ?></dd> |
| 52 |
<dt><?php esc_html_e( 'Space Recovered', 'sweeppress' ); ?></dt> |
| 53 |
<dd><?php echo File::size_format( absint( $statistics['size'] ) ); ?></dd> |
| 54 |
<dt><?php esc_html_e( 'Sweeping Time', 'sweeppress' ); ?></dt> |
| 55 |
<dd><?php echo ceil( $statistics['time'] ) . ' ' . esc_html__( 'seconds', 'sweeppress' ); ?></dd> |
| 56 |
</dl> |
| 57 |
<hr/> |
| 58 |
<dl> |
| 59 |
<dt><?php esc_html_e( 'Total Space Recovered (With Database Cleanup)', 'sweeppress' ); ?></dt> |
| 60 |
<dd><?php echo File::size_format( absint( $statistics['size_total'] ) ); ?></dd> |
| 61 |
</dl> |
| 62 |
</div> |
| 63 |
</div> |
| 64 |
<div class="d4p-group"> |
| 65 |
<h3><?php esc_html_e( 'Individual Sweepers', 'sweeppress' ); ?></h3> |
| 66 |
<div class="d4p-group-inner sweeppress-statistics-sweeper"> |
| 67 |
<?php foreach ( $statistics['sweepers'] as $sweeper => $data ) { ?> |
| 68 |
<h5><?php echo sweeppress_core()->get_sweeper_title( $sweeper ); ?></h5> |
| 69 |
<dl> |
| 70 |
<dt><?php esc_html_e( 'Sweeps Counter', 'sweeppress' ); ?></dt> |
| 71 |
<dd><?php echo absint( $data['counts'] ?? 1 ); ?></dd> |
| 72 |
<dt><?php esc_html_e( 'Records Removed', 'sweeppress' ); ?></dt> |
| 73 |
<dd><?php echo absint( $data['records'] ); ?></dd> |
| 74 |
<dt><?php esc_html_e( 'Space Recovered', 'sweeppress' ); ?></dt> |
| 75 |
<dd><?php echo File::size_format( absint( $data['size'] ) ); ?></dd> |
| 76 |
<dt><?php esc_html_e( 'Sweeping Time', 'sweeppress' ); ?></dt> |
| 77 |
<dd><?php echo ceil( $data['time'] ) . ' ' . esc_html__( 'seconds', 'sweeppress' ); ?></dd> |
| 78 |
</dl> |
| 79 |
<?php } ?> |
| 80 |
</div> |
| 81 |
</div> |
| 82 |
<?php } ?> |
| 83 |
</div> |
| 84 |
|