2014-07-28 14:50:11 +00:00
|
|
|
<?php
|
|
|
|
/**
|
|
|
|
* Admin View: Page - Status Logs
|
2017-11-07 08:29:16 +00:00
|
|
|
*
|
2020-08-05 16:36:24 +00:00
|
|
|
* @package WooCommerce\Admin\Logs
|
2014-07-28 14:50:11 +00:00
|
|
|
*/
|
|
|
|
|
2014-07-28 15:16:35 +00:00
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
2015-03-07 03:16:08 +00:00
|
|
|
exit;
|
2014-07-28 15:16:35 +00:00
|
|
|
}
|
2014-07-28 14:50:11 +00:00
|
|
|
|
|
|
|
?>
|
2014-05-28 10:12:35 +00:00
|
|
|
<?php if ( $logs ) : ?>
|
|
|
|
<div id="log-viewer-select">
|
|
|
|
<div class="alignleft">
|
2016-08-02 13:42:27 +00:00
|
|
|
<h2>
|
|
|
|
<?php echo esc_html( $viewed_log ); ?>
|
2018-07-09 11:01:23 +00:00
|
|
|
<?php if ( ! empty( $viewed_log ) ) : ?>
|
2018-09-14 16:45:53 +00:00
|
|
|
<a class="page-title-action" href="<?php echo esc_url( wp_nonce_url( add_query_arg( array( 'handle' => sanitize_title( $viewed_log ) ), admin_url( 'admin.php?page=wc-status&tab=logs' ) ), 'remove_log' ) ); ?>" class="button"><?php esc_html_e( 'Delete log', 'woocommerce' ); ?></a>
|
2016-08-02 13:42:27 +00:00
|
|
|
<?php endif; ?>
|
|
|
|
</h2>
|
2014-05-28 10:12:35 +00:00
|
|
|
</div>
|
|
|
|
<div class="alignright">
|
2017-11-07 08:29:16 +00:00
|
|
|
<form action="<?php echo esc_url( admin_url( 'admin.php?page=wc-status&tab=logs' ) ); ?>" method="post">
|
2014-05-28 10:12:35 +00:00
|
|
|
<select name="log_file">
|
|
|
|
<?php foreach ( $logs as $log_key => $log_file ) : ?>
|
2017-12-19 17:38:50 +00:00
|
|
|
<?php
|
|
|
|
$timestamp = filemtime( WC_LOG_DIR . $log_file );
|
2021-07-11 07:36:14 +00:00
|
|
|
$date = sprintf(
|
|
|
|
/* translators: 1: last access date 2: last access time 3: last access timezone abbreviation */
|
|
|
|
__( '%1$s at %2$s %3$s', 'woocommerce' ),
|
|
|
|
wp_date( wc_date_format(), $timestamp ),
|
|
|
|
wp_date( wc_time_format(), $timestamp ),
|
|
|
|
wp_date( 'T', $timestamp )
|
|
|
|
);
|
2017-12-19 17:38:50 +00:00
|
|
|
?>
|
|
|
|
<option value="<?php echo esc_attr( $log_key ); ?>" <?php selected( sanitize_title( $viewed_log ), $log_key ); ?>><?php echo esc_html( $log_file ); ?> (<?php echo esc_html( $date ); ?>)</option>
|
2014-05-28 10:12:35 +00:00
|
|
|
<?php endforeach; ?>
|
|
|
|
</select>
|
2017-11-07 08:30:41 +00:00
|
|
|
<button type="submit" class="button" value="<?php esc_attr_e( 'View', 'woocommerce' ); ?>"><?php esc_html_e( 'View', 'woocommerce' ); ?></button>
|
2014-05-28 10:12:35 +00:00
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
<div class="clear"></div>
|
|
|
|
</div>
|
|
|
|
<div id="log-viewer">
|
2016-08-19 21:48:49 +00:00
|
|
|
<pre><?php echo esc_html( file_get_contents( WC_LOG_DIR . $viewed_log ) ); ?></pre>
|
2014-05-28 10:12:35 +00:00
|
|
|
</div>
|
|
|
|
<?php else : ?>
|
2017-11-07 08:29:16 +00:00
|
|
|
<div class="updated woocommerce-message inline"><p><?php esc_html_e( 'There are currently no logs to view.', 'woocommerce' ); ?></p></div>
|
2015-03-07 03:16:08 +00:00
|
|
|
<?php endif; ?>
|