PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 4.1.16
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v4.1.16
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
← All changes | admin/admin-page.php +497 -338 1.9.44.1.16 View file →
@@ -2,42 +2,93 @@
2 2 if (!defined('ABSPATH'))
3 3 exit;
4 4
5 5 $cached_pages = bwp_cached_pages_count();
6 -
6 +$plugin_name = defined('BERQWP_PLUGIN_NAME') ? BERQWP_PLUGIN_NAME : 'BerqWP';
7 +$berqconfigs = berqConfigs::getInstance();
8 +$configs = $berqconfigs->get_configs();
9 +$berqwp_can_use_cloud = berqwp_can_use_cloud();
7 10 ?>
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); ?>">
11 +<!--<link href="https://fonts.googleapis.com/css2?family=Source+Sans+3:wght@400;500;600;&display=swap" rel="stylesheet">-->
12 +<!--<link href="https://fonts.googleapis.com/css2?family=Lato:wght@400;700&display=swap" rel="stylesheet">-->
13 +<!--<link href="<?php echo esc_attr(optifer_URL . '/admin/css/dataTables.dataTables.min.css?v=' . BERQWP_VERSION); ?>" rel="stylesheet">-->
14 +<!--<link rel="stylesheet" href="<?php echo esc_attr(optifer_URL . '/admin/css/style.css?v=' . BERQWP_VERSION); ?>">-->
15 +<!--<link rel="stylesheet" href="<?php echo esc_attr(optifer_URL . '/admin/css/bootstrap-slider.min.css?v=' . BERQWP_VERSION); ?>">-->
16 +<!--<link rel="stylesheet" href="<?php echo esc_attr(optifer_URL . '/admin/css/bootstrap.min.css?v=' . BERQWP_VERSION); ?>">-->
16 17
17 -<div class="wrap">
18 - <h1 style="display:none">BerqWP</h1>
19 - <div></div>
18 +<div class="wrap1">
19 + <!-- <h1 style="display:none">BerqWP</h1>
20 + <div></div> -->
20 21 <div class="berqwp-dashbaord">
21 22 <div class="berqwp-header">
22 - <img src="<?php echo esc_attr(optifer_URL . '/admin/img/berqwp-logo-light.png'); ?>" alt="BerqWP Logo">
23 + <img src="<?php
24 +
25 + if (defined('BERQWP_LOGO')) {
26 + echo esc_attr(BERQWP_LOGO);
27 + } else {
28 + echo esc_attr(optifer_URL . '/admin/img/logo.png');
29 + }
30 +
31 + ?>" alt="BerqWP Logo">
23 32 <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>
33 + <?php if (empty(berqwp_get_license_key()) || $this->key_response->product_ref == 'Free Account') { ?>
34 + <a class="bwp-action-btn light bwp-upgrade-btn" href="https://berqwp.com/dashboard/?referrer=plugin-installation" target="_blank">
35 + <div class="icon">
36 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-rocket-icon lucide-rocket"><path d="M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5"/><path d="M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09"/><path d="M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z"/><path d="M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05"/></svg>
37 + </div>
38 + <?php esc_html_e('Upgrade to Premium', 'searchpro'); ?>
39 + </a>
40 + <?php } ?>
35 41
42 + <?php if ($this->is_key_verified) { ?>
43 + <div class="optimization-methods-switch <?php echo esc_attr($configs['optimization_method'])?>" title="Optimization method">
44 + <a class="method-local" href="<?php echo esc_attr(wp_nonce_url(admin_url('admin-post.php?action=switch_optimization_method_local'), 'switch_optimization_method_local_action')); ?>">
45 + <div class="icon">
46 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-server-icon lucide-server">
47 + <rect width="20" height="8" x="2" y="2" rx="2" ry="2" />
48 + <rect width="20" height="8" x="2" y="14" rx="2" ry="2" />
49 + <line x1="6" x2="6.01" y1="6" y2="6" />
50 + <line x1="6" x2="6.01" y1="18" y2="18" />
51 + </svg>
52 + </div>
53 + Self-hosted
54 +
55 + </a>
56 +
57 + <a class="method-cloud" href="<?php echo esc_attr(wp_nonce_url(admin_url('admin-post.php?action=switch_optimization_method_cloud'), 'switch_optimization_method_cloud_action')); ?>">
58 + <div class="icon">
59 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-cloudy-icon lucide-cloudy">
60 + <path d="M17.5 12a1 1 0 1 1 0 9H9.006a7 7 0 1 1 6.702-9z" />
61 + <path d="M21.832 9A3 3 0 0 0 19 7h-2.207a5.5 5.5 0 0 0-10.72.61" />
62 + </svg>
63 + </div>
64 + BerqWP Cloud
65 + </a>
66 + </div>
67 +
68 + <?php } ?>
69 +
70 + <a class="bwp-action-btn light" href="<?php echo esc_attr(wp_nonce_url(admin_url('admin-post.php?action=clear_cache'), 'clear_cache_action')); ?>">
71 + <div class="icon">
72 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-brush-cleaning-icon lucide-brush-cleaning"><path d="m16 22-1-4"/><path d="M19 14a1 1 0 0 0 1-1v-1a2 2 0 0 0-2-2h-3a1 1 0 0 1-1-1V4a2 2 0 0 0-4 0v5a1 1 0 0 1-1 1H6a2 2 0 0 0-2 2v1a1 1 0 0 0 1 1"/><path d="M19 14H5l-1.973 6.767A1 1 0 0 0 4 22h16a1 1 0 0 0 .973-1.233z"/><path d="m8 22 1-4"/></svg>
73 + </div>
74 + Flush cache
36 75 </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'); ?>
76 +
77 + <?php if ($berqwp_can_use_cloud) { ?>
78 + <a class="bwp-action-btn" href="<?php echo esc_attr(wp_nonce_url(admin_url('admin-post.php?action=warmup_cache'), 'warmup_cache_action')); ?>">
79 +
80 + <div class="icon">
81 + <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-refresh-ccw-icon lucide-refresh-ccw"><path d="M21 12a9 9 0 0 0-9-9 9.75 9.75 0 0 0-6.74 2.74L3 8"/><path d="M3 3v5h5"/><path d="M3 12a9 9 0 0 0 9 9 9.75 9.75 0 0 0 6.74-2.74L21 16"/><path d="M16 16h5v5"/></svg>
82 + </div>
83 + Warmup cache
84 + </a>
85 + <?php } ?>
86 +
87 + <?php if (bwp_show_docs()) { ?>
88 + <!--<a href="https://wordpress.org/support/plugin/searchpro/reviews/#new-post" target="_blank"
89 + class="berqwp-support">
90 + <?php esc_html_e('Write a review', 'searchpro'); ?>
40 91 <svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
41 92 <path
42 93 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 94 fill="#465774" />
@@ -45,58 +96,87 @@
45 96 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 97 fill="#465774" />
47 98 </svg>
48 99
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>
100 + </a>-->
54 101 <?php } ?>
102 +
55 103 </div>
56 104 </div>
57 105 <div class="berqwp-dashbord-body">
58 106 <div class="berqwp-tabs">
59 - <div class="berqwp-tab active" data-tab="dashboard">
107 + <div class="berqwp-tab <?php bwp_is_tab_nav('dashboard'); ?>" data-tab="dashboard">
108 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-layout-dashboard-icon lucide-layout-dashboard"><rect width="7" height="9" x="3" y="3" rx="1"/><rect width="7" height="5" x="14" y="3" rx="1"/><rect width="7" height="9" x="14" y="12" rx="1"/><rect width="7" height="5" x="3" y="16" rx="1"/></svg></div>
60 109 <?php esc_html_e('Dashboard', 'searchpro'); ?>
61 - <p>
62 - <?php esc_html_e('Flush Cache, Sandbox Mode, Cached Pages', 'searchpro'); ?>
63 - </p>
64 110 </div>
65 - <div class="berqwp-tab" data-tab="cache-management">
111 + <div class="berqwp-tab <?php bwp_is_tab_nav('cache-management'); ?>" data-tab="cache-management">
112 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-gauge-icon lucide-gauge"><path d="m12 14 4-4"/><path d="M3.34 19a10 10 0 1 1 17.32 0"/></svg></div>
66 113 <?php esc_html_e('Cache Management', 'searchpro'); ?>
67 - <p>
68 - <?php esc_html_e('Exclude Pages, Ignore URL Parameters', 'searchpro'); ?>
69 - </p>
70 114 </div>
71 - <div class="berqwp-tab" data-tab="image-optimization">
115 + <div class="berqwp-tab <?php bwp_is_tab_nav('css-javascript'); ?>" data-tab="css-javascript">
116 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-code-icon lucide-code"><path d="m16 18 6-6-6-6"/><path d="m8 6-6 6 6 6"/></svg></div>
117 + <?php esc_html_e('CSS & JavaScript', 'searchpro'); ?>
118 + </div>
119 + <div class="berqwp-tab <?php bwp_is_tab_nav('media-optimization'); ?>" data-tab="media-optimization">
120 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-images-icon lucide-images"><path d="m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16"/><path d="M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2"/><circle cx="13" cy="7" r="1" fill="currentColor"/><rect x="8" y="2" width="14" height="14" rx="2"/></svg></div>
121 + <?php esc_html_e('Media Optimization', 'searchpro'); ?>
122 + </div>
123 + <div class="berqwp-tab <?php bwp_is_tab_nav('content-delivery-network'); ?>" data-tab="content-delivery-network">
124 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-earth-icon lucide-earth"><path d="M21.54 15H17a2 2 0 0 0-2 2v4.54"/><path d="M7 3.34V5a3 3 0 0 0 3 3a2 2 0 0 1 2 2c0 1.1.9 2 2 2a2 2 0 0 0 2-2c0-1.1.9-2 2-2h3.17"/><path d="M11 21.95V18a2 2 0 0 0-2-2a2 2 0 0 1-2-2v-1a2 2 0 0 0-2-2H2.05"/><circle cx="12" cy="12" r="10"/></svg></div>
125 + <?php esc_html_e('CDN', 'searchpro'); ?>
126 + </div>
127 + <!--<div class="berqwp-tab <?php bwp_is_tab_nav('image-optimization'); ?>" data-tab="image-optimization">
128 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-images-icon lucide-images"><path d="m22 11-1.296-1.296a2.4 2.4 0 0 0-3.408 0L11 16"/><path d="M4 8a2 2 0 0 0-2 2v10a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2"/><circle cx="13" cy="7" r="1" fill="currentColor"/><rect x="8" y="2" width="14" height="14" rx="2"/></svg></div>
72 129 <?php esc_html_e('Image Optimization', 'searchpro'); ?>
73 - <p>
74 - <?php esc_html_e('WebP Images, Image Resize, LazyLoad', 'searchpro'); ?>
75 - </p>
76 130 </div>
77 - <div class="berqwp-tab" data-tab="script-manager">
131 + <div class="berqwp-tab <?php bwp_is_tab_nav('script-manager'); ?>" data-tab="script-manager">
132 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-file-code-corner-icon lucide-file-code-corner"><path d="M4 12.15V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.706.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2h-3.35"/><path d="M14 2v5a1 1 0 0 0 1 1h5"/><path d="m5 16-3 3 3 3"/><path d="m9 22 3-3-3-3"/></svg></div>
78 133 <?php esc_html_e('Script Manager', 'searchpro'); ?>
79 - <p>
80 - <?php esc_html_e('JavaScript Modes, Emojis, YouTube', 'searchpro'); ?>
81 - </p>
134 + </div>-->
135 + <div class="berqwp-tab <?php bwp_is_tab_nav('database'); ?>" data-tab="database">
136 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-database-icon lucide-database"><ellipse cx="12" cy="5" rx="9" ry="3"/><path d="M3 5V19A9 3 0 0 0 21 19V5"/><path d="M3 12A9 3 0 0 0 21 12"/></svg></div>
137 + <?php esc_html_e('Database', 'searchpro'); ?>
82 138 </div>
83 - <div class="berqwp-tab" data-tab="activate-license">
139 + <div class="berqwp-tab <?php bwp_is_tab_nav('debloat'); ?>" data-tab="debloat">
140 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-trash2-icon lucide-trash-2"><path d="M3 6h18"/><path d="M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6"/><path d="M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2"/><line x1="10" x2="10" y1="11" y2="17"/><line x1="14" x2="14" y1="11" y2="17"/></svg></div>
141 + <?php esc_html_e('Debloat', 'searchpro'); ?>
142 + </div>
143 + <div class="berqwp-tab <?php bwp_is_tab_nav('integration'); ?>" data-tab="integration">
144 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-blocks-icon lucide-blocks"><path d="M10 22V7a1 1 0 0 0-1-1H4a2 2 0 0 0-2 2v12a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-5a1 1 0 0 0-1-1H2"/><rect x="14" y="2" width="8" height="8" rx="1"/></svg></div>
145 + <?php esc_html_e('Integration', 'searchpro'); ?>
146 + </div>
147 + <div class="berqwp-tab <?php bwp_is_tab_nav('activate-license'); ?>" data-tab="activate-license">
148 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="lucide lucide-settings2-icon lucide-settings-2"><path d="M14 17H5"/><path d="M19 7h-9"/><circle cx="17" cy="17" r="3"/><circle cx="7" cy="7" r="3"/></svg></div>
84 149 <?php esc_html_e('License', 'searchpro'); ?>
85 - <p>
86 - <?php esc_html_e('Deactivate License Key', 'searchpro'); ?>
87 - </p>
88 150 </div>
151 +
152 + <?php if (!defined('BERQWP_HIDE_DOCS') || !BERQWP_HIDE_DOCS) { ?>
153 + <a class="berqwp-tab tab-link" target="_blank" href="https://www.facebook.com/groups/1660827728253423">
154 + <div class="icon"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 640" width="24"><!--!Font Awesome Free v7.2.0 by @fontawesome - https://fontawesome.com License - https://fontawesome.com/license/free Copyright 2026 Fonticons, Inc.--><path d="M576 320C576 178.6 461.4 64 320 64C178.6 64 64 178.6 64 320C64 440 146.7 540.8 258.2 568.5L258.2 398.2L205.4 398.2L205.4 320L258.2 320L258.2 286.3C258.2 199.2 297.6 158.8 383.2 158.8C399.4 158.8 427.4 162 438.9 165.2L438.9 236C432.9 235.4 422.4 235 409.3 235C367.3 235 351.1 250.9 351.1 292.2L351.1 320L434.7 320L420.3 398.2L351 398.2L351 574.1C477.8 558.8 576 450.9 576 320z"/></svg></svg></div>
155 + <?php esc_html_e('Join BerqWP Community', 'searchpro'); ?>
156 + </a>
157 + <?php } ?>
89 158 </div>
90 159 <div class="berqwp-tab-content">
160 + <?php do_action('berqwp_notices'); ?>
91 161 <form action="" method="post">
92 162 <?php
93 163 wp_nonce_field('berqwp_save_settings', 'berqwp_save_nonce');
164 + ?>
165 + <input type="hidden" name="bwp_current_tab_id" value="<?php echo !empty($_GET['tab_id']) ? esc_attr(sanitize_text_field(wp_unslash($_GET['tab_id']))) : 'dashboard'; ?>">
166 + <?php
94 167 require_once optifer_PATH . '/admin/tabs/dashboard.php';
95 168 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';
169 + require_once optifer_PATH . '/admin/tabs/content-delivery-network.php';
170 + require_once optifer_PATH . '/admin/tabs/css-javascript.php';
171 + // require_once optifer_PATH . '/admin/tabs/image-optimization.php';
172 + require_once optifer_PATH . '/admin/tabs/media-optimization.php';
173 + // require_once optifer_PATH . '/admin/tabs/script-manager.php';
174 + require_once optifer_PATH . '/admin/tabs/integration.php';
175 + require_once optifer_PATH . '/admin/tabs/database.php';
176 + require_once optifer_PATH . '/admin/tabs/debloat.php';
98 177 require_once optifer_PATH . '/admin/tabs/activate-license.php';
178 +
99 179 ?>
100 180 </form>
101 181 </div>
102 182 </div>
@@ -101,360 +181,439 @@
101 181 </div>
102 182 </div>
103 183 </div>
104 184 </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>
185 +<!-- <p class="below-settings-panel">Explore <a href="https://berqier.com" target="_blank">Berqier Ltd</a>, the creators of
186 + BerqWP. Want to know more? Reach out—we love talking WordPress!</p> -->
187 +<!--<script src="<?php echo esc_attr(optifer_URL . '/admin/js/bootstrap-slider.js?v=' . BERQWP_VERSION); ?>"></script>-->
188 +<!--<script src="<?php echo esc_attr(optifer_URL . '/admin/js/dataTables.min.js?v=' . BERQWP_VERSION); ?>"></script>-->
109 189 <script>
110 - (function ($) {
111 - $(document).ready(function () {
112 - $('.bwp_feedback').hide();
190 + (function($) {
191 + $(document).ready(function() {
192 + const bwp_controllers = [];
193 + // $('.bwp_feedback').hide();
113 194 let berq_nounce = '<?php echo esc_html(wp_create_nonce('wp_rest')); ?>';
195 + let bwp_pages_nonce = '<?php echo esc_html(wp_create_nonce('berqwp_get_optimized_pages_nonce')); ?>';
114 196
197 + window.addEventListener('beforeunload', () => {
198 + bwp_controllers.forEach(c => c.abort());
199 + });
200 +
201 +
115 202 function numberWithCommas(x) {
116 203 return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
117 204 }
118 205
206 + function init_opt_slider() {
207 + let opt_slider = new Slider('#berq_opt_mode', {
208 + // min: 5,
209 + // max: 30,
210 + value: '<?php echo esc_html(get_option('berq_opt_mode', 4)); ?>',
211 + ticks_labels: ['Basic', 'Medium', 'Blaze', 'Aggressive'],
212 + ticks: [1, 2, 3, 4],
213 + // ticks_positions: [0, 50, 100],
214 + ticks_snap_bounds: 20,
215 + tooltip_position: 'bottom',
216 + // formatter: function (value) {
217 + // if (value == 1) {
218 + // // return '<div class="tooltip-title">Basic (stable)</div> <div class="tooltip-content">Basic optimizations like image lazy loading, page cache etc</div>';
219 + // $("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>')
220 +
221 + // return '';
222 + // }
223 + // },
224 + ticks_tooltip: true,
225 + // ticks_tooltip: true,
226 + // lock_to_ticks: true,
227 + // step: 1
228 + });
229 +
230 + $(".optimzation-slider").mousemove(function(event) {
231 + let val = $("#berq_opt_mode").val();
232 +
233 + if ($(".slider-tick:nth-child(1)").is(":hover") || $('.tooltip-inner').html() == '1') {
234 + $("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>')
235 + }
236 +
237 + if ($(".slider-tick:nth-child(2)").is(":hover") || $('.tooltip-inner').html() == '2') {
238 + $("div.tooltip-inner").html('<div class="tooltip-title">Medium</div> <div class="tooltip-content">Highly stable optimization mode for many cases.</div>')
239 + }
240 +
241 + if ($(".slider-tick:nth-child(3)").is(":hover") || $('.tooltip-inner').html() == '3') {
242 + $("div.tooltip-inner").html('<div class="tooltip-title">Blaze</div> <div class="tooltip-content">Balance between optimization and stability.</div>')
243 + }
244 +
245 + if ($(".slider-tick:nth-child(4)").is(":hover") || $('.tooltip-inner').html() == '4') {
246 + $("div.tooltip-inner").html('<div class="tooltip-title">Aggressive</div> <div class="tooltip-content">Provide the best possible speed scores.</div>')
247 + }
248 + })
249 +
250 + $("#berq_opt_mode").on("slide slideStop", function(slideEvt) {
251 + let val = $("#berq_opt_mode").val();
252 +
253 + if (val == 1) {
254 + $("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>')
255 + }
256 +
257 + if (val == 2) {
258 + $("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>')
259 + }
260 +
261 + if (val == 3) {
262 + $("div.tooltip-inner").html('<div class="tooltip-title">Blaze</div> <div class="tooltip-content">Basic optimizations like image lazy loading, page cache etc</div>')
263 + }
264 +
265 + if (val == 4) {
266 + $("div.tooltip-inner").html('<div class="tooltip-title">Aggressive</div> <div class="tooltip-content">Basic optimizations like image lazy loading, page cache etc</div>')
267 + }
268 + })
269 + }
270 +
119 271 function berq_clear_cache() {
120 272 $.ajax({
121 273 url: '<?php echo esc_html(get_site_url()); ?>/wp-json/optifer/v1/clear-cache',
122 274 method: 'POST',
123 - beforeSend: function (xhr) {
275 + beforeSend: function(xhr) {
124 276 xhr.setRequestHeader('X-WP-Nonce', berq_nounce);
125 277 },
126 - success: function (response) {
278 + success: function(response) {
127 279
128 280 }
129 281 })
130 282 }
131 283
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>')
284 + function berq_refresh_cache_stats() {
285 + const controller = new AbortController();
286 + bwp_controllers.push(controller);
145 287
146 - // return '';
147 - // }
148 - // },
149 - ticks_tooltip: true,
150 - // ticks_tooltip: true,
151 - // lock_to_ticks: true,
152 - // step: 1
153 - });
288 + $.ajax({
289 + url: ajaxurl,
290 + type: 'POST',
291 + data: {
292 + action: 'berqwp_refresh_cache_stats',
293 + nonce: berq_nounce,
294 + },
295 + signal: controller.signal,
296 + beforeSend: function(xhr) {
297 + xhr.setRequestHeader('X-WP-Nonce', berq_nounce);
298 + },
299 + success: function(data) {
154 300
155 - $(".optimzation-slider").mousemove(function (event) {
156 - let val = $("#berq_opt_mode").val();
301 + if (data.success) {
157 302
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 - }
303 + $('.cache-percentage').html(`${data.data.cache_percentage}% (${data.data.cache_count}) of your pages are currently cached.`);
161 304
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 - }
305 + $('.cached-pages-bar .progress-bar').css('width', `${data.data.cache_percentage}%`);
165 306
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 - }
307 + // if (data.data.server_queue > 0) {
308 + // $('.bwp-pending-optimization').html(`${data.data.server_queue} pending optimization`);
169 309
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 - })
310 + // } else {
311 + // $('.bwp-pending-optimization').html('');
312 + // }
313 + }
174 314
175 - $("#berq_opt_mode").on("slide slideStop", function (slideEvt) {
176 - let val = $("#berq_opt_mode").val();
315 + },
316 + error: function() {
317 + console.log('Error in AJAX request.');
318 + }
319 + });
320 + }
177 321
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 - }
322 + // init_opt_slider();
181 323
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 - }
324 + $('.berqwp-tab[data-tab]').click(function() {
325 + let tab = $(this).attr('data-tab');
326 + $("html, body").animate({
327 + scrollTop: $(".berqwp-dashbaord").offset().top - 30
328 + }, 200);
185 329
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 - }
330 + $('.berqwp-tab-content > form > div').css({
331 + 'visibility': 'hidden',
332 + 'display': 'none',
333 + 'opacity': 0,
334 + 'height': '0px',
335 + 'overflow': 'hidden'
336 + });
337 + $('.berqwp-tab').removeClass('active');
338 + $(this).addClass('active');
339 + // $(`.berqwp-tab-content #${tab}`).show();
340 + $(`.berqwp-tab-content #${tab}`).css({
341 + 'visibility': 'visible',
342 + 'display': 'block',
343 + 'opacity': 1,
344 + 'height': 'auto'
345 + });
189 346
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>')
347 + let tab_id = $(`.berqwp-tab-content #${tab}`).attr('id');
348 + $('input[name="bwp_current_tab_id"]').val(tab_id);
349 +
350 +
351 + // Get the current URL and its parts
352 + const url = new URL(window.location.href);
353 +
354 + // Check if 'tab_id' is present
355 + if (url.searchParams.has('tab_id')) {
356 + // Update the 'tab_id' parameter value
357 + url.searchParams.set('tab_id', tab_id);
358 +
359 + // Update the address bar with the new URL (without reloading the page)
360 + window.history.replaceState(null, null, url.toString());
192 361 }
193 - })
194 362
195 - $('.berqwp-tab').click(function () {
196 - let tab = $(this).attr('data-tab');
197 363
198 - $('.berqwp-tab-content > form > div').hide();
199 - $('.berqwp-tab').removeClass('active');
200 - $(this).addClass('active');
201 - $(`.berqwp-tab-content #${tab}`).show();
202 364
203 365 })
204 366
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) { ?>
367 + // let tab_id = $('input[name="bwp_current_tab_id"]').val();
368 + // $(`.berqwp-tab[data-tab="${tab_id}"]`).trigger('click');
369 + let is_admin_page_active = true;
210 370
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');
371 + // Visibility tracking - pause when tab hidden
372 + document.addEventListener('visibilitychange', function() {
373 + is_admin_page_active = !document.hidden;
374 + });
223 375
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)');
376 + // berq_refresh_cache_stats();
227 377
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 - }
378 + // setInterval(function() {
232 379
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 - });
380 + // if (!is_admin_page_active) return;
251 381
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 - });
382 + // berq_refresh_cache_stats();
275 383
384 + // }, 10000)
276 385
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 386
287 - if (mobileSpeedScore >= 80 && $('.bwp_feedback')) {
288 - $('.bwp_feedback').show();
289 - }
387 + })
388 + })(jQuery)
389 +</script>
390 +<?php
391 +if (function_exists('pll_current_language')) {
392 + $lang = !empty(pll_current_language()) ? pll_current_language() : 'all';
393 + echo "<script>ajaxurl = ajaxurl + '?lang=$lang';</script>";
394 +}
395 +?>
396 +<script>
397 + (function($) {
398 + // $(document).ready(function () {
399 + // let table = new DataTable('.optimized-pages > table', {
400 + // // "paging": false, // Disable pagination
401 + // "searching": false, // Disable the search box
402 + // "pageLength": 5,
403 + // "info": false, // Disable the info text (e.g., "Showing 1 to 10 of 57 entries")
404 + // "lengthChange": false
405 + // });
406 + // })
290 407
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)');
408 +
409 + jQuery(document).ready(function($) {
410 + var dataTable = $('.optimized-pages > table').DataTable({
411 + ordering: false,
412 + paging: true,
413 + searching: true,
414 + processing: true,
415 + serverSide: true,
416 + info: false,
417 + lengthChange: false,
418 + pageLength: 5,
419 + ajax: function(data, callback, settings) {
420 + var start = settings._iDisplayStart;
421 + var length = settings._iDisplayLength;
422 +
423 + $.ajax({
424 + url: ajaxurl, // WordPress AJAX URL
425 + type: 'POST',
426 + data: {
427 + action: 'berqwp_get_optimized_pages',
428 + nonce: bwp_pages_nonce,
429 + start: start,
430 + length: length,
431 + search: data.search.value
432 + },
433 + success: function(response) {
434 + if (response.success) {
435 + callback({
436 + draw: data.draw,
437 + recordsTotal: response.data.total_entries, // Total number of records
438 + recordsFiltered: response.data.records_filtered, // Total after filtering
439 + data: response.data.optimized_pages // Data for the current page
440 + });
441 + } else {
442 + console.error("Error fetching data:", response);
443 + }
444 + },
445 + error: function(error) {
446 + console.error("AJAX error:", error);
300 447 }
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);
448 + });
326 449 },
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');
450 + columns: [{
451 + data: 'url',
452 + title: "Page URL"
453 + }, // Map 'url' to the first column
454 + {
455 + data: 'status',
456 + title: "Cache Status"
457 + }, // Map 'status' to the second column
458 + {
459 + data: 'last_modified',
460 + title: "Last Optimized Date"
461 + } // Map 'last_modified' to the third column
462 + ]
463 + });
464 + });
334 465
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;
466 + $('[name="berqwp_lazyload_youtube_embed"]').on('change', function() {
467 + if ($(this).is(':checked')) {
468 + $('[name="berqwp_preload_yt_poster"]').parent().show();
469 + } else {
470 + $('[name="berqwp_preload_yt_poster"]').parent().hide();
471 + }
472 + });
338 473
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)}%`);
474 + $('[name="berqwp_heartbeat_mode"]').on('change', function() {
475 + if ($('[name="berqwp_heartbeat_mode"]:checked').val() === 'throttle') {
476 + $('.berqwp-heartbeat-interval').show();
477 + } else {
478 + $('.berqwp-heartbeat-interval').hide();
479 + }
480 + });
341 481
482 + // $(document).ready(function () {
483 + // const stickyDiv = $('.berqwp-dashbaord');
484 + // const offset = stickyDiv.offset().top;
342 485
343 - function sendBatch(products, deleting = false) {
344 - var batchSize = 5;
345 - var totalBatches = Math.ceil(products.length / batchSize);
346 - var currentBatchIndex = 0;
486 + // $(window).on('scroll', function () {
487 + // if ($(this).scrollTop() + 30 >= offset) {
488 + // stickyDiv.addClass('sticky');
489 + // stickyDiv.parent().css('paddingBottom', '100vh');
490 + // setTimeout(function() {
491 + // var resizeEvent = new Event('resize');
492 + // window.dispatchEvent(resizeEvent);
493 + // document.dispatchEvent(resizeEvent);
494 + // }, 300)
495 + // } else {
496 + // stickyDiv.removeClass('sticky');
497 + // stickyDiv.parent().css('paddingBottom', '0vh');
498 + // setTimeout(function() {
499 + // var resizeEvent = new Event('resize');
500 + // window.dispatchEvent(resizeEvent);
501 + // document.dispatchEvent(resizeEvent);
502 + // }, 300)
503 + // }
504 + // });
505 + // });
347 506
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 507
355 - if (deleting) {
356 - var url = '<?php echo esc_html(get_site_url()); ?>/wp-json/optifer/v1/delete-images';
357 - }
358 508
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 509
376 - if (unoptimized_images_count < batchSize) {
377 - optimized_images_count = optimized_images_count + unoptimized_images_count;
378 - unoptimized_images_count = 0;
379 - }
380 510
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 511
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 512
393 - $(".berq-progress-optimized-images").css('font-size', '30px');
394 - $(".berq-progress-optimized-images").html(`Deleting...`);
513 + })(jQuery)
514 +</script>
515 +<script>
516 + (function($) {
517 + $(document).ready(function() {
518 + let cache_lifespan_options = $('input[name="berqwp_cache_lifespan"], input[name="berq_opt_mode"]');
395 519
396 - $('.berq-optimized-images').hide();
397 - $('.berq-unoptimized-images').hide();
398 - }
520 + cache_lifespan_options.change(function() {
521 + cache_lifespan_options.parent('label').removeClass('selected');
522 + $('input[name="berqwp_cache_lifespan"]:checked, input[name="berq_opt_mode"]:checked').parent('label').addClass('selected');
523 + })
399 524
525 + $('input[name="berqwp_cache_lifespan"]:checked, input[name="berq_opt_mode"]:checked').parent('label').addClass('selected');
526 + })
527 + })(jQuery)
528 +</script>
529 +<script>
530 + (function($) {
531 + $(document).ready(function() {
532 + let enable_compression_btn = $('a.berqwp-enable-page-compression');
533 + let berq_nounce = '<?php echo esc_html(wp_create_nonce('wp_rest')); ?>';
400 534
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 - }
535 + enable_compression_btn.click(function(e) {
536 + e.preventDefault();
420 537
421 - processBatch(); // Start processing the batches
422 - }
538 + let loader = enable_compression_btn.find('.berqwp-loader');
539 + $.ajax({
540 + url: ajaxurl,
541 + type: 'POST',
542 + data: {
543 + action: 'berqwp_enable_page_compression',
544 + nonce: berq_nounce,
545 + },
546 + beforeSend: function(xhr) {
547 + xhr.setRequestHeader('X-WP-Nonce', berq_nounce);
548 + loader.show();
549 + },
550 + success: function(data) {
551 + loader.hide();
423 552
424 - $('.berq-convert-webp').click(function () {
425 - if (unoptimized_images.length > 0) {
426 - loader.show();
427 - sendBatch(unoptimized_images);
553 + if (data.success === true) {
554 + let currentUrl = window.location.href;
555 + let url = new URL(currentUrl);
556 + let params = new URLSearchParams(url.search);
557 + params.set('berqwp_page_compression_enabled', '');
558 + url.search = params.toString();
559 + window.location.href = url.toString();
428 560 } else {
429 - alert('<?php esc_html_e("All images have already been optimized for speed.", "searchpro"); ?>');
561 + alert("Page compression test failed: Your web server doesn't support Gzip compression.");
430 562 }
431 - })
432 563
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 564
441 -
442 -
443 - }
444 - });
565 + },
566 + error: function() {
567 + loader.hide();
568 + alert("Page compression test failed: Please check your internet connection.");
569 + }
570 + });
571 + })
445 572 })
446 573 })(jQuery)
447 574 </script>
448 575 <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
576 + (function($) {
577 + $(document).ready(function() {
578 + let berq_nounce = '<?php echo esc_html(wp_create_nonce('wp_rest')); ?>';
579 +
580 + $('.berqwp-db-run-action').click(function(e) {
581 + e.preventDefault();
582 +
583 + let $btn = $(this);
584 + let $action = $btn.closest('.berqwp-db-action');
585 + let task = $action.data('task');
586 + let limit = $action.find('input[name="berqwp_db_revision_limit"]').val();
587 +
588 + $btn.addClass('disabled').text('Running...');
589 +
590 + $.ajax({
591 + url: ajaxurl,
592 + type: 'POST',
593 + data: {
594 + action: 'berqwp_db_run_action',
595 + task: task,
596 + limit: limit,
597 + nonce: berq_nounce,
598 + },
599 + beforeSend: function(xhr) {
600 + xhr.setRequestHeader('X-WP-Nonce', berq_nounce);
601 + },
602 + success: function(data) {
603 + if (data.success) {
604 + alert(data.data.message);
605 + } else {
606 + alert(data.data && data.data.message ? data.data.message : 'Something went wrong.');
607 + }
608 + },
609 + error: function() {
610 + alert('Request failed. Please check your internet connection.');
611 + },
612 + complete: function() {
613 + $btn.removeClass('disabled').text($btn.data('task') === 'optimize_tables' ? 'Optimize now' : 'Clean now');
614 + }
457 615 });
458 616 })
459 - })(jQuery)
460 -</script>
617 + })
618 + })(jQuery)
619 +</script>