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

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

65 lines 1.4 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 if (!defined('ABSPATH')) exit;
4
5 use BerqWP\BerqWP;
6
7 class berqElementor extends berqIntegrations
8 {
9
10 function __construct()
11 {
12 // add_action( 'elementor/editor/after_save', [$this, 'flush_page_cache'] );
13
14 // post update
15 add_action('updated_post_meta', [$this, 'cdn_purge_static_post'], 10, 4);
16 add_action('added_post_meta', [$this, 'cdn_purge_static_post'], 10, 4);
17
18 // elementor cache flush
19 add_action('elementor/core/files/clear_cache', [$this, 'handle_flush_cache']);
20 }
21
22 function detect() {
23 return class_exists( '\Elementor\Plugin' );
24 }
25
26 function flush_page_cache($post_id, $editor_data)
27 {
28
29 $post_url = get_permalink($post_id);
30 berqCache::purge_page($post_url, true);
31 }
32
33 function handle_flush_cache() {
34
35 if (!$this->detect()) {
36 return;
37 }
38
39 berqCache::stale_cloud_assets();
40 }
41
42 function cdn_purge_static_post($meta_id, $post_id, $meta_key, $meta_value)
43 {
44
45 if (!$this->detect()) {
46 return;
47 }
48
49 if ('_elementor_css' !== $meta_key) {
50 return;
51 }
52
53 if (!berqwp_can_use_cloud()) {
54 return;
55 }
56
57 global $berq_log;
58 $berq_log->info("Elementor regenerating css detected");
59
60 berqCache::stale_cloud_assets();
61 }
62 }
63
64 new berqElementor();
65