mirror of
https://github.com/WordPress/five-for-the-future.git
synced 2025-07-12 21:35:44 +03:00
Logging: Initial commit with proof of concept
This commit is contained in:
parent
6209060eb2
commit
e15522756b
3 changed files with 219 additions and 0 deletions
53
plugins/wporg-5ftf/views/log.php
Normal file
53
plugins/wporg-5ftf/views/log.php
Normal file
|
@ -0,0 +1,53 @@
|
|||
<?php
|
||||
namespace WordPressDotOrg\FiveForTheFuture\View;
|
||||
|
||||
/** @var array $log */
|
||||
?>
|
||||
|
||||
<div class="5ftf-activity-log">
|
||||
<?php if ( ! empty( $log ) ) : ?>
|
||||
|
||||
<table class="striped widefat">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>Date</td>
|
||||
<td>Entry</td>
|
||||
<td>User</td>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ( $log as $entry ) : ?>
|
||||
<tr>
|
||||
<td>
|
||||
<?php echo esc_html( date( 'Y-m-d G:i:s', $entry['timestamp'] ) ); ?>
|
||||
</td>
|
||||
<td>
|
||||
<details>
|
||||
<summary>
|
||||
<?php echo wp_kses_data( $entry['message'] ); ?>
|
||||
</summary>
|
||||
<?php if ( ! empty( $entry['data'] ) ) : ?>
|
||||
<pre><?php echo esc_html( print_r( $entry['data'] ) ); ?></pre>
|
||||
<?php endif; ?>
|
||||
</details>
|
||||
</td>
|
||||
<td>
|
||||
<?php
|
||||
$user = get_user_by( 'id', $entry['user_id'] );
|
||||
if ( $user ) : ?>
|
||||
<?php echo sanitize_user( $user->user_login ); ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<?php else : ?>
|
||||
|
||||
<p>
|
||||
There are no log entries.
|
||||
</p>
|
||||
|
||||
<?php endif; ?>
|
||||
</div>
|
Loading…
Add table
Add a link
Reference in a new issue