| @@ -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 as 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; |
| @@ -17,8 +18,9 @@ | ||
| 17 | 18 | exit; // Exit if accessed directly. |
| 18 | 19 | } |
| 19 | 20 | |
| 20 | 21 | class Module extends BaseModule implements Checklist_Module_Interface { |
| 22 | + const EXPERIMENT_NAME = 'launchpad-checklist'; | |
| 21 | 23 | const DB_OPTION_KEY = 'elementor_checklist'; |
| 22 | 24 | const VISIBILITY_SWITCH_ID = 'show_launchpad_checklist'; |
| 23 | 25 | const FIRST_CLOSED_CHECKLIST_IN_EDITOR = 'first_closed_checklist_in_editor'; |
| 24 | 26 | const LAST_OPENED_TIMESTAMP = 'last_opened_timestamp'; |
| @@ -44,8 +46,13 @@ | ||
| 44 | 46 | $this->wordpress_adapter = $wordpress_adapter ?? new Wordpress_Adapter(); |
| 45 | 47 | $this->elementor_adapter = $elementor_adapter ?? new Elementor_Adapter(); |
| 46 | 48 | |
| 47 | 49 | parent::__construct(); |
| 50 | + | |
| 51 | + if ( ! Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ) ) { | |
| 52 | + return; | |
| 53 | + } | |
| 54 | + | |
| 48 | 55 | $this->init_user_progress(); |
| 49 | 56 | |
| 50 | 57 | Plugin::$instance->data_manager_v2->register_controller( new Controller() ); |
| 51 | 58 | $this->user_progress = $this->user_progress ?? $this->get_user_progress_from_db(); |
| @@ -67,8 +74,19 @@ | ||
| 67 | 74 | public function get_name(): string { |
| 68 | 75 | return 'e-checklist'; |
| 69 | 76 | } |
| 70 | 77 | |
| 78 | + public static function get_experimental_data(): array { | |
| 79 | + return [ | |
| 80 | + 'name' => self::EXPERIMENT_NAME, | |
| 81 | + 'title' => esc_html__( 'Launchpad Checklist', 'elementor' ), | |
| 82 | + 'description' => esc_html__( 'Launchpad Checklist feature to boost productivity and deliver your site faster', 'elementor' ), | |
| 83 | + 'hidden' => true, | |
| 84 | + 'default' => Experiments_Manager::STATE_INACTIVE, | |
| 85 | + 'release_status' => Experiments_Manager::RELEASE_STATUS_STABLE, | |
| 86 | + ]; | |
| 87 | + } | |
| 88 | + | |
| 71 | 89 | /** |
| 72 | 90 | * Gets user's progress from db |
| 73 | 91 | * |
| 74 | 92 | * @return array { |
| @@ -238,7 +256,8 @@ | ||
| 238 | 256 | }, 11 ); |
| 239 | 257 | } |
| 240 | 258 | |
| 241 | 259 | public static function should_display_checklist_toggle_control(): bool { |
| 242 | - return current_user_can( 'manage_options' ); | |
| 260 | + return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_NAME ) | |
| 261 | + && current_user_can( 'manage_options' ); | |
| 243 | 262 | } |
| 244 | 263 | } |