@@ -17,390 +17,390 @@ |
||
17 | 17 | */ |
18 | 18 | class GetPaid_Admin_Setup_Wizard { |
19 | 19 | |
20 | - /** |
|
21 | - * @var string Current Step |
|
22 | - */ |
|
23 | - protected $step = ''; |
|
24 | - |
|
25 | - /** |
|
26 | - * @var string|false Previous Step |
|
27 | - */ |
|
28 | - protected $previous_step = ''; |
|
29 | - |
|
30 | - /** |
|
31 | - * @var string|false Next Step |
|
32 | - */ |
|
33 | - protected $next_step = ''; |
|
34 | - |
|
35 | - /** |
|
36 | - * @var array All available steps for the setup wizard |
|
37 | - */ |
|
38 | - protected $steps = array(); |
|
39 | - |
|
40 | - /** |
|
41 | - * Class constructor. |
|
42 | - * |
|
43 | - * @since 2.4.0 |
|
44 | - */ |
|
45 | - public function __construct() { |
|
46 | - |
|
47 | - if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && wpinv_current_user_can_manage_invoicing() ) { |
|
48 | - add_action( 'admin_menu', array( $this, 'add_menu' ) ); |
|
49 | - add_action( 'current_screen', array( $this, 'setup_wizard' ) ); |
|
50 | - } |
|
51 | - |
|
52 | - } |
|
53 | - |
|
54 | - /** |
|
55 | - * Add admin menus/screens. |
|
56 | - * |
|
57 | - * @since 2.4.0 |
|
58 | - */ |
|
59 | - public function add_menu() { |
|
60 | - add_dashboard_page( '', '', wpinv_get_capability(), 'gp-setup', '' ); |
|
61 | - } |
|
62 | - |
|
63 | - /** |
|
64 | - * Sets up the setup wizard. |
|
65 | - * |
|
66 | - * @since 2.4.0 |
|
67 | - */ |
|
68 | - public function setup_wizard() { |
|
69 | - |
|
70 | - if ( isset( $_GET['page'] ) && 'gp-setup' === $_GET['page'] ) { |
|
71 | - $this->setup_globals(); |
|
72 | - $this->maybe_save_current_step(); |
|
73 | - $this->display_wizard(); |
|
74 | - exit; |
|
75 | - } |
|
76 | - |
|
77 | - } |
|
78 | - |
|
79 | - /** |
|
80 | - * Sets up class variables. |
|
81 | - * |
|
82 | - * @since 2.4.0 |
|
83 | - */ |
|
84 | - protected function setup_globals() { |
|
85 | - $this->steps = $this->get_setup_steps(); |
|
86 | - $this->step = $this->get_current_step(); |
|
87 | - $this->previous_step = $this->get_previous_step(); |
|
88 | - $this->next_step = $this->get_next_step(); |
|
89 | - } |
|
90 | - |
|
91 | - /** |
|
92 | - * Saves the current step. |
|
93 | - * |
|
94 | - * @since 2.4.0 |
|
95 | - */ |
|
96 | - protected function maybe_save_current_step() { |
|
97 | - if ( ! empty( $_POST['save_step'] ) && is_callable( $this->steps[ $this->step ]['handler'] ) ) { |
|
98 | - call_user_func( $this->steps[ $this->step ]['handler'], $this ); |
|
99 | - } |
|
100 | - } |
|
101 | - |
|
102 | - /** |
|
103 | - * Returns the setup steps. |
|
104 | - * |
|
105 | - * @since 2.4.0 |
|
106 | - * @return array |
|
107 | - */ |
|
108 | - protected function get_setup_steps() { |
|
109 | - |
|
110 | - $steps = array( |
|
111 | - |
|
112 | - 'introduction' => array( |
|
113 | - 'name' => __( 'Introduction', 'invoicing' ), |
|
114 | - 'view' => array( $this, 'setup_introduction' ), |
|
115 | - 'handler' => '', |
|
116 | - ), |
|
117 | - |
|
118 | - 'business_details' => array( |
|
119 | - 'name' => __( "Business Details", 'invoicing' ), |
|
120 | - 'view' => array( $this, 'setup_business' ), |
|
121 | - 'handler' => '', |
|
122 | - ), |
|
123 | - |
|
124 | - 'currency' => array( |
|
125 | - 'name' => __( 'Currency', 'invoicing' ), |
|
126 | - 'view' => array( $this, 'setup_currency' ), |
|
127 | - 'handler' => '', |
|
128 | - ), |
|
129 | - |
|
130 | - 'payments' => array( |
|
131 | - 'name' => __( 'Payment Gateways', 'invoicing' ), |
|
132 | - 'view' => array( $this, 'setup_payments' ), |
|
133 | - 'handler' => array( $this, 'setup_payments_save' ), |
|
134 | - ), |
|
135 | - |
|
136 | - 'recommend' => array( |
|
137 | - 'name' => __( 'Recommend', 'invoicing' ), |
|
138 | - 'view' => array( $this, 'setup_recommend' ), |
|
139 | - 'handler' => '', |
|
140 | - ), |
|
141 | - |
|
142 | - 'next_steps' => array( |
|
143 | - 'name' => __( 'Get Paid', 'invoicing' ), |
|
144 | - 'view' => array( $this, 'setup_ready' ), |
|
145 | - 'handler' => '', |
|
146 | - ), |
|
147 | - |
|
148 | - ); |
|
149 | - |
|
150 | - return apply_filters( 'getpaid_setup_wizard_steps', $steps ); |
|
151 | - |
|
152 | - } |
|
153 | - |
|
154 | - /** |
|
155 | - * Returns the current step. |
|
156 | - * |
|
157 | - * @since 2.4.0 |
|
158 | - * @return string |
|
159 | - */ |
|
160 | - protected function get_current_step() { |
|
161 | - $step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : ''; |
|
162 | - return ! empty( $step ) && in_array( $step, array_keys( $this->steps ) ) ? $step : current( array_keys( $this->steps ) ); |
|
163 | - } |
|
164 | - |
|
165 | - /** |
|
166 | - * Returns the previous step. |
|
167 | - * |
|
168 | - * @since 2.4.0 |
|
169 | - * @return string|false |
|
170 | - */ |
|
171 | - protected function get_previous_step() { |
|
172 | - |
|
173 | - $previous = false; |
|
174 | - $current = $this->step; |
|
175 | - foreach ( array_keys( $this->steps ) as $step ) { |
|
176 | - if ( $current === $step ) { |
|
177 | - return $previous; |
|
178 | - } |
|
179 | - |
|
180 | - $previous = $step; |
|
181 | - } |
|
182 | - |
|
183 | - return false; |
|
184 | - } |
|
185 | - |
|
186 | - /** |
|
187 | - * Returns the next step. |
|
188 | - * |
|
189 | - * @since 2.4.0 |
|
190 | - * @return string|false |
|
191 | - */ |
|
192 | - protected function get_next_step() { |
|
193 | - |
|
194 | - $on_current = false; |
|
195 | - $current = $this->step; |
|
196 | - foreach ( array_keys( $this->steps ) as $step ) { |
|
197 | - |
|
198 | - if ( $on_current ) { |
|
199 | - return $step; |
|
200 | - } |
|
201 | - |
|
202 | - if ( $current === $step ) { |
|
203 | - return $on_current = true; |
|
204 | - } |
|
205 | - |
|
206 | - } |
|
207 | - |
|
208 | - return false; |
|
209 | - } |
|
210 | - |
|
211 | - /** |
|
212 | - * Displays the setup wizard. |
|
213 | - * |
|
214 | - * @since 2.4.0 |
|
215 | - */ |
|
216 | - public function display_wizard() { |
|
217 | - $this->display_header(); |
|
218 | - $this->display_current_step(); |
|
219 | - $this->display_footer(); |
|
220 | - } |
|
221 | - |
|
222 | - /** |
|
223 | - * Displays the Wizard Header. |
|
224 | - * |
|
225 | - * @since 2.0.0 |
|
226 | - */ |
|
227 | - public function display_header() { |
|
228 | - $steps = $this->steps; |
|
229 | - $current = $this->step; |
|
230 | - $next_step = $this->next_step; |
|
231 | - array_shift( $steps ); |
|
232 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-header.php'; |
|
233 | - } |
|
234 | - |
|
235 | - /** |
|
236 | - * Displays the content for the current step. |
|
237 | - * |
|
238 | - * @since 2.4.0 |
|
239 | - */ |
|
240 | - public function display_current_step() { |
|
241 | - ?> |
|
20 | + /** |
|
21 | + * @var string Current Step |
|
22 | + */ |
|
23 | + protected $step = ''; |
|
24 | + |
|
25 | + /** |
|
26 | + * @var string|false Previous Step |
|
27 | + */ |
|
28 | + protected $previous_step = ''; |
|
29 | + |
|
30 | + /** |
|
31 | + * @var string|false Next Step |
|
32 | + */ |
|
33 | + protected $next_step = ''; |
|
34 | + |
|
35 | + /** |
|
36 | + * @var array All available steps for the setup wizard |
|
37 | + */ |
|
38 | + protected $steps = array(); |
|
39 | + |
|
40 | + /** |
|
41 | + * Class constructor. |
|
42 | + * |
|
43 | + * @since 2.4.0 |
|
44 | + */ |
|
45 | + public function __construct() { |
|
46 | + |
|
47 | + if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && wpinv_current_user_can_manage_invoicing() ) { |
|
48 | + add_action( 'admin_menu', array( $this, 'add_menu' ) ); |
|
49 | + add_action( 'current_screen', array( $this, 'setup_wizard' ) ); |
|
50 | + } |
|
51 | + |
|
52 | + } |
|
53 | + |
|
54 | + /** |
|
55 | + * Add admin menus/screens. |
|
56 | + * |
|
57 | + * @since 2.4.0 |
|
58 | + */ |
|
59 | + public function add_menu() { |
|
60 | + add_dashboard_page( '', '', wpinv_get_capability(), 'gp-setup', '' ); |
|
61 | + } |
|
62 | + |
|
63 | + /** |
|
64 | + * Sets up the setup wizard. |
|
65 | + * |
|
66 | + * @since 2.4.0 |
|
67 | + */ |
|
68 | + public function setup_wizard() { |
|
69 | + |
|
70 | + if ( isset( $_GET['page'] ) && 'gp-setup' === $_GET['page'] ) { |
|
71 | + $this->setup_globals(); |
|
72 | + $this->maybe_save_current_step(); |
|
73 | + $this->display_wizard(); |
|
74 | + exit; |
|
75 | + } |
|
76 | + |
|
77 | + } |
|
78 | + |
|
79 | + /** |
|
80 | + * Sets up class variables. |
|
81 | + * |
|
82 | + * @since 2.4.0 |
|
83 | + */ |
|
84 | + protected function setup_globals() { |
|
85 | + $this->steps = $this->get_setup_steps(); |
|
86 | + $this->step = $this->get_current_step(); |
|
87 | + $this->previous_step = $this->get_previous_step(); |
|
88 | + $this->next_step = $this->get_next_step(); |
|
89 | + } |
|
90 | + |
|
91 | + /** |
|
92 | + * Saves the current step. |
|
93 | + * |
|
94 | + * @since 2.4.0 |
|
95 | + */ |
|
96 | + protected function maybe_save_current_step() { |
|
97 | + if ( ! empty( $_POST['save_step'] ) && is_callable( $this->steps[ $this->step ]['handler'] ) ) { |
|
98 | + call_user_func( $this->steps[ $this->step ]['handler'], $this ); |
|
99 | + } |
|
100 | + } |
|
101 | + |
|
102 | + /** |
|
103 | + * Returns the setup steps. |
|
104 | + * |
|
105 | + * @since 2.4.0 |
|
106 | + * @return array |
|
107 | + */ |
|
108 | + protected function get_setup_steps() { |
|
109 | + |
|
110 | + $steps = array( |
|
111 | + |
|
112 | + 'introduction' => array( |
|
113 | + 'name' => __( 'Introduction', 'invoicing' ), |
|
114 | + 'view' => array( $this, 'setup_introduction' ), |
|
115 | + 'handler' => '', |
|
116 | + ), |
|
117 | + |
|
118 | + 'business_details' => array( |
|
119 | + 'name' => __( "Business Details", 'invoicing' ), |
|
120 | + 'view' => array( $this, 'setup_business' ), |
|
121 | + 'handler' => '', |
|
122 | + ), |
|
123 | + |
|
124 | + 'currency' => array( |
|
125 | + 'name' => __( 'Currency', 'invoicing' ), |
|
126 | + 'view' => array( $this, 'setup_currency' ), |
|
127 | + 'handler' => '', |
|
128 | + ), |
|
129 | + |
|
130 | + 'payments' => array( |
|
131 | + 'name' => __( 'Payment Gateways', 'invoicing' ), |
|
132 | + 'view' => array( $this, 'setup_payments' ), |
|
133 | + 'handler' => array( $this, 'setup_payments_save' ), |
|
134 | + ), |
|
135 | + |
|
136 | + 'recommend' => array( |
|
137 | + 'name' => __( 'Recommend', 'invoicing' ), |
|
138 | + 'view' => array( $this, 'setup_recommend' ), |
|
139 | + 'handler' => '', |
|
140 | + ), |
|
141 | + |
|
142 | + 'next_steps' => array( |
|
143 | + 'name' => __( 'Get Paid', 'invoicing' ), |
|
144 | + 'view' => array( $this, 'setup_ready' ), |
|
145 | + 'handler' => '', |
|
146 | + ), |
|
147 | + |
|
148 | + ); |
|
149 | + |
|
150 | + return apply_filters( 'getpaid_setup_wizard_steps', $steps ); |
|
151 | + |
|
152 | + } |
|
153 | + |
|
154 | + /** |
|
155 | + * Returns the current step. |
|
156 | + * |
|
157 | + * @since 2.4.0 |
|
158 | + * @return string |
|
159 | + */ |
|
160 | + protected function get_current_step() { |
|
161 | + $step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : ''; |
|
162 | + return ! empty( $step ) && in_array( $step, array_keys( $this->steps ) ) ? $step : current( array_keys( $this->steps ) ); |
|
163 | + } |
|
164 | + |
|
165 | + /** |
|
166 | + * Returns the previous step. |
|
167 | + * |
|
168 | + * @since 2.4.0 |
|
169 | + * @return string|false |
|
170 | + */ |
|
171 | + protected function get_previous_step() { |
|
172 | + |
|
173 | + $previous = false; |
|
174 | + $current = $this->step; |
|
175 | + foreach ( array_keys( $this->steps ) as $step ) { |
|
176 | + if ( $current === $step ) { |
|
177 | + return $previous; |
|
178 | + } |
|
179 | + |
|
180 | + $previous = $step; |
|
181 | + } |
|
182 | + |
|
183 | + return false; |
|
184 | + } |
|
185 | + |
|
186 | + /** |
|
187 | + * Returns the next step. |
|
188 | + * |
|
189 | + * @since 2.4.0 |
|
190 | + * @return string|false |
|
191 | + */ |
|
192 | + protected function get_next_step() { |
|
193 | + |
|
194 | + $on_current = false; |
|
195 | + $current = $this->step; |
|
196 | + foreach ( array_keys( $this->steps ) as $step ) { |
|
197 | + |
|
198 | + if ( $on_current ) { |
|
199 | + return $step; |
|
200 | + } |
|
201 | + |
|
202 | + if ( $current === $step ) { |
|
203 | + return $on_current = true; |
|
204 | + } |
|
205 | + |
|
206 | + } |
|
207 | + |
|
208 | + return false; |
|
209 | + } |
|
210 | + |
|
211 | + /** |
|
212 | + * Displays the setup wizard. |
|
213 | + * |
|
214 | + * @since 2.4.0 |
|
215 | + */ |
|
216 | + public function display_wizard() { |
|
217 | + $this->display_header(); |
|
218 | + $this->display_current_step(); |
|
219 | + $this->display_footer(); |
|
220 | + } |
|
221 | + |
|
222 | + /** |
|
223 | + * Displays the Wizard Header. |
|
224 | + * |
|
225 | + * @since 2.0.0 |
|
226 | + */ |
|
227 | + public function display_header() { |
|
228 | + $steps = $this->steps; |
|
229 | + $current = $this->step; |
|
230 | + $next_step = $this->next_step; |
|
231 | + array_shift( $steps ); |
|
232 | + include plugin_dir_path( __FILE__ ) . 'views/wizard-header.php'; |
|
233 | + } |
|
234 | + |
|
235 | + /** |
|
236 | + * Displays the content for the current step. |
|
237 | + * |
|
238 | + * @since 2.4.0 |
|
239 | + */ |
|
240 | + public function display_current_step() { |
|
241 | + ?> |
|
242 | 242 | <div class="gp-setup-content rowx mw-100 text-center mb-3"> |
243 | 243 | <div class="col-12 col-md-5 m-auto"> |
244 | 244 | <?php call_user_func( $this->steps[ $this->step ]['view'], $this ); ?> |
245 | 245 | </div> |
246 | 246 | </div> |
247 | 247 | <?php |
248 | - } |
|
249 | - |
|
250 | - /** |
|
251 | - * Setup Wizard Footer. |
|
252 | - * |
|
253 | - * @since 2.4.0 |
|
254 | - */ |
|
255 | - public function display_footer() { |
|
256 | - |
|
257 | - if ( isset( $_GET['step'] ) ) { |
|
258 | - $next_url = esc_url( $this->get_next_step_link() ); |
|
259 | - $label = $this->step == 'next_steps' ? __( 'Return to the WordPress Dashboard', 'invoicing' ) : __( 'Skip this step', 'invoicing' ); |
|
260 | - |
|
261 | - echo '<p class="gd-return-to-dashboard-wrap"> <a href="' . $next_url . '" class="gd-return-to-dashboard btn btn-link d-block text-muted">' . $label . '</a></p>'; |
|
262 | - } |
|
263 | - |
|
264 | - echo '</body></html>'; |
|
265 | - } |
|
266 | - |
|
267 | - /** |
|
268 | - * Introduction step. |
|
269 | - * |
|
270 | - * @since 2.0.0 |
|
271 | - */ |
|
272 | - public function setup_introduction() { |
|
273 | - $next_url = $this->get_next_step_link(); |
|
274 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-introduction.php'; |
|
275 | - } |
|
276 | - |
|
277 | - /** |
|
278 | - * Get the URL for the next step's screen. |
|
279 | - * |
|
280 | - * @param string step slug (default: current step) |
|
281 | - * |
|
282 | - * @return string URL for next step if a next step exists. |
|
283 | - * Admin URL if it's the last step. |
|
284 | - * Empty string on failure. |
|
285 | - * @since 3.0.0 |
|
286 | - */ |
|
287 | - public function get_next_step_link( $step = '' ) { |
|
288 | - if ( ! $step ) { |
|
289 | - $step = $this->step; |
|
290 | - } |
|
291 | - |
|
292 | - $keys = array_keys( $this->steps ); |
|
293 | - if ( end( $keys ) === $step ) { |
|
294 | - return admin_url(); |
|
295 | - } |
|
296 | - |
|
297 | - $step_index = array_search( $step, $keys ); |
|
298 | - if ( false === $step_index ) { |
|
299 | - return ''; |
|
300 | - } |
|
301 | - |
|
302 | - return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] )); |
|
303 | - } |
|
304 | - |
|
305 | - /** |
|
306 | - * Setup maps api. |
|
307 | - * |
|
308 | - * @since 2.0.0 |
|
309 | - */ |
|
310 | - public function setup_business() { |
|
311 | - $next_url = $this->get_next_step_link(); |
|
312 | - $wizard = $this; |
|
313 | - $page = 'wpinv_settings_general_main'; |
|
314 | - $section = 'wpinv_settings_general_main'; |
|
315 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php'; |
|
316 | - } |
|
317 | - |
|
318 | - /** |
|
319 | - * Default Location settings. |
|
320 | - * |
|
321 | - * @since 2.0.0 |
|
322 | - */ |
|
323 | - public function setup_currency() { |
|
324 | - $next_url = $this->get_next_step_link(); |
|
325 | - $wizard = $this; |
|
326 | - $page = 'wpinv_settings_general_currency_section'; |
|
327 | - $section = 'wpinv_settings_general_currency_section'; |
|
328 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php'; |
|
329 | - } |
|
330 | - |
|
331 | - /** |
|
332 | - * Installation of recommended plugins. |
|
333 | - * |
|
334 | - * @since 1.0.0 |
|
335 | - */ |
|
336 | - public function setup_recommend() { |
|
337 | - $next_url = $this->get_next_step_link(); |
|
338 | - $recommended_plugins = self::get_recommend_wp_plugins(); |
|
339 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-plugins.php'; |
|
340 | - } |
|
341 | - |
|
342 | - /** |
|
343 | - * A list of recommended wp.org plugins. |
|
344 | - * @return array |
|
345 | - */ |
|
346 | - public static function get_recommend_wp_plugins(){ |
|
347 | - return array( |
|
348 | - 'ayecode-connect' => array( |
|
349 | - 'file' => 'ayecode-connect/ayecode-connect.php', |
|
350 | - 'url' => 'https://wordpress.org/plugins/ayecode-connect/', |
|
351 | - 'slug' => 'ayecode-connect', |
|
352 | - 'name' => 'AyeCode Connect', |
|
353 | - 'desc' => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ), |
|
354 | - ), |
|
355 | - 'invoicing-quotes' => array( |
|
356 | - 'file' => 'invoicing-quotes/wpinv-quote.php', |
|
357 | - 'url' => 'https://wordpress.org/plugins/invoicing-quotes/', |
|
358 | - 'slug' => 'invoicing-quotes', |
|
359 | - 'name' => 'Customer Quotes', |
|
360 | - 'desc' => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'), |
|
361 | - ), |
|
362 | - 'userswp' => array( |
|
363 | - 'file' => 'userswp/userswp.php', |
|
364 | - 'url' => 'https://wordpress.org/plugins/userswp/', |
|
365 | - 'slug' => 'userswp', |
|
366 | - 'name' => 'UsersWP', |
|
367 | - 'desc' => __('Frontend user login and registration as well as slick profile pages.','geodirectory'), |
|
368 | - ), |
|
369 | - ); |
|
370 | - } |
|
371 | - |
|
372 | - /** |
|
373 | - * Dummy Data setup. |
|
374 | - * |
|
375 | - * @since 2.4.0 |
|
376 | - */ |
|
377 | - public function setup_payments() { |
|
378 | - $next_url = $this->get_next_step_link(); |
|
379 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-gateways.php'; |
|
380 | - } |
|
381 | - |
|
382 | - /** |
|
383 | - * Dummy data save. |
|
384 | - * |
|
385 | - * This is done via ajax so we just pass onto the next step. |
|
386 | - * |
|
387 | - * @since 2.0.0 |
|
388 | - */ |
|
389 | - public function setup_payments_save() { |
|
390 | - check_admin_referer( 'getpaid-setup-wizard', 'getpaid-setup-wizard' ); |
|
391 | - wpinv_update_option( 'manual_active', ! empty( $_POST['enable-manual-gateway'] ) ); |
|
392 | - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
393 | - exit; |
|
394 | - } |
|
395 | - |
|
396 | - /** |
|
397 | - * Final step. |
|
398 | - * |
|
399 | - * @since 2.0.0 |
|
400 | - */ |
|
401 | - public function setup_ready() { |
|
402 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-thank-you.php'; |
|
403 | - } |
|
248 | + } |
|
249 | + |
|
250 | + /** |
|
251 | + * Setup Wizard Footer. |
|
252 | + * |
|
253 | + * @since 2.4.0 |
|
254 | + */ |
|
255 | + public function display_footer() { |
|
256 | + |
|
257 | + if ( isset( $_GET['step'] ) ) { |
|
258 | + $next_url = esc_url( $this->get_next_step_link() ); |
|
259 | + $label = $this->step == 'next_steps' ? __( 'Return to the WordPress Dashboard', 'invoicing' ) : __( 'Skip this step', 'invoicing' ); |
|
260 | + |
|
261 | + echo '<p class="gd-return-to-dashboard-wrap"> <a href="' . $next_url . '" class="gd-return-to-dashboard btn btn-link d-block text-muted">' . $label . '</a></p>'; |
|
262 | + } |
|
263 | + |
|
264 | + echo '</body></html>'; |
|
265 | + } |
|
266 | + |
|
267 | + /** |
|
268 | + * Introduction step. |
|
269 | + * |
|
270 | + * @since 2.0.0 |
|
271 | + */ |
|
272 | + public function setup_introduction() { |
|
273 | + $next_url = $this->get_next_step_link(); |
|
274 | + include plugin_dir_path( __FILE__ ) . 'views/wizard-introduction.php'; |
|
275 | + } |
|
276 | + |
|
277 | + /** |
|
278 | + * Get the URL for the next step's screen. |
|
279 | + * |
|
280 | + * @param string step slug (default: current step) |
|
281 | + * |
|
282 | + * @return string URL for next step if a next step exists. |
|
283 | + * Admin URL if it's the last step. |
|
284 | + * Empty string on failure. |
|
285 | + * @since 3.0.0 |
|
286 | + */ |
|
287 | + public function get_next_step_link( $step = '' ) { |
|
288 | + if ( ! $step ) { |
|
289 | + $step = $this->step; |
|
290 | + } |
|
291 | + |
|
292 | + $keys = array_keys( $this->steps ); |
|
293 | + if ( end( $keys ) === $step ) { |
|
294 | + return admin_url(); |
|
295 | + } |
|
296 | + |
|
297 | + $step_index = array_search( $step, $keys ); |
|
298 | + if ( false === $step_index ) { |
|
299 | + return ''; |
|
300 | + } |
|
301 | + |
|
302 | + return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] )); |
|
303 | + } |
|
304 | + |
|
305 | + /** |
|
306 | + * Setup maps api. |
|
307 | + * |
|
308 | + * @since 2.0.0 |
|
309 | + */ |
|
310 | + public function setup_business() { |
|
311 | + $next_url = $this->get_next_step_link(); |
|
312 | + $wizard = $this; |
|
313 | + $page = 'wpinv_settings_general_main'; |
|
314 | + $section = 'wpinv_settings_general_main'; |
|
315 | + include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php'; |
|
316 | + } |
|
317 | + |
|
318 | + /** |
|
319 | + * Default Location settings. |
|
320 | + * |
|
321 | + * @since 2.0.0 |
|
322 | + */ |
|
323 | + public function setup_currency() { |
|
324 | + $next_url = $this->get_next_step_link(); |
|
325 | + $wizard = $this; |
|
326 | + $page = 'wpinv_settings_general_currency_section'; |
|
327 | + $section = 'wpinv_settings_general_currency_section'; |
|
328 | + include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php'; |
|
329 | + } |
|
330 | + |
|
331 | + /** |
|
332 | + * Installation of recommended plugins. |
|
333 | + * |
|
334 | + * @since 1.0.0 |
|
335 | + */ |
|
336 | + public function setup_recommend() { |
|
337 | + $next_url = $this->get_next_step_link(); |
|
338 | + $recommended_plugins = self::get_recommend_wp_plugins(); |
|
339 | + include plugin_dir_path( __FILE__ ) . 'views/wizard-plugins.php'; |
|
340 | + } |
|
341 | + |
|
342 | + /** |
|
343 | + * A list of recommended wp.org plugins. |
|
344 | + * @return array |
|
345 | + */ |
|
346 | + public static function get_recommend_wp_plugins(){ |
|
347 | + return array( |
|
348 | + 'ayecode-connect' => array( |
|
349 | + 'file' => 'ayecode-connect/ayecode-connect.php', |
|
350 | + 'url' => 'https://wordpress.org/plugins/ayecode-connect/', |
|
351 | + 'slug' => 'ayecode-connect', |
|
352 | + 'name' => 'AyeCode Connect', |
|
353 | + 'desc' => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ), |
|
354 | + ), |
|
355 | + 'invoicing-quotes' => array( |
|
356 | + 'file' => 'invoicing-quotes/wpinv-quote.php', |
|
357 | + 'url' => 'https://wordpress.org/plugins/invoicing-quotes/', |
|
358 | + 'slug' => 'invoicing-quotes', |
|
359 | + 'name' => 'Customer Quotes', |
|
360 | + 'desc' => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'), |
|
361 | + ), |
|
362 | + 'userswp' => array( |
|
363 | + 'file' => 'userswp/userswp.php', |
|
364 | + 'url' => 'https://wordpress.org/plugins/userswp/', |
|
365 | + 'slug' => 'userswp', |
|
366 | + 'name' => 'UsersWP', |
|
367 | + 'desc' => __('Frontend user login and registration as well as slick profile pages.','geodirectory'), |
|
368 | + ), |
|
369 | + ); |
|
370 | + } |
|
371 | + |
|
372 | + /** |
|
373 | + * Dummy Data setup. |
|
374 | + * |
|
375 | + * @since 2.4.0 |
|
376 | + */ |
|
377 | + public function setup_payments() { |
|
378 | + $next_url = $this->get_next_step_link(); |
|
379 | + include plugin_dir_path( __FILE__ ) . 'views/wizard-gateways.php'; |
|
380 | + } |
|
381 | + |
|
382 | + /** |
|
383 | + * Dummy data save. |
|
384 | + * |
|
385 | + * This is done via ajax so we just pass onto the next step. |
|
386 | + * |
|
387 | + * @since 2.0.0 |
|
388 | + */ |
|
389 | + public function setup_payments_save() { |
|
390 | + check_admin_referer( 'getpaid-setup-wizard', 'getpaid-setup-wizard' ); |
|
391 | + wpinv_update_option( 'manual_active', ! empty( $_POST['enable-manual-gateway'] ) ); |
|
392 | + wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
393 | + exit; |
|
394 | + } |
|
395 | + |
|
396 | + /** |
|
397 | + * Final step. |
|
398 | + * |
|
399 | + * @since 2.0.0 |
|
400 | + */ |
|
401 | + public function setup_ready() { |
|
402 | + include plugin_dir_path( __FILE__ ) . 'views/wizard-thank-you.php'; |
|
403 | + } |
|
404 | 404 | |
405 | 405 | } |
406 | 406 |
@@ -10,7 +10,7 @@ discard block |
||
10 | 10 | * @version 2.4.0 |
11 | 11 | * @info GetPaid Setup Wizard. |
12 | 12 | */ |
13 | -defined( 'ABSPATH' ) || exit; |
|
13 | +defined('ABSPATH') || exit; |
|
14 | 14 | |
15 | 15 | /** |
16 | 16 | * GetPaid_Admin_Setup_Wizard class. |
@@ -44,9 +44,9 @@ discard block |
||
44 | 44 | */ |
45 | 45 | public function __construct() { |
46 | 46 | |
47 | - if ( apply_filters( 'getpaid_enable_setup_wizard', true ) && wpinv_current_user_can_manage_invoicing() ) { |
|
48 | - add_action( 'admin_menu', array( $this, 'add_menu' ) ); |
|
49 | - add_action( 'current_screen', array( $this, 'setup_wizard' ) ); |
|
47 | + if (apply_filters('getpaid_enable_setup_wizard', true) && wpinv_current_user_can_manage_invoicing()) { |
|
48 | + add_action('admin_menu', array($this, 'add_menu')); |
|
49 | + add_action('current_screen', array($this, 'setup_wizard')); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | } |
@@ -57,7 +57,7 @@ discard block |
||
57 | 57 | * @since 2.4.0 |
58 | 58 | */ |
59 | 59 | public function add_menu() { |
60 | - add_dashboard_page( '', '', wpinv_get_capability(), 'gp-setup', '' ); |
|
60 | + add_dashboard_page('', '', wpinv_get_capability(), 'gp-setup', ''); |
|
61 | 61 | } |
62 | 62 | |
63 | 63 | /** |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | */ |
68 | 68 | public function setup_wizard() { |
69 | 69 | |
70 | - if ( isset( $_GET['page'] ) && 'gp-setup' === $_GET['page'] ) { |
|
70 | + if (isset($_GET['page']) && 'gp-setup' === $_GET['page']) { |
|
71 | 71 | $this->setup_globals(); |
72 | 72 | $this->maybe_save_current_step(); |
73 | 73 | $this->display_wizard(); |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @since 2.4.0 |
95 | 95 | */ |
96 | 96 | protected function maybe_save_current_step() { |
97 | - if ( ! empty( $_POST['save_step'] ) && is_callable( $this->steps[ $this->step ]['handler'] ) ) { |
|
98 | - call_user_func( $this->steps[ $this->step ]['handler'], $this ); |
|
97 | + if (!empty($_POST['save_step']) && is_callable($this->steps[$this->step]['handler'])) { |
|
98 | + call_user_func($this->steps[$this->step]['handler'], $this); |
|
99 | 99 | } |
100 | 100 | } |
101 | 101 | |
@@ -110,44 +110,44 @@ discard block |
||
110 | 110 | $steps = array( |
111 | 111 | |
112 | 112 | 'introduction' => array( |
113 | - 'name' => __( 'Introduction', 'invoicing' ), |
|
114 | - 'view' => array( $this, 'setup_introduction' ), |
|
113 | + 'name' => __('Introduction', 'invoicing'), |
|
114 | + 'view' => array($this, 'setup_introduction'), |
|
115 | 115 | 'handler' => '', |
116 | 116 | ), |
117 | 117 | |
118 | 118 | 'business_details' => array( |
119 | - 'name' => __( "Business Details", 'invoicing' ), |
|
120 | - 'view' => array( $this, 'setup_business' ), |
|
119 | + 'name' => __("Business Details", 'invoicing'), |
|
120 | + 'view' => array($this, 'setup_business'), |
|
121 | 121 | 'handler' => '', |
122 | 122 | ), |
123 | 123 | |
124 | 124 | 'currency' => array( |
125 | - 'name' => __( 'Currency', 'invoicing' ), |
|
126 | - 'view' => array( $this, 'setup_currency' ), |
|
125 | + 'name' => __('Currency', 'invoicing'), |
|
126 | + 'view' => array($this, 'setup_currency'), |
|
127 | 127 | 'handler' => '', |
128 | 128 | ), |
129 | 129 | |
130 | 130 | 'payments' => array( |
131 | - 'name' => __( 'Payment Gateways', 'invoicing' ), |
|
132 | - 'view' => array( $this, 'setup_payments' ), |
|
133 | - 'handler' => array( $this, 'setup_payments_save' ), |
|
131 | + 'name' => __('Payment Gateways', 'invoicing'), |
|
132 | + 'view' => array($this, 'setup_payments'), |
|
133 | + 'handler' => array($this, 'setup_payments_save'), |
|
134 | 134 | ), |
135 | 135 | |
136 | 136 | 'recommend' => array( |
137 | - 'name' => __( 'Recommend', 'invoicing' ), |
|
138 | - 'view' => array( $this, 'setup_recommend' ), |
|
137 | + 'name' => __('Recommend', 'invoicing'), |
|
138 | + 'view' => array($this, 'setup_recommend'), |
|
139 | 139 | 'handler' => '', |
140 | 140 | ), |
141 | 141 | |
142 | 142 | 'next_steps' => array( |
143 | - 'name' => __( 'Get Paid', 'invoicing' ), |
|
144 | - 'view' => array( $this, 'setup_ready' ), |
|
143 | + 'name' => __('Get Paid', 'invoicing'), |
|
144 | + 'view' => array($this, 'setup_ready'), |
|
145 | 145 | 'handler' => '', |
146 | 146 | ), |
147 | 147 | |
148 | 148 | ); |
149 | 149 | |
150 | - return apply_filters( 'getpaid_setup_wizard_steps', $steps ); |
|
150 | + return apply_filters('getpaid_setup_wizard_steps', $steps); |
|
151 | 151 | |
152 | 152 | } |
153 | 153 | |
@@ -158,8 +158,8 @@ discard block |
||
158 | 158 | * @return string |
159 | 159 | */ |
160 | 160 | protected function get_current_step() { |
161 | - $step = isset( $_GET['step'] ) ? sanitize_key( $_GET['step'] ) : ''; |
|
162 | - return ! empty( $step ) && in_array( $step, array_keys( $this->steps ) ) ? $step : current( array_keys( $this->steps ) ); |
|
161 | + $step = isset($_GET['step']) ? sanitize_key($_GET['step']) : ''; |
|
162 | + return !empty($step) && in_array($step, array_keys($this->steps)) ? $step : current(array_keys($this->steps)); |
|
163 | 163 | } |
164 | 164 | |
165 | 165 | /** |
@@ -172,8 +172,8 @@ discard block |
||
172 | 172 | |
173 | 173 | $previous = false; |
174 | 174 | $current = $this->step; |
175 | - foreach ( array_keys( $this->steps ) as $step ) { |
|
176 | - if ( $current === $step ) { |
|
175 | + foreach (array_keys($this->steps) as $step) { |
|
176 | + if ($current === $step) { |
|
177 | 177 | return $previous; |
178 | 178 | } |
179 | 179 | |
@@ -193,13 +193,13 @@ discard block |
||
193 | 193 | |
194 | 194 | $on_current = false; |
195 | 195 | $current = $this->step; |
196 | - foreach ( array_keys( $this->steps ) as $step ) { |
|
196 | + foreach (array_keys($this->steps) as $step) { |
|
197 | 197 | |
198 | - if ( $on_current ) { |
|
198 | + if ($on_current) { |
|
199 | 199 | return $step; |
200 | 200 | } |
201 | 201 | |
202 | - if ( $current === $step ) { |
|
202 | + if ($current === $step) { |
|
203 | 203 | return $on_current = true; |
204 | 204 | } |
205 | 205 | |
@@ -228,8 +228,8 @@ discard block |
||
228 | 228 | $steps = $this->steps; |
229 | 229 | $current = $this->step; |
230 | 230 | $next_step = $this->next_step; |
231 | - array_shift( $steps ); |
|
232 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-header.php'; |
|
231 | + array_shift($steps); |
|
232 | + include plugin_dir_path(__FILE__) . 'views/wizard-header.php'; |
|
233 | 233 | } |
234 | 234 | |
235 | 235 | /** |
@@ -241,7 +241,7 @@ discard block |
||
241 | 241 | ?> |
242 | 242 | <div class="gp-setup-content rowx mw-100 text-center mb-3"> |
243 | 243 | <div class="col-12 col-md-5 m-auto"> |
244 | - <?php call_user_func( $this->steps[ $this->step ]['view'], $this ); ?> |
|
244 | + <?php call_user_func($this->steps[$this->step]['view'], $this); ?> |
|
245 | 245 | </div> |
246 | 246 | </div> |
247 | 247 | <?php |
@@ -254,9 +254,9 @@ discard block |
||
254 | 254 | */ |
255 | 255 | public function display_footer() { |
256 | 256 | |
257 | - if ( isset( $_GET['step'] ) ) { |
|
258 | - $next_url = esc_url( $this->get_next_step_link() ); |
|
259 | - $label = $this->step == 'next_steps' ? __( 'Return to the WordPress Dashboard', 'invoicing' ) : __( 'Skip this step', 'invoicing' ); |
|
257 | + if (isset($_GET['step'])) { |
|
258 | + $next_url = esc_url($this->get_next_step_link()); |
|
259 | + $label = $this->step == 'next_steps' ? __('Return to the WordPress Dashboard', 'invoicing') : __('Skip this step', 'invoicing'); |
|
260 | 260 | |
261 | 261 | echo '<p class="gd-return-to-dashboard-wrap"> <a href="' . $next_url . '" class="gd-return-to-dashboard btn btn-link d-block text-muted">' . $label . '</a></p>'; |
262 | 262 | } |
@@ -271,7 +271,7 @@ discard block |
||
271 | 271 | */ |
272 | 272 | public function setup_introduction() { |
273 | 273 | $next_url = $this->get_next_step_link(); |
274 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-introduction.php'; |
|
274 | + include plugin_dir_path(__FILE__) . 'views/wizard-introduction.php'; |
|
275 | 275 | } |
276 | 276 | |
277 | 277 | /** |
@@ -284,22 +284,22 @@ discard block |
||
284 | 284 | * Empty string on failure. |
285 | 285 | * @since 3.0.0 |
286 | 286 | */ |
287 | - public function get_next_step_link( $step = '' ) { |
|
288 | - if ( ! $step ) { |
|
287 | + public function get_next_step_link($step = '') { |
|
288 | + if (!$step) { |
|
289 | 289 | $step = $this->step; |
290 | 290 | } |
291 | 291 | |
292 | - $keys = array_keys( $this->steps ); |
|
293 | - if ( end( $keys ) === $step ) { |
|
292 | + $keys = array_keys($this->steps); |
|
293 | + if (end($keys) === $step) { |
|
294 | 294 | return admin_url(); |
295 | 295 | } |
296 | 296 | |
297 | - $step_index = array_search( $step, $keys ); |
|
298 | - if ( false === $step_index ) { |
|
297 | + $step_index = array_search($step, $keys); |
|
298 | + if (false === $step_index) { |
|
299 | 299 | return ''; |
300 | 300 | } |
301 | 301 | |
302 | - return remove_query_arg('settings-updated', add_query_arg( 'step', $keys[ $step_index + 1 ] )); |
|
302 | + return remove_query_arg('settings-updated', add_query_arg('step', $keys[$step_index + 1])); |
|
303 | 303 | } |
304 | 304 | |
305 | 305 | /** |
@@ -312,7 +312,7 @@ discard block |
||
312 | 312 | $wizard = $this; |
313 | 313 | $page = 'wpinv_settings_general_main'; |
314 | 314 | $section = 'wpinv_settings_general_main'; |
315 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php'; |
|
315 | + include plugin_dir_path(__FILE__) . 'views/wizard-settings.php'; |
|
316 | 316 | } |
317 | 317 | |
318 | 318 | /** |
@@ -325,7 +325,7 @@ discard block |
||
325 | 325 | $wizard = $this; |
326 | 326 | $page = 'wpinv_settings_general_currency_section'; |
327 | 327 | $section = 'wpinv_settings_general_currency_section'; |
328 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-settings.php'; |
|
328 | + include plugin_dir_path(__FILE__) . 'views/wizard-settings.php'; |
|
329 | 329 | } |
330 | 330 | |
331 | 331 | /** |
@@ -336,35 +336,35 @@ discard block |
||
336 | 336 | public function setup_recommend() { |
337 | 337 | $next_url = $this->get_next_step_link(); |
338 | 338 | $recommended_plugins = self::get_recommend_wp_plugins(); |
339 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-plugins.php'; |
|
339 | + include plugin_dir_path(__FILE__) . 'views/wizard-plugins.php'; |
|
340 | 340 | } |
341 | 341 | |
342 | 342 | /** |
343 | 343 | * A list of recommended wp.org plugins. |
344 | 344 | * @return array |
345 | 345 | */ |
346 | - public static function get_recommend_wp_plugins(){ |
|
346 | + public static function get_recommend_wp_plugins() { |
|
347 | 347 | return array( |
348 | 348 | 'ayecode-connect' => array( |
349 | 349 | 'file' => 'ayecode-connect/ayecode-connect.php', |
350 | 350 | 'url' => 'https://wordpress.org/plugins/ayecode-connect/', |
351 | 351 | 'slug' => 'ayecode-connect', |
352 | 352 | 'name' => 'AyeCode Connect', |
353 | - 'desc' => __( 'Documentation and Support from within your WordPress admin.', 'geodirectory' ), |
|
353 | + 'desc' => __('Documentation and Support from within your WordPress admin.', 'geodirectory'), |
|
354 | 354 | ), |
355 | 355 | 'invoicing-quotes' => array( |
356 | 356 | 'file' => 'invoicing-quotes/wpinv-quote.php', |
357 | 357 | 'url' => 'https://wordpress.org/plugins/invoicing-quotes/', |
358 | 358 | 'slug' => 'invoicing-quotes', |
359 | 359 | 'name' => 'Customer Quotes', |
360 | - 'desc' => __('Create & Send Quotes to Customers and have them accept and pay.','geodirectory'), |
|
360 | + 'desc' => __('Create & Send Quotes to Customers and have them accept and pay.', 'geodirectory'), |
|
361 | 361 | ), |
362 | 362 | 'userswp' => array( |
363 | 363 | 'file' => 'userswp/userswp.php', |
364 | 364 | 'url' => 'https://wordpress.org/plugins/userswp/', |
365 | 365 | 'slug' => 'userswp', |
366 | 366 | 'name' => 'UsersWP', |
367 | - 'desc' => __('Frontend user login and registration as well as slick profile pages.','geodirectory'), |
|
367 | + 'desc' => __('Frontend user login and registration as well as slick profile pages.', 'geodirectory'), |
|
368 | 368 | ), |
369 | 369 | ); |
370 | 370 | } |
@@ -376,7 +376,7 @@ discard block |
||
376 | 376 | */ |
377 | 377 | public function setup_payments() { |
378 | 378 | $next_url = $this->get_next_step_link(); |
379 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-gateways.php'; |
|
379 | + include plugin_dir_path(__FILE__) . 'views/wizard-gateways.php'; |
|
380 | 380 | } |
381 | 381 | |
382 | 382 | /** |
@@ -387,9 +387,9 @@ discard block |
||
387 | 387 | * @since 2.0.0 |
388 | 388 | */ |
389 | 389 | public function setup_payments_save() { |
390 | - check_admin_referer( 'getpaid-setup-wizard', 'getpaid-setup-wizard' ); |
|
391 | - wpinv_update_option( 'manual_active', ! empty( $_POST['enable-manual-gateway'] ) ); |
|
392 | - wp_redirect( esc_url_raw( $this->get_next_step_link() ) ); |
|
390 | + check_admin_referer('getpaid-setup-wizard', 'getpaid-setup-wizard'); |
|
391 | + wpinv_update_option('manual_active', !empty($_POST['enable-manual-gateway'])); |
|
392 | + wp_redirect(esc_url_raw($this->get_next_step_link())); |
|
393 | 393 | exit; |
394 | 394 | } |
395 | 395 | |
@@ -399,7 +399,7 @@ discard block |
||
399 | 399 | * @since 2.0.0 |
400 | 400 | */ |
401 | 401 | public function setup_ready() { |
402 | - include plugin_dir_path( __FILE__ ) . 'views/wizard-thank-you.php'; |
|
402 | + include plugin_dir_path(__FILE__) . 'views/wizard-thank-you.php'; |
|
403 | 403 | } |
404 | 404 | |
405 | 405 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | ?> |
10 | 10 | |
@@ -12,14 +12,14 @@ discard block |
||
12 | 12 | <div class="text-center pb-3 mt-5"> |
13 | 13 | <a class=" text-decoration-none" href="https://wpgetpaid.com/"> |
14 | 14 | <span class="text-black-50"> |
15 | - <img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png';?>" /> |
|
15 | + <img class="ml-n3x" src="<?php echo WPINV_PLUGIN_URL . 'assets/images/getpaid-logo.png'; ?>" /> |
|
16 | 16 | </span> |
17 | 17 | </a> |
18 | 18 | </div> |
19 | 19 | |
20 | 20 | <form method="post" class="text-left card-body" action="options.php"> |
21 | - <?php settings_fields( 'wpinv_settings' ); ?> |
|
22 | - <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url( $next_url ); ?>"> |
|
21 | + <?php settings_fields('wpinv_settings'); ?> |
|
22 | + <input type="hidden" name="_wp_http_referer" value="<?php echo esc_url($next_url); ?>"> |
|
23 | 23 | |
24 | 24 | <table class="gp-setup-maps w-100 " cellspacing="0"> |
25 | 25 | <tbody> |
@@ -27,28 +27,28 @@ discard block |
||
27 | 27 | |
28 | 28 | global $wp_settings_fields; |
29 | 29 | |
30 | - if ( isset( $wp_settings_fields[ $page ][ $section ] ) ) { |
|
31 | - $settings = $wp_settings_fields[ $page ][ $section ]; |
|
30 | + if (isset($wp_settings_fields[$page][$section])) { |
|
31 | + $settings = $wp_settings_fields[$page][$section]; |
|
32 | 32 | |
33 | - foreach ( $settings as $field ) { |
|
33 | + foreach ($settings as $field) { |
|
34 | 34 | |
35 | - $name = esc_attr( $field['id'] ); |
|
36 | - $id = sanitize_key( $name ); |
|
35 | + $name = esc_attr($field['id']); |
|
36 | + $id = sanitize_key($name); |
|
37 | 37 | $class = ''; |
38 | - $value = isset( $field['args']['std'] ) ? $field['args']['std'] : ''; |
|
39 | - $value = wpinv_clean( wpinv_get_option( $field['args']['id'], $value ) ); |
|
40 | - $help_text = isset( $field['args']['desc'] ) ? wp_kses_post( $field['args']['desc'] ) : ''; |
|
41 | - $type = str_replace( 'wpinv_', '', str_replace( '_callback', '', $field['callback'] ) ); |
|
42 | - $label = isset( $field['args']['name'] ) ? wp_kses_post( $field['args']['name'] ) : ''; |
|
43 | - $options = isset( $field['args']['options'] ) ? $field['args']['options'] : array(); |
|
38 | + $value = isset($field['args']['std']) ? $field['args']['std'] : ''; |
|
39 | + $value = wpinv_clean(wpinv_get_option($field['args']['id'], $value)); |
|
40 | + $help_text = isset($field['args']['desc']) ? wp_kses_post($field['args']['desc']) : ''; |
|
41 | + $type = str_replace('wpinv_', '', str_replace('_callback', '', $field['callback'])); |
|
42 | + $label = isset($field['args']['name']) ? wp_kses_post($field['args']['name']) : ''; |
|
43 | + $options = isset($field['args']['options']) ? $field['args']['options'] : array(); |
|
44 | 44 | |
45 | - if ( false !== strpos( $name, 'logo') ) { |
|
45 | + if (false !== strpos($name, 'logo')) { |
|
46 | 46 | $type = 'hidden'; |
47 | 47 | } |
48 | 48 | |
49 | - if ( 'country_states' == $type ) { |
|
49 | + if ('country_states' == $type) { |
|
50 | 50 | |
51 | - if ( 0 == count( wpinv_get_country_states( wpinv_get_default_country() ) ) ) { |
|
51 | + if (0 == count(wpinv_get_country_states(wpinv_get_default_country()))) { |
|
52 | 52 | $type = 'text'; |
53 | 53 | } else { |
54 | 54 | $type = 'select'; |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | $class = 'getpaid_js_field-state'; |
58 | 58 | } |
59 | 59 | |
60 | - if ( 'wpinv_settings[default_country]' == $name ) { |
|
60 | + if ('wpinv_settings[default_country]' == $name) { |
|
61 | 61 | $class = 'getpaid_js_field-country'; |
62 | 62 | } |
63 | 63 | |
64 | - switch ( $type ) { |
|
64 | + switch ($type) { |
|
65 | 65 | |
66 | 66 | case 'hidden': |
67 | 67 | echo "<input type='hidden' id='$id' name='$name' value='$value' />"; |
@@ -73,7 +73,7 @@ discard block |
||
73 | 73 | 'type' => $type, |
74 | 74 | 'id' => $id, |
75 | 75 | 'name' => $name, |
76 | - 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
76 | + 'value' => is_scalar($value) ? esc_attr($value) : '', |
|
77 | 77 | 'required' => false, |
78 | 78 | 'help_text' => $help_text, |
79 | 79 | 'label' => $label, |
@@ -89,7 +89,7 @@ discard block |
||
89 | 89 | array( |
90 | 90 | 'id' => $id, |
91 | 91 | 'name' => $name, |
92 | - 'value' => is_scalar( $value ) ? esc_textarea( $value ) : '', |
|
92 | + 'value' => is_scalar($value) ? esc_textarea($value) : '', |
|
93 | 93 | 'required' => false, |
94 | 94 | 'help_text' => $help_text, |
95 | 95 | 'label' => $label, |
@@ -101,7 +101,7 @@ discard block |
||
101 | 101 | ); |
102 | 102 | |
103 | 103 | // Bug fixed in AUI 0.1.51 for name stripping [] |
104 | - echo str_replace( sanitize_html_class( $name ), esc_attr( $name ), $textarea ); |
|
104 | + echo str_replace(sanitize_html_class($name), esc_attr($name), $textarea); |
|
105 | 105 | |
106 | 106 | break; |
107 | 107 | case 'select': |
@@ -110,7 +110,7 @@ discard block |
||
110 | 110 | 'id' => $id, |
111 | 111 | 'name' => $name, |
112 | 112 | 'placeholder' => '', |
113 | - 'value' => is_scalar( $value ) ? esc_attr( $value ) : '', |
|
113 | + 'value' => is_scalar($value) ? esc_attr($value) : '', |
|
114 | 114 | 'required' => false, |
115 | 115 | 'help_text' => $help_text, |
116 | 116 | 'label' => $label, |
@@ -135,7 +135,7 @@ discard block |
||
135 | 135 | <input |
136 | 136 | type="submit" |
137 | 137 | class="btn btn-primary button-next" |
138 | - value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/> |
|
138 | + value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/> |
|
139 | 139 | </p> |
140 | 140 | </table> |
141 | 141 | </form> |
@@ -4,30 +4,30 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | ?> |
10 | 10 | |
11 | 11 | <div class="card shadow-sm my-5">' |
12 | 12 | |
13 | - <form method="post" class="text-center card-body" action="<?php echo esc_url( admin_url() ); ?>"> |
|
14 | - <?php getpaid_hidden_field( 'getpaid-admin-action', 'install_plugin' ); ?> |
|
15 | - <?php wp_nonce_field( 'getpaid-nonce', 'getpaid-nonce' ); ?> |
|
16 | - <?php getpaid_hidden_field( 'redirect', $next_url ); ?> |
|
13 | + <form method="post" class="text-center card-body" action="<?php echo esc_url(admin_url()); ?>"> |
|
14 | + <?php getpaid_hidden_field('getpaid-admin-action', 'install_plugin'); ?> |
|
15 | + <?php wp_nonce_field('getpaid-nonce', 'getpaid-nonce'); ?> |
|
16 | + <?php getpaid_hidden_field('redirect', $next_url); ?> |
|
17 | 17 | <div class="gd-wizard-recommend"> |
18 | 18 | |
19 | - <h2 class="gd-settings-title h3"><?php _e( 'Recommended Plugins', 'invoicing' ); ?></h2> |
|
20 | - <p><?php _e( 'Below are a few of our own plugins that may help you.', 'invoicing' ); ?></p> |
|
19 | + <h2 class="gd-settings-title h3"><?php _e('Recommended Plugins', 'invoicing'); ?></h2> |
|
20 | + <p><?php _e('Below are a few of our own plugins that may help you.', 'invoicing'); ?></p> |
|
21 | 21 | |
22 | 22 | <ul class="list-group"> |
23 | - <?php foreach ( $recommended_plugins as $plugin ) : ?> |
|
23 | + <?php foreach ($recommended_plugins as $plugin) : ?> |
|
24 | 24 | <li class="list-group-item d-flex justify-content-between align-items-center flex-wrap text-left"> |
25 | - <span class="mr-auto"><?php echo esc_html( $plugin['name'] ); ?></span> |
|
25 | + <span class="mr-auto"><?php echo esc_html($plugin['name']); ?></span> |
|
26 | 26 | <div class="custom-control custom-switch getpaid-install-plugin-siwtch-div mr-n2"> |
27 | - <input type="checkbox" name="plugins[<?php echo esc_attr( $plugin['slug'] ); ?>]" value="<?php echo esc_attr( $plugin['file'] ); ?>" class="custom-control-input" <?php if( is_plugin_active( $plugin['slug'] ) ){echo "checked";} ?>> |
|
27 | + <input type="checkbox" name="plugins[<?php echo esc_attr($plugin['slug']); ?>]" value="<?php echo esc_attr($plugin['file']); ?>" class="custom-control-input" <?php if (is_plugin_active($plugin['slug'])) {echo "checked"; } ?>> |
|
28 | 28 | <label class="custom-control-label" for="ac-setting-updates"></label> |
29 | 29 | </div> |
30 | - <small class="w-100"><?php echo esc_attr( $plugin['desc'] );?></small> |
|
30 | + <small class="w-100"><?php echo esc_attr($plugin['desc']); ?></small> |
|
31 | 31 | </li> |
32 | 32 | <?php endforeach; ?> |
33 | 33 | </ul> |
@@ -36,7 +36,7 @@ discard block |
||
36 | 36 | <input |
37 | 37 | type="submit" |
38 | 38 | class="btn btn-primary button-next" |
39 | - value="<?php esc_attr_e( 'Continue', 'invoicing' ); ?>" name="save_step"/> |
|
39 | + value="<?php esc_attr_e('Continue', 'invoicing'); ?>" name="save_step"/> |
|
40 | 40 | </p> |
41 | 41 | |
42 | 42 | </div> |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | ?> |
10 | 10 | |
@@ -12,52 +12,52 @@ discard block |
||
12 | 12 | |
13 | 13 | <form method="post" class="text-center card-body"> |
14 | 14 | <div class="gp-wizard-payments"> |
15 | - <h2 class="gd-settings-title h3 "><?php _e( 'Gateway Setup', 'invoicing' ); ?></h2> |
|
16 | - <p><?php _e( 'Below are a few gateways that can be setup in a few seconds.', 'invoicing' ); ?> |
|
15 | + <h2 class="gd-settings-title h3 "><?php _e('Gateway Setup', 'invoicing'); ?></h2> |
|
16 | + <p><?php _e('Below are a few gateways that can be setup in a few seconds.', 'invoicing'); ?> |
|
17 | 17 | <br> |
18 | - <?php _e( 'We have 20+ Gateways that can be setup later.', 'invoicing' ); ?> |
|
18 | + <?php _e('We have 20+ Gateways that can be setup later.', 'invoicing'); ?> |
|
19 | 19 | </p> |
20 | 20 | |
21 | 21 | <ul class="list-group"> |
22 | 22 | |
23 | 23 | <li class="list-group-item d-flex justify-content-between align-items-center"> |
24 | - <span class="mr-auto"><img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg' );?>" class="ml-n2" alt="Stripe"></span> |
|
24 | + <span class="mr-auto"><img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/stripe-verified.svg'); ?>" class="ml-n2" alt="Stripe"></span> |
|
25 | 25 | <a href="<?php echo wp_nonce_url( |
26 | 26 | add_query_arg( |
27 | 27 | array( |
28 | 28 | 'getpaid-admin-action' => 'connect_gateway', |
29 | 29 | 'plugin' => 'stripe', |
30 | - 'redirect' => urlencode( $next_url ), |
|
30 | + 'redirect' => urlencode($next_url), |
|
31 | 31 | ), |
32 | 32 | admin_url() |
33 | 33 | ), |
34 | 34 | 'getpaid-nonce', |
35 | 35 | 'getpaid-nonce' |
36 | 36 | ); ?>" |
37 | - class="btn btn-sm btn-outline-primary"><?php _e( 'Connect', 'invoicing' ); ?></a> |
|
37 | + class="btn btn-sm btn-outline-primary"><?php _e('Connect', 'invoicing'); ?></a> |
|
38 | 38 | </li> |
39 | 39 | |
40 | 40 | <li class="list-group-item d-flex justify-content-between align-items-center"> |
41 | - <span class="mr-auto"><img src="<?php echo esc_url( WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp' );?>" class="" alt="PayPal" height="25"></span> |
|
41 | + <span class="mr-auto"><img src="<?php echo esc_url(WPINV_PLUGIN_URL . 'assets/images/pp-logo-150px.webp'); ?>" class="" alt="PayPal" height="25"></span> |
|
42 | 42 | <a href="<?php echo wp_nonce_url( |
43 | 43 | add_query_arg( |
44 | 44 | array( |
45 | 45 | 'getpaid-admin-action' => 'connect_gateway', |
46 | 46 | 'plugin' => 'paypal', |
47 | - 'redirect' => urlencode( $next_url ), |
|
47 | + 'redirect' => urlencode($next_url), |
|
48 | 48 | ), |
49 | 49 | admin_url() |
50 | 50 | ), |
51 | 51 | 'getpaid-nonce', |
52 | 52 | 'getpaid-nonce' |
53 | 53 | ); ?>" |
54 | - class="btn btn-sm btn-outline-primary"><?php _e( 'Connect', 'invoicing' ); ?></a> |
|
54 | + class="btn btn-sm btn-outline-primary"><?php _e('Connect', 'invoicing'); ?></a> |
|
55 | 55 | </li> |
56 | 56 | |
57 | 57 | <li class="list-group-item d-flex justify-content-between align-items-center"> |
58 | - <span class="mr-auto"><?php _e( 'Test Getway', 'invoicing' ); ?></span> |
|
58 | + <span class="mr-auto"><?php _e('Test Getway', 'invoicing'); ?></span> |
|
59 | 59 | <div class="custom-control custom-switch"> |
60 | - <input type="checkbox" name="enable-manual-gateway" class="custom-control-input" id="enable-manual-gateway" <?php checked( wpinv_is_gateway_active( 'manual' ) ); ?>> |
|
60 | + <input type="checkbox" name="enable-manual-gateway" class="custom-control-input" id="enable-manual-gateway" <?php checked(wpinv_is_gateway_active('manual')); ?>> |
|
61 | 61 | <label class="custom-control-label" for="enable-manual-gateway"></label> |
62 | 62 | </div> |
63 | 63 | </li> |
@@ -66,9 +66,9 @@ discard block |
||
66 | 66 | </div> |
67 | 67 | |
68 | 68 | <p class="gp-setup-actions step text-center mt-4"> |
69 | - <a href="<?php echo esc_url( $next_url ); ?>" class="btn btn-primary"><?php esc_attr_e( 'Continue', 'invoicing' ); ?></a> |
|
69 | + <a href="<?php echo esc_url($next_url); ?>" class="btn btn-primary"><?php esc_attr_e('Continue', 'invoicing'); ?></a> |
|
70 | 70 | </p> |
71 | 71 | |
72 | - <?php wp_nonce_field( 'getpaid-setup-wizard', 'getpaid-setup-wizard' ); ?> |
|
72 | + <?php wp_nonce_field('getpaid-setup-wizard', 'getpaid-setup-wizard'); ?> |
|
73 | 73 | </form> |
74 | 74 | </div> |
@@ -4,53 +4,53 @@ |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | ?> |
10 | 10 | |
11 | 11 | <div class="card shadow-sm my-5"> |
12 | 12 | <div class="text-center card-body"> |
13 | - <h1 class="h3"><?php esc_html_e( 'Awesome, you are ready to Get Paid', 'invoicing' ); ?></h1> |
|
13 | + <h1 class="h3"><?php esc_html_e('Awesome, you are ready to Get Paid', 'invoicing'); ?></h1> |
|
14 | 14 | |
15 | 15 | <div class="geodirectory-message geodirectory-tracker"> |
16 | - <p><?php _e( 'Thank you for choosing GetPaid!', 'invoicing' ); ?> <i class="far fa-smile-beam"></i></p> |
|
16 | + <p><?php _e('Thank you for choosing GetPaid!', 'invoicing'); ?> <i class="far fa-smile-beam"></i></p> |
|
17 | 17 | </div> |
18 | 18 | |
19 | 19 | <div class="gp-setup-next-steps"> |
20 | 20 | <div class="gp-setup-next-steps-first mb-4"> |
21 | - <h2 class="h3"><?php esc_html_e( 'Next steps', 'invoicing' ); ?></h2> |
|
21 | + <h2 class="h3"><?php esc_html_e('Next steps', 'invoicing'); ?></h2> |
|
22 | 22 | <a |
23 | 23 | class="btn btn-primary btn-sm" |
24 | - href="<?php echo esc_url( admin_url( 'post-new.php?post_type=wpi_item' ) ); ?>"><?php esc_html_e( 'Create your first Item!', 'invoicing' ); ?></a> |
|
24 | + href="<?php echo esc_url(admin_url('post-new.php?post_type=wpi_item')); ?>"><?php esc_html_e('Create your first Item!', 'invoicing'); ?></a> |
|
25 | 25 | <div class="gp-setup-next-steps-first mb-4"> |
26 | - <h2 class="h3"><?php esc_html_e( 'Examples', 'invoicing' ); ?></h2> |
|
26 | + <h2 class="h3"><?php esc_html_e('Examples', 'invoicing'); ?></h2> |
|
27 | 27 | <a |
28 | 28 | class="btn btn-primary btn-sm" |
29 | 29 | target="_blank" |
30 | - href="https://demos.ayecode.io/getpaid/"><?php esc_html_e( "View What's Possible", 'invoicing' ); ?></a> |
|
30 | + href="https://demos.ayecode.io/getpaid/"><?php esc_html_e("View What's Possible", 'invoicing'); ?></a> |
|
31 | 31 | |
32 | 32 | <a |
33 | 33 | class="btn btn-outline-primary btn-sm" |
34 | 34 | target="_blank" |
35 | - href="https://demos.ayecode.io/getpaid/"><?php esc_html_e( "View What's Possible", 'invoicing' ); ?></a> |
|
35 | + href="https://demos.ayecode.io/getpaid/"><?php esc_html_e("View What's Possible", 'invoicing'); ?></a> |
|
36 | 36 | </div> |
37 | 37 | <div class="gp-setup-next-steps-last"> |
38 | - <h2 class="h3"><?php _e( 'Learn more', 'invoicing' ); ?></h2> |
|
38 | + <h2 class="h3"><?php _e('Learn more', 'invoicing'); ?></h2> |
|
39 | 39 | <a |
40 | 40 | class="btn btn-outline-primary btn-sm" href="https://docs.wpgetpaid.com/collection/114-getting-started?utm_source=setupwizard&utm_medium=product&utm_content=getting-started&utm_campaign=invoicingplugin" |
41 | - target="_blank"><?php esc_html_e( 'Getting Started', 'invoicing' ); ?></a> |
|
41 | + target="_blank"><?php esc_html_e('Getting Started', 'invoicing'); ?></a> |
|
42 | 42 | <a |
43 | 43 | class="btn btn-outline-primary btn-sm" |
44 | 44 | href="https://docs.wpgetpaid.com/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingplugin" |
45 | - target="_blank"><?php esc_html_e( 'Documentation', 'invoicing' ); ?></a> |
|
45 | + target="_blank"><?php esc_html_e('Documentation', 'invoicing'); ?></a> |
|
46 | 46 | <a |
47 | 47 | class="btn btn-outline-primary btn-sm" |
48 | 48 | href="https://wpgetpaid.com/support/?utm_source=setupwizard&utm_medium=product&utm_content=docs&utm_campaign=invoicingyplugin" |
49 | - target="_blank"><?php esc_html_e( 'Support', 'invoicing' ); ?></a> |
|
49 | + target="_blank"><?php esc_html_e('Support', 'invoicing'); ?></a> |
|
50 | 50 | <a |
51 | 51 | class="btn btn-outline-primary btn-sm" |
52 | 52 | href="https://demos.ayecode.io/getpaid/?utm_source=setupwizard&utm_medium=product&utm_content=demos&utm_campaign=invoicingyplugin" |
53 | - target="_blank"><?php esc_html_e( 'Demos', 'invoicing' ); ?></a> |
|
53 | + target="_blank"><?php esc_html_e('Demos', 'invoicing'); ?></a> |
|
54 | 54 | </div> |
55 | 55 | </div> |
56 | 56 | </div> |