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

berqwp.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 1.9.7, at berqwp.php

129 lines 4.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
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.7
7 * Requires at least: 5.3
8 * Requires PHP: 7.4
9 * Author: BerqWP
10 * Author URI: https://berqwp.com
11 * Text Domain: searchpro
12 * Domain Path: /languages
13 */
14
15 if (!defined('ABSPATH')) exit;
16
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 if (!defined('BERQWP_VERSION')) {
31 define('BERQWP_VERSION', '1.9.7');
32 }
33
34 if (!defined('optifer_PATH')) {
35 define('optifer_PATH', plugin_dir_path(__FILE__));
36 }
37
38 if (!defined('optifer_URL')) {
39 define('optifer_URL', plugin_dir_url(__FILE__));
40 }
41
42 if (!defined('optifer_cache')) {
43 define('optifer_cache', WP_CONTENT_DIR . '/cache/berqwp/');
44 }
45
46 if (!defined('BERQ_SERVER')) {
47 define('BERQ_SERVER', 'https://berqwp.com/');
48 }
49
50 if (!defined('BERQ_SECRET')) {
51 define('BERQ_SECRET', '64bc22f838e982.66069471');
52 }
53
54
55 if (!defined('BERQWP_MAX_WARMUP_REQUESTS')) {
56 define('BERQWP_MAX_WARMUP_REQUESTS', 2); // 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 if (!file_exists(optifer_cache)) {
64 mkdir(optifer_cache, 0755, true);
65 }
66
67
68 require_once optifer_PATH . '/inc/crawler/berqDetectCrawler.php';
69 require_once optifer_PATH . '/inc/class-berqreverseproxy.php';
70 require_once optifer_PATH . '/inc/class-ignoreparams.php';
71 require_once optifer_PATH . '/inc/class-MemoryLeakDetector.php';
72 require_once optifer_PATH . '/vendor/autoload.php';
73 require_once optifer_PATH . '/vendor/woocommerce/action-scheduler/action-scheduler.php';
74 require_once optifer_PATH . '/inc/class-berqlogs.php';
75 require_once optifer_PATH . '/inc/helper-functions.php';
76 require_once optifer_PATH . '/inc/classs-http.php';
77 require_once optifer_PATH . '/inc/photon/class-berqPageOptimizer.php';
78 require_once optifer_PATH . '/inc/photon/class-berqBufferOptimize.php';
79 require_once optifer_PATH . '/inc/photon/class-styleOptimizer.php';
80 require_once optifer_PATH . '/inc/photon/class-scriptOptimizer.php';
81 require_once optifer_PATH . '/inc/photon/class-berqImages.php';
82 require_once optifer_PATH . '/inc/photon/class-berqCDN.php';
83 require_once optifer_PATH . '/inc/photon/class-berqCriticalCSS.php';
84 require_once optifer_PATH . '/inc/photon/integration/index.php';
85 require_once optifer_PATH . '/inc/class-berqcache.php';
86 require_once optifer_PATH . '/inc/class-berqwp.php';
87 require_once optifer_PATH . '/inc/class-berqimages.php';
88 require_once optifer_PATH . '/inc/class-berqintegrations.php';
89 require_once optifer_PATH . '/inc/class-berqnotifications.php';
90
91
92 // Redirect to BerqWP admin page after activation
93 register_activation_hook(__FILE__, 'berqwp_activation');
94 register_deactivation_hook(__FILE__, 'berqwp_deactivate_plugin');
95
96 function berqwp_activation()
97 {
98 // Specify the drop-in file path
99 $dropin_file = ABSPATH . 'wp-content/advanced-cache.php';
100
101 // Dynamically create the drop-in file
102 $dropin_content = file_get_contents(optifer_PATH . 'advanced-cache.php');
103
104 // Write the drop-in content to the file, replacing any existing file
105 file_put_contents($dropin_file, $dropin_content);
106
107 // Enable object cache in wp-config.php
108 berqwp_enable_object_cache(true);
109
110 if (function_exists('wp_cache_flush')) {
111 wp_cache_flush(); // Clear the entire object cache.
112 }
113
114 set_transient( 'bqwp_hide_feedback_notice', true, 60*60 ); // Hide for one hour
115 set_transient('berqwp_redirect', true, 1);
116 }
117
118 function berqwp_deactivate_plugin() {
119 // Specify the drop-in file path
120 $dropin_file = ABSPATH . 'wp-content/advanced-cache.php';
121
122 // Check if the drop-in file exists and delete it
123 if (file_exists($dropin_file)) {
124 unlink($dropin_file);
125 }
126
127 // Disable object cache in wp-config.php
128 berqwp_enable_object_cache(false);
129 }