PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
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 +33 -14 6.27 → trunk View file →
@@ -41,9 +41,9 @@
41 41 /**
42 42 * @param array $atts
43 43 */
44 44 public function __construct( $atts = array() ) {
45 - if ( empty( $this->plugin_slug ) ) {
45 + if ( ! $this->plugin_slug ) {
46 46 return;
47 47 }
48 48
49 49 add_action( 'plugins_loaded', array( $this, 'load_hooks' ), 50 );
@@ -48,9 +48,9 @@
48 48
49 49 add_action( 'plugins_loaded', array( $this, 'load_hooks' ), 50 );
50 50 add_action( 'admin_init', array( $this, 'redirect' ), 9999 );
51 51
52 - if ( empty( $this->plugin_file ) ) {
52 + if ( ! $this->plugin_file ) {
53 53 $this->plugin_file = $this->plugin_slug . '.php';
54 54 }
55 55 }
56 56
@@ -89,9 +89,9 @@
89 89 * @return array
90 90 */
91 91 public function plugin_links( $links ) {
92 92 if ( ! $this->is_complete() ) {
93 - $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>';
94 94 array_unshift( $links, $settings );
95 95 }
96 96
97 97 return $links;
@@ -246,16 +246,20 @@
246 246
247 247 if ( $all_imported ) {
248 248 $step['description'] = __( 'The following form(s) have been created.', 'formidable' );
249 249 }
250 +
250 251 $this->show_app_install( $step );
251 252
252 - if ( ! $all_imported ) {
253 - $step = $steps['complete'];
254 - $step['current'] = false;
255 - $step['button_class'] .= ' frm_grey disabled';
256 - $this->show_page_links( $step );
253 + if ( $all_imported ) {
254 + return;
257 255 }
256 +
257 + $step = $steps['complete'];
258 + $step['current'] = false;
259 + $step['button_class'] .= ' frm_grey disabled';
260 +
261 + $this->show_page_links( $step );
258 262 }
259 263
260 264 /**
261 265 * Getting Started screen. Shows after first install.
@@ -285,8 +289,9 @@
285 289 'height' => 90,
286 290 'width' => 90,
287 291 );
288 292
293 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
289 294 ?>
290 295 <section class="top">
291 296 <div class="frm-smtp-logos">
292 297 <?php FrmAppHelper::show_logo( $size ); ?>
@@ -310,8 +315,9 @@
310 315 <h1><?php echo esc_html( $this->page_title() ); ?></h1>
311 316 <p><?php echo esc_html( $this->page_description() ); ?></p>
312 317 </section>
313 318 <?php
319 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
314 320 }
315 321
316 322 /**
317 323 * This is the welcome page content.
@@ -340,9 +346,9 @@
340 346 'license' => array(
341 347 'label' => __( 'Connect to FormidableForms.com', 'formidable' ),
342 348 'description' => __( 'Create a connection to get plugin downloads.', 'formidable' ),
343 349 'button_label' => __( 'Connect an Account', 'formidable' ),
344 - 'current' => empty( $pro_installed ),
350 + 'current' => ! $pro_installed,
345 351 'complete' => $pro_installed,
346 352 'num' => 1,
347 353 ),
348 354 'plugin' => array(
@@ -455,10 +461,11 @@
455 461 *
456 462 * @return void
457 463 */
458 464 protected function step_top( $step ) {
459 - $section_class = empty( $step['current'] ) ? 'frm_grey' : '';
465 + $section_class = ! empty( $step['current'] ) ? '' : 'frm_grey';
460 466
467 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
461 468 ?>
462 469 <section class="step step-install <?php echo esc_attr( $section_class ); ?>">
463 470 <aside class="num">
464 471 <?php
@@ -487,8 +494,9 @@
487 494 <?php if ( isset( $step['error'] ) ) { ?>
488 495 <p class="frm_error"><?php echo esc_html( $step['error'] ); ?></p>
489 496 <?php } ?>
490 497 <?php
498 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
491 499 }
492 500
493 501 /**
494 502 * @param array $step Step.
@@ -495,12 +503,14 @@
495 503 *
496 504 * @return void
497 505 */
498 506 protected function step_bottom( $step ) {
507 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
499 508 ?>
500 509 </div>
501 510 </section>
502 511 <?php
512 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
503 513 }
504 514
505 515 /**
506 516 * Generate and output Connect step section HTML.
@@ -512,13 +522,15 @@
512 522 protected function license_box( $step ) {
513 523 $this->step_top( $step );
514 524
515 525 if ( $step['complete'] ) {
526 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
516 527 ?>
517 528 <a href="#" class="<?php echo esc_attr( $step['button_class'] ); ?>">
518 529 <?php echo esc_html( $step['button_label'] ); ?>
519 530 </a>
520 531 <?php
532 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
521 533 } else {
522 534 FrmSettingsController::license_box();
523 535 }
524 536
@@ -535,13 +547,15 @@
535 547
536 548 if ( ! isset( $step['error'] ) ) {
537 549 $rel = $step['links'] ?? array();
538 550
551 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
539 552 ?>
540 553 <a rel="<?php echo esc_attr( implode( ',', $rel ) ); ?>" class="<?php echo esc_attr( $step['button_class'] ); ?>">
541 554 <?php echo esc_html( $step['button_label'] ); ?>
542 555 </a>
543 556 <?php
557 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
544 558 }
545 559
546 560 $this->step_bottom( $step );
547 561 }
@@ -553,9 +567,9 @@
553 567 */
554 568 protected function show_app_install( $step ) {
555 569 $is_complete = $step['complete'];
556 570
557 - if ( ! empty( $this->form_options() ) && ! $is_complete ) {
571 + if ( $this->form_options() && ! $is_complete ) {
558 572 $step['description'] = __( 'Select the form or view you would like to create.', 'formidable' );
559 573 }
560 574
561 575 $this->step_top( $step );
@@ -564,8 +578,9 @@
564 578 $addons = $api->get_api_info();
565 579 $id = $this->download_id();
566 580 $has_file = isset( $addons[ $id ] ) && isset( $addons[ $id ]['beta'] );
567 581
582 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
568 583 if ( ! $step['current'] ) {
569 584 ?>
570 585 <a href="#" class="<?php echo esc_attr( $step['button_class'] ); ?>">
571 586 <?php echo esc_html( $step['button_label'] ); ?>
@@ -621,8 +636,9 @@
621 636 } else {
622 637 echo '</form>';
623 638 }
624 639 }//end if
640 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
625 641
626 642 $this->step_bottom( $step );
627 643 }
628 644
@@ -686,8 +702,9 @@
686 702
687 703 echo '<h3>Choose New Page Title</h3>';
688 704
689 705 foreach ( $pages as $page ) {
706 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
690 707 ?>
691 708 <p>
692 709 <label for="pages_<?php echo esc_html( $page['type'] ); ?>">
693 710 <?php echo esc_html( $page['label'] ); ?>
@@ -694,8 +711,9 @@
694 711 </label>
695 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 ?>
696 713 </p>
697 714 <?php
715 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
698 716 }
699 717 }
700 718
701 719 /**
@@ -709,13 +727,15 @@
709 727 }
710 728
711 729 $this->step_top( $step );
712 730
731 + // phpcs:disable Generic.WhiteSpace.ScopeIndent
713 732 ?>
714 733 <a href="#" target="_blank" rel="noopener" id="frm-redirect-link" class="<?php echo esc_attr( $step['button_class'] ); ?>">
715 734 <?php echo esc_html( $step['button_label'] ); ?>
716 735 </a>
717 736 <?php
737 + // phpcs:enable Generic.WhiteSpace.ScopeIndent
718 738
719 739 $this->step_bottom( $step );
720 740 }
721 741
@@ -725,9 +745,9 @@
725 745 * @return bool
726 746 */
727 747 protected function is_current_plugin() {
728 748 $to_redirect = get_transient( FrmOnboardingWizardController::TRANSIENT_NAME );
729 - return $to_redirect === $this->plugin_slug && empty( $this->is_complete() );
749 + return $to_redirect === $this->plugin_slug && ! $this->is_complete();
730 750 }
731 751
732 752 /**
733 753 * Override this function to indicate when install is complete.
@@ -754,11 +774,10 @@
754 774 * @return array
755 775 */
756 776 protected function previously_imported_forms() {
757 777 $imported = array();
758 - $forms = $this->form_options();
759 778
760 - foreach ( $forms as $form ) {
779 + foreach ( $this->form_options() as $form ) {
761 780 $was_imported = isset( $form['form'] ) ? FrmForm::get_id_by_key( $form['form'] ) : false;
762 781
763 782 if ( $was_imported ) {
764 783 $imported[ $form['form'] ] = $was_imported;