PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / trunk
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript vtrunk
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 | berqwp.php +97 -84 1.9.3trunk View file →
@@ -1,35 +1,25 @@
1 1 <?php
2 2 /**
3 3 * Plugin Name: BerqWP
4 - * Plugin URI: https://berqwp.com
5 - * Description: Automatically pass Core Web Vitals for WordPress and boost your speed score to 90+ for both mobile and desktop without any technical skills.
6 - * Version: 1.9.3
4 + * Plugin URI: https://berqwp.com/
5 + * Description: Automatically boost your WordPress website speed. Includes full-page caching, image optimization, CSS/JS delivery, and Core Web Vitals improvements.
6 + * Version: 4.1.16
7 7 * Requires at least: 5.3
8 8 * Requires PHP: 7.4
9 9 * Author: BerqWP
10 - * Author URI: https://berqwp.com
10 + * Author URI: https://berqwp.com/
11 11 * Text Domain: searchpro
12 12 * Domain Path: /languages
13 + * Network: true
14 + * License: GPL-2.0-or-later
15 + * License URI: https://www.gnu.org/licenses/gpl-2.0.html
13 16 */
14 17
15 18 if (!defined('ABSPATH')) exit;
16 19
17 -if (class_exists('berqWP')) {
18 - include_once(ABSPATH . 'wp-admin/includes/plugin.php');
19 - $free_plugin_path = 'berqwp-lite/berqwp-lite.php';
20 - if (is_plugin_active($free_plugin_path)) {
21 - deactivate_plugins($free_plugin_path);
22 - }
23 - $free_plugin_path = 'berqwp/berqwp.php';
24 - if (is_plugin_active($free_plugin_path)) {
25 - deactivate_plugins($free_plugin_path);
26 - }
27 - return;
28 -}
29 -
30 20 if (!defined('BERQWP_VERSION')) {
31 - define('BERQWP_VERSION', '1.9.3');
21 + define('BERQWP_VERSION', '4.1.16');
32 22 }
33 23
34 24 if (!defined('optifer_PATH')) {
35 25 define('optifer_PATH', plugin_dir_path(__FILE__));
@@ -50,99 +40,122 @@
50 40 if (!defined('BERQ_SECRET')) {
51 41 define('BERQ_SECRET', '64bc22f838e982.66069471');
52 42 }
53 43
44 +// define('BERQWP_DISABLE_CACHE_WARMUP', true);
54 45
55 -if (!defined('BERQWP_MAX_WARMUP_REQUESTS')) {
56 - define('BERQWP_MAX_WARMUP_REQUESTS', 1); // The maximum number of requests in our rate limit window.
57 -}
58 -
59 -if (!defined('BERQWP_WARMUP_RATE_LIMIT_WINDOW')) {
60 - define('BERQWP_WARMUP_RATE_LIMIT_WINDOW', 125); // Time window for rate limit in seconds, i.e., 5 minutes.
61 -}
62 -
63 46 if (!file_exists(optifer_cache)) {
64 47 mkdir(optifer_cache, 0755, true);
65 48 }
66 49
50 +if (isset($_GET['disable_berqwp'])) {
51 + return;
52 +}
67 53
68 -// if (isset($_GET['generating_critical_css'])
69 -// || isset($_GET['nocache'])
70 -// || isset($_GET['creating_cache'])) {
54 +global $bwp_current_page;
55 +$bwp_current_page = null;
71 56
72 -// add_filter( 'berqwp_bypass_cache', function () { return true; } );
57 +// Initialize BerqWP SDK
58 +require_once optifer_PATH . '/BerqWP/vendor-prefixed/vendor/scoper-autoload.php';
59 +// require_once optifer_PATH . '/BerqWP/src/Vendor/SimpleHtmlDom/simple_html_dom.php';
73 60
74 -// if (berqReverseProxyCache::is_reverse_proxy_cache_enabled()) {
75 -// berqReverseProxyCache::bypass();
76 -// }
77 -
78 -// if (!class_exists('HMWP_Models_Compatibility_Abstract')) {
79 -// return;
80 -// }
81 -// }
82 -
83 -
84 -// if (get_option('berqwp_enable_sandbox') == 1 && !isset($_GET['berqwp']) && !is_admin() && !isset($_POST)) {
85 -// return;
86 -// }
87 -
88 -require_once optifer_PATH . '/inc/class-berqreverseproxy.php';
89 -require_once optifer_PATH . '/inc/class-ignoreparams.php';
90 -require_once optifer_PATH . '/inc/class-MemoryLeakDetector.php';
91 -require_once optifer_PATH . '/vendor/autoload.php';
92 -require_once optifer_PATH . '/vendor/woocommerce/action-scheduler/action-scheduler.php';
61 +require_once optifer_PATH . '/inc/crawler/berqDetectCrawler.php';
62 +require_once optifer_PATH . '/inc/class-berqconfigs.php';
63 +require_once optifer_PATH . '/inc/class-berqdatabase.php';
64 +// require_once optifer_PATH . '/vendor/autoload.php';
65 +// require_once optifer_PATH . '/vendor/woocommerce/action-scheduler/action-scheduler.php';
93 66 require_once optifer_PATH . '/inc/class-berqlogs.php';
94 67 require_once optifer_PATH . '/inc/helper-functions.php';
95 -require_once optifer_PATH . '/inc/classs-http.php';
68 +require_once optifer_PATH . '/inc/common-functions.php';
69 +require_once optifer_PATH . '/inc/dropin-functions.php';
70 +require_once optifer_PATH . '/inc/photon/class-berqUsedCSS.php';
96 71 require_once optifer_PATH . '/inc/photon/class-berqPageOptimizer.php';
97 -require_once optifer_PATH . '/inc/photon/class-berqBufferOptimize.php';
98 -require_once optifer_PATH . '/inc/photon/class-styleOptimizer.php';
99 -require_once optifer_PATH . '/inc/photon/class-scriptOptimizer.php';
100 -require_once optifer_PATH . '/inc/photon/class-berqImages.php';
101 -require_once optifer_PATH . '/inc/photon/class-berqCDN.php';
102 -require_once optifer_PATH . '/inc/photon/class-berqCriticalCSS.php';
103 -require_once optifer_PATH . '/inc/photon/integration/index.php';
104 -require_once optifer_PATH . '/inc/class-berqcache.php';
72 +require_once optifer_PATH . '/inc/class-berqintegrations.php';
105 73 require_once optifer_PATH . '/inc/class-berqwp.php';
106 -require_once optifer_PATH . '/inc/class-berqimages.php';
107 -require_once optifer_PATH . '/inc/class-berqintegrations.php';
108 74 require_once optifer_PATH . '/inc/class-berqnotifications.php';
109 75
76 +// cache
77 +require_once optifer_PATH . '/inc/cache/class-berqcache.php';
78 +require_once optifer_PATH . '/inc/cache/class-berqwarmup.php';
79 +require_once optifer_PATH . '/inc/cache/class-berqCloudflareAPIHandler.php';
80 +require_once optifer_PATH . '/inc/cache/class-berqreverseproxy.php';
81 +require_once optifer_PATH . '/inc/cache/class-ignoreparams.php';
110 82
83 +// queue
84 +require_once optifer_PATH . '/inc/queue/class-berqUpload.php';
85 +require_once optifer_PATH . '/inc/queue/class-berqHeartbeat.php';
86 +
87 +// admin
88 +require_once optifer_PATH . '/admin/class-berqPageRules.php';
89 +require_once optifer_PATH . '/admin/admin-bar.php';
90 +
91 +if (get_option('berqwp_enable_sandbox') == 0) {
92 + bwp_serve_advanced_cache();
93 +}
94 +// register_shutdown_function('bwp_cache_current_page');
95 +
111 96 // Redirect to BerqWP admin page after activation
112 97 register_activation_hook(__FILE__, 'berqwp_activation');
113 98 register_deactivation_hook(__FILE__, 'berqwp_deactivate_plugin');
114 99
115 -function berqwp_activation()
100 +function berqwp_activation($network_wide = false)
116 101 {
117 - // Specify the drop-in file path
118 - $dropin_file = ABSPATH . 'wp-content/advanced-cache.php';
102 + if (function_exists('is_multisite') && is_multisite() && $network_wide) {
103 + // Network-wide activation: activate for each site
104 + $sites = get_sites(['fields' => 'ids', 'number' => 0]);
105 + foreach ($sites as $site_id) {
106 + switch_to_blog($site_id);
107 + berqwp_activate_single_site();
108 + restore_current_blog();
109 + }
110 + } else {
111 + berqwp_activate_single_site();
112 + }
119 113
120 - // Dynamically create the drop-in file
121 - $dropin_content = file_get_contents(optifer_PATH . 'advanced-cache.php');
114 + // Install the advanced-cache.php drop-in (shared across network)
115 + berqwp_install_dropin();
116 +}
122 117
123 - // Write the drop-in content to the file, replacing any existing file
124 - file_put_contents($dropin_file, $dropin_content);
118 +function berqwp_install_dropin()
119 +{
120 + if (defined('BERQWP_ADVANCED_CACHE_PATH')) {
121 + $dropin_file = BERQWP_ADVANCED_CACHE_PATH;
122 + } else {
123 + $dropin_file = WP_CONTENT_DIR . '/advanced-cache.php';
124 + }
125 125
126 - // Enable object cache in wp-config.php
127 - berqwp_enable_object_cache(true);
126 + if (!file_exists($dropin_file) || (file_exists($dropin_file) && is_writable($dropin_file))) {
127 + $dropin_content = file_get_contents(optifer_PATH . 'advanced-cache.php');
128 + file_put_contents($dropin_file, $dropin_content);
129 + berqwp_enable_advanced_cache(true);
130 + }
131 +}
128 132
129 - if (function_exists('wp_cache_flush')) {
130 - wp_cache_flush(); // Clear the entire object cache.
133 +function berqwp_deactivate_plugin($network_wide = false) {
134 +
135 + // Remove the shared drop-in
136 + if (defined('BERQWP_ADVANCED_CACHE_PATH')) {
137 + $dropin_file = BERQWP_ADVANCED_CACHE_PATH;
138 + } else {
139 + $dropin_file = WP_CONTENT_DIR . '/advanced-cache.php';
131 140 }
132 141
133 - set_transient( 'bqwp_hide_feedback_notice', true, 60*60 ); // Hide for one hour
134 - set_transient('berqwp_redirect', true, 1);
135 -}
142 + if (file_exists($dropin_file)) {
143 + unlink($dropin_file);
144 + }
136 145
137 -function berqwp_deactivate_plugin() {
138 - // Specify the drop-in file path
139 - $dropin_file = ABSPATH . 'wp-content/advanced-cache.php';
146 + berqwp_enable_advanced_cache(false);
140 147
141 - // Check if the drop-in file exists and delete it
142 - if (file_exists($dropin_file)) {
143 - unlink($dropin_file);
144 - }
148 + if (function_exists('is_multisite') && is_multisite() && $network_wide) {
149 + $sites = get_sites(['fields' => 'ids', 'number' => 0]);
150 + foreach ($sites as $site_id) {
151 + switch_to_blog($site_id);
152 + do_action('berqwp_deactivate_plugin');
153 + restore_current_blog();
154 + }
155 + } else {
156 + do_action('berqwp_deactivate_plugin');
157 + }
158 +}
145 159
146 - // Disable object cache in wp-config.php
147 - berqwp_enable_object_cache(false);
148 -}
160 +bwp_lock_cache_directory();
161 +bwp_serve_advanced_cache();