| 1 |
<?php |
| 2 |
/** |
| 3 |
* Admin View: Page - Status Logs |
| 4 |
* |
| 5 |
* @package WooCommerce/Admin/Logs |
| 6 |
*/ |
| 7 |
|
| 8 |
if ( ! defined( 'ABSPATH' ) ) { |
| 9 |
exit; |
| 10 |
} |
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
?> |
| 15 |
<?php if ( $logs ) : ?> |
| 16 |
<div id="log-viewer-select"> |
| 17 |
<div class="alignright"> |
| 18 |
<form action=" |
| 19 |
<?php |
| 20 |
echo esc_url( |
| 21 |
add_query_arg( |
| 22 |
array( |
| 23 |
'page' => 'cartflows_settings', |
| 24 |
'cartflows-error-log' => 1, |
| 25 |
'tab' => 'logs', |
| 26 |
), |
| 27 |
admin_url( '/admin.php' ) |
| 28 |
) |
| 29 |
); |
| 30 |
?> |
| 31 |
" method="post"> |
| 32 |
<select name="log_file"> |
| 33 |
<?php foreach ( $logs as $log_key => $log_file ) : ?> |
| 34 |
<?php |
| 35 |
$timestamp = filemtime( CARTFLOWS_LOG_DIR . $log_file ); |
| 36 |
$date = sprintf( __( '%1$s at %2$s', 'cartflows' ), date_i18n( 'F j, Y', $timestamp ), date_i18n( 'g:i a', $timestamp ) ); // phpcs:ignore |
| 37 |
?> |
| 38 |
<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> |
| 39 |
<?php endforeach; ?> |
| 40 |
</select> |
| 41 |
<button type="submit" class="button" value="<?php esc_attr_e( 'View', 'cartflows' ); ?>"><?php esc_html_e( 'View', 'cartflows' ); ?></button> |
| 42 |
</form> |
| 43 |
</div> |
| 44 |
<div class="clear"></div> |
| 45 |
</div> |
| 46 |
<div id="log-viewer"> |
| 47 |
<div class="wcf-log-container"> |
| 48 |
<pre><?php echo esc_html( file_get_contents( CARTFLOWS_LOG_DIR . $viewed_log ) ); ?></pre> |
| 49 |
</div> |
| 50 |
<?php if ( ! empty( $viewed_log ) ) : ?> |
| 51 |
<a onclick="return confirm('Are you sure to delete this log?');" style="float: right" href=" |
| 52 |
<?php |
| 53 |
echo esc_url( |
| 54 |
wp_nonce_url( |
| 55 |
add_query_arg( |
| 56 |
array( |
| 57 |
'handle' => sanitize_title( $viewed_log ), |
| 58 |
'tab' => 'logs', |
| 59 |
) |
| 60 |
), |
| 61 |
'remove_log' |
| 62 |
) |
| 63 |
); |
| 64 |
?> |
| 65 |
"><?php esc_html_e( 'Delete log', 'cartflows' ); ?></a> |
| 66 |
<?php endif; ?> |
| 67 |
|
| 68 |
</div> |
| 69 |
<?php else : ?> |
| 70 |
<div class="updated woocommerce-message inline"><p><?php esc_html_e( 'There are currently no logs to view.', 'cartflows' ); ?></p></div> |
| 71 |
<?php endif; ?> |
| 72 |
|