No Description

html-admin-page-status-logs.php 1.9KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /**
  3. * Admin View: Page - Status Logs
  4. *
  5. * @package WooCommerce\Admin\Logs
  6. */
  7. if ( ! defined( 'ABSPATH' ) ) {
  8. exit;
  9. }
  10. ?>
  11. <?php if ( $logs ) : ?>
  12. <div id="log-viewer-select">
  13. <div class="alignleft">
  14. <h2>
  15. <?php echo esc_html( $viewed_log ); ?>
  16. <?php if ( ! empty( $viewed_log ) ) : ?>
  17. <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>
  18. <?php endif; ?>
  19. </h2>
  20. </div>
  21. <div class="alignright">
  22. <form action="<?php echo esc_url( admin_url( 'admin.php?page=wc-status&tab=logs' ) ); ?>" method="post">
  23. <select name="log_file">
  24. <?php foreach ( $logs as $log_key => $log_file ) : ?>
  25. <?php
  26. $timestamp = filemtime( WC_LOG_DIR . $log_file );
  27. $date = sprintf(
  28. /* translators: 1: last access date 2: last access time 3: last access timezone abbreviation */
  29. __( '%1$s at %2$s %3$s', 'woocommerce' ),
  30. wp_date( wc_date_format(), $timestamp ),
  31. wp_date( wc_time_format(), $timestamp ),
  32. wp_date( 'T', $timestamp )
  33. );
  34. ?>
  35. <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>
  36. <?php endforeach; ?>
  37. </select>
  38. <button type="submit" class="button" value="<?php esc_attr_e( 'View', 'woocommerce' ); ?>"><?php esc_html_e( 'View', 'woocommerce' ); ?></button>
  39. </form>
  40. </div>
  41. <div class="clear"></div>
  42. </div>
  43. <div id="log-viewer">
  44. <pre><?php echo esc_html( file_get_contents( WC_LOG_DIR . $viewed_log ) ); ?></pre>
  45. </div>
  46. <?php else : ?>
  47. <div class="updated woocommerce-message inline"><p><?php esc_html_e( 'There are currently no logs to view.', 'woocommerce' ); ?></p></div>
  48. <?php endif; ?>