PluginProbe
Elementor Website Builder – more than just a page builder / 3.29.1
Elementor Website Builder – more than just a page builder v3.29.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/checklist/module.php +36 -3 4.2.23.29.1 View file →
@@ -2,8 +2,9 @@
2 2
3 3 namespace Elementor\Modules\Checklist;
4 4
5 5 use Elementor\Core\Base\Module as BaseModule;
6 +use Elementor\Core\Experiments\Manager;
6 7 use Elementor\Modules\ElementorCounter\Module as Elementor_Counter;
7 8 use Elementor\Core\Isolation\Wordpress_Adapter;
8 9 use Elementor\Core\Isolation\Wordpress_Adapter_Interface;
9 10 use Elementor\Core\Isolation\Elementor_Adapter;
@@ -11,8 +12,10 @@
11 12 use Elementor\Core\Isolation\Elementor_Counter_Adapter_Interface;
12 13 use Elementor\Plugin;
13 14 use Elementor\Utils;
14 15 use Elementor\Modules\Checklist\Data\Controller;
16 +use Elementor\Core\Utils\Isolation_Manager;
17 +use Elementor\Modules\EditorAppBar\Module as AppBarModule;
15 18
16 19 if ( ! defined( 'ABSPATH' ) ) {
17 20 exit; // Exit if accessed directly.
18 21 }
@@ -17,8 +20,9 @@
17 20 exit; // Exit if accessed directly.
18 21 }
19 22
20 23 class Module extends BaseModule implements Checklist_Module_Interface {
24 + const EXPERIMENT_ID = 'launchpad-checklist';
21 25 const DB_OPTION_KEY = 'elementor_checklist';
22 26 const VISIBILITY_SWITCH_ID = 'show_launchpad_checklist';
23 27 const FIRST_CLOSED_CHECKLIST_IN_EDITOR = 'first_closed_checklist_in_editor';
24 28 const LAST_OPENED_TIMESTAMP = 'last_opened_timestamp';
@@ -40,14 +44,18 @@
40 44 public function __construct(
41 45 ?Wordpress_Adapter_Interface $wordpress_adapter = null,
42 46 ?Elementor_Adapter_Interface $elementor_adapter = null
43 47 ) {
44 - $this->wordpress_adapter = $wordpress_adapter ?? new Wordpress_Adapter();
45 - $this->elementor_adapter = $elementor_adapter ?? new Elementor_Adapter();
48 + $this->wordpress_adapter = $wordpress_adapter ?? Isolation_Manager::get_adapter( Wordpress_Adapter::class );
49 + $this->elementor_adapter = $elementor_adapter ?? Isolation_Manager::get_adapter( Elementor_Adapter::class );
46 50
47 51 parent::__construct();
48 52 $this->init_user_progress();
49 53
54 + if ( ! $this->is_experiment_active() ) {
55 + return;
56 + }
57 +
50 58 Plugin::$instance->data_manager_v2->register_controller( new Controller() );
51 59 $this->user_progress = $this->user_progress ?? $this->get_user_progress_from_db();
52 60 $this->handle_checklist_visibility_with_kit();
53 61 $this->steps_manager = new Steps_Manager( $this );
@@ -68,8 +76,17 @@
68 76 return 'e-checklist';
69 77 }
70 78
71 79 /**
80 + * Checks if the experiment is active
81 + *
82 + * @return bool
83 + */
84 + public function is_experiment_active(): bool {
85 + return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_ID );
86 + }
87 +
88 + /**
72 89 * Gets user's progress from db
73 90 *
74 91 * @return array {
75 92 * @type bool $is_hidden
@@ -200,8 +217,22 @@
200 217 public function should_switch_preferences_off(): bool {
201 218 return ! $this->elementor_adapter->is_active_kit_default() && ! $this->user_progress[ self::LAST_OPENED_TIMESTAMP ] && ! $this->elementor_adapter->get_count( Elementor_Counter::EDITOR_COUNTER_KEY );
202 219 }
203 220
221 + public static function get_experimental_data(): array {
222 + return [
223 + 'name' => self::EXPERIMENT_ID,
224 + 'title' => esc_html__( 'Launchpad Checklist', 'elementor' ),
225 + 'description' => esc_html__( 'Launchpad Checklist feature to boost productivity and deliver your site faster', 'elementor' ),
226 + 'release_status' => Manager::RELEASE_STATUS_STABLE,
227 + 'hidden' => true,
228 + 'new_site' => [
229 + 'default_active' => true,
230 + 'minimum_installation_version' => '3.25.0',
231 + ],
232 + ];
233 + }
234 +
204 235 private function init_user_progress(): void {
205 236 $default_settings = $this->get_default_user_progress();
206 237
207 238 $this->wordpress_adapter->add_option( self::DB_OPTION_KEY, wp_json_encode( $default_settings ) );
@@ -238,7 +269,9 @@
238 269 }, 11 );
239 270 }
240 271
241 272 public static function should_display_checklist_toggle_control(): bool {
242 - return current_user_can( 'manage_options' );
273 + return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_ID ) &&
274 + Plugin::$instance->experiments->is_feature_active( AppBarModule::EXPERIMENT_NAME ) &&
275 + current_user_can( 'manage_options' );
243 276 }
244 277 }