PluginProbe
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript / 1.9.4
BerqWP – All-In-One Optimization for Core Web Vitals, Cache, CDN, Images, CSS & JavaScript v1.9.4
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 / api / store_cache.php

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

41 lines 1.2 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 $status = sanitize_text_field($request->get_param('status'));
5 $key = sanitize_text_field($request->get_param('key'));
6 $html = base64_decode($request->get_param('html'));
7 $slug = sanitize_text_field($request->get_param('page_slug'));
8
9 if ($status == 'success' && !empty($request->get_param('html'))) {
10
11 // Allow other plugins to modify cache html
12 $html = apply_filters( 'berqwp_cache_buffer', $html );
13
14 // Define the cache directory
15 $cache_directory = optifer_cache . '/html/';
16
17 // Create the cache directory if it doesn't exist
18 if (!file_exists($cache_directory)) {
19 mkdir($cache_directory, 0755, true);
20 }
21
22 $cache_file = $cache_directory . md5($slug) . '.html';
23
24 // update_option( md5($slug), $key );
25 file_put_contents($cache_file, $html);
26
27 if (bwp_is_gzip_supported()) {
28 $cache_file = $cache_directory . md5($slug) . '.gz';
29 $html = gzencode($html, 9);
30 file_put_contents($cache_file, $html);
31 }
32
33
34 do_action('berqwp_stored_page_cache', $slug);
35
36 global $berq_log;
37 $berq_log->info("Stored cache for $slug");
38
39
40 }
41 unset($html); // release memory