| @@ -49,9 +49,8 @@ | ||
| 49 | 49 | add_action( 'wp_ajax_frm_import_' . $this->slug, array( $this, 'import_forms' ) ); |
| 50 | 50 | } |
| 51 | 51 | |
| 52 | 52 | public function import_page() { |
| 53 | - $forms = $this->get_forms(); | |
| 54 | 53 | ?> |
| 55 | 54 | <div class="wrap"> |
| 56 | 55 | <h2 class="frm-h2"><?php echo esc_html( $this->name ); ?> Importer</h2> |
| 57 | 56 | <p class="howto">Import forms and settings automatically from <?php echo esc_html( $this->name ); ?>.</p> |
| @@ -66,13 +65,13 @@ | ||
| 66 | 65 | <input type="hidden" name="slug" value="<?php echo esc_attr( $this->slug ); ?>" /> |
| 67 | 66 | <input type="hidden" name="action" value="frm_import_<?php echo esc_attr( $this->slug ); ?>" /> |
| 68 | 67 | <div style="max-width:400px;text-align:left;"> |
| 69 | 68 | <?php |
| 70 | - if ( ! $forms ) { | |
| 69 | + if ( empty( $this->get_forms() ) ) { | |
| 71 | 70 | esc_html_e( 'No Forms Found.', 'formidable' ); |
| 72 | 71 | } |
| 73 | 72 | ?> |
| 74 | - <?php foreach ( $forms as $form_id => $name ) { ?> | |
| 73 | + <?php foreach ( $this->get_forms() as $form_id => $name ) { ?> | |
| 75 | 74 | <p> |
| 76 | 75 | <label> |
| 77 | 76 | <input type="checkbox" name="form_id[]" |
| 78 | 77 | value="<?php echo esc_attr( $form_id ); ?>" checked="checked" /> |
| @@ -86,22 +85,9 @@ | ||
| 86 | 85 | </label> |
| 87 | 86 | </p> |
| 88 | 87 | <?php } ?> |
| 89 | 88 | </div> |
| 90 | - <?php | |
| 91 | - $button_atts = array( | |
| 92 | - 'type' => 'submit', | |
| 93 | - 'class' => 'button button-primary frm-button-primary', | |
| 94 | - ); | |
| 95 | - if ( ! $forms ) { | |
| 96 | - $button_atts['disabled'] = 'disabled'; | |
| 97 | - } | |
| 98 | - ?> | |
| 99 | - <p class="submit"> | |
| 100 | - <button <?php FrmAppHelper::array_to_html_params( $button_atts, true ); ?>> | |
| 101 | - <?php esc_html_e( 'Start Import', 'formidable' ); ?> | |
| 102 | - </button> | |
| 103 | - </p> | |
| 89 | + <p class="submit"><button type="submit" class="button button-primary frm-button-primary">Start Import</button></p> | |
| 104 | 90 | </form> |
| 105 | 91 | <div id="frm-importer-process" class="frm-importer-process frm_hidden"> |
| 106 | 92 | |
| 107 | 93 | <p class="process-count"> |
| @@ -110,15 +96,10 @@ | ||
| 110 | 96 | from <?php echo esc_html( $this->name ); ?>. |
| 111 | 97 | </p> |
| 112 | 98 | |
| 113 | 99 | <p class="process-completed" class="frm_hidden"> |
| 114 | - <?php | |
| 115 | - printf( | |
| 116 | - // translators: %s is the number of forms that were imported. | |
| 117 | - esc_html__( 'The import process has finished! We have successfully imported %s forms. You can review the results below.', 'formidable' ), | |
| 118 | - '<span class="forms-completed"></span>' | |
| 119 | - ); | |
| 120 | - ?> | |
| 100 | + The import process has finished! We have successfully imported | |
| 101 | + <span class="forms-completed"></span> forms. You can review the results below. | |
| 121 | 102 | </p> |
| 122 | 103 | |
| 123 | 104 | <div class="status"></div> |
| 124 | 105 | |
| @@ -440,11 +421,8 @@ | ||
| 440 | 421 | * @param array $form |
| 441 | 422 | * @param int $form_id |
| 442 | 423 | */ |
| 443 | 424 | protected function save_action( $action, $form, $form_id ) { |
| 444 | - /** | |
| 445 | - * @var FrmFormAction | |
| 446 | - */ | |
| 447 | 425 | $action_control = FrmFormActionsController::get_form_actions( $action['type'] ); |
| 448 | 426 | unset( $action['type'] ); |
| 449 | 427 | $new_action = $action_control->prepare_new( $form_id ); |
| 450 | 428 | foreach ( $action as $key => $value ) { |
| @@ -596,9 +574,9 @@ | ||
| 596 | 574 | * |
| 597 | 575 | * @return string |
| 598 | 576 | */ |
| 599 | 577 | protected function get_field_label( $field ) { |
| 600 | - $label = $field['label'] ?? ''; | |
| 578 | + $label = isset( $field['label'] ) ? $field['label'] : ''; | |
| 601 | 579 | if ( ! empty( $label ) ) { |
| 602 | 580 | return $label; |
| 603 | 581 | } |
| 604 | 582 | |