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.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/variables/module.php +2 -55 4.0.93.30.1 View file →
@@ -4,27 +4,18 @@
4 4
5 5 use Elementor\Core\Base\Module as BaseModule;
6 6 use Elementor\Core\Experiments\Manager as ExperimentsManager;
7 7 use Elementor\Modules\AtomicWidgets\Module as AtomicWidgetsModule;
8 -use Elementor\Modules\Variables\Classes\Variable_Types_Registry;
9 -use Elementor\Modules\Variables\ImportExportCustomization\Import_Export_Customization;
10 -use Elementor\Modules\Variables\PropTypes\Color_Variable_Prop_Type;
11 -use Elementor\Modules\Variables\PropTypes\Font_Variable_Prop_Type;
12 -use Elementor\Modules\Variables\PropTypes\Size_Variable_Prop_Type;
13 8 use Elementor\Plugin;
14 -use Elementor\Utils;
15 9
16 10 if ( ! defined( 'ABSPATH' ) ) {
17 - exit;
11 + exit; // Exit if accessed directly.
18 12 }
19 13
20 14 class Module extends BaseModule {
21 15 const MODULE_NAME = 'e-variables';
22 16 const EXPERIMENT_NAME = 'e_variables';
23 - const EXPERIMENT_MANAGER_NAME = 'e_variables_manager';
24 17
25 - private Variable_Types_Registry $variable_types_registry;
26 -
27 18 public function get_name() {
28 19 return self::MODULE_NAME;
29 20 }
30 21
@@ -33,9 +24,9 @@
33 24 'name' => self::EXPERIMENT_NAME,
34 25 'title' => esc_html__( 'Variables', 'elementor' ),
35 26 'description' => esc_html__( 'Enable variables. (For this feature to work - Atomic Widgets must be active)', 'elementor' ),
36 27 'hidden' => true,
37 - 'default' => ExperimentsManager::STATE_ACTIVE,
28 + 'default' => ExperimentsManager::STATE_INACTIVE,
38 29 'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA,
39 30 ];
40 31 }
41 32
@@ -48,57 +39,13 @@
48 39
49 40 if ( ! $this->is_experiment_active() ) {
50 41 return;
51 42 }
52 - $this->register_features();
53 43
54 44 $this->hooks()->register();
55 -
56 - ( new Import_Export_Customization() )->register_hooks();
57 -
58 - add_action( 'init', [ $this, 'init_variable_types_registry' ] );
59 - add_action( 'elementor/editor/before_enqueue_scripts', fn () => $this->enqueue_editor_scripts() );
60 45 }
61 46
62 - private function register_features() {
63 - Plugin::$instance->experiments->add_feature([
64 - 'name' => self::EXPERIMENT_MANAGER_NAME,
65 - 'title' => esc_html__( 'Variables Manager', 'elementor' ),
66 - 'description' => esc_html__( 'Enable variables manager. (For this feature to work - Variables must be active)', 'elementor' ),
67 - 'hidden' => true,
68 - 'default' => ExperimentsManager::STATE_ACTIVE,
69 - 'release_status' => ExperimentsManager::RELEASE_STATUS_ALPHA,
70 - ]);
71 - }
72 -
73 47 private function is_experiment_active(): bool {
74 48 return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME )
75 49 && Plugin::$instance->experiments->is_feature_active( AtomicWidgetsModule::EXPERIMENT_NAME );
76 - }
77 -
78 - public function init_variable_types_registry(): void {
79 - $this->variable_types_registry = new Variable_Types_Registry();
80 -
81 - do_action( 'elementor/variables/register', $this->variable_types_registry );
82 - }
83 -
84 -
85 - public function get_variable_types_registry(): Variable_Types_Registry {
86 - return $this->variable_types_registry;
87 - }
88 -
89 - private function get_quota_config(): array {
90 - return [
91 - Color_Variable_Prop_Type::get_key() => 100000,
92 - Font_Variable_Prop_Type::get_key() => 100000,
93 - ];
94 - }
95 -
96 - public function enqueue_editor_scripts() {
97 -
98 - wp_add_inline_script(
99 - 'elementor-common',
100 - 'window.ElementorVariablesQuotaConfig = ' . wp_json_encode( $this->get_quota_config() ) . ';',
101 - 'before'
102 - );
103 50 }
104 51 }