-
Notifications
You must be signed in to change notification settings - Fork 90
/
Copy pathGeneric_Page_PurgeLog_View.php
132 lines (115 loc) · 2.97 KB
/
Generic_Page_PurgeLog_View.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<?php
/**
* File: Generic_Page_PurgeLog_View.php
*
* @package W3TC
*/
namespace W3TC;
if ( ! defined( 'W3TC' ) ) {
die();
}
require W3TC_INC_DIR . '/options/common/header.php';
?>
<style>
.w3tc_purge_log_header {
width: 100%;
display: flex;
align-items: center;
justify-content: space-between;
}
.w3tc_purge_log_clear {
text-align: right;
}
.w3tc_purge_log_table {
display: grid;
grid-template-columns: auto 1fr;
grid-gap: 10px;
background: #fff;
padding: 11px;
border: 1px solid #ccd0d4;
margin-bottom: 11px;
}
.w3tc_purge_log_label {
white-space: nowrap;
font-weight: bold;
}
.w3tc_purge_log_urls {
font-family: courier;
}
.w3tc_purge_log_backtrace {
font-family: courier;
border: 1px solid #ccd0d4;
border-spacing: 0;
}
.w3tc_purge_log_backtrace td {
padding: 5px 5px;
}
.w3tc_purge_log_backtrace tr:nth-child(odd){
background-color: #f2f2f2;
}
</style>
<div class="w3tc_purge_log_header">
<h1>Purges Log</h1>
<div class="w3tc_purge_log_clear">
<?php
echo wp_kses(
Util_Ui::button_link(
__( 'Clear Log', 'w3-total-cache' ),
Util_Ui::url(
array(
'w3tc_default_purgelog_clear' => 'y',
'module' => $module,
)
)
),
array(
'input' => array(
'type' => array(),
'name' => array(),
'class' => array(),
'value' => array(),
'onclick' => array(),
),
)
);
?>
</div>
</div>
<p>
Available logs:
<?php foreach ( $purgelog_modules as $module ) : ?>
<a href="admin.php?page=w3tc_general&view=purge_log&module=<?php echo esc_attr( $module['label'] ); ?>"><?php echo esc_html( $module['name'] ); ?></a>
<?php echo esc_html( $module['postfix'] ); ?>
<?php endforeach ?>
</p>
<p>
Filename: <?php echo esc_html( $log_filename ); ?> (<?php echo esc_html( $log_filefize ); ?>)
</p>
<?php foreach ( $lines as $line ) : ?>
<div class="w3tc_purge_log_table">
<div class="w3tc_purge_log_label">Date</div>
<div><?php echo esc_html( $line['date'] ); ?></div>
<div class="w3tc_purge_log_label">Action</div>
<div class="w3tc_purge_log_message"><?php echo esc_html( $line['message'] ); ?></div>
<div class="w3tc_purge_log_label">User</div>
<div class="w3tc_purge_log_message"><?php echo esc_html( $line['username'] ); ?></div>
<?php if ( ! empty( $line['urls'] ) ) : ?>
<div class="w3tc_purge_log_label">Pages Flushed</div>
<div class="w3tc_purge_log_urls">
<?php foreach ( $line['urls'] as $url ) : ?>
<div><?php echo esc_html( $url ); ?></div>
<?php endforeach ?>
</div>
<?php endif ?>
<div class="w3tc_purge_log_label">Stack Trace</div>
<table class="w3tc_purge_log_backtrace">
<?php foreach ( $line['backtrace'] as $backtrace_line ) : ?>
<tr>
<td><?php echo esc_html( $backtrace_line['number'] ); ?></td>
<td><?php echo $this->esc_filename( $backtrace_line['filename'] ); // phpcs:ignore ?></td>
<td><?php echo esc_html( $backtrace_line['function'] ); ?></td>
</tr>
<?php endforeach ?>
</table>
</div>
<?php endforeach ?>