| @@ -134,13 +134,13 @@ | ||
| 134 | 134 | return TRUE; // Always return true. |
| 135 | 135 | } |
| 136 | 136 | |
| 137 | 137 | /** |
| 138 | - * Defines no-cache constants for various WordPress plugins. | |
| 138 | + * Defines no-cache constants/signals for WordPress caching plugins. | |
| 139 | 139 | * |
| 140 | - * This is compatible with Quick Cache, W3 Total Cache, and also with WP Super Cache. | |
| 141 | - * Quick Cache uses: ``QUICK_CACHE_ALLOWED``, and other plugins use: ``DONOTCACHEPAGE``. | |
| 142 | - * W3 Total Cache is also known to be compatible with ``DONOTCACHEOBJECT`` and ``DONOTCACHEDB``. | |
| 140 | + * `DONOTCACHEPAGE` is the de facto cross-plugin page-cache bypass signal. | |
| 141 | + * Legacy s2Member cache flags are retained, with explicit runtime APIs/filters | |
| 142 | + * for popular caches that expose their own no-cache mechanisms. | |
| 143 | 143 | * |
| 144 | 144 | * Disallow caching if the ``$no_cache`` parameter is passed in as ``true``, by other routines. |
| 145 | 145 | * In addition, always disallow caching for logged in users, and GET requests with: `/?s2member` Systematics. |
| 146 | 146 | * For clarity on s2Member Systematics, see: {@link s2Member\Systematics\c_ws_plugin__s2member_systematics::is_s2_systematic_use_page()}. |
| @@ -238,8 +238,21 @@ | ||
| 238 | 238 | * @var bool |
| 239 | 239 | */ |
| 240 | 240 | if(!defined('QUICK_CACHE_ALLOWED')) |
| 241 | 241 | define('QUICK_CACHE_ALLOWED', FALSE); |
| 242 | + | |
| 243 | + //260918.2104 Explicit runtime no-cache APIs for popular caches that do not uniformly rely on the generic constants. | |
| 244 | + do_action('litespeed_control_set_nocache', 's2Member dynamic/private content'); // LiteSpeed Cache. | |
| 245 | + add_filter('flying_press_is_cacheable', '__return_false', PHP_INT_MAX); // FlyingPress. | |
| 246 | + add_filter('swcfpc_cache_bypass', '__return_true', PHP_INT_MAX); // Super Page Cache for Cloudflare. | |
| 247 | + if(function_exists('wpfc_exclude_current_page')) // WP Fastest Cache. | |
| 248 | + wpfc_exclude_current_page(); | |
| 249 | + | |
| 250 | + // Cloudflare APO uses its own edge-cache signal. The filter helps when this runs early; | |
| 251 | + // the response header also overrides APO when headers are still mutable on a later call. | |
| 252 | + add_filter('cloudflare_use_cache', '__return_false', PHP_INT_MAX); | |
| 253 | + if(class_exists('\Cloudflare\APO\WordPress\Hooks', FALSE) && !headers_sent()) | |
| 254 | + header('cf-edge-cache: no-cache', TRUE); | |
| 242 | 255 | |
| 243 | 256 | $once = TRUE; // Set these one time only. |
| 244 | 257 | |
| 245 | 258 | c_ws_plugin__s2member_no_cache::$headers = TRUE; |