PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 1.9.5
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v1.9.5
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 / admin-page.php

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

460 lines 28.7 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH'))
3 exit;
4
5 $cached_pages = bwp_cached_pages_count();
6
7 ?>
8 <link rel="preconnect" href="https://fonts.googleapis.com">
9 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
10 <link href="https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500&display=swap" rel="stylesheet">
11 <link href="//cdn.datatables.net/2.1.0/css/dataTables.dataTables.min.css" rel="stylesheet">
12 <link rel="stylesheet" href="<?php echo esc_attr(optifer_URL . '/admin/css/style.css?v=' . BERQWP_VERSION); ?>">
13 <link rel="stylesheet"
14 href="<?php echo esc_attr(optifer_URL . '/admin/css/bootstrap-slider.min.css?v=' . BERQWP_VERSION); ?>">
15 <link rel="stylesheet" href="<?php echo esc_attr(optifer_URL . '/admin/css/bootstrap.min.css?v=' . BERQWP_VERSION); ?>">
16
17 <div class="wrap">
18 <h1 style="display:none">BerqWP</h1>
19 <div></div>
20 <div class="berqwp-dashbaord">
21 <div class="berqwp-header">
22 <img src="<?php echo esc_attr(optifer_URL . '/admin/img/berqwp-logo-light.png'); ?>" alt="BerqWP Logo">
23 <div class="berqwp-header-right">
24 <a href="https://wordpress.org/support/plugin/searchpro/reviews/#new-post" target="_blank"
25 class="berqwp-support">
26 <?php esc_html_e('Write a review', 'searchpro'); ?>
27 <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
28 <path
29 d="M11.0001 3C10.7349 3 10.4805 3.10536 10.293 3.29289C10.1054 3.48043 10.0001 3.73478 10.0001 4C10.0001 4.26522 10.1054 4.51957 10.293 4.70711C10.4805 4.89464 10.7349 5 11.0001 5H13.5861L7.29308 11.293C7.19757 11.3852 7.12139 11.4956 7.06898 11.6176C7.01657 11.7396 6.98898 11.8708 6.98783 12.0036C6.98668 12.1364 7.01198 12.2681 7.06226 12.391C7.11254 12.5139 7.18679 12.6255 7.28069 12.7194C7.37458 12.8133 7.48623 12.8875 7.60913 12.9378C7.73202 12.9881 7.8637 13.0134 7.99648 13.0123C8.12926 13.0111 8.26048 12.9835 8.38249 12.9311C8.50449 12.8787 8.61483 12.8025 8.70708 12.707L15.0001 6.414V9C15.0001 9.26522 15.1054 9.51957 15.293 9.70711C15.4805 9.89464 15.7349 10 16.0001 10C16.2653 10 16.5197 9.89464 16.7072 9.70711C16.8947 9.51957 17.0001 9.26522 17.0001 9V4C17.0001 3.73478 16.8947 3.48043 16.7072 3.29289C16.5197 3.10536 16.2653 3 16.0001 3H11.0001Z"
30 fill="#465774" />
31 <path
32 d="M5 5C4.46957 5 3.96086 5.21071 3.58579 5.58579C3.21071 5.96086 3 6.46957 3 7V15C3 15.5304 3.21071 16.0391 3.58579 16.4142C3.96086 16.7893 4.46957 17 5 17H13C13.5304 17 14.0391 16.7893 14.4142 16.4142C14.7893 16.0391 15 15.5304 15 15V12C15 11.7348 14.8946 11.4804 14.7071 11.2929C14.5196 11.1054 14.2652 11 14 11C13.7348 11 13.4804 11.1054 13.2929 11.2929C13.1054 11.4804 13 11.7348 13 12V15H5V7H8C8.26522 7 8.51957 6.89464 8.70711 6.70711C8.89464 6.51957 9 6.26522 9 6C9 5.73478 8.89464 5.48043 8.70711 5.29289C8.51957 5.10536 8.26522 5 8 5H5Z"
33 fill="#465774" />
34 </svg>
35
36 </a>
37 <?php if ($this->key_response->product_ref !== 'Free Account') { ?>
38 <a href="https://berqwp.com/support/" target="_blank" class="berqwp-support">
39 <?php esc_html_e('Contact support', 'searchpro'); ?>
40 <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
41 <path
42 d="M11.0001 3C10.7349 3 10.4805 3.10536 10.293 3.29289C10.1054 3.48043 10.0001 3.73478 10.0001 4C10.0001 4.26522 10.1054 4.51957 10.293 4.70711C10.4805 4.89464 10.7349 5 11.0001 5H13.5861L7.29308 11.293C7.19757 11.3852 7.12139 11.4956 7.06898 11.6176C7.01657 11.7396 6.98898 11.8708 6.98783 12.0036C6.98668 12.1364 7.01198 12.2681 7.06226 12.391C7.11254 12.5139 7.18679 12.6255 7.28069 12.7194C7.37458 12.8133 7.48623 12.8875 7.60913 12.9378C7.73202 12.9881 7.8637 13.0134 7.99648 13.0123C8.12926 13.0111 8.26048 12.9835 8.38249 12.9311C8.50449 12.8787 8.61483 12.8025 8.70708 12.707L15.0001 6.414V9C15.0001 9.26522 15.1054 9.51957 15.293 9.70711C15.4805 9.89464 15.7349 10 16.0001 10C16.2653 10 16.5197 9.89464 16.7072 9.70711C16.8947 9.51957 17.0001 9.26522 17.0001 9V4C17.0001 3.73478 16.8947 3.48043 16.7072 3.29289C16.5197 3.10536 16.2653 3 16.0001 3H11.0001Z"
43 fill="#465774" />
44 <path
45 d="M5 5C4.46957 5 3.96086 5.21071 3.58579 5.58579C3.21071 5.96086 3 6.46957 3 7V15C3 15.5304 3.21071 16.0391 3.58579 16.4142C3.96086 16.7893 4.46957 17 5 17H13C13.5304 17 14.0391 16.7893 14.4142 16.4142C14.7893 16.0391 15 15.5304 15 15V12C15 11.7348 14.8946 11.4804 14.7071 11.2929C14.5196 11.1054 14.2652 11 14 11C13.7348 11 13.4804 11.1054 13.2929 11.2929C13.1054 11.4804 13 11.7348 13 12V15H5V7H8C8.26522 7 8.51957 6.89464 8.70711 6.70711C8.89464 6.51957 9 6.26522 9 6C9 5.73478 8.89464 5.48043 8.70711 5.29289C8.51957 5.10536 8.26522 5 8 5H5Z"
46 fill="#465774" />
47 </svg>
48
49 </a>
50 <?php } else { ?>
51 <a href="https://berqwp.com/dashboard/" target="_blank" class="upgrade-btn">
52 <?php esc_html_e('Upgrade to Premium', 'searchpro'); ?>
53 </a>
54 <?php } ?>
55 </div>
56 </div>
57 <div class="berqwp-dashbord-body">
58 <div class="berqwp-tabs">
59 <div class="berqwp-tab active" data-tab="dashboard">
60 <?php esc_html_e('Dashboard', 'searchpro'); ?>
61 <p>
62 <?php esc_html_e('Flush Cache, Sandbox Mode, Cached Pages', 'searchpro'); ?>
63 </p>
64 </div>
65 <div class="berqwp-tab" data-tab="cache-management">
66 <?php esc_html_e('Cache Management', 'searchpro'); ?>
67 <p>
68 <?php esc_html_e('Exclude Pages, Ignore URL Parameters', 'searchpro'); ?>
69 </p>
70 </div>
71 <div class="berqwp-tab" data-tab="image-optimization">
72 <?php esc_html_e('Image Optimization', 'searchpro'); ?>
73 <p>
74 <?php esc_html_e('WebP Images, Image Resize, LazyLoad', 'searchpro'); ?>
75 </p>
76 </div>
77 <div class="berqwp-tab" data-tab="script-manager">
78 <?php esc_html_e('Script Manager', 'searchpro'); ?>
79 <p>
80 <?php esc_html_e('JavaScript Modes, Emojis, YouTube', 'searchpro'); ?>
81 </p>
82 </div>
83 <div class="berqwp-tab" data-tab="activate-license">
84 <?php esc_html_e('License', 'searchpro'); ?>
85 <p>
86 <?php esc_html_e('Deactivate License Key', 'searchpro'); ?>
87 </p>
88 </div>
89 </div>
90 <div class="berqwp-tab-content">
91 <form action="" method="post">
92 <?php
93 wp_nonce_field('berqwp_save_settings', 'berqwp_save_nonce');
94 require_once optifer_PATH . '/admin/tabs/dashboard.php';
95 require_once optifer_PATH . '/admin/tabs/cache-management.php';
96 require_once optifer_PATH . '/admin/tabs/image-optimization.php';
97 require_once optifer_PATH . '/admin/tabs/script-manager.php';
98 require_once optifer_PATH . '/admin/tabs/activate-license.php';
99 ?>
100 </form>
101 </div>
102 </div>
103 </div>
104 </div>
105 <p class="below-settings-panel">Explore <a href="https://berqier.com" target="_blank">Berqier Ltd</a>, the creators of
106 BerqWP. Want to know more? Reach out—we love talking WordPress!</p>
107 <script src="<?php echo esc_attr(optifer_URL . '/admin/js/bootstrap-slider.js?v=' . BERQWP_VERSION); ?>"></script>
108 <script src="//cdn.datatables.net/2.1.0/js/dataTables.min.js"></script>
109 <script>
110 (function ($) {
111 $(document).ready(function () {
112 $('.bwp_feedback').hide();
113 let berq_nounce = '<?php echo esc_html(wp_create_nonce('wp_rest')); ?>';
114
115 function numberWithCommas(x) {
116 return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
117 }
118
119 function berq_clear_cache() {
120 $.ajax({
121 url: '<?php echo esc_html(get_site_url()); ?>/wp-json/optifer/v1/clear-cache',
122 method: 'POST',
123 beforeSend: function (xhr) {
124 xhr.setRequestHeader('X-WP-Nonce', berq_nounce);
125 },
126 success: function (response) {
127
128 }
129 })
130 }
131
132 let opt_slider = new Slider('#berq_opt_mode', {
133 // min: 5,
134 // max: 30,
135 value: '<?php echo esc_html(get_option('berq_opt_mode', 4)); ?>',
136 ticks_labels: ['Basic', 'Medium', 'Blaze', 'Aggressive'],
137 ticks: [1, 2, 3, 4],
138 // ticks_positions: [0, 50, 100],
139 ticks_snap_bounds: 20,
140 tooltip_position: 'bottom',
141 // formatter: function (value) {
142 // if (value == 1) {
143 // // return '<div class="tooltip-title">Basic (stable)</div> <div class="tooltip-content">Basic optimizations like image lazy loading, page cache etc</div>';
144 // $("div.tooltip-inner").html('<div class="tooltip-title">Basic (stable)</div> <div class="tooltip-content">Basic optimizations like image lazy loading, page cache etc</div>')
145
146 // return '';
147 // }
148 // },
149 ticks_tooltip: true,
150 // ticks_tooltip: true,
151 // lock_to_ticks: true,
152 // step: 1
153 });
154
155 $(".optimzation-slider").mousemove(function (event) {
156 let val = $("#berq_opt_mode").val();
157
158 if ($(".slider-tick:nth-child(1)").is(":hover") || $('.tooltip-inner').html() == '1') {
159 $("div.tooltip-inner").html('<div class="tooltip-title">Basic</div> <div class="tooltip-content">Basic optimizations like image lazy loading, page cache, URL prefectch etc.</div>')
160 }
161
162 if ($(".slider-tick:nth-child(2)").is(":hover") || $('.tooltip-inner').html() == '2') {
163 $("div.tooltip-inner").html('<div class="tooltip-title">Medium</div> <div class="tooltip-content">Highly stable optimization mode for many cases.</div>')
164 }
165
166 if ($(".slider-tick:nth-child(3)").is(":hover") || $('.tooltip-inner').html() == '3') {
167 $("div.tooltip-inner").html('<div class="tooltip-title">Blaze</div> <div class="tooltip-content">Balance between optimization and stability.</div>')
168 }
169
170 if ($(".slider-tick:nth-child(4)").is(":hover") || $('.tooltip-inner').html() == '4') {
171 $("div.tooltip-inner").html('<div class="tooltip-title">Aggressive</div> <div class="tooltip-content">Provide the best possible speed scores.</div>')
172 }
173 })
174
175 $("#berq_opt_mode").on("slide slideStop", function (slideEvt) {
176 let val = $("#berq_opt_mode").val();
177
178 if (val == 1) {
179 $("div.tooltip-inner").html('<div class="tooltip-title">Basic (stable)</div> <div class="tooltip-content">Basic optimizations like image lazy loading, page cache etc</div>')
180 }
181
182 if (val == 2) {
183 $("div.tooltip-inner").html('<div class="tooltip-title">Medium (stable)</div> <div class="tooltip-content">Basic optimizations like image lazy loading, page cache etc</div>')
184 }
185
186 if (val == 3) {
187 $("div.tooltip-inner").html('<div class="tooltip-title">Blaze</div> <div class="tooltip-content">Basic optimizations like image lazy loading, page cache etc</div>')
188 }
189
190 if (val == 4) {
191 $("div.tooltip-inner").html('<div class="tooltip-title">Aggressive</div> <div class="tooltip-content">Basic optimizations like image lazy loading, page cache etc</div>')
192 }
193 })
194
195 $('.berqwp-tab').click(function () {
196 let tab = $(this).attr('data-tab');
197
198 $('.berqwp-tab-content > form > div').hide();
199 $('.berqwp-tab').removeClass('active');
200 $(this).addClass('active');
201 $(`.berqwp-tab-content #${tab}`).show();
202
203 })
204
205 <?php
206 $cache_directory = optifer_cache . '/html/';
207 $home_cache_file = $cache_directory . md5('/') . '.html';
208 $is_home_ready = file_exists($home_cache_file);
209 if ($is_home_ready) { ?>
210
211 $.ajax({
212 method: 'GET',
213 url: 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed',
214 data: {
215 url: '<?php echo get_option('berqwp_enable_sandbox') ? esc_html(home_url() . '/?berqwp') : esc_html(home_url()); ?>',
216 strategy: 'mobile'
217 },
218 success: function (data) {
219 let mobileSpeedScore = data.lighthouseResult.categories.performance.score * 100;
220 if (mobileSpeedScore >= 90) {
221 $('.without-berqwp .berq-speed-score').css('background', `radial-gradient(closest-side, white 79%, transparent 80% 100%), conic-gradient(#2eb91e ${mobileSpeedScore}%, #caffd1 0)`);
222 $('.without-berqwp .berq-speed-score').css('color', '#2eb91e');
223
224 } else if (mobileSpeedScore >= 50) {
225 $('.without-berqwp .berq-speed-score').css('background', `radial-gradient(closest-side, white 79%, transparent 80%, transparent 100%), conic-gradient(rgb(246 174 76) ${mobileSpeedScore}%, rgb(255 248 202) 0deg)`);
226 $('.without-berqwp .berq-speed-score').css('color', 'rgb(246 174 76)');
227
228 } else if (mobileSpeedScore <= 49) {
229 $('.without-berqwp .berq-speed-score').css('background', `radial-gradient(closest-side, white 79%, transparent 80%, transparent 100%), conic-gradient(rgb(246 76 76) ${mobileSpeedScore}%, rgb(255 202 202) 0deg)`);
230 $('.without-berqwp .berq-speed-score').css('color', 'rgb(246 76 76)');
231 }
232
233 $('.without-berqwp .berq-speed-score').html(Math.round(mobileSpeedScore) + `<svg width="40" height="40" viewBox="0 0 40 40" fill="none"
234 xmlns="http://www.w3.org/2000/svg">
235 <g clip-path="url(#clip0_405_102)">
236 <path
237 d="M29.2683 0H10.7317C4.80475 0 0 4.80475 0 10.7317V29.2683C0 35.1952 4.80475 40 10.7317 40H29.2683C35.1952 40 40 35.1952 40 29.2683V10.7317C40 4.80475 35.1952 0 29.2683 0Z"
238 fill="#1F71FF" />
239 <path
240 d="M14.3327 21.2558L26.3146 6.82928L21.3023 17.3L27.3171 18.3704L11.7073 34.1464L20.5862 21.2558H14.3327Z"
241 fill="white" />
242 </g>
243 <defs>
244 <clipPath id="clip0_405_102">
245 <rect width="40" height="40" fill="white" />
246 </clipPath>
247 </defs>
248 </svg>`);
249 }
250 });
251
252 $.ajax({
253 url: ajaxurl,
254 type: 'POST',
255 data: {
256 action: 'berqwp_fetch_remote_html',
257 nonce: berq_nounce,
258 },
259 beforeSend: function (xhr) {
260 xhr.setRequestHeader('X-WP-Nonce', berq_nounce);
261 },
262 success: function (data) {
263 // 'data' contains the HTML content from the specified URL
264 if ($(data).is('[data-berqwp]')) {
265 console.log('HTML contains data-berqwp attribute.');
266 } else {
267 $('.with-berqwp').addClass('cache-not-deleted');
268 console.log('HTML does not contain data-berqwp attribute.');
269 }
270 },
271 error: function () {
272 console.log('Error in AJAX request.');
273 }
274 });
275
276
277 $.ajax({
278 method: 'GET',
279 url: 'https://www.googleapis.com/pagespeedonline/v5/runPagespeed',
280 data: {
281 url: '<?php echo get_option('berqwp_enable_sandbox') ? esc_html(home_url() . '/?berqwp') : esc_html(home_url()); ?>',
282 strategy: 'desktop'
283 },
284 success: function (data) {
285 let mobileSpeedScore = data.lighthouseResult.categories.performance.score * 100;
286
287 if (mobileSpeedScore >= 80 && $('.bwp_feedback')) {
288 $('.bwp_feedback').show();
289 }
290
291 if (mobileSpeedScore >= 90) {
292 $('.with-berqwp .berq-speed-score').css('background', `radial-gradient(closest-side, white 79%, transparent 80% 100%), conic-gradient(#2eb91e ${mobileSpeedScore}%, #caffd1 0)`);
293 $('.with-berqwp .berq-speed-score').css('color', '#2eb91e');
294 } else if (mobileSpeedScore >= 50) {
295 $('.with-berqwp .berq-speed-score').css('background', `radial-gradient(closest-side, white 79%, transparent 80%, transparent 100%), conic-gradient(rgb(246 174 76) ${mobileSpeedScore}%, rgb(255 248 202) 0deg)`);
296 $('.with-berqwp .berq-speed-score').css('color', 'rgb(246 174 76)');
297 } else if (mobileSpeedScore <= 49) {
298 $('.with-berqwp .berq-speed-score').css('background', `radial-gradient(closest-side, white 79%, transparent 80%, transparent 100%), conic-gradient(rgb(246 76 76) ${mobileSpeedScore}%, rgb(255 202 202) 0deg)`);
299 $('.with-berqwp .berq-speed-score').css('color', 'rgb(246 76 76)');
300 }
301 $('.with-berqwp .berq-speed-score').html(Math.round(mobileSpeedScore) + `<svg width="40" height="40" viewBox="0 0 40 40" fill="none"
302 xmlns="http://www.w3.org/2000/svg">
303 <g clip-path="url(#clip0_405_102)">
304 <path
305 d="M29.2683 0H10.7317C4.80475 0 0 4.80475 0 10.7317V29.2683C0 35.1952 4.80475 40 10.7317 40H29.2683C35.1952 40 40 35.1952 40 29.2683V10.7317C40 4.80475 35.1952 0 29.2683 0Z"
306 fill="#1F71FF" />
307 <path
308 d="M14.3327 21.2558L26.3146 6.82928L21.3023 17.3L27.3171 18.3704L11.7073 34.1464L20.5862 21.2558H14.3327Z"
309 fill="white" />
310 </g>
311 <defs>
312 <clipPath id="clip0_405_102">
313 <rect width="40" height="40" fill="white" />
314 </clipPath>
315 </defs>
316 </svg>`);
317 }
318 });
319 <?php } ?>
320
321 // $.ajax({
322 // method: 'POST',
323 // url: '<?php echo esc_html(get_site_url()); ?>/wp-json/optifer/v1/media-ids',
324 // beforeSend: function (xhr) {
325 // xhr.setRequestHeader('X-WP-Nonce', berq_nounce);
326 // },
327 // success: function (data) {
328 // let unoptimized_images = data['unoptimized'];
329 // let optimized_images = data['optimized'];
330 // let total_images = unoptimized_images.length + optimized_images.length;
331 // let optimized_images_count = optimized_images.length;
332 // let unoptimized_images_count = unoptimized_images.length;
333 // let loader = $('.berq-generating-images');
334
335 // $('.berq-optimized-images span').html(optimized_images_count);
336 // $('.berq-unoptimized-images span').html(unoptimized_images_count);
337 // let wheel_per = (optimized_images_count / total_images) * 100;
338
339 // $(".berq-progress-optimized-images").css('background', `radial-gradient(closest-side, white 79%, transparent 80% 100%), conic-gradient(#2763c9 ${wheel_per}%, #cadeff 0)`);
340 // $(".berq-progress-optimized-images").html(`${Math.round(wheel_per)}%`);
341
342
343 // function sendBatch(products, deleting = false) {
344 // var batchSize = 5;
345 // var totalBatches = Math.ceil(products.length / batchSize);
346 // var currentBatchIndex = 0;
347
348 // function processBatch() {
349 // if (currentBatchIndex < totalBatches) {
350 // var start = currentBatchIndex * batchSize;
351 // var end = start + batchSize;
352 // var currentBatch = products.slice(start, end);
353 // var url = '<?php echo esc_html(get_site_url()); ?>/wp-json/optifer/v1/optimize-images';
354
355 // if (deleting) {
356 // var url = '<?php echo esc_html(get_site_url()); ?>/wp-json/optifer/v1/delete-images';
357 // }
358
359 // $.ajax({
360 // url: url,
361 // method: 'POST',
362 // data: {
363 // images: JSON.stringify(currentBatch)
364 // },
365 // beforeSend: function (xhr) {
366 // xhr.setRequestHeader('X-WP-Nonce', berq_nounce);
367 // },
368 // success: function (response) {
369 // // Handle the successful response from the server
370 // if (!deleting) {
371 // if (unoptimized_images_count => batchSize) {
372 // unoptimized_images_count = unoptimized_images_count - batchSize;
373 // optimized_images_count = optimized_images_count + batchSize;
374 // }
375
376 // if (unoptimized_images_count < batchSize) {
377 // optimized_images_count = optimized_images_count + unoptimized_images_count;
378 // unoptimized_images_count = 0;
379 // }
380
381 // currentBatchIndex++;
382 // let per = (optimized_images_count / total_images) * 100;
383 // $(".berq-progress-optimized-images").css('background', `radial-gradient(closest-side, white 79%, transparent 80% 100%), conic-gradient(#2763c9 ${per}%, #cadeff 0)`);
384 // $(".berq-progress-optimized-images").html(`${Math.round(per)}%`);
385
386 // $('.berq-optimized-images span').html(numberWithCommas(optimized_images_count));
387 // $('.berq-unoptimized-images span').html(numberWithCommas(unoptimized_images_count));
388 // } else {
389 // currentBatchIndex++;
390 // let per = (currentBatchIndex / totalBatches) * 100;
391 // $(".berq-progress-optimized-images").css('background', `radial-gradient(closest-side, white 79%, transparent 80% 100%), conic-gradient(#2763c9 ${per}%, #cadeff 0)`);
392
393 // $(".berq-progress-optimized-images").css('font-size', '30px');
394 // $(".berq-progress-optimized-images").html(`Deleting...`);
395
396 // $('.berq-optimized-images').hide();
397 // $('.berq-unoptimized-images').hide();
398 // }
399
400
401 // processBatch(); // Process the next batch
402 // },
403 // error: function (xhr, status, error) {
404 // loader.hide();
405 // // Handle errors that occur during the AJAX request
406 // alert('<?php esc_html_e("Error: Unable to connect to the server. If the issue persists, please contact our support team.", "searchpro"); ?>');
407 // }
408 // });
409 // } else {
410 // loader.hide();
411 // berq_clear_cache();
412 // if (deleting) {
413 // alert('<?php esc_html_e("All WebP images have been deleted.", "searchpro"); ?>');
414 // location.reload();
415 // } else {
416 // alert('<?php esc_html_e("Image optimization completed!", "searchpro"); ?>');
417 // }
418 // }
419 // }
420
421 // processBatch(); // Start processing the batches
422 // }
423
424 // $('.berq-convert-webp').click(function () {
425 // if (unoptimized_images.length > 0) {
426 // loader.show();
427 // sendBatch(unoptimized_images);
428 // } else {
429 // alert('<?php esc_html_e("All images have already been optimized for speed.", "searchpro"); ?>');
430 // }
431 // })
432
433 // $('.berq-delete-webp').click(function () {
434 // if (confirm('Are you sure?')) {
435 // if (optimized_images.length > 0) {
436 // sendBatch(optimized_images, true);
437 // }
438 // }
439 // })
440
441
442
443 // }
444 // });
445 })
446 })(jQuery)
447 </script>
448 <script>
449 (function ($) {
450 $(document).ready(function () {
451 let table = new DataTable('.optimized-pages > table', {
452 // "paging": false, // Disable pagination
453 "searching": false, // Disable the search box
454 "pageLength": 5,
455 "info": false, // Disable the info text (e.g., "Showing 1 to 10 of 57 entries")
456 "lengthChange": false
457 });
458 })
459 })(jQuery)
460 </script>