PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 4.0.26
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v4.0.26
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 / BerqWP / src / BerqWP.php

BerqWP.php in BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript 4.0.26, at BerqWP/src/BerqWP.php

80 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 namespace BerqWP;
3 use BerqWP\Cache;
4 use BerqWP\CriticalCSS;
5 use BerqWP\CDN;
6 // use BerqWP\GuzzleHttp\Client;
7 use GuzzleHttp\Client;
8
9
10 class BerqWP
11 {
12 protected $client = null;
13 protected $license_key = null;
14 protected $cache_directory = null;
15 protected $storage_dir = null;
16 static $endpoint = 'https://boost.berqwp.com/optimize/';
17
18 function __construct($license_key, $cache_directory, $storage_dir) {
19 $this->license_key = $license_key;
20 $this->cache_directory = $cache_directory;
21 $this->storage_dir = $storage_dir;
22
23 $this->client = new Client([
24 'base_uri' => self::$endpoint,
25 'http_errors' => false,
26 'verify' => false,
27 'timeout' => 30,
28 'headers' => [
29 'User-Agent' => 'BerqWP/1.0 (https://berqwp.com)'
30 ]
31 ]);
32 }
33
34 function request_cache($post_data, $timeout = 30) {
35 $cache = new Cache($this->client, $this->cache_directory, $this->storage_dir);
36 return $cache->request_cache($post_data, $timeout);
37 }
38
39 function request_multi_cache($post_data_arr) {
40 $cache = new Cache($this->client, $this->cache_directory, $this->storage_dir);
41 return $cache->request_multi_cache($post_data_arr);
42 }
43
44 function purge_critilclcss($domain) {
45 $critical = new CriticalCSS($this->client, $this->license_key);
46 return $critical->purge_all($domain);
47 }
48
49 function purge_criticlecss_url($page_url) {
50 $critical = new CriticalCSS($this->client, $this->license_key);
51 return $critical->purge_url($page_url);
52 }
53
54 function purge_cdn($domain) {
55 $cdn = new CDN($this->client, $this->license_key);
56 return $cdn->purge_all($domain);
57 }
58
59 function cdn_stale_assets($domain) {
60 $cdn = new CDN($this->client, $this->license_key);
61 return $cdn->stale_assets($domain);
62 }
63
64 function request_cache_warmup($post_data, $async = false) {
65 $cache = new Cache($this->client, $this->cache_directory, $this->storage_dir);
66 return $cache->request_cache_warmup($post_data, $async);
67 }
68
69 function queue_count($site_id) {
70 $cache = new Cache($this->client, $this->cache_directory, $this->storage_dir);
71 return $cache->queue_count($site_id);
72 }
73
74 function clear_cache_queue($site_url, $site_id) {
75 $cache = new Cache($this->client, $this->cache_directory, $this->storage_dir);
76 return $cache->clear_queue($site_url, $site_id, $this->license_key);
77 }
78
79 }
80