Completed
Pull Request — trunk (#696)
by
unknown
03:31
created
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_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_Utils.php 1 patch
Spacing   +20 added lines, -21 removed lines patch added patch discarded remove patch
@@ -30,7 +30,7 @@  discard block
 block discarded – undo
30 30
 		$dir = wp_upload_dir();
31 31
 
32 32
 		// Is URL in uploads directory?
33
-		if ( false === strpos( $img_url, $dir['baseurl'] . '/' ) ) {
33
+		if ( false === strpos( $img_url, $dir[ 'baseurl' ] . '/' ) ) {
34 34
 			return false;
35 35
 		}
36 36
 
@@ -55,8 +55,8 @@  discard block
 block discarded – undo
55 55
 
56 56
 			foreach ( $query->posts as $post_id ) {
57 57
 				$meta = wp_get_attachment_metadata( $post_id );
58
-				$original_file       = basename( $meta['file'] );
59
-				$cropped_image_files = isset( $meta['sizes'] ) ? wp_list_pluck( $meta['sizes'], 'file' ) : array();
58
+				$original_file       = basename( $meta[ 'file' ] );
59
+				$cropped_image_files = isset( $meta[ 'sizes' ] ) ? wp_list_pluck( $meta[ 'sizes' ], 'file' ) : array();
60 60
 				if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
61 61
 					$attachment_id = $post_id;
62 62
 					break;
@@ -140,8 +140,7 @@  discard block
 block discarded – undo
140 140
 		}
141 141
 
142 142
 		return $this->is_valid_time_stamp( $string )
143
-			? (int) $string :
144
-			strtotime( (string) $string );
143
+			? (int) $string : strtotime( (string) $string );
145 144
 	}
146 145
 
147 146
 	/**
@@ -172,7 +171,7 @@  discard block
 block discarded – undo
172 171
 	 * @param  mixed $value Value to check
173 172
 	 * @return bool         True or false
174 173
 	 */
175
-	public function notempty( $value ){
174
+	public function notempty( $value ) {
176 175
 		return null !== $value && '' !== $value && false !== $value;
177 176
 	}
178 177
 
@@ -322,24 +321,24 @@  discard block
 block discarded – undo
322 321
 
323 322
 		// order is relevant here, since the replacement will be done sequentially.
324 323
 		$supported_options = array(
325
-			'd' => 'dd',  // Day, leading 0
326
-			'j' => 'd',   // Day, no 0
327
-			'z' => 'o',   // Day of the year, no leading zeroes,
324
+			'd' => 'dd', // Day, leading 0
325
+			'j' => 'd', // Day, no 0
326
+			'z' => 'o', // Day of the year, no leading zeroes,
328 327
 			// 'D' => 'D',   // Day name short, not sure how it'll work with translations
329 328
 			// 'l' => 'DD',  // Day name full, idem before
330
-			'm' => 'mm',  // Month of the year, leading 0
331
-			'n' => 'm',   // Month of the year, no leading 0
329
+			'm' => 'mm', // Month of the year, leading 0
330
+			'n' => 'm', // Month of the year, no leading 0
332 331
 			// 'M' => 'M',   // Month, Short name
333 332
 			// 'F' => 'MM',  // Month, full name,
334
-			'y' => 'y',   // Year, two digit
335
-			'Y' => 'yy',  // Year, full
336
-			'H' => 'HH',  // Hour with leading 0 (24 hour)
337
-			'G' => 'H',   // Hour with no leading 0 (24 hour)
338
-			'h' => 'hh',  // Hour with leading 0 (12 hour)
339
-			'g' => 'h',   // Hour with no leading 0 (12 hour),
340
-			'i' => 'mm',  // Minute with leading 0,
341
-			's' => 'ss',  // Second with leading 0,
342
-			'a' => 'tt',  // am/pm
333
+			'y' => 'y', // Year, two digit
334
+			'Y' => 'yy', // Year, full
335
+			'H' => 'HH', // Hour with leading 0 (24 hour)
336
+			'G' => 'H', // Hour with no leading 0 (24 hour)
337
+			'h' => 'hh', // Hour with leading 0 (12 hour)
338
+			'g' => 'h', // Hour with no leading 0 (12 hour),
339
+			'i' => 'mm', // Minute with leading 0,
340
+			's' => 'ss', // Second with leading 0,
341
+			'a' => 'tt', // am/pm
343 342
 			'A' => 'TT'   // AM/PM
344 343
 		);
345 344
 
@@ -360,7 +359,7 @@  discard block
 block discarded – undo
360 359
 	 * @return string Modified value
361 360
 	 */
362 361
 	public function wrap_escaped_chars( $value ) {
363
-		return "&#39;" . str_replace( '\\', '', $value[0] ) . "&#39;";
362
+		return "&#39;" . str_replace( '\\', '', $value[ 0 ] ) . "&#39;";
364 363
 	}
365 364
 
366 365
 	/**
Please login to merge, or discard this patch.
includes/types/CMB2_Type_Taxonomy_Select.php 1 patch
Spacing   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -15,7 +15,7 @@
 block discarded – undo
15 15
 	public function render() {
16 16
 		$names = $this->get_object_terms();
17 17
 
18
-		$saved_term  = is_wp_error( $names ) || empty( $names ) ? $this->field->get_default() : $names[key( $names )]->slug;
18
+		$saved_term  = is_wp_error( $names ) || empty( $names ) ? $this->field->get_default() : $names[ key( $names ) ]->slug;
19 19
 		$terms       = $this->get_terms();
20 20
 		$options     = '';
21 21
 		$option_none = $this->field->args( 'show_option_none' );
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
@@ -29,7 +29,7 @@
 block discarded – undo
29 29
 		), $this->args );
30 30
 
31 31
 		return $this->rendered(
32
-			sprintf( '<%1$s %2$s>%3$s</%1$s>%4$s', $a['tag'], $this->concat_attrs( $a, array( 'tag', 'name', 'desc' ) ), $a['name'], $a['desc'] )
32
+			sprintf( '<%1$s %2$s>%3$s</%1$s>%4$s', $a[ 'tag' ], $this->concat_attrs( $a, array( 'tag', 'name', 'desc' ) ), $a[ 'name' ], $a[ 'desc' ] )
33 33
 		);
34 34
 	}
35 35
 
Please login to merge, or discard this patch.
includes/CMB2_Field_Display.php 1 patch
Spacing   +12 added lines, -12 removed lines patch added patch discarded remove patch
@@ -124,7 +124,7 @@  discard block
 block discarded – undo
124 124
 			if ( is_array( $this->field->value ) ) {
125 125
 
126 126
 				// Then loop and output.
127
-				echo '<ul class="cmb2-'. str_replace( '_', '-', $this->field->type() ) .'">';
127
+				echo '<ul class="cmb2-' . str_replace( '_', '-', $this->field->type() ) . '">';
128 128
 				foreach ( $this->field->value as $val ) {
129 129
 					$this->value = $val;
130 130
 					echo '<li>', $this->_display(), '</li>';
@@ -197,8 +197,8 @@  discard block
 block discarded – undo
197 197
 		$options = $this->field->options();
198 198
 
199 199
 		$fallback = $this->field->args( 'show_option_none' );
200
-		if ( ! $fallback && isset( $options[''] ) ) {
201
-			$fallback = $options[''];
200
+		if ( ! $fallback && isset( $options[ '' ] ) ) {
201
+			$fallback = $options[ '' ];
202 202
 		}
203 203
 		if ( ! $this->value && $fallback ) {
204 204
 			echo $fallback;
@@ -225,9 +225,9 @@  discard block
 block discarded – undo
225 225
 		$output = array();
226 226
 		foreach ( $this->value as $val ) {
227 227
 			if ( isset( $options[ $val ] ) ) {
228
-				$output[] = $options[ $val ];
228
+				$output[ ] = $options[ $val ];
229 229
 			} else {
230
-				$output[] = esc_attr( $val );
230
+				$output[ ] = esc_attr( $val );
231 231
 			}
232 232
 		}
233 233
 
@@ -251,7 +251,7 @@  discard block
 block discarded – undo
251 251
 	 * @since 2.2.2
252 252
 	 */
253 253
 	protected function _display() {
254
-		echo '<xmp class="cmb2-code">'. print_r( $this->value, true ) .'</xmp>';
254
+		echo '<xmp class="cmb2-code">' . print_r( $this->value, true ) . '</xmp>';
255 255
 	}
256 256
 }
257 257
 
@@ -293,7 +293,7 @@  discard block
 block discarded – undo
293 293
 		if ( $datetime && $datetime instanceof DateTime ) {
294 294
 			$tz       = $datetime->getTimezone();
295 295
 			$tzstring = $tz->getName();
296
-			$this->value    = $datetime->getTimestamp();
296
+			$this->value = $datetime->getTimestamp();
297 297
 		}
298 298
 
299 299
 		$date = $this->field->get_timestamp_format( 'date_format', $this->value );
@@ -317,7 +317,7 @@  discard block
 block discarded – undo
317 317
 		if ( is_wp_error( $terms ) || empty( $terms ) && ( $default = $this->field->get_default() ) ) {
318 318
 			$term = get_term_by( 'slug', $default, $taxonomy );
319 319
 		} elseif ( ! empty( $terms ) ) {
320
-			$term = $terms[key( $terms )];
320
+			$term = $terms[ key( $terms ) ];
321 321
 		}
322 322
 
323 323
 		if ( $term ) {
@@ -341,10 +341,10 @@  discard block
 block discarded – undo
341 341
 			$terms = array();
342 342
 			if ( is_array( $default ) ) {
343 343
 				foreach ( $default as $slug ) {
344
-					$terms[] = get_term_by( 'slug', $slug, $taxonomy );
344
+					$terms[ ] = get_term_by( 'slug', $slug, $taxonomy );
345 345
 				}
346 346
 			} else {
347
-				$terms[] = get_term_by( 'slug', $default, $taxonomy );
347
+				$terms[ ] = get_term_by( 'slug', $default, $taxonomy );
348 348
 			}
349 349
 		}
350 350
 
@@ -353,7 +353,7 @@  discard block
 block discarded – undo
353 353
 			$links = array();
354 354
 			foreach ( $terms as $term ) {
355 355
 				$link = get_edit_term_link( $term->term_id, $taxonomy );
356
-				$links[] = '<a href="'. esc_url( $link ) .'">'. esc_html( $term->name ) .'</a>';
356
+				$links[ ] = '<a href="' . esc_url( $link ) . '">' . esc_html( $term->name ) . '</a>';
357 357
 			}
358 358
 			// Then loop and output.
359 359
 			echo '<div class="cmb2-taxonomy-terms-', esc_attr( $taxonomy ), '">';
@@ -396,7 +396,7 @@  discard block
 block discarded – undo
396 396
 			if ( $id ) {
397 397
 				$image = wp_get_attachment_image( $id, $img_size, null, array( 'class' => 'cmb-image-display' ) );
398 398
 			} else {
399
-				$size = is_array( $img_size ) ? $img_size[0] : 200;
399
+				$size = is_array( $img_size ) ? $img_size[ 0 ] : 200;
400 400
 				$image = '<img class="cmb-image-display" style="max-width: ' . absint( $size ) . 'px; width: 100%; height: auto;" src="' . $url_value . '" alt="" />';
401 401
 			}
402 402
 
Please login to merge, or discard this patch.
includes/CMB2_hookup.php 1 patch
Spacing   +16 added lines, -16 removed lines patch added patch discarded remove patch
@@ -119,7 +119,7 @@  discard block
 block discarded – undo
119 119
 
120 120
 		if ( $this->cmb->has_columns ) {
121 121
 			add_filter( 'manage_edit-comments_columns', array( $this, 'register_column_headers' ) );
122
-			add_action( 'manage_comments_custom_column', array( $this, 'column_display'  ), 10, 3 );
122
+			add_action( 'manage_comments_custom_column', array( $this, 'column_display' ), 10, 3 );
123 123
 		}
124 124
 	}
125 125
 
@@ -136,7 +136,7 @@  discard block
 block discarded – undo
136 136
 
137 137
 		if ( $this->cmb->has_columns ) {
138 138
 			add_filter( 'manage_users_columns', array( $this, 'register_column_headers' ) );
139
-			add_filter( 'manage_users_custom_column', array( $this, 'return_column_display'  ), 10, 3 );
139
+			add_filter( 'manage_users_custom_column', array( $this, 'return_column_display' ), 10, 3 );
140 140
 		}
141 141
 	}
142 142
 
@@ -170,7 +170,7 @@  discard block
 block discarded – undo
170 170
 
171 171
 			if ( $this->cmb->has_columns ) {
172 172
 				add_filter( "manage_edit-{$taxonomy}_columns", array( $this, 'register_column_headers' ) );
173
-				add_filter( "manage_{$taxonomy}_custom_column", array( $this, 'return_column_display'  ), 10, 3 );
173
+				add_filter( "manage_{$taxonomy}_custom_column", array( $this, 'return_column_display' ), 10, 3 );
174 174
 			}
175 175
 		}
176 176
 
@@ -263,25 +263,25 @@  discard block
 block discarded – undo
263 263
 		$fields = $this->cmb->prop( 'fields' );
264 264
 
265 265
 		foreach ( $fields as $key => $field ) {
266
-			if ( ! isset( $field['column'] ) ) {
266
+			if ( ! isset( $field[ 'column' ] ) ) {
267 267
 				continue;
268 268
 			}
269 269
 
270
-			$column = $field['column'];
270
+			$column = $field[ 'column' ];
271 271
 
272
-			if ( false === $column['position'] ) {
272
+			if ( false === $column[ 'position' ] ) {
273 273
 
274
-				$columns[ $field['id'] ] = $column['name'];
274
+				$columns[ $field[ 'id' ] ] = $column[ 'name' ];
275 275
 
276 276
 			} else {
277 277
 
278
-				$before = array_slice( $columns, 0, absint( $column['position'] ) );
279
-				$before[ $field['id'] ] = $column['name'];
278
+				$before = array_slice( $columns, 0, absint( $column[ 'position' ] ) );
279
+				$before[ $field[ 'id' ] ] = $column[ 'name' ];
280 280
 				$columns = $before + $columns;
281 281
 			}
282 282
 
283
-			$column['field'] = $field;
284
-			$this->columns[ $field['id'] ] = $column;
283
+			$column[ 'field' ] = $field;
284
+			$this->columns[ $field[ 'id' ] ] = $column;
285 285
 		}
286 286
 
287 287
 		return $columns;
@@ -294,7 +294,7 @@  discard block
 block discarded – undo
294 294
 	public function column_display( $column_name, $object_id ) {
295 295
 		if ( isset( $this->columns[ $column_name ] ) ) {
296 296
  			$field = new CMB2_Field( array(
297
-				'field_args'  => $this->columns[ $column_name ]['field'],
297
+				'field_args'  => $this->columns[ $column_name ][ 'field' ],
298 298
 				'object_type' => $this->object_type,
299 299
 				'object_id'   => $this->cmb->object_id( $object_id ),
300 300
 				'cmb_id'      => $this->cmb->cmb_id,
@@ -355,7 +355,7 @@  discard block
 block discarded – undo
355 355
 	 * @return array           Modified array of classes
356 356
 	 */
357 357
 	public function close_metabox_class( $classes ) {
358
-		$classes[] = 'closed';
358
+		$classes[ ] = 'closed';
359 359
 		return $classes;
360 360
 	}
361 361
 
@@ -375,7 +375,7 @@  discard block
 block discarded – undo
375 375
 	public function user_new_metabox( $section ) {
376 376
 		if ( $section == $this->cmb->prop( 'new_user_section' ) ) {
377 377
 			$object_id = $this->cmb->object_id();
378
-			$this->cmb->object_id( isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id );
378
+			$this->cmb->object_id( isset( $_REQUEST[ 'user_id' ] ) ? $_REQUEST[ 'user_id' ] : $object_id );
379 379
 			$this->user_metabox();
380 380
 		}
381 381
 	}
@@ -555,7 +555,7 @@  discard block
 block discarded – undo
555 555
 		if ( $this->taxonomy_can_save( $taxonomy ) ) {
556 556
 
557 557
 			foreach ( $this->cmb->prop( 'fields' ) as $field ) {
558
-				$data_to_delete[ $field['id'] ] = '';
558
+				$data_to_delete[ $field[ 'id' ] ] = '';
559 559
 			}
560 560
 
561 561
 			$this->cmb->save_fields( $term_id, 'term', $data_to_delete );
@@ -616,7 +616,7 @@  discard block
 block discarded – undo
616 616
 			return;
617 617
 		}
618 618
 
619
-		self::$hooks_completed[] = $key;
619
+		self::$hooks_completed[ ] = $key;
620 620
 		add_filter( $action, $hook, $priority, $accepted_args );
621 621
 	}
622 622
 
Please login to merge, or discard this patch.
includes/CMB2.php 1 patch
Spacing   +67 added lines, -67 removed lines patch added patch discarded remove patch
@@ -104,19 +104,19 @@  discard block
 block discarded – undo
104 104
 	 */
105 105
 	public function __construct( $config, $object_id = 0 ) {
106 106
 
107
-		if ( empty( $config['id'] ) ) {
107
+		if ( empty( $config[ 'id' ] ) ) {
108 108
 			wp_die( __( 'Metabox configuration is required to have an ID parameter', 'cmb2' ) );
109 109
 		}
110 110
 
111 111
 		$this->meta_box = wp_parse_args( $config, $this->mb_defaults );
112
-		$this->meta_box['fields'] = array();
112
+		$this->meta_box[ 'fields' ] = array();
113 113
 
114 114
 		$this->object_id( $object_id );
115 115
 		$this->mb_object_type();
116
-		$this->cmb_id = $config['id'];
116
+		$this->cmb_id = $config[ 'id' ];
117 117
 
118
-		if ( ! empty( $config['fields'] ) && is_array( $config['fields'] ) ) {
119
-			$this->add_fields( $config['fields'] );
118
+		if ( ! empty( $config[ 'fields' ] ) && is_array( $config[ 'fields' ] ) ) {
119
+			$this->add_fields( $config[ 'fields' ] );
120 120
 		}
121 121
 
122 122
 		CMB2_Boxes::add( $this );
@@ -285,22 +285,22 @@  discard block
 block discarded – undo
285 285
 	 * @return mixed CMB2_Field object if successful.
286 286
 	 */
287 287
 	public function render_field( $field_args ) {
288
-		$field_args['context'] = $this->prop( 'context' );
288
+		$field_args[ 'context' ] = $this->prop( 'context' );
289 289
 
290
-		if ( 'group' == $field_args['type'] ) {
290
+		if ( 'group' == $field_args[ 'type' ] ) {
291 291
 
292
-			if ( ! isset( $field_args['show_names'] ) ) {
293
-				$field_args['show_names'] = $this->prop( 'show_names' );
292
+			if ( ! isset( $field_args[ 'show_names' ] ) ) {
293
+				$field_args[ 'show_names' ] = $this->prop( 'show_names' );
294 294
 			}
295 295
 			$field = $this->render_group( $field_args );
296 296
 
297
-		} elseif ( 'hidden' == $field_args['type'] && $this->get_field( $field_args )->should_show() ) {
297
+		} elseif ( 'hidden' == $field_args[ 'type' ] && $this->get_field( $field_args )->should_show() ) {
298 298
 			// Save rendering for after the metabox
299 299
 			$field = $this->add_hidden_field( $field_args );
300 300
 
301 301
 		} else {
302 302
 
303
-			$field_args['show_names'] = $this->prop( 'show_names' );
303
+			$field_args[ 'show_names' ] = $this->prop( 'show_names' );
304 304
 
305 305
 			// Render default fields
306 306
 			$field = $this->get_field( $field_args )->render_field();
@@ -316,7 +316,7 @@  discard block
 block discarded – undo
316 316
 	 */
317 317
 	public function render_group( $args ) {
318 318
 
319
-		if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) {
319
+		if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) {
320 320
 			return;
321 321
 		}
322 322
 
@@ -398,15 +398,15 @@  discard block
 block discarded – undo
398 398
 			<div class="inside cmb-td cmb-nested cmb-field-list">';
399 399
 				// Loop and render repeatable group fields
400 400
 				foreach ( array_values( $field_group->args( 'fields' ) ) as $field_args ) {
401
-					if ( 'hidden' == $field_args['type'] ) {
401
+					if ( 'hidden' == $field_args[ 'type' ] ) {
402 402
 
403 403
 						// Save rendering for after the metabox
404 404
 						$this->add_hidden_field( $field_args, $field_group );
405 405
 
406 406
 					} else {
407 407
 
408
-						$field_args['show_names'] = $field_group->args( 'show_names' );
409
-						$field_args['context']    = $field_group->args( 'context' );
408
+						$field_args[ 'show_names' ] = $field_group->args( 'show_names' );
409
+						$field_args[ 'context' ]    = $field_group->args( 'context' );
410 410
 
411 411
 						$field = $this->get_field( $field_args, $field_group )->render_field();
412 412
 					}
@@ -434,7 +434,7 @@  discard block
 block discarded – undo
434 434
 	 * @param array  $field_args Array of field arguments to be passed to CMB2_Field
435 435
 	 */
436 436
 	public function add_hidden_field( $field_args, $field_group = null ) {
437
-		if ( isset( $field_args['field_args'] ) ) {
437
+		if ( isset( $field_args[ 'field_args' ] ) ) {
438 438
 			// For back-compatibility.
439 439
 			$field = new CMB2_Field( $field_args );
440 440
 		} else {
@@ -447,7 +447,7 @@  discard block
 block discarded – undo
447 447
 			$type->iterator = $field_group->index;
448 448
 		}
449 449
 
450
-		$this->hidden_fields[] = $type;
450
+		$this->hidden_fields[ ] = $type;
451 451
 
452 452
 		return $field;
453 453
 	}
@@ -544,11 +544,11 @@  discard block
 block discarded – undo
544 544
 	 */
545 545
 	public function process_field( $field_args ) {
546 546
 
547
-		switch ( $field_args['type'] ) {
547
+		switch ( $field_args[ 'type' ] ) {
548 548
 
549 549
 			case 'group':
550 550
 				if ( $this->save_group( $field_args ) ) {
551
-					$this->updated[] = $field_args['id'];
551
+					$this->updated[ ] = $field_args[ 'id' ];
552 552
 				}
553 553
 
554 554
 				break;
@@ -562,7 +562,7 @@  discard block
 block discarded – undo
562 562
 				$field = $this->get_new_field( $field_args );
563 563
 
564 564
 				if ( $field->save_field_from_data( $this->data_to_save ) ) {
565
-					$this->updated[] = $field->id();
565
+					$this->updated[ ] = $field->id();
566 566
 				}
567 567
 
568 568
 				break;
@@ -629,7 +629,7 @@  discard block
 block discarded – undo
629 629
 	 * @return mixed        Return of CMB2_Field::update_data()
630 630
 	 */
631 631
 	public function save_group( $args ) {
632
-		if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) {
632
+		if ( ! isset( $args[ 'id' ], $args[ 'fields' ] ) || ! is_array( $args[ 'fields' ] ) ) {
633 633
 			return;
634 634
 		}
635 635
 
@@ -677,16 +677,16 @@  discard block
 block discarded – undo
677 677
 						$_new_val = array();
678 678
 						foreach ( $new_val as $group_index => $grouped_data ) {
679 679
 							// Add the supporting data to the $saved array stack
680
-							$saved[ $field_group->index ][ $grouped_data['supporting_field_id'] ][] = $grouped_data['supporting_field_value'];
680
+							$saved[ $field_group->index ][ $grouped_data[ 'supporting_field_id' ] ][ ] = $grouped_data[ 'supporting_field_value' ];
681 681
 							// Reset var to the actual value
682
-							$_new_val[ $group_index ] = $grouped_data['value'];
682
+							$_new_val[ $group_index ] = $grouped_data[ 'value' ];
683 683
 						}
684 684
 						$new_val = $_new_val;
685 685
 					} else {
686 686
 						// Add the supporting data to the $saved array stack
687
-						$saved[ $field_group->index ][ $new_val['supporting_field_id'] ] = $new_val['supporting_field_value'];
687
+						$saved[ $field_group->index ][ $new_val[ 'supporting_field_id' ] ] = $new_val[ 'supporting_field_value' ];
688 688
 						// Reset var to the actual value
689
-						$new_val = $new_val['value'];
689
+						$new_val = $new_val[ 'value' ];
690 690
 					}
691 691
 				}
692 692
 
@@ -700,7 +700,7 @@  discard block
 block discarded – undo
700 700
 
701 701
 				// Compare values and add to `$updated` array
702 702
 				if ( $is_updated || $is_removed ) {
703
-					$this->updated[] = $base_id . '::' . $field_group->index . '::' . $sub_id;
703
+					$this->updated[ ] = $base_id . '::' . $field_group->index . '::' . $sub_id;
704 704
 				}
705 705
 
706 706
 				// Add to `$saved` array
@@ -737,22 +737,22 @@  discard block
 block discarded – undo
737 737
 		// Try to get our object ID from the global space
738 738
 		switch ( $this->object_type() ) {
739 739
 			case 'user':
740
-				$object_id = isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id;
741
-				$object_id = ! $object_id && 'user-new.php' != $pagenow && isset( $GLOBALS['user_ID'] ) ? $GLOBALS['user_ID'] : $object_id;
740
+				$object_id = isset( $_REQUEST[ 'user_id' ] ) ? $_REQUEST[ 'user_id' ] : $object_id;
741
+				$object_id = ! $object_id && 'user-new.php' != $pagenow && isset( $GLOBALS[ 'user_ID' ] ) ? $GLOBALS[ 'user_ID' ] : $object_id;
742 742
 				break;
743 743
 
744 744
 			case 'comment':
745
-				$object_id = isset( $_REQUEST['c'] ) ? $_REQUEST['c'] : $object_id;
746
-				$object_id = ! $object_id && isset( $GLOBALS['comments']->comment_ID ) ? $GLOBALS['comments']->comment_ID : $object_id;
745
+				$object_id = isset( $_REQUEST[ 'c' ] ) ? $_REQUEST[ 'c' ] : $object_id;
746
+				$object_id = ! $object_id && isset( $GLOBALS[ 'comments' ]->comment_ID ) ? $GLOBALS[ 'comments' ]->comment_ID : $object_id;
747 747
 				break;
748 748
 
749 749
 			case 'term':
750
-				$object_id = isset( $_REQUEST['tag_ID'] ) ? $_REQUEST['tag_ID'] : $object_id;
750
+				$object_id = isset( $_REQUEST[ 'tag_ID' ] ) ? $_REQUEST[ 'tag_ID' ] : $object_id;
751 751
 				break;
752 752
 
753 753
 			default:
754
-				$object_id = isset( $GLOBALS['post']->ID ) ? $GLOBALS['post']->ID : $object_id;
755
-				$object_id = isset( $_REQUEST['post'] ) ? $_REQUEST['post'] : $object_id;
754
+				$object_id = isset( $GLOBALS[ 'post' ]->ID ) ? $GLOBALS[ 'post' ]->ID : $object_id;
755
+				$object_id = isset( $_REQUEST[ 'post' ] ) ? $_REQUEST[ 'post' ] : $object_id;
756 756
 				break;
757 757
 		}
758 758
 
@@ -828,7 +828,7 @@  discard block
 block discarded – undo
828 828
 	 * @return boolean True/False
829 829
 	 */
830 830
 	public function is_options_page_mb() {
831
-		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'] ) );
831
+		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' ] ) );
832 832
 	}
833 833
 
834 834
 	/**
@@ -915,7 +915,7 @@  discard block
 block discarded – undo
915 915
 			return $field;
916 916
 		}
917 917
 
918
-		$field_id = is_string( $field ) ? $field : $field['id'];
918
+		$field_id = is_string( $field ) ? $field : $field[ 'id' ];
919 919
 
920 920
 		$parent_field_id = ! empty( $field_group ) ? $field_group->id() : '';
921 921
 		$ids = $this->get_field_ids( $field_id, $parent_field_id, true );
@@ -951,16 +951,16 @@  discard block
 block discarded – undo
951 951
 		if ( $field_group && ( $sub_field_id || 0 === $sub_field_id ) ) {
952 952
 
953 953
 			// Update the fields array w/ any modified properties inherited from the group field
954
-			$this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] = $field_args;
954
+			$this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] = $field_args;
955 955
 
956 956
 			return $this->get_default_args( $field_args, $field_group );
957 957
 		}
958 958
 
959 959
 		if ( is_array( $field_args ) ) {
960
-			$this->meta_box['fields'][ $field_id ] = array_merge( $field_args, $this->meta_box['fields'][ $field_id ] );
960
+			$this->meta_box[ 'fields' ][ $field_id ] = array_merge( $field_args, $this->meta_box[ 'fields' ][ $field_id ] );
961 961
 		}
962 962
 
963
-		return $this->get_default_args( $this->meta_box['fields'][ $field_id ] );
963
+		return $this->get_default_args( $this->meta_box[ 'fields' ][ $field_id ] );
964 964
 	}
965 965
 
966 966
 	/**
@@ -1010,8 +1010,8 @@  discard block
 block discarded – undo
1010 1010
 
1011 1011
 			$sub_fields = false;
1012 1012
 			if ( array_key_exists( 'fields', $field ) ) {
1013
-				$sub_fields = $field['fields'];
1014
-				unset( $field['fields'] );
1013
+				$sub_fields = $field[ 'fields' ];
1014
+				unset( $field[ 'fields' ] );
1015 1015
 			}
1016 1016
 
1017 1017
 			$field_id = $parent_field_id
@@ -1036,29 +1036,29 @@  discard block
 block discarded – undo
1036 1036
 			return false;
1037 1037
 		}
1038 1038
 
1039
-		if ( 'oembed' === $field['type'] ) {
1039
+		if ( 'oembed' === $field[ 'type' ] ) {
1040 1040
 			// Initiate oembed Ajax hooks
1041 1041
 			cmb2_ajax();
1042 1042
 		}
1043 1043
 
1044
-		if ( isset( $field['column'] ) && false !== $field['column'] ) {
1044
+		if ( isset( $field[ 'column' ] ) && false !== $field[ 'column' ] ) {
1045 1045
 			$this->has_columns = true;
1046 1046
 
1047
-			$column = is_array( $field['column'] ) ? $field['column'] : array();
1047
+			$column = is_array( $field[ 'column' ] ) ? $field[ 'column' ] : array();
1048 1048
 
1049
-			$field['column'] = wp_parse_args( $column, array(
1050
-				'name'     => isset( $field['name'] ) ? $field['name'] : '',
1049
+			$field[ 'column' ] = wp_parse_args( $column, array(
1050
+				'name'     => isset( $field[ 'name' ] ) ? $field[ 'name' ] : '',
1051 1051
 				'position' => false,
1052 1052
 			) );
1053 1053
 		}
1054 1054
 
1055 1055
 		$this->_add_field_to_array(
1056 1056
 			$field,
1057
-			$this->meta_box['fields'],
1057
+			$this->meta_box[ 'fields' ],
1058 1058
 			$position
1059 1059
 		);
1060 1060
 
1061
-		return $field['id'];
1061
+		return $field[ 'id' ];
1062 1062
 	}
1063 1063
 
1064 1064
 	/**
@@ -1070,27 +1070,27 @@  discard block
 block discarded – undo
1070 1070
 	 * @return mixed                   Array of parent/field ids or false
1071 1071
 	 */
1072 1072
 	public function add_group_field( $parent_field_id, array $field, $position = 0 ) {
1073
-		if ( ! array_key_exists( $parent_field_id, $this->meta_box['fields'] ) ) {
1073
+		if ( ! array_key_exists( $parent_field_id, $this->meta_box[ 'fields' ] ) ) {
1074 1074
 			return false;
1075 1075
 		}
1076 1076
 
1077
-		$parent_field = $this->meta_box['fields'][ $parent_field_id ];
1077
+		$parent_field = $this->meta_box[ 'fields' ][ $parent_field_id ];
1078 1078
 
1079
-		if ( 'group' !== $parent_field['type'] ) {
1079
+		if ( 'group' !== $parent_field[ 'type' ] ) {
1080 1080
 			return false;
1081 1081
 		}
1082 1082
 
1083
-		if ( ! isset( $parent_field['fields'] ) ) {
1084
-			$this->meta_box['fields'][ $parent_field_id ]['fields'] = array();
1083
+		if ( ! isset( $parent_field[ 'fields' ] ) ) {
1084
+			$this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ] = array();
1085 1085
 		}
1086 1086
 
1087 1087
 		$this->_add_field_to_array(
1088 1088
 			$field,
1089
-			$this->meta_box['fields'][ $parent_field_id ]['fields'],
1089
+			$this->meta_box[ 'fields' ][ $parent_field_id ][ 'fields' ],
1090 1090
 			$position
1091 1091
 		);
1092 1092
 
1093
-		return array( $parent_field_id, $field['id'] );
1093
+		return array( $parent_field_id, $field[ 'id' ] );
1094 1094
 	}
1095 1095
 
1096 1096
 	/**
@@ -1102,9 +1102,9 @@  discard block
 block discarded – undo
1102 1102
 	 */
1103 1103
 	protected function _add_field_to_array( $field, &$fields, $position = 0 ) {
1104 1104
 		if ( $position ) {
1105
-			cmb2_utils()->array_insert( $fields, array( $field['id'] => $field ), $position );
1105
+			cmb2_utils()->array_insert( $fields, array( $field[ 'id' ] => $field ), $position );
1106 1106
 		} else {
1107
-			$fields[ $field['id'] ] = $field;
1107
+			$fields[ $field[ 'id' ] ] = $field;
1108 1108
 		}
1109 1109
 	}
1110 1110
 
@@ -1127,15 +1127,15 @@  discard block
 block discarded – undo
1127 1127
 		unset( $this->fields[ implode( '', $ids ) ] );
1128 1128
 
1129 1129
 		if ( ! $sub_field_id ) {
1130
-			unset( $this->meta_box['fields'][ $field_id ] );
1130
+			unset( $this->meta_box[ 'fields' ][ $field_id ] );
1131 1131
 			return true;
1132 1132
 		}
1133 1133
 
1134
-		if ( isset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] ) ) {
1135
-			unset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] );
1134
+		if ( isset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] ) ) {
1135
+			unset( $this->fields[ $field_id ]->args[ 'fields' ][ $sub_field_id ] );
1136 1136
 		}
1137
-		if ( isset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] ) ) {
1138
-			unset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] );
1137
+		if ( isset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] ) ) {
1138
+			unset( $this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ] );
1139 1139
 		}
1140 1140
 		return true;
1141 1141
 	}
@@ -1159,11 +1159,11 @@  discard block
 block discarded – undo
1159 1159
 		list( $field_id, $sub_field_id ) = $ids;
1160 1160
 
1161 1161
 		if ( ! $sub_field_id ) {
1162
-			$this->meta_box['fields'][ $field_id ][ $property ] = $value;
1162
+			$this->meta_box[ 'fields' ][ $field_id ][ $property ] = $value;
1163 1163
 			return $field_id;
1164 1164
 		}
1165 1165
 
1166
-		$this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ][ $property ] = $value;
1166
+		$this->meta_box[ 'fields' ][ $field_id ][ 'fields' ][ $sub_field_id ][ $property ] = $value;
1167 1167
 		return $field_id;
1168 1168
 	}
1169 1169
 
@@ -1177,7 +1177,7 @@  discard block
 block discarded – undo
1177 1177
 	public function get_field_ids( $field_id, $parent_field_id = '' ) {
1178 1178
 		$sub_field_id = $parent_field_id ? $field_id : '';
1179 1179
 		$field_id     = $parent_field_id ? $parent_field_id : $field_id;
1180
-		$fields       =& $this->meta_box['fields'];
1180
+		$fields       = & $this->meta_box[ 'fields' ];
1181 1181
 
1182 1182
 		if ( ! array_key_exists( $field_id, $fields ) ) {
1183 1183
 			$field_id = $this->search_old_school_array( $field_id, $fields );
@@ -1191,12 +1191,12 @@  discard block
 block discarded – undo
1191 1191
 			return array( $field_id, $sub_field_id );
1192 1192
 		}
1193 1193
 
1194
-		if ( 'group' !== $fields[ $field_id ]['type'] ) {
1194
+		if ( 'group' !== $fields[ $field_id ][ 'type' ] ) {
1195 1195
 			return false;
1196 1196
 		}
1197 1197
 
1198
-		if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ]['fields'] ) ) {
1199
-			$sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ]['fields'] );
1198
+		if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ][ 'fields' ] ) ) {
1199
+			$sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ][ 'fields' ] );
1200 1200
 		}
1201 1201
 
1202 1202
 		return false === $sub_field_id ? false : array( $field_id, $sub_field_id );
Please login to merge, or discard this patch.