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 | inc/crawler/berqDetectCrawler.php +5 -0 1.9.7trunk View file →
@@ -4,9 +4,14 @@
4 4 class berqDetectCrawler {
5 5 public static function is_crawler() {
6 6 // Load the JSON data
7 7 $json_file = optifer_PATH . '/inc/crawler/crawler-user-agents.json';
8 + if (empty($_SERVER['HTTP_USER_AGENT'])) {
9 + return false;
10 + }
8 11 $user_agent = $_SERVER['HTTP_USER_AGENT'];
12 +
13 +
9 14 $crawler_data = json_decode(file_get_contents($json_file), true);
10 15
11 16 if (!$crawler_data) {
12 17 error_log('Failed to load or decode the JSON file.');