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/save-settings.php +74 -12 4.0.214.1.16 View file →
@@ -11,9 +11,10 @@
11 11 }
12 12
13 13 $plugin_name = defined('BERQWP_PLUGIN_NAME') ? BERQWP_PLUGIN_NAME : 'BerqWP';
14 14
15 - if (!empty($_POST['berqwp_intro_page']) && !berqwp_is_license_managed_by_network()) {
15 + // if (!empty($_POST['berqwp_intro_page']) && !berqwp_is_license_managed_by_network()) {
16 + if (!berqwp_is_license_managed_by_network() && !empty($_POST['berqwp_optimization_method'])) {
16 17 $optimization_method = sanitize_text_field($_POST['berqwp_optimization_method']);
17 18
18 19 if ($optimization_method == 'local') {
19 20 $email = sanitize_email($_POST['berqwp_local_user_email']);
@@ -36,9 +37,10 @@
36 37 <?php
37 38 exit();
38 39 }
39 40
40 - if ($optimization_method == 'cloud' && !empty($_POST['berqwp_license_key'])) {
41 + // if ($optimization_method == 'cloud' && !empty($_POST['berqwp_license_key'])) {
42 + if (!empty($_POST['berqwp_license_key'])) {
41 43 $license_key = sanitize_text_field($_POST['berqwp_license_key']);
42 44 $berqconfigs = berqConfigs::getInstance();
43 45 $berqwp_configs = $berqconfigs->get_configs();
44 46 $site_id = $berqwp_configs['site_id'];
@@ -43,13 +45,9 @@
43 45 $berqwp_configs = $berqconfigs->get_configs();
44 46 $site_id = $berqwp_configs['site_id'];
45 47
46 48 if (empty($site_id)) {
47 - $blog_id = get_current_blog_id();
48 - $network_id = function_exists('get_current_network_id') ? get_current_network_id() : 1;
49 - $siteurl = get_option('siteurl');
50 - $site_id = md5("berqwp|$network_id|$blog_id|$siteurl");
51 -
49 + $site_id = berqwp_generate_site_id();
52 50 $berqconfigs->update_configs(['site_id' => $site_id]);
53 51 }
54 52
55 53 // $lic_response = wp_remote_post(BerqWP::$endpoint."authenticate", [
@@ -241,8 +239,10 @@
241 239 $key_response = $this->verify_license_key($license_key, 'slm_deactivate');
242 240
243 241 delete_transient('berq_lic_response_cache');
244 242 delete_transient('berqwp_lic_response_cache');
243 + berqwp_delete_network_option('berqwp_license_cache');
244 +
245 245 berqwp_delete_license_key();
246 246 berqwp_clear_cache_queue();
247 247
248 248 global $berqNotifications;
@@ -457,8 +457,52 @@
457 457 } else {
458 458 update_option('berqwp_disable_emojis', 0);
459 459 }
460 460
461 + if (isset($_POST['berqwp_heartbeat_mode'])) {
462 + $heartbeat_mode = sanitize_text_field($_POST['berqwp_heartbeat_mode']);
463 + if (!in_array($heartbeat_mode, ['default', 'restrict', 'throttle', 'disable'], true)) {
464 + $heartbeat_mode = 'default';
465 + }
466 + update_option('berqwp_heartbeat_mode', $heartbeat_mode);
467 + }
468 +
469 + if (isset($_POST['berqwp_heartbeat_interval'])) {
470 + $heartbeat_interval = max(15, min(300, (int) sanitize_text_field($_POST['berqwp_heartbeat_interval'])));
471 + update_option('berqwp_heartbeat_interval', $heartbeat_interval);
472 + }
473 +
474 + foreach ([
475 + 'berqwp_disable_embeds',
476 + 'berqwp_disable_xmlrpc',
477 + 'berqwp_remove_rest_head_links',
478 + 'berqwp_remove_head_meta',
479 + 'berqwp_disable_self_pingbacks',
480 + ] as $bwp_debloat_option) {
481 + update_option($bwp_debloat_option, isset($_POST[$bwp_debloat_option]) ? 1 : 0);
482 + }
483 +
484 + if (isset($_POST['berqwp_db_schedule_frequency'])) {
485 + $db_schedule_frequency = sanitize_text_field($_POST['berqwp_db_schedule_frequency']);
486 + if (!in_array($db_schedule_frequency, ['daily', 'weekly', 'monthly'], true)) {
487 + $db_schedule_frequency = 'weekly';
488 + }
489 + update_option('berqwp_db_schedule_frequency', $db_schedule_frequency);
490 + }
491 +
492 + if (isset($_POST['berqwp_db_revision_limit'])) {
493 + update_option('berqwp_db_revision_limit', max(0, (int) sanitize_text_field($_POST['berqwp_db_revision_limit'])));
494 + }
495 +
496 + $_POST['berqwp_db_scheduled_tasks'] = $_POST['berqwp_db_scheduled_tasks'] ?? [];
497 + if (is_array($_POST['berqwp_db_scheduled_tasks'])) {
498 + update_option('berqwp_db_scheduled_tasks', array_map('sanitize_text_field', wp_unslash($_POST['berqwp_db_scheduled_tasks'])));
499 + }
500 +
501 + update_option('berqwp_db_schedule_enabled', isset($_POST['berqwp_db_schedule_enabled']) ? 1 : 0);
502 +
503 + do_action('berqwp_reschedule_db_cron');
504 +
461 505 // If the option is changed require flush cache
462 506 if (bwp_is_option_updated('berqwp_lazyload_youtube_embed')) {
463 507 $berq_log->info('Updated berqwp_lazyload_youtube_embed');
464 508 update_option('bwp_require_flush_cache', 1);
@@ -481,8 +525,14 @@
481 525 } else {
482 526 update_option('berqwp_preload_yt_poster', 0);
483 527 }
484 528
529 + // If the option is changed require flush cache
530 + if (bwp_is_option_updated('berqwp_enable_critical_css')) {
531 + $berq_log->info('Updated berqwp_enable_critical_css');
532 + update_option('bwp_require_flush_cache', 1);
533 + }
534 +
485 535 if (isset($_POST['berqwp_enable_critical_css'])) {
486 536 update_option('berqwp_enable_critical_css', 1);
487 537 } else {
488 538 update_option('berqwp_enable_critical_css', 0);
@@ -487,8 +537,20 @@
487 537 } else {
488 538 update_option('berqwp_enable_critical_css', 0);
489 539 }
490 540
541 + // If the option is changed require flush cache
542 + if (bwp_is_option_updated('berqwp_enable_used_css')) {
543 + $berq_log->info('Updated berqwp_enable_used_css');
544 + update_option('bwp_require_flush_cache', 1);
545 + }
546 +
547 + if (isset($_POST['berqwp_enable_used_css'])) {
548 + update_option('berqwp_enable_used_css', 1);
549 + } else {
550 + update_option('berqwp_enable_used_css', 0);
551 + }
552 +
491 553 if (isset($_POST['berqwp_async_excluded_styles'])) {
492 554 update_option('berqwp_async_excluded_styles', 1);
493 555 } else {
494 556 update_option('berqwp_async_excluded_styles', 0);
@@ -493,13 +555,13 @@
493 555 } else {
494 556 update_option('berqwp_async_excluded_styles', 0);
495 557 }
496 558
497 - // if (isset($_POST['berqwp_defer_excluded_styles'])) {
498 - // update_option('berqwp_defer_excluded_styles', 1);
499 - // } else {
500 - // update_option('berqwp_defer_excluded_styles', 0);
501 - // }
559 + if (isset($_POST['berqwp_defer_excluded_js'])) {
560 + update_option('berqwp_defer_excluded_js', 1);
561 + } else {
562 + update_option('berqwp_defer_excluded_js', 0);
563 + }
502 564
503 565 if (isset($_POST['berqwp_delay_third_party_scripts'])) {
504 566 update_option('berqwp_delay_third_party_scripts', 1);
505 567 } else {