| @@ -10,69 +10,142 @@ | ||
| 10 | 10 | $param_lines = implode("\n", $ignore_params); |
| 11 | 11 | |
| 12 | 12 | $post_type_names = get_post_types(array( |
| 13 | 13 | 'public' => true, |
| 14 | - 'exclude_from_search' => false, | |
| 14 | + // 'exclude_from_search' => false, | |
| 15 | 15 | ), 'names'); |
| 16 | + | |
| 16 | 17 | unset($post_type_names['attachment']); |
| 18 | +unset($post_type_names['e-floating-buttons']); | |
| 17 | 19 | |
| 18 | -$taxonomy_names = get_taxonomies(array( | |
| 19 | - 'public' => true, | |
| 20 | - 'show_in_rest' => true | |
| 21 | -), 'names'); | |
| 20 | +$taxonomy_names = get_taxonomies([ | |
| 21 | + 'public' => true, | |
| 22 | + 'publicly_queryable' => true, | |
| 23 | + 'rewrite' => true, | |
| 24 | + 'show_ui' => true, // optional but useful | |
| 25 | +], 'names'); | |
| 22 | 26 | |
| 27 | +$excluded_cookies = implode("\n", $configs['exclude_cookies']); | |
| 28 | +$cache_lifespan = $configs['cache_lifespan']; | |
| 23 | 29 | |
| 24 | 30 | |
| 25 | 31 | ?> |
| 26 | -<div id="cache-management" style="display:none"> | |
| 32 | +<div id="cache-management" <?php bwp_is_tab('cache-management'); ?>> | |
| 27 | 33 | <h2 class="berq-tab-title"><?php esc_html_e('Cache Management', 'searchpro'); ?></h2> |
| 28 | 34 | <div class="berq-info-box"> |
| 29 | - <h3 class="berq-box-title"><?php esc_html_e('Page exclusions', 'searchpro'); ?></h3> | |
| 35 | + <h3 class="berq-box-title"><?php esc_html_e('Max. Cache Lifespan', 'searchpro'); ?></h3> | |
| 30 | 36 | <div class="berq-box-content"> |
| 31 | - <p><?php esc_html_e('Exclude pages from being cached. Enter page URLs, one URL per line.', 'searchpro'); ?> <a href="https://berqwp.com/help-center/exclude-pages-from-being-cached/" target="_blank"><?php esc_html_e('Learn more', 'searchpro'); ?></a></p> | |
| 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> | |
| 32 | 90 | <textarea name="berq_exclude_urls" cols="30" rows="10"><?php echo esc_textarea($url_lines); ?></textarea> |
| 33 | 91 | </div> |
| 34 | 92 | </div> |
| 35 | 93 | <div class="berq-info-box"> |
| 36 | - <h3 class="berq-box-title"><?php esc_html_e('Content types', 'searchpro'); ?></h3> | |
| 94 | + <h3 class="berq-box-title"><?php esc_html_e('Content Types', 'searchpro'); ?></h3> | |
| 37 | 95 | <div class="berq-box-content"> |
| 38 | 96 | <p><?php esc_html_e('Choose which post types and archive pages should be cached.', 'searchpro'); ?></p> |
| 39 | 97 | <div class="optimize-post-types"> |
| 40 | - <?php | |
| 41 | - foreach($post_type_names as $key => $value) { | |
| 42 | - ?> | |
| 98 | + <?php | |
| 99 | + foreach ($post_type_names as $key => $value) { | |
| 100 | + ?> | |
| 43 | 101 | <div> |
| 44 | - <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); ?> > | |
| 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); ?>> | |
| 45 | 103 | |
| 46 | 104 | <?php |
| 47 | 105 | $post_counts = wp_count_posts($value); |
| 48 | - $published_count = isset($post_counts->publish) ? $post_counts->publish : 0; | |
| 49 | - echo esc_html(ucfirst($key) . " ($published_count)"); | |
| 106 | + $published_count = isset($post_counts->publish) ? $post_counts->publish : 0; | |
| 107 | + echo esc_html(ucfirst($key) . " ($published_count)"); | |
| 50 | 108 | |
| 51 | 109 | ?> |
| 52 | 110 | </div> |
| 53 | - <?php | |
| 54 | - } | |
| 55 | - foreach($taxonomy_names as $key => $value) { | |
| 56 | - ?> | |
| 111 | + <?php | |
| 112 | + } | |
| 113 | + foreach ($taxonomy_names as $key => $value) { | |
| 114 | + ?> | |
| 57 | 115 | <div> |
| 58 | - <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); ?> > | |
| 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); ?>> | |
| 59 | 117 | |
| 60 | 118 | <?php |
| 61 | - echo esc_html(ucfirst($key)); | |
| 119 | + echo esc_html(ucfirst($key)); | |
| 62 | 120 | ?> |
| 63 | 121 | </div> |
| 64 | - <?php | |
| 65 | - } | |
| 66 | - ?> | |
| 122 | + <?php | |
| 123 | + } | |
| 124 | + ?> | |
| 67 | 125 | |
| 68 | 126 | </div> |
| 69 | 127 | </div> |
| 70 | 128 | </div> |
| 71 | 129 | <div class="berq-info-box"> |
| 72 | - <h3 class="berq-box-title"><?php esc_html_e('Ignore URL parameters', 'searchpro'); ?></h3> | |
| 130 | + <h3 class="berq-box-title"><?php esc_html_e('Exclude Cookies', 'searchpro'); ?></h3> | |
| 73 | 131 | <div class="berq-box-content"> |
| 74 | - <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."); ?> <a href="https://berqwp.com/help-center/ignore-url-parameters/" target="_blank"><?php esc_html_e('Learn more', 'searchpro'); ?></a></p> | |
| 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> | |
| 75 | 148 | <textarea name="berq_ignore_urls_params" cols="30" rows="10"><?php echo esc_textarea($param_lines); ?></textarea> |
| 76 | 149 | </div> |
| 77 | 150 | </div> |
| 78 | 151 | <button type="submit" class="berqwp-save"><svg width="20" height="20" viewBox="0 0 20 20" fill="none" |
| @@ -80,5 +153,5 @@ | ||
| 80 | 153 | <path d="M4.16663 10.8333L7.49996 14.1667L15.8333 5.83334" stroke="white" stroke-width="2" |
| 81 | 154 | stroke-linecap="round" stroke-linejoin="round" /> |
| 82 | 155 | </svg> |
| 83 | 156 | <?php esc_html_e("Save changes", "searchpro"); ?></button> |
| 84 | -</div> | |
| 157 | +</div> | |