Completed
Push — trunk ( 16f377...0795f4 )
by Justin
25:11 queued 10:17
created
includes/CMB2_Utils.php 1 patch
Spacing   +33 added lines, -34 removed lines patch added patch discarded remove patch
@@ -40,7 +40,7 @@  discard block
 block discarded – undo
40 40
 		$dir = wp_upload_dir();
41 41
 
42 42
 		// Is URL in uploads directory?
43
-		if ( false === strpos( $img_url, $dir['baseurl'] . '/' ) ) {
43
+		if ( false === strpos( $img_url, $dir[ 'baseurl' ] . '/' ) ) {
44 44
 			return false;
45 45
 		}
46 46
 
@@ -65,8 +65,8 @@  discard block
 block discarded – undo
65 65
 
66 66
 			foreach ( $query->posts as $post_id ) {
67 67
 				$meta = wp_get_attachment_metadata( $post_id );
68
-				$original_file       = basename( $meta['file'] );
69
-				$cropped_image_files = isset( $meta['sizes'] ) ? wp_list_pluck( $meta['sizes'], 'file' ) : array();
68
+				$original_file       = basename( $meta[ 'file' ] );
69
+				$cropped_image_files = isset( $meta[ 'sizes' ] ) ? wp_list_pluck( $meta[ 'sizes' ], 'file' ) : array();
70 70
 				if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
71 71
 					$attachment_id = $post_id;
72 72
 					break;
@@ -128,31 +128,31 @@  discard block
 block discarded – undo
128 128
 			foreach ( $image_sizes as $_size => $data ) {
129 129
 
130 130
 				// If there's an exact match to an existing image size, short circuit.
131
-				if ( $data['width'] == $size[0] && $data['height'] == $size[1] ) {
132
-					$candidates[ $data['width'] * $data['height'] ] = array( $_size, $data );
131
+				if ( $data[ 'width' ] == $size[ 0 ] && $data[ 'height' ] == $size[ 1 ] ) {
132
+					$candidates[ $data[ 'width' ] * $data[ 'height' ] ] = array( $_size, $data );
133 133
 					break;
134 134
 				}
135 135
 
136 136
 				// If it's not an exact match, consider larger sizes with the same aspect ratio.
137
-				if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) {
137
+				if ( $data[ 'width' ] >= $size[ 0 ] && $data[ 'height' ] >= $size[ 1 ] ) {
138 138
 
139 139
 					/*
140 140
 					 * To test for varying crops, we constrain the dimensions of the larger image
141 141
 					 * to the dimensions of the smaller image and see if they match.
142 142
 					 */
143
-					if ( $data['width'] > $size[0] ) {
144
-						$constrained_size = wp_constrain_dimensions( $data['width'], $data['height'], $size[0] );
145
-						$expected_size = array( $size[0], $size[1] );
143
+					if ( $data[ 'width' ] > $size[ 0 ] ) {
144
+						$constrained_size = wp_constrain_dimensions( $data[ 'width' ], $data[ 'height' ], $size[ 0 ] );
145
+						$expected_size = array( $size[ 0 ], $size[ 1 ] );
146 146
 					} else {
147
-						$constrained_size = wp_constrain_dimensions( $size[0], $size[1], $data['width'] );
148
-						$expected_size = array( $data['width'], $data['height'] );
147
+						$constrained_size = wp_constrain_dimensions( $size[ 0 ], $size[ 1 ], $data[ 'width' ] );
148
+						$expected_size = array( $data[ 'width' ], $data[ 'height' ] );
149 149
 					}
150 150
 
151 151
 					// If the image dimensions are within 1px of the expected size, we consider it a match.
152
-					$matched = ( abs( $constrained_size[0] - $expected_size[0] ) <= 1 && abs( $constrained_size[1] - $expected_size[1] ) <= 1 );
152
+					$matched = ( abs( $constrained_size[ 0 ] - $expected_size[ 0 ] ) <= 1 && abs( $constrained_size[ 1 ] - $expected_size[ 1 ] ) <= 1 );
153 153
 
154 154
 					if ( $matched ) {
155
-						$candidates[ $data['width'] * $data['height'] ] = array( $_size, $data );
155
+						$candidates[ $data[ 'width' ] * $data[ 'height' ] ] = array( $_size, $data );
156 156
 					}
157 157
 				}
158 158
 			}
@@ -164,8 +164,8 @@  discard block
 block discarded – undo
164 164
 				}
165 165
 
166 166
 				$data = array_shift( $candidates );
167
-				$data = $data[0];
168
-			} elseif ( ! empty( $image_sizes['thumbnail'] ) && $image_sizes['thumbnail']['width'] >= $size[0] && $image_sizes['thumbnail']['width'] >= $size[1] ) {
167
+				$data = $data[ 0 ];
168
+			} elseif ( ! empty( $image_sizes[ 'thumbnail' ] ) && $image_sizes[ 'thumbnail' ][ 'width' ] >= $size[ 0 ] && $image_sizes[ 'thumbnail' ][ 'width' ] >= $size[ 1 ] ) {
169 169
 				/*
170 170
 				 * When the size requested is smaller than the thumbnail dimensions, we
171 171
 				 * fall back to the thumbnail size.
@@ -260,8 +260,7 @@  discard block
 block discarded – undo
260 260
 		}
261 261
 
262 262
 		return self::is_valid_time_stamp( $string )
263
-			? (int) $string :
264
-			strtotime( (string) $string );
263
+			? (int) $string : strtotime( (string) $string );
265 264
 	}
266 265
 
267 266
 	/**
@@ -457,25 +456,25 @@  discard block
 block discarded – undo
457 456
 
458 457
 		// order is relevant here, since the replacement will be done sequentially.
459 458
 		$supported_options = array(
460
-			'd' => 'dd',  // Day, leading 0
461
-			'j' => 'd',   // Day, no 0
462
-			'z' => 'o',   // Day of the year, no leading zeroes,
459
+			'd' => 'dd', // Day, leading 0
460
+			'j' => 'd', // Day, no 0
461
+			'z' => 'o', // Day of the year, no leading zeroes,
463 462
 			// 'D' => 'D',   // Day name short, not sure how it'll work with translations
464 463
 			// 'l' => 'DD',  // Day name full, idem before
465
-			'm' => 'mm',  // Month of the year, leading 0
466
-			'n' => 'm',   // Month of the year, no leading 0
464
+			'm' => 'mm', // Month of the year, leading 0
465
+			'n' => 'm', // Month of the year, no leading 0
467 466
 			// 'M' => 'M',   // Month, Short name
468 467
 			// 'F' => 'MM',  // Month, full name,
469
-			'y' => 'y',   // Year, two digit
470
-			'Y' => 'yy',  // Year, full
471
-			'H' => 'HH',  // Hour with leading 0 (24 hour)
472
-			'G' => 'H',   // Hour with no leading 0 (24 hour)
473
-			'h' => 'hh',  // Hour with leading 0 (12 hour)
474
-			'g' => 'h',   // Hour with no leading 0 (12 hour),
475
-			'i' => 'mm',  // Minute with leading 0,
476
-			's' => 'ss',  // Second with leading 0,
477
-			'a' => 'tt',  // am/pm
478
-			'A' => 'TT',// AM/PM
468
+			'y' => 'y', // Year, two digit
469
+			'Y' => 'yy', // Year, full
470
+			'H' => 'HH', // Hour with leading 0 (24 hour)
471
+			'G' => 'H', // Hour with no leading 0 (24 hour)
472
+			'h' => 'hh', // Hour with leading 0 (12 hour)
473
+			'g' => 'h', // Hour with no leading 0 (12 hour),
474
+			'i' => 'mm', // Minute with leading 0,
475
+			's' => 'ss', // Second with leading 0,
476
+			'a' => 'tt', // am/pm
477
+			'A' => 'TT', // AM/PM
479 478
 		);
480 479
 
481 480
 		foreach ( $supported_options as $php => $js ) {
@@ -496,7 +495,7 @@  discard block
 block discarded – undo
496 495
 	 * @return string Modified value
497 496
 	 */
498 497
 	public static function wrap_escaped_chars( $value ) {
499
-		return '&#39;' . str_replace( '\\', '', $value[0] ) . '&#39;';
498
+		return '&#39;' . str_replace( '\\', '', $value[ 0 ] ) . '&#39;';
500 499
 	}
501 500
 
502 501
 	/**
@@ -559,7 +558,7 @@  discard block
 block discarded – undo
559 558
 	 * @return string               String of attributes for form element.
560 559
 	 */
561 560
 	public static function concat_attrs( $attrs, $attr_exclude = array() ) {
562
-		$attr_exclude[] = 'rendered';
561
+		$attr_exclude[ ] = 'rendered';
563 562
 		$attributes = '';
564 563
 		foreach ( $attrs as $attr => $val ) {
565 564
 			$excluded = in_array( $attr, (array) $attr_exclude, true );
Please login to merge, or discard this patch.
includes/helper-functions.php 1 patch
Spacing   +21 added lines, -21 removed lines patch added patch discarded remove patch
@@ -96,18 +96,18 @@  discard block
 block discarded – undo
96 96
 	$oembed = cmb2_ajax()->get_oembed_no_edit( $args );
97 97
 
98 98
 	// Send back our embed
99
-	if ( $oembed['embed'] && $oembed['embed'] != $oembed['fallback'] ) {
100
-		return '<div class="cmb2-oembed">' . $oembed['embed'] . '</div>';
99
+	if ( $oembed[ 'embed' ] && $oembed[ 'embed' ] != $oembed[ 'fallback' ] ) {
100
+		return '<div class="cmb2-oembed">' . $oembed[ 'embed' ] . '</div>';
101 101
 	}
102 102
 
103 103
 	$error = sprintf(
104 104
 		/* translators: 1: results for. 2: link to codex.wordpress.org/Embeds */
105 105
 		esc_html__( 'No oEmbed Results Found for %1$s. View more info at %2$s.', 'cmb2' ),
106
-		$oembed['fallback'],
106
+		$oembed[ 'fallback' ],
107 107
 		'<a href="https://codex.wordpress.org/Embeds" target="_blank">codex.wordpress.org/Embeds</a>'
108 108
 	);
109 109
 
110
-	if ( isset( $args['wp_error'] ) && $args['wp_error'] ) {
110
+	if ( isset( $args[ 'wp_error' ] ) && $args[ 'wp_error' ] ) {
111 111
 		return new WP_Error( 'cmb2_get_oembed_result', $error, compact( 'oembed', 'args' ) );
112 112
 	}
113 113
 
@@ -229,7 +229,7 @@  discard block
 block discarded – undo
229 229
 		$cmb = CMB2_Boxes::get( $meta_box );
230 230
 	} else {
231 231
 		// See if we already have an instance of this metabox
232
-		$cmb = CMB2_Boxes::get( $meta_box['id'] );
232
+		$cmb = CMB2_Boxes::get( $meta_box[ 'id' ] );
233 233
 		// If not, we'll initate a new metabox
234 234
 		$cmb = $cmb ? $cmb : new CMB2( $meta_box, $object_id );
235 235
 	}
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	) );
308 308
 
309 309
 	// Set object type explicitly (rather than trying to guess from context)
310
-	$cmb->object_type( $args['object_type'] );
310
+	$cmb->object_type( $args[ 'object_type' ] );
311 311
 
312 312
 	// Save the metabox if it's been submitted
313 313
 	// check permissions
@@ -315,32 +315,32 @@  discard block
 block discarded – undo
315 315
 	if (
316 316
 		$cmb->prop( 'save_fields' )
317 317
 		// check nonce
318
-		&& isset( $_POST['submit-cmb'], $_POST['object_id'], $_POST[ $cmb->nonce() ] )
318
+		&& isset( $_POST[ 'submit-cmb' ], $_POST[ 'object_id' ], $_POST[ $cmb->nonce() ] )
319 319
 		&& wp_verify_nonce( $_POST[ $cmb->nonce() ], $cmb->nonce() )
320
-		&& $object_id && $_POST['object_id'] == $object_id
320
+		&& $object_id && $_POST[ 'object_id' ] == $object_id
321 321
 	) {
322 322
 		$cmb->save_fields( $object_id, $cmb->object_type(), $_POST );
323 323
 	}
324 324
 
325 325
 	// Enqueue JS/CSS
326
-	if ( $args['cmb_styles'] ) {
326
+	if ( $args[ 'cmb_styles' ] ) {
327 327
 		CMB2_hookup::enqueue_cmb_css();
328 328
 	}
329 329
 
330
-	if ( $args['enqueue_js'] ) {
330
+	if ( $args[ 'enqueue_js' ] ) {
331 331
 		CMB2_hookup::enqueue_cmb_js();
332 332
 	}
333 333
 
334
-	$form_format = apply_filters( 'cmb2_get_metabox_form_format', $args['form_format'], $object_id, $cmb );
334
+	$form_format = apply_filters( 'cmb2_get_metabox_form_format', $args[ 'form_format' ], $object_id, $cmb );
335 335
 
336 336
 	$format_parts = explode( '%3$s', $form_format );
337 337
 
338 338
 	// Show cmb form
339
-	printf( $format_parts[0], $cmb->cmb_id, $object_id );
339
+	printf( $format_parts[ 0 ], $cmb->cmb_id, $object_id );
340 340
 	$cmb->show_form();
341 341
 
342
-	if ( isset( $format_parts[1] ) && $format_parts[1] ) {
343
-		printf( str_ireplace( '%4$s', '%1$s', $format_parts[1] ), $args['save_button'] );
342
+	if ( isset( $format_parts[ 1 ] ) && $format_parts[ 1 ] ) {
343
+		printf( str_ireplace( '%4$s', '%1$s', $format_parts[ 1 ] ), $args[ 'save_button' ] );
344 344
 	}
345 345
 
346 346
 }
@@ -354,7 +354,7 @@  discard block
 block discarded – undo
354 354
  * @param  array $args      Optional arguments array
355 355
  */
356 356
 function cmb2_metabox_form( $meta_box, $object_id = 0, $args = array() ) {
357
-	if ( ! isset( $args['echo'] ) || $args['echo'] ) {
357
+	if ( ! isset( $args[ 'echo' ] ) || $args[ 'echo' ] ) {
358 358
 		cmb2_print_metabox_form( $meta_box, $object_id, $args );
359 359
 	} else {
360 360
 		return cmb2_get_metabox_form( $meta_box, $object_id, $args );
@@ -393,12 +393,12 @@  discard block
 block discarded – undo
393 393
 			 * 4 or 2 characters, as needed
394 394
 			 */
395 395
 			'%04d-%02d-%02d %02d:%02d:%02d',
396
-			$parsed_time['tm_year'] + 1900,  // This will be "111", so we need to add 1900.
397
-			$parsed_time['tm_mon'] + 1,      // This will be the month minus one, so we add one.
398
-			$parsed_time['tm_mday'],
399
-			$parsed_time['tm_hour'],
400
-			$parsed_time['tm_min'],
401
-			$parsed_time['tm_sec']
396
+			$parsed_time[ 'tm_year' ] + 1900, // This will be "111", so we need to add 1900.
397
+			$parsed_time[ 'tm_mon' ] + 1, // This will be the month minus one, so we add one.
398
+			$parsed_time[ 'tm_mday' ],
399
+			$parsed_time[ 'tm_hour' ],
400
+			$parsed_time[ 'tm_min' ],
401
+			$parsed_time[ 'tm_sec' ]
402 402
 		);
403 403
 
404 404
 		return new DateTime( $ymd );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Multi_Base.php 1 patch
Spacing   +11 added lines, -11 removed lines patch added patch discarded remove patch
@@ -20,7 +20,7 @@  discard block
 block discarded – undo
20 20
 	 * @return string       Generated option element html
21 21
 	 */
22 22
 	public function select_option( $args = array() ) {
23
-		return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args['value'], selected( isset( $args['checked'] ) && $args['checked'], true, false ), $args['label'] ) . "\n";
23
+		return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args[ 'value' ], selected( isset( $args[ 'checked' ] ) && $args[ 'checked' ], true, false ), $args[ 'label' ] ) . "\n";
24 24
 	}
25 25
 
26 26
 	/**
@@ -41,7 +41,7 @@  discard block
 block discarded – undo
41 41
 			'label' => '',
42 42
 		), $args );
43 43
 
44
-		return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a['id'], $a['label'] );
44
+		return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a[ 'id' ], $a[ 'label' ] );
45 45
 	}
46 46
 
47 47
 	/**
@@ -54,10 +54,10 @@  discard block
 block discarded – undo
54 54
 	 */
55 55
 	public function list_input_checkbox( $args, $i ) {
56 56
 		$saved_value = $this->field->escaped_value();
57
-		if ( is_array( $saved_value ) && in_array( $args['value'], $saved_value ) ) {
58
-			$args['checked'] = 'checked';
57
+		if ( is_array( $saved_value ) && in_array( $args[ 'value' ], $saved_value ) ) {
58
+			$args[ 'checked' ] = 'checked';
59 59
 		}
60
-		$args['type'] = 'checkbox';
60
+		$args[ 'type' ] = 'checkbox';
61 61
 		return $this->list_input( $args, $i );
62 62
 	}
63 63
 
@@ -71,8 +71,8 @@  discard block
 block discarded – undo
71 71
 	public function concat_items( $args = array() ) {
72 72
 		$field = $this->field;
73 73
 
74
-		$method = isset( $args['method'] ) ? $args['method'] : 'select_option';
75
-		unset( $args['method'] );
74
+		$method = isset( $args[ 'method' ] ) ? $args[ 'method' ] : 'select_option';
75
+		unset( $args[ 'method' ] );
76 76
 
77 77
 		$value = null !== $field->escaped_value()
78 78
 			? $field->escaped_value()
@@ -87,7 +87,7 @@  discard block
 block discarded – undo
87 87
 
88 88
 		$options = array();
89 89
 		if ( $option_none = $field->args( 'show_option_none' ) ) {
90
-			$options[''] = $option_none;
90
+			$options[ '' ] = $option_none;
91 91
 		}
92 92
 		$options = $options + (array) $field->options();
93 93
 		foreach ( $options as $opt_value => $opt_label ) {
@@ -95,12 +95,12 @@  discard block
 block discarded – undo
95 95
 			// Clone args & modify for just this item
96 96
 			$a = $args;
97 97
 
98
-			$a['value'] = $opt_value;
99
-			$a['label'] = $opt_label;
98
+			$a[ 'value' ] = $opt_value;
99
+			$a[ 'label' ] = $opt_label;
100 100
 
101 101
 			// Check if this option is the value of the input
102 102
 			if ( $value === $opt_value ) {
103
-				$a['checked'] = 'checked';
103
+				$a[ 'checked' ] = 'checked';
104 104
 			}
105 105
 
106 106
 			$concatenated_items .= $this->$method( $a, $i++ );
Please login to merge, or discard this patch.
includes/types/CMB2_Type_File_List.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -29,8 +29,8 @@
 block discarded – undo
29 29
 			'size'  => 45,
30 30
 			'desc'  => '',
31 31
 			'value'  => '',
32
-			'data-previewsize' => sprintf( '[%d,%d]', $img_size_data['width'], $img_size_data['height'] ),
33
-			'data-sizename'    => $img_size_data['name'],
32
+			'data-previewsize' => sprintf( '[%d,%d]', $img_size_data[ 'width' ], $img_size_data[ 'height' ] ),
33
+			'data-sizename'    => $img_size_data[ 'name' ],
34 34
 			'data-queryargs'   => ! empty( $query_args ) ? json_encode( $query_args ) : '',
35 35
 			'js_dependencies'  => 'media-editor',
36 36
 		) );
Please login to merge, or discard this patch.
includes/CMB2_Base.php 1 patch
Spacing   +2 added lines, -2 removed lines patch added patch discarded remove patch
@@ -403,11 +403,11 @@
 block discarded – undo
403 403
 			switch ( $message ) {
404 404
 
405 405
 				case self::DEPRECATED_PARAM:
406
-					$message = sprintf( __( 'The "%1$s" field parameter has been deprecated in favor of the "%1$s" parameter.', 'cmb2' ), $args[3], $args[4] );
406
+					$message = sprintf( __( 'The "%1$s" field parameter has been deprecated in favor of the "%1$s" parameter.', 'cmb2' ), $args[ 3 ], $args[ 4 ] );
407 407
 					break;
408 408
 
409 409
 				case self::DEPRECATED_CB_PARAM:
410
-					$message = sprintf( __( 'Using the "%1$s" field parameter as a callback has been deprecated in favor of the "%1$s" parameter.', 'cmb2' ), $args[3], $args[4] );
410
+					$message = sprintf( __( 'Using the "%1$s" field parameter as a callback has been deprecated in favor of the "%1$s" parameter.', 'cmb2' ), $args[ 3 ], $args[ 4 ] );
411 411
 					break;
412 412
 
413 413
 				default:
Please login to merge, or discard this patch.
includes/CMB2_Field.php 1 patch
Spacing   +78 added lines, -78 removed lines patch added patch discarded remove patch
@@ -122,21 +122,21 @@  discard block
 block discarded – undo
122 122
 	 */
123 123
 	public function __construct( $args ) {
124 124
 
125
-		if ( ! empty( $args['group_field'] ) ) {
126
-			$this->group       = $args['group_field'];
125
+		if ( ! empty( $args[ 'group_field' ] ) ) {
126
+			$this->group       = $args[ 'group_field' ];
127 127
 			$this->object_id   = $this->group->object_id;
128 128
 			$this->object_type = $this->group->object_type;
129 129
 			$this->cmb_id      = $this->group->cmb_id;
130 130
 		} else {
131
-			$this->object_id   = isset( $args['object_id'] ) && '_' !== $args['object_id'] ? $args['object_id'] : 0;
132
-			$this->object_type = isset( $args['object_type'] ) ? $args['object_type'] : 'post';
131
+			$this->object_id   = isset( $args[ 'object_id' ] ) && '_' !== $args[ 'object_id' ] ? $args[ 'object_id' ] : 0;
132
+			$this->object_type = isset( $args[ 'object_type' ] ) ? $args[ 'object_type' ] : 'post';
133 133
 
134
-			if ( isset( $args['cmb_id'] ) ) {
135
-				$this->cmb_id = $args['cmb_id'];
134
+			if ( isset( $args[ 'cmb_id' ] ) ) {
135
+				$this->cmb_id = $args[ 'cmb_id' ];
136 136
 			}
137 137
 		}
138 138
 
139
-		$this->args = $this->_set_field_defaults( $args['field_args'], $args );
139
+		$this->args = $this->_set_field_defaults( $args[ 'field_args' ], $args );
140 140
 
141 141
 		if ( $this->object_id ) {
142 142
 			$this->value = $this->get_data();
@@ -156,7 +156,7 @@  discard block
 block discarded – undo
156 156
 			return call_user_func_array( array( $this, 'get_string' ), $arguments );
157 157
 		}
158 158
 
159
-		$key = isset( $arguments[0] ) ? $arguments[0] : false;
159
+		$key = isset( $arguments[ 0 ] ) ? $arguments[ 0 ] : false;
160 160
 		return $this->args( $name, $key );
161 161
 	}
162 162
 
@@ -232,9 +232,9 @@  discard block
 block discarded – undo
232 232
 	 */
233 233
 	public function get_data( $field_id = '', $args = array() ) {
234 234
 		if ( $field_id ) {
235
-			$args['field_id'] = $field_id;
235
+			$args[ 'field_id' ] = $field_id;
236 236
 		} elseif ( $this->group ) {
237
-			$args['field_id'] = $this->group->id();
237
+			$args[ 'field_id' ] = $this->group->id();
238 238
 		}
239 239
 
240 240
 		$a = $this->data_args( $args );
@@ -275,13 +275,13 @@  discard block
 block discarded – undo
275 275
 		 *
276 276
 		 * @since 2.0.0
277 277
 		 */
278
-		$data = apply_filters( "cmb2_override_{$a['field_id']}_meta_value", $data, $this->object_id, $a, $this );
278
+		$data = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_value", $data, $this->object_id, $a, $this );
279 279
 
280 280
 		// If no override, get value normally
281 281
 		if ( 'cmb2_field_no_override_val' === $data ) {
282
-			$data = 'options-page' === $a['type']
283
-				? cmb2_options( $a['id'] )->get( $a['field_id'] )
284
-				: get_metadata( $a['type'], $a['id'], $a['field_id'], ( $a['single'] || $a['repeat'] ) );
282
+			$data = 'options-page' === $a[ 'type' ]
283
+				? cmb2_options( $a[ 'id' ] )->get( $a[ 'field_id' ] )
284
+				: get_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], ( $a[ 'single' ] || $a[ 'repeat' ] ) );
285 285
 		}
286 286
 
287 287
 		if ( $this->group ) {
@@ -304,7 +304,7 @@  discard block
 block discarded – undo
304 304
 	public function update_data( $new_value, $single = true ) {
305 305
 		$a = $this->data_args( array( 'single' => $single ) );
306 306
 
307
-		$a['value'] = $a['repeat'] ? array_values( $new_value ) : $new_value;
307
+		$a[ 'value' ] = $a[ 'repeat' ] ? array_values( $new_value ) : $new_value;
308 308
 
309 309
 		/**
310 310
 		 * Filter whether to override saving of meta value.
@@ -340,7 +340,7 @@  discard block
 block discarded – undo
340 340
 		 *
341 341
 		 * @since 2.0.0
342 342
 		 */
343
-		$override = apply_filters( "cmb2_override_{$a['field_id']}_meta_save", $override, $a, $this->args(), $this );
343
+		$override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_save", $override, $a, $this->args(), $this );
344 344
 
345 345
 		// If override, return that
346 346
 		if ( null !== $override ) {
@@ -348,22 +348,22 @@  discard block
 block discarded – undo
348 348
 		}
349 349
 
350 350
 		// Options page handling (or temp data store)
351
-		if ( 'options-page' === $a['type'] || empty( $a['id'] ) ) {
352
-			return cmb2_options( $a['id'] )->update( $a['field_id'], $a['value'], false, $a['single'] );
351
+		if ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) {
352
+			return cmb2_options( $a[ 'id' ] )->update( $a[ 'field_id' ], $a[ 'value' ], false, $a[ 'single' ] );
353 353
 		}
354 354
 
355 355
 		// Add metadata if not single
356
-		if ( ! $a['single'] ) {
357
-			return add_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'], false );
356
+		if ( ! $a[ 'single' ] ) {
357
+			return add_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ], false );
358 358
 		}
359 359
 
360 360
 		// Delete meta if we have an empty array
361
-		if ( is_array( $a['value'] ) && empty( $a['value'] ) ) {
362
-			return delete_metadata( $a['type'], $a['id'], $a['field_id'], $this->value );
361
+		if ( is_array( $a[ 'value' ] ) && empty( $a[ 'value' ] ) ) {
362
+			return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $this->value );
363 363
 		}
364 364
 
365 365
 		// Update metadata
366
-		return update_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'] );
366
+		return update_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ] );
367 367
 	}
368 368
 
369 369
 	/**
@@ -414,18 +414,18 @@  discard block
 block discarded – undo
414 414
 		 * @param array $field_args All field arguments
415 415
 		 * @param CMB2_Field object $field This field object
416 416
 		 */
417
-		$override = apply_filters( "cmb2_override_{$a['field_id']}_meta_remove", $override, $a, $this->args(), $this );
417
+		$override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_remove", $override, $a, $this->args(), $this );
418 418
 
419 419
 		// If no override, remove as usual
420 420
 		if ( null !== $override ) {
421 421
 			return $override;
422 422
 		} // Option page handling
423
-		elseif ( 'options-page' === $a['type'] || empty( $a['id'] ) ) {
424
-			return cmb2_options( $a['id'] )->remove( $a['field_id'] );
423
+		elseif ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) {
424
+			return cmb2_options( $a[ 'id' ] )->remove( $a[ 'field_id' ] );
425 425
 		}
426 426
 
427 427
 		// Remove metadata
428
-		return delete_metadata( $a['type'], $a['id'], $a['field_id'], $old );
428
+		return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $old );
429 429
 	}
430 430
 
431 431
 	/**
@@ -891,7 +891,7 @@  discard block
 block discarded – undo
891 891
 
892 892
 		foreach ( $conditional_classes as $class => $condition ) {
893 893
 			if ( $condition ) {
894
-				$classes[] = $class;
894
+				$classes[ ] = $class;
895 895
 			}
896 896
 		}
897 897
 
@@ -902,7 +902,7 @@  discard block
 block discarded – undo
902 902
 		}
903 903
 
904 904
 		if ( $added_classes ) {
905
-			$classes[] = esc_attr( $added_classes );
905
+			$classes[ ] = esc_attr( $added_classes );
906 906
 		}
907 907
 
908 908
 		/**
@@ -1005,10 +1005,10 @@  discard block
 block discarded – undo
1005 1005
 	public function get_string( $text_key, $fallback ) {
1006 1006
 		// If null, populate with our field strings values.
1007 1007
 		if ( null === $this->strings ) {
1008
-			$this->strings = (array) $this->args['text'];
1008
+			$this->strings = (array) $this->args[ 'text' ];
1009 1009
 
1010
-			if ( is_callable( $this->args['text_cb'] ) ) {
1011
-				$strings = call_user_func( $this->args['text_cb'], $this );
1010
+			if ( is_callable( $this->args[ 'text_cb' ] ) ) {
1011
+				$strings = call_user_func( $this->args[ 'text_cb' ], $this );
1012 1012
 
1013 1013
 				if ( $strings && is_array( $strings ) ) {
1014 1014
 					$this->strings += $strings;
@@ -1043,10 +1043,10 @@  discard block
 block discarded – undo
1043 1043
 			return $this->field_options;
1044 1044
 		}
1045 1045
 
1046
-		$this->field_options = (array) $this->args['options'];
1046
+		$this->field_options = (array) $this->args[ 'options' ];
1047 1047
 
1048
-		if ( is_callable( $this->args['options_cb'] ) ) {
1049
-			$options = call_user_func( $this->args['options_cb'], $this );
1048
+		if ( is_callable( $this->args[ 'options_cb' ] ) ) {
1049
+			$options = call_user_func( $this->args[ 'options_cb' ], $this );
1050 1050
 
1051 1051
 			if ( $options && is_array( $options ) ) {
1052 1052
 				$this->field_options = $options + $this->field_options;
@@ -1068,7 +1068,7 @@  discard block
 block discarded – undo
1068 1068
 	 */
1069 1069
 	public function add_js_dependencies( $dependencies = array() ) {
1070 1070
 		foreach ( (array) $dependencies as $dependency ) {
1071
-			$this->args['js_dependencies'][ $dependency ] = $dependency;
1071
+			$this->args[ 'js_dependencies' ][ $dependency ] = $dependency;
1072 1072
 		}
1073 1073
 
1074 1074
 		CMB2_JS::add_dependencies( $dependencies );
@@ -1082,17 +1082,17 @@  discard block
 block discarded – undo
1082 1082
 	 * @return mixed  Default field value
1083 1083
 	 */
1084 1084
 	public function get_default() {
1085
-		if ( null !== $this->args['default'] ) {
1086
-			return $this->args['default'];
1085
+		if ( null !== $this->args[ 'default' ] ) {
1086
+			return $this->args[ 'default' ];
1087 1087
 		}
1088 1088
 
1089
-		$param = is_callable( $this->args['default_cb'] ) ? 'default_cb' : 'default';
1089
+		$param = is_callable( $this->args[ 'default_cb' ] ) ? 'default_cb' : 'default';
1090 1090
 		$default = $this->get_param_callback_result( $param );
1091 1091
 
1092 1092
 		// Allow a filter override of the default value
1093
-		$this->args['default'] = apply_filters( 'cmb2_default_filter', $default, $this );
1093
+		$this->args[ 'default' ] = apply_filters( 'cmb2_default_filter', $default, $this );
1094 1094
 
1095
-		return $this->args['default'];
1095
+		return $this->args[ 'default' ];
1096 1096
 	}
1097 1097
 
1098 1098
 	/**
@@ -1123,18 +1123,18 @@  discard block
 block discarded – undo
1123 1123
 			'classes_cb'        => '',
1124 1124
 			'select_all_button' => true,
1125 1125
 			'multiple'          => false,
1126
-			'repeatable'        => isset( $args['type'] ) && 'group' == $args['type'],
1126
+			'repeatable'        => isset( $args[ 'type' ] ) && 'group' == $args[ 'type' ],
1127 1127
 			'inline'            => false,
1128 1128
 			'on_front'          => true,
1129 1129
 			'show_names'        => true,
1130 1130
 			'save_field'        => true, // Will not save if false
1131 1131
 			'date_format'       => 'm\/d\/Y',
1132 1132
 			'time_format'       => 'h:i A',
1133
-			'description'       => isset( $args['desc'] ) ? $args['desc'] : '',
1134
-			'preview_size'      => 'file' == $args['type'] ? array( 350, 350 ) : array( 50, 50 ),
1133
+			'description'       => isset( $args[ 'desc' ] ) ? $args[ 'desc' ] : '',
1134
+			'preview_size'      => 'file' == $args[ 'type' ] ? array( 350, 350 ) : array( 50, 50 ),
1135 1135
 			'render_row_cb'     => array( $this, 'render_field_callback' ),
1136 1136
 			'display_cb'        => array( $this, 'display_value_callback' ),
1137
-			'label_cb'          => 'title' != $args['type'] ? array( $this, 'label' ) : '',
1137
+			'label_cb'          => 'title' != $args[ 'type' ] ? array( $this, 'label' ) : '',
1138 1138
 			'column'            => false,
1139 1139
 			'js_dependencies'   => array(),
1140 1140
 			'show_in_rest'      => null,
@@ -1149,43 +1149,43 @@  discard block
 block discarded – undo
1149 1149
 		 */
1150 1150
 		$args = $this->convert_deprecated_params( $args );
1151 1151
 
1152
-		$args['repeatable'] = $args['repeatable'] && ! $this->repeatable_exception( $args['type'] );
1153
-		$args['inline']     = $args['inline'] || false !== stripos( $args['type'], '_inline' );
1152
+		$args[ 'repeatable' ] = $args[ 'repeatable' ] && ! $this->repeatable_exception( $args[ 'type' ] );
1153
+		$args[ 'inline' ]     = $args[ 'inline' ] || false !== stripos( $args[ 'type' ], '_inline' );
1154 1154
 
1155
-		$args['options']    = 'group' == $args['type'] ? wp_parse_args( $args['options'], array(
1155
+		$args[ 'options' ]    = 'group' == $args[ 'type' ] ? wp_parse_args( $args[ 'options' ], array(
1156 1156
 			'add_button'    => esc_html__( 'Add Group', 'cmb2' ),
1157 1157
 			'remove_button' => esc_html__( 'Remove Group', 'cmb2' ),
1158
-		) ) : $args['options'];
1158
+		) ) : $args[ 'options' ];
1159 1159
 
1160
-		$args['_id']        = $args['id'];
1161
-		$args['_name']      = $args['id'];
1160
+		$args[ '_id' ]        = $args[ 'id' ];
1161
+		$args[ '_name' ]      = $args[ 'id' ];
1162 1162
 
1163 1163
 		if ( $this->group ) {
1164 1164
 
1165
-			$args['id']    = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args['id'];
1166
-			$args['_name'] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args['_name'] . ']';
1165
+			$args[ 'id' ]    = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args[ 'id' ];
1166
+			$args[ '_name' ] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args[ '_name' ] . ']';
1167 1167
 		}
1168 1168
 
1169
-		if ( 'wysiwyg' == $args['type'] ) {
1170
-			$args['id'] = strtolower( str_ireplace( '-', '_', $args['id'] ) );
1171
-			$args['options']['textarea_name'] = $args['_name'];
1169
+		if ( 'wysiwyg' == $args[ 'type' ] ) {
1170
+			$args[ 'id' ] = strtolower( str_ireplace( '-', '_', $args[ 'id' ] ) );
1171
+			$args[ 'options' ][ 'textarea_name' ] = $args[ '_name' ];
1172 1172
 		}
1173 1173
 
1174 1174
 		$option_types = apply_filters( 'cmb2_all_or_nothing_types', array( 'select', 'radio', 'radio_inline', 'taxonomy_select', 'taxonomy_radio', 'taxonomy_radio_inline' ), $this );
1175 1175
 
1176
-		if ( in_array( $args['type'], $option_types, true ) ) {
1176
+		if ( in_array( $args[ 'type' ], $option_types, true ) ) {
1177 1177
 
1178
-			$args['show_option_none'] = isset( $args['show_option_none'] ) ? $args['show_option_none'] : null;
1179
-			$args['show_option_none'] = true === $args['show_option_none'] ? esc_html__( 'None', 'cmb2' ) : $args['show_option_none'];
1178
+			$args[ 'show_option_none' ] = isset( $args[ 'show_option_none' ] ) ? $args[ 'show_option_none' ] : null;
1179
+			$args[ 'show_option_none' ] = true === $args[ 'show_option_none' ] ? esc_html__( 'None', 'cmb2' ) : $args[ 'show_option_none' ];
1180 1180
 
1181
-			if ( null === $args['show_option_none'] ) {
1182
-				$off_by_default = in_array( $args['type'], array( 'select', 'radio', 'radio_inline' ), true );
1183
-				$args['show_option_none'] = $off_by_default ? false : esc_html__( 'None', 'cmb2' );
1181
+			if ( null === $args[ 'show_option_none' ] ) {
1182
+				$off_by_default = in_array( $args[ 'type' ], array( 'select', 'radio', 'radio_inline' ), true );
1183
+				$args[ 'show_option_none' ] = $off_by_default ? false : esc_html__( 'None', 'cmb2' );
1184 1184
 			}
1185 1185
 		}
1186 1186
 
1187
-		$args['has_supporting_data'] = in_array(
1188
-			$args['type'],
1187
+		$args[ 'has_supporting_data' ] = in_array(
1188
+			$args[ 'type' ],
1189 1189
 			array(
1190 1190
 				// CMB2_Sanitize::_save_file_id_value()/CMB2_Sanitize::_get_group_file_value_array()
1191 1191
 				'file',
@@ -1209,10 +1209,10 @@  discard block
 block discarded – undo
1209 1209
 	protected function get_default_args( $field_args, $field_group = null ) {
1210 1210
 		$args = parent::get_default_args( array(), $this->group );
1211 1211
 
1212
-		if ( isset( $field_args['field_args'] ) ) {
1212
+		if ( isset( $field_args[ 'field_args' ] ) ) {
1213 1213
 			$args = wp_parse_args( $field_args, $args );
1214 1214
 		} else {
1215
-			$args['field_args'] = wp_parse_args( $field_args, $this->args );
1215
+			$args[ 'field_args' ] = wp_parse_args( $field_args, $this->args );
1216 1216
 		}
1217 1217
 
1218 1218
 		return $args;
@@ -1256,41 +1256,41 @@  discard block
 block discarded – undo
1256 1256
 	 */
1257 1257
 	protected function convert_deprecated_params( $args ) {
1258 1258
 
1259
-		if ( isset( $args['row_classes'] ) ) {
1259
+		if ( isset( $args[ 'row_classes' ] ) ) {
1260 1260
 
1261 1261
 			// We'll let this one be.
1262 1262
 			// $this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_PARAM, 'row_classes', 'classes' );
1263 1263
 			// row_classes param could be a callback. This is definitely deprecated.
1264
-			if ( is_callable( $args['row_classes'] ) ) {
1264
+			if ( is_callable( $args[ 'row_classes' ] ) ) {
1265 1265
 
1266 1266
 				$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'row_classes', 'classes_cb' );
1267 1267
 
1268
-				$args['classes_cb'] = $args['row_classes'];
1269
-				$args['classes'] = null;
1268
+				$args[ 'classes_cb' ] = $args[ 'row_classes' ];
1269
+				$args[ 'classes' ] = null;
1270 1270
 			} else {
1271 1271
 
1272
-				$args['classes'] = $args['row_classes'];
1272
+				$args[ 'classes' ] = $args[ 'row_classes' ];
1273 1273
 			}
1274 1274
 
1275
-			unset( $args['row_classes'] );
1275
+			unset( $args[ 'row_classes' ] );
1276 1276
 		}
1277 1277
 
1278 1278
 		// default param can be passed a callback as well
1279
-		if ( is_callable( $args['default'] ) ) {
1279
+		if ( is_callable( $args[ 'default' ] ) ) {
1280 1280
 
1281 1281
 			$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'default', 'default_cb' );
1282 1282
 
1283
-			$args['default_cb'] = $args['default'];
1284
-			$args['default'] = null;
1283
+			$args[ 'default_cb' ] = $args[ 'default' ];
1284
+			$args[ 'default' ] = null;
1285 1285
 		}
1286 1286
 
1287 1287
 		// options param can be passed a callback as well
1288
-		if ( is_callable( $args['options'] ) ) {
1288
+		if ( is_callable( $args[ 'options' ] ) ) {
1289 1289
 
1290 1290
 			$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'options', 'options_cb' );
1291 1291
 
1292
-			$args['options_cb'] = $args['options'];
1293
-			$args['options'] = array();
1292
+			$args[ 'options_cb' ] = $args[ 'options' ];
1293
+			$args[ 'options' ] = array();
1294 1294
 		}
1295 1295
 
1296 1296
 		return $args;
Please login to merge, or discard this patch.
includes/CMB2_Field_Display.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -205,8 +205,8 @@  discard block
 block discarded – undo
205 205
 		$options = $this->field->options();
206 206
 
207 207
 		$fallback = $this->field->args( 'show_option_none' );
208
-		if ( ! $fallback && isset( $options[''] ) ) {
209
-			$fallback = $options[''];
208
+		if ( ! $fallback && isset( $options[ '' ] ) ) {
209
+			$fallback = $options[ '' ];
210 210
 		}
211 211
 		if ( ! $this->value && $fallback ) {
212 212
 			echo $fallback;
@@ -234,9 +234,9 @@  discard block
 block discarded – undo
234 234
 		$output = array();
235 235
 		foreach ( $this->value as $val ) {
236 236
 			if ( isset( $options[ $val ] ) ) {
237
-				$output[] = $options[ $val ];
237
+				$output[ ] = $options[ $val ];
238 238
 			} else {
239
-				$output[] = esc_attr( $val );
239
+				$output[ ] = esc_attr( $val );
240 240
 			}
241 241
 		}
242 242
 
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 		if ( $datetime && $datetime instanceof DateTime ) {
308 308
 			$tz       = $datetime->getTimezone();
309 309
 			$tzstring = $tz->getName();
310
-			$this->value    = $datetime->getTimestamp();
310
+			$this->value = $datetime->getTimestamp();
311 311
 		}
312 312
 
313 313
 		$date = $this->field->get_timestamp_format( 'date_format', $this->value );
@@ -359,10 +359,10 @@  discard block
 block discarded – undo
359 359
 			$terms = array();
360 360
 			if ( is_array( $default ) ) {
361 361
 				foreach ( $default as $slug ) {
362
-					$terms[] = get_term_by( 'slug', $slug, $taxonomy );
362
+					$terms[ ] = get_term_by( 'slug', $slug, $taxonomy );
363 363
 				}
364 364
 			} else {
365
-				$terms[] = get_term_by( 'slug', $default, $taxonomy );
365
+				$terms[ ] = get_term_by( 'slug', $default, $taxonomy );
366 366
 			}
367 367
 		}
368 368
 
@@ -371,7 +371,7 @@  discard block
 block discarded – undo
371 371
 			$links = array();
372 372
 			foreach ( $terms as $term ) {
373 373
 				$link = get_edit_term_link( $term->term_id, $taxonomy );
374
-				$links[] = '<a href="' . esc_url( $link ) . '">' . esc_html( $term->name ) . '</a>';
374
+				$links[ ] = '<a href="' . esc_url( $link ) . '">' . esc_html( $term->name ) . '</a>';
375 375
 			}
376 376
 			// Then loop and output.
377 377
 			echo '<div class="cmb2-taxonomy-terms-', esc_attr( $taxonomy ), '">';
@@ -416,7 +416,7 @@  discard block
 block discarded – undo
416 416
 			if ( $id ) {
417 417
 				$image = wp_get_attachment_image( $id, $img_size, null, array( 'class' => 'cmb-image-display' ) );
418 418
 			} else {
419
-				$size = is_array( $img_size ) ? $img_size[0] : 200;
419
+				$size = is_array( $img_size ) ? $img_size[ 0 ] : 200;
420 420
 				$image = '<img class="cmb-image-display" style="max-width: ' . absint( $size ) . 'px; width: 100%; height: auto;" src="' . $url_value . '" alt="" />';
421 421
 			}
422 422
 
Please login to merge, or discard this patch.
includes/CMB2_hookup.php 1 patch
Spacing   +18 added lines, -18 removed lines patch added patch discarded remove patch
@@ -276,25 +276,25 @@  discard block
 block discarded – undo
276 276
 		$fields = $this->cmb->prop( 'fields' );
277 277
 
278 278
 		foreach ( $fields as $key => $field ) {
279
-			if ( ! isset( $field['column'] ) ) {
279
+			if ( ! isset( $field[ 'column' ] ) ) {
280 280
 				continue;
281 281
 			}
282 282
 
283
-			$column = $field['column'];
283
+			$column = $field[ 'column' ];
284 284
 
285
-			if ( false === $column['position'] ) {
285
+			if ( false === $column[ 'position' ] ) {
286 286
 
287
-				$columns[ $field['id'] ] = $column['name'];
287
+				$columns[ $field[ 'id' ] ] = $column[ 'name' ];
288 288
 
289 289
 			} else {
290 290
 
291
-				$before = array_slice( $columns, 0, absint( $column['position'] ) );
292
-				$before[ $field['id'] ] = $column['name'];
291
+				$before = array_slice( $columns, 0, absint( $column[ 'position' ] ) );
292
+				$before[ $field[ 'id' ] ] = $column[ 'name' ];
293 293
 				$columns = $before + $columns;
294 294
 			}
295 295
 
296
-			$column['field'] = $field;
297
-			$this->columns[ $field['id'] ] = $column;
296
+			$column[ 'field' ] = $field;
297
+			$this->columns[ $field[ 'id' ] ] = $column;
298 298
 		}
299 299
 
300 300
 		return $columns;
@@ -308,7 +308,7 @@  discard block
 block discarded – undo
308 308
 	public function column_display( $column_name, $object_id ) {
309 309
 		if ( isset( $this->columns[ $column_name ] ) ) {
310 310
 				$field = new CMB2_Field( array(
311
-					'field_args'  => $this->columns[ $column_name ]['field'],
311
+					'field_args'  => $this->columns[ $column_name ][ 'field' ],
312 312
 					'object_type' => $this->object_type,
313 313
 					'object_id'   => $this->cmb->object_id( $object_id ),
314 314
 					'cmb_id'      => $this->cmb->cmb_id,
@@ -488,13 +488,13 @@  discard block
 block discarded – undo
488 488
 	 */
489 489
 	public function postbox_classes( $classes ) {
490 490
 		if ( $this->cmb->prop( 'closed' ) && ! in_array( 'closed', $classes ) ) {
491
-			$classes[] = 'closed';
491
+			$classes[ ] = 'closed';
492 492
 		}
493 493
 
494 494
 		if ( $this->cmb->is_alternate_context_box() ) {
495 495
 			$classes = $this->alternate_context_postbox_classes( $classes );
496 496
 		} else {
497
-			$classes[] = 'cmb2-postbox';
497
+			$classes[ ] = 'cmb2-postbox';
498 498
 		}
499 499
 
500 500
 		return $classes;
@@ -508,19 +508,19 @@  discard block
 block discarded – undo
508 508
 	 * @return array           Modified array of classes
509 509
 	 */
510 510
 	protected function alternate_context_postbox_classes( $classes ) {
511
-		$classes[] = 'context-box';
512
-		$classes[] = 'context-' . $this->cmb->prop( 'context' ) . '-box';
511
+		$classes[ ] = 'context-box';
512
+		$classes[ ] = 'context-' . $this->cmb->prop( 'context' ) . '-box';
513 513
 
514 514
 		if ( in_array( $this->cmb->cmb_id, get_hidden_meta_boxes( get_current_screen() ) ) ) {
515
-			$classes[] = 'hide-if-js';
515
+			$classes[ ] = 'hide-if-js';
516 516
 		}
517 517
 
518 518
 		$add_wrap = $this->cmb->prop( 'title' ) || ! $this->cmb->prop( 'remove_box_wrap' );
519 519
 
520 520
 		if ( $add_wrap ) {
521
-			$classes[] = 'cmb2-postbox postbox';
521
+			$classes[ ] = 'cmb2-postbox postbox';
522 522
 		} else {
523
-			$classes[] = 'cmb2-no-box-wrap';
523
+			$classes[ ] = 'cmb2-no-box-wrap';
524 524
 		}
525 525
 
526 526
 		return $classes;
@@ -544,7 +544,7 @@  discard block
 block discarded – undo
544 544
 	public function user_new_metabox( $section ) {
545 545
 		if ( $section == $this->cmb->prop( 'new_user_section' ) ) {
546 546
 			$object_id = $this->cmb->object_id();
547
-			$this->cmb->object_id( isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id );
547
+			$this->cmb->object_id( isset( $_REQUEST[ 'user_id' ] ) ? $_REQUEST[ 'user_id' ] : $object_id );
548 548
 			$this->user_metabox();
549 549
 		}
550 550
 	}
@@ -735,7 +735,7 @@  discard block
 block discarded – undo
735 735
 
736 736
 			$data_to_delete = array();
737 737
 			foreach ( $this->cmb->prop( 'fields' ) as $field ) {
738
-				$data_to_delete[ $field['id'] ] = '';
738
+				$data_to_delete[ $field[ 'id' ] ] = '';
739 739
 			}
740 740
 
741 741
 			$this->cmb->save_fields( $term_id, 'term', $data_to_delete );
Please login to merge, or discard this patch.
includes/CMB2.php 1 patch
Spacing   +75 added lines, -75 removed lines patch added patch discarded remove patch
@@ -134,19 +134,19 @@  discard block
 block discarded – undo
134 134
 	 */
135 135
 	public function __construct( $config, $object_id = 0 ) {
136 136
 
137
-		if ( empty( $config['id'] ) ) {
137
+		if ( empty( $config[ 'id' ] ) ) {
138 138
 			wp_die( esc_html__( 'Metabox configuration is required to have an ID parameter.', 'cmb2' ) );
139 139
 		}
140 140
 
141 141
 		$this->meta_box = wp_parse_args( $config, $this->mb_defaults );
142
-		$this->meta_box['fields'] = array();
142
+		$this->meta_box[ 'fields' ] = array();
143 143
 
144 144
 		$this->object_id( $object_id );
145 145
 		$this->mb_object_type();
146
-		$this->cmb_id = $config['id'];
146
+		$this->cmb_id = $config[ 'id' ];
147 147
 
148
-		if ( ! empty( $config['fields'] ) && is_array( $config['fields'] ) ) {
149
-			$this->add_fields( $config['fields'] );
148
+		if ( ! empty( $config[ 'fields' ] ) && is_array( $config[ 'fields' ] ) ) {
149
+			$this->add_fields( $config[ 'fields' ] );
150 150
 		}
151 151
 
152 152
 		CMB2_Boxes::add( $this );
@@ -256,17 +256,17 @@  discard block
 block discarded – undo
256 256
 
257 257
 			// Include custom class if requesting no title.
258 258
 			if ( ! $this->prop( 'title' ) && ! $this->prop( 'remove_box_wrap' ) ) {
259
-				$context[] = 'cmb2-context-wrap-no-title';
259
+				$context[ ] = 'cmb2-context-wrap-no-title';
260 260
 			}
261 261
 
262 262
 			// Include a generic context wrapper.
263
-			$context[] = 'cmb2-context-wrap';
263
+			$context[ ] = 'cmb2-context-wrap';
264 264
 
265 265
 			// Include a context-type based context wrapper.
266
-			$context[] = 'cmb2-context-wrap-' . $this->prop( 'context' );
266
+			$context[ ] = 'cmb2-context-wrap-' . $this->prop( 'context' );
267 267
 
268 268
 			// Include an ID based context wrapper as well.
269
-			$context[] = 'cmb2-context-wrap-' . $this->prop( 'id' );
269
+			$context[ ] = 'cmb2-context-wrap-' . $this->prop( 'id' );
270 270
 
271 271
 			// And merge all the classes back into the array.
272 272
 			$classes = array_merge( $classes, $context );
@@ -347,22 +347,22 @@  discard block
 block discarded – undo
347 347
 	 * @return mixed CMB2_Field object if successful.
348 348
 	 */
349 349
 	public function render_field( $field_args ) {
350
-		$field_args['context'] = $this->prop( 'context' );
350
+		$field_args[ 'context' ] = $this->prop( 'context' );
351 351
 
352
-		if ( 'group' == $field_args['type'] ) {
352
+		if ( 'group' == $field_args[ 'type' ] ) {
353 353
 
354
-			if ( ! isset( $field_args['show_names'] ) ) {
355
-				$field_args['show_names'] = $this->prop( 'show_names' );
354
+			if ( ! isset( $field_args[ 'show_names' ] ) ) {
355
+				$field_args[ 'show_names' ] = $this->prop( 'show_names' );
356 356
 			}
357 357
 			$field = $this->render_group( $field_args );
358 358
 
359
-		} elseif ( 'hidden' == $field_args['type'] && $this->get_field( $field_args )->should_show() ) {
359
+		} elseif ( 'hidden' == $field_args[ 'type' ] && $this->get_field( $field_args )->should_show() ) {
360 360
 			// Save rendering for after the metabox
361 361
 			$field = $this->add_hidden_field( $field_args );
362 362
 
363 363
 		} else {
364 364
 
365
-			$field_args['show_names'] = $this->prop( 'show_names' );
365
+			$field_args[ 'show_names' ] = $this->prop( 'show_names' );
366 366
 
367 367
 			// Render default fields
368 368
 			$field = $this->get_field( $field_args )->render_field();
@@ -379,7 +379,7 @@  discard block
 block discarded – undo
379 379
 	 */
380 380
 	public function render_group( $args ) {
381 381
 
382
-		if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) {
382
+		if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) {
383 383
 			return;
384 384
 		}
385 385
 
@@ -491,15 +491,15 @@  discard block
 block discarded – undo
491 491
 			<div class="inside cmb-td cmb-nested cmb-field-list">';
492 492
 				// Loop and render repeatable group fields
493 493
 		foreach ( array_values( $field_group->args( 'fields' ) ) as $field_args ) {
494
-			if ( 'hidden' == $field_args['type'] ) {
494
+			if ( 'hidden' == $field_args[ 'type' ] ) {
495 495
 
496 496
 				// Save rendering for after the metabox
497 497
 				$this->add_hidden_field( $field_args, $field_group );
498 498
 
499 499
 			} else {
500 500
 
501
-				$field_args['show_names'] = $field_group->args( 'show_names' );
502
-				$field_args['context']    = $field_group->args( 'context' );
501
+				$field_args[ 'show_names' ] = $field_group->args( 'show_names' );
502
+				$field_args[ 'context' ]    = $field_group->args( 'context' );
503 503
 
504 504
 				$field = $this->get_field( $field_args, $field_group )->render_field();
505 505
 			}
@@ -529,7 +529,7 @@  discard block
 block discarded – undo
529 529
 	 * @param CMB2_Field|null $field_group CMB2_Field group field object
530 530
 	 */
531 531
 	public function add_hidden_field( $field_args, $field_group = null ) {
532
-		if ( isset( $field_args['field_args'] ) ) {
532
+		if ( isset( $field_args[ 'field_args' ] ) ) {
533 533
 			// For back-compatibility.
534 534
 			$field = new CMB2_Field( $field_args );
535 535
 		} else {
@@ -542,7 +542,7 @@  discard block
 block discarded – undo
542 542
 			$types->iterator = $field_group->index;
543 543
 		}
544 544
 
545
-		$this->hidden_fields[] = $types;
545
+		$this->hidden_fields[ ] = $types;
546 546
 
547 547
 		return $field;
548 548
 	}
@@ -650,11 +650,11 @@  discard block
 block discarded – undo
650 650
 	 */
651 651
 	public function process_field( $field_args ) {
652 652
 
653
-		switch ( $field_args['type'] ) {
653
+		switch ( $field_args[ 'type' ] ) {
654 654
 
655 655
 			case 'group':
656 656
 				if ( $this->save_group( $field_args ) ) {
657
-					$this->updated[] = $field_args['id'];
657
+					$this->updated[ ] = $field_args[ 'id' ];
658 658
 				}
659 659
 
660 660
 				break;
@@ -668,7 +668,7 @@  discard block
 block discarded – undo
668 668
 				$field = $this->get_new_field( $field_args );
669 669
 
670 670
 				if ( $field->save_field_from_data( $this->data_to_save ) ) {
671
-					$this->updated[] = $field->id();
671
+					$this->updated[ ] = $field->id();
672 672
 				}
673 673
 
674 674
 				break;
@@ -736,7 +736,7 @@  discard block
 block discarded – undo
736 736
 	 * @return mixed        Return of CMB2_Field::update_data()
737 737
 	 */
738 738
 	public function save_group( $args ) {
739
-		if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) {
739
+		if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) {
740 740
 			return;
741 741
 		}
742 742
 
@@ -766,7 +766,7 @@  discard block
 block discarded – undo
766 766
 		$field_group->data_to_save = $this->data_to_save;
767 767
 
768 768
 		foreach ( array_values( $field_group->fields() ) as $field_args ) {
769
-			if ( 'title' === $field_args['type'] ) {
769
+			if ( 'title' === $field_args[ 'type' ] ) {
770 770
 				// Don't process title fields
771 771
 				continue;
772 772
 			}
@@ -789,16 +789,16 @@  discard block
 block discarded – undo
789 789
 						$_new_val = array();
790 790
 						foreach ( $new_val as $group_index => $grouped_data ) {
791 791
 							// Add the supporting data to the $saved array stack
792
-							$saved[ $field_group->index ][ $grouped_data['supporting_field_id'] ][] = $grouped_data['supporting_field_value'];
792
+							$saved[ $field_group->index ][ $grouped_data[ 'supporting_field_id' ] ][ ] = $grouped_data[ 'supporting_field_value' ];
793 793
 							// Reset var to the actual value
794
-							$_new_val[ $group_index ] = $grouped_data['value'];
794
+							$_new_val[ $group_index ] = $grouped_data[ 'value' ];
795 795
 						}
796 796
 						$new_val = $_new_val;
797 797
 					} else {
798 798
 						// Add the supporting data to the $saved array stack
799
-						$saved[ $field_group->index ][ $new_val['supporting_field_id'] ] = $new_val['supporting_field_value'];
799
+						$saved[ $field_group->index ][ $new_val[ 'supporting_field_id' ] ] = $new_val[ 'supporting_field_value' ];
800 800
 						// Reset var to the actual value
801
-						$new_val = $new_val['value'];
801
+						$new_val = $new_val[ 'value' ];
802 802
 					}
803 803
 				}
804 804
 
@@ -812,7 +812,7 @@  discard block
 block discarded – undo
812 812
 
813 813
 				// Compare values and add to `$updated` array
814 814
 				if ( $is_updated || $is_removed ) {
815
-					$this->updated[] = $base_id . '::' . $field_group->index . '::' . $sub_id;
815
+					$this->updated[ ] = $base_id . '::' . $field_group->index . '::' . $sub_id;
816 816
 				}
817 817
 
818 818
 				// Add to `$saved` array
@@ -850,22 +850,22 @@  discard block
 block discarded – undo
850 850
 		// Try to get our object ID from the global space
851 851
 		switch ( $this->object_type() ) {
852 852
 			case 'user':
853
-				$object_id = isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id;
854
-				$object_id = ! $object_id && 'user-new.php' != $pagenow && isset( $GLOBALS['user_ID'] ) ? $GLOBALS['user_ID'] : $object_id;
853
+				$object_id = isset( $_REQUEST[ 'user_id' ] ) ? $_REQUEST[ 'user_id' ] : $object_id;
854
+				$object_id = ! $object_id && 'user-new.php' != $pagenow && isset( $GLOBALS[ 'user_ID' ] ) ? $GLOBALS[ 'user_ID' ] : $object_id;
855 855
 				break;
856 856
 
857 857
 			case 'comment':
858
-				$object_id = isset( $_REQUEST['c'] ) ? $_REQUEST['c'] : $object_id;
859
-				$object_id = ! $object_id && isset( $GLOBALS['comments']->comment_ID ) ? $GLOBALS['comments']->comment_ID : $object_id;
858
+				$object_id = isset( $_REQUEST[ 'c' ] ) ? $_REQUEST[ 'c' ] : $object_id;
859
+				$object_id = ! $object_id && isset( $GLOBALS[ 'comments' ]->comment_ID ) ? $GLOBALS[ 'comments' ]->comment_ID : $object_id;
860 860
 				break;
861 861
 
862 862
 			case 'term':
863
-				$object_id = isset( $_REQUEST['tag_ID'] ) ? $_REQUEST['tag_ID'] : $object_id;
863
+				$object_id = isset( $_REQUEST[ 'tag_ID' ] ) ? $_REQUEST[ 'tag_ID' ] : $object_id;
864 864
 				break;
865 865
 
866 866
 			default:
867
-				$object_id = isset( $GLOBALS['post']->ID ) ? $GLOBALS['post']->ID : $object_id;
868
-				$object_id = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : $object_id;
867
+				$object_id = isset( $GLOBALS[ 'post' ]->ID ) ? $GLOBALS[ 'post' ]->ID : $object_id;
868
+				$object_id = isset( $_REQUEST[ 'post' ] ) ? $_REQUEST[ 'post' ] : $object_id;
869 869
 				break;
870 870
 		}
871 871
 
@@ -939,7 +939,7 @@  discard block
 block discarded – undo
939 939
 	 * @return boolean True/False
940 940
 	 */
941 941
 	public function is_options_page_mb() {
942
-		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'] ) );
942
+		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' ] ) );
943 943
 	}
944 944
 
945 945
 	/**
@@ -985,7 +985,7 @@  discard block
 block discarded – undo
985 985
 			$type = 'term';
986 986
 		}
987 987
 
988
-		if ( defined( 'DOING_AJAX' ) && isset( $_POST['action'] ) && 'add-tag' === $_POST['action'] ) {
988
+		if ( defined( 'DOING_AJAX' ) && isset( $_POST[ 'action' ] ) && 'add-tag' === $_POST[ 'action' ] ) {
989 989
 			$type = 'term';
990 990
 		}
991 991
 
@@ -1035,7 +1035,7 @@  discard block
 block discarded – undo
1035 1035
 			return $field;
1036 1036
 		}
1037 1037
 
1038
-		$field_id = is_string( $field ) ? $field : $field['id'];
1038
+		$field_id = is_string( $field ) ? $field : $field[ 'id' ];
1039 1039
 
1040 1040
 		$parent_field_id = ! empty( $field_group ) ? $field_group->id() : '';
1041 1041
 		$ids = $this->get_field_ids( $field_id, $parent_field_id );
@@ -1072,16 +1072,16 @@  discard block
 block discarded – undo
1072 1072
 		if ( $field_group && ( $sub_field_id || 0 === $sub_field_id ) ) {
1073 1073
 
1074 1074
 			// Update the fields array w/ any modified properties inherited from the group field
1075
-			$this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] = $field_args;
1075
+			$this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] = $field_args;
1076 1076
 
1077 1077
 			return $this->get_default_args( $field_args, $field_group );
1078 1078
 		}
1079 1079
 
1080 1080
 		if ( is_array( $field_args ) ) {
1081
-			$this->meta_box['fields'][ $field_id ] = array_merge( $field_args, $this->meta_box['fields'][ $field_id ] );
1081
+			$this->meta_box[ 'fields' ][ $field_id ] = array_merge( $field_args, $this->meta_box[ 'fields' ][ $field_id ] );
1082 1082
 		}
1083 1083
 
1084
-		return $this->get_default_args( $this->meta_box['fields'][ $field_id ] );
1084
+		return $this->get_default_args( $this->meta_box[ 'fields' ][ $field_id ] );
1085 1085
 	}
1086 1086
 
1087 1087
 	/**
@@ -1134,8 +1134,8 @@  discard block
 block discarded – undo
1134 1134
 
1135 1135
 			$sub_fields = false;
1136 1136
 			if ( array_key_exists( 'fields', $field ) ) {
1137
-				$sub_fields = $field['fields'];
1138
-				unset( $field['fields'] );
1137
+				$sub_fields = $field[ 'fields' ];
1138
+				unset( $field[ 'fields' ] );
1139 1139
 			}
1140 1140
 
1141 1141
 			$field_id = $parent_field_id
@@ -1162,7 +1162,7 @@  discard block
 block discarded – undo
1162 1162
 		}
1163 1163
 
1164 1164
 		// Perform some field-type-specific initiation actions.
1165
-		switch ( $field['type'] ) {
1165
+		switch ( $field[ 'type' ] ) {
1166 1166
 			case 'file':
1167 1167
 			case 'file_list':
1168 1168
 
@@ -1177,21 +1177,21 @@  discard block
 block discarded – undo
1177 1177
 				break;
1178 1178
 		}
1179 1179
 
1180
-		if ( isset( $field['column'] ) && false !== $field['column'] ) {
1180
+		if ( isset( $field[ 'column' ] ) && false !== $field[ 'column' ] ) {
1181 1181
 			$field = $this->define_field_column( $field );
1182 1182
 		}
1183 1183
 
1184
-		if ( isset( $field['taxonomy'] ) && ! empty( $field['remove_default'] ) ) {
1185
-			$this->tax_metaboxes_to_remove[ $field['taxonomy'] ] = $field['taxonomy'];
1184
+		if ( isset( $field[ 'taxonomy' ] ) && ! empty( $field[ 'remove_default' ] ) ) {
1185
+			$this->tax_metaboxes_to_remove[ $field[ 'taxonomy' ] ] = $field[ 'taxonomy' ];
1186 1186
 		}
1187 1187
 
1188 1188
 		$this->_add_field_to_array(
1189 1189
 			$field,
1190
-			$this->meta_box['fields'],
1190
+			$this->meta_box[ 'fields' ],
1191 1191
 			$position
1192 1192
 		);
1193 1193
 
1194
-		return $field['id'];
1194
+		return $field[ 'id' ];
1195 1195
 	}
1196 1196
 
1197 1197
 	/**
@@ -1204,10 +1204,10 @@  discard block
 block discarded – undo
1204 1204
 	protected function define_field_column( array $field ) {
1205 1205
 		$this->has_columns = true;
1206 1206
 
1207
-		$column = is_array( $field['column'] ) ? $field['column'] : array();
1207
+		$column = is_array( $field[ 'column' ] ) ? $field[ 'column' ] : array();
1208 1208
 
1209
-		$field['column'] = wp_parse_args( $column, array(
1210
-			'name'     => isset( $field['name'] ) ? $field['name'] : '',
1209
+		$field[ 'column' ] = wp_parse_args( $column, array(
1210
+			'name'     => isset( $field[ 'name' ] ) ? $field[ 'name' ] : '',
1211 1211
 			'position' => false,
1212 1212
 		) );
1213 1213
 
@@ -1224,27 +1224,27 @@  discard block
 block discarded – undo
1224 1224
 	 * @return mixed                   Array of parent/field ids or false
1225 1225
 	 */
1226 1226
 	public function add_group_field( $parent_field_id, array $field, $position = 0 ) {
1227
-		if ( ! array_key_exists( $parent_field_id, $this->meta_box['fields'] ) ) {
1227
+		if ( ! array_key_exists( $parent_field_id, $this->meta_box[ 'fields' ] ) ) {
1228 1228
 			return false;
1229 1229
 		}
1230 1230
 
1231
-		$parent_field = $this->meta_box['fields'][ $parent_field_id ];
1231
+		$parent_field = $this->meta_box[ 'fields' ][ $parent_field_id ];
1232 1232
 
1233
-		if ( 'group' !== $parent_field['type'] ) {
1233
+		if ( 'group' !== $parent_field[ 'type' ] ) {
1234 1234
 			return false;
1235 1235
 		}
1236 1236
 
1237
-		if ( ! isset( $parent_field['fields'] ) ) {
1238
-			$this->meta_box['fields'][ $parent_field_id ]['fields'] = array();
1237
+		if ( ! isset( $parent_field[ 'fields' ] ) ) {
1238
+			$this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ] = array();
1239 1239
 		}
1240 1240
 
1241 1241
 		$this->_add_field_to_array(
1242 1242
 			$field,
1243
-			$this->meta_box['fields'][ $parent_field_id ]['fields'],
1243
+			$this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ],
1244 1244
 			$position
1245 1245
 		);
1246 1246
 
1247
-		return array( $parent_field_id, $field['id'] );
1247
+		return array( $parent_field_id, $field[ 'id' ] );
1248 1248
 	}
1249 1249
 
1250 1250
 	/**
@@ -1257,9 +1257,9 @@  discard block
 block discarded – undo
1257 1257
 	 */
1258 1258
 	protected function _add_field_to_array( $field, &$fields, $position = 0 ) {
1259 1259
 		if ( $position ) {
1260
-			CMB2_Utils::array_insert( $fields, array( $field['id'] => $field ), $position );
1260
+			CMB2_Utils::array_insert( $fields, array( $field[ 'id' ] => $field ), $position );
1261 1261
 		} else {
1262
-			$fields[ $field['id'] ] = $field;
1262
+			$fields[ $field[ 'id' ] ] = $field;
1263 1263
 		}
1264 1264
 	}
1265 1265
 
@@ -1283,15 +1283,15 @@  discard block
 block discarded – undo
1283 1283
 		unset( $this->fields[ implode( '', $ids ) ] );
1284 1284
 
1285 1285
 		if ( ! $sub_field_id ) {
1286
-			unset( $this->meta_box['fields'][ $field_id ] );
1286
+			unset( $this->meta_box[ 'fields' ][ $field_id ] );
1287 1287
 			return true;
1288 1288
 		}
1289 1289
 
1290
-		if ( isset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] ) ) {
1291
-			unset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] );
1290
+		if ( isset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] ) ) {
1291
+			unset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] );
1292 1292
 		}
1293
-		if ( isset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] ) ) {
1294
-			unset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] );
1293
+		if ( isset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] ) ) {
1294
+			unset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] );
1295 1295
 		}
1296 1296
 		return true;
1297 1297
 	}
@@ -1316,11 +1316,11 @@  discard block
 block discarded – undo
1316 1316
 		list( $field_id, $sub_field_id ) = $ids;
1317 1317
 
1318 1318
 		if ( ! $sub_field_id ) {
1319
-			$this->meta_box['fields'][ $field_id ][ $property ] = $value;
1319
+			$this->meta_box[ 'fields' ][ $field_id ][ $property ] = $value;
1320 1320
 			return $field_id;
1321 1321
 		}
1322 1322
 
1323
-		$this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ][ $property ] = $value;
1323
+		$this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ][ $property ] = $value;
1324 1324
 		return $field_id;
1325 1325
 	}
1326 1326
 
@@ -1335,7 +1335,7 @@  discard block
 block discarded – undo
1335 1335
 	public function get_field_ids( $field_id, $parent_field_id = '' ) {
1336 1336
 		$sub_field_id = $parent_field_id ? $field_id : '';
1337 1337
 		$field_id     = $parent_field_id ? $parent_field_id : $field_id;
1338
-		$fields       =& $this->meta_box['fields'];
1338
+		$fields       = & $this->meta_box[ 'fields' ];
1339 1339
 
1340 1340
 		if ( ! array_key_exists( $field_id, $fields ) ) {
1341 1341
 			$field_id = $this->search_old_school_array( $field_id, $fields );
@@ -1349,12 +1349,12 @@  discard block
 block discarded – undo
1349 1349
 			return array( $field_id, $sub_field_id );
1350 1350
 		}
1351 1351
 
1352
-		if ( 'group' !== $fields[ $field_id ]['type'] ) {
1352
+		if ( 'group' !== $fields[ $field_id ][ 'type' ] ) {
1353 1353
 			return false;
1354 1354
 		}
1355 1355
 
1356
-		if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ]['fields'] ) ) {
1357
-			$sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ]['fields'] );
1356
+		if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ][ 'fields' ] ) ) {
1357
+			$sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ][ 'fields' ] );
1358 1358
 		}
1359 1359
 
1360 1360
 		return false === $sub_field_id ? false : array( $field_id, $sub_field_id );
Please login to merge, or discard this patch.