| 1 |
<?php |
| 2 |
/** |
| 3 |
* Partial: Page Cache module card. |
| 4 |
*/ |
| 5 |
|
| 6 |
if (!defined('ABSPATH')) die('No direct access allowed'); |
| 7 |
|
| 8 |
$active = $cache['active']; |
| 9 |
$is_premium = !empty($cache['is_premium']); |
| 10 |
$files_cached_raw = (int) $cache['files_cached']; |
| 11 |
$files_cached = number_format_i18n($files_cached_raw); |
| 12 |
$cache_size_human = $cache['cache_size_human']; |
| 13 |
$last_cleared_human = $cache['last_cleared_human']; |
| 14 |
$gzip_active = $cache['gzip_active']; |
| 15 |
$country_caching = $cache['country_caching']; // always false in free |
| 16 |
?> |
| 17 |
|
| 18 |
<div class="wpo-mod-card<?php echo !$active ? ' wpo-inactive-card' : ''; ?>"> |
| 19 |
|
| 20 |
<div class="wpo-mod-header"> |
| 21 |
<div class="wpo-mod-icon-title"> |
| 22 |
<span class="wpo-dash-icon dashicons dashicons-cloud"></span> |
| 23 |
<?php esc_html_e('Page cache', 'wp-optimize'); ?> |
| 24 |
</div> |
| 25 |
<?php if ($active) : ?> |
| 26 |
<span class="wpo-badge active"> |
| 27 |
<?php esc_html_e('Active', 'wp-optimize'); ?> |
| 28 |
</span> |
| 29 |
<?php else : ?> |
| 30 |
<span class="wpo-badge inactive"><?php esc_html_e('Inactive', 'wp-optimize'); ?></span> |
| 31 |
<?php endif; ?> |
| 32 |
</div> |
| 33 |
|
| 34 |
<div> |
| 35 |
<?php if ($active) : ?> |
| 36 |
<div class="wpo-mod-big"> |
| 37 |
<?php echo esc_html($files_cached); ?> |
| 38 |
<?php /* translators: singular/plural label next to the cached files count */ ?> |
| 39 |
<span><?php echo esc_html(_n('cached file', 'cached files', $files_cached_raw, 'wp-optimize')); ?></span> |
| 40 |
</div> |
| 41 |
<?php else : ?> |
| 42 |
<div class="wpo-mod-big"><?php esc_html_e('No cached files yet', 'wp-optimize'); ?></div> |
| 43 |
<?php endif; ?> |
| 44 |
<p class="wpo-mod-desc"> |
| 45 |
<?php echo $is_premium ? esc_html__('Visitors get pre-built pages, so repeat visits feel instant.', 'wp-optimize') : esc_html__('Serves a saved version of your pages to repeat visitors, like photocopying instead of retyping.', 'wp-optimize'); ?> |
| 46 |
</p> |
| 47 |
</div> |
| 48 |
|
| 49 |
<div class="wpo-feature-list"> |
| 50 |
|
| 51 |
<div class="wpo-feat-row"> |
| 52 |
<span class="wpo-feat-name"> |
| 53 |
<span class="wpo-dot <?php echo $active ? 'wpo-dot-on' : 'wpo-dot-off'; ?>">●</span> |
| 54 |
<?php esc_html_e('Page caching', 'wp-optimize'); ?> |
| 55 |
</span> |
| 56 |
<span class="wpo-feat-val <?php echo $active ? 'on' : 'off'; ?>"> |
| 57 |
<?php |
| 58 |
if ($active) : |
| 59 |
/* translators: %s = number of files */ |
| 60 |
echo esc_html(sprintf(_n('%s file', '%s files', $files_cached_raw, 'wp-optimize'), $files_cached)); |
| 61 |
else : |
| 62 |
echo '–'; |
| 63 |
endif; |
| 64 |
?> |
| 65 |
</span> |
| 66 |
</div> |
| 67 |
|
| 68 |
<div class="wpo-feat-row"> |
| 69 |
<span class="wpo-feat-name"> |
| 70 |
<span class="wpo-dot <?php echo $gzip_active ? 'wpo-dot-on' : 'wpo-dot-off'; ?>">●</span> |
| 71 |
<?php esc_html_e('Gzip compression', 'wp-optimize'); ?> |
| 72 |
</span> |
| 73 |
<span class="wpo-feat-val <?php echo $gzip_active ? 'on' : 'off'; ?>"> |
| 74 |
<?php echo $gzip_active ? esc_html__('Active', 'wp-optimize') : '–'; ?> |
| 75 |
</span> |
| 76 |
</div> |
| 77 |
|
| 78 |
<div class="wpo-feat-row"> |
| 79 |
<span class="wpo-feat-name"> |
| 80 |
<span class="wpo-dot <?php echo $country_caching ? 'wpo-dot-on' : 'wpo-dot-off'; ?>">●</span> |
| 81 |
<?php esc_html_e('Country-based caching', 'wp-optimize'); ?> |
| 82 |
</span> |
| 83 |
<?php if ($is_premium) : ?> |
| 84 |
<span class="wpo-feat-val <?php echo $country_caching ? 'on' : 'off'; ?>"> |
| 85 |
<?php echo $country_caching ? esc_html__('Active', 'wp-optimize') : '–'; ?> |
| 86 |
</span> |
| 87 |
<?php else : ?> |
| 88 |
<span class="wpo-feat-val premium"><?php esc_html_e('Premium', 'wp-optimize'); ?></span> |
| 89 |
<?php endif; ?> |
| 90 |
</div> |
| 91 |
|
| 92 |
</div> |
| 93 |
|
| 94 |
<?php if (!$is_premium) : ?> |
| 95 |
<div class="wpo-notice"> |
| 96 |
<span class="wpo-dash-icon dashicons dashicons-admin-site"></span> |
| 97 |
<span> |
| 98 |
<?php esc_html_e('Have visitors from different regions? Serve faster, localised pages with Premium.', 'wp-optimize'); ?> |
| 99 |
<a href="<?php echo esc_url(WP_Optimize()->premium_version_link . '&utm_content=dashboard-cache-country'); ?>" target="_blank"> |
| 100 |
<?php esc_html_e('Learn more', 'wp-optimize'); ?> |
| 101 |
</a>. |
| 102 |
</span> |
| 103 |
</div> |
| 104 |
<?php endif; ?> |
| 105 |
|
| 106 |
<div class="wpo-mod-footer"> |
| 107 |
<span> |
| 108 |
<?php |
| 109 |
if ($active) : |
| 110 |
/* translators: %1$s = cache size, %2$s = time cleared */ |
| 111 |
printf(esc_html__('%1$s cached · %2$s', 'wp-optimize'), esc_html($cache_size_human), esc_html($last_cleared_human)); |
| 112 |
endif; |
| 113 |
?> |
| 114 |
</span> |
| 115 |
<a href="<?php echo esc_url(WP_Optimize()->get_options()->admin_page_url('wpo_cache')); ?>" class="wpo-dash-link"> |
| 116 |
<?php esc_html_e('Manage cache', 'wp-optimize'); ?><span class="dashicons dashicons-arrow-right-alt"></span> |
| 117 |
</a> |
| 118 |
</div> |
| 119 |
</div> |