?? null;
}
/**
* Update the progress of a step
*
* @param $step_id
* @param $step_progress
*
* @return void
*/
public function set_step_progress( $step_id, $step_progress ) : void {
$this->user_progress['steps'][ $step_id ] = $step_progress;
$this->update_user_progress_in_db();
}
public function update_user_progress( $new_data ) : void {
$allowed_properties = [
self::FIRST_CLOSED_CHECKLIST_IN_EDITOR => $new_data[ self::FIRST_CLOSED_CHECKLIST_IN_EDITOR ] ?? null,
self::LAST_OPENED_TIMESTAMP => $new_data[ self::LAST_OPENED_TIMESTAMP ] ?? null,
self::IS_POPUP_MINIMIZED_KEY => $new_data[ self::IS_POPUP_MINIMIZED_KEY ] ?? null,
];
foreach ( $allowed_properties as $key => $value ) {
if ( null !== $value ) {
$this->user_progress[ $key ] = $this->get_formatted_value( $key, $value );
}
}
$this->update_user_progress_in_db();
if ( isset( $new_data[ Elementor_Counter::EDITOR_COUNTER_KEY ] ) ) {
$this->elementor_adapter->set_count( Elementor_Counter::EDITOR_COUNTER_KEY, $new_data[ Elementor_Counter::EDITOR_COUNTER_KEY ] );
}
}
/**
* @return Steps_Manager
*/
public function get_steps_manager() : Steps_Manager {
return $this->steps_manager;
}
/**
* @return Wordpress_Adapter
*/
public function get_wordpress_adapter() : Wordpress_Adapter {
return $this->wordpress_adapter;
}
/**
* @return Elementor_Adapter
*/
public function get_elementor_adapter() : Elementor_Adapter {
return $this->elementor_adapter;
}
public function enqueue_editor_scripts() : void {
add_action( 'elementor/editor/before_enqueue_scripts', function () {
$min_suffix = Utils::is_script_debug() ? '' : '.min';
wp_enqueue_script(
$this->get_name(),
ELEMENTOR_ASSETS_URL . 'js/checklist' . $min_suffix . '.js',
[
'react',
'react-dom',
'elementor-common',
'elementor-v2-ui',
'elementor-v2-icons',
'elementor-v2-editor-app-bar',
'elementor-web-cli',
],
ELEMENTOR_VERSION,
true
);
wp_set_script_translations( $this->get_name(), 'elementor' );
} );
}
public function is_preference_switch_on() : bool {
if ( $this->should_switch_preferences_off() ) {
return false;
}
$user_preferences = $this->wordpress_adapter->get_user_preferences( self::VISIBILITY_SWITCH_ID );
return 'yes' === $user_preferences || $this->wordpress_adapter->is_new_installation();
}
public function should_switch_preferences_off() : bool {
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 );
}
private function register_experiment() : void {
Plugin::$instance->experiments->add_feature( [
'name' => self::EXPERIMENT_ID,
'title' => esc_html__( 'Launchpad Checklist', 'elementor' ),
'description' => esc_html__( 'Launchpad Checklist feature to boost productivity and deliver your site faster', 'elementor' ),
'release_status' => Manager::RELEASE_STATUS_ALPHA,
'hidden' => true,
'new_site' => [
'default_active' => true,
'minimum_installation_version' => '3.25.0',
],
] );
}
private function init_user_progress() : void {
$default_settings = $this->get_default_user_progress();
$this->wordpress_adapter->add_option( self::DB_OPTION_KEY, wp_json_encode( $default_settings ) );
}
private function get_default_user_progress() : array {
return [
self::LAST_OPENED_TIMESTAMP => null,
self::FIRST_CLOSED_CHECKLIST_IN_EDITOR => false,
self::IS_POPUP_MINIMIZED_KEY => false,
'steps' => [],
];
}
private function update_user_progress_in_db() : void {
$this->wordpress_adapter->update_option( self::DB_OPTION_KEY, wp_json_encode( $this->user_progress ) );
}
private function get_formatted_value( $key, $value ) {
if ( self::LAST_OPENED_TIMESTAMP === $key ) {
return $value ? time() : null;
}
return $value;
}
private function handle_checklist_visibility_with_kit() {
if ( ! $this->should_switch_preferences_off() ) {
return;
}
add_action( 'elementor/editor/init', function () {
$this->wordpress_adapter->set_user_preferences( self::VISIBILITY_SWITCH_ID, '' );
}, 11 );
}
public static function should_display_checklist_toggle_control() : bool {
return Plugin::$instance->experiments->is_feature_active( self::EXPERIMENT_ID ) &&
Plugin::$instance->experiments->is_feature_active( AppBarModule::EXPERIMENT_NAME ) &&
current_user_can( 'manage_options' );
}
}
Fatal error: Uncaught Error: Class 'Elementor\Modules\Checklist\Module' not found in /var/www/html/dportilho.com.br/web/wp-content/plugins/elementor/core/modules-manager.php:53
Stack trace:
#0 /var/www/html/dportilho.com.br/web/wp-content/plugins/elementor/includes/plugin.php(755): Elementor\Core\Modules_Manager->__construct()
#1 /var/www/html/dportilho.com.br/web/wp-content/plugins/elementor/includes/plugin.php(673): Elementor\Plugin->init_components()
#2 /var/www/html/dportilho.com.br/web/wp-includes/class-wp-hook.php(324): Elementor\Plugin->init('')
#3 /var/www/html/dportilho.com.br/web/wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters(NULL, Array)
#4 /var/www/html/dportilho.com.br/web/wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#5 /var/www/html/dportilho.com.br/web/wp-settings.php(704): do_action('init')
#6 /var/www/html/dportilho.com.br/web/wp-config.php(126): require_once('/var/www/html/d...')
#7 /var/www/html/dportilho.com.br/web/wp-load.php(50): require_once('/var/www/html/d...')
#8 /var/www/ht in /var/www/html/dportilho.com.br/web/wp-content/plugins/elementor/core/modules-manager.php on line 53