| 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 |
unset($post_type_names['attachment']); |
| 17 |
|
| 18 |
$taxonomy_names = get_taxonomies(array( |
| 19 |
'public' => true, |
| 20 |
'show_in_rest' => true |
| 21 |
), 'names'); |
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
?> |
| 26 |
<div id="cache-management" style="display:none"> |
| 27 |
<h2 class="berq-tab-title"><?php esc_html_e('Cache Management', 'searchpro'); ?></h2> |
| 28 |
<div class="berq-info-box"> |
| 29 |
<h3 class="berq-box-title"><?php esc_html_e('Page exclusions', 'searchpro'); ?></h3> |
| 30 |
<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> |
| 32 |
<textarea name="berq_exclude_urls" cols="30" rows="10"><?php echo esc_textarea($url_lines); ?></textarea> |
| 33 |
</div> |
| 34 |
</div> |
| 35 |
<div class="berq-info-box"> |
| 36 |
<h3 class="berq-box-title"><?php esc_html_e('Content types', 'searchpro'); ?></h3> |
| 37 |
<div class="berq-box-content"> |
| 38 |
<p><?php esc_html_e('Choose which post types and archive pages should be cached.', 'searchpro'); ?></p> |
| 39 |
<div class="optimize-post-types"> |
| 40 |
<?php |
| 41 |
foreach($post_type_names as $key => $value) { |
| 42 |
?> |
| 43 |
<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); ?> > |
| 45 |
|
| 46 |
<?php |
| 47 |
$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)"); |
| 50 |
|
| 51 |
?> |
| 52 |
</div> |
| 53 |
<?php |
| 54 |
} |
| 55 |
foreach($taxonomy_names as $key => $value) { |
| 56 |
?> |
| 57 |
<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); ?> > |
| 59 |
|
| 60 |
<?php |
| 61 |
echo esc_html(ucfirst($key)); |
| 62 |
?> |
| 63 |
</div> |
| 64 |
<?php |
| 65 |
} |
| 66 |
?> |
| 67 |
|
| 68 |
</div> |
| 69 |
</div> |
| 70 |
</div> |
| 71 |
<div class="berq-info-box"> |
| 72 |
<h3 class="berq-box-title"><?php esc_html_e('Ignore URL parameters', 'searchpro'); ?></h3> |
| 73 |
<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> |
| 75 |
<textarea name="berq_ignore_urls_params" cols="30" rows="10"><?php echo esc_textarea($param_lines); ?></textarea> |
| 76 |
</div> |
| 77 |
</div> |
| 78 |
<button type="submit" class="berqwp-save"><svg width="20" height="20" viewBox="0 0 20 20" fill="none" |
| 79 |
xmlns="http://www.w3.org/2000/svg"> |
| 80 |
<path d="M4.16663 10.8333L7.49996 14.1667L15.8333 5.83334" stroke="white" stroke-width="2" |
| 81 |
stroke-linecap="round" stroke-linejoin="round" /> |
| 82 |
</svg> |
| 83 |
<?php esc_html_e("Save changes", "searchpro"); ?></button> |
| 84 |
</div> |