0 ) { $gorilla_cache_sentence = __( 'Visitors get your pages from the cache.', 'gorilla-cache' ); } else { $gorilla_cache_sentence = __( 'Your pages are cached as visitors arrive.', 'gorilla-cache' ); } } else { $gorilla_cache_sentence = '' === (string) $gorilla_cache_state['reason'] ? __( 'It has not checked this site yet. Click Check again.', 'gorilla-cache' ) : GorillaCache_Environment::message( $gorilla_cache_state ); } // "Taken care of": one row per thing handled; a warning row is amber. Each row: sign, icon, line, optional sentence. $gorilla_cache_items = array(); if ( $gorilla_cache_on ) { if ( array() !== $gorilla_cache_stores ) { /* translators: %s: list of plugin names, such as WooCommerce. */ $gorilla_cache_items[] = array( 'good', 'yes-alt', sprintf( __( '%s: cart, checkout, account and member pages are never cached', 'gorilla-cache' ), implode( ', ', $gorilla_cache_stores ) ), '' ); } else { $gorilla_cache_items[] = array( 'good', 'yes-alt', __( 'Logged-in visitors and shoppers get their own pages', 'gorilla-cache' ), '' ); } $gorilla_cache_items[] = array( 'good', 'yes-alt', __( 'Cleared when you change something', 'gorilla-cache' ), '' ); // Another plugin's leftover page cache file was replaced: said for 7 days, with where its copy is kept. $gorilla_cache_replaced = (array) $gorilla_cache_state['replaced']; if ( ! empty( $gorilla_cache_replaced['at'] ) && (int) $gorilla_cache_replaced['at'] > time() - 7 * DAY_IN_SECONDS ) { $gorilla_cache_items[] = array( 'neutral', 'update', /* translators: %s: name of another cache plugin. */ sprintf( __( "%s's leftover page cache file was replaced", 'gorilla-cache' ), (string) $gorilla_cache_replaced['name'] ), /* translators: 1: a date, 2: a file name. */ sprintf( __( 'On %1$s. The old file is kept as wp-content/cache/gorilla-cache/%2$s while Gorilla Cache is active.', 'gorilla-cache' ), wp_date( get_option( 'date_format' ), (int) $gorilla_cache_replaced['at'] ), (string) $gorilla_cache_replaced['kept'] ), ); } $gorilla_cache_move = GorillaCache_Site::last_move(); if ( null !== $gorilla_cache_move && '' !== $gorilla_cache_move['from'] && $gorilla_cache_move['from'] === $gorilla_cache_move['to'] ) { /* translators: %s: a date. */ $gorilla_cache_items[] = array( 'neutral', 'update', __( 'Started fresh after a move or copy', 'gorilla-cache' ), sprintf( __( 'This site now runs on another server, database or environment. Its cache was cleared on %s, so no page from the other copy is shown.', 'gorilla-cache' ), wp_date( get_option( 'date_format' ), (int) $gorilla_cache_move['at'] ) ) ); } elseif ( null !== $gorilla_cache_move && '' !== $gorilla_cache_move['from'] ) { $gorilla_cache_items[] = array( 'neutral', 'update', __( 'Started fresh after a move or copy', 'gorilla-cache' ), /* translators: 1: the site's address now, 2: its address before, 3: a date. */ sprintf( __( 'This site now runs at %1$s (before: %2$s). Its cache was cleared on %3$s, so no page from the other copy is shown.', 'gorilla-cache' ), $gorilla_cache_move['to'], $gorilla_cache_move['from'], wp_date( get_option( 'date_format' ), (int) $gorilla_cache_move['at'] ) ), ); } $gorilla_cache_cron_hours = GorillaCache_Installer::cron_stalled_hours(); switch ( GorillaCache_Preload::summary() ) { case 'off': $gorilla_cache_items[] = array( 'neutral', 'minus', __( 'Warming is off', 'gorilla-cache' ), __( 'Pages are cached as visitors arrive.', 'gorilla-cache' ) ); break; case 'paused': $gorilla_cache_items[] = array( 'warning', 'warning', __( 'Warming is paused', 'gorilla-cache' ), GorillaCache_Preload::blocked_message( $gorilla_cache_preload['blocked'] ) ); break; case 'waiting': $gorilla_cache_items[] = array( 'warning', 'warning', __( 'Warming is waiting', 'gorilla-cache' ), $gorilla_cache_cron_hours ? __( 'It starts when WP-Cron runs again.', 'gorilla-cache' ) : __( "WordPress's scheduled tasks are not running on this site, so warming cannot start. Pages are still cached as visitors arrive. Your host can run WordPress's scheduled tasks with a real cron job.", 'gorilla-cache' ) ); break; case 'starting': $gorilla_cache_items[] = array( 'neutral', 'update', __( 'Warming starts in the background', 'gorilla-cache' ), '' ); break; case 'warming': /* translators: 1: pages visited so far, 2: pages to visit in total. */ $gorilla_cache_items[] = array( 'neutral', 'update', sprintf( __( 'Warming in the background: %1$s of %2$s pages', 'gorilla-cache' ), number_format_i18n( $gorilla_cache_preload['done'] ), number_format_i18n( $gorilla_cache_preload['total'] ) ), '' ); break; default: $gorilla_cache_refusals = GorillaCache_Preload::refusals(); if ( $gorilla_cache_refusals['stored'] < $gorilla_cache_refusals['visited'] ) { /* translators: 1: pages stored, 2: pages visited. */ $gorilla_cache_items[] = array( 'good', 'yes-alt', sprintf( __( 'Warmed in the background: %1$s of %2$s pages stored', 'gorilla-cache' ), number_format_i18n( $gorilla_cache_refusals['stored'] ), number_format_i18n( $gorilla_cache_refusals['visited'] ) ), '' ); } else { $gorilla_cache_items[] = array( 'good', 'yes-alt', __( 'Warmed in the background', 'gorilla-cache' ), '' ); } } // Most pages warming visited could not be stored, for one reason: say so, since "Caching is on" with no pages // stored would read as healthy. $gorilla_cache_refusals = GorillaCache_Preload::refusals(); $gorilla_cache_top = $gorilla_cache_refusals['top']; // Perfmatters' Cloudflare Edge Cache forbids caching on every page: named as the cause, instead of the header alone. $gorilla_cache_pm_edge = GorillaCache_Environment::perfmatters_edge_cache(); if ( $gorilla_cache_pm_edge ) { $gorilla_cache_items[] = array( 'warning', 'warning', __( "Perfmatters' Cloudflare Edge Cache stops Gorilla Cache storing pages", 'gorilla-cache' ), __( 'It sends a header on every page that forbids caching, so Gorilla Cache stores none. Turn off one of the two: Cloudflare Edge Cache in Perfmatters, or Gorilla Cache.', 'gorilla-cache' ) ); } if ( null !== $gorilla_cache_top && ! ( $gorilla_cache_pm_edge && 'no_cache_header' === $gorilla_cache_top['reason'] ) && $gorilla_cache_refusals['visited'] >= 3 && 2 * (int) $gorilla_cache_top['count'] > $gorilla_cache_refusals['visited'] ) { $gorilla_cache_items[] = array( 'warning', 'warning', /* translators: 1: pages that could not be stored for this reason, 2: pages visited. */ sprintf( __( '%1$s of %2$s pages cannot be cached', 'gorilla-cache' ), number_format_i18n( (int) $gorilla_cache_top['count'] ), number_format_i18n( $gorilla_cache_refusals['visited'] ) ), /* translators: 1: why, in one sentence, 2: one of those addresses. */ sprintf( __( '%1$s For example: %2$s', 'gorilla-cache' ), GorillaCache_Explain::refusal_sentence( (string) $gorilla_cache_top['reason'], (string) $gorilla_cache_top['detail'] ), (string) $gorilla_cache_top['url'] ), ); } if ( $gorilla_cache_cron_hours ) { $gorilla_cache_items[] = array( 'warning', 'warning', /* translators: %s: number of hours. */ sprintf( _n( 'WP-Cron has not run here for %s hour', 'WP-Cron has not run here for %s hours', $gorilla_cache_cron_hours, 'gorilla-cache' ), number_format_i18n( $gorilla_cache_cron_hours ) ), __( "WordPress's scheduled tasks run when someone visits the site, or from a cron job on the server. Until they run, warming waits and expired pages are not tidied away; pages are still cached as visitors arrive. A site behind a password, or with WP-Cron switched off, needs a cron job on the server: your host can add one.", 'gorilla-cache' ), ); } // Cloudflare: what a clear does there, from the Cloudflare plugin's own settings. $gorilla_cache_cf = GorillaCache_Environment::cloudflare(); if ( $gorilla_cache_cf['plugin'] ) { if ( GorillaCache_Site::is_copy() ) { $gorilla_cache_items[] = array( 'neutral', 'info-outline', __( 'Cloudflare is not purged from this copy', 'gorilla-cache' ), __( 'It shares the live site\'s Cloudflare zone, so a clear here never purges it.', 'gorilla-cache' ) ); } elseif ( ! $gorilla_cache_cf['signed_in'] ) { $gorilla_cache_items[] = array( 'neutral', 'info-outline', __( 'Cloudflare plugin not connected', 'gorilla-cache' ), __( 'Sign in to the Cloudflare plugin so a clear can request a Cloudflare purge.', 'gorilla-cache' ) ); } elseif ( $gorilla_cache_cf['apo'] || $gorilla_cache_cf['auto_purge'] ) { $gorilla_cache_items[] = array( 'good', 'yes-alt', __( 'Works with Cloudflare', 'gorilla-cache' ), $gorilla_cache_cf['apo'] ? __( 'Each full clear also requests a Cloudflare purge (APO is on).', 'gorilla-cache' ) : __( 'Each full clear also requests a Cloudflare purge (Auto Purge is on).', 'gorilla-cache' ) ); } elseif ( 'cloudflare_edge' === $gorilla_cache_state['note'] ) { $gorilla_cache_items[] = array( 'warning', 'warning', __( 'Cloudflare is not purged', 'gorilla-cache' ), __( 'Cloudflare serves cached pages, but its plugin purges only with APO or Auto Purge on. Turn one on in the Cloudflare plugin.', 'gorilla-cache' ) ); } else { $gorilla_cache_items[] = array( 'neutral', 'info-outline', __( 'Cloudflare', 'gorilla-cache' ), __( 'APO and Auto Purge are off, so Cloudflare keeps no copy of your pages and nothing needs a purge.', 'gorilla-cache' ) ); } } if ( '' !== $gorilla_cache_note && ! ( $gorilla_cache_cf['plugin'] && 'cloudflare_edge' === $gorilla_cache_state['note'] ) ) { $gorilla_cache_note_titles = array( 'cloudflare_edge' => __( 'Cloudflare also caches your pages', 'gorilla-cache' ), 'litespeed_no_cache' => __( 'LiteSpeed server', 'gorilla-cache' ), 'litespeed_plugin_idle' => __( 'LiteSpeed Cache cannot cache here', 'gorilla-cache' ), 'probe_failed' => __( 'The check for other caches did not finish', 'gorilla-cache' ), 'weak_headers' => __( 'Caching headers, but no cache in front', 'gorilla-cache' ), ); $gorilla_cache_note_code = (string) $gorilla_cache_state['note']; $gorilla_cache_items[] = array( 'neutral', 'info-outline', isset( $gorilla_cache_note_titles[ $gorilla_cache_note_code ] ) ? $gorilla_cache_note_titles[ $gorilla_cache_note_code ] : __( 'Worth knowing', 'gorilla-cache' ), $gorilla_cache_note ); } // Plugins that put a visitor's own session into every first page: nothing can be stored safely. if ( class_exists( 'Charitable' ) ) { $gorilla_cache_items[] = array( 'warning', 'warning', __( 'Charitable keeps pages out of the cache', 'gorilla-cache' ), __( "Charitable writes a visitor's own session into every page, so pages are not cached: a cached copy would share one donor's session with everyone.", 'gorilla-cache' ) ); } if ( defined( 'FLUENTCART_VERSION' ) ) { $gorilla_cache_items[] = array( 'warning', 'warning', __( 'FluentCart keeps pages out of the cache', 'gorilla-cache' ), __( "FluentCart sets a visitor's own cookie on every first visit, so pages are not cached.", 'gorilla-cache' ) ); } if ( array() !== $gorilla_cache_unsafe ) { $gorilla_cache_names = array(); foreach ( $gorilla_cache_unsafe as $gorilla_cache_name ) { // Plugin names stay as they are; the one description is translated. $gorilla_cache_names[] = 'WooCommerce geolocation with location-based taxes' === $gorilla_cache_name ? __( 'WooCommerce geolocation with location-based taxes', 'gorilla-cache' ) : $gorilla_cache_name; } /* translators: %s: list of setups that choose prices per visitor. */ $gorilla_cache_items[] = array( 'warning', 'warning', __( 'Pages with prices are not cached', 'gorilla-cache' ), sprintf( __( 'Prices are chosen on the server for each visitor (%s), so pages that show prices are not cached, to keep prices right.', 'gorilla-cache' ), implode( ', ', $gorilla_cache_names ) ) ); } if ( defined( 'PERFMATTERS_VERSION' ) ) { $gorilla_cache_items[] = array( 'good', 'yes-alt', __( 'Works with Perfmatters', 'gorilla-cache' ), __( 'Cached pages are cleared when its settings change.', 'gorilla-cache' ) ); } if ( GorillaCache_Integrations::unloaded_by_mu_mode() ) { $gorilla_cache_items[] = array( 'warning', 'warning', __( "Perfmatters' MU Mode switches Gorilla Cache off on some pages", 'gorilla-cache' ), __( "Those pages are not cleared when they change. Remove Gorilla Cache from the MU Mode list in Perfmatters' Script Manager.", 'gorilla-cache' ) ); } } $gorilla_cache_cards_only = ! empty( $gorilla_cache_cards_only ); // The on/off switch: while caching is on, or while the owner turned it off here (not while another cache does the // job, and not when wp-config.php turns it off, which only an edit there undoes). $gorilla_cache_switch = current_user_can( 'activate_plugins' ) && ( $gorilla_cache_on || ( 'paused' === $gorilla_cache_state['reason'] && ! ( defined( 'GORILLA_CACHE_PAUSED' ) && GORILLA_CACHE_PAUSED ) ) ); $gorilla_cache_warming = $gorilla_cache_on && in_array( GorillaCache_Preload::summary(), array( 'starting', 'warming' ), true ); ?>