Completed
Pull Request — master (#141)
by Stephanie
02:25
created
classes/models/FrmFormMigrator.php 3 patches
Doc Comments   +10 added lines patch added patch discarded remove patch
@@ -167,6 +167,9 @@  discard block
 block discarded – undo
167 167
 		return $response;
168 168
 	}
169 169
 
170
+	/**
171
+	 * @param string $source_form_name
172
+	 */
170 173
 	protected function prepare_new_form( $source_id, $source_form_name ) {
171 174
 		return array(
172 175
 			'import_form_id' => $source_id,
@@ -267,6 +270,7 @@  discard block
 block discarded – undo
267 270
 	 *                            particularly the overrides in child classes, as
268 271
 	 *                            there will be no need to rebuild the converter
269 272
 	 *                            array at usage locations.
273
+	 * @return string
270 274
 	 */
271 275
 	protected function convert_field_type( $field, $use = '' ) {
272 276
 		// for reverse compat
@@ -415,6 +419,9 @@  discard block
 block discarded – undo
415 419
 		return array();
416 420
 	}
417 421
 
422
+	/**
423
+	 * @param string $type
424
+	 */
418 425
 	private function is_unsupported_field( $type ) {
419 426
 		$fields = $this->unsupported_field_types();
420 427
 
@@ -430,6 +437,9 @@  discard block
 block discarded – undo
430 437
 		return array();
431 438
 	}
432 439
 
440
+	/**
441
+	 * @param string $type
442
+	 */
433 443
 	protected function should_skip_field( $type ) {
434 444
 		$skip_pro_fields = $this->skip_pro_fields();
435 445
 
Please login to merge, or discard this patch.
Indentation   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -24,7 +24,7 @@
 block discarded – undo
24 24
 		}
25 25
 
26 26
 		if ( ! function_exists( 'is_plugin_active' ) ) {
27
-		    require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
27
+			require_once( ABSPATH . '/wp-admin/includes/plugin.php' );
28 28
 		}
29 29
 
30 30
 		$this->source_active = is_plugin_active( $this->path );
Please login to merge, or discard this patch.
Spacing   +7 added lines, -8 removed lines patch added patch discarded remove patch
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 		$form['fields'][]         = $new_field;
295 295
 		$this->current_section    = null;
296 296
 
297
-		$field_order++;
297
+		$field_order ++;
298 298
 	}
299 299
 
300 300
 	protected function before_add_field( $field, &$new_field, &$form, &$field_order ) {
@@ -320,7 +320,7 @@  discard block
 block discarded – undo
320 320
 
321 321
 		foreach ( $form['fields'] as $key => $new_field ) {
322 322
 			$new_field['form_id']         = $form_id;
323
-			$form['fields'][ $key ]['id'] = FrmField::create( $new_field );
323
+			$form['fields'][$key]['id'] = FrmField::create( $new_field );
324 324
 		}
325 325
 
326 326
 		// create emails
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 				if ( $key === 'post_title' ) {
333 333
 					$new_action->post_title = $value;
334 334
 				} else {
335
-					$new_action->post_content[ $key ] = $this->replace_smart_tags( $value, $form['fields'] );
335
+					$new_action->post_content[$key] = $this->replace_smart_tags( $value, $form['fields'] );
336 336
 				}
337 337
 			}
338 338
 
@@ -384,7 +384,7 @@  discard block
 block discarded – undo
384 384
 
385 385
 		$imported = $this->get_tracked_import();
386 386
 
387
-		$imported[ $this->slug ][ $new_form_id ] = $source_id;
387
+		$imported[$this->slug][$new_form_id] = $source_id;
388 388
 
389 389
 		update_option( $this->tracking, $imported, false );
390 390
 	}
@@ -404,11 +404,11 @@  discard block
 block discarded – undo
404 404
 	private function is_imported( $source_id ) {
405 405
 		$imported    = $this->get_tracked_import();
406 406
 		$new_form_id = 0;
407
-		if ( ! isset( $imported[ $this->slug ] ) || ! in_array( $source_id, $imported[ $this->slug ] ) ) {
407
+		if ( ! isset( $imported[$this->slug] ) || ! in_array( $source_id, $imported[$this->slug] ) ) {
408 408
 			return $new_form_id;
409 409
 		}
410 410
 
411
-		$new_form_id = array_search( $source_id, array_reverse( $imported[ $this->slug ], true ) );
411
+		$new_form_id = array_search( $source_id, array_reverse( $imported[$this->slug], true ) );
412 412
 		if ( ! empty( $new_form_id ) && empty( FrmForm::get_key_by_id( $new_form_id ) ) ) {
413 413
 			// Allow reimport if the form was deleted.
414 414
 			$new_form_id = 0;
@@ -505,8 +505,7 @@  discard block
 block discarded – undo
505 505
 	 * @return string
506 506
 	 */
507 507
 	protected function get_field_label( $field ) {
508
-		$label = is_array( $field ) ? ( isset( $field['label'] ) ? $field['label'] : '' ) :
509
-									  ( isset( $field->label )   ? $field->label   : '' );
508
+		$label = is_array( $field ) ? ( isset( $field['label'] ) ? $field['label'] : '' ) : ( isset( $field->label ) ? $field->label : '' );
510 509
 		if ( ! empty( $label ) ) {
511 510
 			return sanitize_text_field( $label );
512 511
 		}
Please login to merge, or discard this patch.