芝麻web文件管理V1.00
编辑当前文件:/home/royashxg/www/wp-content/plugins/elementor/modules/checklist/steps/step-base.php
module = $module; $this->wordpress_adapter = $wordpress_adapter ?? new Wordpress_Adapter(); $this->kit_adapter = $kit_adapter ?? new Kit_Adapter(); $this->promotion_data = $promotion_data; $this->user_progress = $module->get_step_progress( $this->get_id() ) ?? $this->get_step_initial_progress(); } /** * Returns step visibility (by-default step is visible) * * @return bool */ public function is_visible() : bool { return true; } public function get_learn_more_text() : string { return esc_html__( 'Learn more', 'elementor' ); } public function get_learn_more_url() : string { return 'https://go.elementor.com/getting-started-with-elementor/'; } public function update_step( array $step_data ) : void { $allowed_properties = [ self::MARKED_AS_COMPLETED_KEY => $step_data[ self::MARKED_AS_COMPLETED_KEY ] ?? null, self::IMMUTABLE_COMPLETION_KEY => $step_data[ self::IMMUTABLE_COMPLETION_KEY ] ?? null, self::ABSOLUTE_COMPLETION_KEY => $step_data[ self::ABSOLUTE_COMPLETION_KEY ] ?? null, ]; foreach ( $allowed_properties as $key => $value ) { if ( null !== $value ) { $this->user_progress[ $key ] = $value; } } $this->set_step_progress(); } /** * Marking a step as completed based on user's desire * * @return void */ public function mark_as_completed() : void { $this->update_step( [ self::MARKED_AS_COMPLETED_KEY => true ] ); } /** * Unmarking a step as completed based on user's desire * * @return void */ public function unmark_as_completed() : void { $this->update_step( [ self::MARKED_AS_COMPLETED_KEY => false ] ); } /** * Marking a step as completed if it was completed once, and it's suffice to marketing's requirements * * @return void */ public function maybe_immutably_mark_as_completed() : void { $is_immutable_completed = $this->user_progress[ self::IMMUTABLE_COMPLETION_KEY ] ?? false; if ( ! $is_immutable_completed && $this->get_is_completion_immutable() && $this->is_absolute_completed() ) { $this->update_step( [ self::MARKED_AS_COMPLETED_KEY => false, self::IMMUTABLE_COMPLETION_KEY => true, ] ); } } /** * Returns the step marked as completed value * * @return bool */ public function is_marked_as_completed() : bool { return $this->user_progress[ self::MARKED_AS_COMPLETED_KEY ]; } /** * Returns the step completed value * * @return bool */ public function is_immutable_completed() : bool { return $this->get_is_completion_immutable() && $this->user_progress[ self::IMMUTABLE_COMPLETION_KEY ] ?? false; } /** * Sets and returns the initial progress of the step * * @return array */ public function get_step_initial_progress() : array { $initial_progress = [ self::MARKED_AS_COMPLETED_KEY => false, self::IMMUTABLE_COMPLETION_KEY => false, ]; $this->module->set_step_progress( $this->get_id(), $initial_progress ); return $initial_progress; } /** * @return ?array */ public function get_promotion_data() : ?array { return $this->promotion_data; } /** * Sets the step progress * * @return void */ private function set_step_progress() : void { $this->module->set_step_progress( $this->get_id(), $this->user_progress ); } }