Passed
Push — trunk ( 15f8cd...35f7f8 )
by Justin
02:30
created
includes/CMB2.php 1 patch
Spacing   +96 added lines, -96 removed lines patch added patch discarded remove patch
@@ -175,16 +175,16 @@  discard block
 block discarded – undo
175 175
 	 */
176 176
 	public function __construct( $config, $object_id = 0 ) {
177 177
 
178
-		if ( empty( $config['id'] ) ) {
178
+		if ( empty( $config[ 'id' ] ) ) {
179 179
 			wp_die( esc_html__( 'Metabox configuration is required to have an ID parameter.', 'cmb2' ) );
180 180
 		}
181 181
 
182
-		$this->cmb_id = $config['id'];
182
+		$this->cmb_id = $config[ 'id' ];
183 183
 		$this->meta_box = wp_parse_args( $config, $this->mb_defaults );
184
-		$this->meta_box['fields'] = array();
184
+		$this->meta_box[ 'fields' ] = array();
185 185
 
186 186
 		// Ensures object_types is an array.
187
-		$this->set_prop( 'object_types', $this->box_types() ) ;
187
+		$this->set_prop( 'object_types', $this->box_types() );
188 188
 		$this->object_id( $object_id );
189 189
 
190 190
 		if ( $this->is_options_page_mb() ) {
@@ -193,8 +193,8 @@  discard block
 block discarded – undo
193 193
 
194 194
 		$this->mb_object_type();
195 195
 
196
-		if ( ! empty( $config['fields'] ) && is_array( $config['fields'] ) ) {
197
-			$this->add_fields( $config['fields'] );
196
+		if ( ! empty( $config[ 'fields' ] ) && is_array( $config[ 'fields' ] ) ) {
197
+			$this->add_fields( $config[ 'fields' ] );
198 198
 		}
199 199
 
200 200
 		CMB2_Boxes::add( $this );
@@ -315,17 +315,17 @@  discard block
 block discarded – undo
315 315
 
316 316
 			// Include custom class if requesting no title.
317 317
 			if ( ! $this->prop( 'title' ) && ! $this->prop( 'remove_box_wrap' ) ) {
318
-				$context[] = 'cmb2-context-wrap-no-title';
318
+				$context[ ] = 'cmb2-context-wrap-no-title';
319 319
 			}
320 320
 
321 321
 			// Include a generic context wrapper.
322
-			$context[] = 'cmb2-context-wrap';
322
+			$context[ ] = 'cmb2-context-wrap';
323 323
 
324 324
 			// Include a context-type based context wrapper.
325
-			$context[] = 'cmb2-context-wrap-' . $this->prop( 'context' );
325
+			$context[ ] = 'cmb2-context-wrap-' . $this->prop( 'context' );
326 326
 
327 327
 			// Include an ID based context wrapper as well.
328
-			$context[] = 'cmb2-context-wrap-' . $this->prop( 'id' );
328
+			$context[ ] = 'cmb2-context-wrap-' . $this->prop( 'id' );
329 329
 
330 330
 			// And merge all the classes back into the array.
331 331
 			$classes = array_merge( $classes, $context );
@@ -408,22 +408,22 @@  discard block
 block discarded – undo
408 408
 	 * @return mixed CMB2_Field object if successful.
409 409
 	 */
410 410
 	public function render_field( $field_args ) {
411
-		$field_args['context'] = $this->prop( 'context' );
411
+		$field_args[ 'context' ] = $this->prop( 'context' );
412 412
 
413
-		if ( 'group' === $field_args['type'] ) {
413
+		if ( 'group' === $field_args[ 'type' ] ) {
414 414
 
415
-			if ( ! isset( $field_args['show_names'] ) ) {
416
-				$field_args['show_names'] = $this->prop( 'show_names' );
415
+			if ( ! isset( $field_args[ 'show_names' ] ) ) {
416
+				$field_args[ 'show_names' ] = $this->prop( 'show_names' );
417 417
 			}
418 418
 			$field = $this->render_group( $field_args );
419 419
 
420
-		} elseif ( 'hidden' === $field_args['type'] && $this->get_field( $field_args )->should_show() ) {
420
+		} elseif ( 'hidden' === $field_args[ 'type' ] && $this->get_field( $field_args )->should_show() ) {
421 421
 			// Save rendering for after the metabox.
422 422
 			$field = $this->add_hidden_field( $field_args );
423 423
 
424 424
 		} else {
425 425
 
426
-			$field_args['show_names'] = $this->prop( 'show_names' );
426
+			$field_args[ 'show_names' ] = $this->prop( 'show_names' );
427 427
 
428 428
 			// Render default fields.
429 429
 			$field = $this->get_field( $field_args )->render_field();
@@ -441,9 +441,9 @@  discard block
 block discarded – undo
441 441
 	public function render_group( $args ) {
442 442
 		$field_group = false;
443 443
 
444
-		if ( $args instanceof CMB2_Field  ) {
444
+		if ( $args instanceof CMB2_Field ) {
445 445
 			$field_group = 'group' === $args->type() ? $args : false;
446
-		} elseif ( isset( $args['id'], $args['fields'] ) && is_array( $args['fields'] ) ) {
446
+		} elseif ( isset( $args[ 'id' ], $args[ 'fields' ] ) && is_array( $args[ 'fields' ] ) ) {
447 447
 			$field_group = $this->get_field( $args );
448 448
 		}
449 449
 
@@ -585,15 +585,15 @@  discard block
 block discarded – undo
585 585
 			<div class="inside cmb-td cmb-nested cmb-field-list">';
586 586
 				// Loop and render repeatable group fields.
587 587
 		foreach ( array_values( $field_group->args( 'fields' ) ) as $field_args ) {
588
-			if ( 'hidden' === $field_args['type'] ) {
588
+			if ( 'hidden' === $field_args[ 'type' ] ) {
589 589
 
590 590
 				// Save rendering for after the metabox.
591 591
 				$this->add_hidden_field( $field_args, $field_group );
592 592
 
593 593
 			} else {
594 594
 
595
-				$field_args['show_names'] = $field_group->args( 'show_names' );
596
-				$field_args['context']    = $field_group->args( 'context' );
595
+				$field_args[ 'show_names' ] = $field_group->args( 'show_names' );
596
+				$field_args[ 'context' ]    = $field_group->args( 'context' );
597 597
 
598 598
 				$this->get_field( $field_args, $field_group )->render_field();
599 599
 			}
@@ -625,7 +625,7 @@  discard block
 block discarded – undo
625 625
 	 * @param CMB2_Field|null $field_group CMB2_Field group field object.
626 626
 	 */
627 627
 	public function add_hidden_field( $field_args, $field_group = null ) {
628
-		if ( isset( $field_args['field_args'] ) ) {
628
+		if ( isset( $field_args[ 'field_args' ] ) ) {
629 629
 			// For back-compatibility.
630 630
 			$field = new CMB2_Field( $field_args );
631 631
 		} else {
@@ -638,7 +638,7 @@  discard block
 block discarded – undo
638 638
 			$types->iterator = $field_group->index;
639 639
 		}
640 640
 
641
-		$this->hidden_fields[] = $types;
641
+		$this->hidden_fields[ ] = $types;
642 642
 
643 643
 		return $field;
644 644
 	}
@@ -758,11 +758,11 @@  discard block
 block discarded – undo
758 758
 	 */
759 759
 	public function process_field( $field_args ) {
760 760
 
761
-		switch ( $field_args['type'] ) {
761
+		switch ( $field_args[ 'type' ] ) {
762 762
 
763 763
 			case 'group':
764 764
 				if ( $this->save_group( $field_args ) ) {
765
-					$this->updated[] = $field_args['id'];
765
+					$this->updated[ ] = $field_args[ 'id' ];
766 766
 				}
767 767
 
768 768
 				break;
@@ -775,7 +775,7 @@  discard block
 block discarded – undo
775 775
 				$field = $this->get_new_field( $field_args );
776 776
 
777 777
 				if ( $field->save_field_from_data( $this->data_to_save ) ) {
778
-					$this->updated[] = $field->id();
778
+					$this->updated[ ] = $field->id();
779 779
 				}
780 780
 
781 781
 				break;
@@ -866,7 +866,7 @@  discard block
 block discarded – undo
866 866
 	 * @return mixed        Return of CMB2_Field::update_data().
867 867
 	 */
868 868
 	public function save_group( $args ) {
869
-		if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) {
869
+		if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) {
870 870
 			return;
871 871
 		}
872 872
 
@@ -896,7 +896,7 @@  discard block
 block discarded – undo
896 896
 		$field_group->data_to_save = $this->data_to_save;
897 897
 
898 898
 		foreach ( array_values( $field_group->fields() ) as $field_args ) {
899
-			if ( 'title' === $field_args['type'] ) {
899
+			if ( 'title' === $field_args[ 'type' ] ) {
900 900
 				// Don't process title fields.
901 901
 				continue;
902 902
 			}
@@ -919,16 +919,16 @@  discard block
 block discarded – undo
919 919
 						$_new_val = array();
920 920
 						foreach ( $new_val as $group_index => $grouped_data ) {
921 921
 							// Add the supporting data to the $saved array stack.
922
-							$saved[ $field_group->index ][ $grouped_data['supporting_field_id'] ][] = $grouped_data['supporting_field_value'];
922
+							$saved[ $field_group->index ][ $grouped_data[ 'supporting_field_id' ] ][ ] = $grouped_data[ 'supporting_field_value' ];
923 923
 							// Reset var to the actual value.
924
-							$_new_val[ $group_index ] = $grouped_data['value'];
924
+							$_new_val[ $group_index ] = $grouped_data[ 'value' ];
925 925
 						}
926 926
 						$new_val = $_new_val;
927 927
 					} else {
928 928
 						// Add the supporting data to the $saved array stack.
929
-						$saved[ $field_group->index ][ $new_val['supporting_field_id'] ] = $new_val['supporting_field_value'];
929
+						$saved[ $field_group->index ][ $new_val[ 'supporting_field_id' ] ] = $new_val[ 'supporting_field_value' ];
930 930
 						// Reset var to the actual value.
931
-						$new_val = $new_val['value'];
931
+						$new_val = $new_val[ 'value' ];
932 932
 					}
933 933
 				}
934 934
 
@@ -942,7 +942,7 @@  discard block
 block discarded – undo
942 942
 
943 943
 				// Compare values and add to `$updated` array.
944 944
 				if ( $is_updated || $is_removed ) {
945
-					$this->updated[] = $base_id . '::' . $field_group->index . '::' . $sub_id;
945
+					$this->updated[ ] = $base_id . '::' . $field_group->index . '::' . $sub_id;
946 946
 				}
947 947
 
948 948
 				// Add to `$saved` array.
@@ -980,17 +980,17 @@  discard block
 block discarded – undo
980 980
 		// Try to get our object ID from the global space.
981 981
 		switch ( $this->object_type() ) {
982 982
 			case 'user':
983
-				$object_id = isset( $_REQUEST['user_id'] ) ? wp_unslash( $_REQUEST['user_id'] ) : $object_id;
984
-				$object_id = ! $object_id && 'user-new.php' !== $pagenow && isset( $GLOBALS['user_ID'] ) ? $GLOBALS['user_ID'] : $object_id;
983
+				$object_id = isset( $_REQUEST[ 'user_id' ] ) ? wp_unslash( $_REQUEST[ 'user_id' ] ) : $object_id;
984
+				$object_id = ! $object_id && 'user-new.php' !== $pagenow && isset( $GLOBALS[ 'user_ID' ] ) ? $GLOBALS[ 'user_ID' ] : $object_id;
985 985
 				break;
986 986
 
987 987
 			case 'comment':
988
-				$object_id = isset( $_REQUEST['c'] ) ? wp_unslash( $_REQUEST['c'] ) : $object_id;
989
-				$object_id = ! $object_id && isset( $GLOBALS['comments']->comment_ID ) ? $GLOBALS['comments']->comment_ID : $object_id;
988
+				$object_id = isset( $_REQUEST[ 'c' ] ) ? wp_unslash( $_REQUEST[ 'c' ] ) : $object_id;
989
+				$object_id = ! $object_id && isset( $GLOBALS[ 'comments' ]->comment_ID ) ? $GLOBALS[ 'comments' ]->comment_ID : $object_id;
990 990
 				break;
991 991
 
992 992
 			case 'term':
993
-				$object_id = isset( $_REQUEST['tag_ID'] ) ? wp_unslash( $_REQUEST['tag_ID'] ) : $object_id;
993
+				$object_id = isset( $_REQUEST[ 'tag_ID' ] ) ? wp_unslash( $_REQUEST[ 'tag_ID' ] ) : $object_id;
994 994
 				break;
995 995
 
996 996
 			case 'options-page':
@@ -1001,8 +1001,8 @@  discard block
 block discarded – undo
1001 1001
 				break;
1002 1002
 
1003 1003
 			default:
1004
-				$object_id = isset( $GLOBALS['post']->ID ) ? $GLOBALS['post']->ID : $object_id;
1005
-				$object_id = isset( $_REQUEST['post'] ) ? wp_unslash( $_REQUEST['post'] ) : $object_id;
1004
+				$object_id = isset( $GLOBALS[ 'post' ]->ID ) ? $GLOBALS[ 'post' ]->ID : $object_id;
1005
+				$object_id = isset( $_REQUEST[ 'post' ] ) ? wp_unslash( $_REQUEST[ 'post' ] ) : $object_id;
1006 1006
 				break;
1007 1007
 		}
1008 1008
 
@@ -1088,14 +1088,14 @@  discard block
 block discarded – undo
1088 1088
 		} else {
1089 1089
 
1090 1090
 			// Make sure 'options-page' is one of the object types.
1091
-			$types[] = 'options-page';
1091
+			$types[ ] = 'options-page';
1092 1092
 		}
1093 1093
 
1094 1094
 		// Set/Reset the option_key property.
1095 1095
 		$this->set_prop( 'option_key', $keys );
1096 1096
 
1097 1097
 		// Reset the object types.
1098
-		$this->set_prop( 'object_types', array_unique( $types ) ) ;
1098
+		$this->set_prop( 'object_types', array_unique( $types ) );
1099 1099
 	}
1100 1100
 
1101 1101
 	/**
@@ -1106,12 +1106,12 @@  discard block
 block discarded – undo
1106 1106
 	 * @return array
1107 1107
 	 */
1108 1108
 	protected function deinit_options_mb( $types ) {
1109
-		if ( isset( $this->meta_box['show_on']['key'] ) && 'options-page' === $this->meta_box['show_on']['key'] ) {
1110
-			unset( $this->meta_box['show_on']['key'] );
1109
+		if ( isset( $this->meta_box[ 'show_on' ][ 'key' ] ) && 'options-page' === $this->meta_box[ 'show_on' ][ 'key' ] ) {
1110
+			unset( $this->meta_box[ 'show_on' ][ 'key' ] );
1111 1111
 		}
1112 1112
 
1113
-		if ( array_key_exists( 'options-page', $this->meta_box['show_on'] ) ) {
1114
-			unset( $this->meta_box['show_on']['options-page'] );
1113
+		if ( array_key_exists( 'options-page', $this->meta_box[ 'show_on' ] ) ) {
1114
+			unset( $this->meta_box[ 'show_on' ][ 'options-page' ] );
1115 1115
 		}
1116 1116
 
1117 1117
 		$index = array_search( 'options-page', $types );
@@ -1146,8 +1146,8 @@  discard block
 block discarded – undo
1146 1146
 	public function is_old_school_options_page_mb() {
1147 1147
 		return (
1148 1148
 			// 'show_on' values checked for back-compatibility.
1149
-			isset( $this->meta_box['show_on']['key'] ) && 'options-page' === $this->meta_box['show_on']['key']
1150
-			|| array_key_exists( 'options-page', $this->meta_box['show_on'] )
1149
+			isset( $this->meta_box[ 'show_on' ][ 'key' ] ) && 'options-page' === $this->meta_box[ 'show_on' ][ 'key' ]
1150
+			|| array_key_exists( 'options-page', $this->meta_box[ 'show_on' ] )
1151 1151
 		);
1152 1152
 	}
1153 1153
 
@@ -1166,12 +1166,12 @@  discard block
 block discarded – undo
1166 1166
 			return $found_key;
1167 1167
 		}
1168 1168
 
1169
-		if ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], $keys ) ) {
1170
-			$found_key = $_GET['page'];
1169
+		if ( ! empty( $_GET[ 'page' ] ) && in_array( $_GET[ 'page' ], $keys ) ) {
1170
+			$found_key = $_GET[ 'page' ];
1171 1171
 		}
1172 1172
 
1173
-		if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $keys ) ) {
1174
-			$found_key = $_POST['action'];
1173
+		if ( ! empty( $_POST[ 'action' ] ) && in_array( $_POST[ 'action' ], $keys ) ) {
1174
+			$found_key = $_POST[ 'action' ];
1175 1175
 		}
1176 1176
 
1177 1177
 		return $found_key ? $found_key : false;
@@ -1190,12 +1190,12 @@  discard block
 block discarded – undo
1190 1190
 		}
1191 1191
 
1192 1192
 		$values = null;
1193
-		if ( ! empty( $this->meta_box['show_on']['value'] ) ) {
1194
-			$values = $this->meta_box['show_on']['value'];
1195
-		} elseif ( ! empty( $this->meta_box['show_on']['options-page'] ) ) {
1196
-			$values = $this->meta_box['show_on']['options-page'];
1197
-		} elseif ( $this->prop( 'option_key') ) {
1198
-			$values = $this->prop( 'option_key');
1193
+		if ( ! empty( $this->meta_box[ 'show_on' ][ 'value' ] ) ) {
1194
+			$values = $this->meta_box[ 'show_on' ][ 'value' ];
1195
+		} elseif ( ! empty( $this->meta_box[ 'show_on' ][ 'options-page' ] ) ) {
1196
+			$values = $this->meta_box[ 'show_on' ][ 'options-page' ];
1197
+		} elseif ( $this->prop( 'option_key' ) ) {
1198
+			$values = $this->prop( 'option_key' );
1199 1199
 		}
1200 1200
 
1201 1201
 		if ( $values ) {
@@ -1253,7 +1253,7 @@  discard block
 block discarded – undo
1253 1253
 			$type = 'term';
1254 1254
 		}
1255 1255
 
1256
-		if ( defined( 'DOING_AJAX' ) && isset( $_POST['action'] ) && 'add-tag' === $_POST['action'] ) {
1256
+		if ( defined( 'DOING_AJAX' ) && isset( $_POST[ 'action' ] ) && 'add-tag' === $_POST[ 'action' ] ) {
1257 1257
 			$type = 'term';
1258 1258
 		}
1259 1259
 
@@ -1313,7 +1313,7 @@  discard block
 block discarded – undo
1313 1313
 			return $field;
1314 1314
 		}
1315 1315
 
1316
-		$field_id = is_string( $field ) ? $field : $field['id'];
1316
+		$field_id = is_string( $field ) ? $field : $field[ 'id' ];
1317 1317
 
1318 1318
 		$parent_field_id = ! empty( $field_group ) ? $field_group->id() : '';
1319 1319
 		$ids = $this->get_field_ids( $field_id, $parent_field_id );
@@ -1351,16 +1351,16 @@  discard block
 block discarded – undo
1351 1351
 		if ( $field_group && ( $sub_field_id || 0 === $sub_field_id ) ) {
1352 1352
 
1353 1353
 			// Update the fields array w/ any modified properties inherited from the group field.
1354
-			$this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] = $field_args;
1354
+			$this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] = $field_args;
1355 1355
 
1356 1356
 			return $this->get_default_args( $field_args, $field_group );
1357 1357
 		}
1358 1358
 
1359 1359
 		if ( is_array( $field_args ) ) {
1360
-			$this->meta_box['fields'][ $field_id ] = array_merge( $field_args, $this->meta_box['fields'][ $field_id ] );
1360
+			$this->meta_box[ 'fields' ][ $field_id ] = array_merge( $field_args, $this->meta_box[ 'fields' ][ $field_id ] );
1361 1361
 		}
1362 1362
 
1363
-		return $this->get_default_args( $this->meta_box['fields'][ $field_id ] );
1363
+		return $this->get_default_args( $this->meta_box[ 'fields' ][ $field_id ] );
1364 1364
 	}
1365 1365
 
1366 1366
 	/**
@@ -1403,8 +1403,8 @@  discard block
 block discarded – undo
1403 1403
 
1404 1404
 			$sub_fields = false;
1405 1405
 			if ( array_key_exists( 'fields', $field ) ) {
1406
-				$sub_fields = $field['fields'];
1407
-				unset( $field['fields'] );
1406
+				$sub_fields = $field[ 'fields' ];
1407
+				unset( $field[ 'fields' ] );
1408 1408
 			}
1409 1409
 
1410 1410
 			$field_id = $parent_field_id
@@ -1433,7 +1433,7 @@  discard block
 block discarded – undo
1433 1433
 		}
1434 1434
 
1435 1435
 		// Perform some field-type-specific initiation actions.
1436
-		switch ( $field['type'] ) {
1436
+		switch ( $field[ 'type' ] ) {
1437 1437
 			case 'file':
1438 1438
 			case 'file_list':
1439 1439
 
@@ -1448,8 +1448,8 @@  discard block
 block discarded – undo
1448 1448
 				break;
1449 1449
 
1450 1450
 			case 'group':
1451
-				if ( empty( $field['render_row_cb'] ) ) {
1452
-					$field['render_row_cb'] = array( $this, 'render_group_callback' );
1451
+				if ( empty( $field[ 'render_row_cb' ] ) ) {
1452
+					$field[ 'render_row_cb' ] = array( $this, 'render_group_callback' );
1453 1453
 				}
1454 1454
 				break;
1455 1455
 			case 'colorpicker':
@@ -1460,21 +1460,21 @@  discard block
 block discarded – undo
1460 1460
 				break;
1461 1461
 		}
1462 1462
 
1463
-		if ( isset( $field['column'] ) && false !== $field['column'] ) {
1463
+		if ( isset( $field[ 'column' ] ) && false !== $field[ 'column' ] ) {
1464 1464
 			$field = $this->define_field_column( $field );
1465 1465
 		}
1466 1466
 
1467
-		if ( isset( $field['taxonomy'] ) && ! empty( $field['remove_default'] ) ) {
1468
-			$this->tax_metaboxes_to_remove[ $field['taxonomy'] ] = $field['taxonomy'];
1467
+		if ( isset( $field[ 'taxonomy' ] ) && ! empty( $field[ 'remove_default' ] ) ) {
1468
+			$this->tax_metaboxes_to_remove[ $field[ 'taxonomy' ] ] = $field[ 'taxonomy' ];
1469 1469
 		}
1470 1470
 
1471 1471
 		$this->_add_field_to_array(
1472 1472
 			$field,
1473
-			$this->meta_box['fields'],
1473
+			$this->meta_box[ 'fields' ],
1474 1474
 			$position
1475 1475
 		);
1476 1476
 
1477
-		return $field['id'];
1477
+		return $field[ 'id' ];
1478 1478
 	}
1479 1479
 
1480 1480
 	/**
@@ -1487,10 +1487,10 @@  discard block
 block discarded – undo
1487 1487
 	protected function define_field_column( array $field ) {
1488 1488
 		$this->has_columns = true;
1489 1489
 
1490
-		$column = is_array( $field['column'] ) ? $field['column'] : array();
1490
+		$column = is_array( $field[ 'column' ] ) ? $field[ 'column' ] : array();
1491 1491
 
1492
-		$field['column'] = wp_parse_args( $column, array(
1493
-			'name'     => isset( $field['name'] ) ? $field['name'] : '',
1492
+		$field[ 'column' ] = wp_parse_args( $column, array(
1493
+			'name'     => isset( $field[ 'name' ] ) ? $field[ 'name' ] : '',
1494 1494
 			'position' => false,
1495 1495
 		) );
1496 1496
 
@@ -1507,27 +1507,27 @@  discard block
 block discarded – undo
1507 1507
 	 * @return mixed                   Array of parent/field ids or false.
1508 1508
 	 */
1509 1509
 	public function add_group_field( $parent_field_id, array $field, $position = 0 ) {
1510
-		if ( ! array_key_exists( $parent_field_id, $this->meta_box['fields'] ) ) {
1510
+		if ( ! array_key_exists( $parent_field_id, $this->meta_box[ 'fields' ] ) ) {
1511 1511
 			return false;
1512 1512
 		}
1513 1513
 
1514
-		$parent_field = $this->meta_box['fields'][ $parent_field_id ];
1514
+		$parent_field = $this->meta_box[ 'fields' ][ $parent_field_id ];
1515 1515
 
1516
-		if ( 'group' !== $parent_field['type'] ) {
1516
+		if ( 'group' !== $parent_field[ 'type' ] ) {
1517 1517
 			return false;
1518 1518
 		}
1519 1519
 
1520
-		if ( ! isset( $parent_field['fields'] ) ) {
1521
-			$this->meta_box['fields'][ $parent_field_id ]['fields'] = array();
1520
+		if ( ! isset( $parent_field[ 'fields' ] ) ) {
1521
+			$this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ] = array();
1522 1522
 		}
1523 1523
 
1524 1524
 		$this->_add_field_to_array(
1525 1525
 			$field,
1526
-			$this->meta_box['fields'][ $parent_field_id ]['fields'],
1526
+			$this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ],
1527 1527
 			$position
1528 1528
 		);
1529 1529
 
1530
-		return array( $parent_field_id, $field['id'] );
1530
+		return array( $parent_field_id, $field[ 'id' ] );
1531 1531
 	}
1532 1532
 
1533 1533
 	/**
@@ -1540,9 +1540,9 @@  discard block
 block discarded – undo
1540 1540
 	 */
1541 1541
 	protected function _add_field_to_array( $field, &$fields, $position = 0 ) {
1542 1542
 		if ( $position ) {
1543
-			CMB2_Utils::array_insert( $fields, array( $field['id'] => $field ), $position );
1543
+			CMB2_Utils::array_insert( $fields, array( $field[ 'id' ] => $field ), $position );
1544 1544
 		} else {
1545
-			$fields[ $field['id'] ] = $field;
1545
+			$fields[ $field[ 'id' ] ] = $field;
1546 1546
 		}
1547 1547
 	}
1548 1548
 
@@ -1566,15 +1566,15 @@  discard block
 block discarded – undo
1566 1566
 		unset( $this->fields[ implode( '', $ids ) ] );
1567 1567
 
1568 1568
 		if ( ! $sub_field_id ) {
1569
-			unset( $this->meta_box['fields'][ $field_id ] );
1569
+			unset( $this->meta_box[ 'fields' ][ $field_id ] );
1570 1570
 			return true;
1571 1571
 		}
1572 1572
 
1573
-		if ( isset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] ) ) {
1574
-			unset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] );
1573
+		if ( isset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] ) ) {
1574
+			unset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] );
1575 1575
 		}
1576
-		if ( isset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] ) ) {
1577
-			unset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] );
1576
+		if ( isset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] ) ) {
1577
+			unset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] );
1578 1578
 		}
1579 1579
 
1580 1580
 		return true;
@@ -1600,11 +1600,11 @@  discard block
 block discarded – undo
1600 1600
 		list( $field_id, $sub_field_id ) = $ids;
1601 1601
 
1602 1602
 		if ( ! $sub_field_id ) {
1603
-			$this->meta_box['fields'][ $field_id ][ $property ] = $value;
1603
+			$this->meta_box[ 'fields' ][ $field_id ][ $property ] = $value;
1604 1604
 			return $field_id;
1605 1605
 		}
1606 1606
 
1607
-		$this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ][ $property ] = $value;
1607
+		$this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ][ $property ] = $value;
1608 1608
 		return $field_id;
1609 1609
 	}
1610 1610
 
@@ -1619,7 +1619,7 @@  discard block
 block discarded – undo
1619 1619
 	public function get_field_ids( $field_id, $parent_field_id = '' ) {
1620 1620
 		$sub_field_id = $parent_field_id ? $field_id : '';
1621 1621
 		$field_id     = $parent_field_id ? $parent_field_id : $field_id;
1622
-		$fields       =& $this->meta_box['fields'];
1622
+		$fields       = & $this->meta_box[ 'fields' ];
1623 1623
 
1624 1624
 		if ( ! array_key_exists( $field_id, $fields ) ) {
1625 1625
 			$field_id = $this->search_old_school_array( $field_id, $fields );
@@ -1633,12 +1633,12 @@  discard block
 block discarded – undo
1633 1633
 			return array( $field_id, $sub_field_id );
1634 1634
 		}
1635 1635
 
1636
-		if ( 'group' !== $fields[ $field_id ]['type'] ) {
1636
+		if ( 'group' !== $fields[ $field_id ][ 'type' ] ) {
1637 1637
 			return false;
1638 1638
 		}
1639 1639
 
1640
-		if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ]['fields'] ) ) {
1641
-			$sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ]['fields'] );
1640
+		if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ][ 'fields' ] ) ) {
1641
+			$sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ][ 'fields' ] );
1642 1642
 		}
1643 1643
 
1644 1644
 		return false === $sub_field_id ? false : array( $field_id, $sub_field_id );
Please login to merge, or discard this patch.