PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 4.1.13
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v4.1.13
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 / admin / tabs / cache-management.php

cache-management.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 4.1.13, at admin/tabs/cache-management.php

158 lines 7.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) exit;
3
4 // Page exclusions
5 $exclude_urls = get_option('berq_exclude_urls', []);
6 $url_lines = implode("\n", $exclude_urls);
7
8 // Ignore URL params
9 $ignore_params = get_option('berq_ignore_urls_params', []);
10 $param_lines = implode("\n", $ignore_params);
11
12 $post_type_names = get_post_types(array(
13 'public' => true,
14 // 'exclude_from_search' => false,
15 ), 'names');
16
17 unset($post_type_names['attachment']);
18 unset($post_type_names['e-floating-buttons']);
19
20 $taxonomy_names = get_taxonomies([
21 'public' => true,
22 'publicly_queryable' => true,
23 'rewrite' => true,
24 'show_ui' => true, // optional but useful
25 ], 'names');
26
27 $excluded_cookies = implode("\n", $configs['exclude_cookies']);
28 $cache_lifespan = $configs['cache_lifespan'];
29
30
31 ?>
32 <div id="cache-management" <?php bwp_is_tab('cache-management'); ?>>
33 <h2 class="berq-tab-title"><?php esc_html_e('Cache Management', 'searchpro'); ?></h2>
34 <div class="berq-info-box">
35 <h3 class="berq-box-title"><?php esc_html_e('Max. Cache Lifespan', 'searchpro'); ?></h3>
36 <div class="berq-box-content">
37 <p><?php printf( /* translators: %s: Plugin name */ esc_html__('Set the maximum cache lifespan to control how long cached pages are stored before being refreshed. Note that %s automatically flushes the page cache when content is updated, so keeping the cache lifespan high is recommended.', 'searchpro'), esc_html($plugin_name) ); ?></p>
38
39 <div class="berqwp-lifespan-options">
40 <label>
41 <input type="radio" name="berqwp_cache_lifespan" value="<?php echo MONTH_IN_SECONDS; ?>" <?php echo $cache_lifespan == MONTH_IN_SECONDS ? 'checked' : ''; ?>>
42 <?php esc_html_e('30 Days (Default)', 'searchpro'); ?>
43 </label>
44 <label>
45 <input type="radio" name="berqwp_cache_lifespan" value="<?php echo WEEK_IN_SECONDS; ?>" <?php echo $cache_lifespan == WEEK_IN_SECONDS ? 'checked' : ''; ?>>
46 <?php esc_html_e('7 Days', 'searchpro'); ?>
47 </label>
48 <label>
49 <input type="radio" name="berqwp_cache_lifespan" value="<?php echo DAY_IN_SECONDS; ?>" <?php echo $cache_lifespan == DAY_IN_SECONDS ? 'checked' : ''; ?>>
50 <?php esc_html_e('24 Hours', 'searchpro'); ?>
51 </label>
52 </div>
53 </div>
54 </div>
55 <!-- <div class="berq-info-box">
56 <h3 class="berq-box-title"><?php esc_html_e('Page Compression', 'searchpro'); ?></h3>
57 <div class="berq-box-content">
58 <p><?php esc_html_e('Deliver GZIP-compressed page cache files, reducing page size by up to 70%.', 'searchpro'); ?></p>
59
60 <div class="berqwp-pagecompress-options">
61
62 <?php if ($configs['page_compression'] === true) { ?>
63
64 <label class="bwp-disable-pagecompression">
65 <input type="submit" name="bwp_disable_page_compression" value="Disable page compression" style="display:none">
66 <?php esc_html_e('Disable page compression', 'searchpro'); ?>
67 </label>
68
69 <?php } else { ?>
70
71 <a href="#" class="berq-btn berqwp-enable-page-compression">
72 <div class="berqwp-loader"></div><?php esc_html_e('Enable page compression', 'searchpro'); ?>
73 </a>
74
75 <?php } ?>
76
77 </div>
78 </div>
79 </div> -->
80 <div class="berq-info-box">
81 <h3 class="berq-box-title"><?php esc_html_e('Page Exclusions', 'searchpro'); ?></h3>
82 <div class="berq-box-content">
83 <p><?php esc_html_e('Exclude pages from cache. Enter one page URL per line. You can use a wildcard by adding *. For example: https://yoursite.com/campaign/*', 'searchpro'); ?>
84
85 <?php if (bwp_show_docs()) { ?>
86 <a href="https://berqwp.com/help-center/exclude-pages-from-being-cached/" target="_blank"><?php esc_html_e('Learn more', 'searchpro'); ?></a>
87 <?php } ?>
88
89 </p>
90 <textarea name="berq_exclude_urls" cols="30" rows="10"><?php echo esc_textarea($url_lines); ?></textarea>
91 </div>
92 </div>
93 <div class="berq-info-box">
94 <h3 class="berq-box-title"><?php esc_html_e('Content Types', 'searchpro'); ?></h3>
95 <div class="berq-box-content">
96 <p><?php esc_html_e('Choose which post types and archive pages should be cached.', 'searchpro'); ?></p>
97 <div class="optimize-post-types">
98 <?php
99 foreach ($post_type_names as $key => $value) {
100 ?>
101 <div>
102 <input type="checkbox" name="berqwp_optimize_post_types[]" value="<?php echo esc_attr($key); ?>" <?php checked(1, in_array($value, get_option('berqwp_optimize_post_types')), true); ?>>
103
104 <?php
105 $post_counts = wp_count_posts($value);
106 $published_count = isset($post_counts->publish) ? $post_counts->publish : 0;
107 echo esc_html(ucfirst($key) . " ($published_count)");
108
109 ?>
110 </div>
111 <?php
112 }
113 foreach ($taxonomy_names as $key => $value) {
114 ?>
115 <div>
116 <input type="checkbox" name="berqwp_optimize_taxonomies[]" value="<?php echo esc_attr($key); ?>" <?php checked(1, in_array($value, get_option('berqwp_optimize_taxonomies')), true); ?>>
117
118 <?php
119 echo esc_html(ucfirst($key));
120 ?>
121 </div>
122 <?php
123 }
124 ?>
125
126 </div>
127 </div>
128 </div>
129 <div class="berq-info-box">
130 <h3 class="berq-box-title"><?php esc_html_e('Exclude Cookies', 'searchpro'); ?></h3>
131 <div class="berq-box-content">
132 <p><?php esc_html_e("Prevent cached pages from being served when the following cookies are present. Enter a partial match or keyword from the cookie name to exclude it. Add one cookie ID per line. Example: woocommerce_cart_hash", 'searchpro'); ?>
133
134 </p>
135 <textarea name="berq_exclude_cookies" cols="30" rows="10"><?php echo esc_textarea($excluded_cookies); ?></textarea>
136 </div>
137 </div>
138 <div class="berq-info-box">
139 <h3 class="berq-box-title"><?php esc_html_e('Ignore URL Parameters', 'searchpro'); ?></h3>
140 <div class="berq-box-content">
141 <p><?php esc_html_e("Ignore page URL parameters, these parameters will be disregarded and won't be cached separately. Enter one parameter per line.", 'searchpro'); ?>
142
143 <?php if (bwp_show_docs()) { ?>
144 <a href="https://berqwp.com/help-center/ignore-url-parameters/" target="_blank"><?php esc_html_e('Learn more', 'searchpro'); ?></a>
145 <?php } ?>
146
147 </p>
148 <textarea name="berq_ignore_urls_params" cols="30" rows="10"><?php echo esc_textarea($param_lines); ?></textarea>
149 </div>
150 </div>
151 <button type="submit" class="berqwp-save"><svg width="20" height="20" viewBox="0 0 20 20" fill="none"
152 xmlns="http://www.w3.org/2000/svg">
153 <path d="M4.16663 10.8333L7.49996 14.1667L15.8333 5.83334" stroke="white" stroke-width="2"
154 stroke-linecap="round" stroke-linejoin="round" />
155 </svg>
156 <?php esc_html_e("Save changes", "searchpro"); ?></button>
157 </div>
158