| @@ -14,9 +14,9 @@ | ||
| 14 | 14 | public $response = array(); |
| 15 | 15 | public $tracking = 'frm_forms_imported'; |
| 16 | 16 | |
| 17 | 17 | protected $fields_map = array(); |
| 18 | - protected $current_source_form = null; | |
| 18 | + protected $current_source_form; | |
| 19 | 19 | protected $current_section = array(); |
| 20 | 20 | |
| 21 | 21 | /** |
| 22 | 22 | * Define required properties. |
| @@ -26,9 +26,9 @@ | ||
| 26 | 26 | return; |
| 27 | 27 | } |
| 28 | 28 | |
| 29 | 29 | if ( ! function_exists( 'is_plugin_active' ) ) { |
| 30 | - require_once( ABSPATH . '/wp-admin/includes/plugin.php' ); | |
| 30 | + require_once ABSPATH . '/wp-admin/includes/plugin.php'; | |
| 31 | 31 | } |
| 32 | 32 | |
| 33 | 33 | $this->source_active = is_plugin_active( $this->path ); |
| 34 | 34 | if ( ! $this->source_active ) { |
| @@ -127,9 +127,9 @@ | ||
| 127 | 127 | ); |
| 128 | 128 | |
| 129 | 129 | if ( is_array( $forms ) ) { |
| 130 | 130 | $imported = array(); |
| 131 | - foreach ( (array) $forms as $form_id ) { | |
| 131 | + foreach ( $forms as $form_id ) { | |
| 132 | 132 | $imported[] = $this->import_form( $form_id ); |
| 133 | 133 | } |
| 134 | 134 | } else { |
| 135 | 135 | $imported = $this->import_form( $forms ); |
| @@ -233,18 +233,18 @@ | ||
| 233 | 233 | } |
| 234 | 234 | |
| 235 | 235 | // This may occassionally skip one level/order e.g. after adding a |
| 236 | 236 | // list field, as field_order would already be prepared to be used. |
| 237 | - $field_order ++; | |
| 237 | + ++$field_order; | |
| 238 | 238 | |
| 239 | - if ( isset( $new_field['fields'] ) && is_array( $new_field['fields'] ) && ! empty( $new_field['fields'] ) ) { | |
| 239 | + if ( ! empty( $new_field['fields'] ) && is_array( $new_field['fields'] ) ) { | |
| 240 | 240 | // we have (inner) fields to merge |
| 241 | 241 | |
| 242 | 242 | $form['fields'] = array_merge( $form['fields'], $new_field['fields'] ); |
| 243 | 243 | // set the new field_order as it would have changed |
| 244 | - $field_order = $new_field['current_order']; | |
| 244 | + $field_order = $new_field['current_order']; | |
| 245 | 245 | } |
| 246 | - } | |
| 246 | + }//end foreach | |
| 247 | 247 | } |
| 248 | 248 | |
| 249 | 249 | protected function prepare_field( $field, &$new_field ) { |
| 250 | 250 | // customize this function |
| @@ -271,9 +271,9 @@ | ||
| 271 | 271 | $open = array(); |
| 272 | 272 | |
| 273 | 273 | $order = 0; |
| 274 | 274 | foreach ( $fields as $field ) { |
| 275 | - $order ++; | |
| 275 | + ++$order; | |
| 276 | 276 | $type = $this->get_field_type( $field ); |
| 277 | 277 | $new_type = $this->convert_field_type( $type, $field ); |
| 278 | 278 | if ( ! in_array( $new_type, $with_end ) && $new_type !== 'break' ) { |
| 279 | 279 | continue; |
| @@ -301,9 +301,9 @@ | ||
| 301 | 301 | $sub = FrmFieldsHelper::setup_new_vars( 'end_divider' ); |
| 302 | 302 | $sub['name'] = __( 'Section Buttons', 'formidable' ); |
| 303 | 303 | $subs = array( $sub ); |
| 304 | 304 | $this->insert_fields_in_array( $subs, $order, 0, $fields ); |
| 305 | - $order ++; | |
| 305 | + ++$order; | |
| 306 | 306 | } |
| 307 | 307 | |
| 308 | 308 | /** |
| 309 | 309 | * Replace the original combo field with a group. |
| @@ -336,9 +336,9 @@ | ||
| 336 | 336 | /** |
| 337 | 337 | * Add the new form to the database and return AJAX data.å |
| 338 | 338 | * |
| 339 | 339 | * @param array $form Form to import. |
| 340 | - * @param array $upgrade_omit No field alternative | |
| 340 | + * @param array $upgrade_omit No field alternative. | |
| 341 | 341 | */ |
| 342 | 342 | protected function add_form( $form, $upgrade_omit = array() ) { |
| 343 | 343 | |
| 344 | 344 | // Create empty form so we have an ID to work with. |
| @@ -392,9 +392,9 @@ | ||
| 392 | 392 | |
| 393 | 393 | /** |
| 394 | 394 | * @since 4.04.03 |
| 395 | 395 | * |
| 396 | - * @param int $form_id | |
| 396 | + * @param int $form_id | |
| 397 | 397 | * @param array $form |
| 398 | 398 | */ |
| 399 | 399 | protected function create_fields( $form_id, &$form ) { |
| 400 | 400 | foreach ( $form['fields'] as $key => $new_field ) { |
| @@ -416,9 +416,11 @@ | ||
| 416 | 416 | |
| 417 | 417 | /** |
| 418 | 418 | * @since 4.04.03 |
| 419 | 419 | * |
| 420 | + * @param array $action | |
| 420 | 421 | * @param array $form |
| 422 | + * @param int $form_id | |
| 421 | 423 | */ |
| 422 | 424 | protected function save_action( $action, $form, $form_id ) { |
| 423 | 425 | $action_control = FrmFormActionsController::get_form_actions( $action['type'] ); |
| 424 | 426 | unset( $action['type'] ); |
| @@ -444,10 +446,10 @@ | ||
| 444 | 446 | * After a form has been successfully imported we track it, so that in the |
| 445 | 447 | * future we can alert users if they try to import a form that has already |
| 446 | 448 | * been imported. |
| 447 | 449 | * |
| 448 | - * @param int $source_id Imported plugin form ID | |
| 449 | - * @param int $new_form_id Formidable form ID | |
| 450 | + * @param int $source_id Imported plugin form ID. | |
| 451 | + * @param int $new_form_id Formidable form ID. | |
| 450 | 452 | */ |
| 451 | 453 | protected function track_import( $source_id, $new_form_id ) { |
| 452 | 454 | |
| 453 | 455 | $imported = $this->get_tracked_import(); |
| @@ -464,9 +466,9 @@ | ||
| 464 | 466 | return get_option( $this->tracking, array() ); |
| 465 | 467 | } |
| 466 | 468 | |
| 467 | 469 | /** |
| 468 | - * @param int $source_id Imported plugin form ID | |
| 470 | + * @param int $source_id Imported plugin form ID. | |
| 469 | 471 | * |
| 470 | 472 | * @return int the ID of the created form or 0 |
| 471 | 473 | */ |
| 472 | 474 | private function is_imported( $source_id ) { |
| @@ -518,9 +520,9 @@ | ||
| 518 | 520 | /** |
| 519 | 521 | * Replace 3rd-party form provider tags/shortcodes with our own Tags. |
| 520 | 522 | * |
| 521 | 523 | * @param string $string String to process the smart tag in. |
| 522 | - * @param array $fields List of fields for the form. | |
| 524 | + * @param array $fields List of fields for the form. | |
| 523 | 525 | * |
| 524 | 526 | * @return string |
| 525 | 527 | */ |
| 526 | 528 | protected function replace_smart_tags( $string, $fields ) { |
| @@ -540,9 +542,9 @@ | ||
| 540 | 542 | return array(); |
| 541 | 543 | } |
| 542 | 544 | |
| 543 | 545 | /** |
| 544 | - * @param object|array $source_form | |
| 546 | + * @param array|object $source_form | |
| 545 | 547 | * |
| 546 | 548 | * @return string |
| 547 | 549 | */ |
| 548 | 550 | protected function get_form_name( $source_form ) { |
| @@ -549,9 +551,9 @@ | ||
| 549 | 551 | return __( 'Default Form', 'formidable' ); |
| 550 | 552 | } |
| 551 | 553 | |
| 552 | 554 | /** |
| 553 | - * @param object|array $source_form | |
| 555 | + * @param array|object $source_form | |
| 554 | 556 | * |
| 555 | 557 | * @return array |
| 556 | 558 | */ |
| 557 | 559 | protected function get_form_fields( $source_form ) { |