PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.32
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.32
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
← All changes | classes/models/FrmSolution.php +148 -74 6.36.32 View file →
@@ -3,8 +3,10 @@
3 3 * Handles the installation of a solution and any dependencies.
4 4 * This page is shown when a Formidable plugin is activated.
5 5 *
6 6 * @since 4.06.02
7 + *
8 + * @package Formidable
7 9 */
8 10
9 11 if ( ! defined( 'ABSPATH' ) ) {
10 12 die( 'You are not allowed to call this page directly.' );
@@ -11,10 +13,16 @@
11 13 }
12 14
13 15 class FrmSolution {
14 16
17 + /**
18 + * @var string
19 + */
15 20 protected $plugin_slug = '';
16 21
22 + /**
23 + * @var string
24 + */
17 25 protected $plugin_file = '';
18 26
19 27 /**
20 28 * Hidden welcome page slug.
@@ -19,15 +27,23 @@
19 27 /**
20 28 * Hidden welcome page slug.
21 29 *
22 30 * @since 4.06.02
31 + *
32 + * @var string
23 33 */
24 34 protected $page = '';
25 35
26 - protected $icon = 'frm_icon_font frm_settings_icon';
36 + /**
37 + * @var string
38 + */
39 + protected $icon = 'frmfont frm_settings_icon';
27 40
41 + /**
42 + * @param array $atts
43 + */
28 44 public function __construct( $atts = array() ) {
29 - if ( empty( $this->plugin_slug ) ) {
45 + if ( ! $this->plugin_slug ) {
30 46 return;
31 47 }
32 48
33 49 add_action( 'plugins_loaded', array( $this, 'load_hooks' ), 50 );
@@ -32,9 +48,9 @@
32 48
33 49 add_action( 'plugins_loaded', array( $this, 'load_hooks' ), 50 );
34 50 add_action( 'admin_init', array( $this, 'redirect' ), 9999 );
35 51
36 - if ( empty( $this->plugin_file ) ) {
52 + if ( ! $this->plugin_file ) {
37 53 $this->plugin_file = $this->plugin_slug . '.php';
38 54 }
39 55 }
40 56
@@ -66,11 +82,16 @@
66 82 add_action( 'admin_menu', array( $this, 'register' ) );
67 83 add_action( 'admin_head', array( $this, 'hide_menu' ) );
68 84 }
69 85
86 + /**
87 + * @param array $links
88 + *
89 + * @return array
90 + */
70 91 public function plugin_links( $links ) {
71 92 if ( ! $this->is_complete() ) {
72 - $settings = '<a href="' . esc_url( $this->settings_link() ) . '">' . __( 'Setup', 'formidable' ) . '</a>';
93 + $settings = '<a href="' . esc_url( $this->settings_link() ) . '">' . esc_html__( 'Setup', 'formidable' ) . '</a>';
73 94 array_unshift( $links, $settings );
74 95 }
75 96
76 97 return $links;
@@ -86,9 +107,8 @@
86 107 *
87 108 * @return void
88 109 */
89 110 public function register() {
90 -
91 111 // Getting started - shows after installation.
92 112 add_dashboard_page(
93 113 esc_html( $this->page_title() ),
94 114 esc_html( $this->page_title() ),
@@ -144,10 +164,10 @@
144 164 *
145 165 * @return void
146 166 */
147 167 public function redirect() {
168 + $current_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
148 169
149 - $current_page = FrmAppHelper::simple_get( 'page', 'sanitize_title' );
150 170 if ( $current_page === $this->page ) {
151 171 // Prevent endless loop.
152 172 return;
153 173 }
@@ -161,9 +181,9 @@
161 181 if ( ! $this->is_current_plugin() ) {
162 182 return;
163 183 }
164 184
165 - delete_transient( 'frm_activation_redirect' );
185 + delete_transient( FrmOnboardingWizardController::TRANSIENT_NAME );
166 186
167 187 // Initial install.
168 188 wp_safe_redirect( $this->settings_link() );
169 189 exit;
@@ -175,10 +195,14 @@
175 195 protected function settings_link() {
176 196 return admin_url( 'index.php?page=' . $this->page );
177 197 }
178 198
179 - /*
199 + /**
180 200 * Add page to global settings.
201 + *
202 + * @param array $sections Sections.
203 + *
204 + * @return array
181 205 */
182 206 public function add_settings( $sections ) {
183 207 wp_enqueue_style( 'formidable-pro-fields' );
184 208 $sections[ $this->plugin_slug ] = array(
@@ -198,8 +222,9 @@
198 222 * @return void
199 223 */
200 224 public function settings_page() {
201 225 $steps = $this->get_steps_data();
226 +
202 227 if ( ! $steps['license']['complete'] || ( isset( $steps['plugin'] ) && ! $steps['plugin']['complete'] ) ) {
203 228 // Redirect to the welcome page if install hasn't been done.
204 229 $url = $this->settings_link();
205 230 echo '<script>window.location.replace("' . esc_url_raw( $url ) . '");</script>';
@@ -205,10 +230,9 @@
205 230 echo '<script>window.location.replace("' . esc_url_raw( $url ) . '");</script>';
206 231 return;
207 232 }
208 233
209 - $all_imported = $this->is_complete( 'all' );
210 -
234 + $all_imported = $this->is_complete( 'all' );
211 235 $step = $steps['import'];
212 236 $step['label'] = '';
213 237 $step['nested'] = true;
214 238
@@ -215,22 +239,27 @@
215 239 if ( $steps['complete']['current'] ) {
216 240 // Always show this step in settings.
217 241 $step['current'] = true;
218 242
219 - $new_class = $all_imported ? ' button frm_hidden' : '';
243 + $new_class = $all_imported ? ' button frm_hidden' : '';
220 244 $step['button_class'] = str_replace( 'frm_grey disabled', $new_class, $step['button_class'] );
221 245 }
246 +
222 247 if ( $all_imported ) {
223 248 $step['description'] = __( 'The following form(s) have been created.', 'formidable' );
224 249 }
250 +
225 251 $this->show_app_install( $step );
226 252
227 - if ( ! $all_imported ) {
228 - $step = $steps['complete'];
229 - $step['current'] = false;
230 - $step['button_class'] .= ' frm_grey disabled';
231 - $this->show_page_links( $step );
253 + if ( $all_imported ) {
254 + return;
232 255 }
256 +
257 + $step = $steps['complete'];
258 + $step['current'] = false;
259 + $step['button_class'] .= ' frm_grey disabled';
260 +
261 + $this->show_page_links( $step );
233 262 }
234 263
235 264 /**
236 265 * Getting Started screen. Shows after first install.
@@ -260,8 +289,9 @@
260 289 'height' => 90,
261 290 'width' => 90,
262 291 );
263 292
293 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
264 294 ?>
265 295 <section class="top">
266 296 <div class="frm-smtp-logos">
267 297 <?php FrmAppHelper::show_logo( $size ); ?>
@@ -285,8 +315,9 @@
285 315 <h1><?php echo esc_html( $this->page_title() ); ?></h1>
286 316 <p><?php echo esc_html( $this->page_description() ); ?></p>
287 317 </section>
288 318 <?php
319 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
289 320 }
290 321
291 322 /**
292 323 * This is the welcome page content.
@@ -296,8 +327,9 @@
296 327 */
297 328 protected function main_content() {
298 329 $steps = $this->get_steps_data();
299 330 $this->license_box( $steps['license'] );
331 +
300 332 if ( isset( $steps['plugin'] ) ) {
301 333 $this->show_plugin_install( $steps['plugin'] );
302 334 }
303 335 $this->show_app_install( $steps['import'] );
@@ -303,41 +335,44 @@
303 335 $this->show_app_install( $steps['import'] );
304 336 $this->show_page_links( $steps['complete'] );
305 337 }
306 338
339 + /**
340 + * @return array
341 + */
307 342 protected function get_steps_data() {
308 343 $pro_installed = FrmAppHelper::pro_is_connected();
309 344
310 345 $steps = array(
311 - 'license' => array(
312 - 'label' => __( 'Connect to FormidableForms.com', 'formidable' ),
313 - 'description' => __( 'Create a connection to get plugin downloads.', 'formidable' ),
314 - 'button_label' => __( 'Connect an Account', 'formidable' ),
315 - 'current' => empty( $pro_installed ),
316 - 'complete' => $pro_installed,
317 - 'num' => 1,
346 + 'license' => array(
347 + 'label' => __( 'Connect to FormidableForms.com', 'formidable' ),
348 + 'description' => __( 'Create a connection to get plugin downloads.', 'formidable' ),
349 + 'button_label' => __( 'Connect an Account', 'formidable' ),
350 + 'current' => ! $pro_installed,
351 + 'complete' => $pro_installed,
352 + 'num' => 1,
318 353 ),
319 - 'plugin' => array(
320 - 'label' => __( 'Install and Activate Add-Ons', 'formidable' ),
321 - 'description' => __( 'Install any required add-ons from FormidableForms.com.', 'formidable' ),
322 - 'button_label' => __( 'Install & Activate', 'formidable' ),
323 - 'current' => false,
324 - 'complete' => false,
325 - 'num' => 2,
354 + 'plugin' => array(
355 + 'label' => __( 'Install and Activate Add-Ons', 'formidable' ),
356 + 'description' => __( 'Install any required add-ons from FormidableForms.com.', 'formidable' ),
357 + 'button_label' => __( 'Install & Activate', 'formidable' ),
358 + 'current' => false,
359 + 'complete' => false,
360 + 'num' => 2,
326 361 ),
327 - 'import' => array(
328 - 'label' => __( 'Setup Forms, Views, and Pages', 'formidable' ),
329 - 'description' => __( 'Build the forms, views, and pages automatically.', 'formidable' ),
330 - 'button_label' => __( 'Create Now', 'formidable' ),
331 - 'complete' => $this->is_complete(),
332 - 'num' => 3,
362 + 'import' => array(
363 + 'label' => __( 'Setup Forms, Views, and Pages', 'formidable' ),
364 + 'description' => __( 'Build the forms, views, and pages automatically.', 'formidable' ),
365 + 'button_label' => __( 'Create Now', 'formidable' ),
366 + 'complete' => $this->is_complete(),
367 + 'num' => 3,
333 368 ),
334 369 'complete' => array(
335 - 'label' => __( 'Customize Your New Pages', 'formidable' ),
336 - 'description' => __( 'Make any required changes and publish the page.', 'formidable' ),
337 - 'button_label' => __( 'View Page', 'formidable' ),
338 - 'complete' => false,
339 - 'num' => 4,
370 + 'label' => __( 'Customize Your New Pages', 'formidable' ),
371 + 'description' => __( 'Make any required changes and publish the page.', 'formidable' ),
372 + 'button_label' => __( 'View Page', 'formidable' ),
373 + 'complete' => false,
374 + 'num' => 4,
340 375 ),
341 376 );
342 377
343 378 $this->adjust_plugin_install_step( $steps );
@@ -342,8 +377,9 @@
342 377
343 378 $this->adjust_plugin_install_step( $steps );
344 379
345 380 $has_current = false;
381 +
346 382 foreach ( $steps as $k => $step ) {
347 383 // Set the current step.
348 384 if ( ! isset( $step['current'] ) ) {
349 385 if ( $step['complete'] ) {
@@ -349,9 +385,9 @@
349 385 if ( $step['complete'] ) {
350 386 $steps[ $k ]['current'] = false;
351 387 } else {
352 388 $steps[ $k ]['current'] = ! $has_current;
353 - $has_current = true;
389 + $has_current = true;
354 390 }
355 391 } elseif ( $step['current'] ) {
356 392 $has_current = true;
357 393 }
@@ -356,15 +392,16 @@
356 392 $has_current = true;
357 393 }
358 394
359 395 // Set disabled buttons.
360 - $class = isset( $step['button_class'] ) ? $step['button_class'] : '';
396 + $class = $step['button_class'] ?? '';
361 397 $class .= ' button-primary frm-button-primary';
398 +
362 399 if ( ! $steps[ $k ]['current'] ) {
363 400 $class .= ' frm_grey disabled';
364 401 }
365 402 $steps[ $k ]['button_class'] = $class;
366 - }
403 + }//end foreach
367 404
368 405 return $steps;
369 406 }
370 407
@@ -374,9 +411,10 @@
374 411 * @return void
375 412 */
376 413 protected function adjust_plugin_install_step( &$steps ) {
377 414 $plugins = $this->required_plugins();
378 - if ( empty( $plugins ) ) {
415 +
416 + if ( ! $plugins ) {
379 417 unset( $steps['plugin'] );
380 418 $steps['import']['num'] = 2;
381 419 $steps['complete']['num'] = 3;
382 420 return;
@@ -383,14 +421,16 @@
383 421 }
384 422
385 423 $missing = array();
386 424 $rel = array();
425 +
387 426 foreach ( $plugins as $plugin_key ) {
388 427 $plugin = FrmAddonsController::install_link( $plugin_key );
428 +
389 429 if ( $plugin['status'] === 'active' ) {
390 430 continue;
391 431 }
392 - $links[ $plugin_key ] = $plugin;
432 +
393 433 if ( isset( $plugin['url'] ) ) {
394 434 $rel[] = $plugin['url'];
395 435 } else {
396 436 // Add-on is required but not allowed.
@@ -396,11 +436,12 @@
396 436 // Add-on is required but not allowed.
397 437 $missing[] = $plugin_key;
398 438 }
399 439 }
400 - if ( empty( $rel ) && empty( $missing ) ) {
440 +
441 + if ( ! $rel && ! $missing ) {
401 442 $steps['plugin']['complete'] = true;
402 - } elseif ( ! empty( $missing ) ) {
443 + } elseif ( $missing ) {
403 444 $steps['plugin']['error'] = sprintf(
404 445 /* translators: %1$s: Plugin name */
405 446 esc_html__( 'You need permission to download the Formidable %1$s plugin', 'formidable' ),
406 447 implode( ', ', $missing )
@@ -405,9 +446,9 @@
405 446 esc_html__( 'You need permission to download the Formidable %1$s plugin', 'formidable' ),
406 447 implode( ', ', $missing )
407 448 );
408 449 } else {
409 - $steps['plugin']['links'] = $rel;
450 + $steps['plugin']['links'] = $rel;
410 451 $steps['plugin']['button_class'] = 'frm-solution-multiple ';
411 452 }
412 453
413 454 if ( $steps['license']['complete'] && ! $steps['plugin']['complete'] ) {
@@ -415,18 +456,21 @@
415 456 }
416 457 }
417 458
418 459 /**
460 + * @param array $step Step.
461 + *
419 462 * @return void
420 463 */
421 464 protected function step_top( $step ) {
422 - $section_class = ( ! isset( $step['current'] ) || ! $step['current'] ) ? 'frm_grey' : '';
465 + $section_class = ! empty( $step['current'] ) ? '' : 'frm_grey';
423 466
467 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
424 468 ?>
425 469 <section class="step step-install <?php echo esc_attr( $section_class ); ?>">
426 470 <aside class="num">
427 471 <?php
428 - if ( isset( $step['complete'] ) && $step['complete'] ) {
472 + if ( ! empty( $step['complete'] ) ) {
429 473 FrmAppHelper::icon_by_class(
430 474 'frmfont frm_step_complete_icon',
431 475 array(
432 476 /* translators: %1$s: Step number */
@@ -435,9 +479,9 @@
435 479 )
436 480 );
437 481 } else {
438 482 ?>
439 - <svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" fill="#ccc"/><text x="50%" y="50%" text-anchor="middle" fill="#fff" stroke="#fff" stroke-width="2px" dy=".3em" font-size="3.7em"><?php echo esc_html( $step['num'] ); ?></text></svg>
483 + <svg xmlns="http://www.w3.org/2000/svg" width="50" height="50" viewBox="0 0 100 100"><circle cx="50" cy="50" r="50" fill="#ccc"/><text x="50%" y="50%" text-anchor="middle" fill="#fff" stroke="#fff" stroke-width="2px" dy=".3em" font-size="3.7em"><?php echo esc_html( $step['num'] ); ?></text></svg><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?>
440 484 <?php
441 485 }
442 486 ?>
443 487 <i class="loader hidden"></i>
@@ -450,23 +494,30 @@
450 494 <?php if ( isset( $step['error'] ) ) { ?>
451 495 <p class="frm_error"><?php echo esc_html( $step['error'] ); ?></p>
452 496 <?php } ?>
453 497 <?php
498 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
454 499 }
455 500
456 501 /**
502 + * @param array $step Step.
503 + *
457 504 * @return void
458 505 */
459 506 protected function step_bottom( $step ) {
507 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
460 508 ?>
461 509 </div>
462 510 </section>
463 511 <?php
512 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
464 513 }
465 514
466 515 /**
467 516 * Generate and output Connect step section HTML.
468 517 *
518 + * @param array $step Step.
519 + *
469 520 * @return void
470 521 */
471 522 protected function license_box( $step ) {
472 523 $this->step_top( $step );
@@ -471,13 +522,15 @@
471 522 protected function license_box( $step ) {
472 523 $this->step_top( $step );
473 524
474 525 if ( $step['complete'] ) {
526 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
475 527 ?>
476 528 <a href="#" class="<?php echo esc_attr( $step['button_class'] ); ?>">
477 529 <?php echo esc_html( $step['button_label'] ); ?>
478 530 </a>
479 531 <?php
532 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
480 533 } else {
481 534 FrmSettingsController::license_box();
482 535 }
483 536
@@ -484,8 +537,10 @@
484 537 $this->step_bottom( $step );
485 538 }
486 539
487 540 /**
541 + * @param array $step Step.
542 + *
488 543 * @return void
489 544 */
490 545 protected function show_plugin_install( $step ) {
491 546 $this->step_top( $step );
@@ -490,15 +545,17 @@
490 545 protected function show_plugin_install( $step ) {
491 546 $this->step_top( $step );
492 547
493 548 if ( ! isset( $step['error'] ) ) {
494 - $rel = isset( $step['links'] ) ? $step['links'] : array();
549 + $rel = $step['links'] ?? array();
495 550
551 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
496 552 ?>
497 553 <a rel="<?php echo esc_attr( implode( ',', $rel ) ); ?>" class="<?php echo esc_attr( $step['button_class'] ); ?>">
498 554 <?php echo esc_html( $step['button_label'] ); ?>
499 555 </a>
500 556 <?php
557 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
501 558 }
502 559
503 560 $this->step_bottom( $step );
504 561 }
@@ -503,24 +560,27 @@
503 560 $this->step_bottom( $step );
504 561 }
505 562
506 563 /**
564 + * @param array $step Step.
565 + *
507 566 * @return void
508 567 */
509 568 protected function show_app_install( $step ) {
510 569 $is_complete = $step['complete'];
511 - if ( ! empty( $this->form_options() ) && ! $is_complete ) {
570 +
571 + if ( $this->form_options() && ! $is_complete ) {
512 572 $step['description'] = __( 'Select the form or view you would like to create.', 'formidable' );
513 573 }
514 574
515 575 $this->step_top( $step );
516 576
517 - $api = new FrmFormApi();
518 - $addons = $api->get_api_info();
519 -
520 - $id = $this->download_id();
577 + $api = new FrmFormApi();
578 + $addons = $api->get_api_info();
579 + $id = $this->download_id();
521 580 $has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] );
522 581
582 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
523 583 if ( ! $step['current'] ) {
524 584 ?>
525 585 <a href="#" class="<?php echo esc_attr( $step['button_class'] ); ?>">
526 586 <?php echo esc_html( $step['button_label'] ); ?>
@@ -533,11 +593,12 @@
533 593
534 594 if ( ! $has_file ) {
535 595 echo '<p class="frm_error_style">' . esc_html__( 'We didn\'t find anything to import. Please contact our team.', 'formidable' ) . '</p>';
536 596 } elseif ( ! isset( $addons[ $id ]['beta']['package'] ) ) {
537 - echo '<p class="frm_error_style">' . esc_html__( 'Looks like you may not have a current subscription for this solution. Please check your account.', 'formidable' ) . '</p>';
597 + echo '<p class="frm_error_style">' . esc_html__( 'Looks like you may not have a current subscription for this solution. Please check your account.', 'formidable' ) . '</p>'; // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong
538 598 } else {
539 599 $xml = $addons[ $id ]['beta']['package'];
600 +
540 601 if ( is_array( $xml ) ) {
541 602 $xml = reset( $xml );
542 603 }
543 604
@@ -574,14 +635,17 @@
574 635 echo '</fieldset>';
575 636 } else {
576 637 echo '</form>';
577 638 }
578 - }
639 + }//end if
640 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
579 641
580 642 $this->step_bottom( $step );
581 643 }
582 644
583 645 /**
646 + * @param string $xml
647 + *
584 648 * @return void
585 649 */
586 650 protected function show_form_options( $xml ) {
587 651 $this->show_import_options( $this->form_options(), 'form', $xml );
@@ -594,9 +658,11 @@
594 658 $this->show_import_options( $this->view_options(), 'view' );
595 659 }
596 660
597 661 /**
662 + * @param array $options
598 663 * @param string $importing
664 + * @param string $xml
599 665 *
600 666 * @psalm-param 'form'|'view' $importing
601 667 *
602 668 * @return void
@@ -601,26 +667,28 @@
601 667 *
602 668 * @return void
603 669 */
604 670 protected function show_import_options( $options, $importing, $xml = '' ) {
605 - if ( empty( $options ) ) {
671 + if ( ! $options ) {
606 672 return;
607 673 }
608 674
609 675 $imported = $this->previously_imported_forms();
610 676 $count = count( $options );
677 +
611 678 foreach ( $options as $info ) {
612 679 // Count the number of options displayed for css.
613 680 if ( $count > 1 && ! isset( $info['img'] ) ) {
614 - $count --;
681 + --$count;
615 682 }
616 683 }
684 +
617 685 $width = floor( ( 533 - ( ( $count - 1 ) * 20 ) ) / $count );
618 686 unset( $count );
619 687
620 688 $selected = false;
621 689
622 - include( FrmAppHelper::plugin_path() . '/classes/views/solutions/_import.php' );
690 + include FrmAppHelper::plugin_path() . '/classes/views/solutions/_import.php';
623 691 }
624 692
625 693 /**
626 694 * @return void
@@ -626,26 +694,32 @@
626 694 * @return void
627 695 */
628 696 protected function show_page_options() {
629 697 $pages = $this->needed_pages();
630 - if ( empty( $pages ) ) {
698 +
699 + if ( ! $pages ) {
631 700 return;
632 701 }
633 702
634 703 echo '<h3>Choose New Page Title</h3>';
704 +
635 705 foreach ( $pages as $page ) {
706 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
636 707 ?>
637 708 <p>
638 709 <label for="pages_<?php echo esc_html( $page['type'] ); ?>">
639 710 <?php echo esc_html( $page['label'] ); ?>
640 711 </label>
641 - <input type="text" name="pages[<?php echo esc_html( $page['type'] ); ?>]" value="<?php echo esc_attr( $page['name'] ); ?>" id="pages_<?php echo esc_html( $page['type'] ); ?>" required />
712 + <input type="text" name="pages[<?php echo esc_html( $page['type'] ); ?>]" value="<?php echo esc_attr( $page['name'] ); ?>" id="pages_<?php echo esc_html( $page['type'] ); ?>" required /><?php // phpcs:ignore SlevomatCodingStandard.Files.LineLength.LineTooLong ?>
642 713 </p>
643 714 <?php
715 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
644 716 }
645 717 }
646 718
647 719 /**
720 + * @param array $step
721 + *
648 722 * @return void
649 723 */
650 724 protected function show_page_links( $step ) {
651 725 if ( $step['current'] ) {
@@ -653,13 +727,15 @@
653 727 }
654 728
655 729 $this->step_top( $step );
656 730
731 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
657 732 ?>
658 733 <a href="#" target="_blank" rel="noopener" id="frm-redirect-link" class="<?php echo esc_attr( $step['button_class'] ); ?>">
659 734 <?php echo esc_html( $step['button_label'] ); ?>
660 735 </a>
661 736 <?php
737 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
662 738
663 739 $this->step_bottom( $step );
664 740 }
665 741
@@ -668,10 +744,10 @@
668 744 *
669 745 * @return bool
670 746 */
671 747 protected function is_current_plugin() {
672 - $to_redirect = get_transient( 'frm_activation_redirect' );
673 - return $to_redirect === $this->plugin_slug && empty( $this->is_complete() );
748 + $to_redirect = get_transient( FrmOnboardingWizardController::TRANSIENT_NAME );
749 + return $to_redirect === $this->plugin_slug && ! $this->is_complete();
674 750 }
675 751
676 752 /**
677 753 * Override this function to indicate when install is complete.
@@ -683,11 +759,13 @@
683 759 * @return bool
684 760 */
685 761 protected function is_complete( $count = 1 ) {
686 762 $imported = $this->previously_imported_forms();
763 +
687 764 if ( $count === 'all' ) {
688 765 return count( $imported ) >= count( $this->form_options() );
689 766 }
767 +
690 768 return ! empty( $imported );
691 769 }
692 770
693 771 /**
@@ -696,11 +774,12 @@
696 774 * @return array
697 775 */
698 776 protected function previously_imported_forms() {
699 777 $imported = array();
700 - $forms = $this->form_options();
701 - foreach ( $forms as $form ) {
778 +
779 + foreach ( $this->form_options() as $form ) {
702 780 $was_imported = isset( $form['form'] ) ? FrmForm::get_id_by_key( $form['form'] ) : false;
781 +
703 782 if ( $was_imported ) {
704 783 $imported[ $form['form'] ] = $was_imported;
705 784 }
706 785 }
@@ -781,10 +860,8 @@
781 860 wp_enqueue_style( 'formidable-pro-fields' );
782 861 ?>
783 862 <style>
784 863 #frm-welcome *, #frm-welcome *::before, #frm-welcome *::after {
785 - -webkit-box-sizing: border-box;
786 - -moz-box-sizing: border-box;
787 864 box-sizing: border-box;
788 865 }
789 866 #frm-welcome{
790 867 width: 700px;
@@ -843,10 +920,8 @@
843 920 border-radius: 3px;
844 921 }
845 922 #frm-welcome .step,
846 923 #frm-welcome .screenshot .cont {
847 - -webkit-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.05);
848 - -moz-box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.05);
849 924 box-shadow: 0px 2px 5px 0px rgba(0, 0, 0, 0.05);
850 925 }
851 926 #frm-welcome .step {
852 927 background-color: #F9F9F9;
@@ -889,6 +964,5 @@
889 964 }
890 965 </style>
891 966 <?php
892 967 }
893 -
894 968 }