Completed
Push — master ( 6680ae...68e551 )
by
unknown
20s
created
classes/models/FrmEntryMeta.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -58,7 +58,7 @@  discard block
 block discarded – undo
58 58
 
59 59
 		global $wpdb;
60 60
 
61
-		$values               = array(
61
+		$values = array(
62 62
 			'item_id'  => $entry_id,
63 63
 			'field_id' => $field_id,
64 64
 		);
@@ -138,7 +138,7 @@  discard block
 block discarded – undo
138 138
 				}
139 139
 			}
140 140
 
141
-			$values_indexed_by_field_id[ $field_id ] = $meta_value;
141
+			$values_indexed_by_field_id[$field_id] = $meta_value;
142 142
 
143 143
 			self::get_value_to_save( compact( 'field', 'field_id', 'entry_id' ), $meta_value );
144 144
 
@@ -146,7 +146,7 @@  discard block
 block discarded – undo
146 146
 
147 147
 				if ( ( is_array( $meta_value ) && empty( $meta_value ) ) || ( ! is_array( $meta_value ) && trim( $meta_value ) === '' ) ) {
148 148
 					// Remove blank fields.
149
-					unset( $values_indexed_by_field_id[ $field_id ] );
149
+					unset( $values_indexed_by_field_id[$field_id] );
150 150
 				} else {
151 151
 					// if value exists, then update it
152 152
 					self::update_entry_meta( $entry_id, $field_id, '', $meta_value );
@@ -224,7 +224,7 @@  discard block
 block discarded – undo
224 224
 	 */
225 225
 	public static function get_meta_value( $entry, $field_id ) {
226 226
 		if ( isset( $entry->metas ) ) {
227
-			return $entry->metas[ $field_id ] ?? false;
227
+			return $entry->metas[$field_id] ?? false;
228 228
 		}
229 229
 		return self::get_entry_meta_by_field( $entry->id, $field_id );
230 230
 	}
@@ -246,8 +246,8 @@  discard block
 block discarded – undo
246 246
 			$cached   = FrmDb::check_cache( $entry_id, 'frm_entry' );
247 247
 		}
248 248
 
249
-		if ( $cached && isset( $cached->metas ) && isset( $cached->metas[ $field_id ] ) ) {
250
-			$result = $cached->metas[ $field_id ];
249
+		if ( $cached && isset( $cached->metas ) && isset( $cached->metas[$field_id] ) ) {
250
+			$result = $cached->metas[$field_id];
251 251
 
252 252
 			return wp_unslash( $result );
253 253
 		}
@@ -280,7 +280,7 @@  discard block
 block discarded – undo
280 280
 			'stripslashes' => true,
281 281
 			'is_draft'     => false,
282 282
 		);
283
-		$args     = wp_parse_args( $args, $defaults );
283
+		$args = wp_parse_args( $args, $defaults );
284 284
 
285 285
 		$query = array();
286 286
 		self::meta_field_query( $field_id, $order, $limit, $args, $query );
@@ -295,7 +295,7 @@  discard block
 block discarded – undo
295 295
 
296 296
 		foreach ( $values as $k => $v ) {
297 297
 			FrmAppHelper::unserialize_or_decode( $v );
298
-			$values[ $k ] = $v;
298
+			$values[$k] = $v;
299 299
 			unset( $k, $v );
300 300
 		}
301 301
 
@@ -362,7 +362,7 @@  discard block
 block discarded – undo
362 362
 
363 363
 		foreach ( $results as $k => $result ) {
364 364
 			FrmAppHelper::unserialize_or_decode( $result->meta_value );
365
-			$results[ $k ]->meta_value = wp_unslash( $result->meta_value );
365
+			$results[$k]->meta_value = wp_unslash( $result->meta_value );
366 366
 			unset( $k, $result );
367 367
 		}
368 368
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 			'user_id'  => '',
376 376
 			'group_by' => '',
377 377
 		);
378
-		$args     = wp_parse_args( $args, $defaults );
378
+		$args = wp_parse_args( $args, $defaults );
379 379
 
380 380
 		$query = array();
381 381
 		self::get_ids_query( $where, $order_by, $limit, $unique, $args, $query );
@@ -478,7 +478,7 @@  discard block
 block discarded – undo
478 478
 			} elseif ( false !== strpos( $args['is_draft'], ',' ) ) {
479 479
 				$is_draft = array_reduce(
480 480
 					explode( ',', $args['is_draft'] ),
481
-					function ( $total, $current ) {
481
+					function( $total, $current ) {
482 482
 						if ( is_numeric( $current ) ) {
483 483
 							$total[] = absint( $current );
484 484
 						}
Please login to merge, or discard this patch.
classes/helpers/FrmXMLHelper.php 1 patch
Spacing   +101 added lines, -101 removed lines patch added patch discarded remove patch
@@ -96,7 +96,7 @@  discard block
 block discarded – undo
96 96
 				$content_before_channel_tag,
97 97
 				1
98 98
 			);
99
-			$xml_string                 = $content_before_channel_tag . substr( $xml_string, $channel_start_position );
99
+			$xml_string = $content_before_channel_tag . substr( $xml_string, $channel_start_position );
100 100
 		}
101 101
 	}
102 102
 
@@ -185,8 +185,8 @@  discard block
 block discarded – undo
185 185
 			);
186 186
 
187 187
 			if ( $term && is_array( $term ) ) {
188
-				++$imported['imported']['terms'];
189
-				$imported['terms'][ (int) $t->term_id ] = $term['term_id'];
188
+				++ $imported['imported']['terms'];
189
+				$imported['terms'][(int) $t->term_id] = $term['term_id'];
190 190
 			}
191 191
 
192 192
 			unset( $term, $t );
@@ -246,11 +246,11 @@  discard block
 block discarded – undo
246 246
 				if ( $form_id ) {
247 247
 					if ( empty( $form['parent_form_id'] ) ) {
248 248
 						// Don't include the repeater form in the imported count.
249
-						++$imported['imported']['forms'];
249
+						++ $imported['imported']['forms'];
250 250
 					}
251 251
 
252 252
 					// Keep track of whether this specific form was updated or not.
253
-					$imported['form_status'][ $form_id ] = 'imported';
253
+					$imported['form_status'][$form_id] = 'imported';
254 254
 				}
255 255
 			}
256 256
 
@@ -265,7 +265,7 @@  discard block
 block discarded – undo
265 265
 			// Update field ids/keys to new ones.
266 266
 			do_action( 'frm_after_duplicate_form', $form_id, $form, array( 'old_id' => $old_id ) );
267 267
 
268
-			$imported['forms'][ (int) $item->id ] = $form_id;
268
+			$imported['forms'][(int) $item->id] = $form_id;
269 269
 
270 270
 			// Send pre 2.0 form options through function that creates actions.
271 271
 			self::migrate_form_settings_to_actions( $form['options'], $form_id, $imported, true );
@@ -335,19 +335,19 @@  discard block
 block discarded – undo
335 335
 		FrmForm::update( $form_id, $form );
336 336
 		if ( empty( $form['parent_form_id'] ) ) {
337 337
 			// Don't include the repeater form in the updated count.
338
-			++$imported['updated']['forms'];
338
+			++ $imported['updated']['forms'];
339 339
 		}
340 340
 
341 341
 		// Keep track of whether this specific form was updated or not
342
-		$imported['form_status'][ $form_id ] = 'updated';
342
+		$imported['form_status'][$form_id] = 'updated';
343 343
 	}
344 344
 
345 345
 	private static function get_form_fields( $form_id ) {
346 346
 		$form_fields = FrmField::get_all_for_form( $form_id, '', 'exclude', 'exclude' );
347 347
 		$old_fields  = array();
348 348
 		foreach ( $form_fields as $f ) {
349
-			$old_fields[ $f->id ]        = $f;
350
-			$old_fields[ $f->field_key ] = $f->id;
349
+			$old_fields[$f->id]        = $f;
350
+			$old_fields[$f->field_key] = $f->id;
351 351
 			unset( $f );
352 352
 		}
353 353
 		$form_fields = $old_fields;
@@ -404,7 +404,7 @@  discard block
 block discarded – undo
404 404
 	 */
405 405
 	private static function track_imported_child_forms( $form_id, $parent_form_id, &$child_forms ) {
406 406
 		if ( $parent_form_id ) {
407
-			$child_forms[ $form_id ] = $parent_form_id;
407
+			$child_forms[$form_id] = $parent_form_id;
408 408
 		}
409 409
 	}
410 410
 
@@ -419,9 +419,9 @@  discard block
 block discarded – undo
419 419
 	 */
420 420
 	private static function maybe_update_child_form_parent_id( $imported_forms, $child_forms ) {
421 421
 		foreach ( $child_forms as $child_form_id => $old_parent_form_id ) {
422
-			if ( isset( $imported_forms[ $old_parent_form_id ] ) && (int) $imported_forms[ $old_parent_form_id ] !== (int) $old_parent_form_id ) {
422
+			if ( isset( $imported_forms[$old_parent_form_id] ) && (int) $imported_forms[$old_parent_form_id] !== (int) $old_parent_form_id ) {
423 423
 				// Update all children with this old parent_form_id
424
-				$new_parent_form_id = (int) $imported_forms[ $old_parent_form_id ];
424
+				$new_parent_form_id = (int) $imported_forms[$old_parent_form_id];
425 425
 				FrmForm::update( $child_form_id, array( 'parent_form_id' => $new_parent_form_id ) );
426 426
 				do_action( 'frm_update_child_form_parent_id', $child_form_id, $new_parent_form_id );
427 427
 			}
@@ -451,34 +451,34 @@  discard block
 block discarded – undo
451 451
 
452 452
 			if ( ! empty( $this_form ) ) {
453 453
 				// check for field to edit by field id
454
-				if ( isset( $form_fields[ $f['id'] ] ) ) {
454
+				if ( isset( $form_fields[$f['id']] ) ) {
455 455
 					FrmField::update( $f['id'], $f );
456
-					++$imported['updated']['fields'];
456
+					++ $imported['updated']['fields'];
457 457
 
458
-					unset( $form_fields[ $f['id'] ] );
458
+					unset( $form_fields[$f['id']] );
459 459
 
460 460
 					// Unset old field key.
461
-					if ( isset( $form_fields[ $f['field_key'] ] ) ) {
462
-						unset( $form_fields[ $f['field_key'] ] );
461
+					if ( isset( $form_fields[$f['field_key']] ) ) {
462
+						unset( $form_fields[$f['field_key']] );
463 463
 					}
464
-				} elseif ( isset( $form_fields[ $f['field_key'] ] ) ) {
465
-					$keys_by_original_field_id[ $f['id'] ] = $f['field_key'];
464
+				} elseif ( isset( $form_fields[$f['field_key']] ) ) {
465
+					$keys_by_original_field_id[$f['id']] = $f['field_key'];
466 466
 
467 467
 					$old_field_id = $f['id'];
468 468
 
469 469
 					// check for field to edit by field key
470 470
 					unset( $f['id'] );
471 471
 
472
-					FrmField::update( $form_fields[ $f['field_key'] ], $f );
473
-					++$imported['updated']['fields'];
472
+					FrmField::update( $form_fields[$f['field_key']], $f );
473
+					++ $imported['updated']['fields'];
474 474
 
475 475
 					self::do_after_field_imported_action( $f, $form_fields, $old_field_id );
476 476
 
477 477
 					// Unset old field id.
478
-					unset( $form_fields[ $form_fields[ $f['field_key'] ] ] );
478
+					unset( $form_fields[$form_fields[$f['field_key']]] );
479 479
 
480 480
 					// Unset old field key.
481
-					unset( $form_fields[ $f['field_key'] ] );
481
+					unset( $form_fields[$f['field_key']] );
482 482
 				} else {
483 483
 					// If no matching field id or key in this form, create the field.
484 484
 					self::create_imported_field( $f, $imported );
@@ -518,7 +518,7 @@  discard block
 block discarded – undo
518 518
 	 */
519 519
 	private static function do_after_field_imported_action( $field_array, $form_fields, $old_field_id ) {
520 520
 		// Assign field array the update field's ID.
521
-		$field_array['id'] = $form_fields[ $field_array['field_key'] ];
521
+		$field_array['id'] = $form_fields[$field_array['field_key']];
522 522
 
523 523
 		/**
524 524
 		 * Fires when an existing field is imported.
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 		 * @param int   $field_id
530 530
 		 * @param int   $old_field_id
531 531
 		 */
532
-		do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[ $field_array['field_key'] ], $old_field_id );
532
+		do_action( 'frm_after_existing_field_is_imported', $field_array, $form_fields[$field_array['field_key']], $old_field_id );
533 533
 	}
534 534
 
535 535
 	private static function fill_field( $field, $form_id ) {
@@ -625,8 +625,8 @@  discard block
 block discarded – undo
625 625
 		if ( $f['type'] === 'form' || ( $f['type'] === 'divider' && FrmField::is_option_true( $f['field_options'], 'repeat' ) ) ) {
626 626
 			if ( FrmField::is_option_true( $f['field_options'], 'form_select' ) ) {
627 627
 				$form_select = (int) $f['field_options']['form_select'];
628
-				if ( isset( $imported['forms'][ $form_select ] ) ) {
629
-					$f['field_options']['form_select'] = $imported['forms'][ $form_select ];
628
+				if ( isset( $imported['forms'][$form_select] ) ) {
629
+					$f['field_options']['form_select'] = $imported['forms'][$form_select];
630 630
 				}
631 631
 			}
632 632
 		}
@@ -647,8 +647,8 @@  discard block
 block discarded – undo
647 647
 
648 648
 		if ( FrmField::is_option_true_in_array( $f['field_options'], 'get_values_form' ) ) {
649 649
 			$old_form = $f['field_options']['get_values_form'];
650
-			if ( isset( $imported['forms'][ $old_form ] ) ) {
651
-				$f['field_options']['get_values_form'] = $imported['forms'][ $old_form ];
650
+			if ( isset( $imported['forms'][$old_form] ) ) {
651
+				$f['field_options']['get_values_form'] = $imported['forms'][$old_form];
652 652
 			}
653 653
 		}
654 654
 	}
@@ -669,12 +669,12 @@  discard block
 block discarded – undo
669 669
 	private static function migrate_placeholders( &$f ) {
670 670
 		$update_values = self::migrate_field_placeholder( $f, 'clear_on_focus' );
671 671
 		foreach ( $update_values as $k => $v ) {
672
-			$f[ $k ] = $v;
672
+			$f[$k] = $v;
673 673
 		}
674 674
 
675 675
 		$update_values = self::migrate_field_placeholder( $f, 'default_blank' );
676 676
 		foreach ( $update_values as $k => $v ) {
677
-			$f[ $k ] = $v;
677
+			$f[$k] = $v;
678 678
 		}
679 679
 	}
680 680
 
@@ -688,7 +688,7 @@  discard block
 block discarded – undo
688 688
 	public static function migrate_field_placeholder( $field, $type ) {
689 689
 		$field         = (array) $field;
690 690
 		$field_options = $field['field_options'];
691
-		if ( empty( $field_options[ $type ] ) || empty( $field['default_value'] ) ) {
691
+		if ( empty( $field_options[$type] ) || empty( $field['default_value'] ) ) {
692 692
 			return array();
693 693
 		}
694 694
 
@@ -714,7 +714,7 @@  discard block
 block discarded – undo
714 714
 				}
715 715
 
716 716
 				if ( $opt == $default_value ) {
717
-					unset( $options[ $opt_key ] );
717
+					unset( $options[$opt_key] );
718 718
 					break;
719 719
 				}
720 720
 			}
@@ -741,7 +741,7 @@  discard block
 block discarded – undo
741 741
 
742 742
 		$new_id = FrmField::create( $f );
743 743
 		if ( $new_id != false ) {
744
-			++$imported['imported']['fields'];
744
+			++ $imported['imported']['fields'];
745 745
 			do_action( 'frm_after_field_is_imported', $f, $new_id );
746 746
 		}
747 747
 	}
@@ -770,10 +770,10 @@  discard block
 block discarded – undo
770 770
 
771 771
 			$image_id = FrmProFileImport::import_attachment( $option['src'], $field_object );
772 772
 			// Remove the src from options as it isn't required after import.
773
-			unset( $field['options'][ $key ]['src'] );
773
+			unset( $field['options'][$key]['src'] );
774 774
 
775 775
 			if ( is_numeric( $image_id ) ) {
776
-				$field['options'][ $key ]['image'] = $image_id;
776
+				$field['options'][$key]['image'] = $image_id;
777 777
 			}
778 778
 		}
779 779
 
@@ -955,8 +955,8 @@  discard block
 block discarded – undo
955 955
 			} else {
956 956
 				if ( $post['post_type'] === 'frm_display' ) {
957 957
 					$post['post_content'] = self::maybe_prepare_json_view_content( $post['post_content'] );
958
-				} elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][ $post['post_parent'] ] ) ) {
959
-					$post['post_parent'] = $imported['posts'][ $post['post_parent'] ];
958
+				} elseif ( 'page' === $post['post_type'] && isset( $imported['posts'][$post['post_parent']] ) ) {
959
+					$post['post_parent'] = $imported['posts'][$post['post_parent']];
960 960
 				}
961 961
 				// Create/update post now
962 962
 				$post_id = wp_insert_post( $post );
@@ -967,27 +967,27 @@  discard block
 block discarded – undo
967 967
 			}
968 968
 
969 969
 			if ( false !== strpos( $post['post_content'], '[display-frm-data' ) || false !== strpos( $post['post_content'], '[formidable' ) ) {
970
-				$posts_with_shortcodes[ $post_id ] = $post;
970
+				$posts_with_shortcodes[$post_id] = $post;
971 971
 			}
972 972
 
973 973
 			self::update_postmeta( $post, $post_id );
974 974
 			self::update_layout( $post, $post_id );
975 975
 
976 976
 			$this_type = 'posts';
977
-			if ( isset( $post_types[ $post['post_type'] ] ) ) {
978
-				$this_type = $post_types[ $post['post_type'] ];
977
+			if ( isset( $post_types[$post['post_type']] ) ) {
978
+				$this_type = $post_types[$post['post_type']];
979 979
 			}
980 980
 
981 981
 			if ( isset( $post['ID'] ) && $post_id == $post['ID'] ) {
982
-				++$imported['updated'][ $this_type ];
982
+				++ $imported['updated'][$this_type];
983 983
 			} else {
984
-				++$imported['imported'][ $this_type ];
984
+				++ $imported['imported'][$this_type];
985 985
 			}
986 986
 
987
-			$imported['posts'][ $old_id ] = $post_id;
987
+			$imported['posts'][$old_id] = $post_id;
988 988
 
989 989
 			if ( $post['post_type'] === 'frm_display' ) {
990
-				$view_ids[ $old_id ] = $post_id;
990
+				$view_ids[$old_id] = $post_id;
991 991
 			}
992 992
 
993 993
 			do_action( 'frm_after_import_view', $post_id, $post );
@@ -1148,9 +1148,9 @@  discard block
 block discarded – undo
1148 1148
 			$post['attachment_url'] = (string) $item->attachment_url;
1149 1149
 		}
1150 1150
 
1151
-		if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][ (int) $post['menu_order'] ] ) ) {
1151
+		if ( $post['post_type'] == FrmFormActionsController::$action_post_type && isset( $imported['forms'][(int) $post['menu_order']] ) ) {
1152 1152
 			// update to new form id
1153
-			$post['menu_order'] = $imported['forms'][ (int) $post['menu_order'] ];
1153
+			$post['menu_order'] = $imported['forms'][(int) $post['menu_order']];
1154 1154
 		}
1155 1155
 
1156 1156
 		// Don't allow default styles to take over a site's default style
@@ -1187,8 +1187,8 @@  discard block
 block discarded – undo
1187 1187
 		);
1188 1188
 
1189 1189
 		// Switch old form and field ids to new ones.
1190
-		if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][ (int) $m['value'] ] ) ) {
1191
-			$m['value'] = $imported['forms'][ (int) $m['value'] ];
1190
+		if ( 'frm_form_id' === $m['key'] && isset( $imported['forms'][(int) $m['value']] ) ) {
1191
+			$m['value'] = $imported['forms'][(int) $m['value']];
1192 1192
 		} else {
1193 1193
 			$m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
1194 1194
 
@@ -1199,23 +1199,23 @@  discard block
 block discarded – undo
1199 1199
 				} elseif ( 'frm_options' === $m['key'] ) {
1200 1200
 
1201 1201
 					foreach ( array( 'date_field_id', 'edate_field_id' ) as $setting_name ) {
1202
-						if ( isset( $m['value'][ $setting_name ] ) && is_numeric( $m['value'][ $setting_name ] ) && isset( $frm_duplicate_ids[ $m['value'][ $setting_name ] ] ) ) {
1203
-							$m['value'][ $setting_name ] = $frm_duplicate_ids[ $m['value'][ $setting_name ] ];
1202
+						if ( isset( $m['value'][$setting_name] ) && is_numeric( $m['value'][$setting_name] ) && isset( $frm_duplicate_ids[$m['value'][$setting_name]] ) ) {
1203
+							$m['value'][$setting_name] = $frm_duplicate_ids[$m['value'][$setting_name]];
1204 1204
 						}
1205 1205
 					}
1206 1206
 
1207 1207
 					if ( ! empty( $m['value']['map_address_fields'] ) ) {
1208 1208
 						foreach ( $m['value']['map_address_fields'] as $address_field_key => $address_field_id ) {
1209
-							if ( isset( $frm_duplicate_ids[ $address_field_id ] ) ) {
1210
-								$m['value']['map_address_fields'][ $address_field_key ] = $frm_duplicate_ids[ $address_field_id ];
1209
+							if ( isset( $frm_duplicate_ids[$address_field_id] ) ) {
1210
+								$m['value']['map_address_fields'][$address_field_key] = $frm_duplicate_ids[$address_field_id];
1211 1211
 							}
1212 1212
 						}
1213 1213
 					}
1214 1214
 
1215 1215
 					if ( ! empty( $m['value']['calendar_options'] ) ) {
1216 1216
 						foreach ( $m['value']['calendar_options'] as $calendar_option_group_key => $calendar_option ) {
1217
-							if ( isset( $frm_duplicate_ids[ $calendar_option['value'] ] ) ) {
1218
-								$m['value']['calendar_options'][ $calendar_option_group_key ]['value'] = $frm_duplicate_ids[ $calendar_option['value'] ];
1217
+							if ( isset( $frm_duplicate_ids[$calendar_option['value']] ) ) {
1218
+								$m['value']['calendar_options'][$calendar_option_group_key]['value'] = $frm_duplicate_ids[$calendar_option['value']];
1219 1219
 							}
1220 1220
 						}
1221 1221
 					}
@@ -1223,8 +1223,8 @@  discard block
 block discarded – undo
1223 1223
 					if ( ! empty( $m['value']['timeline_options'] ) ) {
1224 1224
 						foreach ( $m['value']['timeline_options'] as $timeline_option_group_key => $timeline_group_option ) {
1225 1225
 							foreach ( $timeline_group_option as $timeline_option_key => $timeline_option ) {
1226
-								if ( isset( $frm_duplicate_ids[ $timeline_option ] ) ) {
1227
-									$m['value']['timeline_options'][ $timeline_option_group_key ][ $timeline_option_key ] = $frm_duplicate_ids[ $timeline_option ];
1226
+								if ( isset( $frm_duplicate_ids[$timeline_option] ) ) {
1227
+									$m['value']['timeline_options'][$timeline_option_group_key][$timeline_option_key] = $frm_duplicate_ids[$timeline_option];
1228 1228
 								}
1229 1229
 							}
1230 1230
 						}
@@ -1232,8 +1232,8 @@  discard block
 block discarded – undo
1232 1232
 
1233 1233
 					$check_dup_array = array();
1234 1234
 					if ( ! empty( $m['value']['order_by'] ) ) {
1235
-						if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[ $m['value']['order_by'] ] ) ) {
1236
-							$m['value']['order_by'] = $frm_duplicate_ids[ $m['value']['order_by'] ];
1235
+						if ( is_numeric( $m['value']['order_by'] ) && isset( $frm_duplicate_ids[$m['value']['order_by']] ) ) {
1236
+							$m['value']['order_by'] = $frm_duplicate_ids[$m['value']['order_by']];
1237 1237
 						} elseif ( is_array( $m['value']['order_by'] ) ) {
1238 1238
 							$check_dup_array[] = 'order_by';
1239 1239
 						}
@@ -1244,9 +1244,9 @@  discard block
 block discarded – undo
1244 1244
 					}
1245 1245
 
1246 1246
 					foreach ( $check_dup_array as $check_k ) {
1247
-						foreach ( (array) $m['value'][ $check_k ] as $mk => $mv ) {
1248
-							if ( isset( $frm_duplicate_ids[ $mv ] ) ) {
1249
-								$m['value'][ $check_k ][ $mk ] = $frm_duplicate_ids[ $mv ];
1247
+						foreach ( (array) $m['value'][$check_k] as $mk => $mv ) {
1248
+							if ( isset( $frm_duplicate_ids[$mv] ) ) {
1249
+								$m['value'][$check_k][$mk] = $frm_duplicate_ids[$mv];
1250 1250
 							}
1251 1251
 							unset( $mk, $mv );
1252 1252
 						}
@@ -1259,11 +1259,11 @@  discard block
 block discarded – undo
1259 1259
 			$m['value'] = FrmAppHelper::maybe_json_decode( $m['value'] );
1260 1260
 		}
1261 1261
 
1262
-		$post['postmeta'][ (string) $meta->meta_key ] = $m['value'];
1262
+		$post['postmeta'][(string) $meta->meta_key] = $m['value'];
1263 1263
 	}
1264 1264
 
1265 1265
 	private static function populate_layout( &$post, $layout ) {
1266
-		$post['layout'][ (string) $layout->type ] = (string) $layout->data;
1266
+		$post['layout'][(string) $layout->type] = (string) $layout->data;
1267 1267
 	}
1268 1268
 
1269 1269
 	/**
@@ -1291,11 +1291,11 @@  discard block
 block discarded – undo
1291 1291
 				$name = (string) $c;
1292 1292
 			}
1293 1293
 
1294
-			if ( ! isset( $post['tax_input'][ $taxonomy ] ) ) {
1295
-				$post['tax_input'][ $taxonomy ] = array();
1294
+			if ( ! isset( $post['tax_input'][$taxonomy] ) ) {
1295
+				$post['tax_input'][$taxonomy] = array();
1296 1296
 			}
1297 1297
 
1298
-			$post['tax_input'][ $taxonomy ][] = $name;
1298
+			$post['tax_input'][$taxonomy][] = $name;
1299 1299
 			unset( $name );
1300 1300
 		}//end foreach
1301 1301
 	}
@@ -1435,7 +1435,7 @@  discard block
 block discarded – undo
1435 1435
 
1436 1436
 		$message = '<ul>';
1437 1437
 		foreach ( $result as $type => $results ) {
1438
-			if ( ! isset( $t_strings[ $type ] ) ) {
1438
+			if ( ! isset( $t_strings[$type] ) ) {
1439 1439
 				// only print imported and updated
1440 1440
 				continue;
1441 1441
 			}
@@ -1447,7 +1447,7 @@  discard block
 block discarded – undo
1447 1447
 			}
1448 1448
 
1449 1449
 			if ( ! empty( $s_message ) ) {
1450
-				$message .= '<li><strong>' . $t_strings[ $type ] . ':</strong> ';
1450
+				$message .= '<li><strong>' . $t_strings[$type] . ':</strong> ';
1451 1451
 				$message .= implode( ', ', $s_message );
1452 1452
 				$message .= '</li>';
1453 1453
 			}
@@ -1499,8 +1499,8 @@  discard block
 block discarded – undo
1499 1499
 			'actions' => sprintf( _n( '%1$s Form Action', '%1$s Form Actions', $m, 'formidable' ), $m ),
1500 1500
 		);
1501 1501
 
1502
-		if ( isset( $strings[ $type ] ) ) {
1503
-			$s_message[] = $strings[ $type ];
1502
+		if ( isset( $strings[$type] ) ) {
1503
+			$s_message[] = $strings[$type];
1504 1504
 		} else {
1505 1505
 			$string = ' ' . $m . ' ' . ucfirst( $type );
1506 1506
 
@@ -1648,7 +1648,7 @@  discard block
 block discarded – undo
1648 1648
 
1649 1649
 		foreach ( $options as $key => $option ) {
1650 1650
 			if ( is_array( $option ) && ! empty( $option['image'] ) ) {
1651
-				$options[ $key ]['src'] = wp_get_attachment_url( $option['image'] );
1651
+				$options[$key]['src'] = wp_get_attachment_url( $option['image'] );
1652 1652
 				$updated                = true;
1653 1653
 			}
1654 1654
 		}
@@ -1677,8 +1677,8 @@  discard block
 block discarded – undo
1677 1677
 	 */
1678 1678
 	private static function remove_defaults( $defaults, &$saved ) {
1679 1679
 		foreach ( $saved as $key => $value ) {
1680
-			if ( isset( $defaults[ $key ] ) && $defaults[ $key ] === $value ) {
1681
-				unset( $saved[ $key ] );
1680
+			if ( isset( $defaults[$key] ) && $defaults[$key] === $value ) {
1681
+				unset( $saved[$key] );
1682 1682
 			}
1683 1683
 		}
1684 1684
 	}
@@ -1689,14 +1689,14 @@  discard block
 block discarded – undo
1689 1689
 	 * @since 3.06
1690 1690
 	 */
1691 1691
 	private static function remove_default_html( $html_name, $defaults, &$options ) {
1692
-		if ( ! isset( $options[ $html_name ] ) || ! isset( $defaults[ $html_name ] ) ) {
1692
+		if ( ! isset( $options[$html_name] ) || ! isset( $defaults[$html_name] ) ) {
1693 1693
 			return;
1694 1694
 		}
1695 1695
 
1696
-		$old_html     = str_replace( "\r\n", "\n", $options[ $html_name ] );
1697
-		$default_html = $defaults[ $html_name ];
1696
+		$old_html     = str_replace( "\r\n", "\n", $options[$html_name] );
1697
+		$default_html = $defaults[$html_name];
1698 1698
 		if ( $old_html == $default_html ) {
1699
-			unset( $options[ $html_name ] );
1699
+			unset( $options[$html_name] );
1700 1700
 
1701 1701
 			return;
1702 1702
 		}
@@ -1704,7 +1704,7 @@  discard block
 block discarded – undo
1704 1704
 		// Account for some of the older field default HTML.
1705 1705
 		$default_html = str_replace( ' id="frm_desc_field_[key]"', '', $default_html );
1706 1706
 		if ( $old_html === $default_html ) {
1707
-			unset( $options[ $html_name ] );
1707
+			unset( $options[$html_name] );
1708 1708
 		}
1709 1709
 	}
1710 1710
 
@@ -1795,8 +1795,8 @@  discard block
 block discarded – undo
1795 1795
 		);
1796 1796
 
1797 1797
 		foreach ( $post_settings as $post_setting ) {
1798
-			if ( isset( $form_options[ $post_setting ] ) ) {
1799
-				$new_action['post_content'][ $post_setting ] = $form_options[ $post_setting ];
1798
+			if ( isset( $form_options[$post_setting] ) ) {
1799
+				$new_action['post_content'][$post_setting] = $form_options[$post_setting];
1800 1800
 			}
1801 1801
 			unset( $post_setting );
1802 1802
 		}
@@ -1834,7 +1834,7 @@  discard block
 block discarded – undo
1834 1834
 		if ( ! $exists ) {
1835 1835
 			// this isn't an email, but we need to use a class that will always be included
1836 1836
 			FrmDb::save_json_post( $new_action );
1837
-			++$imported['imported']['actions'];
1837
+			++ $imported['imported']['actions'];
1838 1838
 		}
1839 1839
 	}
1840 1840
 
@@ -1867,11 +1867,11 @@  discard block
 block discarded – undo
1867 1867
 		foreach ( $post_content as $key => $setting ) {
1868 1868
 			if ( ! is_array( $setting ) && in_array( $key, $basic_fields ) ) {
1869 1869
 				// Replace old IDs with new IDs
1870
-				$post_content[ $key ] = str_replace( $old, $new, $setting );
1870
+				$post_content[$key] = str_replace( $old, $new, $setting );
1871 1871
 			} elseif ( is_array( $setting ) && in_array( $key, $array_fields ) ) {
1872 1872
 				foreach ( $setting as $k => $val ) {
1873 1873
 					// Replace old IDs with new IDs
1874
-					$post_content[ $key ][ $k ] = str_replace( $old, $new, $val );
1874
+					$post_content[$key][$k] = str_replace( $old, $new, $val );
1875 1875
 				}
1876 1876
 			}
1877 1877
 			unset( $key, $setting );
@@ -1928,7 +1928,7 @@  discard block
 block discarded – undo
1928 1928
 
1929 1929
 			if ( empty( $exists ) ) {
1930 1930
 				FrmDb::save_json_post( $new_notification );
1931
-				++$imported['imported']['actions'];
1931
+				++ $imported['imported']['actions'];
1932 1932
 			}
1933 1933
 			unset( $new_notification );
1934 1934
 		}//end foreach
@@ -1947,8 +1947,8 @@  discard block
 block discarded – undo
1947 1947
 	private static function remove_deprecated_notification_settings( $form_id, $form_options ) {
1948 1948
 		$delete_settings = array( 'notification', 'autoresponder', 'email_to' );
1949 1949
 		foreach ( $delete_settings as $index ) {
1950
-			if ( isset( $form_options[ $index ] ) ) {
1951
-				unset( $form_options[ $index ] );
1950
+			if ( isset( $form_options[$index] ) ) {
1951
+				unset( $form_options[$index] );
1952 1952
 			}
1953 1953
 		}
1954 1954
 		FrmForm::update( $form_id, array( 'options' => $form_options ) );
@@ -2001,12 +2001,12 @@  discard block
 block discarded – undo
2001 2001
 			'reply_to_name' => '',
2002 2002
 		);
2003 2003
 		foreach ( $reply_fields as $f => $val ) {
2004
-			if ( isset( $notification[ $f ] ) ) {
2005
-				$atts[ $f ] = $notification[ $f ];
2006
-				if ( 'custom' == $notification[ $f ] ) {
2007
-					$atts[ $f ] = $notification[ 'cust_' . $f ];
2008
-				} elseif ( is_numeric( $atts[ $f ] ) && ! empty( $atts[ $f ] ) ) {
2009
-					$atts[ $f ] = '[' . $atts[ $f ] . ']';
2004
+			if ( isset( $notification[$f] ) ) {
2005
+				$atts[$f] = $notification[$f];
2006
+				if ( 'custom' == $notification[$f] ) {
2007
+					$atts[$f] = $notification['cust_' . $f];
2008
+				} elseif ( is_numeric( $atts[$f] ) && ! empty( $atts[$f] ) ) {
2009
+					$atts[$f] = '[' . $atts[$f] . ']';
2010 2010
 				}
2011 2011
 			}
2012 2012
 			unset( $f, $val );
@@ -2037,13 +2037,13 @@  discard block
 block discarded – undo
2037 2037
 		foreach ( $atts['email_to'] as $key => $email_field ) {
2038 2038
 
2039 2039
 			if ( is_numeric( $email_field ) ) {
2040
-				$atts['email_to'][ $key ] = '[' . $email_field . ']';
2040
+				$atts['email_to'][$key] = '[' . $email_field . ']';
2041 2041
 			}
2042 2042
 
2043 2043
 			if ( strpos( $email_field, '|' ) ) {
2044 2044
 				$email_opt = explode( '|', $email_field );
2045 2045
 				if ( isset( $email_opt[0] ) ) {
2046
-					$atts['email_to'][ $key ] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
2046
+					$atts['email_to'][$key] = '[' . $email_opt[0] . ' show=' . $email_opt[1] . ']';
2047 2047
 				}
2048 2048
 				unset( $email_opt );
2049 2049
 			}
@@ -2064,12 +2064,12 @@  discard block
 block discarded – undo
2064 2064
 		// Add more fields to the new notification
2065 2065
 		$add_fields = array( 'email_message', 'email_subject', 'plain_text', 'inc_user_info', 'conditions' );
2066 2066
 		foreach ( $add_fields as $add_field ) {
2067
-			if ( isset( $notification[ $add_field ] ) ) {
2068
-				$new_notification['post_content'][ $add_field ] = $notification[ $add_field ];
2067
+			if ( isset( $notification[$add_field] ) ) {
2068
+				$new_notification['post_content'][$add_field] = $notification[$add_field];
2069 2069
 			} elseif ( in_array( $add_field, array( 'plain_text', 'inc_user_info' ) ) ) {
2070
-				$new_notification['post_content'][ $add_field ] = 0;
2070
+				$new_notification['post_content'][$add_field] = 0;
2071 2071
 			} else {
2072
-				$new_notification['post_content'][ $add_field ] = '';
2072
+				$new_notification['post_content'][$add_field] = '';
2073 2073
 			}
2074 2074
 			unset( $add_field );
2075 2075
 		}
@@ -2093,7 +2093,7 @@  discard block
 block discarded – undo
2093 2093
 		if ( isset( $post_content['conditions'] ) && is_array( $post_content['conditions'] ) ) {
2094 2094
 			foreach ( $post_content['conditions'] as $email_key => $val ) {
2095 2095
 				if ( is_numeric( $email_key ) ) {
2096
-					$post_content['conditions'][ $email_key ] = self::switch_action_field_ids( $val, array( 'hide_field' ) );
2096
+					$post_content['conditions'][$email_key] = self::switch_action_field_ids( $val, array( 'hide_field' ) );
2097 2097
 				}
2098 2098
 				unset( $email_key, $val );
2099 2099
 			}
Please login to merge, or discard this patch.
classes/helpers/FrmListHelper.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -224,8 +224,8 @@  discard block
 block discarded – undo
224 224
 			return $this->get_pagenum();
225 225
 		}
226 226
 
227
-		if ( isset( $this->_pagination_args[ $key ] ) ) {
228
-			return $this->_pagination_args[ $key ];
227
+		if ( isset( $this->_pagination_args[$key] ) ) {
228
+			return $this->_pagination_args[$key];
229 229
 		}
230 230
 	}
231 231
 
@@ -270,8 +270,8 @@  discard block
 block discarded – undo
270 270
 	}
271 271
 
272 272
 	private function hidden_search_inputs( $param_name ) {
273
-		if ( ! empty( $_REQUEST[ $param_name ] ) ) {
274
-			$value = sanitize_text_field( wp_unslash( $_REQUEST[ $param_name ] ) );
273
+		if ( ! empty( $_REQUEST[$param_name] ) ) {
274
+			$value = sanitize_text_field( wp_unslash( $_REQUEST[$param_name] ) );
275 275
 			echo '<input type="hidden" name="' . esc_attr( $param_name ) . '" value="' . esc_attr( $value ) . '" />';
276 276
 		}
277 277
 	}
@@ -313,7 +313,7 @@  discard block
 block discarded – undo
313 313
 
314 314
 		echo "<ul class='subsubsub'>\n";
315 315
 		foreach ( $views as $class => $view ) {
316
-			$views[ $class ] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view;
316
+			$views[$class] = "\t" . '<li class="' . esc_attr( $class ) . '">' . $view;
317 317
 		}
318 318
 		echo implode( " |</li>\n", $views ) . "</li>\n"; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
319 319
 		echo '</ul>';
@@ -474,7 +474,7 @@  discard block
 block discarded – undo
474 474
 
475 475
 		$out = '<div class="' . ( $always_visible ? 'row-actions visible' : 'row-actions' ) . '">';
476 476
 		foreach ( $actions as $action => $link ) {
477
-			++$i;
477
+			++ $i;
478 478
 			$sep  = $i === $action_count ? '' : ' | ';
479 479
 			$out .= "<span class='$action'>$link$sep</span>";
480 480
 		}
@@ -697,7 +697,7 @@  discard block
 block discarded – undo
697 697
 			'next'  => __( 'Next page', 'formidable' ),
698 698
 		);
699 699
 
700
-		return $labels[ $link ];
700
+		return $labels[$link];
701 701
 	}
702 702
 
703 703
 	private function current_url() {
@@ -787,7 +787,7 @@  discard block
 block discarded – undo
787 787
 
788 788
 		// If the primary column doesn't exist fall back to the
789 789
 		// first non-checkbox column.
790
-		if ( ! isset( $columns[ $default ] ) ) {
790
+		if ( ! isset( $columns[$default] ) ) {
791 791
 			$default = self::get_default_primary_column_name();
792 792
 		}
793 793
 
@@ -801,7 +801,7 @@  discard block
 block discarded – undo
801 801
 		 */
802 802
 		$column = apply_filters( 'list_table_primary_column', $default, $this->screen->id );
803 803
 
804
-		if ( empty( $column ) || ! isset( $columns[ $column ] ) ) {
804
+		if ( empty( $column ) || ! isset( $columns[$column] ) ) {
805 805
 			$column = $default;
806 806
 		}
807 807
 
@@ -822,7 +822,7 @@  discard block
 block discarded – undo
822 822
 			// In 4.3, we added a fourth argument for primary column.
823 823
 			$column_headers = array( array(), array(), array(), $this->get_primary_column_name() );
824 824
 			foreach ( $this->_column_headers as $key => $value ) {
825
-				$column_headers[ $key ] = $value;
825
+				$column_headers[$key] = $value;
826 826
 			}
827 827
 
828 828
 			return $column_headers;
@@ -855,7 +855,7 @@  discard block
 block discarded – undo
855 855
 				$data[1] = false;
856 856
 			}
857 857
 
858
-			$sortable[ $id ] = $data;
858
+			$sortable[$id] = $data;
859 859
 		}
860 860
 
861 861
 		$primary = $this->get_primary_column_name();
@@ -913,7 +913,7 @@  discard block
 block discarded – undo
913 913
 			static $cb_counter = 1;
914 914
 			$columns['cb']     = '<label class="screen-reader-text" for="cb-select-all-' . $cb_counter . '">' . __( 'Select All', 'formidable' ) . '</label>';
915 915
 			$columns['cb']    .= '<input id="cb-select-all-' . esc_attr( $cb_counter ) . '" type="checkbox" />';
916
-			++$cb_counter;
916
+			++ $cb_counter;
917 917
 		}
918 918
 
919 919
 		foreach ( $columns as $column_key => $column_display_name ) {
@@ -935,8 +935,8 @@  discard block
 block discarded – undo
935 935
 				$class[] = 'column-primary';
936 936
 			}
937 937
 
938
-			if ( isset( $sortable[ $column_key ] ) ) {
939
-				list( $orderby, $desc_first ) = $sortable[ $column_key ];
938
+			if ( isset( $sortable[$column_key] ) ) {
939
+				list( $orderby, $desc_first ) = $sortable[$column_key];
940 940
 
941 941
 				if ( $current_orderby == $orderby ) {
942 942
 					// The sorted column. The `aria-sort` attribute must be set only on the sorted column.
@@ -1053,7 +1053,7 @@  discard block
 block discarded – undo
1053 1053
 	 * @return bool Returns true if the setting is not set or if it is not false; otherwise, returns false.
1054 1054
 	 */
1055 1055
 	protected function should_display( $args, $settings ) {
1056
-		return ! isset( $args[ $settings ] ) || false !== $args[ $settings ];
1056
+		return ! isset( $args[$settings] ) || false !== $args[$settings];
1057 1057
 	}
1058 1058
 
1059 1059
 	/**
Please login to merge, or discard this patch.