PluginProbe
Elementor Website Builder – more than just a page builder / 3.35.0-dev4
Elementor Website Builder – more than just a page builder v3.35.0-dev4
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 4.1.0-dev2 4.0.8 All 454 releases
← All changes | modules/atomic-widgets/opt-in/opt-in.php +14 -28 4.3.03.35.0-dev4 View file →
@@ -3,33 +3,40 @@
3 3 namespace Elementor\Modules\AtomicWidgets\OptIn;
4 4
5 5 use Elementor\Core\Common\Modules\Ajax\Module as Ajax;
6 6 use Elementor\Core\Experiments\Manager as Experiments_Manager;
7 +use Elementor\Modules\GlobalClasses\Module as GlobalClassesModule;
8 +use Elementor\Modules\NestedElements\Module as NestedElementsModule;
7 9 use Elementor\Modules\AtomicWidgets\Module as AtomicWidgetsModule;
10 +use Elementor\Modules\Variables\Module as VariablesModule;
11 +use Elementor\Modules\Components\Module as ComponentsModule;
8 12 use Elementor\Plugin;
9 13
10 14 class Opt_In {
11 15 const EXPERIMENT_NAME = 'e_opt_in_v4';
12 16
13 - const OPT_IN_CLICKED_OPTION = 'elementor_v4_opt_in_clicked';
14 -
15 - const OPT_IN_FEATURES = [
17 + const OPT_OUT_FEATURES = [
16 18 self::EXPERIMENT_NAME,
17 - 'container',
18 19 AtomicWidgetsModule::EXPERIMENT_NAME,
20 + GlobalClassesModule::NAME,
21 + VariablesModule::EXPERIMENT_NAME,
22 + ComponentsModule::EXPERIMENT_NAME,
19 23 ];
20 24
21 - const OPT_OUT_FEATURES = [
25 + const OPT_IN_FEATURES = [
22 26 self::EXPERIMENT_NAME,
27 + 'container',
28 + NestedElementsModule::EXPERIMENT_NAME,
23 29 AtomicWidgetsModule::EXPERIMENT_NAME,
30 + GlobalClassesModule::NAME,
31 + VariablesModule::EXPERIMENT_NAME,
32 + ComponentsModule::EXPERIMENT_NAME,
24 33 ];
25 34
26 -
27 35 public function init() {
28 36 $this->register_feature();
29 37
30 38 add_action( 'elementor/ajax/register_actions', fn( Ajax $ajax ) => $this->add_ajax_actions( $ajax ) );
31 - add_action( 'rest_api_init', fn() => $this->register_routes() );
32 39 }
33 40
34 41 private function register_feature() {
35 42 Plugin::$instance->experiments->add_feature([
@@ -38,12 +45,8 @@
38 45 'description' => esc_html__( 'Enable Editor V4.', 'elementor' ),
39 46 'hidden' => true,
40 47 'default' => Experiments_Manager::STATE_INACTIVE,
41 48 'release_status' => Experiments_Manager::RELEASE_STATUS_ALPHA,
42 - 'new_site' => [
43 - 'default_active' => true,
44 - 'minimum_installation_version' => '4.0.0',
45 - ],
46 49 ]);
47 50 }
48 51
49 52 private function opt_out_v4() {
@@ -57,10 +60,8 @@
57 60 foreach ( self::OPT_IN_FEATURES as $feature ) {
58 61 $feature_key = Plugin::$instance->experiments->get_feature_option_key( $feature );
59 62 update_option( $feature_key, Experiments_Manager::STATE_ACTIVE );
60 63 }
61 -
62 - update_option( self::OPT_IN_CLICKED_OPTION, true );
63 64 }
64 65
65 66 public function ajax_opt_out_v4() {
66 67 if ( ! current_user_can( 'manage_options' ) ) {
@@ -80,21 +81,6 @@
80 81
81 82 private function add_ajax_actions( Ajax $ajax ) {
82 83 $ajax->register_ajax_action( 'editor_v4_opt_in', fn() => $this->ajax_opt_in_v4() );
83 84 $ajax->register_ajax_action( 'editor_v4_opt_out', fn() => $this->ajax_opt_out_v4() );
84 - }
85 -
86 - private function handle_rest_opt_in_v4() {
87 - $this->ajax_opt_in_v4();
88 - return new \WP_REST_Response( [
89 - 'success' => true,
90 - ], 200 );
91 - }
92 -
93 - private function register_routes() {
94 - register_rest_route( 'elementor/v1', '/operations/opt-in-v4', [
95 - 'methods' => 'POST',
96 - 'callback' => fn() => $this->handle_rest_opt_in_v4(),
97 - 'permission_callback' => fn() => current_user_can( 'manage_options' ),
98 - ] );
99 85 }
100 86 }