PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / trunk
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript vtrunk
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 1.9.7 All 169 releases
searchpro / inc / thirdparty / hosting / LiteSpeed.php

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

46 lines 1.0 KB
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 LiteSpeed extends berqIntegrations {
5 function __construct() {
6 add_action('berqwp_flush_all_cache', [$this, 'flush_cache']);
7 add_action('berqwp_stored_page_cache', [$this, 'flush_page_cache']);
8 add_action('berqwp_flush_page_cache', [$this, 'flush_page_cache']);
9 }
10
11 function flush_page_cache($slug) {
12
13 if (empty($slug)) {
14 $slug = '/';
15 }
16
17 if (!$this->is_litespeed()) {
18 return;
19 }
20
21 @header('X-LiteSpeed-Purge: '.$slug);
22
23 $page_url = home_url() . $slug;
24
25 do_action( 'litespeed_purge_url', $page_url );
26 }
27
28
29 function flush_cache() {
30
31 if (!$this->is_litespeed()) {
32 return;
33 }
34
35 @header('X-LiteSpeed-Purge: *', true);
36
37 do_action( 'litespeed_purge_all' );
38 }
39
40 function is_litespeed() {
41 return isset($_SERVER['SERVER_SOFTWARE']) && strpos($_SERVER['SERVER_SOFTWARE'], 'LiteSpeed') !== false;
42 }
43
44 }
45
46 new LiteSpeed();