PluginProbe ʕ •ᴥ•ʔ
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More / 4.0.7
Superb Addons: Blocks, Patterns, Pre-built Pages, Sliders, Popups, Free Forms, Animations & More v4.0.7
4.0.7 4.0.6 4.0.5 4.0.4 4.0.3 4.0.2 4.0.1 4.0.0 trunk 1.0.0 2.0.0 2.0.1 2.0.2 2.0.3 3.0 3.0.1 3.0.2 3.0.5 3.0.6 3.0.7 3.0.8 3.0.9 3.1.0 3.1.2 3.1.3 3.2.0 3.2.1 3.2.2 3.2.4 3.2.5 3.2.7 3.2.8 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.4.5 3.4.6 3.5.0 3.5.1 3.5.2 3.5.3 3.5.4 3.5.6 3.5.7 3.5.8 3.5.9 3.6.0 3.6.1 3.6.2 3.7.0 3.7.1
superb-blocks / src / gutenberg / class-gutenberg-cache-util.php
superb-blocks / src / gutenberg Last commit date
block-api 2 days ago form 2 days ago import 2 days ago popup 2 days ago templates 2 days ago class-gutenberg-block-styles.php 2 days ago class-gutenberg-cache-util.php 2 days ago class-gutenberg-conditions-controller.php 2 days ago class-gutenberg-controller.php 2 days ago class-gutenberg-dynamic-content-controller.php 2 days ago class-gutenberg-enhancements-controller.php 2 days ago class-gutenberg-social-icons-controller.php 2 days ago class-gutenberg-sticky-controller.php 2 days ago class-gutenberg-z-index-controller.php 2 days ago
class-gutenberg-cache-util.php
41 lines
1 <?php
2
3 namespace SuperbAddons\Gutenberg\Controllers;
4
5 defined('ABSPATH') || exit();
6
7 /**
8 * Shared helpers for marking the current request uncacheable when rendered
9 * output depends on the current visitor (visibility conditions, dynamic user
10 * content, etc.).
11 *
12 * Scopes the opt-out to two layers so both in-process WP cache plugins and
13 * upstream CDNs respect it:
14 * - DONOTCACHEPAGE: honored by WP Rocket, W3TC, WP Super Cache, LiteSpeed,
15 * Kinsta/WP Engine host caches.
16 * - nocache_headers(): emits Cache-Control: no-cache, no-store, must-revalidate,
17 * which most well-behaved CDNs and reverse proxies respect.
18 */
19 class GutenbergCacheUtil
20 {
21 /**
22 * Flag the current request as uncacheable. Safe to call multiple times.
23 */
24 public static function MarkAsUncacheable()
25 {
26 // DONOTCACHEPAGE is the well-known unprefixed contract honored by WP Rocket, W3TC, WP Super Cache, LiteSpeed, and major managed hosts; prefixing it would defeat its purpose.
27 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound
28 if (!defined('DONOTCACHEPAGE')) {
29 // phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedConstantFound
30 define('DONOTCACHEPAGE', true);
31 }
32
33 // nocache_headers() only emits when headers haven't already been sent
34 // (render_block runs during body output — fine for most setups, no-op
35 // if output buffering was flushed early).
36 if (!headers_sent()) {
37 nocache_headers();
38 }
39 }
40 }
41