PluginProbe
Elementor Website Builder – more than just a page builder / 3.27.3
Elementor Website Builder – more than just a page builder v3.27.3
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 4.1.0-dev2 4.0.8 4.1.0-beta1 4.1.0-dev1 4.0.7 All 451 releases
← All changes | modules/element-cache/module.php +18 -16 4.2.33.27.3 View file →
@@ -13,10 +13,8 @@
13 13 }
14 14
15 15 class Module extends BaseModule {
16 16
17 - const OPTION_UNIQUE_ID = '_elementor_element_cache_unique_id';
18 -
19 17 public function get_name() {
20 18 return 'element-cache';
21 19 }
22 20
@@ -22,11 +20,14 @@
22 20
23 21 public function __construct() {
24 22 parent::__construct();
25 23
24 + $this->register_experiments();
26 25 $this->register_shortcode();
27 26
28 - add_filter( 'elementor/element_cache/unique_id', [ $this, 'get_unique_id' ] );
27 + if ( ! Plugin::$instance->experiments->is_feature_active( 'e_element_cache' ) ) {
28 + return;
29 + }
29 30
30 31 $this->add_advanced_tab_actions();
31 32
32 33 if ( is_admin() ) {
@@ -35,26 +36,27 @@
35 36
36 37 $this->clear_cache_on_site_changed();
37 38 }
38 39
39 - public function get_unique_id() {
40 - $unique_id = get_option( static::OPTION_UNIQUE_ID );
41 -
42 - if ( ! $unique_id ) {
43 - $unique_id = md5( uniqid( wp_generate_password() ) );
44 - update_option( static::OPTION_UNIQUE_ID, $unique_id );
45 - }
46 -
47 - return $unique_id;
40 + private function register_experiments() {
41 + Plugin::$instance->experiments->add_feature( [
42 + 'name' => 'e_element_cache',
43 + 'title' => esc_html__( 'Element Caching', 'elementor' ),
44 + 'tag' => esc_html__( 'Performance', 'elementor' ),
45 + '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' ),
46 + 'release_status' => ExperimentsManager::RELEASE_STATUS_BETA,
47 + 'default' => ExperimentsManager::STATE_INACTIVE,
48 + 'new_site' => [
49 + 'default_active' => true,
50 + 'minimum_installation_version' => '3.23.0',
51 + ],
52 + 'generator_tag' => true,
53 + ] );
48 54 }
49 55
50 56 private function register_shortcode() {
51 57 add_shortcode( 'elementor-element', function ( $atts ) {
52 58 if ( empty( $atts['data'] ) ) {
53 - return '';
54 - }
55 -
56 - if ( empty( $atts['k'] ) || $atts['k'] !== $this->get_unique_id() ) {
57 59 return '';
58 60 }
59 61
60 62 $widget_data = json_decode( base64_decode( $atts['data'] ), true );