PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / 6.21
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More v6.21
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/FrmFormMigrator.php +24 -19 6.56.21 View file →
@@ -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 );
@@ -231,20 +231,20 @@
231 231 } elseif ( $new_type === 'break' || $new_type === 'end_divider' ) {
232 232 $this->current_section = array();
233 233 }
234 234
235 - // This may occassionally skip one level/order e.g. after adding a
235 + // This may occasionally 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.
@@ -325,9 +325,9 @@
325 325 * array at usage locations.
326 326 */
327 327 protected function convert_field_type( $type, $field = array(), $use = '' ) {
328 328 if ( empty( $field ) ) {
329 - // For reverse compatability.
329 + // For reverse compatibility.
330 330 return $type;
331 331 }
332 332
333 333 return $use ? $use : $field['type'];
@@ -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,11 +416,16 @@
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 ) {
425 + /**
426 + * @var FrmFormAction
427 + */
423 428 $action_control = FrmFormActionsController::get_form_actions( $action['type'] );
424 429 unset( $action['type'] );
425 430 $new_action = $action_control->prepare_new( $form_id );
426 431 foreach ( $action as $key => $value ) {
@@ -444,10 +449,10 @@
444 449 * After a form has been successfully imported we track it, so that in the
445 450 * future we can alert users if they try to import a form that has already
446 451 * been imported.
447 452 *
448 - * @param int $source_id Imported plugin form ID
449 - * @param int $new_form_id Formidable form ID
453 + * @param int $source_id Imported plugin form ID.
454 + * @param int $new_form_id Formidable form ID.
450 455 */
451 456 protected function track_import( $source_id, $new_form_id ) {
452 457
453 458 $imported = $this->get_tracked_import();
@@ -464,9 +469,9 @@
464 469 return get_option( $this->tracking, array() );
465 470 }
466 471
467 472 /**
468 - * @param int $source_id Imported plugin form ID
473 + * @param int $source_id Imported plugin form ID.
469 474 *
470 475 * @return int the ID of the created form or 0
471 476 */
472 477 private function is_imported( $source_id ) {
@@ -518,9 +523,9 @@
518 523 /**
519 524 * Replace 3rd-party form provider tags/shortcodes with our own Tags.
520 525 *
521 526 * @param string $string String to process the smart tag in.
522 - * @param array $fields List of fields for the form.
527 + * @param array $fields List of fields for the form.
523 528 *
524 529 * @return string
525 530 */
526 531 protected function replace_smart_tags( $string, $fields ) {
@@ -540,9 +545,9 @@
540 545 return array();
541 546 }
542 547
543 548 /**
544 - * @param object|array $source_form
549 + * @param array|object $source_form
545 550 *
546 551 * @return string
547 552 */
548 553 protected function get_form_name( $source_form ) {
@@ -549,9 +554,9 @@
549 554 return __( 'Default Form', 'formidable' );
550 555 }
551 556
552 557 /**
553 - * @param object|array $source_form
558 + * @param array|object $source_form
554 559 *
555 560 * @return array
556 561 */
557 562 protected function get_form_fields( $source_form ) {