Completed
Pull Request — trunk (#848)
by
unknown
04:35
created
includes/CMB2_Utils.php 2 patches
Doc Comments   +1 added lines, -1 removed lines patch added patch discarded remove patch
@@ -547,7 +547,7 @@
 block discarded – undo
547 547
 	 * @since  2.2.3
548 548
 	 *
549 549
 	 * @param  mixed $value   Value to ensure is array.
550
-	 * @param  array $default Default array. Defaults to empty array.
550
+	 * @param  string[] $default Default array. Defaults to empty array.
551 551
 	 *
552 552
 	 * @return array          The array.
553 553
 	 */
Please login to merge, or discard this patch.
Spacing   +28 added lines, -29 removed lines patch added patch discarded remove patch
@@ -37,7 +37,7 @@  discard block
 block discarded – undo
37 37
 		$dir = wp_upload_dir();
38 38
 
39 39
 		// Is URL in uploads directory?
40
-		if ( false === strpos( $img_url, $dir['baseurl'] . '/' ) ) {
40
+		if ( false === strpos( $img_url, $dir[ 'baseurl' ] . '/' ) ) {
41 41
 			return false;
42 42
 		}
43 43
 
@@ -62,8 +62,8 @@  discard block
 block discarded – undo
62 62
 
63 63
 			foreach ( $query->posts as $post_id ) {
64 64
 				$meta = wp_get_attachment_metadata( $post_id );
65
-				$original_file       = basename( $meta['file'] );
66
-				$cropped_image_files = isset( $meta['sizes'] ) ? wp_list_pluck( $meta['sizes'], 'file' ) : array();
65
+				$original_file       = basename( $meta[ 'file' ] );
66
+				$cropped_image_files = isset( $meta[ 'sizes' ] ) ? wp_list_pluck( $meta[ 'sizes' ], 'file' ) : array();
67 67
 				if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
68 68
 					$attachment_id = $post_id;
69 69
 					break;
@@ -125,15 +125,15 @@  discard block
 block discarded – undo
125 125
 			foreach ( $image_sizes as $_size => $data ) {
126 126
 
127 127
 				// If there's an exact match to an existing image size, short circuit.
128
-				if ( $data['width'] == $size[0] && $data['height'] == $size[1] ) {
129
-					$candidates[ $data['width'] * $data['height'] ] = array( $_size, $data );
128
+				if ( $data[ 'width' ] == $size[ 0 ] && $data[ 'height' ] == $size[ 1 ] ) {
129
+					$candidates[ $data[ 'width' ] * $data[ 'height' ] ] = array( $_size, $data );
130 130
 					break;
131 131
 				}
132 132
 
133 133
 				// If it's not an exact match, consider larger sizes with the same aspect ratio.
134
-				if ( $data['width'] >= $size[0] && $data['height'] >= $size[1] ) {
135
-					if ( wp_image_matches_ratio( $data['width'], $data['height'], $size[0], $size[1] ) ) {
136
-						$candidates[ $data['width'] * $data['height'] ] = array( $_size, $data );
134
+				if ( $data[ 'width' ] >= $size[ 0 ] && $data[ 'height' ] >= $size[ 1 ] ) {
135
+					if ( wp_image_matches_ratio( $data[ 'width' ], $data[ 'height' ], $size[ 0 ], $size[ 1 ] ) ) {
136
+						$candidates[ $data[ 'width' ] * $data[ 'height' ] ] = array( $_size, $data );
137 137
 					}
138 138
 				}
139 139
 			}
@@ -145,12 +145,12 @@  discard block
 block discarded – undo
145 145
 				}
146 146
 
147 147
 				$data = array_shift( $candidates );
148
-				$data = $data[0];
148
+				$data = $data[ 0 ];
149 149
 			/*
150 150
 			 * When the size requested is smaller than the thumbnail dimensions, we
151 151
 			 * fall back to the thumbnail size.
152 152
 			 */
153
-			} elseif ( ! empty( $image_sizes['thumbnail'] ) && $image_sizes['thumbnail']['width'] >= $size[0] && $image_sizes['thumbnail']['width'] >= $size[1] ) {
153
+			} elseif ( ! empty( $image_sizes[ 'thumbnail' ] ) && $image_sizes[ 'thumbnail' ][ 'width' ] >= $size[ 0 ] && $image_sizes[ 'thumbnail' ][ 'width' ] >= $size[ 1 ] ) {
154 154
 				$data = 'thumbnail';
155 155
 			} else {
156 156
 				return false;
@@ -240,8 +240,7 @@  discard block
 block discarded – undo
240 240
 		}
241 241
 
242 242
 		return self::is_valid_time_stamp( $string )
243
-			? (int) $string :
244
-			strtotime( (string) $string );
243
+			? (int) $string : strtotime( (string) $string );
245 244
 	}
246 245
 
247 246
 	/**
@@ -272,7 +271,7 @@  discard block
 block discarded – undo
272 271
 	 * @param  mixed $value Value to check
273 272
 	 * @return bool         True or false
274 273
 	 */
275
-	public static function notempty( $value ){
274
+	public static function notempty( $value ) {
276 275
 		return null !== $value && '' !== $value && false !== $value && array() !== $value;
277 276
 	}
278 277
 
@@ -430,24 +429,24 @@  discard block
 block discarded – undo
430 429
 
431 430
 		// order is relevant here, since the replacement will be done sequentially.
432 431
 		$supported_options = array(
433
-			'd' => 'dd',  // Day, leading 0
434
-			'j' => 'd',   // Day, no 0
435
-			'z' => 'o',   // Day of the year, no leading zeroes,
432
+			'd' => 'dd', // Day, leading 0
433
+			'j' => 'd', // Day, no 0
434
+			'z' => 'o', // Day of the year, no leading zeroes,
436 435
 			// 'D' => 'D',   // Day name short, not sure how it'll work with translations
437 436
 			// 'l' => 'DD',  // Day name full, idem before
438
-			'm' => 'mm',  // Month of the year, leading 0
439
-			'n' => 'm',   // Month of the year, no leading 0
437
+			'm' => 'mm', // Month of the year, leading 0
438
+			'n' => 'm', // Month of the year, no leading 0
440 439
 			// 'M' => 'M',   // Month, Short name
441 440
 			// 'F' => 'MM',  // Month, full name,
442
-			'y' => 'y',   // Year, two digit
443
-			'Y' => 'yy',  // Year, full
444
-			'H' => 'HH',  // Hour with leading 0 (24 hour)
445
-			'G' => 'H',   // Hour with no leading 0 (24 hour)
446
-			'h' => 'hh',  // Hour with leading 0 (12 hour)
447
-			'g' => 'h',   // Hour with no leading 0 (12 hour),
448
-			'i' => 'mm',  // Minute with leading 0,
449
-			's' => 'ss',  // Second with leading 0,
450
-			'a' => 'tt',  // am/pm
441
+			'y' => 'y', // Year, two digit
442
+			'Y' => 'yy', // Year, full
443
+			'H' => 'HH', // Hour with leading 0 (24 hour)
444
+			'G' => 'H', // Hour with no leading 0 (24 hour)
445
+			'h' => 'hh', // Hour with leading 0 (12 hour)
446
+			'g' => 'h', // Hour with no leading 0 (12 hour),
447
+			'i' => 'mm', // Minute with leading 0,
448
+			's' => 'ss', // Second with leading 0,
449
+			'a' => 'tt', // am/pm
451 450
 			'A' => 'TT'   // AM/PM
452 451
 		);
453 452
 
@@ -468,7 +467,7 @@  discard block
 block discarded – undo
468 467
 	 * @return string Modified value
469 468
 	 */
470 469
 	public static function wrap_escaped_chars( $value ) {
471
-		return "'" . str_replace( '\\', '', $value[0] ) . "'";
470
+		return "'" . str_replace( '\\', '', $value[ 0 ] ) . "'";
472 471
 	}
473 472
 
474 473
 	/**
@@ -527,7 +526,7 @@  discard block
 block discarded – undo
527 526
 	 * @return string               String of attributes for form element.
528 527
 	 */
529 528
 	public static function concat_attrs( $attrs, $attr_exclude = array() ) {
530
-		$attr_exclude[] = 'rendered';
529
+		$attr_exclude[ ] = 'rendered';
531 530
 		$attributes = '';
532 531
 		foreach ( $attrs as $attr => $val ) {
533 532
 			$excluded = in_array( $attr, (array) $attr_exclude, true );
Please login to merge, or discard this patch.
includes/CMB2_JS.php 1 patch
Spacing   +13 added lines, -13 removed lines patch added patch discarded remove patch
@@ -56,23 +56,23 @@  discard block
 block discarded – undo
56 56
 		$min = $debug ? '' : '.min';
57 57
 
58 58
 		// if colorpicker
59
-		if ( ! is_admin() && isset( $dependencies['wp-color-picker'] ) ) {
59
+		if ( ! is_admin() && isset( $dependencies[ 'wp-color-picker' ] ) ) {
60 60
 			self::colorpicker_frontend();
61 61
 		}
62 62
 
63 63
 		// if file/file_list
64
-		if ( isset( $dependencies['media-editor'] ) ) {
64
+		if ( isset( $dependencies[ 'media-editor' ] ) ) {
65 65
 			wp_enqueue_media();
66 66
 		}
67 67
 
68 68
 		// if timepicker
69
-		if ( isset( $dependencies['jquery-ui-datetimepicker'] ) ) {
69
+		if ( isset( $dependencies[ 'jquery-ui-datetimepicker' ] ) ) {
70 70
 			wp_register_script( 'jquery-ui-datetimepicker', CMB2_Utils::url( 'js/jquery-ui-timepicker-addon.min.js' ), array( 'jquery-ui-slider' ), CMB2_VERSION );
71 71
 		}
72 72
 
73 73
 		// if cmb2-wysiwyg
74
-		$enqueue_wysiwyg = isset( $dependencies['cmb2-wysiwyg'] ) && $debug;
75
-		unset( $dependencies['cmb2-wysiwyg'] );
74
+		$enqueue_wysiwyg = isset( $dependencies[ 'cmb2-wysiwyg' ] ) && $debug;
75
+		unset( $dependencies[ 'cmb2-wysiwyg' ] );
76 76
 
77 77
 		// Enqueue cmb JS
78 78
 		wp_enqueue_script( self::$handle, CMB2_Utils::url( "js/cmb2{$min}.js" ), $dependencies, CMB2_VERSION, true );
@@ -166,7 +166,7 @@  discard block
 block discarded – undo
166 166
 	 * @since  2.x.x.x
167 167
 	 */
168 168
 	public static function filter_media() {
169
-		add_filter( 'wp_prepare_attachment_for_js',  array( __CLASS__, 'prepare_image_sizes_for_js' ) , 10, 3 );
169
+		add_filter( 'wp_prepare_attachment_for_js', array( __CLASS__, 'prepare_image_sizes_for_js' ), 10, 3 );
170 170
 	}
171 171
 
172 172
 	/**
@@ -187,17 +187,17 @@  discard block
 block discarded – undo
187 187
 		
188 188
 		foreach ( $image_sizes as $size ) {
189 189
 			// registered image size exists for this attachment
190
-			if ( isset( $meta['sizes'][ $size ] ) ) {
190
+			if ( isset( $meta[ 'sizes' ][ $size ] ) ) {
191 191
 
192 192
 				$attachment_url = wp_get_attachment_url( $attachment->ID );
193 193
 				$base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url );
194
-				$size_meta = $meta['sizes'][ $size ];
194
+				$size_meta = $meta[ 'sizes' ][ $size ];
195 195
 
196
-				$response['sizes'][ $size ] = array(
197
-					'url'         => $base_url . $size_meta['file'],
198
-					'height'      => $size_meta['height'],
199
-					'width'       => $size_meta['width'],
200
-					'orientation' => $size_meta['height'] > $size_meta['width'] ? 'portrait' : 'landscape',
196
+				$response[ 'sizes' ][ $size ] = array(
197
+					'url'         => $base_url . $size_meta[ 'file' ],
198
+					'height'      => $size_meta[ 'height' ],
199
+					'width'       => $size_meta[ 'width' ],
200
+					'orientation' => $size_meta[ 'height' ] > $size_meta[ 'width' ] ? 'portrait' : 'landscape',
201 201
 				);
202 202
 			}
203 203
 		}
Please login to merge, or discard this patch.
includes/types/CMB2_Type_File.php 1 patch
Spacing   +5 added lines, -5 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 		$output      = '';
26 26
 
27 27
 		if ( is_array( $img_size ) ) {
28
-			$size_width  = $img_size[0];
29
-			$size_height = $img_size[1];
28
+			$size_width  = $img_size[ 0 ];
29
+			$size_height = $img_size[ 1 ];
30 30
 			
31 31
 			// Try and get the closest named size from our array of dimensions
32 32
 			if ( $named_size = CMB2_Utils::get_named_size( $img_size ) ) {
@@ -47,13 +47,13 @@  discard block
 block discarded – undo
47 47
 			}
48 48
 
49 49
 			// Get image dimensions from named sizes
50
-			$size_width  = $image_sizes[ $img_size ]['width'];
51
-			$size_height = $image_sizes[ $img_size ]['height'];
50
+			$size_width  = $image_sizes[ $img_size ][ 'width' ];
51
+			$size_height = $image_sizes[ $img_size ][ 'height' ];
52 52
 			$size_name   = $img_size;
53 53
 		}
54 54
 
55 55
 		// if options array and 'url' => false, then hide the url field
56
-		$input_type = array_key_exists( 'url', $options ) && false === $options['url'] ? 'hidden' : 'text';
56
+		$input_type = array_key_exists( 'url', $options ) && false === $options[ 'url' ] ? 'hidden' : 'text';
57 57
 
58 58
 		$output .= parent::render( array(
59 59
 			'type'  => $input_type,
Please login to merge, or discard this patch.
includes/types/CMB2_Type_File_List.php 1 patch
Spacing   +4 added lines, -4 removed lines patch added patch discarded remove patch
@@ -25,8 +25,8 @@  discard block
 block discarded – undo
25 25
 		$output      = '';
26 26
 
27 27
 		if ( is_array( $img_size ) ) {
28
-			$size_width  = $img_size[0];
29
-			$size_height = $img_size[1];
28
+			$size_width  = $img_size[ 0 ];
29
+			$size_height = $img_size[ 1 ];
30 30
 
31 31
 			// Try and get the closest named size from our array of dimensions
32 32
 			if ( $named_size = CMB2_Utils::get_named_size( $img_size ) ) {
@@ -47,8 +47,8 @@  discard block
 block discarded – undo
47 47
 			}
48 48
 
49 49
 			// Get image dimensions from named sizes
50
-			$size_width  = $image_sizes[ $img_size ]['width'];
51
-			$size_height = $image_sizes[ $img_size ]['height'];
50
+			$size_width  = $image_sizes[ $img_size ][ 'width' ];
51
+			$size_height = $image_sizes[ $img_size ][ 'height' ];
52 52
 			$size_name   = $img_size;
53 53
 		}
54 54
 
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
@@ -112,21 +112,21 @@  discard block
 block discarded – undo
112 112
 	 */
113 113
 	public function __construct( $args ) {
114 114
 
115
-		if ( ! empty( $args['group_field'] ) ) {
116
-			$this->group       = $args['group_field'];
115
+		if ( ! empty( $args[ 'group_field' ] ) ) {
116
+			$this->group       = $args[ 'group_field' ];
117 117
 			$this->object_id   = $this->group->object_id;
118 118
 			$this->object_type = $this->group->object_type;
119 119
 			$this->cmb_id      = $this->group->cmb_id;
120 120
 		} else {
121
-			$this->object_id   = isset( $args['object_id'] ) && '_' !== $args['object_id'] ? $args['object_id'] : 0;
122
-			$this->object_type = isset( $args['object_type'] ) ? $args['object_type'] : 'post';
121
+			$this->object_id   = isset( $args[ 'object_id' ] ) && '_' !== $args[ 'object_id' ] ? $args[ 'object_id' ] : 0;
122
+			$this->object_type = isset( $args[ 'object_type' ] ) ? $args[ 'object_type' ] : 'post';
123 123
 
124
-			if ( isset( $args['cmb_id'] ) ) {
125
-				$this->cmb_id = $args['cmb_id'];
124
+			if ( isset( $args[ 'cmb_id' ] ) ) {
125
+				$this->cmb_id = $args[ 'cmb_id' ];
126 126
 			}
127 127
 		}
128 128
 
129
-		$this->args = $this->_set_field_defaults( $args['field_args'], $args );
129
+		$this->args = $this->_set_field_defaults( $args[ 'field_args' ], $args );
130 130
 
131 131
 		if ( $this->object_id ) {
132 132
 			$this->value = $this->get_data();
@@ -145,7 +145,7 @@  discard block
 block discarded – undo
145 145
 			return call_user_func_array( array( $this, 'get_string' ), $arguments );
146 146
 		}
147 147
 
148
-		$key = isset( $arguments[0] ) ? $arguments[0] : false;
148
+		$key = isset( $arguments[ 0 ] ) ? $arguments[ 0 ] : false;
149 149
 		return $this->args( $name, $key );
150 150
 	}
151 151
 
@@ -216,9 +216,9 @@  discard block
 block discarded – undo
216 216
 	 */
217 217
 	public function get_data( $field_id = '', $args = array() ) {
218 218
 		if ( $field_id ) {
219
-			$args['field_id'] = $field_id;
219
+			$args[ 'field_id' ] = $field_id;
220 220
 		} else if ( $this->group ) {
221
-			$args['field_id'] = $this->group->id();
221
+			$args[ 'field_id' ] = $this->group->id();
222 222
 		}
223 223
 
224 224
 		$a = $this->data_args( $args );
@@ -259,13 +259,13 @@  discard block
 block discarded – undo
259 259
 		 *
260 260
 		 * @since 2.0.0
261 261
 		 */
262
-		$data = apply_filters( "cmb2_override_{$a['field_id']}_meta_value", $data, $this->object_id, $a, $this );
262
+		$data = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_value", $data, $this->object_id, $a, $this );
263 263
 
264 264
 		// If no override, get value normally
265 265
 		if ( 'cmb2_field_no_override_val' === $data ) {
266
-			$data = 'options-page' === $a['type']
267
-				? cmb2_options( $a['id'] )->get( $a['field_id'] )
268
-				: get_metadata( $a['type'], $a['id'], $a['field_id'], ( $a['single'] || $a['repeat'] ) );
266
+			$data = 'options-page' === $a[ 'type' ]
267
+				? cmb2_options( $a[ 'id' ] )->get( $a[ 'field_id' ] )
268
+				: get_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], ( $a[ 'single' ] || $a[ 'repeat' ] ) );
269 269
 		}
270 270
 
271 271
 		if ( $this->group ) {
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	public function update_data( $new_value, $single = true ) {
288 288
 		$a = $this->data_args( array( 'single' => $single ) );
289 289
 
290
-		$a['value'] = $a['repeat'] ? array_values( $new_value ) : $new_value;
290
+		$a[ 'value' ] = $a[ 'repeat' ] ? array_values( $new_value ) : $new_value;
291 291
 
292 292
 		/**
293 293
 		 * Filter whether to override saving of meta value.
@@ -323,7 +323,7 @@  discard block
 block discarded – undo
323 323
 		 *
324 324
 		 * @since 2.0.0
325 325
 		 */
326
-		$override = apply_filters( "cmb2_override_{$a['field_id']}_meta_save", $override, $a, $this->args(), $this );
326
+		$override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_save", $override, $a, $this->args(), $this );
327 327
 
328 328
 		// If override, return that
329 329
 		if ( null !== $override ) {
@@ -331,22 +331,22 @@  discard block
 block discarded – undo
331 331
 		}
332 332
 
333 333
 		// Options page handling (or temp data store)
334
-		if ( 'options-page' === $a['type'] || empty( $a['id'] ) ) {
335
-			return cmb2_options( $a['id'] )->update( $a['field_id'], $a['value'], false, $a['single'] );
334
+		if ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) {
335
+			return cmb2_options( $a[ 'id' ] )->update( $a[ 'field_id' ], $a[ 'value' ], false, $a[ 'single' ] );
336 336
 		}
337 337
 
338 338
 		// Add metadata if not single
339
-		if ( ! $a['single'] ) {
340
-			return add_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'], false );
339
+		if ( ! $a[ 'single' ] ) {
340
+			return add_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ], false );
341 341
 		}
342 342
 
343 343
 		// Delete meta if we have an empty array
344
-		if ( is_array( $a['value'] ) && empty( $a['value'] ) ) {
345
-			return delete_metadata( $a['type'], $a['id'], $a['field_id'], $this->value );
344
+		if ( is_array( $a[ 'value' ] ) && empty( $a[ 'value' ] ) ) {
345
+			return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $this->value );
346 346
 		}
347 347
 
348 348
 		// Update metadata
349
-		return update_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'] );
349
+		return update_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $a[ 'value' ] );
350 350
 	}
351 351
 
352 352
 	/**
@@ -396,19 +396,19 @@  discard block
 block discarded – undo
396 396
 		 * @param array $field_args All field arguments
397 397
 		 * @param CMB2_Field object $field This field object
398 398
 		 */
399
-		$override = apply_filters( "cmb2_override_{$a['field_id']}_meta_remove", $override, $a, $this->args(), $this );
399
+		$override = apply_filters( "cmb2_override_{$a[ 'field_id' ]}_meta_remove", $override, $a, $this->args(), $this );
400 400
 
401 401
 		// If no override, remove as usual
402 402
 		if ( null !== $override ) {
403 403
 			return $override;
404 404
 		}
405 405
 		// Option page handling
406
-		elseif ( 'options-page' === $a['type'] || empty( $a['id'] ) ) {
407
-			return cmb2_options( $a['id'] )->remove( $a['field_id'] );
406
+		elseif ( 'options-page' === $a[ 'type' ] || empty( $a[ 'id' ] ) ) {
407
+			return cmb2_options( $a[ 'id' ] )->remove( $a[ 'field_id' ] );
408 408
 		}
409 409
 
410 410
 		// Remove metadata
411
-		return delete_metadata( $a['type'], $a['id'], $a['field_id'], $old );
411
+		return delete_metadata( $a[ 'type' ], $a[ 'id' ], $a[ 'field_id' ], $old );
412 412
 	}
413 413
 
414 414
 	/**
@@ -859,7 +859,7 @@  discard block
 block discarded – undo
859 859
 
860 860
 		foreach ( $conditional_classes as $class => $condition ) {
861 861
 			if ( $condition ) {
862
-				$classes[] = $class;
862
+				$classes[ ] = $class;
863 863
 			}
864 864
 		}
865 865
 
@@ -870,7 +870,7 @@  discard block
 block discarded – undo
870 870
 		}
871 871
 
872 872
 		if ( $added_classes ) {
873
-			$classes[] = esc_attr( $added_classes );
873
+			$classes[ ] = esc_attr( $added_classes );
874 874
 		}
875 875
 
876 876
 		/**
@@ -970,10 +970,10 @@  discard block
 block discarded – undo
970 970
 	public function get_string( $text_key, $fallback ) {
971 971
 		// If null, populate with our field strings values.
972 972
 		if ( null === $this->strings ) {
973
-			$this->strings = (array) $this->args['text'];
973
+			$this->strings = (array) $this->args[ 'text' ];
974 974
 
975
-			if ( is_callable( $this->args['text_cb'] ) ) {
976
-				$strings = call_user_func( $this->args['text_cb'], $this );
975
+			if ( is_callable( $this->args[ 'text_cb' ] ) ) {
976
+				$strings = call_user_func( $this->args[ 'text_cb' ], $this );
977 977
 
978 978
 				if ( $strings && is_array( $strings ) ) {
979 979
 					$this->strings += $strings;
@@ -1007,10 +1007,10 @@  discard block
 block discarded – undo
1007 1007
 			return $this->field_options;
1008 1008
 		}
1009 1009
 
1010
-		$this->field_options = (array) $this->args['options'];
1010
+		$this->field_options = (array) $this->args[ 'options' ];
1011 1011
 
1012
-		if ( is_callable( $this->args['options_cb'] ) ) {
1013
-			$options = call_user_func( $this->args['options_cb'], $this );
1012
+		if ( is_callable( $this->args[ 'options_cb' ] ) ) {
1013
+			$options = call_user_func( $this->args[ 'options_cb' ], $this );
1014 1014
 
1015 1015
 			if ( $options && is_array( $options ) ) {
1016 1016
 				$this->field_options = $options + $this->field_options;
@@ -1031,7 +1031,7 @@  discard block
 block discarded – undo
1031 1031
 	 */
1032 1032
 	public function add_js_dependencies( $dependencies = array() ) {
1033 1033
 		foreach ( (array) $dependencies as $dependency ) {
1034
-			$this->args['js_dependencies'][ $dependency ] = $dependency;
1034
+			$this->args[ 'js_dependencies' ][ $dependency ] = $dependency;
1035 1035
 		}
1036 1036
 
1037 1037
 		CMB2_JS::add_dependencies( $dependencies );
@@ -1045,17 +1045,17 @@  discard block
 block discarded – undo
1045 1045
 	 * @return mixed  Default field value
1046 1046
 	 */
1047 1047
 	public function get_default() {
1048
-		if ( null !== $this->args['default'] ) {
1049
-			return $this->args['default'];
1048
+		if ( null !== $this->args[ 'default' ] ) {
1049
+			return $this->args[ 'default' ];
1050 1050
 		}
1051 1051
 
1052
-		$param = is_callable( $this->args['default_cb'] ) ? 'default_cb' : 'default';
1052
+		$param = is_callable( $this->args[ 'default_cb' ] ) ? 'default_cb' : 'default';
1053 1053
 		$default = $this->get_param_callback_result( $param );
1054 1054
 
1055 1055
 		// Allow a filter override of the default value
1056
-		$this->args['default'] = apply_filters( 'cmb2_default_filter', $default, $this );
1056
+		$this->args[ 'default' ] = apply_filters( 'cmb2_default_filter', $default, $this );
1057 1057
 
1058
-		return $this->args['default'];
1058
+		return $this->args[ 'default' ];
1059 1059
 	}
1060 1060
 
1061 1061
 	/**
@@ -1085,18 +1085,18 @@  discard block
 block discarded – undo
1085 1085
 			'classes_cb'        => '',
1086 1086
 			'select_all_button' => true,
1087 1087
 			'multiple'          => false,
1088
-			'repeatable'        => isset( $args['type'] ) && 'group' == $args['type'],
1088
+			'repeatable'        => isset( $args[ 'type' ] ) && 'group' == $args[ 'type' ],
1089 1089
 			'inline'            => false,
1090 1090
 			'on_front'          => true,
1091 1091
 			'show_names'        => true,
1092 1092
 			'save_field'        => true, // Will not save if false
1093 1093
 			'date_format'       => 'm\/d\/Y',
1094 1094
 			'time_format'       => 'h:i A',
1095
-			'description'       => isset( $args['desc'] ) ? $args['desc'] : '',
1096
-			'preview_size'      => 'file' == $args['type'] ? 'large' : 'thumbnail',
1095
+			'description'       => isset( $args[ 'desc' ] ) ? $args[ 'desc' ] : '',
1096
+			'preview_size'      => 'file' == $args[ 'type' ] ? 'large' : 'thumbnail',
1097 1097
 			'render_row_cb'     => array( $this, 'render_field_callback' ),
1098 1098
 			'display_cb'        => array( $this, 'display_value_callback' ),
1099
-			'label_cb'          => 'title' != $args['type'] ? array( $this, 'label' ) : '',
1099
+			'label_cb'          => 'title' != $args[ 'type' ] ? array( $this, 'label' ) : '',
1100 1100
 			'column'            => false,
1101 1101
 			'js_dependencies'   => array(),
1102 1102
 			'show_in_rest'      => null,
@@ -1111,44 +1111,44 @@  discard block
 block discarded – undo
1111 1111
 		 */
1112 1112
 		$args = $this->convert_deprecated_params( $args );
1113 1113
 
1114
-		$args['repeatable'] = $args['repeatable'] && ! $this->repeatable_exception( $args['type'] );
1115
-		$args['inline']     = $args['inline'] || false !== stripos( $args['type'], '_inline' );
1114
+		$args[ 'repeatable' ] = $args[ 'repeatable' ] && ! $this->repeatable_exception( $args[ 'type' ] );
1115
+		$args[ 'inline' ]     = $args[ 'inline' ] || false !== stripos( $args[ 'type' ], '_inline' );
1116 1116
 
1117
-		$args['options']    = 'group' == $args['type'] ? wp_parse_args( $args['options'], array(
1117
+		$args[ 'options' ]    = 'group' == $args[ 'type' ] ? wp_parse_args( $args[ 'options' ], array(
1118 1118
 			'add_button'    => esc_html__( 'Add Group', 'cmb2' ),
1119 1119
 			'remove_button' => esc_html__( 'Remove Group', 'cmb2' ),
1120
-		) ) : $args['options'];
1120
+		) ) : $args[ 'options' ];
1121 1121
 
1122
-		$args['_id']        = $args['id'];
1123
-		$args['_name']      = $args['id'];
1122
+		$args[ '_id' ]        = $args[ 'id' ];
1123
+		$args[ '_name' ]      = $args[ 'id' ];
1124 1124
 
1125 1125
 		if ( $this->group ) {
1126 1126
 
1127
-			$args['id']    = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args['id'];
1128
-			$args['_name'] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args['_name'] . ']';
1127
+			$args[ 'id' ]    = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args[ 'id' ];
1128
+			$args[ '_name' ] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args[ '_name' ] . ']';
1129 1129
 		}
1130 1130
 
1131
-		if ( 'wysiwyg' == $args['type'] ) {
1132
-			$args['id'] = strtolower( str_ireplace( '-', '_', $args['id'] ) );
1133
-			$args['options']['textarea_name'] = $args['_name'];
1131
+		if ( 'wysiwyg' == $args[ 'type' ] ) {
1132
+			$args[ 'id' ] = strtolower( str_ireplace( '-', '_', $args[ 'id' ] ) );
1133
+			$args[ 'options' ][ 'textarea_name' ] = $args[ '_name' ];
1134 1134
 		}
1135 1135
 
1136 1136
 		$option_types = apply_filters( 'cmb2_all_or_nothing_types', array( 'select', 'radio', 'radio_inline', 'taxonomy_select', 'taxonomy_radio', 'taxonomy_radio_inline' ), $this );
1137 1137
 
1138
-		if ( in_array( $args['type'], $option_types, true ) ) {
1138
+		if ( in_array( $args[ 'type' ], $option_types, true ) ) {
1139 1139
 
1140
-			$args['show_option_none'] = isset( $args['show_option_none'] ) ? $args['show_option_none'] : null;
1141
-			$args['show_option_none'] = true === $args['show_option_none'] ? esc_html__( 'None', 'cmb2' ) : $args['show_option_none'];
1140
+			$args[ 'show_option_none' ] = isset( $args[ 'show_option_none' ] ) ? $args[ 'show_option_none' ] : null;
1141
+			$args[ 'show_option_none' ] = true === $args[ 'show_option_none' ] ? esc_html__( 'None', 'cmb2' ) : $args[ 'show_option_none' ];
1142 1142
 
1143
-			if ( null === $args['show_option_none'] ) {
1144
-				$off_by_default = in_array( $args['type'], array( 'select', 'radio', 'radio_inline' ), true );
1145
-				$args['show_option_none'] = $off_by_default ? false : esc_html__( 'None', 'cmb2' );
1143
+			if ( null === $args[ 'show_option_none' ] ) {
1144
+				$off_by_default = in_array( $args[ 'type' ], array( 'select', 'radio', 'radio_inline' ), true );
1145
+				$args[ 'show_option_none' ] = $off_by_default ? false : esc_html__( 'None', 'cmb2' );
1146 1146
 			}
1147 1147
 
1148 1148
 		}
1149 1149
 
1150
-		$args['has_supporting_data'] = in_array(
1151
-			$args['type'],
1150
+		$args[ 'has_supporting_data' ] = in_array(
1151
+			$args[ 'type' ],
1152 1152
 			array(
1153 1153
 				// CMB2_Sanitize::_save_file_id_value()/CMB2_Sanitize::_get_group_file_value_array()
1154 1154
 				'file',
@@ -1171,10 +1171,10 @@  discard block
 block discarded – undo
1171 1171
 	protected function get_default_args( $field_args, $field_group = null ) {
1172 1172
 		$args = parent::get_default_args( array(), $this->group );
1173 1173
 
1174
-		if ( isset( $field_args['field_args'] ) ) {
1174
+		if ( isset( $field_args[ 'field_args' ] ) ) {
1175 1175
 			$args = wp_parse_args( $field_args, $args );
1176 1176
 		} else {
1177
-			$args['field_args'] = wp_parse_args( $field_args, $this->args );
1177
+			$args[ 'field_args' ] = wp_parse_args( $field_args, $this->args );
1178 1178
 		}
1179 1179
 
1180 1180
 		return $args;
@@ -1217,43 +1217,43 @@  discard block
 block discarded – undo
1217 1217
 	 */
1218 1218
 	protected function convert_deprecated_params( $args ) {
1219 1219
 
1220
-		if ( isset( $args['row_classes'] ) ) {
1220
+		if ( isset( $args[ 'row_classes' ] ) ) {
1221 1221
 
1222 1222
 			// We'll let this one be.
1223 1223
 			// $this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_PARAM, 'row_classes', 'classes' );
1224 1224
 
1225 1225
 			// row_classes param could be a callback. This is definitely deprecated.
1226
-			if ( is_callable( $args['row_classes'] ) ) {
1226
+			if ( is_callable( $args[ 'row_classes' ] ) ) {
1227 1227
 
1228 1228
 				$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'row_classes', 'classes_cb' );
1229 1229
 
1230
-				$args['classes_cb'] = $args['row_classes'];
1231
-				$args['classes'] = null;
1230
+				$args[ 'classes_cb' ] = $args[ 'row_classes' ];
1231
+				$args[ 'classes' ] = null;
1232 1232
 			} else {
1233 1233
 
1234
-				$args['classes'] = $args['row_classes'];
1234
+				$args[ 'classes' ] = $args[ 'row_classes' ];
1235 1235
 			}
1236 1236
 
1237
-			unset( $args['row_classes'] );
1237
+			unset( $args[ 'row_classes' ] );
1238 1238
 		}
1239 1239
 
1240 1240
 
1241 1241
 		// default param can be passed a callback as well
1242
-		if ( is_callable( $args['default'] ) ) {
1242
+		if ( is_callable( $args[ 'default' ] ) ) {
1243 1243
 
1244 1244
 			$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'default', 'default_cb' );
1245 1245
 
1246
-			$args['default_cb'] = $args['default'];
1247
-			$args['default'] = null;
1246
+			$args[ 'default_cb' ] = $args[ 'default' ];
1247
+			$args[ 'default' ] = null;
1248 1248
 		}
1249 1249
 
1250 1250
 		// options param can be passed a callback as well
1251
-		if ( is_callable( $args['options'] ) ) {
1251
+		if ( is_callable( $args[ 'options' ] ) ) {
1252 1252
 
1253 1253
 			$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'options', 'options_cb' );
1254 1254
 
1255
-			$args['options_cb'] = $args['options'];
1256
-			$args['options'] = array();
1255
+			$args[ 'options_cb' ] = $args[ 'options' ];
1256
+			$args[ 'options' ] = array();
1257 1257
 		}
1258 1258
 
1259 1259
 		return $args;
Please login to merge, or discard this patch.