PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 1.9.4
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v1.9.4
4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 1.9.3 1.9.4 1.9.5 1.9.6 All 170 releases
searchpro / admin / tabs / dashboard.php

dashboard.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 1.9.4, at admin/tabs/dashboard.php

274 lines 11.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) exit;
3
4 $post_types = get_option('berqwp_optimize_post_types');
5 $paged = 1;
6 $posts_per_page = 500; // Number of posts to process per batch
7 $total_pages = 0;
8 $cached_pages = 0;
9 $optimized_pages = [];
10
11 do {
12 $args = array(
13 'post_type' => $post_types,
14 'posts_per_page' => $posts_per_page,
15 'paged' => $paged,
16 );
17
18 $query = new WP_Query($args);
19
20 while ($query->have_posts()) {
21 $query->the_post();
22
23 $url = trailingslashit(get_permalink());
24 $slug = str_replace(home_url(), '', $url);
25
26 if (berqwp_is_slug_excludable($slug)) {
27 continue;
28 }
29
30 $cache_directory = optifer_cache . '/html/';
31 $cache_key = md5($slug);
32 $cache_file = $cache_directory . $cache_key . '.html';
33
34 if (file_exists($cache_file)) {
35 $cached_pages++;
36
37 $status = '<span class="bwp-cache-tag completed">Completed</span>';
38
39 if (bwp_is_partial_cache($slug) === true) {
40 $status = '<span class="bwp-cache-tag part-completed">Partial cache</span>';
41 }
42
43 $page_arr = [
44 'url' => $url,
45 'status' => $status,
46 'last_modified' => filemtime($cache_file)
47 ];
48
49 array_push($optimized_pages, $page_arr);
50 }
51
52 $total_pages++;
53 }
54
55 // Reset post data
56 wp_reset_postdata();
57
58 // Increase the paged value to get the next set of posts
59 $paged++;
60
61 } while ($query->have_posts());
62
63 // $optimized_pages = [
64 // ["url" => "test url", "last_modified" => "1721741554"],
65 // ["url" => "test url", "last_modified" => "1721741554"],
66 // ["url" => "test url", "last_modified" => "1721741554"],
67 // ["url" => "test url", "last_modified" => "1721741554"],
68 // ["url" => "test url", "last_modified" => "1721741554"],
69 // ["url" => "test url", "last_modified" => "1721741554"],
70 // ["url" => "test url", "last_modified" => "1721741554"],
71 // ["url" => "test url", "last_modified" => "1721741554"],
72 // ["url" => "test url", "last_modified" => "1721741554"],
73 // ["url" => "test url", "last_modified" => "1721741554"],
74 // ["url" => "test url", "last_modified" => "1721741554"],
75 // ["url" => "test url", "last_modified" => "1721741554"],
76 // ["url" => "test url", "last_modified" => "1721741554"],
77 // ["url" => "test url", "last_modified" => "1721741554"],
78 // ["url" => "test url", "last_modified" => "1721741554"],
79 // ];
80
81 wp_reset_postdata();
82
83 $cached_percentage = round((count($optimized_pages) / $total_pages) * 100, 2);
84
85 ?>
86 <div id="dashboard">
87 <h2 class="berq-tab-title">Dashboard</h2>
88 <div class="berq-info-box guide">
89 <div class="berq-box-content">
90 <p><?php esc_html_e('Guide:', 'searchpro'); ?> <a href="https://berqwp.com/help-center/get-started-with-berqwp/" target="_blank"><?php esc_html_e('Get Started With BerqWP', 'searchpro'); ?></a></p>
91 </div>
92
93 </div>
94
95 <?php
96 if (bwp_cached_pages_count() <= 0 ) {
97 bwp_dash_notification("We're currently building the cache for this website, which may take up to 5 minutes. Thank you for your patience, good things are worth the wait.", 'warning');
98 }
99 ?>
100
101 <div class="berq-info-box">
102 <h3 class="berq-box-title"><?php esc_html_e('Optimization Mode', 'searchpro'); ?></h3>
103 <div class="berq-box-content">
104 <p style="margin-bottom:40px"><?php esc_html_e("Optimization modes are optimization presets that allow you to balance your website between the best optimization score and website functionality stability.", 'searchpro'); ?> <a href="https://berqwp.com/help-center/berqwp-optimization-modes/" target="_blank"><?php esc_html_e("Learn more", 'searchpro'); ?></a> </p>
105 <div class="optimzation-slider">
106 <input id="berq_opt_mode" name="berq_opt_mode" type="text" value="<?php echo esc_attr( get_option('berq_opt_mode') ); ?>" style="display:none" />
107 </div>
108
109 </div>
110 </div>
111 <div class="berq-info-box before-after-comparision">
112 <h3 class="berq-box-title"><?php esc_html_e('Google PageSpeed Score', 'searchpro'); ?></h3>
113 <div class="without-berqwp">
114 <?php
115 if (get_option('berqwp_enable_sandbox')) {
116 echo '<div class="berqw-sandbox">Sandbox Optimization</div>';
117 }
118 ?>
119 <div class="berq-speed-score"></div>
120 <p class="device-type"><?php esc_html_e('Device: Mobile', 'searchpro'); ?></p>
121 <p class="website-url">
122 <?php
123 $cache_directory = optifer_cache . '/html/';
124 $is_home_ready = file_exists($cache_directory . md5('/') . '.html');
125 $msg = '';
126
127 if (get_option('berqwp_enable_sandbox')) {
128 $msg .= '/?berqwp';
129 }
130
131 if ($is_home_ready == false) {
132 $msg .= '<br>This page isn\'t cached yet';
133 }
134 echo wp_kses_post(home_url() . $msg); ?>
135 </p>
136 <h4><?php esc_html_e('Mobile Score', 'searchpro'); ?></h4>
137 </div>
138 <div class="with-berqwp">
139 <?php
140 if (get_option('berqwp_enable_sandbox')) {
141 echo '<div class="berqw-sandbox">Sandbox Optimization</div>';
142 }
143 ?>
144 <div class="berq-speed-score"></div>
145 <p class="device-type"><?php esc_html_e('Device: Desktop', 'searchpro'); ?></p>
146 <p class="website-url">
147 <?php
148 $cache_directory = optifer_cache . '/html/';
149 $is_home_ready = file_exists($cache_directory . md5('/') . '.html');
150 $msg = '';
151
152 if (get_option('berqwp_enable_sandbox')) {
153 $msg .= '/?berqwp';
154 }
155
156 if ($is_home_ready == false) {
157 $msg .= '<br>This page isn\'t cached yet';
158 }
159 echo wp_kses_post(home_url() . $msg); ?>
160 </p>
161 <h4><?php esc_html_e('Desktop Score', 'searchpro'); ?></h4>
162 </div>
163 </div>
164
165 <div class="berq-info-box">
166 <h3 class="berq-box-title"><?php esc_html_e('Cached Pages', 'searchpro'); ?></h3>
167 <div class="berq-box-content">
168 <div class="cache-percentage"><p><b><?php echo $cached_percentage; ?>%</b> (<?php echo $cached_pages; ?>) of your pages are currently cached.</p></div>
169 <div class="cached-pages-bar">
170 <div class="progress-bar" style="width:<?php echo $cached_percentage; ?>%"></div>
171 </div>
172
173 <?php
174 if ($this->key_response->product_ref == 'Free Account' && bwp_cached_pages_count() >= 10) {
175 bwp_dash_notification("You've reached the limit of 10 optimized pages for your free BerqWP account. Upgrade now to optimize unlimited pages and get the best performance for your entire site!", "warning");
176 }
177 ?>
178
179 <div class="optimized-pages">
180 <table>
181 <thead>
182 <tr>
183 <th>Page URL</th>
184 <th>Cache Status</th>
185 <th>Last Optimized Date</th>
186 </tr>
187 </thead>
188 <tbody>
189 <?php
190 if (!empty($optimized_pages)) {
191 foreach ($optimized_pages as $page) {
192 $row_html = "<tr>";
193 $row_html .= "<td>";
194 $row_html .= $page['url'];
195 $row_html .= "</td>";
196 $row_html .= "<td>";
197 $row_html .= $page['status'];
198 $row_html .= "</td>";
199 $row_html .= "<td>";
200 $row_html .= date('Y-m-d H:i:s', $page['last_modified']);
201 $row_html .= "</td>";
202 $row_html .= "</tr>";
203 echo $row_html;
204 }
205 }
206 ?>
207
208 </tbody>
209 </table>
210 </div>
211 </div>
212 </div>
213 <div class="berq-dual-box">
214 <div class="berq-info-box">
215 <h3 class="berq-box-title"><?php esc_html_e('My Account', 'searchpro'); ?></h3>
216 <div class="berq-box-content">
217
218 <?php if ($this->key_response->product_ref !== 'AppSumo Deal') { ?>
219 <p>
220 <?php esc_html_e('License:', 'searchpro'); ?>
221 <?php echo esc_html( $this->key_response->product_ref ); ?>
222 </p>
223 <?php } ?>
224
225 <p><?php esc_html_e('License status:', 'searchpro'); ?>
226 <?php echo esc_html( $this->key_response->status ); ?>
227 </p>
228
229 <?php if ($this->key_response->product_ref !== 'AppSumo Deal' && $this->key_response->product_ref !== 'Free Account') { ?>
230 <p><?php esc_html_e('Expiration date:', 'searchpro'); ?>
231 <?php echo esc_html( $this->key_response->date_expiry ); ?>
232 </p>
233 <?php } ?>
234
235 </div>
236 </div>
237 <div class="berq-info-box">
238 <h3 class="berq-box-title"><?php esc_html_e('Quick Actions', 'searchpro'); ?></h3>
239 <div class="berq-box-content">
240 <a href="<?php echo esc_attr(wp_nonce_url(admin_url('admin-post.php?action=clear_cache'), 'clear_cache_action')); ?>" class="berq-btn"><?php esc_html_e('Flush cache', 'searchpro'); ?></a>
241 <a href=https://berqwp.com/help-center/" target="_blank" class="berq-btn"><?php esc_html_e('Visit help center', 'searchpro'); ?></a>
242 </div>
243 </div>
244
245 </div>
246 <div class="berq-info-box">
247 <h3 class="berq-box-title"><?php esc_html_e('Sandbox', 'searchpro'); ?></h3>
248 <div class="berq-box-content">
249 <p><?php esc_html_e("The Sandbox feature allows you to test BerqWP's optimizations without impacting real visitors. Note that pages will load slower when sandbox mode is enabled.", 'searchpro'); ?> <a href="https://berqwp.com/help-center/sandbox-mode-and-how-to-use-it/" target="_blank"><?php esc_html_e("Learn more", 'searchpro'); ?></a> </p>
250 <label class="berq-check">
251 <input type="checkbox" name="berqwp_enable_sandbox" <?php checked(1, get_option('berqwp_enable_sandbox'), true); ?>>
252 <?php esc_html_e('Enable sandbox', 'searchpro'); ?>
253 </label>
254 </div>
255 </div>
256
257 <div class="berq-info-box">
258 <h3 class="berq-box-title"><?php esc_html_e('BerqWP CDN', 'searchpro'); ?></h3>
259 <div class="berq-box-content">
260 <p><?php esc_html_e("BerqWP CDN delivers static files instantly to enhance website performance and user experience.", 'searchpro'); ?></p>
261 <label class="berq-check">
262 <input type="checkbox" name="berqwp_enable_cdn" <?php checked(1, get_option('berqwp_enable_cdn'), true); ?>>
263 <?php esc_html_e('Enable BerqWP CDN', 'searchpro'); ?>
264 </label>
265 </div>
266 </div>
267
268 <button type="submit" class="berqwp-save"><svg width="20" height="20" viewBox="0 0 20 20" fill="none"
269 xmlns="http://www.w3.org/2000/svg">
270 <path d="M4.16663 10.8333L7.49996 14.1667L15.8333 5.83334" stroke="white" stroke-width="2"
271 stroke-linecap="round" stroke-linejoin="round" />
272 </svg>
273 <?php esc_html_e('Save changes', 'searchpro'); ?></button>
274 </div>