PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 1.9.3
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v1.9.3
4.1.16 4.1.15 4.1.14 4.1.13 4.1.12 4.1.11 4.1.10 4.0.30 4.0.29 4.0.28 4.0.27 4.0.26 4.0.24 4.0.25 4.0.23 4.0.22 4.0.21 4.0.19 4.0.18 4.0.17 4.0.16 1.9.3 1.9.4 1.9.5 1.9.6 All 170 releases
searchpro / inc / thirdparty / hosting / Pressable.php

Pressable.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 1.9.3, at inc/thirdparty/hosting/Pressable.php

40 lines 949 B
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if (!defined('ABSPATH')) exit;
3
4 class Pressable extends berqIntegrations {
5
6 function __construct() {
7 add_action('berqwp_flush_all_cache', [$this, 'flush_cache']);
8 add_action('berqwp_stored_page_cache', [$this, 'flush_cache']);
9 add_action('berqwp_flush_page_cache', [$this, 'flush_cache']);
10 add_action('init', [$this, 'bypass_cache']);
11 }
12
13 function bypass_cache() {
14 if (!$this->is_pressable()) {
15 return;
16 }
17
18 $bypass_cache = apply_filters( 'berqwp_bypass_cache', false );
19
20 if ($bypass_cache) {
21 berqReverseProxyCache::bypass();
22 }
23 }
24
25 function is_pressable() {
26 return isset($_SERVER["PRESSABLE_PROXIED_REQUEST"]) || strpos(gethostname(), "atomicsites.net") !== false;
27 }
28
29 function flush_cache() {
30
31 if (!$this->is_pressable()) {
32 return;
33 }
34
35 wp_cache_flush();
36 }
37
38 }
39
40 new Pressable();