| 1 |
<?php |
| 2 |
if (!defined('ABSPATH')) exit; |
| 3 |
|
| 4 |
if (get_option('berqwp_enable_sandbox') == null) { |
| 5 |
update_option('berqwp_enable_sandbox', 0); |
| 6 |
} |
| 7 |
|
| 8 |
if (get_option('berqwp_webp_max_width') == null) { |
| 9 |
update_option('berqwp_webp_max_width', 1920); |
| 10 |
} |
| 11 |
|
| 12 |
if (get_option('berqwp_webp_quality') == null) { |
| 13 |
update_option('berqwp_webp_quality', 80); |
| 14 |
} |
| 15 |
|
| 16 |
if (get_option('berqwp_image_lazyloading') == null) { |
| 17 |
update_option('berqwp_image_lazyloading', 1); |
| 18 |
} |
| 19 |
|
| 20 |
if (get_option('berqwp_disable_webp') == null) { |
| 21 |
update_option('berqwp_disable_webp', 0); |
| 22 |
} |
| 23 |
|
| 24 |
if (get_option('berqwp_enable_cdn') == null) { |
| 25 |
update_option('berqwp_enable_cdn', 1); |
| 26 |
} |
| 27 |
|
| 28 |
if (get_option('berqwp_preload_fontfaces') == null) { |
| 29 |
update_option('berqwp_preload_fontfaces', 0); |
| 30 |
} |
| 31 |
|
| 32 |
if (get_option('berqwp_disable_emojis') == null) { |
| 33 |
update_option('berqwp_disable_emojis', 1); |
| 34 |
} |
| 35 |
|
| 36 |
if (get_option('berqwp_lazyload_youtube_embed') == null) { |
| 37 |
update_option('berqwp_lazyload_youtube_embed', 1); |
| 38 |
} |
| 39 |
|
| 40 |
if (get_option('berqwp_javascript_execution_mode') == null) { |
| 41 |
update_option('berqwp_javascript_execution_mode', 1); |
| 42 |
} |
| 43 |
|
| 44 |
if (get_option('berqwp_enable_preload_mostly_used_font') == null) { |
| 45 |
update_option('berqwp_enable_preload_mostly_used_font', 0); |
| 46 |
} |
| 47 |
|
| 48 |
if (get_option('berqwp_interaction_delay') == null) { |
| 49 |
update_option('berqwp_interaction_delay', ''); |
| 50 |
} |
| 51 |
|
| 52 |
if (get_option('berq_opt_mode') == null) { |
| 53 |
update_option('berq_opt_mode', 2); |
| 54 |
} |
| 55 |
|
| 56 |
if (get_option('berqwp_optimize_post_types') == null) { |
| 57 |
update_option('berqwp_optimize_post_types', ['post', 'page', 'product']); |
| 58 |
} |
| 59 |
|
| 60 |
if (get_option('berqwp_optimize_taxonomies') == null) { |
| 61 |
update_option('berqwp_optimize_taxonomies', ['category', 'product_cat']); |
| 62 |
} |
| 63 |
|
| 64 |
if (get_option('berq_ignore_urls_params') == null) { |
| 65 |
update_option('berq_ignore_urls_params', ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content', 'gclid', 'fbclid', 'msclkid']); |
| 66 |
} |
| 67 |
|
| 68 |
// if (get_option('berq_exclude_urls', null) == null) { |
| 69 |
// $exclude_urls = []; |
| 70 |
|
| 71 |
// if (class_exists('WooCommerce')) { |
| 72 |
// // WooCommerce is active |
| 73 |
|
| 74 |
// // Get cart URL |
| 75 |
// $cart_url = wc_get_cart_url(); |
| 76 |
|
| 77 |
// // Get checkout URL |
| 78 |
// $checkout_url = wc_get_checkout_url(); |
| 79 |
|
| 80 |
// $exclude_urls[] = esc_url($cart_url); |
| 81 |
// $exclude_urls[] = esc_url($checkout_url); |
| 82 |
|
| 83 |
// } |
| 84 |
|
| 85 |
// update_option('berq_exclude_urls', $exclude_urls); |
| 86 |
|
| 87 |
// } |
| 88 |
|
| 89 |
if (get_option('berq_exclude_urls', []) !== null) { |
| 90 |
$urls = get_option('berq_exclude_urls', []); |
| 91 |
|
| 92 |
if (class_exists('WooCommerce')) { |
| 93 |
$cart_url = wc_get_cart_url(); |
| 94 |
$checkout_url = wc_get_checkout_url(); |
| 95 |
|
| 96 |
if (!empty($cart_url) && !in_array($cart_url, $urls) && trailingslashit($cart_url) !== trailingslashit(home_url())) { |
| 97 |
$urls[] = esc_url($cart_url); |
| 98 |
} |
| 99 |
|
| 100 |
if (!empty($checkout_url) && !in_array($checkout_url, $urls) && trailingslashit($checkout_url) !== trailingslashit(home_url())) { |
| 101 |
$urls[] = esc_url($checkout_url); |
| 102 |
} |
| 103 |
|
| 104 |
update_option('berq_exclude_urls', $urls); |
| 105 |
|
| 106 |
} |
| 107 |
} |