PluginProbe
Elementor Website Builder – more than just a page builder / 3.27.4
Elementor Website Builder – more than just a page builder v3.27.4
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/steps/step-base.php +25 -26 4.2.0-dev23.27.4 View file →
@@ -5,8 +5,9 @@
5 5 use Elementor\Core\Isolation\Wordpress_Adapter;
6 6 use Elementor\Core\Isolation\Wordpress_Adapter_Interface;
7 7 use Elementor\Core\Isolation\Elementor_Adapter;
8 8 use Elementor\Core\Isolation\Elementor_Adapter_Interface;
9 +use Elementor\Core\Utils\Isolation_Manager;
9 10 use Elementor\Modules\Checklist\Module as Checklist_Module;
10 11
11 12 if ( ! defined( 'ABSPATH' ) ) {
12 13 exit; // Exit if accessed directly.
@@ -32,61 +33,59 @@
32 33 * Returns a steps current completion status
33 34 *
34 35 * @return bool
35 36 */
36 - abstract protected function is_absolute_completed(): bool;
37 + abstract protected function is_absolute_completed() : bool;
37 38
38 39 /**
39 40 * @return string
40 41 */
41 - abstract public function get_id(): string;
42 + abstract public function get_id() : string;
42 43
43 44 /**
44 45 * @return string
45 46 */
46 - abstract public function get_title(): string;
47 + abstract public function get_title() : string;
47 48
48 49 /**
49 50 * @return string
50 51 */
51 - abstract public function get_description(): string;
52 + abstract public function get_description() : string;
52 53
53 54 /**
54 55 * For instance; 'Create 3 pages'
55 - *
56 56 * @return string
57 57 */
58 - abstract public function get_cta_text(): string;
58 + abstract public function get_cta_text() : string;
59 59
60 60 /**
61 61 * @return string
62 62 */
63 - abstract public function get_cta_url(): string;
63 + abstract public function get_cta_url() : string;
64 64
65 65 /**
66 66 * @return bool
67 67 */
68 - abstract public function get_is_completion_immutable(): bool;
68 + abstract public function get_is_completion_immutable() : bool;
69 69
70 70 /**
71 71 * @return string
72 72 */
73 - abstract public function get_image_src(): string;
73 + abstract public function get_image_src() : string;
74 74
75 75 /**
76 76 * Step_Base constructor.
77 77 *
78 - * @param Checklist_Module $module
78 + * @param Checklist_Module $module
79 79 * @param ?Wordpress_Adapter_Interface $wordpress_adapter
80 80 * @param ?Elementor_Adapter_Interface $elementor_adapter
81 - * @return void
81 + * @return void
82 82 */
83 83 public function __construct( Checklist_Module $module, ?Wordpress_Adapter_Interface $wordpress_adapter = null, ?Elementor_Adapter_Interface $elementor_adapter = null, $promotion_data = null ) {
84 84 $this->module = $module;
85 - $this->wordpress_adapter = $wordpress_adapter ?? new Wordpress_Adapter();
86 - $this->elementor_adapter = $elementor_adapter ?? new Elementor_Adapter();
85 + $this->wordpress_adapter = $wordpress_adapter ?? Isolation_Manager::get_adapter( Wordpress_Adapter::class );
86 + $this->elementor_adapter = $elementor_adapter ?? Isolation_Manager::get_adapter( Elementor_Adapter::class );
87 87 $this->promotion_data = $promotion_data;
88 -
89 88 $this->user_progress = $module->get_step_progress( $this->get_id() ) ?? $this->get_step_initial_progress();
90 89 }
91 90
92 91 /**
@@ -93,21 +92,21 @@
93 92 * Returns step visibility (by-default step is visible)
94 93 *
95 94 * @return bool
96 95 */
97 - public function is_visible(): bool {
96 + public function is_visible() : bool {
98 97 return true;
99 98 }
100 99
101 - public function get_learn_more_text(): string {
100 + public function get_learn_more_text() : string {
102 101 return esc_html__( 'Learn more', 'elementor' );
103 102 }
104 103
105 - public function get_learn_more_url(): string {
104 + public function get_learn_more_url() : string {
106 105 return 'https://go.elementor.com/getting-started-with-elementor/';
107 106 }
108 107
109 - public function update_step( array $step_data ): void {
108 + public function update_step( array $step_data ) : void {
110 109 $allowed_properties = [
111 110 self::MARKED_AS_COMPLETED_KEY => $step_data[ self::MARKED_AS_COMPLETED_KEY ] ?? null,
112 111 self::IMMUTABLE_COMPLETION_KEY => $step_data[ self::IMMUTABLE_COMPLETION_KEY ] ?? null,
113 112 self::ABSOLUTE_COMPLETION_KEY => $step_data[ self::ABSOLUTE_COMPLETION_KEY ] ?? null,
@@ -126,9 +125,9 @@
126 125 * Marking a step as completed based on user's desire
127 126 *
128 127 * @return void
129 128 */
130 - public function mark_as_completed(): void {
129 + public function mark_as_completed() : void {
131 130 $this->update_step( [ self::MARKED_AS_COMPLETED_KEY => true ] );
132 131 }
133 132
134 133 /**
@@ -135,9 +134,9 @@
135 134 * Unmarking a step as completed based on user's desire
136 135 *
137 136 * @return void
138 137 */
139 - public function unmark_as_completed(): void {
138 + public function unmark_as_completed() : void {
140 139 $this->update_step( [ self::MARKED_AS_COMPLETED_KEY => false ] );
141 140 }
142 141
143 142 /**
@@ -144,9 +143,9 @@
144 143 * Marking a step as completed if it was completed once, and it's suffice to marketing's requirements
145 144 *
146 145 * @return void
147 146 */
148 - public function maybe_immutably_mark_as_completed(): void {
147 + public function maybe_immutably_mark_as_completed() : void {
149 148 $is_immutable_completed = $this->user_progress[ self::IMMUTABLE_COMPLETION_KEY ] ?? false;
150 149
151 150 if ( ! $is_immutable_completed && $this->get_is_completion_immutable() && $this->is_absolute_completed() ) {
152 151 $this->update_step( [
@@ -160,9 +159,9 @@
160 159 * Returns the step marked as completed value
161 160 *
162 161 * @return bool
163 162 */
164 - public function is_marked_as_completed(): bool {
163 + public function is_marked_as_completed() : bool {
165 164 return $this->user_progress[ self::MARKED_AS_COMPLETED_KEY ];
166 165 }
167 166
168 167 /**
@@ -169,9 +168,9 @@
169 168 * Returns the step completed value
170 169 *
171 170 * @return bool
172 171 */
173 - public function is_immutable_completed(): bool {
172 + public function is_immutable_completed() : bool {
174 173 return $this->get_is_completion_immutable() && $this->user_progress[ self::IMMUTABLE_COMPLETION_KEY ] ?? false;
175 174 }
176 175
177 176 /**
@@ -178,9 +177,9 @@
178 177 * Sets and returns the initial progress of the step
179 178 *
180 179 * @return array
181 180 */
182 - public function get_step_initial_progress(): array {
181 + public function get_step_initial_progress() : array {
183 182 $initial_progress = [
184 183 self::MARKED_AS_COMPLETED_KEY => false,
185 184 self::IMMUTABLE_COMPLETION_KEY => false,
186 185 ];
@@ -192,9 +191,9 @@
192 191
193 192 /**
194 193 * @return ?array
195 194 */
196 - public function get_promotion_data(): ?array {
195 + public function get_promotion_data() : ?array {
197 196 return $this->promotion_data;
198 197 }
199 198
200 199 /**
@@ -201,8 +200,8 @@
201 200 * Sets the step progress
202 201 *
203 202 * @return void
204 203 */
205 - private function set_step_progress(): void {
204 + private function set_step_progress() : void {
206 205 $this->module->set_step_progress( $this->get_id(), $this->user_progress );
207 206 }
208 207 }