Completed
Push — trunk ( 7c0514...2e0317 )
by Justin
05:45
created
includes/types/CMB2_Type_Text.php 1 patch
Spacing   +3 added lines, -3 removed lines patch added patch discarded remove patch
@@ -50,12 +50,12 @@
 block discarded – undo
50 50
 			'js_dependencies' => array(),
51 51
 		), $args );
52 52
 
53
-		if ( ! empty( $a['js_dependencies'] ) ) {
54
-			CMB2_JS::add_dependencies( $a['js_dependencies'] );
53
+		if ( ! empty( $a[ 'js_dependencies' ] ) ) {
54
+			CMB2_JS::add_dependencies( $a[ 'js_dependencies' ] );
55 55
 		}
56 56
 
57 57
 		return $this->rendered(
58
-			sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc', 'js_dependencies' ) ), $a['desc'] )
58
+			sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc', 'js_dependencies' ) ), $a[ 'desc' ] )
59 59
 		);
60 60
 	}
61 61
 }
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Title.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@
 block discarded – undo
21 21
 		) );
22 22
 
23 23
 		return $this->rendered(
24
-			sprintf( '<%1$s class="%2$s">%3$s</%1$s>%4$s', $a['tag'], $a['class'], $a['name'], $a['desc'] )
24
+			sprintf( '<%1$s class="%2$s">%3$s</%1$s>%4$s', $a[ 'tag' ], $a[ 'class' ], $a[ 'name' ], $a[ 'desc' ] )
25 25
 		);
26 26
 	}
27 27
 
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Text_Datetime_Timestamp_Timezone.php 1 patch
Spacing   +7 added lines, -7 removed lines patch added patch discarded remove patch
@@ -22,12 +22,12 @@  discard block
 block discarded – undo
22 22
 			'select_timezone'         => array(),
23 23
 		) );
24 24
 
25
-		$args['value'] = $field->escaped_value();
26
-		if ( is_array( $args['value'] ) ) {
27
-			$args['value'] = '';
25
+		$args[ 'value' ] = $field->escaped_value();
26
+		if ( is_array( $args[ 'value' ] ) ) {
27
+			$args[ 'value' ] = '';
28 28
 		}
29 29
 
30
-		$datetime = maybe_unserialize( $args['value'] );
30
+		$datetime = maybe_unserialize( $args[ 'value' ] );
31 31
 		$value = $tzstring = '';
32 32
 
33 33
 		if ( $datetime && $datetime instanceof DateTime ) {
@@ -36,19 +36,19 @@  discard block
 block discarded – undo
36 36
 			$value    = $datetime->getTimestamp();
37 37
 		}
38 38
 
39
-		$timestamp_args = wp_parse_args( $args['text_datetime_timestamp'], array(
39
+		$timestamp_args = wp_parse_args( $args[ 'text_datetime_timestamp' ], array(
40 40
 			'desc'     => '',
41 41
 			'value'    => $value,
42 42
 			'rendered' => true,
43 43
 		) );
44 44
 		$datetime_timestamp = $this->types->text_datetime_timestamp( $timestamp_args );
45 45
 
46
-		$timezone_select_args = wp_parse_args( $args['select_timezone'], array(
46
+		$timezone_select_args = wp_parse_args( $args[ 'select_timezone' ], array(
47 47
 			'class'    => 'cmb2_select cmb2-select-timezone',
48 48
 			'name'     => $this->_name( '[timezone]' ),
49 49
 			'id'       => $this->_id( '_timezone' ),
50 50
 			'options'  => wp_timezone_choice( $tzstring ),
51
-			'desc'     => $args['desc'],
51
+			'desc'     => $args[ 'desc' ],
52 52
 			'rendered' => true,
53 53
 		) );
54 54
 		$select = $this->types->select( $timezone_select_args );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Text_Datetime_Timestamp.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -22,16 +22,16 @@  discard block
 block discarded – undo
22 22
 			'timepicker' => array(),
23 23
 		) );
24 24
 
25
-		if ( empty( $args['value'] ) ) {
26
-			$args['value'] = $field->escaped_value();
25
+		if ( empty( $args[ 'value' ] ) ) {
26
+			$args[ 'value' ] = $field->escaped_value();
27 27
 			// This will be used if there is a select_timezone set for this field
28 28
 			$tz_offset = $field->field_timezone_offset();
29 29
 			if ( ! empty( $tz_offset ) ) {
30
-				$args['value'] -= $tz_offset;
30
+				$args[ 'value' ] -= $tz_offset;
31 31
 			}
32 32
 		}
33 33
 
34
-		$has_good_value = ! empty( $args['value'] ) && ! is_array( $args['value'] );
34
+		$has_good_value = ! empty( $args[ 'value' ] ) && ! is_array( $args[ 'value' ] );
35 35
 
36 36
 		$date_input = parent::render( $this->date_args( $args, $has_good_value ) );
37 37
 		$time_input = parent::render( $this->time_args( $args, $has_good_value ) );
@@ -40,31 +40,31 @@  discard block
 block discarded – undo
40 40
 	}
41 41
 
42 42
 	public function date_args( $args, $has_good_value ) {
43
-		$date_args = wp_parse_args( $args['datepicker'], array(
43
+		$date_args = wp_parse_args( $args[ 'datepicker' ], array(
44 44
 			'class' => 'cmb2-text-small cmb2-datepicker',
45 45
 			'name'  => $this->_name( '[date]' ),
46 46
 			'id'    => $this->_id( '_date' ),
47
-			'value' => $has_good_value ? $this->field->get_timestamp_format( 'date_format', $args['value'] ) : '',
47
+			'value' => $has_good_value ? $this->field->get_timestamp_format( 'date_format', $args[ 'value' ] ) : '',
48 48
 			'desc'  => '',
49 49
 		) );
50 50
 
51
-		$date_args['rendered'] = true;
51
+		$date_args[ 'rendered' ] = true;
52 52
 
53 53
 		// Let's get the date-format, and set it up as a data attr for the field.
54 54
 		return $this->parse_picker_options( 'date', $date_args );
55 55
 	}
56 56
 
57 57
 	public function time_args( $args, $has_good_value ) {
58
-		$time_args = wp_parse_args( $args['timepicker'], array(
58
+		$time_args = wp_parse_args( $args[ 'timepicker' ], array(
59 59
 			'class' => 'cmb2-timepicker text-time',
60 60
 			'name'  => $this->_name( '[time]' ),
61 61
 			'id'    => $this->_id( '_time' ),
62
-			'value' => $has_good_value ? $this->field->get_timestamp_format( 'time_format', $args['value'] ) : '',
63
-			'desc'  => $args['desc'],
62
+			'value' => $has_good_value ? $this->field->get_timestamp_format( 'time_format', $args[ 'value' ] ) : '',
63
+			'desc'  => $args[ 'desc' ],
64 64
 			'js_dependencies' => array( 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-datetimepicker' ),
65 65
 		) );
66 66
 
67
-		$time_args['rendered'] = true;
67
+		$time_args[ 'rendered' ] = true;
68 68
 
69 69
 		// Let's get the time-format, and set it up as a data attr for the field.
70 70
 		return $this->parse_picker_options( 'time', $time_args );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Base.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -38,7 +38,7 @@  discard block
 block discarded – undo
38 38
 	 */
39 39
 	public function __construct( CMB2_Types $types, $args = array() ) {
40 40
 		$this->types = $types;
41
-		$args['rendered'] = isset( $args['rendered'] ) ? (bool) $args['rendered'] : true;
41
+		$args[ 'rendered' ] = isset( $args[ 'rendered' ] ) ? (bool) $args[ 'rendered' ] : true;
42 42
 		$this->args = $args;
43 43
 	}
44 44
 
@@ -56,7 +56,7 @@  discard block
 block discarded – undo
56 56
 	 * @return string|CMB2_Type_Base           Rendered output or this object.
57 57
 	 */
58 58
 	public function rendered( $rendered ) {
59
-		if ( $this->args['rendered'] ) {
59
+		if ( $this->args[ 'rendered' ] ) {
60 60
 			return is_a( $rendered, __CLASS__ ) ? $rendered->rendered : $rendered;
61 61
 		}
62 62
 
Please login to merge, or discard this patch.
includes/CMB2_Types.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -162,7 +162,7 @@
 block discarded – undo
162 162
 	 * @return string               String of attributes for form element
163 163
 	 */
164 164
 	public function concat_attrs( $attrs, $attr_exclude = array() ) {
165
-		$attr_exclude[] = 'rendered';
165
+		$attr_exclude[ ] = 'rendered';
166 166
 		$attributes = '';
167 167
 		foreach ( $attrs as $attr => $val ) {
168 168
 			$excluded = in_array( $attr, (array) $attr_exclude, true );
Please login to merge, or discard this patch.
includes/CMB2_Sanitize.php 1 patch
Spacing   +8 added lines, -8 removed lines patch added patch discarded remove patch
@@ -172,7 +172,7 @@  discard block
 block discarded – undo
172 172
 
173 173
 		global $wp_locale;
174 174
 
175
-		$search = array( $wp_locale->number_format['thousands_sep'], $wp_locale->number_format['decimal_point'] );
175
+		$search = array( $wp_locale->number_format[ 'thousands_sep' ], $wp_locale->number_format[ 'decimal_point' ] );
176 176
 		$replace = array( '', '.' );
177 177
 
178 178
 		// for repeatable
@@ -215,8 +215,8 @@  discard block
 block discarded – undo
215 215
 			return $repeat_value;
216 216
 		}
217 217
 
218
-		if ( isset( $this->value['date'], $this->value['time'] ) ) {
219
-			$this->value = $this->field->get_timestamp_from_value( $this->value['date'] . ' ' . $this->value['time'] );
218
+		if ( isset( $this->value[ 'date' ], $this->value[ 'time' ] ) ) {
219
+			$this->value = $this->field->get_timestamp_from_value( $this->value[ 'date' ] . ' ' . $this->value[ 'time' ] );
220 220
 		}
221 221
 
222 222
 		if ( $tz_offset = $this->field->field_timezone_offset() ) {
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 		$tzstring = null;
255 255
 
256 256
 		if ( is_array( $this->value ) && array_key_exists( 'timezone', $this->value ) ) {
257
-			$tzstring = $this->value['timezone'];
257
+			$tzstring = $this->value[ 'timezone' ];
258 258
 		}
259 259
 
260 260
 		if ( empty( $tzstring ) ) {
@@ -274,8 +274,8 @@  discard block
 block discarded – undo
274 274
 			$tzstring = false !== $tzstring ? $tzstring : timezone_name_from_abbr( '', 0, 0 );
275 275
 		}
276 276
 
277
-		$full_format = $this->field->args['date_format'] . ' ' . $this->field->args['time_format'];
278
-		$full_date   = $this->value['date'] . ' ' . $this->value['time'];
277
+		$full_format = $this->field->args[ 'date_format' ] . ' ' . $this->field->args[ 'time_format' ];
278
+		$full_date   = $this->value[ 'date' ] . ' ' . $this->value[ 'time' ];
279 279
 
280 280
 		try {
281 281
 
@@ -298,7 +298,7 @@  discard block
 block discarded – undo
298 298
 			} else {
299 299
 				// Save the utc timestamp supporting field
300 300
 				if ( $repeat ) {
301
-					$utc_values[ $utc_key ][] = $utc_stamp;
301
+					$utc_values[ $utc_key ][ ] = $utc_stamp;
302 302
 				} else {
303 303
 					$this->_save_utc_value( $utc_key, $utc_stamp );
304 304
 				}
@@ -433,7 +433,7 @@  discard block
 block discarded – undo
433 433
 			if ( $this->value ) {
434 434
 				$val = $this->$method( true );
435 435
 				if ( ! empty( $val ) ) {
436
-					$new_value[] = $val;
436
+					$new_value[ ] = $val;
437 437
 				}
438 438
 			}
439 439
 		}
Please login to merge, or discard this patch.
includes/types/CMB2_Type_File.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -21,7 +21,7 @@  discard block
 block discarded – undo
21 21
 		$output     = '';
22 22
 
23 23
 		// if options array and 'url' => false, then hide the url field
24
-		$input_type = array_key_exists( 'url', $options ) && false === $options['url'] ? 'hidden' : 'text';
24
+		$input_type = array_key_exists( 'url', $options ) && false === $options[ 'url' ] ? 'hidden' : 'text';
25 25
 
26 26
 		$output .= parent::render( array(
27 27
 			'type'  => $input_type,
@@ -71,7 +71,7 @@  discard block
 block discarded – undo
71 71
 				if ( $_id_value ) {
72 72
 					$image = wp_get_attachment_image( $_id_value, $img_size, null, array( 'class' => 'cmb-file-field-image' ) );
73 73
 				} else {
74
-					$size = is_array( $img_size ) ? $img_size[0] : 350;
74
+					$size = is_array( $img_size ) ? $img_size[ 0 ] : 350;
75 75
 					$image = '<img style="max-width: ' . absint( $size ) . 'px; width: 100%; height: auto;" src="' . $meta_value . '" alt="" />';
76 76
 				}
77 77
 
Please login to merge, or discard this patch.
includes/CMB2.php 1 patch
Spacing   +63 added lines, -63 removed lines patch added patch discarded remove patch
@@ -119,19 +119,19 @@  discard block
 block discarded – undo
119 119
 	 */
120 120
 	public function __construct( $meta_box, $object_id = 0 ) {
121 121
 
122
-		if ( empty( $meta_box['id'] ) ) {
122
+		if ( empty( $meta_box[ 'id' ] ) ) {
123 123
 			wp_die( __( 'Metabox configuration is required to have an ID parameter', 'cmb2' ) );
124 124
 		}
125 125
 
126 126
 		$this->meta_box = wp_parse_args( $meta_box, $this->mb_defaults );
127
-		$this->meta_box['fields'] = array();
127
+		$this->meta_box[ 'fields' ] = array();
128 128
 
129 129
 		$this->object_id( $object_id );
130 130
 		$this->mb_object_type();
131
-		$this->cmb_id = $meta_box['id'];
131
+		$this->cmb_id = $meta_box[ 'id' ];
132 132
 
133
-		if ( ! empty( $meta_box['fields'] ) && is_array( $meta_box['fields'] ) ) {
134
-			$this->add_fields( $meta_box['fields'] );
133
+		if ( ! empty( $meta_box[ 'fields' ] ) && is_array( $meta_box[ 'fields' ] ) ) {
134
+			$this->add_fields( $meta_box[ 'fields' ] );
135 135
 		}
136 136
 
137 137
 		CMB2_Boxes::add( $this );
@@ -262,22 +262,22 @@  discard block
 block discarded – undo
262 262
 	 * @return mixed CMB2_Field object if successful.
263 263
 	 */
264 264
 	public function render_field( $field_args ) {
265
-		$field_args['context'] = $this->prop( 'context' );
265
+		$field_args[ 'context' ] = $this->prop( 'context' );
266 266
 
267
-		if ( 'group' == $field_args['type'] ) {
267
+		if ( 'group' == $field_args[ 'type' ] ) {
268 268
 
269
-			if ( ! isset( $field_args['show_names'] ) ) {
270
-				$field_args['show_names'] = $this->prop( 'show_names' );
269
+			if ( ! isset( $field_args[ 'show_names' ] ) ) {
270
+				$field_args[ 'show_names' ] = $this->prop( 'show_names' );
271 271
 			}
272 272
 			$field = $this->render_group( $field_args );
273 273
 
274
-		} elseif ( 'hidden' == $field_args['type'] && $this->get_field( $field_args )->should_show() ) {
274
+		} elseif ( 'hidden' == $field_args[ 'type' ] && $this->get_field( $field_args )->should_show() ) {
275 275
 			// Save rendering for after the metabox
276 276
 			$field = $this->add_hidden_field( $field_args );
277 277
 
278 278
 		} else {
279 279
 
280
-			$field_args['show_names'] = $this->prop( 'show_names' );
280
+			$field_args[ 'show_names' ] = $this->prop( 'show_names' );
281 281
 
282 282
 			// Render default fields
283 283
 			$field = $this->get_field( $field_args )->render_field();
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 	 */
294 294
 	public function render_group( $args ) {
295 295
 
296
-		if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) {
296
+		if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) {
297 297
 			return;
298 298
 		}
299 299
 
@@ -375,15 +375,15 @@  discard block
 block discarded – undo
375 375
 			<div class="inside cmb-td cmb-nested cmb-field-list">';
376 376
 				// Loop and render repeatable group fields
377 377
 				foreach ( array_values( $field_group->args( 'fields' ) ) as $field_args ) {
378
-					if ( 'hidden' == $field_args['type'] ) {
378
+					if ( 'hidden' == $field_args[ 'type' ] ) {
379 379
 
380 380
 						// Save rendering for after the metabox
381 381
 						$this->add_hidden_field( $field_args, $field_group );
382 382
 
383 383
 					} else {
384 384
 
385
-						$field_args['show_names'] = $field_group->args( 'show_names' );
386
-						$field_args['context']    = $field_group->args( 'context' );
385
+						$field_args[ 'show_names' ] = $field_group->args( 'show_names' );
386
+						$field_args[ 'context' ]    = $field_group->args( 'context' );
387 387
 
388 388
 						$field = $this->get_field( $field_args, $field_group )->render_field();
389 389
 					}
@@ -411,14 +411,14 @@  discard block
 block discarded – undo
411 411
 	 * @param array  $field_args Array of field arguments to be passed to CMB2_Field
412 412
 	 */
413 413
 	public function add_hidden_field( $field_args, $field_group = null ) {
414
-		if ( isset( $field_args['field_args'] ) ) {
414
+		if ( isset( $field_args[ 'field_args' ] ) ) {
415 415
 			// For back-compatibility.
416 416
 			$field = new CMB2_Field( $field_args );
417 417
 		} else {
418 418
 			$field = $this->get_new_field( $field_args, $field_group );
419 419
 		}
420 420
 
421
-		$this->hidden_fields[] = new CMB2_Types( $field );
421
+		$this->hidden_fields[ ] = new CMB2_Types( $field );
422 422
 
423 423
 		return $field;
424 424
 	}
@@ -515,11 +515,11 @@  discard block
 block discarded – undo
515 515
 	 */
516 516
 	public function process_field( $field_args ) {
517 517
 
518
-		switch ( $field_args['type'] ) {
518
+		switch ( $field_args[ 'type' ] ) {
519 519
 
520 520
 			case 'group':
521 521
 				if ( $this->save_group( $field_args ) ) {
522
-					$this->updated[] = $field_args['id'];
522
+					$this->updated[ ] = $field_args[ 'id' ];
523 523
 				}
524 524
 
525 525
 				break;
@@ -533,7 +533,7 @@  discard block
 block discarded – undo
533 533
 				$field = $this->get_new_field( $field_args );
534 534
 
535 535
 				if ( $field->save_field_from_data( $this->data_to_save ) ) {
536
-					$this->updated[] = $field->id();
536
+					$this->updated[ ] = $field->id();
537 537
 				}
538 538
 
539 539
 				break;
@@ -600,7 +600,7 @@  discard block
 block discarded – undo
600 600
 	 * @return mixed        Return of CMB2_Field::update_data()
601 601
 	 */
602 602
 	public function save_group( $args ) {
603
-		if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) {
603
+		if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) {
604 604
 			return;
605 605
 		}
606 606
 
@@ -648,16 +648,16 @@  discard block
 block discarded – undo
648 648
 						$_new_val = array();
649 649
 						foreach ( $new_val as $group_index => $grouped_data ) {
650 650
 							// Add the supporting data to the $saved array stack
651
-							$saved[ $field_group->index ][ $grouped_data['supporting_field_id'] ][] = $grouped_data['supporting_field_value'];
651
+							$saved[ $field_group->index ][ $grouped_data[ 'supporting_field_id' ] ][ ] = $grouped_data[ 'supporting_field_value' ];
652 652
 							// Reset var to the actual value
653
-							$_new_val[ $group_index ] = $grouped_data['value'];
653
+							$_new_val[ $group_index ] = $grouped_data[ 'value' ];
654 654
 						}
655 655
 						$new_val = $_new_val;
656 656
 					} else {
657 657
 						// Add the supporting data to the $saved array stack
658
-						$saved[ $field_group->index ][ $new_val['supporting_field_id'] ] = $new_val['supporting_field_value'];
658
+						$saved[ $field_group->index ][ $new_val[ 'supporting_field_id' ] ] = $new_val[ 'supporting_field_value' ];
659 659
 						// Reset var to the actual value
660
-						$new_val = $new_val['value'];
660
+						$new_val = $new_val[ 'value' ];
661 661
 					}
662 662
 				}
663 663
 
@@ -670,7 +670,7 @@  discard block
 block discarded – undo
670 670
 				$is_removed = ( empty( $new_val ) && ! empty( $old_val ) );
671 671
 				// Compare values and add to `$updated` array
672 672
 				if ( $is_updated || $is_removed ) {
673
-					$this->updated[] = $base_id . '::' . $field_group->index . '::' . $sub_id;
673
+					$this->updated[ ] = $base_id . '::' . $field_group->index . '::' . $sub_id;
674 674
 				}
675 675
 
676 676
 				// Add to `$saved` array
@@ -705,22 +705,22 @@  discard block
 block discarded – undo
705 705
 		// Try to get our object ID from the global space
706 706
 		switch ( $this->object_type() ) {
707 707
 			case 'user':
708
-				$object_id = isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id;
709
-				$object_id = ! $object_id && 'user-new.php' != $pagenow && isset( $GLOBALS['user_ID'] ) ? $GLOBALS['user_ID'] : $object_id;
708
+				$object_id = isset( $_REQUEST[ 'user_id' ] ) ? $_REQUEST[ 'user_id' ] : $object_id;
709
+				$object_id = ! $object_id && 'user-new.php' != $pagenow && isset( $GLOBALS[ 'user_ID' ] ) ? $GLOBALS[ 'user_ID' ] : $object_id;
710 710
 				break;
711 711
 
712 712
 			case 'comment':
713
-				$object_id = isset( $_REQUEST['c'] ) ? $_REQUEST['c'] : $object_id;
714
-				$object_id = ! $object_id && isset( $GLOBALS['comments']->comment_ID ) ? $GLOBALS['comments']->comment_ID : $object_id;
713
+				$object_id = isset( $_REQUEST[ 'c' ] ) ? $_REQUEST[ 'c' ] : $object_id;
714
+				$object_id = ! $object_id && isset( $GLOBALS[ 'comments' ]->comment_ID ) ? $GLOBALS[ 'comments' ]->comment_ID : $object_id;
715 715
 				break;
716 716
 
717 717
 			case 'term':
718
-				$object_id = isset( $_REQUEST['tag_ID'] ) ? $_REQUEST['tag_ID'] : $object_id;
718
+				$object_id = isset( $_REQUEST[ 'tag_ID' ] ) ? $_REQUEST[ 'tag_ID' ] : $object_id;
719 719
 				break;
720 720
 
721 721
 			default:
722
-				$object_id = isset( $GLOBALS['post']->ID ) ? $GLOBALS['post']->ID : $object_id;
723
-				$object_id = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : $object_id;
722
+				$object_id = isset( $GLOBALS[ 'post' ]->ID ) ? $GLOBALS[ 'post' ]->ID : $object_id;
723
+				$object_id = isset( $_REQUEST[ 'post' ] ) ? $_REQUEST[ 'post' ] : $object_id;
724 724
 				break;
725 725
 		}
726 726
 
@@ -796,7 +796,7 @@  discard block
 block discarded – undo
796 796
 	 * @return boolean True/False
797 797
 	 */
798 798
 	public function is_options_page_mb() {
799
-		return ( isset( $this->meta_box['show_on']['key'] ) && 'options-page' === $this->meta_box['show_on']['key'] || array_key_exists( 'options-page', $this->meta_box['show_on'] ) );
799
+		return ( isset( $this->meta_box[ 'show_on' ][ 'key' ] ) && 'options-page' === $this->meta_box[ 'show_on' ][ 'key' ] || array_key_exists( 'options-page', $this->meta_box[ 'show_on' ] ) );
800 800
 	}
801 801
 
802 802
 	/**
@@ -883,7 +883,7 @@  discard block
 block discarded – undo
883 883
 			return $field;
884 884
 		}
885 885
 
886
-		$field_id = is_string( $field ) ? $field : $field['id'];
886
+		$field_id = is_string( $field ) ? $field : $field[ 'id' ];
887 887
 
888 888
 		$parent_field_id = ! empty( $field_group ) ? $field_group->id() : '';
889 889
 		$ids = $this->get_field_ids( $field_id, $parent_field_id, true );
@@ -919,16 +919,16 @@  discard block
 block discarded – undo
919 919
 		if ( $field_group && ( $sub_field_id || 0 === $sub_field_id ) ) {
920 920
 
921 921
 			// Update the fields array w/ any modified properties inherited from the group field
922
-			$this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] = $field_args;
922
+			$this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] = $field_args;
923 923
 
924 924
 			return $this->get_default_args( $field_args, $field_group );
925 925
 		}
926 926
 
927 927
 		if ( is_array( $field_args ) ) {
928
-			$this->meta_box['fields'][ $field_id ] = array_merge( $field_args, $this->meta_box['fields'][ $field_id ] );
928
+			$this->meta_box[ 'fields' ][ $field_id ] = array_merge( $field_args, $this->meta_box[ 'fields' ][ $field_id ] );
929 929
 		}
930 930
 
931
-		return $this->get_default_args( $this->meta_box['fields'][ $field_id ] );
931
+		return $this->get_default_args( $this->meta_box[ 'fields' ][ $field_id ] );
932 932
 	}
933 933
 
934 934
 	/**
@@ -978,8 +978,8 @@  discard block
 block discarded – undo
978 978
 
979 979
 			$sub_fields = false;
980 980
 			if ( array_key_exists( 'fields', $field ) ) {
981
-				$sub_fields = $field['fields'];
982
-				unset( $field['fields'] );
981
+				$sub_fields = $field[ 'fields' ];
982
+				unset( $field[ 'fields' ] );
983 983
 			}
984 984
 
985 985
 			$field_id = $parent_field_id
@@ -1004,18 +1004,18 @@  discard block
 block discarded – undo
1004 1004
 			return false;
1005 1005
 		}
1006 1006
 
1007
-		if ( 'oembed' === $field['type'] ) {
1007
+		if ( 'oembed' === $field[ 'type' ] ) {
1008 1008
 			// Initiate oembed Ajax hooks
1009 1009
 			cmb2_ajax();
1010 1010
 		}
1011 1011
 
1012 1012
 		$this->_add_field_to_array(
1013 1013
 			$field,
1014
-			$this->meta_box['fields'],
1014
+			$this->meta_box[ 'fields' ],
1015 1015
 			$position
1016 1016
 		);
1017 1017
 
1018
-		return $field['id'];
1018
+		return $field[ 'id' ];
1019 1019
 	}
1020 1020
 
1021 1021
 	/**
@@ -1027,27 +1027,27 @@  discard block
 block discarded – undo
1027 1027
 	 * @return mixed                   Array of parent/field ids or false
1028 1028
 	 */
1029 1029
 	public function add_group_field( $parent_field_id, array $field, $position = 0 ) {
1030
-		if ( ! array_key_exists( $parent_field_id, $this->meta_box['fields'] ) ) {
1030
+		if ( ! array_key_exists( $parent_field_id, $this->meta_box[ 'fields' ] ) ) {
1031 1031
 			return false;
1032 1032
 		}
1033 1033
 
1034
-		$parent_field = $this->meta_box['fields'][ $parent_field_id ];
1034
+		$parent_field = $this->meta_box[ 'fields' ][ $parent_field_id ];
1035 1035
 
1036
-		if ( 'group' !== $parent_field['type'] ) {
1036
+		if ( 'group' !== $parent_field[ 'type' ] ) {
1037 1037
 			return false;
1038 1038
 		}
1039 1039
 
1040
-		if ( ! isset( $parent_field['fields'] ) ) {
1041
-			$this->meta_box['fields'][ $parent_field_id ]['fields'] = array();
1040
+		if ( ! isset( $parent_field[ 'fields' ] ) ) {
1041
+			$this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ] = array();
1042 1042
 		}
1043 1043
 
1044 1044
 		$this->_add_field_to_array(
1045 1045
 			$field,
1046
-			$this->meta_box['fields'][ $parent_field_id ]['fields'],
1046
+			$this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ],
1047 1047
 			$position
1048 1048
 		);
1049 1049
 
1050
-		return array( $parent_field_id, $field['id'] );
1050
+		return array( $parent_field_id, $field[ 'id' ] );
1051 1051
 	}
1052 1052
 
1053 1053
 	/**
@@ -1059,9 +1059,9 @@  discard block
 block discarded – undo
1059 1059
 	 */
1060 1060
 	protected function _add_field_to_array( $field, &$fields, $position = 0 ) {
1061 1061
 		if ( $position ) {
1062
-			cmb2_utils()->array_insert( $fields, array( $field['id'] => $field ), $position );
1062
+			cmb2_utils()->array_insert( $fields, array( $field[ 'id' ] => $field ), $position );
1063 1063
 		} else {
1064
-			$fields[ $field['id'] ] = $field;
1064
+			$fields[ $field[ 'id' ] ] = $field;
1065 1065
 		}
1066 1066
 	}
1067 1067
 
@@ -1084,15 +1084,15 @@  discard block
 block discarded – undo
1084 1084
 		unset( $this->fields[ implode( '', $ids ) ] );
1085 1085
 
1086 1086
 		if ( ! $sub_field_id ) {
1087
-			unset( $this->meta_box['fields'][ $field_id ] );
1087
+			unset( $this->meta_box[ 'fields' ][ $field_id ] );
1088 1088
 			return true;
1089 1089
 		}
1090 1090
 
1091
-		if ( isset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] ) ) {
1092
-			unset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] );
1091
+		if ( isset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] ) ) {
1092
+			unset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] );
1093 1093
 		}
1094
-		if ( isset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] ) ) {
1095
-			unset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] );
1094
+		if ( isset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] ) ) {
1095
+			unset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] );
1096 1096
 		}
1097 1097
 		return true;
1098 1098
 	}
@@ -1116,11 +1116,11 @@  discard block
 block discarded – undo
1116 1116
 		list( $field_id, $sub_field_id ) = $ids;
1117 1117
 
1118 1118
 		if ( ! $sub_field_id ) {
1119
-			$this->meta_box['fields'][ $field_id ][ $property ] = $value;
1119
+			$this->meta_box[ 'fields' ][ $field_id ][ $property ] = $value;
1120 1120
 			return $field_id;
1121 1121
 		}
1122 1122
 
1123
-		$this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ][ $property ] = $value;
1123
+		$this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ][ $property ] = $value;
1124 1124
 		return $field_id;
1125 1125
 	}
1126 1126
 
@@ -1134,7 +1134,7 @@  discard block
 block discarded – undo
1134 1134
 	public function get_field_ids( $field_id, $parent_field_id = '' ) {
1135 1135
 		$sub_field_id = $parent_field_id ? $field_id : '';
1136 1136
 		$field_id     = $parent_field_id ? $parent_field_id : $field_id;
1137
-		$fields       =& $this->meta_box['fields'];
1137
+		$fields       = & $this->meta_box[ 'fields' ];
1138 1138
 
1139 1139
 		if ( ! array_key_exists( $field_id, $fields ) ) {
1140 1140
 			$field_id = $this->search_old_school_array( $field_id, $fields );
@@ -1148,12 +1148,12 @@  discard block
 block discarded – undo
1148 1148
 			return array( $field_id, $sub_field_id );
1149 1149
 		}
1150 1150
 
1151
-		if ( 'group' !== $fields[ $field_id ]['type'] ) {
1151
+		if ( 'group' !== $fields[ $field_id ][ 'type' ] ) {
1152 1152
 			return false;
1153 1153
 		}
1154 1154
 
1155
-		if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ]['fields'] ) ) {
1156
-			$sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ]['fields'] );
1155
+		if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ][ 'fields' ] ) ) {
1156
+			$sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ][ 'fields' ] );
1157 1157
 		}
1158 1158
 
1159 1159
 		return false === $sub_field_id ? false : array( $field_id, $sub_field_id );
Please login to merge, or discard this patch.