PluginProbe ʕ •ᴥ•ʔ
10Web Booster – Website speed optimization, Cache & Page Speed optimizer / trunk
10Web Booster – Website speed optimization, Cache & Page Speed optimizer vtrunk
2.33.0 2.30.5 2.30.7 2.30.9 2.31.10 2.31.8 2.32.11 2.32.21 2.32.3 2.32.4 2.32.7 2.6.31 2.6.40 2.6.42 2.6.7 2.7.37 2.7.44 2.7.47 2.8.18 2.8.19 2.8.32 2.8.34 2.8.35 2.9.23 2.9.24 2.9.25 2.9.27 v2.27.4 trunk 2.0.10 2.0.11 2.0.12 2.0.13 2.0.14 2.0.15 2.0.17 2.0.18 2.0.21 2.0.22 2.0.25 2.0.26 2.0.27 2.0.3 2.0.7 2.0.9 2.10.46 2.10.65 2.10.66 2.10.68 2.11.41 2.11.42 2.11.43 2.12.15 2.12.21 2.12.22 2.12.23 2.12.26 2.13.37 2.13.40 2.13.41 2.13.42 2.13.44 2.13.45 2.13.47 2.14.49 2.14.50 2.15.18 2.17.21 2.17.23 2.18.17 2.19.44 2.19.45 2.19.46 2.19.49 2.2.12 2.2.15 2.2.16 2.2.18 2.2.8 2.20.31 2.20.32 2.20.33 2.21.11 2.21.12 2.21.16 2.21.25 2.22.32 2.23.13 2.23.15 2.23.16 2.23.18 2.24.12 2.24.14 2.24.18 2.25.14 2.26.6 2.28.10 2.28.13 2.28.14 2.28.7 2.29.1 2.29.2 2.29.3 2.3.0 2.3.1 2.3.2 2.3.3 2.30.18
tenweb-speed-optimizer / vendor / 10web-utils / tenweb-image-optimizer / src / TenWebIO / Views / LogsView.php
tenweb-speed-optimizer / vendor / 10web-utils / tenweb-image-optimizer / src / TenWebIO / Views Last commit date
LogsView.php 2 years ago
LogsView.php
162 lines
1 <?php
2 namespace TenWebIO\Views;
3
4 use TenWebIO\CompressDataService;
5 use TenWebIO\Config;
6 use TenWebIO\Logs;
7 use TenWebIO\Settings;
8 use TenWebIO\Utils;
9
10 class LogsView
11 {
12 private $config;
13 private $compress_data_service;
14
15 /**
16 * @return void
17 */
18 public function __construct()
19 {
20 $this->compress_data_service = new CompressDataService();
21 $this->config = new Config();
22 add_action('admin_menu', array($this, 'menu'));
23 add_action('admin_init', array($this, 'init'));
24 }
25
26 /**
27 * @return void
28 */
29 public function menu()
30 {
31 add_submenu_page('', 'Image Optimizer', 'Logs', 'manage_options', TENWEBIO_PREFIX . '_logs', array($this, 'view'));
32 }
33
34 public function init()
35 {
36 if (isset($_POST["clear_logs"])) {
37 check_admin_referer('nonce_' . TENWEBIO_PREFIX, 'nonce_' . TENWEBIO_PREFIX);
38 Logs::clearLogs();
39 } else if (isset($_POST["clear_settings"])) {
40 check_admin_referer('nonce_' . TENWEBIO_PREFIX, 'nonce_' . TENWEBIO_PREFIX);
41 Settings::purgeCompressSettings();
42 delete_site_option(TENWEBIO_PREFIX . '_running_compress_bulk');
43 } else if (isset($_POST["save_configs"])) {
44 check_admin_referer('nonce_' . TENWEBIO_PREFIX, 'nonce_' . TENWEBIO_PREFIX);
45 $this->config->save($_POST);
46 } else if (isset($_POST["cancel_compress"])) {
47 check_admin_referer('nonce_' . TENWEBIO_PREFIX, 'nonce_' . TENWEBIO_PREFIX);
48 Utils::finishQueue('bulk');
49 }
50 }
51
52 /**
53 * @return void
54 */
55 public function view()
56 {
57 $logs = Logs::getLogs();
58 $compress_logs = $this->compress_data_service->getNotCompressedNumbers(true);
59 ?>
60 <div>
61 <div>
62 <h1>Compress Report:</h1>
63 <div>
64 <table class="wp-list-table widefat fixed striped pages">
65 <tr>
66 <td>Not optimized full</td>
67 <td><?php echo $compress_logs['not_optimized']['full']; ?></td>
68 </tr>
69 <tr>
70 <td>Not optimized thumbs</td>
71 <td><?php echo $compress_logs['not_optimized']['thumbs']; ?></td>
72 </tr>
73 <tr>
74 <td>Not optimized other</td>
75 <td><?php echo $compress_logs['not_optimized']['other']; ?></td>
76 </tr>
77 <tr>
78 <td>Last optimized total</td>
79 <td><?php echo $compress_logs['last_optimized']['size']; ?>
80 (<?php echo $compress_logs['last_optimized']['percent']; ?>%)
81 </td>
82 </tr>
83 </table>
84 <br><br>
85 </div>
86 </div>
87 <form
88 method="post"
89 id="logs_form"
90 action="">
91 <?php wp_nonce_field('nonce_' . TENWEBIO_PREFIX, 'nonce_' . TENWEBIO_PREFIX); ?>
92 <h1>Configs</h1>
93 <table class="wp-list-table widefat fixed striped pages">
94 <tr>
95 <td>Debug mode</td>
96 <td><input type="checkbox" value="1" id="iowd_config_debug"
97 name="debug_mode" <?php echo $this->config->getDebugMode() ? 'checked="checked"' : ''; ?>>
98 </td>
99 </tr>
100 <tr>
101 <td>Images count limit for restart</td>
102 <td><input type="text" value="<?php echo $this->config->getImagesLimitForRestart(); ?>"
103 id="iowd_config_images_limit_for_restart"
104 name="images_limit_for_restart"></td>
105 </tr>
106 <tr>
107 <td>Queue chunk images limit</td>
108 <td><input type="text" value="<?php echo $this->config->getQueueChunkImagesLimit(); ?>"
109 id="iowd_config_queue_chunk_images_limit"
110 name="queue_chunk_images_limit"></td>
111 </tr>
112 <tr>
113 <td>Stat chunk images limit</td>
114 <td><input type="text" value="<?php echo $this->config->getStatChunkImagesLimit(); ?>"
115 id="iowd_config_stat_chunk_images_limit"
116 name="stat_chunk_images_limit"></td>
117 </tr>
118 <tr>
119 <td>Auto optimize with rest</td>
120 <td><input type="checkbox" value="1" id="iowd_config_auto_optimize_with_rest"
121 name="auto_optimize_with_rest" <?php echo $this->config->getAutoOptimizeWithRest() ? 'checked="checked"' : ''; ?>>
122 </td>
123 </tr>
124 <tr>
125 <td>Compress only full size</td>
126 <td><input type="checkbox" value="1" id="iowd_compress_only_full_size"
127 name="compress_only_full_size" <?php echo $this->config->getCompressOnlyFullSize() ? 'checked="checked"' : ''; ?>>
128 </td>
129 </tr>
130 </table>
131 <br>
132 <input type="submit" class="button action" value="Clear Logs" name="clear_logs">
133 <input type="submit" class="button action" value="Clear Settings" name="clear_settings">
134 <input type="submit" class="button action" value="Save Configs" name="save_configs">
135 <input type="submit" class="button action" value="Cancel running compress" name="cancel_compress">
136 </form>
137 <h1>Optimization Logs</h1>
138 <table class="wp-list-table widefat fixed striped pages">
139 <thead>
140 <tr>
141 <th>Type</th>
142 <th>Key</th>
143 <th>Message</th>
144 <th>Date</th>
145 </tr>
146 </thead>
147 <?php foreach ($logs as $key => $log) { ?>
148 <tr>
149 <td><?php echo !empty($log["type"]) ? $log["type"] : 'log'; ?></td>
150 <td><?php echo $key; ?></td>
151 <td><?php echo $log["msg"]; ?></td>
152 <td><?php echo $log["date"]; ?></td>
153 </tr>
154 <?php } ?>
155 </table>
156 </div>
157
158 <?php
159 }
160
161 }
162