PluginProbe
Elementor Website Builder – more than just a page builder / 3.34.0-beta1
Elementor Website Builder – more than just a page builder v3.34.0-beta1
4.3.4 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 All 457 releases
← All changes | modules/atomic-widgets/opt-in/opt-in.php +11 -28 4.3.0-beta3 → 3.34.0-beta1 View file →
@@ -3,33 +3,37 @@
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;
8 11 use Elementor\Plugin;
9 12
10 13 class Opt_In {
11 14 const EXPERIMENT_NAME = 'e_opt_in_v4';
12 15
13 - const OPT_IN_CLICKED_OPTION = 'elementor_v4_opt_in_clicked';
14 -
15 - const OPT_IN_FEATURES = [
16 + const OPT_OUT_FEATURES = [
16 17 self::EXPERIMENT_NAME,
17 - 'container',
18 18 AtomicWidgetsModule::EXPERIMENT_NAME,
19 + GlobalClassesModule::NAME,
20 + VariablesModule::EXPERIMENT_NAME,
19 21 ];
20 22
21 - const OPT_OUT_FEATURES = [
23 + const OPT_IN_FEATURES = [
22 24 self::EXPERIMENT_NAME,
25 + 'container',
26 + NestedElementsModule::EXPERIMENT_NAME,
23 27 AtomicWidgetsModule::EXPERIMENT_NAME,
28 + GlobalClassesModule::NAME,
29 + VariablesModule::EXPERIMENT_NAME,
24 30 ];
25 31
26 -
27 32 public function init() {
28 33 $this->register_feature();
29 34
30 35 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 36 }
33 37
34 38 private function register_feature() {
35 39 Plugin::$instance->experiments->add_feature([
@@ -38,12 +42,8 @@
38 42 'description' => esc_html__( 'Enable Editor V4.', 'elementor' ),
39 43 'hidden' => true,
40 44 'default' => Experiments_Manager::STATE_INACTIVE,
41 45 'release_status' => Experiments_Manager::RELEASE_STATUS_ALPHA,
42 - 'new_site' => [
43 - 'default_active' => true,
44 - 'minimum_installation_version' => '4.0.0',
45 - ],
46 46 ]);
47 47 }
48 48
49 49 private function opt_out_v4() {
@@ -57,10 +57,8 @@
57 57 foreach ( self::OPT_IN_FEATURES as $feature ) {
58 58 $feature_key = Plugin::$instance->experiments->get_feature_option_key( $feature );
59 59 update_option( $feature_key, Experiments_Manager::STATE_ACTIVE );
60 60 }
61 -
62 - update_option( self::OPT_IN_CLICKED_OPTION, true );
63 61 }
64 62
65 63 public function ajax_opt_out_v4() {
66 64 if ( ! current_user_can( 'manage_options' ) ) {
@@ -80,21 +78,6 @@
80 78
81 79 private function add_ajax_actions( Ajax $ajax ) {
82 80 $ajax->register_ajax_action( 'editor_v4_opt_in', fn() => $this->ajax_opt_in_v4() );
83 81 $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 82 }
100 83 }