| @@ -16,9 +16,9 @@ | ||
| 16 | 16 | * @return void |
| 17 | 17 | */ |
| 18 | 18 | public static function add_default_templates() { |
| 19 | 19 | if ( FrmXMLHelper::check_if_libxml_disable_entity_loader_exists() ) { |
| 20 | - // XML import is not enabled on your server | |
| 20 | + // XML import is not enabled on your server. | |
| 21 | 21 | return; |
| 22 | 22 | } |
| 23 | 23 | |
| 24 | 24 | $set_err = libxml_use_internal_errors( true ); |
| @@ -87,9 +87,9 @@ | ||
| 87 | 87 | end( $imported['form_status'] ); |
| 88 | 88 | $form_id = key( $imported['form_status'] ); |
| 89 | 89 | $response = array( |
| 90 | 90 | 'id' => $form_id, |
| 91 | - 'redirect' => FrmForm::get_edit_link( $form_id ), | |
| 91 | + 'redirect' => FrmForm::get_edit_link( $form_id ) . '&new_template=true', | |
| 92 | 92 | 'success' => 1, |
| 93 | 93 | ); |
| 94 | 94 | if ( ! empty( $imported['imported']['posts'] ) ) { |
| 95 | 95 | // Return the link to the last page created. |
| @@ -114,9 +114,9 @@ | ||
| 114 | 114 | $response = array( |
| 115 | 115 | 'message' => $message, |
| 116 | 116 | ); |
| 117 | 117 | |
| 118 | - } | |
| 118 | + }//end if | |
| 119 | 119 | |
| 120 | 120 | $response = apply_filters( 'frm_xml_response', $response, compact( 'form', 'imported' ) ); |
| 121 | 121 | |
| 122 | 122 | echo wp_json_encode( $response ); |
| @@ -173,10 +173,10 @@ | ||
| 173 | 173 | |
| 174 | 174 | /** |
| 175 | 175 | * @since 4.06.02 |
| 176 | 176 | * |
| 177 | + * @param array $form | |
| 177 | 178 | * @param string $value |
| 178 | - * @param array $form | |
| 179 | 179 | */ |
| 180 | 180 | private static function get_selected_in_form( $form, $value = 'form' ) { |
| 181 | 181 | if ( ! empty( $form ) && isset( $form[ $value ] ) && ! empty( $form[ $value ] ) ) { |
| 182 | 182 | return $form[ $value ]; |
| @@ -229,9 +229,9 @@ | ||
| 229 | 229 | 'post_type' => 'page', |
| 230 | 230 | 'post_content' => sprintf( $shortcode, $item_key ), |
| 231 | 231 | ) |
| 232 | 232 | ); |
| 233 | - } | |
| 233 | + }//end foreach | |
| 234 | 234 | |
| 235 | 235 | return $page_ids; |
| 236 | 236 | } |
| 237 | 237 | |
| @@ -295,9 +295,9 @@ | ||
| 295 | 295 | } |
| 296 | 296 | |
| 297 | 297 | /** |
| 298 | 298 | * @param string[] $errors |
| 299 | - * @param string $message | |
| 299 | + * @param string $message | |
| 300 | 300 | * |
| 301 | 301 | * @return void |
| 302 | 302 | */ |
| 303 | 303 | public static function form( $errors = array(), $message = '' ) { |
| @@ -343,9 +343,9 @@ | ||
| 343 | 343 | |
| 344 | 344 | return; |
| 345 | 345 | } |
| 346 | 346 | |
| 347 | - $has_file = isset( $_FILES ) && isset( $_FILES['frm_import_file'] ) && ! empty( $_FILES['frm_import_file']['name'] ) && ! empty( $_FILES['frm_import_file']['size'] ) && (int) $_FILES['frm_import_file']['size'] > 0; | |
| 347 | + $has_file = ! empty( $_FILES['frm_import_file'] ) && ! empty( $_FILES['frm_import_file']['name'] ) && ! empty( $_FILES['frm_import_file']['size'] ) && (int) $_FILES['frm_import_file']['size'] > 0; | |
| 348 | 348 | if ( ! $has_file ) { |
| 349 | 349 | $errors[] = __( 'Oops, you didn\'t select a file.', 'formidable' ); |
| 350 | 350 | self::form( $errors ); |
| 351 | 351 | |
| @@ -362,10 +362,8 @@ | ||
| 362 | 362 | |
| 363 | 363 | return; |
| 364 | 364 | } |
| 365 | 365 | |
| 366 | - //add_filter('upload_mimes', 'FrmXMLController::allow_mime'); | |
| 367 | - | |
| 368 | 366 | $export_format = array( |
| 369 | 367 | 'xml' => array( |
| 370 | 368 | 'name' => 'XML', |
| 371 | 369 | 'support' => 'forms', |
| @@ -435,9 +433,10 @@ | ||
| 435 | 433 | wp_die(); |
| 436 | 434 | } |
| 437 | 435 | |
| 438 | 436 | /** |
| 439 | - * @param array $args | |
| 437 | + * @param string[] $type | |
| 438 | + * @param array $args | |
| 440 | 439 | * |
| 441 | 440 | * @psalm-param array{ids?: mixed} $args |
| 442 | 441 | * |
| 443 | 442 | * @return void |
| @@ -476,9 +475,9 @@ | ||
| 476 | 475 | $query_vars = array(); |
| 477 | 476 | |
| 478 | 477 | switch ( $tb_type ) { |
| 479 | 478 | case 'forms': |
| 480 | - //add forms | |
| 479 | + // Add forms. | |
| 481 | 480 | if ( $args['ids'] ) { |
| 482 | 481 | $where[] = array( |
| 483 | 482 | 'or' => 1, |
| 484 | 483 | $table . '.id' => $args['ids'], |
| @@ -536,13 +535,13 @@ | ||
| 536 | 535 | $where['pm.meta_value >'] = 1; |
| 537 | 536 | } else { |
| 538 | 537 | $where['pm.meta_value'] = $args['ids']; |
| 539 | 538 | } |
| 540 | - } | |
| 539 | + }//end switch | |
| 541 | 540 | |
| 542 | 541 | $records[ $tb_type ] = FrmDb::get_col( $table . $join, $where, $select ); |
| 543 | 542 | unset( $tb_type ); |
| 544 | - } | |
| 543 | + }//end foreach | |
| 545 | 544 | |
| 546 | 545 | $filename = self::get_file_name( $args, $type, $records ); |
| 547 | 546 | |
| 548 | 547 | header( 'Content-Description: File Transfer' ); |
| @@ -574,11 +573,11 @@ | ||
| 574 | 573 | * Use the nme of the form if only one form is exported. |
| 575 | 574 | * |
| 576 | 575 | * @since 3.06 |
| 577 | 576 | * |
| 577 | + * @param array $args | |
| 578 | 578 | * @param array $type |
| 579 | 579 | * @param array $records |
| 580 | - * @param array $args | |
| 581 | 580 | * |
| 582 | 581 | * @return string |
| 583 | 582 | */ |
| 584 | 583 | private static function get_file_name( $args, $type, $records ) { |
| @@ -603,9 +602,9 @@ | ||
| 603 | 602 | if ( ! empty( $sitename ) ) { |
| 604 | 603 | $sitename .= '.'; |
| 605 | 604 | } |
| 606 | 605 | $filename = $sitename . 'formidable.' . gmdate( 'Y-m-d' ) . '.xml'; |
| 607 | - } | |
| 606 | + }//end if | |
| 608 | 607 | |
| 609 | 608 | /** |
| 610 | 609 | * @since 5.3 |
| 611 | 610 | * |
| @@ -642,9 +641,10 @@ | ||
| 642 | 641 | $search = FrmAppHelper::get_param( ( isset( $_REQUEST['s'] ) ? 's' : 'search' ), '', 'get', 'sanitize_text_field' ); |
| 643 | 642 | $fid = FrmAppHelper::get_param( 'fid', '', 'get', 'sanitize_text_field' ); |
| 644 | 643 | } |
| 645 | 644 | |
| 646 | - set_time_limit( 0 ); //Remove time limit to execute this function | |
| 645 | + // Remove time limit to execute this function. | |
| 646 | + set_time_limit( 0 ); | |
| 647 | 647 | $mem_limit = str_replace( 'M', '', ini_get( 'memory_limit' ) ); |
| 648 | 648 | if ( (int) $mem_limit < 256 ) { |
| 649 | 649 | wp_raise_memory_limit(); |
| 650 | 650 | } |
| @@ -699,9 +699,9 @@ | ||
| 699 | 699 | * |
| 700 | 700 | * @since 2.0.19 |
| 701 | 701 | * @since 5.0.16 function went from private to public. |
| 702 | 702 | * |
| 703 | - * @param int $form_id | |
| 703 | + * @param int $form_id | |
| 704 | 704 | * @param object $form |
| 705 | 705 | * |
| 706 | 706 | * @return array $csv_fields |
| 707 | 707 | */ |