PluginProbe
Elementor Website Builder – more than just a page builder / 3.30.1
Elementor Website Builder – more than just a page builder v3.30.1
4.3.3 4.3.2 4.3.1 4.3.0 4.3.0-beta3 4.3.0-beta2 4.3.0-beta1 4.2.4 4.2.3 4.2.2 4.2.1 4.2.0 4.1.5 4.2.0-beta2 4.2.0-dev2 4.2.0-beta1 4.1.4 4.1.3 4.1.2 4.1.1 4.1.0 4.1.0-beta3 4.1.0-dev3 4.0.9 4.1.0-beta2 All 456 releases
← All changes | modules/element-cache/module.php +35 -0 4.3.2 → 3.30.1 View file →
@@ -24,8 +24,12 @@
24 24 parent::__construct();
25 25
26 26 $this->register_shortcode();
27 27
28 + if ( ! Plugin::$instance->experiments->is_feature_active( 'e_element_cache' ) ) {
29 + return;
30 + }
31 +
28 32 add_filter( 'elementor/element_cache/unique_id', [ $this, 'get_unique_id' ] );
29 33
30 34 $this->add_advanced_tab_actions();
31 35
@@ -31,10 +35,28 @@
31 35
32 36 if ( is_admin() ) {
33 37 add_action( 'elementor/admin/after_create_settings/' . Settings::PAGE_ID, [ $this, 'register_admin_fields' ], 100 );
34 38 }
39 +
40 + $this->clear_cache_on_site_changed();
35 41 }
36 42
43 + public static function get_experimental_data(): array {
44 + return [
45 + 'name' => 'e_element_cache',
46 + 'title' => esc_html__( 'Element Caching', 'elementor' ),
47 + 'tag' => esc_html__( 'Performance', 'elementor' ),
48 + 'description' => esc_html__( 'Elements caching reduces loading times by serving up a copy of an element instead of rendering it fresh every time the page is loaded. When active, Elementor will determine which elements can benefit from static loading - but you can override this.', 'elementor' ),
49 + 'release_status' => ExperimentsManager::RELEASE_STATUS_STABLE,
50 + 'default' => ExperimentsManager::STATE_INACTIVE,
51 + 'new_site' => [
52 + 'default_active' => true,
53 + 'minimum_installation_version' => '3.23.0',
54 + ],
55 + 'generator_tag' => true,
56 + ];
57 + }
58 +
37 59 public function get_unique_id() {
38 60 $unique_id = get_option( static::OPTION_UNIQUE_ID );
39 61
40 62 if ( ! $unique_id ) {
@@ -139,6 +161,19 @@
139 161 'desc' => esc_html__( 'Specify the duration for which data is stored in the cache. Elements caching speeds up loading by serving pre-rendered copies of elements, rather than rendering them fresh each time. This control ensures efficient performance and up-to-date content.', 'elementor' ),
140 162 ],
141 163 ]
142 164 );
165 + }
166 +
167 + private function clear_cache_on_site_changed() {
168 + add_action( 'activated_plugin', [ $this, 'clear_cache' ] );
169 + add_action( 'deactivated_plugin', [ $this, 'clear_cache' ] );
170 + add_action( 'switch_theme', [ $this, 'clear_cache' ] );
171 + add_action( 'upgrader_process_complete', [ $this, 'clear_cache' ] );
172 +
173 + add_action( 'update_option_elementor_element_cache_ttl', [ $this, 'clear_cache' ] );
174 + }
175 +
176 + public function clear_cache() {
177 + Plugin::$instance->files_manager->clear_cache();
143 178 }
144 179 }