Passed
Push — add/multiplan ( c6d0fb...d178ab )
by Warwick
07:56
created
vendor/CMB2/includes/CMB2_Field.php 1 patch
Spacing   +287 added lines, -287 removed lines patch added patch discarded remove patch
@@ -129,25 +129,25 @@  discard block
 block discarded – undo
129 129
 	 * @since 1.1.0
130 130
 	 * @param array $args Field arguments.
131 131
 	 */
132
-	public function __construct( $args ) {
132
+	public function __construct($args) {
133 133
 
134
-		if ( ! empty( $args['group_field'] ) ) {
134
+		if ( ! empty($args['group_field'])) {
135 135
 			$this->group       = $args['group_field'];
136 136
 			$this->object_id   = $this->group->object_id;
137 137
 			$this->object_type = $this->group->object_type;
138 138
 			$this->cmb_id      = $this->group->cmb_id;
139 139
 		} else {
140
-			$this->object_id   = isset( $args['object_id'] ) && '_' !== $args['object_id'] ? $args['object_id'] : 0;
141
-			$this->object_type = isset( $args['object_type'] ) ? $args['object_type'] : 'post';
140
+			$this->object_id   = isset($args['object_id']) && '_' !== $args['object_id'] ? $args['object_id'] : 0;
141
+			$this->object_type = isset($args['object_type']) ? $args['object_type'] : 'post';
142 142
 
143
-			if ( isset( $args['cmb_id'] ) ) {
143
+			if (isset($args['cmb_id'])) {
144 144
 				$this->cmb_id = $args['cmb_id'];
145 145
 			}
146 146
 		}
147 147
 
148
-		$this->args = $this->_set_field_defaults( $args['field_args'] );
148
+		$this->args = $this->_set_field_defaults($args['field_args']);
149 149
 
150
-		if ( $this->object_id ) {
150
+		if ($this->object_id) {
151 151
 			$this->value = $this->get_data();
152 152
 		}
153 153
 	}
@@ -160,13 +160,13 @@  discard block
 block discarded – undo
160 160
 	 * @param  array  $arguments Array of passed-in arguments.
161 161
 	 * @return mixed             Value of field argument
162 162
 	 */
163
-	public function __call( $name, $arguments ) {
164
-		if ( 'string' === $name ) {
165
-			return call_user_func_array( array( $this, 'get_string' ), $arguments );
163
+	public function __call($name, $arguments) {
164
+		if ('string' === $name) {
165
+			return call_user_func_array(array($this, 'get_string'), $arguments);
166 166
 		}
167 167
 
168
-		$key = isset( $arguments[0] ) ? $arguments[0] : '';
169
-		return $this->args( $name, $key );
168
+		$key = isset($arguments[0]) ? $arguments[0] : '';
169
+		return $this->args($name, $key);
170 170
 	}
171 171
 
172 172
 	/**
@@ -176,9 +176,9 @@  discard block
 block discarded – undo
176 176
 	 * @param  boolean $raw Whether to retrieve pre-modidifed id.
177 177
 	 * @return string       Field id
178 178
 	 */
179
-	public function id( $raw = false ) {
179
+	public function id($raw = false) {
180 180
 		$id = $raw ? '_id' : 'id';
181
-		return $this->args( $id );
181
+		return $this->args($id);
182 182
 	}
183 183
 
184 184
 	/**
@@ -189,16 +189,16 @@  discard block
 block discarded – undo
189 189
 	 * @param  string $_key Sub argument to check.
190 190
 	 * @return mixed        Argument value or false if non-existent
191 191
 	 */
192
-	public function args( $key = '', $_key = '' ) {
193
-		$arg = $this->_data( 'args', $key );
192
+	public function args($key = '', $_key = '') {
193
+		$arg = $this->_data('args', $key);
194 194
 
195
-		if ( in_array( $key, array( 'default', 'default_cb' ), true ) ) {
195
+		if (in_array($key, array('default', 'default_cb'), true)) {
196 196
 
197 197
 			$arg = $this->get_default();
198 198
 
199
-		} elseif ( $_key ) {
199
+		} elseif ($_key) {
200 200
 
201
-			$arg = isset( $arg[ $_key ] ) ? $arg[ $_key ] : false;
201
+			$arg = isset($arg[$_key]) ? $arg[$_key] : false;
202 202
 		}
203 203
 
204 204
 		return $arg;
@@ -212,10 +212,10 @@  discard block
 block discarded – undo
212 212
 	 * @param  string $key Field property array key to check.
213 213
 	 * @return mixed        Queried property value or false
214 214
 	 */
215
-	public function _data( $var, $key = '' ) {
215
+	public function _data($var, $key = '') {
216 216
 		$vars = $this->{$var};
217
-		if ( $key ) {
218
-			return array_key_exists( $key, $vars ) ? $vars[ $key ] : false;
217
+		if ($key) {
218
+			return array_key_exists($key, $vars) ? $vars[$key] : false;
219 219
 		}
220 220
 		return $vars;
221 221
 	}
@@ -227,8 +227,8 @@  discard block
 block discarded – undo
227 227
 	 * @param  string $key If value is an array, is used to get array key->value.
228 228
 	 * @return mixed       Field value or false if non-existent
229 229
 	 */
230
-	public function value( $key = '' ) {
231
-		return $this->_data( 'value', $key );
230
+	public function value($key = '') {
231
+		return $this->_data('value', $key);
232 232
 	}
233 233
 
234 234
 	/**
@@ -239,14 +239,14 @@  discard block
 block discarded – undo
239 239
 	 * @param  array  $args     Override arguments.
240 240
 	 * @return mixed            Meta/Option value
241 241
 	 */
242
-	public function get_data( $field_id = '', $args = array() ) {
243
-		if ( $field_id ) {
242
+	public function get_data($field_id = '', $args = array()) {
243
+		if ($field_id) {
244 244
 			$args['field_id'] = $field_id;
245
-		} elseif ( $this->group ) {
245
+		} elseif ($this->group) {
246 246
 			$args['field_id'] = $this->group->id();
247 247
 		}
248 248
 
249
-		$a = $this->data_args( $args );
249
+		$a = $this->data_args($args);
250 250
 
251 251
 		/**
252 252
 		 * Filter whether to override getting of meta value.
@@ -273,7 +273,7 @@  discard block
 block discarded – undo
273 273
 		 *
274 274
 		 * @param CMB2_Field object $field This field object
275 275
 		 */
276
-		$data = apply_filters( 'cmb2_override_meta_value', 'cmb2_field_no_override_val', $this->object_id, $a, $this );
276
+		$data = apply_filters('cmb2_override_meta_value', 'cmb2_field_no_override_val', $this->object_id, $a, $this);
277 277
 
278 278
 		/**
279 279
 		 * Filter and parameters are documented for 'cmb2_override_meta_value' filter (above).
@@ -284,19 +284,19 @@  discard block
 block discarded – undo
284 284
 		 *
285 285
 		 * @since 2.0.0
286 286
 		 */
287
-		$data = apply_filters( "cmb2_override_{$a['field_id']}_meta_value", $data, $this->object_id, $a, $this );
287
+		$data = apply_filters("cmb2_override_{$a['field_id']}_meta_value", $data, $this->object_id, $a, $this);
288 288
 
289 289
 		// If no override, get value normally.
290
-		if ( 'cmb2_field_no_override_val' === $data ) {
290
+		if ('cmb2_field_no_override_val' === $data) {
291 291
 			$data = 'options-page' === $a['type']
292
-				? cmb2_options( $a['id'] )->get( $a['field_id'] )
293
-				: get_metadata( $a['type'], $a['id'], $a['field_id'], ( $a['single'] || $a['repeat'] ) );
292
+				? cmb2_options($a['id'])->get($a['field_id'])
293
+				: get_metadata($a['type'], $a['id'], $a['field_id'], ($a['single'] || $a['repeat']));
294 294
 		}
295 295
 
296
-		if ( $this->group ) {
296
+		if ($this->group) {
297 297
 
298
-			$data = is_array( $data ) && isset( $data[ $this->group->index ][ $this->args( '_id' ) ] )
299
-				? $data[ $this->group->index ][ $this->args( '_id' ) ]
298
+			$data = is_array($data) && isset($data[$this->group->index][$this->args('_id')])
299
+				? $data[$this->group->index][$this->args('_id')]
300 300
 				: false;
301 301
 		}
302 302
 
@@ -311,12 +311,12 @@  discard block
 block discarded – undo
311 311
 	 * @param  bool  $single    Whether data is an array (add_metadata).
312 312
 	 * @return mixed
313 313
 	 */
314
-	public function update_data( $new_value, $single = true ) {
315
-		$a = $this->data_args( array(
314
+	public function update_data($new_value, $single = true) {
315
+		$a = $this->data_args(array(
316 316
 			'single' => $single,
317
-		) );
317
+		));
318 318
 
319
-		$a['value'] = $a['repeat'] ? array_values( $new_value ) : $new_value;
319
+		$a['value'] = $a['repeat'] ? array_values($new_value) : $new_value;
320 320
 
321 321
 		/**
322 322
 		 * Filter whether to override saving of meta value.
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 		 *
342 342
 		 * @param CMB2_Field object $field This field object
343 343
 		 */
344
-		$override = apply_filters( 'cmb2_override_meta_save', null, $a, $this->args(), $this );
344
+		$override = apply_filters('cmb2_override_meta_save', null, $a, $this->args(), $this);
345 345
 
346 346
 		/**
347 347
 		 * Filter and parameters are documented for 'cmb2_override_meta_save' filter (above).
@@ -352,30 +352,30 @@  discard block
 block discarded – undo
352 352
 		 *
353 353
 		 * @since 2.0.0
354 354
 		 */
355
-		$override = apply_filters( "cmb2_override_{$a['field_id']}_meta_save", $override, $a, $this->args(), $this );
355
+		$override = apply_filters("cmb2_override_{$a['field_id']}_meta_save", $override, $a, $this->args(), $this);
356 356
 
357 357
 		// If override, return that.
358
-		if ( null !== $override ) {
358
+		if (null !== $override) {
359 359
 			return $override;
360 360
 		}
361 361
 
362 362
 		// Options page handling (or temp data store).
363
-		if ( 'options-page' === $a['type'] || empty( $a['id'] ) ) {
364
-			return cmb2_options( $a['id'] )->update( $a['field_id'], $a['value'], false, $a['single'] );
363
+		if ('options-page' === $a['type'] || empty($a['id'])) {
364
+			return cmb2_options($a['id'])->update($a['field_id'], $a['value'], false, $a['single']);
365 365
 		}
366 366
 
367 367
 		// Add metadata if not single.
368
-		if ( ! $a['single'] ) {
369
-			return add_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'], false );
368
+		if ( ! $a['single']) {
369
+			return add_metadata($a['type'], $a['id'], $a['field_id'], $a['value'], false);
370 370
 		}
371 371
 
372 372
 		// Delete meta if we have an empty array.
373
-		if ( is_array( $a['value'] ) && empty( $a['value'] ) ) {
374
-			return delete_metadata( $a['type'], $a['id'], $a['field_id'], $this->value );
373
+		if (is_array($a['value']) && empty($a['value'])) {
374
+			return delete_metadata($a['type'], $a['id'], $a['field_id'], $this->value);
375 375
 		}
376 376
 
377 377
 		// Update metadata.
378
-		return update_metadata( $a['type'], $a['id'], $a['field_id'], $a['value'] );
378
+		return update_metadata($a['type'], $a['id'], $a['field_id'], $a['value']);
379 379
 	}
380 380
 
381 381
 	/**
@@ -385,10 +385,10 @@  discard block
 block discarded – undo
385 385
 	 * @param  string $old Old value.
386 386
 	 * @return mixed
387 387
 	 */
388
-	public function remove_data( $old = '' ) {
389
-		$a = $this->data_args( array(
388
+	public function remove_data($old = '') {
389
+		$a = $this->data_args(array(
390 390
 			'old' => $old,
391
-		) );
391
+		));
392 392
 
393 393
 		/**
394 394
 		 * Filter whether to override removing of meta value.
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 		 * @param array $field_args All field arguments
408 408
 		 * @param CMB2_Field object $field This field object
409 409
 		 */
410
-		$override = apply_filters( 'cmb2_override_meta_remove', null, $a, $this->args(), $this );
410
+		$override = apply_filters('cmb2_override_meta_remove', null, $a, $this->args(), $this);
411 411
 
412 412
 		/**
413 413
 		 * Filter whether to override removing of meta value.
@@ -429,19 +429,19 @@  discard block
 block discarded – undo
429 429
 		 * @param array $field_args All field arguments
430 430
 		 * @param CMB2_Field object $field This field object
431 431
 		 */
432
-		$override = apply_filters( "cmb2_override_{$a['field_id']}_meta_remove", $override, $a, $this->args(), $this );
432
+		$override = apply_filters("cmb2_override_{$a['field_id']}_meta_remove", $override, $a, $this->args(), $this);
433 433
 
434 434
 		// If no override, remove as usual.
435
-		if ( null !== $override ) {
435
+		if (null !== $override) {
436 436
 			return $override;
437 437
 		} // End if.
438 438
 		// Option page handling.
439
-		elseif ( 'options-page' === $a['type'] || empty( $a['id'] ) ) {
440
-			return cmb2_options( $a['id'] )->remove( $a['field_id'] );
439
+		elseif ('options-page' === $a['type'] || empty($a['id'])) {
440
+			return cmb2_options($a['id'])->remove($a['field_id']);
441 441
 		}
442 442
 
443 443
 		// Remove metadata.
444
-		return delete_metadata( $a['type'], $a['id'], $a['field_id'], $old );
444
+		return delete_metadata($a['type'], $a['id'], $a['field_id'], $old);
445 445
 	}
446 446
 
447 447
 	/**
@@ -451,14 +451,14 @@  discard block
 block discarded – undo
451 451
 	 * @param  array $args Override arguments.
452 452
 	 * @return array       Updated arguments
453 453
 	 */
454
-	public function data_args( $args = array() ) {
455
-		$args = wp_parse_args( $args, array(
454
+	public function data_args($args = array()) {
455
+		$args = wp_parse_args($args, array(
456 456
 			'type'     => $this->object_type,
457 457
 			'id'       => $this->object_id,
458
-			'field_id' => $this->id( true ),
459
-			'repeat'   => $this->args( 'repeatable' ),
460
-			'single'   => ! $this->args( 'multiple' ),
461
-		) );
458
+			'field_id' => $this->id(true),
459
+			'repeat'   => $this->args('repeatable'),
460
+			'single'   => ! $this->args('multiple'),
461
+		));
462 462
 		return $args;
463 463
 	}
464 464
 
@@ -469,24 +469,24 @@  discard block
 block discarded – undo
469 469
 	 * @param  mixed $meta_value Meta value.
470 470
 	 * @return mixed             Possibly sanitized meta value
471 471
 	 */
472
-	public function sanitization_cb( $meta_value ) {
472
+	public function sanitization_cb($meta_value) {
473 473
 
474
-		if ( $this->args( 'repeatable' ) && is_array( $meta_value ) ) {
474
+		if ($this->args('repeatable') && is_array($meta_value)) {
475 475
 			// Remove empties.
476
-			$meta_value = array_filter( $meta_value );
476
+			$meta_value = array_filter($meta_value);
477 477
 		}
478 478
 
479 479
 		// Check if the field has a registered validation callback.
480
-		$cb = $this->maybe_callback( 'sanitization_cb' );
481
-		if ( false === $cb ) {
480
+		$cb = $this->maybe_callback('sanitization_cb');
481
+		if (false === $cb) {
482 482
 			// If requesting NO validation, return meta value.
483 483
 			return $meta_value;
484
-		} elseif ( $cb ) {
484
+		} elseif ($cb) {
485 485
 			// Ok, callback is good, let's run it.
486
-			return call_user_func( $cb, $meta_value, $this->args(), $this );
486
+			return call_user_func($cb, $meta_value, $this->args(), $this);
487 487
 		}
488 488
 
489
-		$sanitizer = new CMB2_Sanitize( $this, $meta_value );
489
+		$sanitizer = new CMB2_Sanitize($this, $meta_value);
490 490
 		$field_type = $this->type();
491 491
 
492 492
 		/**
@@ -504,9 +504,9 @@  discard block
 block discarded – undo
504 504
 		 * @param array      $field_args The current field's arguments
505 505
 		 * @param object     $sanitizer  This `CMB2_Sanitize` object
506 506
 		 */
507
-		$override_value = apply_filters( "cmb2_sanitize_{$field_type}", null, $sanitizer->value, $this->object_id, $this->args(), $sanitizer );
507
+		$override_value = apply_filters("cmb2_sanitize_{$field_type}", null, $sanitizer->value, $this->object_id, $this->args(), $sanitizer);
508 508
 
509
-		if ( null !== $override_value ) {
509
+		if (null !== $override_value) {
510 510
 			return $override_value;
511 511
 		}
512 512
 
@@ -521,14 +521,14 @@  discard block
 block discarded – undo
521 521
 	 * @param  array $data_to_save $_POST data to check.
522 522
 	 * @return array|int|bool                Result of save, false on failure
523 523
 	 */
524
-	public function save_field_from_data( array $data_to_save ) {
524
+	public function save_field_from_data(array $data_to_save) {
525 525
 		$this->data_to_save = $data_to_save;
526 526
 
527
-		$meta_value = isset( $this->data_to_save[ $this->id( true ) ] )
528
-			? $this->data_to_save[ $this->id( true ) ]
527
+		$meta_value = isset($this->data_to_save[$this->id(true)])
528
+			? $this->data_to_save[$this->id(true)]
529 529
 			: null;
530 530
 
531
-		return $this->save_field( $meta_value );
531
+		return $this->save_field($meta_value);
532 532
 	}
533 533
 
534 534
 	/**
@@ -538,25 +538,25 @@  discard block
 block discarded – undo
538 538
 	 * @param  array $meta_value Desired value to sanitize/store.
539 539
 	 * @return array|int|bool              Result of save. false on failure
540 540
 	 */
541
-	public function save_field( $meta_value ) {
541
+	public function save_field($meta_value) {
542 542
 
543 543
 		$updated   = false;
544 544
 		$action    = '';
545
-		$new_value = $this->sanitization_cb( $meta_value );
545
+		$new_value = $this->sanitization_cb($meta_value);
546 546
 
547
-		if ( ! $this->args( 'save_field' ) ) {
547
+		if ( ! $this->args('save_field')) {
548 548
 
549 549
 			// Nothing to see here.
550 550
 			$action = 'disabled';
551 551
 
552
-		} elseif ( $this->args( 'multiple' ) && ! $this->args( 'repeatable' ) && ! $this->group ) {
552
+		} elseif ($this->args('multiple') && ! $this->args('repeatable') && ! $this->group) {
553 553
 
554 554
 			$this->remove_data();
555 555
 			$count = 0;
556 556
 
557
-			if ( ! empty( $new_value ) ) {
558
-				foreach ( $new_value as $add_new ) {
559
-					if ( $this->update_data( $add_new, false ) ) {
557
+			if ( ! empty($new_value)) {
558
+				foreach ($new_value as $add_new) {
559
+					if ($this->update_data($add_new, false)) {
560 560
 						$count++;
561 561
 					}
562 562
 				}
@@ -565,20 +565,20 @@  discard block
 block discarded – undo
565 565
 			$updated = $count ? $count : false;
566 566
 			$action  = 'repeatable';
567 567
 
568
-		} elseif ( ! CMB2_Utils::isempty( $new_value ) && $new_value !== $this->get_data() ) {
569
-			$updated = $this->update_data( $new_value );
568
+		} elseif ( ! CMB2_Utils::isempty($new_value) && $new_value !== $this->get_data()) {
569
+			$updated = $this->update_data($new_value);
570 570
 			$action  = 'updated';
571
-		} elseif ( CMB2_Utils::isempty( $new_value ) ) {
571
+		} elseif (CMB2_Utils::isempty($new_value)) {
572 572
 			$updated = $this->remove_data();
573 573
 			$action  = 'removed';
574 574
 		}
575 575
 
576
-		if ( $updated ) {
576
+		if ($updated) {
577 577
 			$this->value = $this->get_data();
578 578
 			$this->escaped_value = null;
579 579
 		}
580 580
 
581
-		$field_id = $this->id( true );
581
+		$field_id = $this->id(true);
582 582
 
583 583
 		/**
584 584
 		 * Hooks after save field action.
@@ -590,7 +590,7 @@  discard block
 block discarded – undo
590 590
 		 * @param string            $action   Action performed. Could be "repeatable", "updated", or "removed".
591 591
 		 * @param CMB2_Field object $field    This field object
592 592
 		 */
593
-		do_action( 'cmb2_save_field', $field_id, $updated, $action, $this );
593
+		do_action('cmb2_save_field', $field_id, $updated, $action, $this);
594 594
 
595 595
 		/**
596 596
 		 * Hooks after save field action.
@@ -604,7 +604,7 @@  discard block
 block discarded – undo
604 604
 		 * @param string            $action  Action performed. Could be "repeatable", "updated", or "removed".
605 605
 		 * @param CMB2_Field object $field   This field object
606 606
 		 */
607
-		do_action( "cmb2_save_field_{$field_id}", $updated, $action, $this );
607
+		do_action("cmb2_save_field_{$field_id}", $updated, $action, $this);
608 608
 
609 609
 		return $updated;
610 610
 	}
@@ -617,11 +617,11 @@  discard block
 block discarded – undo
617 617
 	 */
618 618
 	public function escaping_exception() {
619 619
 		// These types cannot be escaped.
620
-		return in_array( $this->type(), array(
620
+		return in_array($this->type(), array(
621 621
 			'file_list',
622 622
 			'multicheck',
623 623
 			'text_datetime_timestamp_timezone',
624
-		) );
624
+		));
625 625
 	}
626 626
 
627 627
 	/**
@@ -631,7 +631,7 @@  discard block
 block discarded – undo
631 631
 	 * @param  string $type Field type to check.
632 632
 	 * @return bool         True if type cannot be repeatable
633 633
 	 */
634
-	public function repeatable_exception( $type ) {
634
+	public function repeatable_exception($type) {
635 635
 		// These types cannot be repeatable.
636 636
 		$internal_fields = array(
637 637
 			// Use file_list instead.
@@ -662,8 +662,8 @@  discard block
 block discarded – undo
662 662
 		 *                      and not values. The value can be anything, because it is meaningless. Example:
663 663
 		 *                      array( 'my_custom_field' => 1 )
664 664
 		 */
665
-		$all_fields = array_merge( apply_filters( 'cmb2_non_repeatable_fields', array() ), $internal_fields );
666
-		return isset( $all_fields[ $type ] );
665
+		$all_fields = array_merge(apply_filters('cmb2_non_repeatable_fields', array()), $internal_fields);
666
+		return isset($all_fields[$type]);
667 667
 	}
668 668
 
669 669
 	/**
@@ -673,7 +673,7 @@  discard block
 block discarded – undo
673 673
 	 * @param  string $type Field type to check.
674 674
 	 * @return bool         True if has own method.
675 675
 	 */
676
-	public function has_args_method( $type ) {
676
+	public function has_args_method($type) {
677 677
 
678 678
 		// These types have their own arguments parser.
679 679
 		$type_methods = array(
@@ -681,11 +681,11 @@  discard block
 block discarded – undo
681 681
 			'wysiwyg' => 'set_field_defaults_wysiwyg',
682 682
 		);
683 683
 
684
-		if ( isset( $type_methods[ $type ] ) ) {
685
-			return $type_methods[ $type ];
684
+		if (isset($type_methods[$type])) {
685
+			return $type_methods[$type];
686 686
 		}
687 687
 
688
-		$all_or_nothing_types = array_flip( apply_filters( 'cmb2_all_or_nothing_types', array(
688
+		$all_or_nothing_types = array_flip(apply_filters('cmb2_all_or_nothing_types', array(
689 689
 			'select',
690 690
 			'radio',
691 691
 			'radio_inline',
@@ -694,9 +694,9 @@  discard block
 block discarded – undo
694 694
 			'taxonomy_radio',
695 695
 			'taxonomy_radio_inline',
696 696
 			'taxonomy_radio_hierarchical',
697
-		), $this ) );
697
+		), $this));
698 698
 
699
-		if ( isset( $all_or_nothing_types[ $type ] ) ) {
699
+		if (isset($all_or_nothing_types[$type])) {
700 700
 			return 'set_field_defaults_all_or_nothing_types';
701 701
 		}
702 702
 
@@ -711,18 +711,18 @@  discard block
 block discarded – undo
711 711
 	 * @param  mixed           $meta_value Meta value.
712 712
 	 * @return mixed                Final value.
713 713
 	 */
714
-	public function escaped_value( $func = 'esc_attr', $meta_value = '' ) {
714
+	public function escaped_value($func = 'esc_attr', $meta_value = '') {
715 715
 
716
-		if ( null !== $this->escaped_value ) {
716
+		if (null !== $this->escaped_value) {
717 717
 			return $this->escaped_value;
718 718
 		}
719 719
 
720 720
 		$meta_value = $meta_value ? $meta_value : $this->value();
721 721
 
722 722
 		// Check if the field has a registered escaping callback.
723
-		if ( $cb = $this->maybe_callback( 'escape_cb' ) ) {
723
+		if ($cb = $this->maybe_callback('escape_cb')) {
724 724
 			// Ok, callback is good, let's run it.
725
-			return call_user_func( $cb, $meta_value, $this->args(), $this );
725
+			return call_user_func($cb, $meta_value, $this->args(), $this);
726 726
 		}
727 727
 
728 728
 		$field_type = $this->type();
@@ -741,26 +741,26 @@  discard block
 block discarded – undo
741 741
 		 * @param array      $field_args The current field's arguments.
742 742
 		 * @param object     $field      This `CMB2_Field` object.
743 743
 		 */
744
-		$esc = apply_filters( "cmb2_types_esc_{$field_type}", null, $meta_value, $this->args(), $this );
745
-		if ( null !== $esc ) {
744
+		$esc = apply_filters("cmb2_types_esc_{$field_type}", null, $meta_value, $this->args(), $this);
745
+		if (null !== $esc) {
746 746
 			return $esc;
747 747
 		}
748 748
 
749
-		if ( false === $cb || $this->escaping_exception() ) {
749
+		if (false === $cb || $this->escaping_exception()) {
750 750
 			// If requesting NO escaping, return meta value.
751
-			return $this->val_or_default( $meta_value );
751
+			return $this->val_or_default($meta_value);
752 752
 		}
753 753
 
754 754
 		// escaping function passed in?
755 755
 		$func       = $func ? $func : 'esc_attr';
756
-		$meta_value = $this->val_or_default( $meta_value );
756
+		$meta_value = $this->val_or_default($meta_value);
757 757
 
758
-		if ( is_array( $meta_value ) ) {
759
-			foreach ( $meta_value as $key => $value ) {
760
-				$meta_value[ $key ] = call_user_func( $func, $value );
758
+		if (is_array($meta_value)) {
759
+			foreach ($meta_value as $key => $value) {
760
+				$meta_value[$key] = call_user_func($func, $value);
761 761
 			}
762 762
 		} else {
763
-			$meta_value = call_user_func( $func, $meta_value );
763
+			$meta_value = call_user_func($func, $meta_value);
764 764
 		}
765 765
 
766 766
 		$this->escaped_value = $meta_value;
@@ -774,8 +774,8 @@  discard block
 block discarded – undo
774 774
 	 * @param  mixed $meta_value Field value.
775 775
 	 * @return mixed             Field value, or default value
776 776
 	 */
777
-	public function val_or_default( $meta_value ) {
778
-		return ! CMB2_Utils::isempty( $meta_value ) ? $meta_value : $this->get_default();
777
+	public function val_or_default($meta_value) {
778
+		return ! CMB2_Utils::isempty($meta_value) ? $meta_value : $this->get_default();
779 779
 	}
780 780
 
781 781
 	/**
@@ -785,7 +785,7 @@  discard block
 block discarded – undo
785 785
 	 * @return string Offset time string
786 786
 	 */
787 787
 	public function field_timezone_offset() {
788
-		return CMB2_Utils::timezone_offset( $this->field_timezone() );
788
+		return CMB2_Utils::timezone_offset($this->field_timezone());
789 789
 	}
790 790
 
791 791
 	/**
@@ -798,12 +798,12 @@  discard block
 block discarded – undo
798 798
 		$value = '';
799 799
 
800 800
 		// Is timezone arg set?
801
-		if ( $this->args( 'timezone' ) ) {
802
-			$value = $this->args( 'timezone' );
801
+		if ($this->args('timezone')) {
802
+			$value = $this->args('timezone');
803 803
 		} // End if.
804 804
 		// Is there another meta key with a timezone stored as its value we should use?
805
-		elseif ( $this->args( 'timezone_meta_key' ) ) {
806
-			$value = $this->get_data( $this->args( 'timezone_meta_key' ) );
805
+		elseif ($this->args('timezone_meta_key')) {
806
+			$value = $this->get_data($this->args('timezone_meta_key'));
807 807
 		}
808 808
 
809 809
 		return $value;
@@ -817,8 +817,8 @@  discard block
 block discarded – undo
817 817
 	 * @param  string $format     Either date_format or time_format.
818 818
 	 * @return string             Formatted date
819 819
 	 */
820
-	public function format_timestamp( $meta_value, $format = 'date_format' ) {
821
-		return date( stripslashes( $this->args( $format ) ), $meta_value );
820
+	public function format_timestamp($meta_value, $format = 'date_format') {
821
+		return date(stripslashes($this->args($format)), $meta_value);
822 822
 	}
823 823
 
824 824
 	/**
@@ -829,20 +829,20 @@  discard block
 block discarded – undo
829 829
 	 * @param  string|int $meta_value Optional meta value to check.
830 830
 	 * @return string             Formatted date
831 831
 	 */
832
-	public function get_timestamp_format( $format = 'date_format', $meta_value = 0 ) {
832
+	public function get_timestamp_format($format = 'date_format', $meta_value = 0) {
833 833
 		$meta_value = $meta_value ? $meta_value : $this->escaped_value();
834
-		if ( empty( $meta_value ) ) {
834
+		if (empty($meta_value)) {
835 835
 			$meta_value = $this->get_default();
836 836
 		}
837 837
 
838
-		$meta_value = CMB2_Utils::make_valid_time_stamp( $meta_value );
839
-		if ( empty( $meta_value ) ) {
838
+		$meta_value = CMB2_Utils::make_valid_time_stamp($meta_value);
839
+		if (empty($meta_value)) {
840 840
 			return '';
841 841
 		}
842 842
 
843
-		return is_array( $meta_value )
844
-			? array_map( array( $this, 'format_timestamp' ), $meta_value, $format )
845
-			: $this->format_timestamp( $meta_value, $format );
843
+		return is_array($meta_value)
844
+			? array_map(array($this, 'format_timestamp'), $meta_value, $format)
845
+			: $this->format_timestamp($meta_value, $format);
846 846
 	}
847 847
 
848 848
 	/**
@@ -852,8 +852,8 @@  discard block
 block discarded – undo
852 852
 	 * @param  string $value Date value.
853 853
 	 * @return mixed         Unix timestamp representing the date.
854 854
 	 */
855
-	public function get_timestamp_from_value( $value ) {
856
-		return CMB2_Utils::get_timestamp_from_value( $value, $this->args( 'date_format' ) );
855
+	public function get_timestamp_from_value($value) {
856
+		return CMB2_Utils::get_timestamp_from_value($value, $this->args('date_format'));
857 857
 	}
858 858
 
859 859
 	/**
@@ -864,7 +864,7 @@  discard block
 block discarded – undo
864 864
 	public function render_field() {
865 865
 		$this->render_context = 'edit';
866 866
 
867
-		$this->peform_param_callback( 'render_row_cb' );
867
+		$this->peform_param_callback('render_row_cb');
868 868
 
869 869
 		// For chaining.
870 870
 		return $this;
@@ -878,12 +878,12 @@  discard block
 block discarded – undo
878 878
 	public function render_field_callback() {
879 879
 
880 880
 		// If field is requesting to not be shown on the front-end.
881
-		if ( ! is_admin() && ! $this->args( 'on_front' ) ) {
881
+		if ( ! is_admin() && ! $this->args('on_front')) {
882 882
 			return;
883 883
 		}
884 884
 
885 885
 		// If field is requesting to be conditionally shown.
886
-		if ( ! $this->should_show() ) {
886
+		if ( ! $this->should_show()) {
887 887
 			return;
888 888
 		}
889 889
 
@@ -894,7 +894,7 @@  discard block
 block discarded – undo
894 894
 		 *
895 895
 		 * @param CMB2_Field $field The current field object.
896 896
 		 */
897
-		do_action( 'cmb2_before_field_row', $this );
897
+		do_action('cmb2_before_field_row', $this);
898 898
 
899 899
 		/**
900 900
 		 * Hook before field row begins.
@@ -903,36 +903,36 @@  discard block
 block discarded – undo
903 903
 		 *
904 904
 		 * @param CMB2_Field $field The current field object.
905 905
 		 */
906
-		do_action( "cmb2_before_{$field_type}_field_row", $this );
906
+		do_action("cmb2_before_{$field_type}_field_row", $this);
907 907
 
908
-		$this->peform_param_callback( 'before_row' );
908
+		$this->peform_param_callback('before_row');
909 909
 
910
-		printf( "<div class=\"cmb-row %s\" data-fieldtype=\"%s\">\n", $this->row_classes(), $field_type );
910
+		printf("<div class=\"cmb-row %s\" data-fieldtype=\"%s\">\n", $this->row_classes(), $field_type);
911 911
 
912
-		if ( ! $this->args( 'show_names' ) ) {
912
+		if ( ! $this->args('show_names')) {
913 913
 			echo "\n\t<div class=\"cmb-td\">\n";
914 914
 
915
-			$this->peform_param_callback( 'label_cb' );
915
+			$this->peform_param_callback('label_cb');
916 916
 
917 917
 		} else {
918 918
 
919
-			if ( $this->get_param_callback_result( 'label_cb' ) ) {
920
-				echo '<div class="cmb-th">', $this->peform_param_callback( 'label_cb' ), '</div>';
919
+			if ($this->get_param_callback_result('label_cb')) {
920
+				echo '<div class="cmb-th">', $this->peform_param_callback('label_cb'), '</div>';
921 921
 			}
922 922
 
923 923
 			echo "\n\t<div class=\"cmb-td\">\n";
924 924
 		}
925 925
 
926
-		$this->peform_param_callback( 'before' );
926
+		$this->peform_param_callback('before');
927 927
 
928
-		$types = new CMB2_Types( $this );
928
+		$types = new CMB2_Types($this);
929 929
 		$types->render();
930 930
 
931
-		$this->peform_param_callback( 'after' );
931
+		$this->peform_param_callback('after');
932 932
 
933 933
 		echo "\n\t</div>\n</div>";
934 934
 
935
-		$this->peform_param_callback( 'after_row' );
935
+		$this->peform_param_callback('after_row');
936 936
 
937 937
 		/**
938 938
 		 * Hook after field row ends.
@@ -941,14 +941,14 @@  discard block
 block discarded – undo
941 941
 		 *
942 942
 		 * @param CMB2_Field $field The current field object.
943 943
 		 */
944
-		do_action( "cmb2_after_{$field_type}_field_row", $this );
944
+		do_action("cmb2_after_{$field_type}_field_row", $this);
945 945
 
946 946
 		/**
947 947
 		 * Hook after field row ends.
948 948
 		 *
949 949
 		 * @param CMB2_Field $field The current field object.
950 950
 		 */
951
-		do_action( 'cmb2_after_field_row', $this );
951
+		do_action('cmb2_after_field_row', $this);
952 952
 
953 953
 		// For chaining.
954 954
 		return $this;
@@ -961,13 +961,13 @@  discard block
 block discarded – undo
961 961
 	 * @return string Label html markup.
962 962
 	 */
963 963
 	public function label() {
964
-		if ( ! $this->args( 'name' ) ) {
964
+		if ( ! $this->args('name')) {
965 965
 			return '';
966 966
 		}
967 967
 
968
-		$style = ! $this->args( 'show_names' ) ? ' style="display:none;"' : '';
968
+		$style = ! $this->args('show_names') ? ' style="display:none;"' : '';
969 969
 
970
-		return sprintf( "\n" . '<label%1$s for="%2$s">%3$s</label>' . "\n", $style, $this->id(), $this->args( 'name' ) );
970
+		return sprintf("\n" . '<label%1$s for="%2$s">%3$s</label>' . "\n", $style, $this->id(), $this->args('name'));
971 971
 	}
972 972
 
973 973
 	/**
@@ -987,34 +987,34 @@  discard block
 block discarded – undo
987 987
 		 *
988 988
 		 * @param array $field_types The types of fields which should get the 'table-layout' class
989 989
 		 */
990
-		$repeat_table_rows_types = apply_filters( 'cmb2_repeat_table_row_types', array(
990
+		$repeat_table_rows_types = apply_filters('cmb2_repeat_table_row_types', array(
991 991
 			'text_url',
992 992
 			'text',
993
-		) );
993
+		));
994 994
 
995 995
 		$conditional_classes = array(
996
-			'cmb-type-' . str_replace( '_', '-', sanitize_html_class( $this->type() ) ) => true,
997
-			'cmb2-id-' . str_replace( '_', '-', sanitize_html_class( $this->id() ) )    => true,
998
-			'cmb-repeat'             => $this->args( 'repeatable' ),
996
+			'cmb-type-' . str_replace('_', '-', sanitize_html_class($this->type())) => true,
997
+			'cmb2-id-' . str_replace('_', '-', sanitize_html_class($this->id()))    => true,
998
+			'cmb-repeat'             => $this->args('repeatable'),
999 999
 			'cmb-repeat-group-field' => $this->group,
1000
-			'cmb-inline'             => $this->args( 'inline' ),
1001
-			'table-layout'           => 'edit' === $this->render_context && in_array( $this->type(), $repeat_table_rows_types ),
1000
+			'cmb-inline'             => $this->args('inline'),
1001
+			'table-layout'           => 'edit' === $this->render_context && in_array($this->type(), $repeat_table_rows_types),
1002 1002
 		);
1003 1003
 
1004
-		foreach ( $conditional_classes as $class => $condition ) {
1005
-			if ( $condition ) {
1004
+		foreach ($conditional_classes as $class => $condition) {
1005
+			if ($condition) {
1006 1006
 				$classes[] = $class;
1007 1007
 			}
1008 1008
 		}
1009 1009
 
1010
-		if ( $added_classes = $this->args( 'classes' ) ) {
1011
-			$added_classes = is_array( $added_classes ) ? implode( ' ', $added_classes ) : (string) $added_classes;
1012
-		} elseif ( $added_classes = $this->get_param_callback_result( 'classes_cb' ) ) {
1013
-			$added_classes = is_array( $added_classes ) ? implode( ' ', $added_classes ) : (string) $added_classes;
1010
+		if ($added_classes = $this->args('classes')) {
1011
+			$added_classes = is_array($added_classes) ? implode(' ', $added_classes) : (string) $added_classes;
1012
+		} elseif ($added_classes = $this->get_param_callback_result('classes_cb')) {
1013
+			$added_classes = is_array($added_classes) ? implode(' ', $added_classes) : (string) $added_classes;
1014 1014
 		}
1015 1015
 
1016
-		if ( $added_classes ) {
1017
-			$classes[] = esc_attr( $added_classes );
1016
+		if ($added_classes) {
1017
+			$classes[] = esc_attr($added_classes);
1018 1018
 		}
1019 1019
 
1020 1020
 		/**
@@ -1025,7 +1025,7 @@  discard block
 block discarded – undo
1025 1025
 		 * @param string            $classes Space-separated list of row classes
1026 1026
 		 * @param CMB2_Field object $field   This field object
1027 1027
 		 */
1028
-		return apply_filters( 'cmb2_row_classes', implode( ' ', $classes ), $this );
1028
+		return apply_filters('cmb2_row_classes', implode(' ', $classes), $this);
1029 1029
 	}
1030 1030
 
1031 1031
 	/**
@@ -1036,7 +1036,7 @@  discard block
 block discarded – undo
1036 1036
 	public function render_column() {
1037 1037
 		$this->render_context = 'display';
1038 1038
 
1039
-		$this->peform_param_callback( 'display_cb' );
1039
+		$this->peform_param_callback('display_cb');
1040 1040
 
1041 1041
 		// For chaining.
1042 1042
 		return $this;
@@ -1049,10 +1049,10 @@  discard block
 block discarded – undo
1049 1049
 	 */
1050 1050
 	public function get_rest_value() {
1051 1051
 		$field_type = $this->type();
1052
-		$field_id   = $this->id( true );
1052
+		$field_id   = $this->id(true);
1053 1053
 
1054
-		if ( $cb = $this->maybe_callback( 'rest_value_cb' ) ) {
1055
-			add_filter( "cmb2_get_rest_value_for_{$field_id}", $cb, 99 );
1054
+		if ($cb = $this->maybe_callback('rest_value_cb')) {
1055
+			add_filter("cmb2_get_rest_value_for_{$field_id}", $cb, 99);
1056 1056
 		}
1057 1057
 
1058 1058
 		$value = $this->get_data();
@@ -1065,7 +1065,7 @@  discard block
 block discarded – undo
1065 1065
 		 * @param mixed      $value The value from CMB2_Field::get_data()
1066 1066
 		 * @param CMB2_Field $field This field object.
1067 1067
 		 */
1068
-		$value = apply_filters( 'cmb2_get_rest_value', $value, $this );
1068
+		$value = apply_filters('cmb2_get_rest_value', $value, $this);
1069 1069
 
1070 1070
 		/**
1071 1071
 		 * Filter the value before it is sent to the REST request.
@@ -1077,7 +1077,7 @@  discard block
 block discarded – undo
1077 1077
 		 * @param mixed      $value The value from CMB2_Field::get_data()
1078 1078
 		 * @param CMB2_Field $field This field object.
1079 1079
 		 */
1080
-		$value = apply_filters( "cmb2_get_rest_value_{$field_type}", $value, $this );
1080
+		$value = apply_filters("cmb2_get_rest_value_{$field_type}", $value, $this);
1081 1081
 
1082 1082
 		/**
1083 1083
 		 * Filter the value before it is sent to the REST request.
@@ -1089,7 +1089,7 @@  discard block
 block discarded – undo
1089 1089
 		 * @param mixed      $value The value from CMB2_Field::get_data()
1090 1090
 		 * @param CMB2_Field $field This field object.
1091 1091
 		 */
1092
-		return apply_filters( "cmb2_get_rest_value_for_{$field_id}", $value, $this );
1092
+		return apply_filters("cmb2_get_rest_value_for_{$field_id}", $value, $this);
1093 1093
 	}
1094 1094
 
1095 1095
 	/**
@@ -1100,15 +1100,15 @@  discard block
 block discarded – undo
1100 1100
 	 * @return CMB2_Field|bool Supporting field object, if supported.
1101 1101
 	 */
1102 1102
 	public function get_supporting_field() {
1103
-		$suffix = $this->args( 'has_supporting_data' );
1104
-		if ( empty( $suffix ) ) {
1103
+		$suffix = $this->args('has_supporting_data');
1104
+		if (empty($suffix)) {
1105 1105
 			return false;
1106 1106
 		}
1107 1107
 
1108
-		return $this->get_field_clone( array(
1109
-			'id' => $this->_id( '', false ) . $suffix,
1108
+		return $this->get_field_clone(array(
1109
+			'id' => $this->_id('', false) . $suffix,
1110 1110
 			'sanitization_cb' => false,
1111
-		) );
1111
+		));
1112 1112
 	}
1113 1113
 
1114 1114
 	/**
@@ -1118,11 +1118,11 @@  discard block
 block discarded – undo
1118 1118
 	 */
1119 1119
 	public function display_value_callback() {
1120 1120
 		// If field is requesting to be conditionally shown.
1121
-		if ( ! $this->should_show() ) {
1121
+		if ( ! $this->should_show()) {
1122 1122
 			return;
1123 1123
 		}
1124 1124
 
1125
-		$display = new CMB2_Field_Display( $this );
1125
+		$display = new CMB2_Field_Display($this);
1126 1126
 		$field_type = $this->type();
1127 1127
 
1128 1128
 		/**
@@ -1136,26 +1136,26 @@  discard block
 block discarded – undo
1136 1136
 		 * @param CMB2_Field         $field      This field object.
1137 1137
 		 * @param CMB2_Field_Display $display    The `CMB2_Field_Display` object.
1138 1138
 		 */
1139
-		$pre_output = apply_filters( "cmb2_pre_field_display_{$field_type}", null, $this, $display );
1139
+		$pre_output = apply_filters("cmb2_pre_field_display_{$field_type}", null, $this, $display);
1140 1140
 
1141
-		if ( null !== $pre_output ) {
1141
+		if (null !== $pre_output) {
1142 1142
 			echo $pre_output;
1143 1143
 			return;
1144 1144
 		}
1145 1145
 
1146
-		$this->peform_param_callback( 'before_display_wrap' );
1146
+		$this->peform_param_callback('before_display_wrap');
1147 1147
 
1148
-		printf( "<div class=\"cmb-column %s\" data-fieldtype=\"%s\">\n", $this->row_classes(), $field_type );
1148
+		printf("<div class=\"cmb-column %s\" data-fieldtype=\"%s\">\n", $this->row_classes(), $field_type);
1149 1149
 
1150
-		$this->peform_param_callback( 'before_display' );
1150
+		$this->peform_param_callback('before_display');
1151 1151
 
1152
-		CMB2_Field_Display::get( $this )->display();
1152
+		CMB2_Field_Display::get($this)->display();
1153 1153
 
1154
-		$this->peform_param_callback( 'after_display' );
1154
+		$this->peform_param_callback('after_display');
1155 1155
 
1156 1156
 		echo "\n</div>";
1157 1157
 
1158
-		$this->peform_param_callback( 'after_display_wrap' );
1158
+		$this->peform_param_callback('after_display_wrap');
1159 1159
 
1160 1160
 		// For chaining.
1161 1161
 		return $this;
@@ -1168,9 +1168,9 @@  discard block
 block discarded – undo
1168 1168
 	 * @param  string $value Value to update.
1169 1169
 	 * @return string        Updated value
1170 1170
 	 */
1171
-	public function replace_hash( $value ) {
1171
+	public function replace_hash($value) {
1172 1172
 		// Replace hash with 1 based count.
1173
-		return str_replace( '{#}', ( $this->index + 1 ), $value );
1173
+		return str_replace('{#}', ($this->index + 1), $value);
1174 1174
 	}
1175 1175
 
1176 1176
 	/**
@@ -1182,27 +1182,27 @@  discard block
 block discarded – undo
1182 1182
 	 * @param  string $fallback Fallback text.
1183 1183
 	 * @return string            Text
1184 1184
 	 */
1185
-	public function get_string( $text_key, $fallback ) {
1185
+	public function get_string($text_key, $fallback) {
1186 1186
 		// If null, populate with our field strings values.
1187
-		if ( null === $this->strings ) {
1187
+		if (null === $this->strings) {
1188 1188
 			$this->strings = (array) $this->args['text'];
1189 1189
 
1190
-			if ( is_callable( $this->args['text_cb'] ) ) {
1191
-				$strings = call_user_func( $this->args['text_cb'], $this );
1190
+			if (is_callable($this->args['text_cb'])) {
1191
+				$strings = call_user_func($this->args['text_cb'], $this);
1192 1192
 
1193
-				if ( $strings && is_array( $strings ) ) {
1193
+				if ($strings && is_array($strings)) {
1194 1194
 					$this->strings += $strings;
1195 1195
 				}
1196 1196
 			}
1197 1197
 		}
1198 1198
 
1199 1199
 		// If we have that string value, send it back.
1200
-		if ( isset( $this->strings[ $text_key ] ) ) {
1201
-			return $this->strings[ $text_key ];
1200
+		if (isset($this->strings[$text_key])) {
1201
+			return $this->strings[$text_key];
1202 1202
 		}
1203 1203
 
1204 1204
 		// Check options for back-compat.
1205
-		$string = $this->options( $text_key );
1205
+		$string = $this->options($text_key);
1206 1206
 
1207 1207
 		return $string ? $string : $fallback;
1208 1208
 	}
@@ -1214,13 +1214,13 @@  discard block
 block discarded – undo
1214 1214
 	 * @param  string $key Specific option to retrieve.
1215 1215
 	 * @return array|mixed Array of options or specific option.
1216 1216
 	 */
1217
-	public function options( $key = '' ) {
1218
-		if ( empty( $this->field_options ) ) {
1217
+	public function options($key = '') {
1218
+		if (empty($this->field_options)) {
1219 1219
 			$this->set_options();
1220 1220
 		}
1221 1221
 
1222
-		if ( $key ) {
1223
-			return array_key_exists( $key, $this->field_options ) ? $this->field_options[ $key ] : false;
1222
+		if ($key) {
1223
+			return array_key_exists($key, $this->field_options) ? $this->field_options[$key] : false;
1224 1224
 		}
1225 1225
 
1226 1226
 		return $this->field_options;
@@ -1236,10 +1236,10 @@  discard block
 block discarded – undo
1236 1236
 	public function set_options() {
1237 1237
 		$this->field_options = (array) $this->args['options'];
1238 1238
 
1239
-		if ( is_callable( $this->args['options_cb'] ) ) {
1240
-			$options = call_user_func( $this->args['options_cb'], $this );
1239
+		if (is_callable($this->args['options_cb'])) {
1240
+			$options = call_user_func($this->args['options_cb'], $this);
1241 1241
 
1242
-			if ( $options && is_array( $options ) ) {
1242
+			if ($options && is_array($options)) {
1243 1243
 				$this->field_options = $options + $this->field_options;
1244 1244
 			}
1245 1245
 		}
@@ -1253,12 +1253,12 @@  discard block
 block discarded – undo
1253 1253
 	 * @since 2.2.0
1254 1254
 	 * @param array $dependencies Dependies to register for this field.
1255 1255
 	 */
1256
-	public function add_js_dependencies( $dependencies = array() ) {
1257
-		foreach ( (array) $dependencies as $dependency ) {
1258
-			$this->args['js_dependencies'][ $dependency ] = $dependency;
1256
+	public function add_js_dependencies($dependencies = array()) {
1257
+		foreach ((array) $dependencies as $dependency) {
1258
+			$this->args['js_dependencies'][$dependency] = $dependency;
1259 1259
 		}
1260 1260
 
1261
-		CMB2_JS::add_dependencies( $dependencies );
1261
+		CMB2_JS::add_dependencies($dependencies);
1262 1262
 	}
1263 1263
 
1264 1264
 	/**
@@ -1267,11 +1267,11 @@  discard block
 block discarded – undo
1267 1267
 	 * @since 2.2.0
1268 1268
 	 */
1269 1269
 	public function register_js_data() {
1270
-		if ( $this->group ) {
1271
-			CMB2_JS::add_field_data( $this->group );
1270
+		if ($this->group) {
1271
+			CMB2_JS::add_field_data($this->group);
1272 1272
 		}
1273 1273
 
1274
-		return CMB2_JS::add_field_data( $this );
1274
+		return CMB2_JS::add_field_data($this);
1275 1275
 	}
1276 1276
 
1277 1277
 	/**
@@ -1283,13 +1283,13 @@  discard block
 block discarded – undo
1283 1283
 	 */
1284 1284
 	public function js_data() {
1285 1285
 		return array(
1286
-			'label'     => $this->args( 'name' ),
1287
-			'id'        => $this->id( true ),
1286
+			'label'     => $this->args('name'),
1287
+			'id'        => $this->id(true),
1288 1288
 			'type'      => $this->type(),
1289 1289
 			'hash'      => $this->hash_id(),
1290 1290
 			'box'       => $this->cmb_id,
1291 1291
 			'id_attr'   => $this->id(),
1292
-			'name_attr' => $this->args( '_name' ),
1292
+			'name_attr' => $this->args('_name'),
1293 1293
 			'default'   => $this->get_default(),
1294 1294
 			'group'     => $this->group_id(),
1295 1295
 			'index'     => $this->group ? $this->group->index : null,
@@ -1304,8 +1304,8 @@  discard block
 block discarded – undo
1304 1304
 	 * @return string
1305 1305
 	 */
1306 1306
 	public function hash_id() {
1307
-		if ( '' === $this->hash_id ) {
1308
-			$this->hash_id = CMB2_Utils::generate_hash( $this->cmb_id . '||' . $this->id() );
1307
+		if ('' === $this->hash_id) {
1308
+			$this->hash_id = CMB2_Utils::generate_hash($this->cmb_id . '||' . $this->id());
1309 1309
 		}
1310 1310
 
1311 1311
 		return $this->hash_id;
@@ -1319,7 +1319,7 @@  discard block
 block discarded – undo
1319 1319
 	 * @return string
1320 1320
 	 */
1321 1321
 	public function group_id() {
1322
-		return $this->group ? $this->group->id( true ) : '';
1322
+		return $this->group ? $this->group->id(true) : '';
1323 1323
 	}
1324 1324
 
1325 1325
 	/**
@@ -1332,15 +1332,15 @@  discard block
 block discarded – undo
1332 1332
 	public function get_default() {
1333 1333
 		$default = $this->args['default'];
1334 1334
 
1335
-		if ( null !== $default ) {
1336
-			return apply_filters( 'cmb2_default_filter', $default, $this );
1335
+		if (null !== $default) {
1336
+			return apply_filters('cmb2_default_filter', $default, $this);
1337 1337
 		}
1338 1338
 
1339
-		$param = is_callable( $this->args['default_cb'] ) ? 'default_cb' : 'default';
1340
-		$default = $this->args['default'] = $this->get_param_callback_result( $param );
1339
+		$param = is_callable($this->args['default_cb']) ? 'default_cb' : 'default';
1340
+		$default = $this->args['default'] = $this->get_param_callback_result($param);
1341 1341
 
1342 1342
 		// Allow a filter override of the default value.
1343
-		return apply_filters( 'cmb2_default_filter', $this->args['default'], $this );
1343
+		return apply_filters('cmb2_default_filter', $this->args['default'], $this);
1344 1344
 	}
1345 1345
 
1346 1346
 	/**
@@ -1351,8 +1351,8 @@  discard block
 block discarded – undo
1351 1351
 	 * @param  array $args Field config array.
1352 1352
 	 * @return array        Modified field config array.
1353 1353
 	 */
1354
-	public function _set_field_defaults( $args ) {
1355
-		$defaults = $this->get_default_field_args( $args );
1354
+	public function _set_field_defaults($args) {
1355
+		$defaults = $this->get_default_field_args($args);
1356 1356
 
1357 1357
 		/**
1358 1358
 		 * Filter the CMB2 Field defaults.
@@ -1363,10 +1363,10 @@  discard block
 block discarded – undo
1363 1363
 		 * @param string            $type     Field type for the current field to allow for selective filtering.
1364 1364
 		 * @param CMB2_Field object $field    This field object.
1365 1365
 		 */
1366
-		$defaults = apply_filters( 'cmb2_field_defaults', $defaults, $args['id'], $args['type'], $this );
1366
+		$defaults = apply_filters('cmb2_field_defaults', $defaults, $args['id'], $args['type'], $this);
1367 1367
 
1368 1368
 		// Set up blank or default values for empty ones.
1369
-		$args = wp_parse_args( $args, $defaults );
1369
+		$args = wp_parse_args($args, $defaults);
1370 1370
 
1371 1371
 		/**
1372 1372
 		 * Filtering the CMB2 Field arguments once merged with the defaults, but before further processing.
@@ -1375,7 +1375,7 @@  discard block
 block discarded – undo
1375 1375
 		 * @param array             $args  Metabox field config array defaults.
1376 1376
 		 * @param CMB2_Field object $field This field object.
1377 1377
 		 */
1378
-		$args = apply_filters( 'cmb2_field_arguments_raw', $args, $this );
1378
+		$args = apply_filters('cmb2_field_arguments_raw', $args, $this);
1379 1379
 
1380 1380
 		/*
1381 1381
 		 * Deprecated usage:
@@ -1384,19 +1384,19 @@  discard block
 block discarded – undo
1384 1384
 		 * 'row_classes' -- use 'class', or 'class_cb'
1385 1385
 		 * 'default' -- as callback (use default_cb)
1386 1386
 		 */
1387
-		$args = $this->convert_deprecated_params( $args );
1387
+		$args = $this->convert_deprecated_params($args);
1388 1388
 
1389
-		$args['repeatable'] = $args['repeatable'] && ! $this->repeatable_exception( $args['type'] );
1390
-		$args['inline']     = $args['inline'] || false !== stripos( $args['type'], '_inline' );
1389
+		$args['repeatable'] = $args['repeatable'] && ! $this->repeatable_exception($args['type']);
1390
+		$args['inline']     = $args['inline'] || false !== stripos($args['type'], '_inline');
1391 1391
 		$args['_id']        = $args['id'];
1392 1392
 		$args['_name']      = $args['id'];
1393 1393
 
1394
-		if ( $method = $this->has_args_method( $args['type'] ) ) {
1395
-			$args = $this->{$method}( $args );
1394
+		if ($method = $this->has_args_method($args['type'])) {
1395
+			$args = $this->{$method}($args);
1396 1396
 		}
1397 1397
 
1398
-		if ( $this->group ) {
1399
-			$args = $this->set_group_sub_field_defaults( $args );
1398
+		if ($this->group) {
1399
+			$args = $this->set_group_sub_field_defaults($args);
1400 1400
 		}
1401 1401
 
1402 1402
 		$with_supporting = array(
@@ -1406,13 +1406,13 @@  discard block
 block discarded – undo
1406 1406
 			'text_datetime_timestamp_timezone' => '_utc',
1407 1407
 		);
1408 1408
 
1409
-		$args['has_supporting_data'] = isset( $with_supporting[ $args['type'] ] )
1410
-			? $with_supporting[ $args['type'] ]
1409
+		$args['has_supporting_data'] = isset($with_supporting[$args['type']])
1410
+			? $with_supporting[$args['type']]
1411 1411
 			: false;
1412 1412
 
1413 1413
 		// Repeatable fields require jQuery sortable library.
1414
-		if ( ! empty( $args['repeatable'] ) ) {
1415
-			CMB2_JS::add_dependencies( 'jquery-ui-sortable' );
1414
+		if ( ! empty($args['repeatable'])) {
1415
+			CMB2_JS::add_dependencies('jquery-ui-sortable');
1416 1416
 		}
1417 1417
 
1418 1418
 		/**
@@ -1422,7 +1422,7 @@  discard block
 block discarded – undo
1422 1422
 		 * @param array             $args  Metabox field config array after processing.
1423 1423
 		 * @param CMB2_Field object $field This field object.
1424 1424
 		 */
1425
-		return apply_filters( 'cmb2_field_arguments', $args, $this );
1425
+		return apply_filters('cmb2_field_arguments', $args, $this);
1426 1426
 	}
1427 1427
 
1428 1428
 	/**
@@ -1433,12 +1433,12 @@  discard block
 block discarded – undo
1433 1433
 	 * @param  array $args Field config array.
1434 1434
 	 * @return array        Modified field config array.
1435 1435
 	 */
1436
-	protected function set_field_defaults_group( $args ) {
1437
-		$args['options'] = wp_parse_args( $args['options'], array(
1438
-			'add_button'     => esc_html__( 'Add Group', 'cmb2' ),
1439
-			'remove_button'  => esc_html__( 'Remove Group', 'cmb2' ),
1436
+	protected function set_field_defaults_group($args) {
1437
+		$args['options'] = wp_parse_args($args['options'], array(
1438
+			'add_button'     => esc_html__('Add Group', 'cmb2'),
1439
+			'remove_button'  => esc_html__('Remove Group', 'cmb2'),
1440 1440
 			'remove_confirm' => '',
1441
-		) );
1441
+		));
1442 1442
 
1443 1443
 		return $args;
1444 1444
 	}
@@ -1451,8 +1451,8 @@  discard block
 block discarded – undo
1451 1451
 	 * @param  array $args Field config array.
1452 1452
 	 * @return array        Modified field config array.
1453 1453
 	 */
1454
-	protected function set_field_defaults_wysiwyg( $args ) {
1455
-		$args['id'] = strtolower( str_ireplace( '-', '_', $args['id'] ) );
1454
+	protected function set_field_defaults_wysiwyg($args) {
1455
+		$args['id'] = strtolower(str_ireplace('-', '_', $args['id']));
1456 1456
 		$args['options']['textarea_name'] = $args['_name'];
1457 1457
 
1458 1458
 		return $args;
@@ -1466,13 +1466,13 @@  discard block
 block discarded – undo
1466 1466
 	 * @param  array $args Field config array.
1467 1467
 	 * @return array        Modified field config array.
1468 1468
 	 */
1469
-	protected function set_field_defaults_all_or_nothing_types( $args ) {
1470
-		$args['show_option_none'] = isset( $args['show_option_none'] ) ? $args['show_option_none'] : null;
1471
-		$args['show_option_none'] = true === $args['show_option_none'] ? esc_html__( 'None', 'cmb2' ) : $args['show_option_none'];
1469
+	protected function set_field_defaults_all_or_nothing_types($args) {
1470
+		$args['show_option_none'] = isset($args['show_option_none']) ? $args['show_option_none'] : null;
1471
+		$args['show_option_none'] = true === $args['show_option_none'] ? esc_html__('None', 'cmb2') : $args['show_option_none'];
1472 1472
 
1473
-		if ( null === $args['show_option_none'] ) {
1474
-			$off_by_default = in_array( $args['type'], array( 'select', 'radio', 'radio_inline' ), true );
1475
-			$args['show_option_none'] = $off_by_default ? false : esc_html__( 'None', 'cmb2' );
1473
+		if (null === $args['show_option_none']) {
1474
+			$off_by_default = in_array($args['type'], array('select', 'radio', 'radio_inline'), true);
1475
+			$args['show_option_none'] = $off_by_default ? false : esc_html__('None', 'cmb2');
1476 1476
 		}
1477 1477
 
1478 1478
 		return $args;
@@ -1486,9 +1486,9 @@  discard block
 block discarded – undo
1486 1486
 	 * @param  array $args Field config array.
1487 1487
 	 * @return array        Modified field config array.
1488 1488
 	 */
1489
-	protected function set_group_sub_field_defaults( $args ) {
1490
-		$args['id']    = $this->group->args( 'id' ) . '_' . $this->group->index . '_' . $args['id'];
1491
-		$args['_name'] = $this->group->args( 'id' ) . '[' . $this->group->index . '][' . $args['_name'] . ']';
1489
+	protected function set_group_sub_field_defaults($args) {
1490
+		$args['id']    = $this->group->args('id') . '_' . $this->group->index . '_' . $args['id'];
1491
+		$args['_name'] = $this->group->args('id') . '[' . $this->group->index . '][' . $args['_name'] . ']';
1492 1492
 
1493 1493
 		return $args;
1494 1494
 	}
@@ -1501,8 +1501,8 @@  discard block
 block discarded – undo
1501 1501
 	 * @param  array $args Field config array.
1502 1502
 	 * @return array        Field defaults.
1503 1503
 	 */
1504
-	protected function get_default_field_args( $args ) {
1505
-		$type = isset( $args['type'] ) ? $args['type'] : '';
1504
+	protected function get_default_field_args($args) {
1505
+		$type = isset($args['type']) ? $args['type'] : '';
1506 1506
 
1507 1507
 		return array(
1508 1508
 			'type'              => $type,
@@ -1529,11 +1529,11 @@  discard block
 block discarded – undo
1529 1529
 			'save_field'        => true, // Will not save if false.
1530 1530
 			'date_format'       => 'm\/d\/Y',
1531 1531
 			'time_format'       => 'h:i A',
1532
-			'description'       => isset( $args['desc'] ) ? $args['desc'] : '',
1533
-			'preview_size'      => 'file' === $type ? array( 350, 350 ) : array( 50, 50 ),
1534
-			'render_row_cb'     => array( $this, 'render_field_callback' ),
1535
-			'display_cb'        => array( $this, 'display_value_callback' ),
1536
-			'label_cb'          => 'title' !== $type ? array( $this, 'label' ) : '',
1532
+			'description'       => isset($args['desc']) ? $args['desc'] : '',
1533
+			'preview_size'      => 'file' === $type ? array(350, 350) : array(50, 50),
1534
+			'render_row_cb'     => array($this, 'render_field_callback'),
1535
+			'display_cb'        => array($this, 'display_value_callback'),
1536
+			'label_cb'          => 'title' !== $type ? array($this, 'label') : '',
1537 1537
 			'column'            => false,
1538 1538
 			'js_dependencies'   => array(),
1539 1539
 			'show_in_rest'      => null,
@@ -1551,13 +1551,13 @@  discard block
 block discarded – undo
1551 1551
 	 * @param  CMB2_Field $field_group (optional) CMB2_Field object (group parent).
1552 1552
 	 * @return array                   Array of field arguments.
1553 1553
 	 */
1554
-	protected function get_default_args( $field_args, $field_group = null ) {
1555
-		$args = parent::get_default_args( array(), $this->group );
1554
+	protected function get_default_args($field_args, $field_group = null) {
1555
+		$args = parent::get_default_args(array(), $this->group);
1556 1556
 
1557
-		if ( isset( $field_args['field_args'] ) ) {
1558
-			$args = wp_parse_args( $field_args, $args );
1557
+		if (isset($field_args['field_args'])) {
1558
+			$args = wp_parse_args($field_args, $args);
1559 1559
 		} else {
1560
-			$args['field_args'] = wp_parse_args( $field_args, $this->args );
1560
+			$args['field_args'] = wp_parse_args($field_args, $this->args);
1561 1561
 		}
1562 1562
 
1563 1563
 		return $args;
@@ -1573,8 +1573,8 @@  discard block
 block discarded – undo
1573 1573
 	 *
1574 1574
 	 * @return CMB2_Field         The new CMB2_Field instance.
1575 1575
 	 */
1576
-	public function get_field_clone( $field_args ) {
1577
-		return $this->get_new_field( $field_args );
1576
+	public function get_field_clone($field_args) {
1577
+		return $this->get_new_field($field_args);
1578 1578
 	}
1579 1579
 
1580 1580
 	/**
@@ -1585,11 +1585,11 @@  discard block
 block discarded – undo
1585 1585
 	 * @return CMB2|WP_Error If new CMB2_Field is called without cmb_id arg, returns error.
1586 1586
 	 */
1587 1587
 	public function get_cmb() {
1588
-		if ( ! $this->cmb_id ) {
1589
-			return new WP_Error( 'no_cmb_id', esc_html__( 'Sorry, this field does not have a cmb_id specified.', 'cmb2' ) );
1588
+		if ( ! $this->cmb_id) {
1589
+			return new WP_Error('no_cmb_id', esc_html__('Sorry, this field does not have a cmb_id specified.', 'cmb2'));
1590 1590
 		}
1591 1591
 
1592
-		return cmb2_get_metabox( $this->cmb_id, $this->object_id, $this->object_type );
1592
+		return cmb2_get_metabox($this->cmb_id, $this->object_id, $this->object_type);
1593 1593
 	}
1594 1594
 
1595 1595
 	/**
@@ -1599,16 +1599,16 @@  discard block
 block discarded – undo
1599 1599
 	 * @param  array $args Metabox field config array.
1600 1600
 	 * @return array       Modified field config array.
1601 1601
 	 */
1602
-	protected function convert_deprecated_params( $args ) {
1602
+	protected function convert_deprecated_params($args) {
1603 1603
 
1604
-		if ( isset( $args['row_classes'] ) ) {
1604
+		if (isset($args['row_classes'])) {
1605 1605
 
1606 1606
 			// We'll let this one be.
1607 1607
 			// $this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_PARAM, 'row_classes', 'classes' );
1608 1608
 			// row_classes param could be a callback. This is definitely deprecated.
1609
-			if ( is_callable( $args['row_classes'] ) ) {
1609
+			if (is_callable($args['row_classes'])) {
1610 1610
 
1611
-				$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'row_classes', 'classes_cb' );
1611
+				$this->deprecated_param(__CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'row_classes', 'classes_cb');
1612 1612
 
1613 1613
 				$args['classes_cb'] = $args['row_classes'];
1614 1614
 				$args['classes'] = null;
@@ -1617,22 +1617,22 @@  discard block
 block discarded – undo
1617 1617
 				$args['classes'] = $args['row_classes'];
1618 1618
 			}
1619 1619
 
1620
-			unset( $args['row_classes'] );
1620
+			unset($args['row_classes']);
1621 1621
 		}
1622 1622
 
1623 1623
 		// default param can be passed a callback as well.
1624
-		if ( is_callable( $args['default'] ) ) {
1624
+		if (is_callable($args['default'])) {
1625 1625
 
1626
-			$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'default', 'default_cb' );
1626
+			$this->deprecated_param(__CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'default', 'default_cb');
1627 1627
 
1628 1628
 			$args['default_cb'] = $args['default'];
1629 1629
 			$args['default'] = null;
1630 1630
 		}
1631 1631
 
1632 1632
 		// options param can be passed a callback as well.
1633
-		if ( is_callable( $args['options'] ) ) {
1633
+		if (is_callable($args['options'])) {
1634 1634
 
1635
-			$this->deprecated_param( __CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'options', 'options_cb' );
1635
+			$this->deprecated_param(__CLASS__ . '::__construct()', '2.2.3', self::DEPRECATED_CB_PARAM, 'options', 'options_cb');
1636 1636
 
1637 1637
 			$args['options_cb'] = $args['options'];
1638 1638
 			$args['options'] = array();
Please login to merge, or discard this patch.
vendor/CMB2/includes/CMB2_Hookup_Base.php 1 patch
Spacing   +15 added lines, -15 removed lines patch added patch discarded remove patch
@@ -40,8 +40,8 @@  discard block
 block discarded – undo
40 40
 	 *
41 41
 	 * @param  CMB2 $cmb The CMB2 object to hookup.
42 42
 	 */
43
-	public static function maybe_init_and_hookup( CMB2 $cmb ) {
44
-		throw new Exception( sprintf( esc_html__( '%1$s should be implemented by the extended class.', 'cmb2' ), __FUNCTION__ ) );
43
+	public static function maybe_init_and_hookup(CMB2 $cmb) {
44
+		throw new Exception(sprintf(esc_html__('%1$s should be implemented by the extended class.', 'cmb2'), __FUNCTION__));
45 45
 	}
46 46
 
47 47
 	/**
@@ -50,7 +50,7 @@  discard block
 block discarded – undo
50 50
 	 * @since 2.0.0
51 51
 	 * @param CMB2 $cmb The CMB2 object to hookup.
52 52
 	 */
53
-	public function __construct( CMB2 $cmb ) {
53
+	public function __construct(CMB2 $cmb) {
54 54
 		$this->cmb = $cmb;
55 55
 		$this->object_type = $this->cmb->mb_object_type();
56 56
 	}
@@ -66,23 +66,23 @@  discard block
 block discarded – undo
66 66
 	 * @param integer  $priority      Order the functions are executed.
67 67
 	 * @param int      $accepted_args The number of arguments the function accepts.
68 68
 	 */
69
-	public function once( $action, $hook, $priority = 10, $accepted_args = 1 ) {
69
+	public function once($action, $hook, $priority = 10, $accepted_args = 1) {
70 70
 		static $hooks_completed = array();
71 71
 
72 72
 		$args = func_get_args();
73 73
 
74 74
 		// Get object hash.. This bypasses issues with serializing closures.
75
-		if ( is_object( $hook ) ) {
76
-			$args[1] = spl_object_hash( $args[1] );
77
-		} elseif ( is_array( $hook ) && is_object( $hook[0] ) ) {
78
-			$args[1][0] = spl_object_hash( $hook[0] );
75
+		if (is_object($hook)) {
76
+			$args[1] = spl_object_hash($args[1]);
77
+		} elseif (is_array($hook) && is_object($hook[0])) {
78
+			$args[1][0] = spl_object_hash($hook[0]);
79 79
 		}
80 80
 
81
-		$key = md5( serialize( $args ) );
81
+		$key = md5(serialize($args));
82 82
 
83
-		if ( ! isset( $hooks_completed[ $key ] ) ) {
84
-			$hooks_completed[ $key ] = 1;
85
-			add_filter( $action, $hook, $priority, $accepted_args );
83
+		if ( ! isset($hooks_completed[$key])) {
84
+			$hooks_completed[$key] = 1;
85
+			add_filter($action, $hook, $priority, $accepted_args);
86 86
 		}
87 87
 	}
88 88
 
@@ -93,13 +93,13 @@  discard block
 block discarded – undo
93 93
 	 * @throws Exception Throws an exception if the field is invalid.
94 94
 	 * @return mixed
95 95
 	 */
96
-	public function __get( $field ) {
97
-		switch ( $field ) {
96
+	public function __get($field) {
97
+		switch ($field) {
98 98
 			case 'object_type':
99 99
 			case 'cmb':
100 100
 				return $this->{$field};
101 101
 			default:
102
-				throw new Exception( sprintf( esc_html__( 'Invalid %1$s property: %2$s', 'cmb2' ), __CLASS__, $field ) );
102
+				throw new Exception(sprintf(esc_html__('Invalid %1$s property: %2$s', 'cmb2'), __CLASS__, $field));
103 103
 		}
104 104
 	}
105 105
 }
Please login to merge, or discard this patch.
vendor/CMB2/includes/shim/WP_REST_Controller.php 1 patch
Spacing   +115 added lines, -115 removed lines patch added patch discarded remove patch
@@ -22,7 +22,7 @@  discard block
 block discarded – undo
22 22
 	 */
23 23
 	public function register_routes() {
24 24
 		/* translators: %s: register_routes() */
25
-		_doing_it_wrong( 'WP_REST_Controller::register_routes', sprintf( __( "Method '%s' must be overridden." ), __METHOD__ ), '4.7' );
25
+		_doing_it_wrong('WP_REST_Controller::register_routes', sprintf(__("Method '%s' must be overridden."), __METHOD__), '4.7');
26 26
 	}
27 27
 
28 28
 	/**
@@ -31,10 +31,10 @@  discard block
 block discarded – undo
31 31
 	 * @param WP_REST_Request $request Full data about the request.
32 32
 	 * @return WP_Error|boolean
33 33
 	 */
34
-	public function get_items_permissions_check( $request ) {
35
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
34
+	public function get_items_permissions_check($request) {
35
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
36 36
 			'status' => 405,
37
-		) );
37
+		));
38 38
 	}
39 39
 
40 40
 	/**
@@ -43,10 +43,10 @@  discard block
 block discarded – undo
43 43
 	 * @param WP_REST_Request $request Full data about the request.
44 44
 	 * @return WP_Error|WP_REST_Response
45 45
 	 */
46
-	public function get_items( $request ) {
47
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
46
+	public function get_items($request) {
47
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
48 48
 			'status' => 405,
49
-		) );
49
+		));
50 50
 	}
51 51
 
52 52
 	/**
@@ -55,10 +55,10 @@  discard block
 block discarded – undo
55 55
 	 * @param WP_REST_Request $request Full data about the request.
56 56
 	 * @return WP_Error|boolean
57 57
 	 */
58
-	public function get_item_permissions_check( $request ) {
59
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
58
+	public function get_item_permissions_check($request) {
59
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
60 60
 			'status' => 405,
61
-		) );
61
+		));
62 62
 	}
63 63
 
64 64
 	/**
@@ -67,10 +67,10 @@  discard block
 block discarded – undo
67 67
 	 * @param WP_REST_Request $request Full data about the request.
68 68
 	 * @return WP_Error|WP_REST_Response
69 69
 	 */
70
-	public function get_item( $request ) {
71
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
70
+	public function get_item($request) {
71
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
72 72
 			'status' => 405,
73
-		) );
73
+		));
74 74
 	}
75 75
 
76 76
 	/**
@@ -79,10 +79,10 @@  discard block
 block discarded – undo
79 79
 	 * @param WP_REST_Request $request Full data about the request.
80 80
 	 * @return WP_Error|boolean
81 81
 	 */
82
-	public function create_item_permissions_check( $request ) {
83
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
82
+	public function create_item_permissions_check($request) {
83
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
84 84
 			'status' => 405,
85
-		) );
85
+		));
86 86
 	}
87 87
 
88 88
 	/**
@@ -91,10 +91,10 @@  discard block
 block discarded – undo
91 91
 	 * @param WP_REST_Request $request Full data about the request.
92 92
 	 * @return WP_Error|WP_REST_Response
93 93
 	 */
94
-	public function create_item( $request ) {
95
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
94
+	public function create_item($request) {
95
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
96 96
 			'status' => 405,
97
-		) );
97
+		));
98 98
 	}
99 99
 
100 100
 	/**
@@ -103,10 +103,10 @@  discard block
 block discarded – undo
103 103
 	 * @param WP_REST_Request $request Full data about the request.
104 104
 	 * @return WP_Error|boolean
105 105
 	 */
106
-	public function update_item_permissions_check( $request ) {
107
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
106
+	public function update_item_permissions_check($request) {
107
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
108 108
 			'status' => 405,
109
-		) );
109
+		));
110 110
 	}
111 111
 
112 112
 	/**
@@ -115,10 +115,10 @@  discard block
 block discarded – undo
115 115
 	 * @param WP_REST_Request $request Full data about the request.
116 116
 	 * @return WP_Error|WP_REST_Response
117 117
 	 */
118
-	public function update_item( $request ) {
119
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
118
+	public function update_item($request) {
119
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
120 120
 			'status' => 405,
121
-		) );
121
+		));
122 122
 	}
123 123
 
124 124
 	/**
@@ -127,10 +127,10 @@  discard block
 block discarded – undo
127 127
 	 * @param WP_REST_Request $request Full data about the request.
128 128
 	 * @return WP_Error|boolean
129 129
 	 */
130
-	public function delete_item_permissions_check( $request ) {
131
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
130
+	public function delete_item_permissions_check($request) {
131
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
132 132
 			'status' => 405,
133
-		) );
133
+		));
134 134
 	}
135 135
 
136 136
 	/**
@@ -139,10 +139,10 @@  discard block
 block discarded – undo
139 139
 	 * @param WP_REST_Request $request Full data about the request.
140 140
 	 * @return WP_Error|WP_REST_Response
141 141
 	 */
142
-	public function delete_item( $request ) {
143
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
142
+	public function delete_item($request) {
143
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
144 144
 			'status' => 405,
145
-		) );
145
+		));
146 146
 	}
147 147
 
148 148
 	/**
@@ -151,10 +151,10 @@  discard block
 block discarded – undo
151 151
 	 * @param WP_REST_Request $request Request object.
152 152
 	 * @return WP_Error|object $prepared_item
153 153
 	 */
154
-	protected function prepare_item_for_database( $request ) {
155
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
154
+	protected function prepare_item_for_database($request) {
155
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
156 156
 			'status' => 405,
157
-		) );
157
+		));
158 158
 	}
159 159
 
160 160
 	/**
@@ -164,10 +164,10 @@  discard block
 block discarded – undo
164 164
 	 * @param WP_REST_Request $request Request object.
165 165
 	 * @return WP_REST_Response $response
166 166
 	 */
167
-	public function prepare_item_for_response( $item, $request ) {
168
-		return new WP_Error( 'invalid-method', sprintf( __( "Method '%s' not implemented. Must be overridden in subclass." ), __METHOD__ ), array(
167
+	public function prepare_item_for_response($item, $request) {
168
+		return new WP_Error('invalid-method', sprintf(__("Method '%s' not implemented. Must be overridden in subclass."), __METHOD__), array(
169 169
 			'status' => 405,
170
-		) );
170
+		));
171 171
 	}
172 172
 
173 173
 	/**
@@ -176,21 +176,21 @@  discard block
 block discarded – undo
176 176
 	 * @param WP_REST_Response $response Response object.
177 177
 	 * @return array Response data, ready for insertion into collection data.
178 178
 	 */
179
-	public function prepare_response_for_collection( $response ) {
180
-		if ( ! ( $response instanceof WP_REST_Response ) ) {
179
+	public function prepare_response_for_collection($response) {
180
+		if ( ! ($response instanceof WP_REST_Response)) {
181 181
 			return $response;
182 182
 		}
183 183
 
184 184
 		$data = (array) $response->get_data();
185 185
 		$server = rest_get_server();
186 186
 
187
-		if ( method_exists( $server, 'get_compact_response_links' ) ) {
188
-			$links = call_user_func( array( $server, 'get_compact_response_links' ), $response );
187
+		if (method_exists($server, 'get_compact_response_links')) {
188
+			$links = call_user_func(array($server, 'get_compact_response_links'), $response);
189 189
 		} else {
190
-			$links = call_user_func( array( $server, 'get_response_links' ), $response );
190
+			$links = call_user_func(array($server, 'get_response_links'), $response);
191 191
 		}
192 192
 
193
-		if ( ! empty( $links ) ) {
193
+		if ( ! empty($links)) {
194 194
 			$data['_links'] = $links;
195 195
 		}
196 196
 
@@ -204,27 +204,27 @@  discard block
 block discarded – undo
204 204
 	 * @param string $context
205 205
 	 * @return array
206 206
 	 */
207
-	public function filter_response_by_context( $data, $context ) {
207
+	public function filter_response_by_context($data, $context) {
208 208
 
209 209
 		$schema = $this->get_item_schema();
210
-		foreach ( $data as $key => $value ) {
211
-			if ( empty( $schema['properties'][ $key ] ) || empty( $schema['properties'][ $key ]['context'] ) ) {
210
+		foreach ($data as $key => $value) {
211
+			if (empty($schema['properties'][$key]) || empty($schema['properties'][$key]['context'])) {
212 212
 				continue;
213 213
 			}
214 214
 
215
-			if ( ! in_array( $context, $schema['properties'][ $key ]['context'] ) ) {
216
-				unset( $data[ $key ] );
215
+			if ( ! in_array($context, $schema['properties'][$key]['context'])) {
216
+				unset($data[$key]);
217 217
 				continue;
218 218
 			}
219 219
 
220
-			if ( 'object' === $schema['properties'][ $key ]['type'] && ! empty( $schema['properties'][ $key ]['properties'] ) ) {
221
-				foreach ( $schema['properties'][ $key ]['properties'] as $attribute => $details ) {
222
-					if ( empty( $details['context'] ) ) {
220
+			if ('object' === $schema['properties'][$key]['type'] && ! empty($schema['properties'][$key]['properties'])) {
221
+				foreach ($schema['properties'][$key]['properties'] as $attribute => $details) {
222
+					if (empty($details['context'])) {
223 223
 						continue;
224 224
 					}
225
-					if ( ! in_array( $context, $details['context'] ) ) {
226
-						if ( isset( $data[ $key ][ $attribute ] ) ) {
227
-							unset( $data[ $key ][ $attribute ] );
225
+					if ( ! in_array($context, $details['context'])) {
226
+						if (isset($data[$key][$attribute])) {
227
+							unset($data[$key][$attribute]);
228 228
 						}
229 229
 					}
230 230
 				}
@@ -240,7 +240,7 @@  discard block
 block discarded – undo
240 240
 	 * @return array
241 241
 	 */
242 242
 	public function get_item_schema() {
243
-		return $this->add_additional_fields_schema( array() );
243
+		return $this->add_additional_fields_schema(array());
244 244
 	}
245 245
 
246 246
 	/**
@@ -252,9 +252,9 @@  discard block
 block discarded – undo
252 252
 
253 253
 		$schema = $this->get_item_schema();
254 254
 
255
-		foreach ( $schema['properties'] as &$property ) {
256
-			if ( isset( $property['arg_options'] ) ) {
257
-				unset( $property['arg_options'] );
255
+		foreach ($schema['properties'] as &$property) {
256
+			if (isset($property['arg_options'])) {
257
+				unset($property['arg_options']);
258 258
 			}
259 259
 		}
260 260
 
@@ -270,7 +270,7 @@  discard block
 block discarded – undo
270 270
 		return array(
271 271
 			'context'                => $this->get_context_param(),
272 272
 			'page'                   => array(
273
-				'description'        => __( 'Current page of the collection.' ),
273
+				'description'        => __('Current page of the collection.'),
274 274
 				'type'               => 'integer',
275 275
 				'default'            => 1,
276 276
 				'sanitize_callback'  => 'absint',
@@ -278,7 +278,7 @@  discard block
 block discarded – undo
278 278
 				'minimum'            => 1,
279 279
 			),
280 280
 			'per_page'               => array(
281
-				'description'        => __( 'Maximum number of items to be returned in result set.' ),
281
+				'description'        => __('Maximum number of items to be returned in result set.'),
282 282
 				'type'               => 'integer',
283 283
 				'default'            => 10,
284 284
 				'minimum'            => 1,
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 				'validate_callback'  => 'rest_validate_request_arg',
288 288
 			),
289 289
 			'search'                 => array(
290
-				'description'        => __( 'Limit results to those matching a string.' ),
290
+				'description'        => __('Limit results to those matching a string.'),
291 291
 				'type'               => 'string',
292 292
 				'sanitize_callback'  => 'sanitize_text_field',
293 293
 				'validate_callback'  => 'rest_validate_request_arg',
@@ -303,28 +303,28 @@  discard block
 block discarded – undo
303 303
 	 * @param array $args
304 304
 	 * @return array
305 305
 	 */
306
-	public function get_context_param( $args = array() ) {
306
+	public function get_context_param($args = array()) {
307 307
 		$param_details = array(
308
-			'description'        => __( 'Scope under which the request is made; determines fields present in response.' ),
308
+			'description'        => __('Scope under which the request is made; determines fields present in response.'),
309 309
 			'type'               => 'string',
310 310
 			'sanitize_callback'  => 'sanitize_key',
311 311
 			'validate_callback'  => 'rest_validate_request_arg',
312 312
 		);
313 313
 		$schema = $this->get_item_schema();
314
-		if ( empty( $schema['properties'] ) ) {
315
-			return array_merge( $param_details, $args );
314
+		if (empty($schema['properties'])) {
315
+			return array_merge($param_details, $args);
316 316
 		}
317 317
 		$contexts = array();
318
-		foreach ( $schema['properties'] as $attributes ) {
319
-			if ( ! empty( $attributes['context'] ) ) {
320
-				$contexts = array_merge( $contexts, $attributes['context'] );
318
+		foreach ($schema['properties'] as $attributes) {
319
+			if ( ! empty($attributes['context'])) {
320
+				$contexts = array_merge($contexts, $attributes['context']);
321 321
 			}
322 322
 		}
323
-		if ( ! empty( $contexts ) ) {
324
-			$param_details['enum'] = array_unique( $contexts );
325
-			rsort( $param_details['enum'] );
323
+		if ( ! empty($contexts)) {
324
+			$param_details['enum'] = array_unique($contexts);
325
+			rsort($param_details['enum']);
326 326
 		}
327
-		return array_merge( $param_details, $args );
327
+		return array_merge($param_details, $args);
328 328
 	}
329 329
 
330 330
 	/**
@@ -334,17 +334,17 @@  discard block
 block discarded – undo
334 334
 	 * @param WP_REST_Request $request
335 335
 	 * @return array modified object with additional fields.
336 336
 	 */
337
-	protected function add_additional_fields_to_object( $object, $request ) {
337
+	protected function add_additional_fields_to_object($object, $request) {
338 338
 
339 339
 		$additional_fields = $this->get_additional_fields();
340 340
 
341
-		foreach ( $additional_fields as $field_name => $field_options ) {
341
+		foreach ($additional_fields as $field_name => $field_options) {
342 342
 
343
-			if ( ! $field_options['get_callback'] ) {
343
+			if ( ! $field_options['get_callback']) {
344 344
 				continue;
345 345
 			}
346 346
 
347
-			$object[ $field_name ] = call_user_func( $field_options['get_callback'], $object, $field_name, $request, $this->get_object_type() );
347
+			$object[$field_name] = call_user_func($field_options['get_callback'], $object, $field_name, $request, $this->get_object_type());
348 348
 		}
349 349
 
350 350
 		return $object;
@@ -356,22 +356,22 @@  discard block
 block discarded – undo
356 356
 	 * @param array           $object
357 357
 	 * @param WP_REST_Request $request
358 358
 	 */
359
-	protected function update_additional_fields_for_object( $object, $request ) {
359
+	protected function update_additional_fields_for_object($object, $request) {
360 360
 
361 361
 		$additional_fields = $this->get_additional_fields();
362 362
 
363
-		foreach ( $additional_fields as $field_name => $field_options ) {
363
+		foreach ($additional_fields as $field_name => $field_options) {
364 364
 
365
-			if ( ! $field_options['update_callback'] ) {
365
+			if ( ! $field_options['update_callback']) {
366 366
 				continue;
367 367
 			}
368 368
 
369 369
 			// Don't run the update callbacks if the data wasn't passed in the request.
370
-			if ( ! isset( $request[ $field_name ] ) ) {
370
+			if ( ! isset($request[$field_name])) {
371 371
 				continue;
372 372
 			}
373 373
 
374
-			call_user_func( $field_options['update_callback'], $request[ $field_name ], $object, $field_name, $request, $this->get_object_type() );
374
+			call_user_func($field_options['update_callback'], $request[$field_name], $object, $field_name, $request, $this->get_object_type());
375 375
 		}
376 376
 	}
377 377
 
@@ -382,8 +382,8 @@  discard block
 block discarded – undo
382 382
 	 *
383 383
 	 * @param array $schema Schema array.
384 384
 	 */
385
-	protected function add_additional_fields_schema( $schema ) {
386
-		if ( empty( $schema['title'] ) ) {
385
+	protected function add_additional_fields_schema($schema) {
386
+		if (empty($schema['title'])) {
387 387
 			return $schema;
388 388
 		}
389 389
 
@@ -392,14 +392,14 @@  discard block
 block discarded – undo
392 392
 		 */
393 393
 		$object_type = $schema['title'];
394 394
 
395
-		$additional_fields = $this->get_additional_fields( $object_type );
395
+		$additional_fields = $this->get_additional_fields($object_type);
396 396
 
397
-		foreach ( $additional_fields as $field_name => $field_options ) {
398
-			if ( ! $field_options['schema'] ) {
397
+		foreach ($additional_fields as $field_name => $field_options) {
398
+			if ( ! $field_options['schema']) {
399 399
 				continue;
400 400
 			}
401 401
 
402
-			$schema['properties'][ $field_name ] = $field_options['schema'];
402
+			$schema['properties'][$field_name] = $field_options['schema'];
403 403
 		}
404 404
 
405 405
 		return $schema;
@@ -411,23 +411,23 @@  discard block
 block discarded – undo
411 411
 	 * @param  string $object_type
412 412
 	 * @return array
413 413
 	 */
414
-	protected function get_additional_fields( $object_type = null ) {
414
+	protected function get_additional_fields($object_type = null) {
415 415
 
416
-		if ( ! $object_type ) {
416
+		if ( ! $object_type) {
417 417
 			$object_type = $this->get_object_type();
418 418
 		}
419 419
 
420
-		if ( ! $object_type ) {
420
+		if ( ! $object_type) {
421 421
 			return array();
422 422
 		}
423 423
 
424 424
 		global $wp_rest_additional_fields;
425 425
 
426
-		if ( ! $wp_rest_additional_fields || ! isset( $wp_rest_additional_fields[ $object_type ] ) ) {
426
+		if ( ! $wp_rest_additional_fields || ! isset($wp_rest_additional_fields[$object_type])) {
427 427
 			return array();
428 428
 		}
429 429
 
430
-		return $wp_rest_additional_fields[ $object_type ];
430
+		return $wp_rest_additional_fields[$object_type];
431 431
 	}
432 432
 
433 433
 	/**
@@ -438,7 +438,7 @@  discard block
 block discarded – undo
438 438
 	protected function get_object_type() {
439 439
 		$schema = $this->get_item_schema();
440 440
 
441
-		if ( ! $schema || ! isset( $schema['title'] ) ) {
441
+		if ( ! $schema || ! isset($schema['title'])) {
442 442
 			return null;
443 443
 		}
444 444
 
@@ -455,54 +455,54 @@  discard block
 block discarded – undo
455 455
 	 *                       WP_REST_Server::CREATABLE.
456 456
 	 * @return array $endpoint_args
457 457
 	 */
458
-	public function get_endpoint_args_for_item_schema( $method = WP_REST_Server::CREATABLE ) {
458
+	public function get_endpoint_args_for_item_schema($method = WP_REST_Server::CREATABLE) {
459 459
 
460 460
 		$schema                = $this->get_item_schema();
461
-		$schema_properties     = ! empty( $schema['properties'] ) ? $schema['properties'] : array();
461
+		$schema_properties     = ! empty($schema['properties']) ? $schema['properties'] : array();
462 462
 		$endpoint_args = array();
463 463
 
464
-		foreach ( $schema_properties as $field_id => $params ) {
464
+		foreach ($schema_properties as $field_id => $params) {
465 465
 
466 466
 			// Arguments specified as `readonly` are not allowed to be set.
467
-			if ( ! empty( $params['readonly'] ) ) {
467
+			if ( ! empty($params['readonly'])) {
468 468
 				continue;
469 469
 			}
470 470
 
471
-			$endpoint_args[ $field_id ] = array(
471
+			$endpoint_args[$field_id] = array(
472 472
 				'validate_callback' => 'rest_validate_request_arg',
473 473
 				'sanitize_callback' => 'rest_sanitize_request_arg',
474 474
 			);
475 475
 
476
-			if ( isset( $params['description'] ) ) {
477
-				$endpoint_args[ $field_id ]['description'] = $params['description'];
476
+			if (isset($params['description'])) {
477
+				$endpoint_args[$field_id]['description'] = $params['description'];
478 478
 			}
479 479
 
480
-			if ( WP_REST_Server::CREATABLE === $method && isset( $params['default'] ) ) {
481
-				$endpoint_args[ $field_id ]['default'] = $params['default'];
480
+			if (WP_REST_Server::CREATABLE === $method && isset($params['default'])) {
481
+				$endpoint_args[$field_id]['default'] = $params['default'];
482 482
 			}
483 483
 
484
-			if ( WP_REST_Server::CREATABLE === $method && ! empty( $params['required'] ) ) {
485
-				$endpoint_args[ $field_id ]['required'] = true;
484
+			if (WP_REST_Server::CREATABLE === $method && ! empty($params['required'])) {
485
+				$endpoint_args[$field_id]['required'] = true;
486 486
 			}
487 487
 
488
-			foreach ( array( 'type', 'format', 'enum' ) as $schema_prop ) {
489
-				if ( isset( $params[ $schema_prop ] ) ) {
490
-					$endpoint_args[ $field_id ][ $schema_prop ] = $params[ $schema_prop ];
488
+			foreach (array('type', 'format', 'enum') as $schema_prop) {
489
+				if (isset($params[$schema_prop])) {
490
+					$endpoint_args[$field_id][$schema_prop] = $params[$schema_prop];
491 491
 				}
492 492
 			}
493 493
 
494 494
 			// Merge in any options provided by the schema property.
495
-			if ( isset( $params['arg_options'] ) ) {
495
+			if (isset($params['arg_options'])) {
496 496
 
497 497
 				// Only use required / default from arg_options on CREATABLE endpoints.
498
-				if ( WP_REST_Server::CREATABLE !== $method ) {
499
-					$params['arg_options'] = array_diff_key( $params['arg_options'], array(
498
+				if (WP_REST_Server::CREATABLE !== $method) {
499
+					$params['arg_options'] = array_diff_key($params['arg_options'], array(
500 500
 						'required' => '',
501 501
 						'default' => '',
502
-					) );
502
+					));
503 503
 				}
504 504
 
505
-				$endpoint_args[ $field_id ] = array_merge( $endpoint_args[ $field_id ], $params['arg_options'] );
505
+				$endpoint_args[$field_id] = array_merge($endpoint_args[$field_id], $params['arg_options']);
506 506
 			}
507 507
 		}// End foreach().
508 508
 
@@ -523,8 +523,8 @@  discard block
 block discarded – undo
523 523
 	 * @param int|WP_Post $post Post ID or post object. Defaults to global $post.
524 524
 	 * @return WP_Post|null A `WP_Post` object when successful.
525 525
 	 */
526
-	public function get_post( $post ) {
527
-		$post_obj = get_post( $post );
526
+	public function get_post($post) {
527
+		$post_obj = get_post($post);
528 528
 
529 529
 		/**
530 530
 		 * Filter the post.
@@ -534,7 +534,7 @@  discard block
 block discarded – undo
534 534
 		 * @param WP_Post|null $post_obj  The post object as returned by `get_post()`.
535 535
 		 * @param int|WP_Post  $post      The original value used to obtain the post object.
536 536
 		 */
537
-		$post = apply_filters( 'rest_the_post', $post_obj, $post );
537
+		$post = apply_filters('rest_the_post', $post_obj, $post);
538 538
 
539 539
 		return $post;
540 540
 	}
Please login to merge, or discard this patch.
vendor/CMB2/includes/CMB2_Hookup.php 1 patch
Spacing   +216 added lines, -216 removed lines patch added patch discarded remove patch
@@ -62,10 +62,10 @@  discard block
 block discarded – undo
62 62
 	 *
63 63
 	 * @return CMB2_Hookup_Base $hookup The hookup object.
64 64
 	 */
65
-	public static function maybe_init_and_hookup( CMB2 $cmb ) {
66
-		if ( $cmb->prop( 'hookup' ) ) {
65
+	public static function maybe_init_and_hookup(CMB2 $cmb) {
66
+		if ($cmb->prop('hookup')) {
67 67
 
68
-			$hookup = new self( $cmb );
68
+			$hookup = new self($cmb);
69 69
 
70 70
 			// Hook in the hookup... how meta.
71 71
 			return $hookup->universal_hooks();
@@ -75,18 +75,18 @@  discard block
 block discarded – undo
75 75
 	}
76 76
 
77 77
 	public function universal_hooks() {
78
-		foreach ( get_class_methods( 'CMB2_Show_Filters' ) as $filter ) {
79
-			add_filter( 'cmb2_show_on', array( 'CMB2_Show_Filters', $filter ), 10, 3 );
78
+		foreach (get_class_methods('CMB2_Show_Filters') as $filter) {
79
+			add_filter('cmb2_show_on', array('CMB2_Show_Filters', $filter), 10, 3);
80 80
 		}
81 81
 
82
-		if ( is_admin() ) {
82
+		if (is_admin()) {
83 83
 			// Register our scripts and styles for cmb.
84
-			$this->once( 'admin_enqueue_scripts', array( __CLASS__, 'register_scripts' ), 8 );
85
-			$this->once( 'admin_enqueue_scripts', array( $this, 'do_scripts' ) );
84
+			$this->once('admin_enqueue_scripts', array(__CLASS__, 'register_scripts'), 8);
85
+			$this->once('admin_enqueue_scripts', array($this, 'do_scripts'));
86 86
 
87 87
 			$this->maybe_enqueue_column_display_styles();
88 88
 
89
-			switch ( $this->object_type ) {
89
+			switch ($this->object_type) {
90 90
 				case 'post':
91 91
 					return $this->post_hooks();
92 92
 				case 'comment':
@@ -106,42 +106,42 @@  discard block
 block discarded – undo
106 106
 	public function post_hooks() {
107 107
 
108 108
 		// Fetch the context we set in our call.
109
-		$context = $this->cmb->prop( 'context' ) ? $this->cmb->prop( 'context' ) : 'normal';
109
+		$context = $this->cmb->prop('context') ? $this->cmb->prop('context') : 'normal';
110 110
 
111 111
 		// Call the proper hook based on the context provided.
112
-		switch ( $context ) {
112
+		switch ($context) {
113 113
 
114 114
 			case 'form_top':
115
-				add_action( 'edit_form_top', array( $this, 'add_context_metaboxes' ) );
115
+				add_action('edit_form_top', array($this, 'add_context_metaboxes'));
116 116
 				break;
117 117
 
118 118
 			case 'before_permalink':
119
-				add_action( 'edit_form_before_permalink', array( $this, 'add_context_metaboxes' ) );
119
+				add_action('edit_form_before_permalink', array($this, 'add_context_metaboxes'));
120 120
 				break;
121 121
 
122 122
 			case 'after_title':
123
-				add_action( 'edit_form_after_title', array( $this, 'add_context_metaboxes' ) );
123
+				add_action('edit_form_after_title', array($this, 'add_context_metaboxes'));
124 124
 				break;
125 125
 
126 126
 			case 'after_editor':
127
-				add_action( 'edit_form_after_editor', array( $this, 'add_context_metaboxes' ) );
127
+				add_action('edit_form_after_editor', array($this, 'add_context_metaboxes'));
128 128
 				break;
129 129
 
130 130
 			default:
131
-				add_action( 'add_meta_boxes', array( $this, 'add_metaboxes' ) );
131
+				add_action('add_meta_boxes', array($this, 'add_metaboxes'));
132 132
 		}
133 133
 
134
-		add_action( 'add_meta_boxes', array( $this, 'remove_default_tax_metaboxes' ) );
135
-		add_action( 'add_attachment', array( $this, 'save_post' ) );
136
-		add_action( 'edit_attachment', array( $this, 'save_post' ) );
137
-		add_action( 'save_post', array( $this, 'save_post' ), 10, 2 );
134
+		add_action('add_meta_boxes', array($this, 'remove_default_tax_metaboxes'));
135
+		add_action('add_attachment', array($this, 'save_post'));
136
+		add_action('edit_attachment', array($this, 'save_post'));
137
+		add_action('save_post', array($this, 'save_post'), 10, 2);
138 138
 
139
-		if ( $this->cmb->has_columns ) {
140
-			foreach ( $this->cmb->box_types() as $post_type ) {
141
-				add_filter( "manage_{$post_type}_posts_columns", array( $this, 'register_column_headers' ) );
142
-				add_action( "manage_{$post_type}_posts_custom_column", array( $this, 'column_display' ), 10, 2 );
143
-				add_filter( "manage_edit-{$post_type}_sortable_columns", array( $this, 'columns_sortable' ) );
144
-				add_action( 'pre_get_posts', array( $this, 'columns_sortable_orderby' ) );
139
+		if ($this->cmb->has_columns) {
140
+			foreach ($this->cmb->box_types() as $post_type) {
141
+				add_filter("manage_{$post_type}_posts_columns", array($this, 'register_column_headers'));
142
+				add_action("manage_{$post_type}_posts_custom_column", array($this, 'column_display'), 10, 2);
143
+				add_filter("manage_edit-{$post_type}_sortable_columns", array($this, 'columns_sortable'));
144
+				add_action('pre_get_posts', array($this, 'columns_sortable_orderby'));
145 145
 			}
146 146
 		}
147 147
 
@@ -149,14 +149,14 @@  discard block
 block discarded – undo
149 149
 	}
150 150
 
151 151
 	public function comment_hooks() {
152
-		add_action( 'add_meta_boxes_comment', array( $this, 'add_metaboxes' ) );
153
-		add_action( 'edit_comment', array( $this, 'save_comment' ) );
152
+		add_action('add_meta_boxes_comment', array($this, 'add_metaboxes'));
153
+		add_action('edit_comment', array($this, 'save_comment'));
154 154
 
155
-		if ( $this->cmb->has_columns ) {
156
-			add_filter( 'manage_edit-comments_columns', array( $this, 'register_column_headers' ) );
157
-			add_action( 'manage_comments_custom_column', array( $this, 'column_display' ), 10, 3 );
158
-			add_filter( "manage_edit-comments_sortable_columns", array( $this, 'columns_sortable' ) );
159
-			add_action( 'pre_get_posts', array( $this, 'columns_sortable_orderby' ) );
155
+		if ($this->cmb->has_columns) {
156
+			add_filter('manage_edit-comments_columns', array($this, 'register_column_headers'));
157
+			add_action('manage_comments_custom_column', array($this, 'column_display'), 10, 3);
158
+			add_filter("manage_edit-comments_sortable_columns", array($this, 'columns_sortable'));
159
+			add_action('pre_get_posts', array($this, 'columns_sortable_orderby'));
160 160
 		}
161 161
 
162 162
 		return $this;
@@ -165,43 +165,43 @@  discard block
 block discarded – undo
165 165
 	public function user_hooks() {
166 166
 		$priority = $this->get_priority();
167 167
 
168
-		add_action( 'show_user_profile', array( $this, 'user_metabox' ), $priority );
169
-		add_action( 'edit_user_profile', array( $this, 'user_metabox' ), $priority );
170
-		add_action( 'user_new_form', array( $this, 'user_new_metabox' ), $priority );
168
+		add_action('show_user_profile', array($this, 'user_metabox'), $priority);
169
+		add_action('edit_user_profile', array($this, 'user_metabox'), $priority);
170
+		add_action('user_new_form', array($this, 'user_new_metabox'), $priority);
171 171
 
172
-		add_action( 'personal_options_update', array( $this, 'save_user' ) );
173
-		add_action( 'edit_user_profile_update', array( $this, 'save_user' ) );
174
-		add_action( 'user_register', array( $this, 'save_user' ) );
172
+		add_action('personal_options_update', array($this, 'save_user'));
173
+		add_action('edit_user_profile_update', array($this, 'save_user'));
174
+		add_action('user_register', array($this, 'save_user'));
175 175
 
176
-		if ( $this->cmb->has_columns ) {
177
-			add_filter( 'manage_users_columns', array( $this, 'register_column_headers' ) );
178
-			add_filter( 'manage_users_custom_column', array( $this, 'return_column_display' ), 10, 3 );
179
-			add_filter( "manage_users_sortable_columns", array( $this, 'columns_sortable' ) );
180
-			add_action( 'pre_get_posts', array( $this, 'columns_sortable_orderby' ) );
176
+		if ($this->cmb->has_columns) {
177
+			add_filter('manage_users_columns', array($this, 'register_column_headers'));
178
+			add_filter('manage_users_custom_column', array($this, 'return_column_display'), 10, 3);
179
+			add_filter("manage_users_sortable_columns", array($this, 'columns_sortable'));
180
+			add_action('pre_get_posts', array($this, 'columns_sortable_orderby'));
181 181
 		}
182 182
 
183 183
 		return $this;
184 184
 	}
185 185
 
186 186
 	public function term_hooks() {
187
-		if ( ! function_exists( 'get_term_meta' ) ) {
188
-			wp_die( esc_html__( 'Term Metadata is a WordPress 4.4+ feature. Please upgrade your WordPress install.', 'cmb2' ) );
187
+		if ( ! function_exists('get_term_meta')) {
188
+			wp_die(esc_html__('Term Metadata is a WordPress 4.4+ feature. Please upgrade your WordPress install.', 'cmb2'));
189 189
 		}
190 190
 
191
-		if ( ! $this->cmb->prop( 'taxonomies' ) ) {
192
-			wp_die( esc_html__( 'Term metaboxes configuration requires a "taxonomies" parameter.', 'cmb2' ) );
191
+		if ( ! $this->cmb->prop('taxonomies')) {
192
+			wp_die(esc_html__('Term metaboxes configuration requires a "taxonomies" parameter.', 'cmb2'));
193 193
 		}
194 194
 
195
-		$this->taxonomies = (array) $this->cmb->prop( 'taxonomies' );
196
-		$show_on_term_add = $this->cmb->prop( 'new_term_section' );
197
-		$priority         = $this->get_priority( 8 );
195
+		$this->taxonomies = (array) $this->cmb->prop('taxonomies');
196
+		$show_on_term_add = $this->cmb->prop('new_term_section');
197
+		$priority         = $this->get_priority(8);
198 198
 
199
-		foreach ( $this->taxonomies as $taxonomy ) {
199
+		foreach ($this->taxonomies as $taxonomy) {
200 200
 			// Display our form data.
201
-			add_action( "{$taxonomy}_edit_form", array( $this, 'term_metabox' ), $priority, 2 );
201
+			add_action("{$taxonomy}_edit_form", array($this, 'term_metabox'), $priority, 2);
202 202
 
203
-			$show_on_add = is_array( $show_on_term_add )
204
-				? in_array( $taxonomy, $show_on_term_add )
203
+			$show_on_add = is_array($show_on_term_add)
204
+				? in_array($taxonomy, $show_on_term_add)
205 205
 				: (bool) $show_on_term_add;
206 206
 
207 207
 			/**
@@ -212,24 +212,24 @@  discard block
 block discarded – undo
212 212
 			 * @param bool   $show_on_add Default is the value of the new_term_section cmb parameter.
213 213
 			 * @param object $cmb         The CMB2 instance
214 214
 			 */
215
-			$show_on_add = apply_filters( "cmb2_show_on_term_add_form_{$this->cmb->cmb_id}", $show_on_add, $this->cmb );
215
+			$show_on_add = apply_filters("cmb2_show_on_term_add_form_{$this->cmb->cmb_id}", $show_on_add, $this->cmb);
216 216
 
217 217
 			// Display form in add-new section (unless specified not to).
218
-			if ( $show_on_add ) {
219
-				add_action( "{$taxonomy}_add_form_fields", array( $this, 'term_metabox' ), $priority, 2 );
218
+			if ($show_on_add) {
219
+				add_action("{$taxonomy}_add_form_fields", array($this, 'term_metabox'), $priority, 2);
220 220
 			}
221 221
 
222
-			if ( $this->cmb->has_columns ) {
223
-				add_filter( "manage_edit-{$taxonomy}_columns", array( $this, 'register_column_headers' ) );
224
-				add_filter( "manage_{$taxonomy}_custom_column", array( $this, 'return_column_display' ), 10, 3 );
225
-				add_filter( "manage_edit-{$taxonomy}_sortable_columns", array( $this, 'columns_sortable' ) );
226
-				add_action( 'pre_get_posts', array( $this, 'columns_sortable_orderby' ) );
222
+			if ($this->cmb->has_columns) {
223
+				add_filter("manage_edit-{$taxonomy}_columns", array($this, 'register_column_headers'));
224
+				add_filter("manage_{$taxonomy}_custom_column", array($this, 'return_column_display'), 10, 3);
225
+				add_filter("manage_edit-{$taxonomy}_sortable_columns", array($this, 'columns_sortable'));
226
+				add_action('pre_get_posts', array($this, 'columns_sortable_orderby'));
227 227
 			}
228 228
 		}
229 229
 
230
-		add_action( 'created_term', array( $this, 'save_term' ), 10, 3 );
231
-		add_action( 'edited_terms', array( $this, 'save_term' ), 10, 2 );
232
-		add_action( 'delete_term', array( $this, 'delete_term' ), 10, 3 );
230
+		add_action('created_term', array($this, 'save_term'), 10, 3);
231
+		add_action('edited_terms', array($this, 'save_term'), 10, 2);
232
+		add_action('delete_term', array($this, 'delete_term'), 10, 3);
233 233
 
234 234
 		return $this;
235 235
 	}
@@ -237,10 +237,10 @@  discard block
 block discarded – undo
237 237
 	public function options_page_hooks() {
238 238
 		$option_keys = $this->cmb->options_page_keys();
239 239
 
240
-		if ( ! empty( $option_keys ) ) {
241
-			foreach ( $option_keys as $option_key ) {
242
-				$this->options_hookup[ $option_key ] = new CMB2_Options_Hookup( $this->cmb, $option_key );
243
-				$this->options_hookup[ $option_key ]->hooks();
240
+		if ( ! empty($option_keys)) {
241
+			foreach ($option_keys as $option_key) {
242
+				$this->options_hookup[$option_key] = new CMB2_Options_Hookup($this->cmb, $option_key);
243
+				$this->options_hookup[$option_key]->hooks();
244 244
 			}
245 245
 		}
246 246
 
@@ -253,12 +253,12 @@  discard block
 block discarded – undo
253 253
 	 * @since 2.0.7
254 254
 	 */
255 255
 	protected static function register_styles() {
256
-		if ( self::$css_registration_done ) {
256
+		if (self::$css_registration_done) {
257 257
 			return;
258 258
 		}
259 259
 
260 260
 		// Only use minified files if SCRIPT_DEBUG is off.
261
-		$min   = defined( 'SCRIPT_DEBUG' ) && SCRIPT_DEBUG ? '' : '.min';
261
+		$min   = defined('SCRIPT_DEBUG') && SCRIPT_DEBUG ? '' : '.min';
262 262
 		$front = is_admin() ? '' : '-front';
263 263
 		$rtl   = is_rtl() ? '-rtl' : '';
264 264
 
@@ -267,9 +267,9 @@  discard block
 block discarded – undo
267 267
 		 *
268 268
 		 * @param array $dependencies The registered style dependencies for the cmb2 stylesheet.
269 269
 		 */
270
-		$dependencies = apply_filters( 'cmb2_style_dependencies', array() );
271
-		wp_register_style( 'cmb2-styles', CMB2_Utils::url( "css/cmb2{$front}{$rtl}{$min}.css" ), $dependencies );
272
-		wp_register_style( 'cmb2-display-styles', CMB2_Utils::url( "css/cmb2-display{$rtl}{$min}.css" ), $dependencies );
270
+		$dependencies = apply_filters('cmb2_style_dependencies', array());
271
+		wp_register_style('cmb2-styles', CMB2_Utils::url("css/cmb2{$front}{$rtl}{$min}.css"), $dependencies);
272
+		wp_register_style('cmb2-display-styles', CMB2_Utils::url("css/cmb2-display{$rtl}{$min}.css"), $dependencies);
273 273
 
274 274
 		self::$css_registration_done = true;
275 275
 	}
@@ -280,12 +280,12 @@  discard block
 block discarded – undo
280 280
 	 * @since  2.0.7
281 281
 	 */
282 282
 	protected static function register_js() {
283
-		if ( self::$js_registration_done ) {
283
+		if (self::$js_registration_done) {
284 284
 			return;
285 285
 		}
286 286
 
287 287
 		$hook = is_admin() ? 'admin_footer' : 'wp_footer';
288
-		add_action( $hook, array( 'CMB2_JS', 'enqueue' ), 8 );
288
+		add_action($hook, array('CMB2_JS', 'enqueue'), 8);
289 289
 
290 290
 		self::$js_registration_done = true;
291 291
 	}
@@ -307,7 +307,7 @@  discard block
 block discarded – undo
307 307
 	 *
308 308
 	 * @param string $hook Current hook for the admin page.
309 309
 	 */
310
-	public function do_scripts( $hook ) {
310
+	public function do_scripts($hook) {
311 311
 		$hooks = array(
312 312
 			'post.php',
313 313
 			'post-new.php',
@@ -322,11 +322,11 @@  discard block
 block discarded – undo
322 322
 		);
323 323
 		// only pre-enqueue our scripts/styles on the proper pages
324 324
 		// show_form_for_type will have us covered if we miss something here.
325
-		if ( in_array( $hook, $hooks, true ) ) {
326
-			if ( $this->cmb->prop( 'cmb_styles' ) ) {
325
+		if (in_array($hook, $hooks, true)) {
326
+			if ($this->cmb->prop('cmb_styles')) {
327 327
 				self::enqueue_cmb_css();
328 328
 			}
329
-			if ( $this->cmb->prop( 'enqueue_js' ) ) {
329
+			if ($this->cmb->prop('enqueue_js')) {
330 330
 				self::enqueue_cmb_js();
331 331
 			}
332 332
 		}
@@ -339,24 +339,24 @@  discard block
 block discarded – undo
339 339
 	 *
340 340
 	 * @param array $columns Array of columns available for the admin page.
341 341
 	 */
342
-	public function register_column_headers( $columns ) {
343
-		foreach ( $this->cmb->prop( 'fields' ) as $key => $field ) {
344
-			if ( empty( $field['column'] ) ) {
342
+	public function register_column_headers($columns) {
343
+		foreach ($this->cmb->prop('fields') as $key => $field) {
344
+			if (empty($field['column'])) {
345 345
 				continue;
346 346
 			}
347 347
 
348 348
 			$column = $field['column'];
349 349
 
350
-			if ( false === $column['position'] ) {
351
-				$columns[ $field['id'] ] = $column['name'];
350
+			if (false === $column['position']) {
351
+				$columns[$field['id']] = $column['name'];
352 352
 			} else {
353
-				$before = array_slice( $columns, 0, absint( $column['position'] ) );
354
-				$before[ $field['id'] ] = $column['name'];
353
+				$before = array_slice($columns, 0, absint($column['position']));
354
+				$before[$field['id']] = $column['name'];
355 355
 				$columns = $before + $columns;
356 356
 			}
357 357
 
358 358
 			$column['field'] = $field;
359
-			$this->columns[ $field['id'] ] = $column;
359
+			$this->columns[$field['id']] = $column;
360 360
 		}
361 361
 
362 362
 		return $columns;
@@ -370,16 +370,16 @@  discard block
 block discarded – undo
370 370
 	 * @param string $column_name Current column name.
371 371
 	 * @param mixed  $object_id Current object ID.
372 372
 	 */
373
-	public function column_display( $column_name, $object_id ) {
374
-		if ( isset( $this->columns[ $column_name ] ) ) {
375
-			$field = new CMB2_Field( array(
376
-				'field_args'  => $this->columns[ $column_name ]['field'],
373
+	public function column_display($column_name, $object_id) {
374
+		if (isset($this->columns[$column_name])) {
375
+			$field = new CMB2_Field(array(
376
+				'field_args'  => $this->columns[$column_name]['field'],
377 377
 				'object_type' => $this->object_type,
378
-				'object_id'   => $this->cmb->object_id( $object_id ),
378
+				'object_id'   => $this->cmb->object_id($object_id),
379 379
 				'cmb_id'      => $this->cmb->cmb_id,
380
-			) );
380
+			));
381 381
 
382
-			$this->cmb->get_field( $field )->render_column();
382
+			$this->cmb->get_field($field)->render_column();
383 383
 		}
384 384
 	}
385 385
 
@@ -392,10 +392,10 @@  discard block
 block discarded – undo
392 392
 	 *
393 393
 	 * @return array $columns An array of sortable columns with CMB2 columns.
394 394
 	 */
395
-	public function columns_sortable( $columns ) {
396
-		foreach ( $this->cmb->prop( 'fields' ) as $key => $field ) {
397
-			if ( ! empty( $field['column'] ) && empty( $field['column']['disable_sortable'] ) ) {
398
-				$columns[ $field['id'] ] = $field['id'];
395
+	public function columns_sortable($columns) {
396
+		foreach ($this->cmb->prop('fields') as $key => $field) {
397
+			if ( ! empty($field['column']) && empty($field['column']['disable_sortable'])) {
398
+				$columns[$field['id']] = $field['id'];
399 399
 			}
400 400
 		}
401 401
 
@@ -411,28 +411,28 @@  discard block
 block discarded – undo
411 411
 	 *
412 412
 	 * @return void
413 413
 	 */
414
-	public function columns_sortable_orderby( $query ) {
415
-		if ( ! is_admin() ) {
414
+	public function columns_sortable_orderby($query) {
415
+		if ( ! is_admin()) {
416 416
 			return;
417 417
 		}
418 418
 
419
-		$orderby = $query->get( 'orderby' );
419
+		$orderby = $query->get('orderby');
420 420
 
421
-		foreach ( $this->cmb->prop( 'fields' ) as $key => $field ) {
421
+		foreach ($this->cmb->prop('fields') as $key => $field) {
422 422
 			if (
423
-				empty( $field['column'] )
424
-				|| ! empty( $field['column']['disable_sortable'] )
423
+				empty($field['column'])
424
+				|| ! empty($field['column']['disable_sortable'])
425 425
 				|| $field['id'] !== $orderby
426 426
 			) {
427 427
 				continue;
428 428
 			}
429 429
 
430
-			$query->set( 'meta_key', $field['id'] );
430
+			$query->set('meta_key', $field['id']);
431 431
 
432 432
 			$type = $field['type'];
433 433
 
434
-			if ( ! empty( $field['attributes']['type'] ) ) {
435
-				switch ( $field['attributes']['type'] ) {
434
+			if ( ! empty($field['attributes']['type'])) {
435
+				switch ($field['attributes']['type']) {
436 436
 					case 'number':
437 437
 					case 'date':
438 438
 						$type = $field['attributes']['type'];
@@ -443,22 +443,22 @@  discard block
 block discarded – undo
443 443
 				}
444 444
 			}
445 445
 
446
-			switch ( $type ) {
446
+			switch ($type) {
447 447
 				case 'number':
448 448
 				case 'text_date_timestamp':
449 449
 				case 'text_datetime_timestamp':
450 450
 				case 'text_money':
451
-					$query->set( 'orderby', 'meta_value_num' );
451
+					$query->set('orderby', 'meta_value_num');
452 452
 					break;
453 453
 				case 'text_time':
454
-					$query->set( 'orderby', 'meta_value_time' );
454
+					$query->set('orderby', 'meta_value_time');
455 455
 					break;
456 456
 				case 'text_date':
457
-					$query->set( 'orderby', 'meta_value_date' );
457
+					$query->set('orderby', 'meta_value_date');
458 458
 					break;
459 459
 
460 460
 				default:
461
-					$query->set( 'orderby', 'meta_value' );
461
+					$query->set('orderby', 'meta_value');
462 462
 					break;
463 463
 			}
464 464
 		}
@@ -469,9 +469,9 @@  discard block
 block discarded – undo
469 469
 	 *
470 470
 	 * @since 2.2.2
471 471
 	 */
472
-	public function return_column_display( $empty, $custom_column, $object_id ) {
472
+	public function return_column_display($empty, $custom_column, $object_id) {
473 473
 		ob_start();
474
-		$this->column_display( $custom_column, $object_id );
474
+		$this->column_display($custom_column, $object_id);
475 475
 		$column = ob_get_clean();
476 476
 
477 477
 		return $column ? $column : $empty;
@@ -484,17 +484,17 @@  discard block
 block discarded – undo
484 484
 	 */
485 485
 	public function add_context_metaboxes() {
486 486
 
487
-		if ( ! $this->show_on() ) {
487
+		if ( ! $this->show_on()) {
488 488
 			return;
489 489
 		}
490 490
 
491 491
 		$page = get_current_screen()->id;
492 492
 
493
-		foreach ( $this->cmb->box_types() as $object_type ) {
494
-			$screen = convert_to_screen( $object_type );
493
+		foreach ($this->cmb->box_types() as $object_type) {
494
+			$screen = convert_to_screen($object_type);
495 495
 
496 496
 			// If we're on the right post-type/object...
497
-			if ( isset( $screen->id ) && $screen->id === $page ) {
497
+			if (isset($screen->id) && $screen->id === $page) {
498 498
 
499 499
 				// Show the box.
500 500
 				$this->output_context_metabox();
@@ -508,7 +508,7 @@  discard block
 block discarded – undo
508 508
 	 * @since 2.2.4
509 509
 	 */
510 510
 	public function output_context_metabox() {
511
-		$title = $this->cmb->prop( 'title' );
511
+		$title = $this->cmb->prop('title');
512 512
 
513 513
 		/*
514 514
 		 * To keep from outputting the open/close markup, do not include
@@ -517,17 +517,17 @@  discard block
 block discarded – undo
517 517
 		 * To output the fields 'naked' (without a postbox wrapper/style), then
518 518
 		 * add a `'remove_box_wrap' => true` to your metabox registration array.
519 519
 		 */
520
-		$add_wrap = ! empty( $title ) || ! $this->cmb->prop( 'remove_box_wrap' );
521
-		$add_handle = $add_wrap && ! empty( $title );
520
+		$add_wrap = ! empty($title) || ! $this->cmb->prop('remove_box_wrap');
521
+		$add_handle = $add_wrap && ! empty($title);
522 522
 
523 523
 		// Open the context-box wrap.
524
-		$this->context_box_title_markup_open( $add_handle );
524
+		$this->context_box_title_markup_open($add_handle);
525 525
 
526 526
 		// Show the form fields.
527 527
 		$this->cmb->show_form();
528 528
 
529 529
 		// Close the context-box wrap.
530
-		$this->context_box_title_markup_close( $add_handle );
530
+		$this->context_box_title_markup_close($add_handle);
531 531
 	}
532 532
 
533 533
 	/**
@@ -536,22 +536,22 @@  discard block
 block discarded – undo
536 536
 	 * @since 2.2.4
537 537
 	 * @param bool $add_handle Whether to add the metabox handle and opening div for .inside.
538 538
 	 */
539
-	public function context_box_title_markup_open( $add_handle = true ) {
540
-		$title = $this->cmb->prop( 'title' );
539
+	public function context_box_title_markup_open($add_handle = true) {
540
+		$title = $this->cmb->prop('title');
541 541
 
542 542
 		$page = get_current_screen()->id;
543
-		add_filter( "postbox_classes_{$page}_{$this->cmb->cmb_id}", array( $this, 'postbox_classes' ) );
543
+		add_filter("postbox_classes_{$page}_{$this->cmb->cmb_id}", array($this, 'postbox_classes'));
544 544
 
545
-		echo '<div id="' . $this->cmb->cmb_id . '" class="' . postbox_classes( $this->cmb->cmb_id, $page ) . '">' . "\n";
545
+		echo '<div id="' . $this->cmb->cmb_id . '" class="' . postbox_classes($this->cmb->cmb_id, $page) . '">' . "\n";
546 546
 
547
-		if ( $add_handle ) {
547
+		if ($add_handle) {
548 548
 
549 549
 			echo '<button type="button" class="handlediv button-link" aria-expanded="true">';
550
-				echo '<span class="screen-reader-text">' . sprintf( __( 'Toggle panel: %s' ), $title ) . '</span>';
550
+				echo '<span class="screen-reader-text">' . sprintf(__('Toggle panel: %s'), $title) . '</span>';
551 551
 				echo '<span class="toggle-indicator" aria-hidden="true"></span>';
552 552
 			echo '</button>';
553 553
 
554
-			echo '<h2 class="hndle"><span>' . esc_attr( $title ) . '</span></h2>' . "\n";
554
+			echo '<h2 class="hndle"><span>' . esc_attr($title) . '</span></h2>' . "\n";
555 555
 			echo '<div class="inside">' . "\n";
556 556
 		}
557 557
 	}
@@ -562,10 +562,10 @@  discard block
 block discarded – undo
562 562
 	 * @since 2.2.4
563 563
 	 * @param bool $add_inside_close Whether to add closing div for .inside.
564 564
 	 */
565
-	public function context_box_title_markup_close( $add_inside_close = true ) {
565
+	public function context_box_title_markup_close($add_inside_close = true) {
566 566
 
567 567
 		// Load the closing divs for a title box.
568
-		if ( $add_inside_close ) {
568
+		if ($add_inside_close) {
569 569
 			echo '</div>' . "\n"; // .inside
570 570
 		}
571 571
 
@@ -579,7 +579,7 @@  discard block
 block discarded – undo
579 579
 	 */
580 580
 	public function add_metaboxes() {
581 581
 
582
-		if ( ! $this->show_on() ) {
582
+		if ( ! $this->show_on()) {
583 583
 			return;
584 584
 		}
585 585
 
@@ -592,22 +592,22 @@  discard block
 block discarded – undo
592 592
 		 * This is a good solution if you want to handle outputting your
593 593
 		 * metaboxes/fields elsewhere in the post-screen.
594 594
 		 */
595
-		if ( ! $this->cmb->prop( 'title' ) ) {
595
+		if ( ! $this->cmb->prop('title')) {
596 596
 			return;
597 597
 		}
598 598
 
599 599
 		$page = get_current_screen()->id;
600
-		add_filter( "postbox_classes_{$page}_{$this->cmb->cmb_id}", array( $this, 'postbox_classes' ) );
600
+		add_filter("postbox_classes_{$page}_{$this->cmb->cmb_id}", array($this, 'postbox_classes'));
601 601
 
602
-		foreach ( $this->cmb->box_types() as $object_type ) {
602
+		foreach ($this->cmb->box_types() as $object_type) {
603 603
 			add_meta_box(
604 604
 				$this->cmb->cmb_id,
605
-				$this->cmb->prop( 'title' ),
606
-				array( $this, 'metabox_callback' ),
605
+				$this->cmb->prop('title'),
606
+				array($this, 'metabox_callback'),
607 607
 				$object_type,
608
-				$this->cmb->prop( 'context' ),
609
-				$this->cmb->prop( 'priority' ),
610
-				$this->cmb->prop( 'mb_callback_args' )
608
+				$this->cmb->prop('context'),
609
+				$this->cmb->prop('priority'),
610
+				$this->cmb->prop('mb_callback_args')
611 611
 			);
612 612
 		}
613 613
 	}
@@ -619,15 +619,15 @@  discard block
 block discarded – undo
619 619
 	 *
620 620
 	 */
621 621
 	public function remove_default_tax_metaboxes() {
622
-		$to_remove = array_filter( (array) $this->cmb->tax_metaboxes_to_remove, 'taxonomy_exists' );
623
-		if ( empty( $to_remove ) ) {
622
+		$to_remove = array_filter((array) $this->cmb->tax_metaboxes_to_remove, 'taxonomy_exists');
623
+		if (empty($to_remove)) {
624 624
 			return;
625 625
 		}
626 626
 
627
-		foreach ( $this->cmb->box_types() as $post_type ) {
628
-			foreach ( $to_remove as $taxonomy ) {
629
-				$mb_id = is_taxonomy_hierarchical( $taxonomy ) ? "{$taxonomy}div" : "tagsdiv-{$taxonomy}";
630
-				remove_meta_box( $mb_id, $post_type, 'side' );
627
+		foreach ($this->cmb->box_types() as $post_type) {
628
+			foreach ($to_remove as $taxonomy) {
629
+				$mb_id = is_taxonomy_hierarchical($taxonomy) ? "{$taxonomy}div" : "tagsdiv-{$taxonomy}";
630
+				remove_meta_box($mb_id, $post_type, 'side');
631 631
 			}
632 632
 		}
633 633
 	}
@@ -639,13 +639,13 @@  discard block
 block discarded – undo
639 639
 	 * @param  array $classes Array of classes.
640 640
 	 * @return array           Modified array of classes
641 641
 	 */
642
-	public function postbox_classes( $classes ) {
643
-		if ( $this->cmb->prop( 'closed' ) && ! in_array( 'closed', $classes ) ) {
642
+	public function postbox_classes($classes) {
643
+		if ($this->cmb->prop('closed') && ! in_array('closed', $classes)) {
644 644
 			$classes[] = 'closed';
645 645
 		}
646 646
 
647
-		if ( $this->cmb->is_alternate_context_box() ) {
648
-			$classes = $this->alternate_context_postbox_classes( $classes );
647
+		if ($this->cmb->is_alternate_context_box()) {
648
+			$classes = $this->alternate_context_postbox_classes($classes);
649 649
 		} else {
650 650
 			$classes[] = 'cmb2-postbox';
651 651
 		}
@@ -660,17 +660,17 @@  discard block
 block discarded – undo
660 660
 	 * @param  array $classes Array of classes.
661 661
 	 * @return array           Modified array of classes
662 662
 	 */
663
-	protected function alternate_context_postbox_classes( $classes ) {
663
+	protected function alternate_context_postbox_classes($classes) {
664 664
 		$classes[] = 'context-box';
665
-		$classes[] = 'context-' . $this->cmb->prop( 'context' ) . '-box';
665
+		$classes[] = 'context-' . $this->cmb->prop('context') . '-box';
666 666
 
667
-		if ( in_array( $this->cmb->cmb_id, get_hidden_meta_boxes( get_current_screen() ) ) ) {
667
+		if (in_array($this->cmb->cmb_id, get_hidden_meta_boxes(get_current_screen()))) {
668 668
 			$classes[] = 'hide-if-js';
669 669
 		}
670 670
 
671
-		$add_wrap = $this->cmb->prop( 'title' ) || ! $this->cmb->prop( 'remove_box_wrap' );
671
+		$add_wrap = $this->cmb->prop('title') || ! $this->cmb->prop('remove_box_wrap');
672 672
 
673
-		if ( $add_wrap ) {
673
+		if ($add_wrap) {
674 674
 			$classes[] = 'cmb2-postbox postbox';
675 675
 		} else {
676 676
 			$classes[] = 'cmb2-no-box-wrap';
@@ -686,7 +686,7 @@  discard block
 block discarded – undo
686 686
 	 */
687 687
 	public function metabox_callback() {
688 688
 		$object_id = 'comment' === $this->object_type ? get_comment_ID() : get_the_ID();
689
-		$this->cmb->show_form( $object_id, $this->object_type );
689
+		$this->cmb->show_form($object_id, $this->object_type);
690 690
 	}
691 691
 
692 692
 	/**
@@ -696,10 +696,10 @@  discard block
 block discarded – undo
696 696
 	 *
697 697
 	 * @param mixed $section User section metabox.
698 698
 	 */
699
-	public function user_new_metabox( $section ) {
700
-		if ( $section === $this->cmb->prop( 'new_user_section' ) ) {
699
+	public function user_new_metabox($section) {
700
+		if ($section === $this->cmb->prop('new_user_section')) {
701 701
 			$object_id = $this->cmb->object_id();
702
-			$this->cmb->object_id( isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id );
702
+			$this->cmb->object_id(isset($_REQUEST['user_id']) ? $_REQUEST['user_id'] : $object_id);
703 703
 			$this->user_metabox();
704 704
 		}
705 705
 	}
@@ -710,7 +710,7 @@  discard block
 block discarded – undo
710 710
 	 * @since  1.0.0
711 711
 	 */
712 712
 	public function user_metabox() {
713
-		$this->show_form_for_type( 'user' );
713
+		$this->show_form_for_type('user');
714 714
 	}
715 715
 
716 716
 	/**
@@ -719,7 +719,7 @@  discard block
 block discarded – undo
719 719
 	 * @since  2.2.0
720 720
 	 */
721 721
 	public function term_metabox() {
722
-		$this->show_form_for_type( 'term' );
722
+		$this->show_form_for_type('term');
723 723
 	}
724 724
 
725 725
 	/**
@@ -729,23 +729,23 @@  discard block
 block discarded – undo
729 729
 	 * @param  string $type Object type.
730 730
 	 * @return void
731 731
 	 */
732
-	public function show_form_for_type( $type ) {
733
-		if ( $type != $this->object_type ) {
732
+	public function show_form_for_type($type) {
733
+		if ($type != $this->object_type) {
734 734
 			return;
735 735
 		}
736 736
 
737
-		if ( ! $this->show_on() ) {
737
+		if ( ! $this->show_on()) {
738 738
 			return;
739 739
 		}
740 740
 
741
-		if ( $this->cmb->prop( 'cmb_styles' ) ) {
741
+		if ($this->cmb->prop('cmb_styles')) {
742 742
 			self::enqueue_cmb_css();
743 743
 		}
744
-		if ( $this->cmb->prop( 'enqueue_js' ) ) {
744
+		if ($this->cmb->prop('enqueue_js')) {
745 745
 			self::enqueue_cmb_js();
746 746
 		}
747 747
 
748
-		$this->cmb->show_form( 0, $type );
748
+		$this->cmb->show_form(0, $type);
749 749
 	}
750 750
 
751 751
 	/**
@@ -765,7 +765,7 @@  discard block
 block discarded – undo
765 765
 		 * @param mixed  $meta_box_args Array of the metabox arguments.
766 766
 		 * @param mixed  $cmb           The CMB2 instance.
767 767
 		 */
768
-		$show = (bool) apply_filters( 'cmb2_show_on', $show, $this->cmb->meta_box, $this->cmb );
768
+		$show = (bool) apply_filters('cmb2_show_on', $show, $this->cmb->meta_box, $this->cmb);
769 769
 
770 770
 		return $show;
771 771
 	}
@@ -778,11 +778,11 @@  discard block
 block discarded – undo
778 778
 	 * @param integer $default Default display hook priority.
779 779
 	 * @return integer          Hook priority.
780 780
 	 */
781
-	public function get_priority( $default = 10 ) {
782
-		$priority = $this->cmb->prop( 'priority' );
781
+	public function get_priority($default = 10) {
782
+		$priority = $this->cmb->prop('priority');
783 783
 
784
-		if ( ! is_numeric( $priority ) ) {
785
-			switch ( $priority ) {
784
+		if ( ! is_numeric($priority)) {
785
+			switch ($priority) {
786 786
 
787 787
 				case 'high':
788 788
 					$priority = 5;
@@ -809,22 +809,22 @@  discard block
 block discarded – undo
809 809
 	 * @param  mixed $post    Post object.
810 810
 	 * @return void
811 811
 	 */
812
-	public function save_post( $post_id, $post = false ) {
812
+	public function save_post($post_id, $post = false) {
813 813
 
814
-		$post_type = $post ? $post->post_type : get_post_type( $post_id );
814
+		$post_type = $post ? $post->post_type : get_post_type($post_id);
815 815
 
816 816
 		$do_not_pass_go = (
817
-			! $this->can_save( $post_type )
817
+			! $this->can_save($post_type)
818 818
 			// Check user editing permissions.
819
-			|| ( 'page' === $post_type && ! current_user_can( 'edit_page', $post_id ) )
820
-			|| ! current_user_can( 'edit_post', $post_id )
819
+			|| ('page' === $post_type && ! current_user_can('edit_page', $post_id))
820
+			|| ! current_user_can('edit_post', $post_id)
821 821
 		);
822 822
 
823
-		if ( $do_not_pass_go ) {
823
+		if ($do_not_pass_go) {
824 824
 			return;
825 825
 		}
826 826
 
827
-		$this->cmb->save_fields( $post_id, 'post', $_POST );
827
+		$this->cmb->save_fields($post_id, 'post', $_POST);
828 828
 	}
829 829
 
830 830
 	/**
@@ -834,12 +834,12 @@  discard block
 block discarded – undo
834 834
 	 * @param  int $comment_id Comment ID.
835 835
 	 * @return void
836 836
 	 */
837
-	public function save_comment( $comment_id ) {
837
+	public function save_comment($comment_id) {
838 838
 
839
-		$can_edit = current_user_can( 'moderate_comments', $comment_id );
839
+		$can_edit = current_user_can('moderate_comments', $comment_id);
840 840
 
841
-		if ( $this->can_save( get_comment_type( $comment_id ) ) && $can_edit ) {
842
-			$this->cmb->save_fields( $comment_id, 'comment', $_POST );
841
+		if ($this->can_save(get_comment_type($comment_id)) && $can_edit) {
842
+			$this->cmb->save_fields($comment_id, 'comment', $_POST);
843 843
 		}
844 844
 	}
845 845
 
@@ -850,10 +850,10 @@  discard block
 block discarded – undo
850 850
 	 * @param  int $user_id User ID.
851 851
 	 * @return void
852 852
 	 */
853
-	public function save_user( $user_id ) {
853
+	public function save_user($user_id) {
854 854
 		// check permissions.
855
-		if ( $this->can_save( 'user' ) ) {
856
-			$this->cmb->save_fields( $user_id, 'user', $_POST );
855
+		if ($this->can_save('user')) {
856
+			$this->cmb->save_fields($user_id, 'user', $_POST);
857 857
 		}
858 858
 	}
859 859
 
@@ -866,12 +866,12 @@  discard block
 block discarded – undo
866 866
 	 * @param string $taxonomy Taxonomy.
867 867
 	 * @return void
868 868
 	 */
869
-	public function save_term( $term_id, $tt_id, $taxonomy = '' ) {
869
+	public function save_term($term_id, $tt_id, $taxonomy = '') {
870 870
 		$taxonomy = $taxonomy ? $taxonomy : $tt_id;
871 871
 
872 872
 		// check permissions.
873
-		if ( $this->taxonomy_can_save( $taxonomy ) && $this->can_save( 'term' ) ) {
874
-			$this->cmb->save_fields( $term_id, 'term', $_POST );
873
+		if ($this->taxonomy_can_save($taxonomy) && $this->can_save('term')) {
874
+			$this->cmb->save_fields($term_id, 'term', $_POST);
875 875
 		}
876 876
 	}
877 877
 
@@ -884,15 +884,15 @@  discard block
 block discarded – undo
884 884
 	 * @param  string $taxonomy Taxonomy.
885 885
 	 * @return void
886 886
 	 */
887
-	public function delete_term( $term_id, $tt_id, $taxonomy = '' ) {
888
-		if ( $this->taxonomy_can_save( $taxonomy ) ) {
887
+	public function delete_term($term_id, $tt_id, $taxonomy = '') {
888
+		if ($this->taxonomy_can_save($taxonomy)) {
889 889
 
890 890
 			$data_to_delete = array();
891
-			foreach ( $this->cmb->prop( 'fields' ) as $field ) {
892
-				$data_to_delete[ $field['id'] ] = '';
891
+			foreach ($this->cmb->prop('fields') as $field) {
892
+				$data_to_delete[$field['id']] = '';
893 893
 			}
894 894
 
895
-			$this->cmb->save_fields( $term_id, 'term', $data_to_delete );
895
+			$this->cmb->save_fields($term_id, 'term', $data_to_delete);
896 896
 		}
897 897
 	}
898 898
 
@@ -903,19 +903,19 @@  discard block
 block discarded – undo
903 903
 	 * @param  string $type Current object type.
904 904
 	 * @return bool         Whether object can be saved.
905 905
 	 */
906
-	public function can_save( $type = '' ) {
906
+	public function can_save($type = '') {
907 907
 
908 908
 		$can_save = (
909
-			$this->cmb->prop( 'save_fields' )
909
+			$this->cmb->prop('save_fields')
910 910
 			// check nonce.
911
-			&& isset( $_POST[ $this->cmb->nonce() ] )
912
-			&& wp_verify_nonce( $_POST[ $this->cmb->nonce() ], $this->cmb->nonce() )
911
+			&& isset($_POST[$this->cmb->nonce()])
912
+			&& wp_verify_nonce($_POST[$this->cmb->nonce()], $this->cmb->nonce())
913 913
 			// check if autosave.
914
-			&& ! ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE )
914
+			&& ! (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE)
915 915
 			// get the metabox types & compare it to this type.
916
-			&& ( $type && in_array( $type, $this->cmb->box_types() ) )
916
+			&& ($type && in_array($type, $this->cmb->box_types()))
917 917
 			// Don't do updates during a switch-to-blog instance.
918
-			&& ! ( is_multisite() && ms_is_switched() )
918
+			&& ! (is_multisite() && ms_is_switched())
919 919
 		);
920 920
 
921 921
 		/**
@@ -924,7 +924,7 @@  discard block
 block discarded – undo
924 924
 		 * @param bool   $can_save Whether the current metabox can save.
925 925
 		 * @param object $cmb      The CMB2 instance.
926 926
 		 */
927
-		return apply_filters( 'cmb2_can_save', $can_save, $this->cmb );
927
+		return apply_filters('cmb2_can_save', $can_save, $this->cmb);
928 928
 	}
929 929
 
930 930
 	/**
@@ -935,14 +935,14 @@  discard block
 block discarded – undo
935 935
 	 * @param string $taxonomy Taxonomy of term being modified.
936 936
 	 * @return bool             Whether taxonomy is editable.
937 937
 	 */
938
-	public function taxonomy_can_save( $taxonomy ) {
939
-		if ( empty( $this->taxonomies ) || ! in_array( $taxonomy, $this->taxonomies ) ) {
938
+	public function taxonomy_can_save($taxonomy) {
939
+		if (empty($this->taxonomies) || ! in_array($taxonomy, $this->taxonomies)) {
940 940
 			return false;
941 941
 		}
942 942
 
943
-		$taxonomy_object = get_taxonomy( $taxonomy );
943
+		$taxonomy_object = get_taxonomy($taxonomy);
944 944
 		// Can the user edit this term?
945
-		if ( ! isset( $taxonomy_object->cap ) || ! current_user_can( $taxonomy_object->cap->edit_terms ) ) {
945
+		if ( ! isset($taxonomy_object->cap) || ! current_user_can($taxonomy_object->cap->edit_terms)) {
946 946
 			return false;
947 947
 		}
948 948
 
@@ -959,10 +959,10 @@  discard block
 block discarded – undo
959 959
 		if (
960 960
 			$pagenow
961 961
 			&& $this->cmb->has_columns
962
-			&& $this->cmb->prop( 'cmb_styles' )
963
-			&& in_array( $pagenow, array( 'edit.php', 'users.php', 'edit-comments.php', 'edit-tags.php' ), 1 )
962
+			&& $this->cmb->prop('cmb_styles')
963
+			&& in_array($pagenow, array('edit.php', 'users.php', 'edit-comments.php', 'edit-tags.php'), 1)
964 964
 			) {
965
-			self::enqueue_cmb_css( 'cmb2-display-styles' );
965
+			self::enqueue_cmb_css('cmb2-display-styles');
966 966
 		}
967 967
 	}
968 968
 
@@ -974,14 +974,14 @@  discard block
 block discarded – undo
974 974
 	 * @param string $handle CSS handle.
975 975
 	 * @return mixed
976 976
 	 */
977
-	public static function enqueue_cmb_css( $handle = 'cmb2-styles' ) {
977
+	public static function enqueue_cmb_css($handle = 'cmb2-styles') {
978 978
 
979 979
 		/**
980 980
 		 * Filter to determine if CMB2'S css should be enqueued.
981 981
 		 *
982 982
 		 * @param bool $enqueue_css Default is true.
983 983
 		 */
984
-		if ( ! apply_filters( 'cmb2_enqueue_css', true ) ) {
984
+		if ( ! apply_filters('cmb2_enqueue_css', true)) {
985 985
 			return false;
986 986
 		}
987 987
 
@@ -991,7 +991,7 @@  discard block
 block discarded – undo
991 991
 		 * White list the options as this method can be used as a hook callback
992 992
 		 * and have a different argument passed.
993 993
 		 */
994
-		return wp_enqueue_style( 'cmb2-display-styles' === $handle ? $handle : 'cmb2-styles' );
994
+		return wp_enqueue_style('cmb2-display-styles' === $handle ? $handle : 'cmb2-styles');
995 995
 	}
996 996
 
997 997
 	/**
@@ -1006,7 +1006,7 @@  discard block
 block discarded – undo
1006 1006
 		 *
1007 1007
 		 * @param bool $enqueue_js Default is true.
1008 1008
 		 */
1009
-		if ( ! apply_filters( 'cmb2_enqueue_js', true ) ) {
1009
+		if ( ! apply_filters('cmb2_enqueue_js', true)) {
1010 1010
 			return false;
1011 1011
 		}
1012 1012
 
Please login to merge, or discard this patch.
vendor/CMB2/includes/CMB2.php 1 patch
Spacing   +341 added lines, -341 removed lines patch added patch discarded remove patch
@@ -193,31 +193,31 @@  discard block
 block discarded – undo
193 193
 	 * @param array   $config    Metabox config array.
194 194
 	 * @param integer $object_id Optional object id.
195 195
 	 */
196
-	public function __construct( $config, $object_id = 0 ) {
196
+	public function __construct($config, $object_id = 0) {
197 197
 
198
-		if ( empty( $config['id'] ) ) {
199
-			wp_die( esc_html__( 'Metabox configuration is required to have an ID parameter.', 'cmb2' ) );
198
+		if (empty($config['id'])) {
199
+			wp_die(esc_html__('Metabox configuration is required to have an ID parameter.', 'cmb2'));
200 200
 		}
201 201
 
202 202
 		$this->cmb_id = $config['id'];
203
-		$this->meta_box = wp_parse_args( $config, $this->mb_defaults );
203
+		$this->meta_box = wp_parse_args($config, $this->mb_defaults);
204 204
 		$this->meta_box['fields'] = array();
205 205
 
206 206
 		// Ensures object_types is an array.
207
-		$this->set_prop( 'object_types', $this->box_types() );
208
-		$this->object_id( $object_id );
207
+		$this->set_prop('object_types', $this->box_types());
208
+		$this->object_id($object_id);
209 209
 
210
-		if ( $this->is_options_page_mb() ) {
210
+		if ($this->is_options_page_mb()) {
211 211
 			$this->init_options_mb();
212 212
 		}
213 213
 
214 214
 		$this->mb_object_type();
215 215
 
216
-		if ( ! empty( $config['fields'] ) && is_array( $config['fields'] ) ) {
217
-			$this->add_fields( $config['fields'] );
216
+		if ( ! empty($config['fields']) && is_array($config['fields'])) {
217
+			$this->add_fields($config['fields']);
218 218
 		}
219 219
 
220
-		CMB2_Boxes::add( $this );
220
+		CMB2_Boxes::add($this);
221 221
 
222 222
 		/**
223 223
 		 * Hook during initiation of CMB2 object
@@ -226,13 +226,13 @@  discard block
 block discarded – undo
226 226
 		 *
227 227
 		 * @param array $cmb This CMB2 object
228 228
 		 */
229
-		do_action( "cmb2_init_{$this->cmb_id}", $this );
229
+		do_action("cmb2_init_{$this->cmb_id}", $this);
230 230
 
231 231
 		// Hook in the hookup... how meta.
232
-		add_action( "cmb2_init_hookup_{$this->cmb_id}", array( 'CMB2_Hookup', 'maybe_init_and_hookup' ) );
232
+		add_action("cmb2_init_hookup_{$this->cmb_id}", array('CMB2_Hookup', 'maybe_init_and_hookup'));
233 233
 
234 234
 		// Hook in the rest api functionality.
235
-		add_action( "cmb2_init_hookup_{$this->cmb_id}", array( 'CMB2_REST', 'maybe_init_and_hookup' ) );
235
+		add_action("cmb2_init_hookup_{$this->cmb_id}", array('CMB2_REST', 'maybe_init_and_hookup'));
236 236
 	}
237 237
 
238 238
 	/**
@@ -244,14 +244,14 @@  discard block
 block discarded – undo
244 244
 	 *
245 245
 	 * @return CMB2
246 246
 	 */
247
-	public function show_form( $object_id = 0, $object_type = '' ) {
248
-		$this->render_form_open( $object_id, $object_type );
247
+	public function show_form($object_id = 0, $object_type = '') {
248
+		$this->render_form_open($object_id, $object_type);
249 249
 
250
-		foreach ( $this->prop( 'fields' ) as $field_args ) {
251
-			$this->render_field( $field_args );
250
+		foreach ($this->prop('fields') as $field_args) {
251
+			$this->render_field($field_args);
252 252
 		}
253 253
 
254
-		return $this->render_form_close( $object_id, $object_type );
254
+		return $this->render_form_close($object_id, $object_type);
255 255
 	}
256 256
 
257 257
 	/**
@@ -264,9 +264,9 @@  discard block
 block discarded – undo
264 264
 	 *
265 265
 	 * @return CMB2
266 266
 	 */
267
-	public function render_form_open( $object_id = 0, $object_type = '' ) {
268
-		$object_type = $this->object_type( $object_type );
269
-		$object_id = $this->object_id( $object_id );
267
+	public function render_form_open($object_id = 0, $object_type = '') {
268
+		$object_type = $this->object_type($object_type);
269
+		$object_id = $this->object_id($object_id);
270 270
 
271 271
 		echo "\n<!-- Begin CMB2 Fields -->\n";
272 272
 
@@ -282,7 +282,7 @@  discard block
 block discarded – undo
282 282
 		 *                            Could also be `comment`, `user` or `options-page`.
283 283
 		 * @param array  $cmb         This CMB2 object.
284 284
 		 */
285
-		do_action( 'cmb2_before_form', $this->cmb_id, $object_id, $object_type, $this );
285
+		do_action('cmb2_before_form', $this->cmb_id, $object_id, $object_type, $this);
286 286
 
287 287
 		/**
288 288
 		 * Hook before form table begins
@@ -297,9 +297,9 @@  discard block
 block discarded – undo
297 297
 		 * @param int    $object_id   The ID of the current object
298 298
 		 * @param array  $cmb         This CMB2 object
299 299
 		 */
300
-		do_action( "cmb2_before_{$object_type}_form_{$this->cmb_id}", $object_id, $this );
300
+		do_action("cmb2_before_{$object_type}_form_{$this->cmb_id}", $object_id, $this);
301 301
 
302
-		echo '<div class="', esc_attr( $this->box_classes() ), '"><div id="cmb2-metabox-', sanitize_html_class( $this->cmb_id ), '" class="cmb2-metabox cmb-field-list">';
302
+		echo '<div class="', esc_attr($this->box_classes()), '"><div id="cmb2-metabox-', sanitize_html_class($this->cmb_id), '" class="cmb2-metabox cmb-field-list">';
303 303
 
304 304
 		return $this;
305 305
 	}
@@ -312,17 +312,17 @@  discard block
 block discarded – undo
312 312
 	 */
313 313
 	public function box_classes() {
314 314
 
315
-		$classes = array( 'cmb2-wrap', 'form-table' );
315
+		$classes = array('cmb2-wrap', 'form-table');
316 316
 
317 317
 		// Use the callback to fetch classes.
318
-		if ( $added_classes = $this->get_param_callback_result( 'classes_cb' ) ) {
319
-			$added_classes = is_array( $added_classes ) ? $added_classes : array( $added_classes );
320
-			$classes = array_merge( $classes, $added_classes );
318
+		if ($added_classes = $this->get_param_callback_result('classes_cb')) {
319
+			$added_classes = is_array($added_classes) ? $added_classes : array($added_classes);
320
+			$classes = array_merge($classes, $added_classes);
321 321
 		}
322 322
 
323
-		if ( $added_classes = $this->prop( 'classes' ) ) {
324
-			$added_classes = is_array( $added_classes ) ? $added_classes : array( $added_classes );
325
-			$classes = array_merge( $classes, $added_classes );
323
+		if ($added_classes = $this->prop('classes')) {
324
+			$added_classes = is_array($added_classes) ? $added_classes : array($added_classes);
325
+			$classes = array_merge($classes, $added_classes);
326 326
 		}
327 327
 
328 328
 		/**
@@ -330,11 +330,11 @@  discard block
 block discarded – undo
330 330
 		 *
331 331
 		 * @since 2.2.4
332 332
 		 */
333
-		if ( $this->is_alternate_context_box() ) {
333
+		if ($this->is_alternate_context_box()) {
334 334
 			$context = array();
335 335
 
336 336
 			// Include custom class if requesting no title.
337
-			if ( ! $this->prop( 'title' ) && ! $this->prop( 'remove_box_wrap' ) ) {
337
+			if ( ! $this->prop('title') && ! $this->prop('remove_box_wrap')) {
338 338
 				$context[] = 'cmb2-context-wrap-no-title';
339 339
 			}
340 340
 
@@ -342,13 +342,13 @@  discard block
 block discarded – undo
342 342
 			$context[] = 'cmb2-context-wrap';
343 343
 
344 344
 			// Include a context-type based context wrapper.
345
-			$context[] = 'cmb2-context-wrap-' . $this->prop( 'context' );
345
+			$context[] = 'cmb2-context-wrap-' . $this->prop('context');
346 346
 
347 347
 			// Include an ID based context wrapper as well.
348
-			$context[] = 'cmb2-context-wrap-' . $this->prop( 'id' );
348
+			$context[] = 'cmb2-context-wrap-' . $this->prop('id');
349 349
 
350 350
 			// And merge all the classes back into the array.
351
-			$classes = array_merge( $classes, $context );
351
+			$classes = array_merge($classes, $context);
352 352
 		}
353 353
 
354 354
 		/**
@@ -359,22 +359,22 @@  discard block
 block discarded – undo
359 359
 		 * @param string $classes Array of classes for the cmb2-wrap.
360 360
 		 * @param CMB2   $cmb     This CMB2 object.
361 361
 		 */
362
-		$classes = apply_filters( 'cmb2_wrap_classes', $classes, $this );
362
+		$classes = apply_filters('cmb2_wrap_classes', $classes, $this);
363 363
 
364 364
 		$split = array();
365
-		foreach ( array_filter( $classes ) as $class ) {
366
-			foreach ( explode( ' ', $class ) as $_class ) {
365
+		foreach (array_filter($classes) as $class) {
366
+			foreach (explode(' ', $class) as $_class) {
367 367
 				// Clean up & sanitize.
368
-				$split[] = sanitize_html_class( strip_tags( $_class ) );
368
+				$split[] = sanitize_html_class(strip_tags($_class));
369 369
 			}
370 370
 		}
371 371
 		$classes = $split;
372 372
 
373 373
 		// Remove any duplicates.
374
-		$classes = array_unique( $classes );
374
+		$classes = array_unique($classes);
375 375
 
376 376
 		// Make it a string.
377
-		return implode( ' ', $classes );
377
+		return implode(' ', $classes);
378 378
 	}
379 379
 
380 380
 	/**
@@ -387,9 +387,9 @@  discard block
 block discarded – undo
387 387
 	 *
388 388
 	 * @return CMB2
389 389
 	 */
390
-	public function render_form_close( $object_id = 0, $object_type = '' ) {
391
-		$object_type = $this->object_type( $object_type );
392
-		$object_id = $this->object_id( $object_id );
390
+	public function render_form_close($object_id = 0, $object_type = '') {
391
+		$object_type = $this->object_type($object_type);
392
+		$object_id = $this->object_id($object_id);
393 393
 
394 394
 		echo '</div></div>';
395 395
 
@@ -407,7 +407,7 @@  discard block
 block discarded – undo
407 407
 		 * @param int    $object_id   The ID of the current object
408 408
 		 * @param array  $cmb         This CMB2 object
409 409
 		 */
410
-		do_action( "cmb2_after_{$object_type}_form_{$this->cmb_id}", $object_id, $this );
410
+		do_action("cmb2_after_{$object_type}_form_{$this->cmb_id}", $object_id, $this);
411 411
 
412 412
 		/**
413 413
 		 * Hook after form form has been rendered
@@ -419,7 +419,7 @@  discard block
 block discarded – undo
419 419
 		 *                            Could also be `comment`, `user` or `options-page`.
420 420
 		 * @param array  $cmb         This CMB2 object.
421 421
 		 */
422
-		do_action( 'cmb2_after_form', $this->cmb_id, $object_id, $object_type, $this );
422
+		do_action('cmb2_after_form', $this->cmb_id, $object_id, $object_type, $this);
423 423
 
424 424
 		echo "\n<!-- End CMB2 Fields -->\n";
425 425
 
@@ -433,26 +433,26 @@  discard block
 block discarded – undo
433 433
 	 * @param  array $field_args A field configuration array.
434 434
 	 * @return mixed CMB2_Field object if successful.
435 435
 	 */
436
-	public function render_field( $field_args ) {
437
-		$field_args['context'] = $this->prop( 'context' );
436
+	public function render_field($field_args) {
437
+		$field_args['context'] = $this->prop('context');
438 438
 
439
-		if ( 'group' === $field_args['type'] ) {
439
+		if ('group' === $field_args['type']) {
440 440
 
441
-			if ( ! isset( $field_args['show_names'] ) ) {
442
-				$field_args['show_names'] = $this->prop( 'show_names' );
441
+			if ( ! isset($field_args['show_names'])) {
442
+				$field_args['show_names'] = $this->prop('show_names');
443 443
 			}
444
-			$field = $this->render_group( $field_args );
444
+			$field = $this->render_group($field_args);
445 445
 
446
-		} elseif ( 'hidden' === $field_args['type'] && $this->get_field( $field_args )->should_show() ) {
446
+		} elseif ('hidden' === $field_args['type'] && $this->get_field($field_args)->should_show()) {
447 447
 			// Save rendering for after the metabox.
448
-			$field = $this->add_hidden_field( $field_args );
448
+			$field = $this->add_hidden_field($field_args);
449 449
 
450 450
 		} else {
451 451
 
452
-			$field_args['show_names'] = $this->prop( 'show_names' );
452
+			$field_args['show_names'] = $this->prop('show_names');
453 453
 
454 454
 			// Render default fields.
455
-			$field = $this->get_field( $field_args )->render_field();
455
+			$field = $this->get_field($field_args)->render_field();
456 456
 		}
457 457
 
458 458
 		return $field;
@@ -464,21 +464,21 @@  discard block
 block discarded – undo
464 464
 	 * @param array|CMB2_Field $args Array of field arguments for a group field parent or the group parent field.
465 465
 	 * @return CMB2_Field|null Group field object.
466 466
 	 */
467
-	public function render_group( $args ) {
467
+	public function render_group($args) {
468 468
 		$field_group = false;
469 469
 
470
-		if ( $args instanceof CMB2_Field ) {
470
+		if ($args instanceof CMB2_Field) {
471 471
 			$field_group = 'group' === $args->type() ? $args : false;
472
-		} elseif ( isset( $args['id'], $args['fields'] ) && is_array( $args['fields'] ) ) {
473
-			$field_group = $this->get_field( $args );
472
+		} elseif (isset($args['id'], $args['fields']) && is_array($args['fields'])) {
473
+			$field_group = $this->get_field($args);
474 474
 		}
475 475
 
476
-		if ( ! $field_group ) {
476
+		if ( ! $field_group) {
477 477
 			return;
478 478
 		}
479 479
 
480 480
 		$field_group->render_context = 'edit';
481
-		$field_group->peform_param_callback( 'render_row_cb' );
481
+		$field_group->peform_param_callback('render_row_cb');
482 482
 
483 483
 		return $field_group;
484 484
 	}
@@ -493,51 +493,51 @@  discard block
 block discarded – undo
493 493
 	 *
494 494
 	 * @return CMB2_Field|null Group field object.
495 495
 	 */
496
-	public function render_group_callback( $field_args, $field_group ) {
496
+	public function render_group_callback($field_args, $field_group) {
497 497
 
498 498
 		// If field is requesting to be conditionally shown.
499
-		if ( ! $field_group || ! $field_group->should_show() ) {
499
+		if ( ! $field_group || ! $field_group->should_show()) {
500 500
 			return;
501 501
 		}
502 502
 
503 503
 		$field_group->index = 0;
504 504
 
505
-		$field_group->peform_param_callback( 'before_group' );
505
+		$field_group->peform_param_callback('before_group');
506 506
 
507
-		$desc      = $field_group->args( 'description' );
508
-		$label     = $field_group->args( 'name' );
507
+		$desc      = $field_group->args('description');
508
+		$label     = $field_group->args('name');
509 509
 		$group_val = (array) $field_group->value();
510 510
 
511
-		echo '<div class="cmb-row cmb-repeat-group-wrap ', esc_attr( $field_group->row_classes() ), '" data-fieldtype="group"><div class="cmb-td"><div data-groupid="', esc_attr( $field_group->id() ), '" id="', esc_attr( $field_group->id() ), '_repeat" ', $this->group_wrap_attributes( $field_group ), '>';
511
+		echo '<div class="cmb-row cmb-repeat-group-wrap ', esc_attr($field_group->row_classes()), '" data-fieldtype="group"><div class="cmb-td"><div data-groupid="', esc_attr($field_group->id()), '" id="', esc_attr($field_group->id()), '_repeat" ', $this->group_wrap_attributes($field_group), '>';
512 512
 
513
-		if ( $desc || $label ) {
513
+		if ($desc || $label) {
514 514
 			$class = $desc ? ' cmb-group-description' : '';
515 515
 			echo '<div class="cmb-row', $class, '"><div class="cmb-th">';
516
-			if ( $label ) {
516
+			if ($label) {
517 517
 				echo '<h2 class="cmb-group-name">', $label, '</h2>';
518 518
 			}
519
-			if ( $desc ) {
519
+			if ($desc) {
520 520
 				echo '<p class="cmb2-metabox-description">', $desc, '</p>';
521 521
 			}
522 522
 			echo '</div></div>';
523 523
 		}
524 524
 
525
-		if ( ! empty( $group_val ) ) {
526
-			foreach ( $group_val as $group_key => $field_id ) {
527
-				$this->render_group_row( $field_group );
525
+		if ( ! empty($group_val)) {
526
+			foreach ($group_val as $group_key => $field_id) {
527
+				$this->render_group_row($field_group);
528 528
 				$field_group->index++;
529 529
 			}
530 530
 		} else {
531
-			$this->render_group_row( $field_group );
531
+			$this->render_group_row($field_group);
532 532
 		}
533 533
 
534
-		if ( $field_group->args( 'repeatable' ) ) {
535
-			echo '<div class="cmb-row"><div class="cmb-td"><p class="cmb-add-row"><button type="button" data-selector="', esc_attr( $field_group->id() ), '_repeat" data-grouptitle="', esc_attr( $field_group->options( 'group_title' ) ), '" class="cmb-add-group-row button-secondary">', $field_group->options( 'add_button' ), '</button></p></div></div>';
534
+		if ($field_group->args('repeatable')) {
535
+			echo '<div class="cmb-row"><div class="cmb-td"><p class="cmb-add-row"><button type="button" data-selector="', esc_attr($field_group->id()), '_repeat" data-grouptitle="', esc_attr($field_group->options('group_title')), '" class="cmb-add-group-row button-secondary">', $field_group->options('add_button'), '</button></p></div></div>';
536 536
 		}
537 537
 
538 538
 		echo '</div></div></div>';
539 539
 
540
-		$field_group->peform_param_callback( 'after_group' );
540
+		$field_group->peform_param_callback('after_group');
541 541
 
542 542
 		return $field_group;
543 543
 	}
@@ -549,10 +549,10 @@  discard block
 block discarded – undo
549 549
 	 * @param  CMB2_Field $field_group The group CMB2_Field object.
550 550
 	 * @return string                  The attributes string.
551 551
 	 */
552
-	public function group_wrap_attributes( $field_group ) {
552
+	public function group_wrap_attributes($field_group) {
553 553
 		$classes = 'cmb-nested cmb-field-list cmb-repeatable-group';
554
-		$classes .= $field_group->options( 'sortable' ) ? ' sortable' : ' non-sortable';
555
-		$classes .= $field_group->args( 'repeatable' ) ? ' repeatable' : ' non-repeatable';
554
+		$classes .= $field_group->options('sortable') ? ' sortable' : ' non-sortable';
555
+		$classes .= $field_group->args('repeatable') ? ' repeatable' : ' non-repeatable';
556 556
 
557 557
 		$group_wrap_attributes = array(
558 558
 			'class' => $classes,
@@ -569,18 +569,18 @@  discard block
 block discarded – undo
569 569
 		 * @param string     $group_wrap_attributes Current attributes array.
570 570
 		 * @param CMB2_Field $field_group           The group CMB2_Field object.
571 571
 		 */
572
-		$group_wrap_attributes = apply_filters( 'cmb2_group_wrap_attributes', $group_wrap_attributes, $field_group );
572
+		$group_wrap_attributes = apply_filters('cmb2_group_wrap_attributes', $group_wrap_attributes, $field_group);
573 573
 
574 574
 		$atts = array();
575
-		foreach ( $group_wrap_attributes as $att => $att_value ) {
576
-			if ( ! CMB2_Utils::is_data_attribute( $att ) ) {
577
-				$att_value = htmlspecialchars( $att_value );
575
+		foreach ($group_wrap_attributes as $att => $att_value) {
576
+			if ( ! CMB2_Utils::is_data_attribute($att)) {
577
+				$att_value = htmlspecialchars($att_value);
578 578
 			}
579 579
 
580
-			$atts[ sanitize_html_class( $att ) ] = sanitize_text_field( $att_value );
580
+			$atts[sanitize_html_class($att)] = sanitize_text_field($att_value);
581 581
 		}
582 582
 
583
-		return CMB2_Utils::concat_attrs( $atts );
583
+		return CMB2_Utils::concat_attrs($atts);
584 584
 	}
585 585
 
586 586
 	/**
@@ -591,46 +591,46 @@  discard block
 block discarded – undo
591 591
 	 *
592 592
 	 * @return CMB2
593 593
 	 */
594
-	public function render_group_row( $field_group ) {
594
+	public function render_group_row($field_group) {
595 595
 
596
-		$field_group->peform_param_callback( 'before_group_row' );
597
-		$closed_class     = $field_group->options( 'closed' ) ? ' closed' : '';
598
-		$confirm_deletion = $field_group->options( 'remove_confirm' );
599
-		$confirm_deletion = ! empty( $confirm_deletion ) ? $confirm_deletion : '';
596
+		$field_group->peform_param_callback('before_group_row');
597
+		$closed_class     = $field_group->options('closed') ? ' closed' : '';
598
+		$confirm_deletion = $field_group->options('remove_confirm');
599
+		$confirm_deletion = ! empty($confirm_deletion) ? $confirm_deletion : '';
600 600
 
601 601
 		echo '
602 602
 		<div id="cmb-group-', $field_group->id(), '-', $field_group->index, '" class="postbox cmb-row cmb-repeatable-grouping', $closed_class, '" data-iterator="', $field_group->index, '">';
603 603
 
604
-		if ( $field_group->args( 'repeatable' ) ) {
605
-			echo '<button type="button" data-selector="', $field_group->id(), '_repeat" data-confirm="', esc_attr( $confirm_deletion ), '" class="dashicons-before dashicons-no-alt cmb-remove-group-row" title="', esc_attr( $field_group->options( 'remove_button' ) ), '"></button>';
604
+		if ($field_group->args('repeatable')) {
605
+			echo '<button type="button" data-selector="', $field_group->id(), '_repeat" data-confirm="', esc_attr($confirm_deletion), '" class="dashicons-before dashicons-no-alt cmb-remove-group-row" title="', esc_attr($field_group->options('remove_button')), '"></button>';
606 606
 		}
607 607
 
608 608
 			echo '
609
-			<div class="cmbhandle" title="' , esc_attr__( 'Click to toggle', 'cmb2' ), '"><br></div>
610
-			<h3 class="cmb-group-title cmbhandle-title"><span>', $field_group->replace_hash( $field_group->options( 'group_title' ) ), '</span></h3>
609
+			<div class="cmbhandle" title="' , esc_attr__('Click to toggle', 'cmb2'), '"><br></div>
610
+			<h3 class="cmb-group-title cmbhandle-title"><span>', $field_group->replace_hash($field_group->options('group_title')), '</span></h3>
611 611
 
612 612
 			<div class="inside cmb-td cmb-nested cmb-field-list">';
613 613
 				// Loop and render repeatable group fields.
614
-		foreach ( array_values( $field_group->args( 'fields' ) ) as $field_args ) {
615
-			if ( 'hidden' === $field_args['type'] ) {
614
+		foreach (array_values($field_group->args('fields')) as $field_args) {
615
+			if ('hidden' === $field_args['type']) {
616 616
 
617 617
 				// Save rendering for after the metabox.
618
-				$this->add_hidden_field( $field_args, $field_group );
618
+				$this->add_hidden_field($field_args, $field_group);
619 619
 
620 620
 			} else {
621 621
 
622
-				$field_args['show_names'] = $field_group->args( 'show_names' );
623
-				$field_args['context']    = $field_group->args( 'context' );
622
+				$field_args['show_names'] = $field_group->args('show_names');
623
+				$field_args['context']    = $field_group->args('context');
624 624
 
625
-				$this->get_field( $field_args, $field_group )->render_field();
625
+				$this->get_field($field_args, $field_group)->render_field();
626 626
 			}
627 627
 		}
628 628
 
629
-		if ( $field_group->args( 'repeatable' ) ) {
629
+		if ($field_group->args('repeatable')) {
630 630
 			echo '
631 631
 					<div class="cmb-row cmb-remove-field-row">
632 632
 						<div class="cmb-remove-row">
633
-							<button type="button" data-selector="', $field_group->id(), '_repeat" data-confirm="', esc_attr( $confirm_deletion ), '" class="cmb-remove-group-row cmb-remove-group-row-button alignright button-secondary">', $field_group->options( 'remove_button' ), '</button>
633
+							<button type="button" data-selector="', $field_group->id(), '_repeat" data-confirm="', esc_attr($confirm_deletion), '" class="cmb-remove-group-row cmb-remove-group-row-button alignright button-secondary">', $field_group->options('remove_button'), '</button>
634 634
 						</div>
635 635
 					</div>
636 636
 					';
@@ -640,7 +640,7 @@  discard block
 block discarded – undo
640 640
 		</div>
641 641
 		';
642 642
 
643
-		$field_group->peform_param_callback( 'after_group_row' );
643
+		$field_group->peform_param_callback('after_group_row');
644 644
 
645 645
 		return $this;
646 646
 	}
@@ -654,17 +654,17 @@  discard block
 block discarded – undo
654 654
 	 * @param CMB2_Field|null $field_group CMB2_Field group field object.
655 655
 	 * @return CMB2_Field
656 656
 	 */
657
-	public function add_hidden_field( $field_args, $field_group = null ) {
658
-		if ( isset( $field_args['field_args'] ) ) {
657
+	public function add_hidden_field($field_args, $field_group = null) {
658
+		if (isset($field_args['field_args'])) {
659 659
 			// For back-compatibility.
660
-			$field = new CMB2_Field( $field_args );
660
+			$field = new CMB2_Field($field_args);
661 661
 		} else {
662
-			$field = $this->get_new_field( $field_args, $field_group );
662
+			$field = $this->get_new_field($field_args, $field_group);
663 663
 		}
664 664
 
665
-		$types = new CMB2_Types( $field );
665
+		$types = new CMB2_Types($field);
666 666
 
667
-		if ( $field_group ) {
667
+		if ($field_group) {
668 668
 			$types->iterator = $field_group->index;
669 669
 		}
670 670
 
@@ -681,8 +681,8 @@  discard block
 block discarded – undo
681 681
 	 * @return CMB2
682 682
 	 */
683 683
 	public function render_hidden_fields() {
684
-		if ( ! empty( $this->hidden_fields ) ) {
685
-			foreach ( $this->hidden_fields as $hidden ) {
684
+		if ( ! empty($this->hidden_fields)) {
685
+			foreach ($this->hidden_fields as $hidden) {
686 686
 				$hidden->render();
687 687
 			}
688 688
 		}
@@ -697,33 +697,33 @@  discard block
 block discarded – undo
697 697
 	 * @param  array $data_to_sanitize Array of field_id => value data for sanitizing (likely $_POST data).
698 698
 	 * @return mixed
699 699
 	 */
700
-	public function get_sanitized_values( array $data_to_sanitize ) {
700
+	public function get_sanitized_values(array $data_to_sanitize) {
701 701
 		$this->data_to_save = $data_to_sanitize;
702 702
 		$stored_id          = $this->object_id();
703 703
 
704 704
 		// We do this So CMB will sanitize our data for us, but not save it.
705
-		$this->object_id( '_' );
705
+		$this->object_id('_');
706 706
 
707 707
 		// Ensure temp. data store is empty.
708
-		cmb2_options( 0 )->set();
708
+		cmb2_options(0)->set();
709 709
 
710 710
 		// We want to get any taxonomy values back.
711
-		add_filter( "cmb2_return_taxonomy_values_{$this->cmb_id}", '__return_true' );
711
+		add_filter("cmb2_return_taxonomy_values_{$this->cmb_id}", '__return_true');
712 712
 
713 713
 		// Process/save fields.
714 714
 		$this->process_fields();
715 715
 
716 716
 		// Put things back the way they were.
717
-		remove_filter( "cmb2_return_taxonomy_values_{$this->cmb_id}", '__return_true' );
717
+		remove_filter("cmb2_return_taxonomy_values_{$this->cmb_id}", '__return_true');
718 718
 
719 719
 		// Get data from temp. data store.
720
-		$sanitized_values = cmb2_options( 0 )->get_options();
720
+		$sanitized_values = cmb2_options(0)->get_options();
721 721
 
722 722
 		// Empty out temp. data store again.
723
-		cmb2_options( 0 )->set();
723
+		cmb2_options(0)->set();
724 724
 
725 725
 		// Reset the object id.
726
-		$this->object_id( $stored_id );
726
+		$this->object_id($stored_id);
727 727
 
728 728
 		return $sanitized_values;
729 729
 	}
@@ -738,18 +738,18 @@  discard block
 block discarded – undo
738 738
 	 *
739 739
 	 * @return CMB2
740 740
 	 */
741
-	public function save_fields( $object_id = 0, $object_type = '', $data_to_save = array() ) {
741
+	public function save_fields($object_id = 0, $object_type = '', $data_to_save = array()) {
742 742
 
743 743
 		// Fall-back to $_POST data.
744
-		$this->data_to_save = ! empty( $data_to_save ) ? $data_to_save : $_POST;
745
-		$object_id = $this->object_id( $object_id );
746
-		$object_type = $this->object_type( $object_type );
744
+		$this->data_to_save = ! empty($data_to_save) ? $data_to_save : $_POST;
745
+		$object_id = $this->object_id($object_id);
746
+		$object_type = $this->object_type($object_type);
747 747
 
748 748
 		$this->process_fields();
749 749
 
750 750
 		// If options page, save the updated options.
751
-		if ( 'options-page' === $object_type ) {
752
-			cmb2_options( $object_id )->set();
751
+		if ('options-page' === $object_type) {
752
+			cmb2_options($object_id)->set();
753 753
 		}
754 754
 
755 755
 		return $this->after_save();
@@ -767,13 +767,13 @@  discard block
 block discarded – undo
767 767
 		$this->pre_process();
768 768
 
769 769
 		// Remove the show_on properties so saving works.
770
-		$this->prop( 'show_on', array() );
770
+		$this->prop('show_on', array());
771 771
 
772 772
 		// save field ids of those that are updated.
773 773
 		$this->updated = array();
774 774
 
775
-		foreach ( $this->prop( 'fields' ) as $field_args ) {
776
-			$this->process_field( $field_args );
775
+		foreach ($this->prop('fields') as $field_args) {
776
+			$this->process_field($field_args);
777 777
 		}
778 778
 
779 779
 		return $this;
@@ -787,12 +787,12 @@  discard block
 block discarded – undo
787 787
 	 *
788 788
 	 * @return CMB2
789 789
 	 */
790
-	public function process_field( $field_args ) {
790
+	public function process_field($field_args) {
791 791
 
792
-		switch ( $field_args['type'] ) {
792
+		switch ($field_args['type']) {
793 793
 
794 794
 			case 'group':
795
-				if ( $this->save_group( $field_args ) ) {
795
+				if ($this->save_group($field_args)) {
796 796
 					$this->updated[] = $field_args['id'];
797 797
 				}
798 798
 
@@ -803,9 +803,9 @@  discard block
 block discarded – undo
803 803
 				break;
804 804
 
805 805
 			default:
806
-				$field = $this->get_new_field( $field_args );
806
+				$field = $this->get_new_field($field_args);
807 807
 
808
-				if ( $field->save_field_from_data( $this->data_to_save ) ) {
808
+				if ($field->save_field_from_data($this->data_to_save)) {
809 809
 					$this->updated[] = $field->id();
810 810
 				}
811 811
 
@@ -838,7 +838,7 @@  discard block
 block discarded – undo
838 838
 		 * @param array $cmb       This CMB2 object
839 839
 		 * @param int   $object_id The ID of the current object
840 840
 		 */
841
-		do_action( "cmb2_{$object_type}_process_fields_{$this->cmb_id}", $this, $this->object_id() );
841
+		do_action("cmb2_{$object_type}_process_fields_{$this->cmb_id}", $this, $this->object_id());
842 842
 
843 843
 		return $this;
844 844
 	}
@@ -868,7 +868,7 @@  discard block
 block discarded – undo
868 868
 		 *                            Will only include field ids that had values change.
869 869
 		 * @param array  $cmb         This CMB2 object
870 870
 		 */
871
-		do_action( "cmb2_save_{$object_type}_fields", $object_id, $this->cmb_id, $this->updated, $this );
871
+		do_action("cmb2_save_{$object_type}_fields", $object_id, $this->cmb_id, $this->updated, $this);
872 872
 
873 873
 		/**
874 874
 		 * Fires after all fields have been saved.
@@ -884,7 +884,7 @@  discard block
 block discarded – undo
884 884
 		 *                            Will only include field ids that had values change.
885 885
 		 * @param array  $cmb         This CMB2 object
886 886
 		 */
887
-		do_action( "cmb2_save_{$object_type}_fields_{$this->cmb_id}", $object_id, $this->updated, $this );
887
+		do_action("cmb2_save_{$object_type}_fields_{$this->cmb_id}", $object_id, $this->updated, $this);
888 888
 
889 889
 		return $this;
890 890
 	}
@@ -896,12 +896,12 @@  discard block
 block discarded – undo
896 896
 	 * @param  array $args Field arguments array.
897 897
 	 * @return mixed        Return of CMB2_Field::update_data().
898 898
 	 */
899
-	public function save_group( $args ) {
900
-		if ( ! isset( $args['id'], $args['fields'] ) || ! is_array( $args['fields'] ) ) {
899
+	public function save_group($args) {
900
+		if ( ! isset($args['id'], $args['fields']) || ! is_array($args['fields'])) {
901 901
 			return;
902 902
 		}
903 903
 
904
-		return $this->save_group_field( $this->get_new_field( $args ) );
904
+		return $this->save_group_field($this->get_new_field($args));
905 905
 	}
906 906
 
907 907
 	/**
@@ -911,85 +911,85 @@  discard block
 block discarded – undo
911 911
 	 * @param  CMB2_Field $field_group CMB2_Field group field object.
912 912
 	 * @return mixed                   Return of CMB2_Field::update_data().
913 913
 	 */
914
-	public function save_group_field( $field_group ) {
914
+	public function save_group_field($field_group) {
915 915
 		$base_id = $field_group->id();
916 916
 
917
-		if ( ! isset( $this->data_to_save[ $base_id ] ) ) {
917
+		if ( ! isset($this->data_to_save[$base_id])) {
918 918
 			return;
919 919
 		}
920 920
 
921 921
 		$old        = $field_group->get_data();
922 922
 		// Check if group field has sanitization_cb.
923
-		$group_vals = $field_group->sanitization_cb( $this->data_to_save[ $base_id ] );
923
+		$group_vals = $field_group->sanitization_cb($this->data_to_save[$base_id]);
924 924
 		$saved      = array();
925 925
 
926 926
 		$field_group->index = 0;
927 927
 		$field_group->data_to_save = $this->data_to_save;
928 928
 
929
-		foreach ( array_values( $field_group->fields() ) as $field_args ) {
930
-			if ( 'title' === $field_args['type'] ) {
929
+		foreach (array_values($field_group->fields()) as $field_args) {
930
+			if ('title' === $field_args['type']) {
931 931
 				// Don't process title fields.
932 932
 				continue;
933 933
 			}
934 934
 
935
-			$field  = $this->get_new_field( $field_args, $field_group );
936
-			$sub_id = $field->id( true );
937
-			if ( empty( $saved[ $field_group->index ] ) ) {
938
-				$saved[ $field_group->index ] = array();
935
+			$field  = $this->get_new_field($field_args, $field_group);
936
+			$sub_id = $field->id(true);
937
+			if (empty($saved[$field_group->index])) {
938
+				$saved[$field_group->index] = array();
939 939
 			}
940 940
 
941
-			foreach ( (array) $group_vals as $field_group->index => $post_vals ) {
941
+			foreach ((array) $group_vals as $field_group->index => $post_vals) {
942 942
 
943 943
 				// Get value.
944
-				$new_val = isset( $group_vals[ $field_group->index ][ $sub_id ] )
945
-					? $group_vals[ $field_group->index ][ $sub_id ]
944
+				$new_val = isset($group_vals[$field_group->index][$sub_id])
945
+					? $group_vals[$field_group->index][$sub_id]
946 946
 					: false;
947 947
 
948 948
 				// Sanitize.
949
-				$new_val = $field->sanitization_cb( $new_val );
949
+				$new_val = $field->sanitization_cb($new_val);
950 950
 
951
-				if ( is_array( $new_val ) && $field->args( 'has_supporting_data' ) ) {
952
-					if ( $field->args( 'repeatable' ) ) {
951
+				if (is_array($new_val) && $field->args('has_supporting_data')) {
952
+					if ($field->args('repeatable')) {
953 953
 						$_new_val = array();
954
-						foreach ( $new_val as $group_index => $grouped_data ) {
954
+						foreach ($new_val as $group_index => $grouped_data) {
955 955
 							// Add the supporting data to the $saved array stack.
956
-							$saved[ $field_group->index ][ $grouped_data['supporting_field_id'] ][] = $grouped_data['supporting_field_value'];
956
+							$saved[$field_group->index][$grouped_data['supporting_field_id']][] = $grouped_data['supporting_field_value'];
957 957
 							// Reset var to the actual value.
958
-							$_new_val[ $group_index ] = $grouped_data['value'];
958
+							$_new_val[$group_index] = $grouped_data['value'];
959 959
 						}
960 960
 						$new_val = $_new_val;
961 961
 					} else {
962 962
 						// Add the supporting data to the $saved array stack.
963
-						$saved[ $field_group->index ][ $new_val['supporting_field_id'] ] = $new_val['supporting_field_value'];
963
+						$saved[$field_group->index][$new_val['supporting_field_id']] = $new_val['supporting_field_value'];
964 964
 						// Reset var to the actual value.
965 965
 						$new_val = $new_val['value'];
966 966
 					}
967 967
 				}
968 968
 
969 969
 				// Get old value.
970
-				$old_val = is_array( $old ) && isset( $old[ $field_group->index ][ $sub_id ] )
971
-					? $old[ $field_group->index ][ $sub_id ]
970
+				$old_val = is_array($old) && isset($old[$field_group->index][$sub_id])
971
+					? $old[$field_group->index][$sub_id]
972 972
 					: false;
973 973
 
974
-				$is_updated = ( ! CMB2_Utils::isempty( $new_val ) && $new_val !== $old_val );
975
-				$is_removed = ( CMB2_Utils::isempty( $new_val ) && ! CMB2_Utils::isempty( $old_val ) );
974
+				$is_updated = ( ! CMB2_Utils::isempty($new_val) && $new_val !== $old_val);
975
+				$is_removed = (CMB2_Utils::isempty($new_val) && ! CMB2_Utils::isempty($old_val));
976 976
 
977 977
 				// Compare values and add to `$updated` array.
978
-				if ( $is_updated || $is_removed ) {
978
+				if ($is_updated || $is_removed) {
979 979
 					$this->updated[] = $base_id . '::' . $field_group->index . '::' . $sub_id;
980 980
 				}
981 981
 
982 982
 				// Add to `$saved` array.
983
-				$saved[ $field_group->index ][ $sub_id ] = $new_val;
983
+				$saved[$field_group->index][$sub_id] = $new_val;
984 984
 
985 985
 			}// End foreach.
986 986
 
987
-			$saved[ $field_group->index ] = CMB2_Utils::filter_empty( $saved[ $field_group->index ] );
987
+			$saved[$field_group->index] = CMB2_Utils::filter_empty($saved[$field_group->index]);
988 988
 		}// End foreach.
989 989
 
990
-		$saved = CMB2_Utils::filter_empty( $saved );
990
+		$saved = CMB2_Utils::filter_empty($saved);
991 991
 
992
-		return $field_group->update_data( $saved, true );
992
+		return $field_group->update_data($saved, true);
993 993
 	}
994 994
 
995 995
 	/**
@@ -999,44 +999,44 @@  discard block
 block discarded – undo
999 999
 	 * @param  integer|string $object_id Object ID.
1000 1000
 	 * @return integer|string $object_id Object ID.
1001 1001
 	 */
1002
-	public function object_id( $object_id = 0 ) {
1002
+	public function object_id($object_id = 0) {
1003 1003
 		global $pagenow;
1004 1004
 
1005
-		if ( $object_id ) {
1005
+		if ($object_id) {
1006 1006
 			$this->object_id = $object_id;
1007 1007
 			return $this->object_id;
1008 1008
 		}
1009 1009
 
1010
-		if ( $this->object_id ) {
1010
+		if ($this->object_id) {
1011 1011
 			return $this->object_id;
1012 1012
 		}
1013 1013
 
1014 1014
 		// Try to get our object ID from the global space.
1015
-		switch ( $this->object_type() ) {
1015
+		switch ($this->object_type()) {
1016 1016
 			case 'user':
1017
-				$object_id = isset( $_REQUEST['user_id'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['user_id'] ) ) : $object_id;
1018
-				$object_id = ! $object_id && 'user-new.php' !== $pagenow && isset( $GLOBALS['user_ID'] ) ? $GLOBALS['user_ID'] : $object_id;
1017
+				$object_id = isset($_REQUEST['user_id']) ? sanitize_text_field(wp_unslash($_REQUEST['user_id'])) : $object_id;
1018
+				$object_id = ! $object_id && 'user-new.php' !== $pagenow && isset($GLOBALS['user_ID']) ? $GLOBALS['user_ID'] : $object_id;
1019 1019
 				break;
1020 1020
 
1021 1021
 			case 'comment':
1022
-				$object_id = isset( $_REQUEST['c'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['c'] ) ) : $object_id;
1023
-				$object_id = ! $object_id && isset( $GLOBALS['comments']->comment_ID ) ? $GLOBALS['comments']->comment_ID : $object_id;
1022
+				$object_id = isset($_REQUEST['c']) ? sanitize_text_field(wp_unslash($_REQUEST['c'])) : $object_id;
1023
+				$object_id = ! $object_id && isset($GLOBALS['comments']->comment_ID) ? $GLOBALS['comments']->comment_ID : $object_id;
1024 1024
 				break;
1025 1025
 
1026 1026
 			case 'term':
1027
-				$object_id = isset( $_REQUEST['tag_ID'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['tag_ID'] ) ) : $object_id;
1027
+				$object_id = isset($_REQUEST['tag_ID']) ? sanitize_text_field(wp_unslash($_REQUEST['tag_ID'])) : $object_id;
1028 1028
 				break;
1029 1029
 
1030 1030
 			case 'options-page':
1031 1031
 				$key = $this->doing_options_page();
1032
-				if ( ! empty( $key ) ) {
1032
+				if ( ! empty($key)) {
1033 1033
 					$object_id = $key;
1034 1034
 				}
1035 1035
 				break;
1036 1036
 
1037 1037
 			default:
1038
-				$object_id = isset( $GLOBALS['post']->ID ) ? $GLOBALS['post']->ID : $object_id;
1039
-				$object_id = isset( $_REQUEST['post'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['post'] ) ) : $object_id;
1038
+				$object_id = isset($GLOBALS['post']->ID) ? $GLOBALS['post']->ID : $object_id;
1039
+				$object_id = isset($_REQUEST['post']) ? sanitize_text_field(wp_unslash($_REQUEST['post'])) : $object_id;
1040 1040
 				break;
1041 1041
 		}
1042 1042
 
@@ -1053,11 +1053,11 @@  discard block
 block discarded – undo
1053 1053
 	 * @return string Object type.
1054 1054
 	 */
1055 1055
 	public function mb_object_type() {
1056
-		if ( null !== $this->mb_object_type ) {
1056
+		if (null !== $this->mb_object_type) {
1057 1057
 			return $this->mb_object_type;
1058 1058
 		}
1059 1059
 
1060
-		if ( $this->is_options_page_mb() ) {
1060
+		if ($this->is_options_page_mb()) {
1061 1061
 			$this->mb_object_type = 'options-page';
1062 1062
 			return $this->mb_object_type;
1063 1063
 		}
@@ -1067,17 +1067,17 @@  discard block
 block discarded – undo
1067 1067
 		$type = '';
1068 1068
 
1069 1069
 		// if it's an array of one, extract it.
1070
-		if ( 1 === count( $registered_types ) ) {
1071
-			$last = end( $registered_types );
1072
-			if ( is_string( $last ) ) {
1070
+		if (1 === count($registered_types)) {
1071
+			$last = end($registered_types);
1072
+			if (is_string($last)) {
1073 1073
 				$type = $last;
1074 1074
 			}
1075
-		} elseif ( ( $curr_type = $this->current_object_type() ) && in_array( $curr_type, $registered_types, true ) ) {
1075
+		} elseif (($curr_type = $this->current_object_type()) && in_array($curr_type, $registered_types, true)) {
1076 1076
 			$type = $curr_type;
1077 1077
 		}
1078 1078
 
1079 1079
 		// Get our object type.
1080
-		switch ( $type ) {
1080
+		switch ($type) {
1081 1081
 
1082 1082
 			case 'user':
1083 1083
 			case 'comment':
@@ -1101,8 +1101,8 @@  discard block
 block discarded – undo
1101 1101
 	 *
1102 1102
 	 * @return array Object types.
1103 1103
 	 */
1104
-	public function box_types( $fallback = array() ) {
1105
-		return CMB2_Utils::ensure_array( $this->prop( 'object_types' ), $fallback );
1104
+	public function box_types($fallback = array()) {
1105
+		return CMB2_Utils::ensure_array($this->prop('object_types'), $fallback);
1106 1106
 	}
1107 1107
 
1108 1108
 	/**
@@ -1115,18 +1115,18 @@  discard block
 block discarded – undo
1115 1115
 	 *
1116 1116
 	 * @return bool Whether given object type(s) are registered to this box.
1117 1117
 	 */
1118
-	public function is_box_type( $object_types = array(), $fallback = array() ) {
1118
+	public function is_box_type($object_types = array(), $fallback = array()) {
1119 1119
 		$object_types = (array) $object_types;
1120
-		$box_types    = $this->box_types( $fallback );
1120
+		$box_types    = $this->box_types($fallback);
1121 1121
 
1122
-		if ( in_array( 'term', $box_types, true ) ) {
1123
-			$taxonomies = CMB2_Utils::ensure_array( $this->prop( 'taxonomies' ) );
1124
-			$box_types = array_merge( $box_types, $taxonomies );
1122
+		if (in_array('term', $box_types, true)) {
1123
+			$taxonomies = CMB2_Utils::ensure_array($this->prop('taxonomies'));
1124
+			$box_types = array_merge($box_types, $taxonomies);
1125 1125
 		}
1126 1126
 
1127
-		$found = array_intersect( $object_types, $box_types );
1127
+		$found = array_intersect($object_types, $box_types);
1128 1128
 
1129
-		return ! empty( $found );
1129
+		return ! empty($found);
1130 1130
 	}
1131 1131
 
1132 1132
 	/**
@@ -1140,9 +1140,9 @@  discard block
 block discarded – undo
1140 1140
 		$keys  = $this->options_page_keys();
1141 1141
 		$types = $this->box_types();
1142 1142
 
1143
-		if ( empty( $keys ) ) {
1143
+		if (empty($keys)) {
1144 1144
 			$keys = '';
1145
-			$types = $this->deinit_options_mb( $types );
1145
+			$types = $this->deinit_options_mb($types);
1146 1146
 		} else {
1147 1147
 
1148 1148
 			// Make sure 'options-page' is one of the object types.
@@ -1150,10 +1150,10 @@  discard block
 block discarded – undo
1150 1150
 		}
1151 1151
 
1152 1152
 		// Set/Reset the option_key property.
1153
-		$this->set_prop( 'option_key', $keys );
1153
+		$this->set_prop('option_key', $keys);
1154 1154
 
1155 1155
 		// Reset the object types.
1156
-		$this->set_prop( 'object_types', array_unique( $types ) );
1156
+		$this->set_prop('object_types', array_unique($types));
1157 1157
 	}
1158 1158
 
1159 1159
 	/**
@@ -1164,19 +1164,19 @@  discard block
 block discarded – undo
1164 1164
 	 * @param array $types Array of types.
1165 1165
 	 * @return array
1166 1166
 	 */
1167
-	protected function deinit_options_mb( $types ) {
1168
-		if ( isset( $this->meta_box['show_on']['key'] ) && 'options-page' === $this->meta_box['show_on']['key'] ) {
1169
-			unset( $this->meta_box['show_on']['key'] );
1167
+	protected function deinit_options_mb($types) {
1168
+		if (isset($this->meta_box['show_on']['key']) && 'options-page' === $this->meta_box['show_on']['key']) {
1169
+			unset($this->meta_box['show_on']['key']);
1170 1170
 		}
1171 1171
 
1172
-		if ( array_key_exists( 'options-page', $this->meta_box['show_on'] ) ) {
1173
-			unset( $this->meta_box['show_on']['options-page'] );
1172
+		if (array_key_exists('options-page', $this->meta_box['show_on'])) {
1173
+			unset($this->meta_box['show_on']['options-page']);
1174 1174
 		}
1175 1175
 
1176
-		$index = array_search( 'options-page', $types );
1176
+		$index = array_search('options-page', $types);
1177 1177
 
1178
-		if ( false !== $index ) {
1179
-			unset( $types[ $index ] );
1178
+		if (false !== $index) {
1179
+			unset($types[$index]);
1180 1180
 		}
1181 1181
 
1182 1182
 		return $types;
@@ -1192,7 +1192,7 @@  discard block
 block discarded – undo
1192 1192
 		return (
1193 1193
 			// 'show_on' values checked for back-compatibility.
1194 1194
 			$this->is_old_school_options_page_mb()
1195
-			|| in_array( 'options-page', $this->box_types() )
1195
+			|| in_array('options-page', $this->box_types())
1196 1196
 		);
1197 1197
 	}
1198 1198
 
@@ -1205,8 +1205,8 @@  discard block
 block discarded – undo
1205 1205
 	public function is_old_school_options_page_mb() {
1206 1206
 		return (
1207 1207
 			// 'show_on' values checked for back-compatibility.
1208
-			isset( $this->meta_box['show_on']['key'] ) && 'options-page' === $this->meta_box['show_on']['key']
1209
-			|| array_key_exists( 'options-page', $this->meta_box['show_on'] )
1208
+			isset($this->meta_box['show_on']['key']) && 'options-page' === $this->meta_box['show_on']['key']
1209
+			|| array_key_exists('options-page', $this->meta_box['show_on'])
1210 1210
 		);
1211 1211
 	}
1212 1212
 
@@ -1221,15 +1221,15 @@  discard block
 block discarded – undo
1221 1221
 		$found_key = false;
1222 1222
 		$keys = $this->options_page_keys();
1223 1223
 
1224
-		if ( empty( $keys ) ) {
1224
+		if (empty($keys)) {
1225 1225
 			return $found_key;
1226 1226
 		}
1227 1227
 
1228
-		if ( ! empty( $_GET['page'] ) && in_array( $_GET['page'], $keys ) ) {
1228
+		if ( ! empty($_GET['page']) && in_array($_GET['page'], $keys)) {
1229 1229
 			$found_key = $_GET['page'];
1230 1230
 		}
1231 1231
 
1232
-		if ( ! empty( $_POST['action'] ) && in_array( $_POST['action'], $keys ) ) {
1232
+		if ( ! empty($_POST['action']) && in_array($_POST['action'], $keys)) {
1233 1233
 			$found_key = $_POST['action'];
1234 1234
 		}
1235 1235
 
@@ -1244,25 +1244,25 @@  discard block
 block discarded – undo
1244 1244
 	 */
1245 1245
 	public function options_page_keys() {
1246 1246
 		$key = '';
1247
-		if ( ! $this->is_options_page_mb() ) {
1247
+		if ( ! $this->is_options_page_mb()) {
1248 1248
 			return $key;
1249 1249
 		}
1250 1250
 
1251 1251
 		$values = null;
1252
-		if ( ! empty( $this->meta_box['show_on']['value'] ) ) {
1252
+		if ( ! empty($this->meta_box['show_on']['value'])) {
1253 1253
 			$values = $this->meta_box['show_on']['value'];
1254
-		} elseif ( ! empty( $this->meta_box['show_on']['options-page'] ) ) {
1254
+		} elseif ( ! empty($this->meta_box['show_on']['options-page'])) {
1255 1255
 			$values = $this->meta_box['show_on']['options-page'];
1256
-		} elseif ( $this->prop( 'option_key' ) ) {
1257
-			$values = $this->prop( 'option_key' );
1256
+		} elseif ($this->prop('option_key')) {
1257
+			$values = $this->prop('option_key');
1258 1258
 		}
1259 1259
 
1260
-		if ( $values ) {
1260
+		if ($values) {
1261 1261
 			$key = $values;
1262 1262
 		}
1263 1263
 
1264
-		if ( ! is_array( $key ) ) {
1265
-			$key = array( $key );
1264
+		if ( ! is_array($key)) {
1265
+			$key = array($key);
1266 1266
 		}
1267 1267
 
1268 1268
 		return $key;
@@ -1275,13 +1275,13 @@  discard block
 block discarded – undo
1275 1275
 	 * @param string $object_type Type of object being saved. (e.g., post, user, or comment). Optional.
1276 1276
 	 * @return string Object type.
1277 1277
 	 */
1278
-	public function object_type( $object_type = '' ) {
1279
-		if ( $object_type ) {
1278
+	public function object_type($object_type = '') {
1279
+		if ($object_type) {
1280 1280
 			$this->object_type = $object_type;
1281 1281
 			return $this->object_type;
1282 1282
 		}
1283 1283
 
1284
-		if ( $this->object_type ) {
1284
+		if ($this->object_type) {
1285 1285
 			return $this->object_type;
1286 1286
 		}
1287 1287
 
@@ -1300,24 +1300,24 @@  discard block
 block discarded – undo
1300 1300
 		global $pagenow;
1301 1301
 		$type = 'post';
1302 1302
 
1303
-		if ( in_array( $pagenow, array( 'user-edit.php', 'profile.php', 'user-new.php' ), true ) ) {
1303
+		if (in_array($pagenow, array('user-edit.php', 'profile.php', 'user-new.php'), true)) {
1304 1304
 			$type = 'user';
1305 1305
 		}
1306 1306
 
1307
-		if ( in_array( $pagenow, array( 'edit-comments.php', 'comment.php' ), true ) ) {
1307
+		if (in_array($pagenow, array('edit-comments.php', 'comment.php'), true)) {
1308 1308
 			$type = 'comment';
1309 1309
 		}
1310 1310
 
1311
-		if ( in_array( $pagenow, array( 'edit-tags.php', 'term.php' ), true ) ) {
1311
+		if (in_array($pagenow, array('edit-tags.php', 'term.php'), true)) {
1312 1312
 			$type = 'term';
1313 1313
 		}
1314 1314
 
1315
-		if ( defined( 'DOING_AJAX' ) && isset( $_POST['action'] ) && 'add-tag' === $_POST['action'] ) {
1315
+		if (defined('DOING_AJAX') && isset($_POST['action']) && 'add-tag' === $_POST['action']) {
1316 1316
 			$type = 'term';
1317 1317
 		}
1318 1318
 
1319 1319
 		if (
1320
-			in_array( $pagenow, array( 'admin.php', 'admin-post.php' ), true )
1320
+			in_array($pagenow, array('admin.php', 'admin-post.php'), true)
1321 1321
 			&& $this->doing_options_page()
1322 1322
 		) {
1323 1323
 			$type = 'options-page';
@@ -1334,10 +1334,10 @@  discard block
 block discarded – undo
1334 1334
 	 * @param  mixed  $value    Value to set if no value found.
1335 1335
 	 * @return mixed            Metabox config property value or false.
1336 1336
 	 */
1337
-	public function set_prop( $property, $value ) {
1338
-		$this->meta_box[ $property ] = $value;
1337
+	public function set_prop($property, $value) {
1338
+		$this->meta_box[$property] = $value;
1339 1339
 
1340
-		return $this->prop( $property );
1340
+		return $this->prop($property);
1341 1341
 	}
1342 1342
 
1343 1343
 	/**
@@ -1348,11 +1348,11 @@  discard block
 block discarded – undo
1348 1348
 	 * @param  mixed  $fallback Fallback value to set if no value found.
1349 1349
 	 * @return mixed            Metabox config property value or false.
1350 1350
 	 */
1351
-	public function prop( $property, $fallback = null ) {
1352
-		if ( array_key_exists( $property, $this->meta_box ) ) {
1353
-			return $this->meta_box[ $property ];
1354
-		} elseif ( $fallback ) {
1355
-			return $this->meta_box[ $property ] = $fallback;
1351
+	public function prop($property, $fallback = null) {
1352
+		if (array_key_exists($property, $this->meta_box)) {
1353
+			return $this->meta_box[$property];
1354
+		} elseif ($fallback) {
1355
+			return $this->meta_box[$property] = $fallback;
1356 1356
 		}
1357 1357
 	}
1358 1358
 
@@ -1367,31 +1367,31 @@  discard block
 block discarded – undo
1367 1367
 	 *
1368 1368
 	 * @return CMB2_Field|false                     CMB2_Field object (or false).
1369 1369
 	 */
1370
-	public function get_field( $field, $field_group = null, $reset_cached = false ) {
1371
-		if ( $field instanceof CMB2_Field ) {
1370
+	public function get_field($field, $field_group = null, $reset_cached = false) {
1371
+		if ($field instanceof CMB2_Field) {
1372 1372
 			return $field;
1373 1373
 		}
1374 1374
 
1375
-		$field_id = is_string( $field ) ? $field : $field['id'];
1375
+		$field_id = is_string($field) ? $field : $field['id'];
1376 1376
 
1377
-		$parent_field_id = ! empty( $field_group ) ? $field_group->id() : '';
1378
-		$ids = $this->get_field_ids( $field_id, $parent_field_id );
1377
+		$parent_field_id = ! empty($field_group) ? $field_group->id() : '';
1378
+		$ids = $this->get_field_ids($field_id, $parent_field_id);
1379 1379
 
1380
-		if ( ! $ids ) {
1380
+		if ( ! $ids) {
1381 1381
 			return false;
1382 1382
 		}
1383 1383
 
1384
-		list( $field_id, $sub_field_id ) = $ids;
1384
+		list($field_id, $sub_field_id) = $ids;
1385 1385
 
1386
-		$index = implode( '', $ids ) . ( $field_group ? $field_group->index : '' );
1386
+		$index = implode('', $ids) . ($field_group ? $field_group->index : '');
1387 1387
 
1388
-		if ( array_key_exists( $index, $this->fields ) && ! $reset_cached ) {
1389
-			return $this->fields[ $index ];
1388
+		if (array_key_exists($index, $this->fields) && ! $reset_cached) {
1389
+			return $this->fields[$index];
1390 1390
 		}
1391 1391
 
1392
-		$this->fields[ $index ] = new CMB2_Field( $this->get_field_args( $field_id, $field, $sub_field_id, $field_group ) );
1392
+		$this->fields[$index] = new CMB2_Field($this->get_field_args($field_id, $field, $sub_field_id, $field_group));
1393 1393
 
1394
-		return $this->fields[ $index ];
1394
+		return $this->fields[$index];
1395 1395
 	}
1396 1396
 
1397 1397
 	/**
@@ -1404,22 +1404,22 @@  discard block
 block discarded – undo
1404 1404
 	 * @param  CMB2_Field|null $field_group  If a sub-field, will be the parent group CMB2_Field object.
1405 1405
 	 * @return array                         Array of CMB2_Field arguments.
1406 1406
 	 */
1407
-	public function get_field_args( $field_id, $field_args, $sub_field_id, $field_group ) {
1407
+	public function get_field_args($field_id, $field_args, $sub_field_id, $field_group) {
1408 1408
 
1409 1409
 		// Check if group is passed and if fields were added in the old-school fields array.
1410
-		if ( $field_group && ( $sub_field_id || 0 === $sub_field_id ) ) {
1410
+		if ($field_group && ($sub_field_id || 0 === $sub_field_id)) {
1411 1411
 
1412 1412
 			// Update the fields array w/ any modified properties inherited from the group field.
1413
-			$this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] = $field_args;
1413
+			$this->meta_box['fields'][$field_id]['fields'][$sub_field_id] = $field_args;
1414 1414
 
1415
-			return $this->get_default_args( $field_args, $field_group );
1415
+			return $this->get_default_args($field_args, $field_group);
1416 1416
 		}
1417 1417
 
1418
-		if ( is_array( $field_args ) ) {
1419
-			$this->meta_box['fields'][ $field_id ] = array_merge( $field_args, $this->meta_box['fields'][ $field_id ] );
1418
+		if (is_array($field_args)) {
1419
+			$this->meta_box['fields'][$field_id] = array_merge($field_args, $this->meta_box['fields'][$field_id]);
1420 1420
 		}
1421 1421
 
1422
-		return $this->get_default_args( $this->meta_box['fields'][ $field_id ] );
1422
+		return $this->get_default_args($this->meta_box['fields'][$field_id]);
1423 1423
 	}
1424 1424
 
1425 1425
 	/**
@@ -1430,8 +1430,8 @@  discard block
 block discarded – undo
1430 1430
 	 * @param  CMB2_Field $field_group (optional) CMB2_Field object (group parent).
1431 1431
 	 * @return array                   Array of field arguments.
1432 1432
 	 */
1433
-	protected function get_default_args( $field_args, $field_group = null ) {
1434
-		if ( $field_group ) {
1433
+	protected function get_default_args($field_args, $field_group = null) {
1434
+		if ($field_group) {
1435 1435
 			$args = array(
1436 1436
 				'field_args'  => $field_args,
1437 1437
 				'group_field' => $field_group,
@@ -1457,21 +1457,21 @@  discard block
 block discarded – undo
1457 1457
 	 *
1458 1458
 	 * @return CMB2
1459 1459
 	 */
1460
-	protected function add_fields( $fields, $parent_field_id = null ) {
1461
-		foreach ( $fields as $field ) {
1460
+	protected function add_fields($fields, $parent_field_id = null) {
1461
+		foreach ($fields as $field) {
1462 1462
 
1463 1463
 			$sub_fields = false;
1464
-			if ( array_key_exists( 'fields', $field ) ) {
1464
+			if (array_key_exists('fields', $field)) {
1465 1465
 				$sub_fields = $field['fields'];
1466
-				unset( $field['fields'] );
1466
+				unset($field['fields']);
1467 1467
 			}
1468 1468
 
1469 1469
 			$field_id = $parent_field_id
1470
-				? $this->add_group_field( $parent_field_id, $field )
1471
-				: $this->add_field( $field );
1470
+				? $this->add_group_field($parent_field_id, $field)
1471
+				: $this->add_field($field);
1472 1472
 
1473
-			if ( $sub_fields ) {
1474
-				$this->add_fields( $sub_fields, $field_id );
1473
+			if ($sub_fields) {
1474
+				$this->add_fields($sub_fields, $field_id);
1475 1475
 			}
1476 1476
 		}
1477 1477
 
@@ -1486,8 +1486,8 @@  discard block
 block discarded – undo
1486 1486
 	 * @param  int   $position (optional) Position of metabox. 1 for first, etc.
1487 1487
 	 * @return string|false    Field id or false.
1488 1488
 	 */
1489
-	public function add_field( array $field, $position = 0 ) {
1490
-		if ( ! array_key_exists( 'id', $field ) ) {
1489
+	public function add_field(array $field, $position = 0) {
1490
+		if ( ! array_key_exists('id', $field)) {
1491 1491
 			return false;
1492 1492
 		}
1493 1493
 
@@ -1509,28 +1509,28 @@  discard block
 block discarded – undo
1509 1509
 	 * @param  int    $position        (optional) Position of metabox. 1 for first, etc.
1510 1510
 	 * @return mixed                   Array of parent/field ids or false.
1511 1511
 	 */
1512
-	public function add_group_field( $parent_field_id, array $field, $position = 0 ) {
1513
-		if ( ! array_key_exists( $parent_field_id, $this->meta_box['fields'] ) ) {
1512
+	public function add_group_field($parent_field_id, array $field, $position = 0) {
1513
+		if ( ! array_key_exists($parent_field_id, $this->meta_box['fields'])) {
1514 1514
 			return false;
1515 1515
 		}
1516 1516
 
1517
-		$parent_field = $this->meta_box['fields'][ $parent_field_id ];
1517
+		$parent_field = $this->meta_box['fields'][$parent_field_id];
1518 1518
 
1519
-		if ( 'group' !== $parent_field['type'] ) {
1519
+		if ('group' !== $parent_field['type']) {
1520 1520
 			return false;
1521 1521
 		}
1522 1522
 
1523
-		if ( ! isset( $parent_field['fields'] ) ) {
1524
-			$this->meta_box['fields'][ $parent_field_id ]['fields'] = array();
1523
+		if ( ! isset($parent_field['fields'])) {
1524
+			$this->meta_box['fields'][$parent_field_id]['fields'] = array();
1525 1525
 		}
1526 1526
 
1527 1527
 		$this->_add_field_to_array(
1528 1528
 			$field,
1529
-			$this->meta_box['fields'][ $parent_field_id ]['fields'],
1529
+			$this->meta_box['fields'][$parent_field_id]['fields'],
1530 1530
 			$position
1531 1531
 		);
1532 1532
 
1533
-		return array( $parent_field_id, $field['id'] );
1533
+		return array($parent_field_id, $field['id']);
1534 1534
 	}
1535 1535
 
1536 1536
 	/**
@@ -1540,13 +1540,13 @@  discard block
 block discarded – undo
1540 1540
 	 * @param  array $field Metabox field config array.
1541 1541
 	 * @return void
1542 1542
 	 */
1543
-	protected function field_actions( $field ) {
1544
-		switch ( $field['type'] ) {
1543
+	protected function field_actions($field) {
1544
+		switch ($field['type']) {
1545 1545
 			case 'file':
1546 1546
 			case 'file_list':
1547 1547
 
1548 1548
 				// Initiate attachment JS hooks.
1549
-				add_filter( 'wp_prepare_attachment_for_js', array( 'CMB2_Type_File_Base', 'prepare_image_sizes_for_js' ), 10, 3 );
1549
+				add_filter('wp_prepare_attachment_for_js', array('CMB2_Type_File_Base', 'prepare_image_sizes_for_js'), 10, 3);
1550 1550
 				break;
1551 1551
 
1552 1552
 			case 'oembed':
@@ -1555,8 +1555,8 @@  discard block
 block discarded – undo
1555 1555
 				break;
1556 1556
 
1557 1557
 			case 'group':
1558
-				if ( empty( $field['render_row_cb'] ) ) {
1559
-					$field['render_row_cb'] = array( $this, 'render_group_callback' );
1558
+				if (empty($field['render_row_cb'])) {
1559
+					$field['render_row_cb'] = array($this, 'render_group_callback');
1560 1560
 				}
1561 1561
 				break;
1562 1562
 			case 'colorpicker':
@@ -1564,16 +1564,16 @@  discard block
 block discarded – undo
1564 1564
 				// https://github.com/JayWood/CMB2_RGBa_Picker
1565 1565
 				// Dequeue the rgba_colorpicker custom field script if it is used,
1566 1566
 				// since we now enqueue our own more current version.
1567
-				add_action( 'admin_enqueue_scripts', array( 'CMB2_Type_Colorpicker', 'dequeue_rgba_colorpicker_script' ), 99 );
1567
+				add_action('admin_enqueue_scripts', array('CMB2_Type_Colorpicker', 'dequeue_rgba_colorpicker_script'), 99);
1568 1568
 				break;
1569 1569
 		}
1570 1570
 
1571
-		if ( isset( $field['column'] ) && false !== $field['column'] ) {
1572
-			$field = $this->define_field_column( $field );
1571
+		if (isset($field['column']) && false !== $field['column']) {
1572
+			$field = $this->define_field_column($field);
1573 1573
 		}
1574 1574
 
1575
-		if ( isset( $field['taxonomy'] ) && ! empty( $field['remove_default'] ) ) {
1576
-			$this->tax_metaboxes_to_remove[ $field['taxonomy'] ] = $field['taxonomy'];
1575
+		if (isset($field['taxonomy']) && ! empty($field['remove_default'])) {
1576
+			$this->tax_metaboxes_to_remove[$field['taxonomy']] = $field['taxonomy'];
1577 1577
 		}
1578 1578
 
1579 1579
 		return $field;
@@ -1586,15 +1586,15 @@  discard block
 block discarded – undo
1586 1586
 	 * @param  array $field Metabox field config array.
1587 1587
 	 * @return array         Modified metabox field config array.
1588 1588
 	 */
1589
-	protected function define_field_column( array $field ) {
1589
+	protected function define_field_column(array $field) {
1590 1590
 		$this->has_columns = true;
1591 1591
 
1592
-		$column = is_array( $field['column'] ) ? $field['column'] : array();
1592
+		$column = is_array($field['column']) ? $field['column'] : array();
1593 1593
 
1594
-		$field['column'] = wp_parse_args( $column, array(
1595
-			'name'     => isset( $field['name'] ) ? $field['name'] : '',
1594
+		$field['column'] = wp_parse_args($column, array(
1595
+			'name'     => isset($field['name']) ? $field['name'] : '',
1596 1596
 			'position' => false,
1597
-		) );
1597
+		));
1598 1598
 
1599 1599
 		return $field;
1600 1600
 	}
@@ -1607,13 +1607,13 @@  discard block
 block discarded – undo
1607 1607
 	 * @param array   $fields   Array (passed by reference) to append the field (array) to.
1608 1608
 	 * @param integer $position Optionally specify a position in the array to be inserted.
1609 1609
 	 */
1610
-	protected function _add_field_to_array( $field, &$fields, $position = 0 ) {
1611
-		$field = $this->field_actions( $field );
1610
+	protected function _add_field_to_array($field, &$fields, $position = 0) {
1611
+		$field = $this->field_actions($field);
1612 1612
 
1613
-		if ( $position ) {
1614
-			CMB2_Utils::array_insert( $fields, array( $field['id'] => $field ), $position );
1613
+		if ($position) {
1614
+			CMB2_Utils::array_insert($fields, array($field['id'] => $field), $position);
1615 1615
 		} else {
1616
-			$fields[ $field['id'] ] = $field;
1616
+			$fields[$field['id']] = $field;
1617 1617
 		}
1618 1618
 	}
1619 1619
 
@@ -1625,27 +1625,27 @@  discard block
 block discarded – undo
1625 1625
 	 * @param  string $parent_field_id (optional) The field id of the group field to remove field from.
1626 1626
 	 * @return bool                    True if field was removed.
1627 1627
 	 */
1628
-	public function remove_field( $field_id, $parent_field_id = '' ) {
1629
-		$ids = $this->get_field_ids( $field_id, $parent_field_id );
1628
+	public function remove_field($field_id, $parent_field_id = '') {
1629
+		$ids = $this->get_field_ids($field_id, $parent_field_id);
1630 1630
 
1631
-		if ( ! $ids ) {
1631
+		if ( ! $ids) {
1632 1632
 			return false;
1633 1633
 		}
1634 1634
 
1635
-		list( $field_id, $sub_field_id ) = $ids;
1635
+		list($field_id, $sub_field_id) = $ids;
1636 1636
 
1637
-		unset( $this->fields[ implode( '', $ids ) ] );
1637
+		unset($this->fields[implode('', $ids)]);
1638 1638
 
1639
-		if ( ! $sub_field_id ) {
1640
-			unset( $this->meta_box['fields'][ $field_id ] );
1639
+		if ( ! $sub_field_id) {
1640
+			unset($this->meta_box['fields'][$field_id]);
1641 1641
 			return true;
1642 1642
 		}
1643 1643
 
1644
-		if ( isset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] ) ) {
1645
-			unset( $this->fields[ $field_id ]->args['fields'][ $sub_field_id ] );
1644
+		if (isset($this->fields[$field_id]->args['fields'][$sub_field_id])) {
1645
+			unset($this->fields[$field_id]->args['fields'][$sub_field_id]);
1646 1646
 		}
1647
-		if ( isset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] ) ) {
1648
-			unset( $this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ] );
1647
+		if (isset($this->meta_box['fields'][$field_id]['fields'][$sub_field_id])) {
1648
+			unset($this->meta_box['fields'][$field_id]['fields'][$sub_field_id]);
1649 1649
 		}
1650 1650
 
1651 1651
 		return true;
@@ -1661,21 +1661,21 @@  discard block
 block discarded – undo
1661 1661
 	 * @param  string $parent_field_id (optional) The field id of the group field to remove field from.
1662 1662
 	 * @return mixed                   Field id. Strict compare to false, as success can return a falsey value (like 0).
1663 1663
 	 */
1664
-	public function update_field_property( $field_id, $property, $value, $parent_field_id = '' ) {
1665
-		$ids = $this->get_field_ids( $field_id, $parent_field_id );
1664
+	public function update_field_property($field_id, $property, $value, $parent_field_id = '') {
1665
+		$ids = $this->get_field_ids($field_id, $parent_field_id);
1666 1666
 
1667
-		if ( ! $ids ) {
1667
+		if ( ! $ids) {
1668 1668
 			return false;
1669 1669
 		}
1670 1670
 
1671
-		list( $field_id, $sub_field_id ) = $ids;
1671
+		list($field_id, $sub_field_id) = $ids;
1672 1672
 
1673
-		if ( ! $sub_field_id ) {
1674
-			$this->meta_box['fields'][ $field_id ][ $property ] = $value;
1673
+		if ( ! $sub_field_id) {
1674
+			$this->meta_box['fields'][$field_id][$property] = $value;
1675 1675
 			return $field_id;
1676 1676
 		}
1677 1677
 
1678
-		$this->meta_box['fields'][ $field_id ]['fields'][ $sub_field_id ][ $property ] = $value;
1678
+		$this->meta_box['fields'][$field_id]['fields'][$sub_field_id][$property] = $value;
1679 1679
 		return $field_id;
1680 1680
 	}
1681 1681
 
@@ -1687,32 +1687,32 @@  discard block
 block discarded – undo
1687 1687
 	 * @param  string $parent_field_id (optional) Parent field id.
1688 1688
 	 * @return mixed                    Array of field/parent ids, or false.
1689 1689
 	 */
1690
-	public function get_field_ids( $field_id, $parent_field_id = '' ) {
1690
+	public function get_field_ids($field_id, $parent_field_id = '') {
1691 1691
 		$sub_field_id = $parent_field_id ? $field_id : '';
1692 1692
 		$field_id     = $parent_field_id ? $parent_field_id : $field_id;
1693
-		$fields       =& $this->meta_box['fields'];
1693
+		$fields       = & $this->meta_box['fields'];
1694 1694
 
1695
-		if ( ! array_key_exists( $field_id, $fields ) ) {
1696
-			$field_id = $this->search_old_school_array( $field_id, $fields );
1695
+		if ( ! array_key_exists($field_id, $fields)) {
1696
+			$field_id = $this->search_old_school_array($field_id, $fields);
1697 1697
 		}
1698 1698
 
1699
-		if ( false === $field_id ) {
1699
+		if (false === $field_id) {
1700 1700
 			return false;
1701 1701
 		}
1702 1702
 
1703
-		if ( ! $sub_field_id ) {
1704
-			return array( $field_id, $sub_field_id );
1703
+		if ( ! $sub_field_id) {
1704
+			return array($field_id, $sub_field_id);
1705 1705
 		}
1706 1706
 
1707
-		if ( 'group' !== $fields[ $field_id ]['type'] ) {
1707
+		if ('group' !== $fields[$field_id]['type']) {
1708 1708
 			return false;
1709 1709
 		}
1710 1710
 
1711
-		if ( ! array_key_exists( $sub_field_id, $fields[ $field_id ]['fields'] ) ) {
1712
-			$sub_field_id = $this->search_old_school_array( $sub_field_id, $fields[ $field_id ]['fields'] );
1711
+		if ( ! array_key_exists($sub_field_id, $fields[$field_id]['fields'])) {
1712
+			$sub_field_id = $this->search_old_school_array($sub_field_id, $fields[$field_id]['fields']);
1713 1713
 		}
1714 1714
 
1715
-		return false === $sub_field_id ? false : array( $field_id, $sub_field_id );
1715
+		return false === $sub_field_id ? false : array($field_id, $sub_field_id);
1716 1716
 	}
1717 1717
 
1718 1718
 	/**
@@ -1723,9 +1723,9 @@  discard block
 block discarded – undo
1723 1723
 	 * @param  array  $fields   Array of fields to search.
1724 1724
 	 * @return mixed            Field index or false.
1725 1725
 	 */
1726
-	public function search_old_school_array( $field_id, $fields ) {
1727
-		$ids = wp_list_pluck( $fields, 'id' );
1728
-		$index = array_search( $field_id, $ids );
1726
+	public function search_old_school_array($field_id, $fields) {
1727
+		$ids = wp_list_pluck($fields, 'id');
1728
+		$index = array_search($field_id, $ids);
1729 1729
 		return false !== $index ? $index : false;
1730 1730
 	}
1731 1731
 
@@ -1737,8 +1737,8 @@  discard block
 block discarded – undo
1737 1737
 	 * @param  mixed    $additional_params Any additoinal parameters which should be passed to the callback.
1738 1738
 	 * @return mixed                       Return of the callback function.
1739 1739
 	 */
1740
-	public function do_callback( $cb, $additional_params = null ) {
1741
-		return call_user_func( $cb, $this, $additional_params );
1740
+	public function do_callback($cb, $additional_params = null) {
1741
+		return call_user_func($cb, $this, $additional_params);
1742 1742
 	}
1743 1743
 
1744 1744
 	/**
@@ -1748,7 +1748,7 @@  discard block
 block discarded – undo
1748 1748
 	 * @return void
1749 1749
 	 */
1750 1750
 	public function nonce_field() {
1751
-		wp_nonce_field( $this->nonce(), $this->nonce(), false, true );
1751
+		wp_nonce_field($this->nonce(), $this->nonce(), false, true);
1752 1752
 	}
1753 1753
 
1754 1754
 	/**
@@ -1758,8 +1758,8 @@  discard block
 block discarded – undo
1758 1758
 	 * @return string unique nonce string.
1759 1759
 	 */
1760 1760
 	public function nonce() {
1761
-		if ( ! $this->generated_nonce ) {
1762
-			$this->generated_nonce = sanitize_html_class( 'nonce_' . basename( __FILE__ ) . $this->cmb_id );
1761
+		if ( ! $this->generated_nonce) {
1762
+			$this->generated_nonce = sanitize_html_class('nonce_' . basename(__FILE__) . $this->cmb_id);
1763 1763
 		}
1764 1764
 
1765 1765
 		return $this->generated_nonce;
@@ -1773,7 +1773,7 @@  discard block
 block discarded – undo
1773 1773
 	 * @return bool
1774 1774
 	 */
1775 1775
 	public function was_updated() {
1776
-		return ! empty( $this->updated );
1776
+		return ! empty($this->updated);
1777 1777
 	}
1778 1778
 
1779 1779
 	/**
@@ -1784,7 +1784,7 @@  discard block
 block discarded – undo
1784 1784
 	 * @return bool
1785 1785
 	 */
1786 1786
 	public function is_alternate_context_box() {
1787
-		return $this->prop( 'context' ) && in_array( $this->prop( 'context' ), array( 'form_top', 'before_permalink', 'after_title', 'after_editor' ), true );
1787
+		return $this->prop('context') && in_array($this->prop('context'), array('form_top', 'before_permalink', 'after_title', 'after_editor'), true);
1788 1788
 	}
1789 1789
 
1790 1790
 	/**
@@ -1794,14 +1794,14 @@  discard block
 block discarded – undo
1794 1794
 	 * @throws Exception Throws an exception if the field is invalid.
1795 1795
 	 * @return mixed
1796 1796
 	 */
1797
-	public function __get( $property ) {
1798
-		switch ( $property ) {
1797
+	public function __get($property) {
1798
+		switch ($property) {
1799 1799
 			case 'updated':
1800 1800
 			case 'has_columns':
1801 1801
 			case 'tax_metaboxes_to_remove':
1802 1802
 				return $this->{$property};
1803 1803
 			default:
1804
-				return parent::__get( $property );
1804
+				return parent::__get($property);
1805 1805
 		}
1806 1806
 	}
1807 1807
 
Please login to merge, or discard this patch.
vendor/CMB2/includes/CMB2_Utils.php 1 patch
Spacing   +152 added lines, -153 removed lines patch added patch discarded remove patch
@@ -35,16 +35,16 @@  discard block
 block discarded – undo
35 35
 	 * @param  string $img_url Attachment url.
36 36
 	 * @return int|false            Attachment ID or false
37 37
 	 */
38
-	public static function image_id_from_url( $img_url ) {
38
+	public static function image_id_from_url($img_url) {
39 39
 		$attachment_id = 0;
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
 
47
-		$file = basename( $img_url );
47
+		$file = basename($img_url);
48 48
 
49 49
 		$query_args = array(
50 50
 			'post_type'   => 'attachment',
@@ -59,15 +59,15 @@  discard block
 block discarded – undo
59 59
 			),
60 60
 		);
61 61
 
62
-		$query = new WP_Query( $query_args );
62
+		$query = new WP_Query($query_args);
63 63
 
64
-		if ( $query->have_posts() ) {
64
+		if ($query->have_posts()) {
65 65
 
66
-			foreach ( $query->posts as $post_id ) {
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();
70
-				if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) {
66
+			foreach ($query->posts as $post_id) {
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();
70
+				if ($original_file === $file || in_array($file, $cropped_image_files)) {
71 71
 					$attachment_id = $post_id;
72 72
 					break;
73 73
 				}
@@ -88,17 +88,17 @@  discard block
 block discarded – undo
88 88
 	public static function get_available_image_sizes() {
89 89
 		global $_wp_additional_image_sizes;
90 90
 
91
-		$default_image_sizes = array( 'thumbnail', 'medium', 'large' );
92
-		foreach ( $default_image_sizes as $size ) {
93
-			$image_sizes[ $size ] = array(
94
-				'height' => intval( get_option( "{$size}_size_h" ) ),
95
-				'width'  => intval( get_option( "{$size}_size_w" ) ),
96
-				'crop'   => get_option( "{$size}_crop" ) ? get_option( "{$size}_crop" ) : false,
91
+		$default_image_sizes = array('thumbnail', 'medium', 'large');
92
+		foreach ($default_image_sizes as $size) {
93
+			$image_sizes[$size] = array(
94
+				'height' => intval(get_option("{$size}_size_h")),
95
+				'width'  => intval(get_option("{$size}_size_w")),
96
+				'crop'   => get_option("{$size}_crop") ? get_option("{$size}_crop") : false,
97 97
 			);
98 98
 		}
99 99
 
100
-		if ( isset( $_wp_additional_image_sizes ) && count( $_wp_additional_image_sizes ) ) {
101
-			$image_sizes = array_merge( $image_sizes, $_wp_additional_image_sizes );
100
+		if (isset($_wp_additional_image_sizes) && count($_wp_additional_image_sizes)) {
101
+			$image_sizes = array_merge($image_sizes, $_wp_additional_image_sizes);
102 102
 		}
103 103
 
104 104
 		return $image_sizes;
@@ -117,55 +117,55 @@  discard block
 block discarded – undo
117 117
 	 * @param  array|string $size Image size. Accepts an array of width and height (in that order).
118 118
 	 * @return false|string       Named image size e.g. 'thumbnail'
119 119
 	 */
120
-	public static function get_named_size( $size ) {
120
+	public static function get_named_size($size) {
121 121
 		$data = array();
122 122
 
123 123
 		// Find the best match when '$size' is an array.
124
-		if ( is_array( $size ) ) {
124
+		if (is_array($size)) {
125 125
 			$image_sizes = self::get_available_image_sizes();
126 126
 			$candidates = array();
127 127
 
128
-			foreach ( $image_sizes as $_size => $data ) {
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
-					if ( $matched ) {
155
-						$candidates[ $data['width'] * $data['height'] ] = array( $_size, $data );
154
+					if ($matched) {
155
+						$candidates[$data['width'] * $data['height']] = array($_size, $data);
156 156
 					}
157 157
 				}
158 158
 			}
159 159
 
160
-			if ( ! empty( $candidates ) ) {
160
+			if ( ! empty($candidates)) {
161 161
 				// Sort the array by size if we have more than one candidate.
162
-				if ( 1 < count( $candidates ) ) {
163
-					ksort( $candidates );
162
+				if (1 < count($candidates)) {
163
+					ksort($candidates);
164 164
 				}
165 165
 
166
-				$data = array_shift( $candidates );
166
+				$data = array_shift($candidates);
167 167
 				$data = $data[0];
168
-			} elseif ( ! empty( $image_sizes['thumbnail'] ) && $image_sizes['thumbnail']['width'] >= $size[0] && $image_sizes['thumbnail']['width'] >= $size[1] ) {
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.
@@ -174,12 +174,12 @@  discard block
 block discarded – undo
174 174
 			} else {
175 175
 				return false;
176 176
 			}
177
-		} elseif ( ! empty( $image_sizes[ $size ] ) ) {
177
+		} elseif ( ! empty($image_sizes[$size])) {
178 178
 			$data = $size;
179 179
 		}// End if.
180 180
 
181 181
 		// If we still don't have a match at this point, return false.
182
-		if ( empty( $data ) ) {
182
+		if (empty($data)) {
183 183
 			return false;
184 184
 		}
185 185
 
@@ -193,20 +193,20 @@  discard block
 block discarded – undo
193 193
 	 * @param  string $tzstring Time string.
194 194
 	 * @return string           Offset time string
195 195
 	 */
196
-	public static function timezone_offset( $tzstring ) {
196
+	public static function timezone_offset($tzstring) {
197 197
 		$tz_offset = 0;
198 198
 
199
-		if ( ! empty( $tzstring ) && is_string( $tzstring ) ) {
200
-			if ( 'UTC' === substr( $tzstring, 0, 3 ) ) {
201
-				$tzstring = str_replace( array( ':15', ':30', ':45' ), array( '.25', '.5', '.75' ), $tzstring );
202
-				return intval( floatval( substr( $tzstring, 3 ) ) * HOUR_IN_SECONDS );
199
+		if ( ! empty($tzstring) && is_string($tzstring)) {
200
+			if ('UTC' === substr($tzstring, 0, 3)) {
201
+				$tzstring = str_replace(array(':15', ':30', ':45'), array('.25', '.5', '.75'), $tzstring);
202
+				return intval(floatval(substr($tzstring, 3)) * HOUR_IN_SECONDS);
203 203
 			}
204 204
 
205 205
 			try {
206
-				$date_time_zone_selected = new DateTimeZone( $tzstring );
207
-				$tz_offset = timezone_offset_get( $date_time_zone_selected, date_create() );
208
-			} catch ( Exception $e ) {
209
-				self::log_if_debug( __METHOD__, __LINE__, $e->getMessage() );
206
+				$date_time_zone_selected = new DateTimeZone($tzstring);
207
+				$tz_offset = timezone_offset_get($date_time_zone_selected, date_create());
208
+			} catch (Exception $e) {
209
+				self::log_if_debug(__METHOD__, __LINE__, $e->getMessage());
210 210
 			}
211 211
 		}
212 212
 
@@ -225,18 +225,18 @@  discard block
 block discarded – undo
225 225
 	 * @return string Timezone string
226 226
 	 */
227 227
 	public static function timezone_string() {
228
-		$current_offset = get_option( 'gmt_offset' );
229
-		$tzstring       = get_option( 'timezone_string' );
228
+		$current_offset = get_option('gmt_offset');
229
+		$tzstring       = get_option('timezone_string');
230 230
 
231 231
 		// Remove old Etc mappings. Fallback to gmt_offset.
232
-		if ( false !== strpos( $tzstring, 'Etc/GMT' ) ) {
232
+		if (false !== strpos($tzstring, 'Etc/GMT')) {
233 233
 			$tzstring = '';
234 234
 		}
235 235
 
236
-		if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists.
237
-			if ( 0 == $current_offset ) {
236
+		if (empty($tzstring)) { // Create a UTC+- zone if no timezone string exists.
237
+			if (0 == $current_offset) {
238 238
 				$tzstring = 'UTC+0';
239
-			} elseif ( $current_offset < 0 ) {
239
+			} elseif ($current_offset < 0) {
240 240
 				$tzstring = 'UTC' . $current_offset;
241 241
 			} else {
242 242
 				$tzstring = 'UTC+' . $current_offset;
@@ -253,14 +253,13 @@  discard block
 block discarded – undo
253 253
 	 * @param  string|int $string Possible timestamp string.
254 254
 	 * @return int Time stamp.
255 255
 	 */
256
-	public static function make_valid_time_stamp( $string ) {
257
-		if ( ! $string ) {
256
+	public static function make_valid_time_stamp($string) {
257
+		if ( ! $string) {
258 258
 			return 0;
259 259
 		}
260 260
 
261
-		return self::is_valid_time_stamp( $string )
262
-			? (int) $string :
263
-			strtotime( (string) $string );
261
+		return self::is_valid_time_stamp($string)
262
+			? (int) $string : strtotime((string) $string);
264 263
 	}
265 264
 
266 265
 	/**
@@ -270,7 +269,7 @@  discard block
 block discarded – undo
270 269
 	 * @param  mixed $timestamp Value to check.
271 270
 	 * @return boolean           Whether value is a valid timestamp
272 271
 	 */
273
-	public static function is_valid_time_stamp( $timestamp ) {
272
+	public static function is_valid_time_stamp($timestamp) {
274 273
 		return (string) (int) $timestamp === (string) $timestamp
275 274
 			&& $timestamp <= PHP_INT_MAX
276 275
 			&& $timestamp >= ~PHP_INT_MAX;
@@ -283,7 +282,7 @@  discard block
 block discarded – undo
283 282
 	 * @param  mixed $value Value to check.
284 283
 	 * @return bool         True or false
285 284
 	 */
286
-	public static function isempty( $value ) {
285
+	public static function isempty($value) {
287 286
 		return null === $value || '' === $value || false === $value || array() === $value;
288 287
 	}
289 288
 
@@ -294,7 +293,7 @@  discard block
 block discarded – undo
294 293
 	 * @param  mixed $value Value to check.
295 294
 	 * @return bool         True or false
296 295
 	 */
297
-	public static function notempty( $value ) {
296
+	public static function notempty($value) {
298 297
 		return null !== $value && '' !== $value && false !== $value && array() !== $value;
299 298
 	}
300 299
 
@@ -305,8 +304,8 @@  discard block
 block discarded – undo
305 304
 	 * @param  mixed $value Value to check.
306 305
 	 * @return array True or false.
307 306
 	 */
308
-	public static function filter_empty( $value ) {
309
-		return array_filter( $value, array( __CLASS__, 'notempty' ) );
307
+	public static function filter_empty($value) {
308
+		return array_filter($value, array(__CLASS__, 'notempty'));
310 309
 	}
311 310
 
312 311
 	/**
@@ -317,10 +316,10 @@  discard block
 block discarded – undo
317 316
 	 * @param  array $new      New array to insert.
318 317
 	 * @param  int   $position Position in the main array to insert the new array.
319 318
 	 */
320
-	public static function array_insert( &$array, $new, $position ) {
321
-		$before = array_slice( $array, 0, $position - 1 );
322
-		$after  = array_diff_key( $array, $before );
323
-		$array  = array_merge( $before, $new, $after );
319
+	public static function array_insert(&$array, $new, $position) {
320
+		$before = array_slice($array, 0, $position - 1);
321
+		$after  = array_diff_key($array, $before);
322
+		$array  = array_merge($before, $new, $after);
324 323
 	}
325 324
 
326 325
 	/**
@@ -333,19 +332,19 @@  discard block
 block discarded – undo
333 332
 	 * @param string $path URL path.
334 333
 	 * @return string URL to CMB2 resources
335 334
 	 */
336
-	public static function url( $path = '' ) {
337
-		if ( self::$url ) {
335
+	public static function url($path = '') {
336
+		if (self::$url) {
338 337
 			return self::$url . $path;
339 338
 		}
340 339
 
341
-		$cmb2_url = self::get_url_from_dir( cmb2_dir() );
340
+		$cmb2_url = self::get_url_from_dir(cmb2_dir());
342 341
 
343 342
 		/**
344 343
 		 * Filter the CMB location url.
345 344
 		 *
346 345
 		 * @param string $cmb2_url Currently registered url.
347 346
 		 */
348
-		self::$url = trailingslashit( apply_filters( 'cmb2_meta_box_url', $cmb2_url, CMB2_VERSION ) );
347
+		self::$url = trailingslashit(apply_filters('cmb2_meta_box_url', $cmb2_url, CMB2_VERSION));
349 348
 
350 349
 		return self::$url . $path;
351 350
 	}
@@ -357,28 +356,28 @@  discard block
 block discarded – undo
357 356
 	 * @param  string $dir Directory path to convert.
358 357
 	 * @return string      Converted URL.
359 358
 	 */
360
-	public static function get_url_from_dir( $dir ) {
361
-		$dir = self::normalize_path( $dir );
359
+	public static function get_url_from_dir($dir) {
360
+		$dir = self::normalize_path($dir);
362 361
 
363 362
 		// Let's test if We are in the plugins or mu-plugins dir.
364
-		$test_dir = trailingslashit( $dir ) . 'unneeded.php';
363
+		$test_dir = trailingslashit($dir) . 'unneeded.php';
365 364
 		if (
366
-			0 === strpos( $test_dir, self::normalize_path( WPMU_PLUGIN_DIR ) )
367
-			|| 0 === strpos( $test_dir, self::normalize_path( WP_PLUGIN_DIR ) )
365
+			0 === strpos($test_dir, self::normalize_path(WPMU_PLUGIN_DIR))
366
+			|| 0 === strpos($test_dir, self::normalize_path(WP_PLUGIN_DIR))
368 367
 		) {
369 368
 			// Ok, then use plugins_url, as it is more reliable.
370
-			return trailingslashit( plugins_url( '', $test_dir ) );
369
+			return trailingslashit(plugins_url('', $test_dir));
371 370
 		}
372 371
 
373 372
 		// Ok, now let's test if we are in the theme dir.
374
-		$theme_root = self::normalize_path( get_theme_root() );
375
-		if ( 0 === strpos( $dir, $theme_root ) ) {
373
+		$theme_root = self::normalize_path(get_theme_root());
374
+		if (0 === strpos($dir, $theme_root)) {
376 375
 			// Ok, then use get_theme_root_uri.
377 376
 			return set_url_scheme(
378 377
 				trailingslashit(
379 378
 					str_replace(
380
-						untrailingslashit( $theme_root ),
381
-						untrailingslashit( get_theme_root_uri() ),
379
+						untrailingslashit($theme_root),
380
+						untrailingslashit(get_theme_root_uri()),
382 381
 						$dir
383 382
 					)
384 383
 				)
@@ -387,15 +386,15 @@  discard block
 block discarded – undo
387 386
 
388 387
 		// Check to see if it's anywhere in the root directory.
389 388
 		$site_dir = self::get_normalized_abspath();
390
-		$site_url = trailingslashit( is_multisite() ? network_site_url() : site_url() );
389
+		$site_url = trailingslashit(is_multisite() ? network_site_url() : site_url());
391 390
 
392 391
 		$url = str_replace(
393
-			array( $site_dir, WP_PLUGIN_DIR ),
394
-			array( $site_url, WP_PLUGIN_URL ),
392
+			array($site_dir, WP_PLUGIN_DIR),
393
+			array($site_url, WP_PLUGIN_URL),
395 394
 			$dir
396 395
 		);
397 396
 
398
-		return set_url_scheme( $url );
397
+		return set_url_scheme($url);
399 398
 	}
400 399
 
401 400
 	/**
@@ -406,7 +405,7 @@  discard block
 block discarded – undo
406 405
 	 * @return string  Normalized absolute path.
407 406
 	 */
408 407
 	protected static function get_normalized_abspath() {
409
-		return self::normalize_path( self::$ABSPATH );
408
+		return self::normalize_path(self::$ABSPATH);
410 409
 	}
411 410
 
412 411
 	/**
@@ -422,16 +421,16 @@  discard block
 block discarded – undo
422 421
 	 * @param string $path Path to normalize.
423 422
 	 * @return string Normalized path.
424 423
 	 */
425
-	protected static function normalize_path( $path ) {
426
-		if ( function_exists( 'wp_normalize_path' ) ) {
427
-			return wp_normalize_path( $path );
424
+	protected static function normalize_path($path) {
425
+		if (function_exists('wp_normalize_path')) {
426
+			return wp_normalize_path($path);
428 427
 		}
429 428
 
430 429
 		// Replace newer WP's version of wp_normalize_path.
431
-		$path = str_replace( '\\', '/', $path );
432
-		$path = preg_replace( '|(?<=.)/+|', '/', $path );
433
-		if ( ':' === substr( $path, 1, 1 ) ) {
434
-			$path = ucfirst( $path );
430
+		$path = str_replace('\\', '/', $path);
431
+		$path = preg_replace('|(?<=.)/+|', '/', $path);
432
+		if (':' === substr($path, 1, 1)) {
433
+			$path = ucfirst($path);
435 434
 		}
436 435
 
437 436
 		return $path;
@@ -445,9 +444,9 @@  discard block
 block discarded – undo
445 444
 	 * @param  string $date_format Expected date format.
446 445
 	 * @return mixed               Unix timestamp representing the date.
447 446
 	 */
448
-	public static function get_timestamp_from_value( $value, $date_format ) {
449
-		$date_object = date_create_from_format( $date_format, $value );
450
-		return $date_object ? $date_object->setTime( 0, 0, 0 )->getTimeStamp() : strtotime( $value );
447
+	public static function get_timestamp_from_value($value, $date_format) {
448
+		$date_object = date_create_from_format($date_format, $value);
449
+		return $date_object ? $date_object->setTime(0, 0, 0)->getTimeStamp() : strtotime($value);
451 450
 	}
452 451
 
453 452
 	/**
@@ -465,48 +464,48 @@  discard block
 block discarded – undo
465 464
 	 * @param string $format PHP date format.
466 465
 	 * @return string reformatted string
467 466
 	 */
468
-	public static function php_to_js_dateformat( $format ) {
467
+	public static function php_to_js_dateformat($format) {
469 468
 
470 469
 		// order is relevant here, since the replacement will be done sequentially.
471 470
 		$supported_options = array(
472
-			'd'   => 'dd',  // Day, leading 0.
473
-			'j'   => 'd',   // Day, no 0.
474
-			'z'   => 'o',   // Day of the year, no leading zeroes.
471
+			'd'   => 'dd', // Day, leading 0.
472
+			'j'   => 'd', // Day, no 0.
473
+			'z'   => 'o', // Day of the year, no leading zeroes.
475 474
 			// 'D' => 'D',   // Day name short, not sure how it'll work with translations.
476
-			'l '  => 'DD ',  // Day name full, idem before.
477
-			'l, ' => 'DD, ',  // Day name full, idem before.
478
-			'm'   => 'mm',  // Month of the year, leading 0.
479
-			'n'   => 'm',   // Month of the year, no leading 0.
475
+			'l '  => 'DD ', // Day name full, idem before.
476
+			'l, ' => 'DD, ', // Day name full, idem before.
477
+			'm'   => 'mm', // Month of the year, leading 0.
478
+			'n'   => 'm', // Month of the year, no leading 0.
480 479
 			// 'M' => 'M',   // Month, Short name.
481
-			'F '  => 'MM ',  // Month, full name.
482
-			'F, ' => 'MM, ',  // Month, full name.
483
-			'y'   => 'y',   // Year, two digit.
484
-			'Y'   => 'yy',  // Year, full.
485
-			'H'   => 'HH',  // Hour with leading 0 (24 hour).
486
-			'G'   => 'H',   // Hour with no leading 0 (24 hour).
487
-			'h'   => 'hh',  // Hour with leading 0 (12 hour).
488
-			'g'   => 'h',   // Hour with no leading 0 (12 hour).
489
-			'i'   => 'mm',  // Minute with leading 0.
490
-			's'   => 'ss',  // Second with leading 0.
491
-			'a'   => 'tt',  // am/pm.
480
+			'F '  => 'MM ', // Month, full name.
481
+			'F, ' => 'MM, ', // Month, full name.
482
+			'y'   => 'y', // Year, two digit.
483
+			'Y'   => 'yy', // Year, full.
484
+			'H'   => 'HH', // Hour with leading 0 (24 hour).
485
+			'G'   => 'H', // Hour with no leading 0 (24 hour).
486
+			'h'   => 'hh', // Hour with leading 0 (12 hour).
487
+			'g'   => 'h', // Hour with no leading 0 (12 hour).
488
+			'i'   => 'mm', // Minute with leading 0.
489
+			's'   => 'ss', // Second with leading 0.
490
+			'a'   => 'tt', // am/pm.
492 491
 			'A'   => 'TT', // AM/PM.
493 492
 		);
494 493
 
495
-		foreach ( $supported_options as $php => $js ) {
494
+		foreach ($supported_options as $php => $js) {
496 495
 			// replaces every instance of a supported option, but skips escaped characters.
497
-			$format = preg_replace( "~(?<!\\\\)$php~", $js, $format );
496
+			$format = preg_replace("~(?<!\\\\)$php~", $js, $format);
498 497
 		}
499 498
 
500 499
 		$supported_options = array(
501
-			'l' => 'DD',  // Day name full, idem before.
502
-			'F' => 'MM',  // Month, full name.
500
+			'l' => 'DD', // Day name full, idem before.
501
+			'F' => 'MM', // Month, full name.
503 502
 		);
504 503
 
505
-		if ( isset( $supported_options[ $format ] ) ) {
506
-			$format = $supported_options[ $format ];
504
+		if (isset($supported_options[$format])) {
505
+			$format = $supported_options[$format];
507 506
 		}
508 507
 
509
-		$format = preg_replace_callback( '~(?:\\\.)+~', array( __CLASS__, 'wrap_escaped_chars' ), $format );
508
+		$format = preg_replace_callback('~(?:\\\.)+~', array(__CLASS__, 'wrap_escaped_chars'), $format);
510 509
 
511 510
 		return $format;
512 511
 	}
@@ -518,8 +517,8 @@  discard block
 block discarded – undo
518 517
 	 * @param  string $value Value to wrap/escape.
519 518
 	 * @return string Modified value
520 519
 	 */
521
-	public static function wrap_escaped_chars( $value ) {
522
-		return '&#39;' . str_replace( '\\', '', $value[0] ) . '&#39;';
520
+	public static function wrap_escaped_chars($value) {
521
+		return '&#39;' . str_replace('\\', '', $value[0]) . '&#39;';
523 522
 	}
524 523
 
525 524
 	/**
@@ -532,9 +531,9 @@  discard block
 block discarded – undo
532 531
 	 * @param  mixed  $msg      Message to output.
533 532
 	 * @param  mixed  $debug    Variable to print_r.
534 533
 	 */
535
-	public static function log_if_debug( $function, $line, $msg, $debug = null ) {
536
-		if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
537
-			error_log( "In $function, $line:" . print_r( $msg, true ) . ( $debug ? print_r( $debug, true ) : '' ) );
534
+	public static function log_if_debug($function, $line, $msg, $debug = null) {
535
+		if (defined('WP_DEBUG') && WP_DEBUG) {
536
+			error_log("In $function, $line:" . print_r($msg, true) . ($debug ? print_r($debug, true) : ''));
538 537
 		}
539 538
 	}
540 539
 
@@ -545,9 +544,9 @@  discard block
 block discarded – undo
545 544
 	 * @param  string $file File url.
546 545
 	 * @return string|false       File extension or false
547 546
 	 */
548
-	public static function get_file_ext( $file ) {
549
-		$parsed = parse_url( $file, PHP_URL_PATH );
550
-		return $parsed ? strtolower( pathinfo( $parsed, PATHINFO_EXTENSION ) ) : false;
547
+	public static function get_file_ext($file) {
548
+		$parsed = parse_url($file, PHP_URL_PATH);
549
+		return $parsed ? strtolower(pathinfo($parsed, PATHINFO_EXTENSION)) : false;
551 550
 	}
552 551
 
553 552
 	/**
@@ -557,9 +556,9 @@  discard block
 block discarded – undo
557 556
 	 * @param  string $value File url or path.
558 557
 	 * @return string        File name
559 558
 	 */
560
-	public static function get_file_name_from_path( $value ) {
561
-		$parts = explode( '/', $value );
562
-		return is_array( $parts ) ? end( $parts ) : $value;
559
+	public static function get_file_name_from_path($value) {
560
+		$parts = explode('/', $value);
561
+		return is_array($parts) ? end($parts) : $value;
563 562
 	}
564 563
 
565 564
 	/**
@@ -569,8 +568,8 @@  discard block
 block discarded – undo
569 568
 	 * @param  string $version WP version string to compare.
570 569
 	 * @return bool            Result of comparison check.
571 570
 	 */
572
-	public static function wp_at_least( $version ) {
573
-		return version_compare( get_bloginfo( 'version' ), $version, '>=' );
571
+	public static function wp_at_least($version) {
572
+		return version_compare(get_bloginfo('version'), $version, '>=');
574 573
 	}
575 574
 
576 575
 	/**
@@ -581,18 +580,18 @@  discard block
 block discarded – undo
581 580
 	 * @param  array $attr_exclude Attributes that should NOT be concatenated.
582 581
 	 * @return string              String of attributes for form element.
583 582
 	 */
584
-	public static function concat_attrs( $attrs, $attr_exclude = array() ) {
583
+	public static function concat_attrs($attrs, $attr_exclude = array()) {
585 584
 		$attr_exclude[] = 'rendered';
586 585
 		$attr_exclude[] = 'js_dependencies';
587 586
 
588 587
 		$attributes = '';
589
-		foreach ( $attrs as $attr => $val ) {
590
-			$excluded = in_array( $attr, (array) $attr_exclude, true );
588
+		foreach ($attrs as $attr => $val) {
589
+			$excluded = in_array($attr, (array) $attr_exclude, true);
591 590
 			$empty    = false === $val && 'value' !== $attr;
592
-			if ( ! $excluded && ! $empty ) {
591
+			if ( ! $excluded && ! $empty) {
593 592
 				// if data attribute, use single quote wraps, else double.
594
-				$quotes = self::is_data_attribute( $attr ) ? "'" : '"';
595
-				$attributes .= sprintf( ' %1$s=%3$s%2$s%3$s', $attr, $val, $quotes );
593
+				$quotes = self::is_data_attribute($attr) ? "'" : '"';
594
+				$attributes .= sprintf(' %1$s=%3$s%2$s%3$s', $attr, $val, $quotes);
596 595
 			}
597 596
 		}
598 597
 		return $attributes;
@@ -606,8 +605,8 @@  discard block
 block discarded – undo
606 605
 	 * @param string $att HTML attribute.
607 606
 	 * @return boolean
608 607
 	 */
609
-	public static function is_data_attribute( $att ) {
610
-		return 0 === stripos( $att, 'data-' );
608
+	public static function is_data_attribute($att) {
609
+		return 0 === stripos($att, 'data-');
611 610
 	}
612 611
 
613 612
 	/**
@@ -620,17 +619,17 @@  discard block
 block discarded – undo
620 619
 	 *
621 620
 	 * @return array          The array.
622 621
 	 */
623
-	public static function ensure_array( $value, $default = array() ) {
624
-		if ( empty( $value ) ) {
622
+	public static function ensure_array($value, $default = array()) {
623
+		if (empty($value)) {
625 624
 			return $default;
626 625
 		}
627 626
 
628
-		if ( is_array( $value ) || is_object( $value ) ) {
627
+		if (is_array($value) || is_object($value)) {
629 628
 			return (array) $value;
630 629
 		}
631 630
 
632 631
 		// Not sure anything would be non-scalar that is not an array or object?
633
-		if ( ! is_scalar( $value ) ) {
632
+		if ( ! is_scalar($value)) {
634 633
 			return $default;
635 634
 		}
636 635
 
@@ -645,9 +644,9 @@  discard block
 block discarded – undo
645 644
 	 * @param mixed $value Value to normalize (if numeric).
646 645
 	 * @return mixed         Possibly normalized value.
647 646
 	 */
648
-	public static function normalize_if_numeric( $value ) {
649
-		if ( is_numeric( $value ) ) {
650
-			$value = false !== strpos( $value, '.' ) ? floatval( $value ) : intval( $value );
647
+	public static function normalize_if_numeric($value) {
648
+		if (is_numeric($value)) {
649
+			$value = false !== strpos($value, '.') ? floatval($value) : intval($value);
651 650
 		}
652 651
 
653 652
 		return $value;
@@ -662,8 +661,8 @@  discard block
 block discarded – undo
662 661
 	 *
663 662
 	 * @return string
664 663
 	 */
665
-	public static function generate_hash( $string ) {
666
-		return substr( base_convert( md5( $string ), 16, 32 ), 0, 12 );
664
+	public static function generate_hash($string) {
665
+		return substr(base_convert(md5($string), 16, 32), 0, 12);
667 666
 	}
668 667
 
669 668
 }
Please login to merge, or discard this patch.
vendor/CMB2/includes/CMB2_Types.php 1 patch
Spacing   +145 added lines, -145 removed lines patch added patch discarded remove patch
@@ -36,7 +36,7 @@  discard block
 block discarded – undo
36 36
 	 */
37 37
 	public $type = null;
38 38
 
39
-	public function __construct( CMB2_Field $field ) {
39
+	public function __construct(CMB2_Field $field) {
40 40
 		$this->field = $field;
41 41
 	}
42 42
 
@@ -47,15 +47,15 @@  discard block
 block discarded – undo
47 47
 	 * @param string $fieldtype Non-existent field type name
48 48
 	 * @param array  $arguments All arguments passed to the method
49 49
 	 */
50
-	public function __call( $fieldtype, $arguments ) {
50
+	public function __call($fieldtype, $arguments) {
51 51
 
52 52
 		// Check for methods to be proxied to the CMB2_Type_Base object.
53
-		if ( $exists = $this->maybe_proxy_method( $fieldtype, $arguments ) ) {
53
+		if ($exists = $this->maybe_proxy_method($fieldtype, $arguments)) {
54 54
 			return $exists['value'];
55 55
 		}
56 56
 
57 57
 		// Check for custom field type class.
58
-		if ( $object = $this->maybe_custom_field_object( $fieldtype, $arguments ) ) {
58
+		if ($object = $this->maybe_custom_field_object($fieldtype, $arguments)) {
59 59
 			return $object->render();
60 60
 		}
61 61
 
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 		 *                                   but could also be `comment`, `user` or `options-page`.
76 76
 		 * @param object $field_type_object  This `CMB2_Types` object
77 77
 		 */
78
-		do_action( "cmb2_render_{$fieldtype}", $this->field, $this->field->escaped_value(), $this->field->object_id, $this->field->object_type, $this );
78
+		do_action("cmb2_render_{$fieldtype}", $this->field, $this->field->escaped_value(), $this->field->object_id, $this->field->object_type, $this);
79 79
 	}
80 80
 
81 81
 	/**
@@ -84,7 +84,7 @@  discard block
 block discarded – undo
84 84
 	 * @since  1.1.0
85 85
 	 */
86 86
 	public function render() {
87
-		if ( $this->field->args( 'repeatable' ) ) {
87
+		if ($this->field->args('repeatable')) {
88 88
 			$this->render_repeatable_field();
89 89
 		} else {
90 90
 			$this->_render();
@@ -97,9 +97,9 @@  discard block
 block discarded – undo
97 97
 	 * @since  1.1.0
98 98
 	 */
99 99
 	protected function _render() {
100
-		$this->field->peform_param_callback( 'before_field' );
100
+		$this->field->peform_param_callback('before_field');
101 101
 		echo $this->{$this->field->type()}();
102
-		$this->field->peform_param_callback( 'after_field' );
102
+		$this->field->peform_param_callback('after_field');
103 103
 	}
104 104
 
105 105
 	/**
@@ -113,16 +113,16 @@  discard block
 block discarded – undo
113 113
 	 *
114 114
 	 * @return mixed           Results from called method.
115 115
 	 */
116
-	protected function proxy_method( $method, $default, $args = array() ) {
117
-		if ( ! is_object( $this->type ) ) {
118
-			$this->guess_type_object( $method );
116
+	protected function proxy_method($method, $default, $args = array()) {
117
+		if ( ! is_object($this->type)) {
118
+			$this->guess_type_object($method);
119 119
 		}
120 120
 
121
-		if ( is_object( $this->type ) && method_exists( $this->type, $method ) ) {
121
+		if (is_object($this->type) && method_exists($this->type, $method)) {
122 122
 
123
-			return empty( $args )
123
+			return empty($args)
124 124
 				? $this->type->$method()
125
-				: call_user_func_array( array( $this->type, $method ), $args );
125
+				: call_user_func_array(array($this->type, $method), $args);
126 126
 		}
127 127
 
128 128
 		return $default;
@@ -138,35 +138,35 @@  discard block
 block discarded – undo
138 138
 	 * @param string $method  Method attempting to be called on the CMB2_Type_Base object.
139 139
 	 * @return bool
140 140
 	 */
141
-	protected function guess_type_object( $method ) {
141
+	protected function guess_type_object($method) {
142 142
 		$fieldtype = $this->field->type();
143 143
 
144 144
 		// Try to "guess" the Type object based on the method requested.
145
-		switch ( $method ) {
145
+		switch ($method) {
146 146
 			case 'select_option':
147 147
 			case 'list_input':
148 148
 			case 'list_input_checkbox':
149 149
 			case 'concat_items':
150
-				$this->get_new_render_type( $fieldtype, 'CMB2_Type_Select' );
150
+				$this->get_new_render_type($fieldtype, 'CMB2_Type_Select');
151 151
 				break;
152 152
 			case 'is_valid_img_ext':
153 153
 			case 'img_status_output':
154 154
 			case 'file_status_output':
155
-				$this->get_new_render_type( $fieldtype, 'CMB2_Type_File_Base' );
155
+				$this->get_new_render_type($fieldtype, 'CMB2_Type_File_Base');
156 156
 				break;
157 157
 			case 'parse_picker_options':
158
-				$this->get_new_render_type( $fieldtype, 'CMB2_Type_Text_Date' );
158
+				$this->get_new_render_type($fieldtype, 'CMB2_Type_Text_Date');
159 159
 				break;
160 160
 			case 'get_object_terms':
161 161
 			case 'get_terms':
162
-				$this->get_new_render_type( $fieldtype, 'CMB2_Type_Taxonomy_Multicheck' );
162
+				$this->get_new_render_type($fieldtype, 'CMB2_Type_Taxonomy_Multicheck');
163 163
 				break;
164 164
 			case 'date_args':
165 165
 			case 'time_args':
166
-				$this->get_new_render_type( $fieldtype, 'CMB2_Type_Text_Datetime_Timestamp' );
166
+				$this->get_new_render_type($fieldtype, 'CMB2_Type_Text_Datetime_Timestamp');
167 167
 				break;
168 168
 			case 'parse_args':
169
-				$this->get_new_render_type( $fieldtype, 'CMB2_Type_Text' );
169
+				$this->get_new_render_type($fieldtype, 'CMB2_Type_Text');
170 170
 				break;
171 171
 		}
172 172
 
@@ -181,7 +181,7 @@  discard block
 block discarded – undo
181 181
 	 * @param  array  $arguments All arguments passed to the method.
182 182
 	 * @return bool|array        False if not proxied, else array with 'value' key being the return of the method.
183 183
 	 */
184
-	public function maybe_proxy_method( $method, $arguments ) {
184
+	public function maybe_proxy_method($method, $arguments) {
185 185
 		$exists = false;
186 186
 
187 187
 		$proxied = array(
@@ -196,10 +196,10 @@  discard block
 block discarded – undo
196 196
 			'file_status_output'   => '',
197 197
 			'parse_picker_options' => array(),
198 198
 		);
199
-		if ( isset( $proxied[ $method ] ) ) {
199
+		if (isset($proxied[$method])) {
200 200
 			$exists = array(
201 201
 				// Ok, proxy the method call to the CMB2_Type_Base object.
202
-				'value' => $this->proxy_method( $method, $proxied[ $method ], $arguments ),
202
+				'value' => $this->proxy_method($method, $proxied[$method], $arguments),
203 203
 			);
204 204
 		}
205 205
 
@@ -218,12 +218,12 @@  discard block
 block discarded – undo
218 218
 	 *                             `cmb2_render_{$field_type}` action.
219 219
 	 * @throws Exception if custom field type class does not extend CMB2_Type_Base.
220 220
 	 */
221
-	public function maybe_custom_field_object( $fieldtype, $args = array() ) {
222
-		if ( $render_class_name = $this->get_render_type_class( $fieldtype ) ) {
223
-			$this->type = new $render_class_name( $this, $args );
221
+	public function maybe_custom_field_object($fieldtype, $args = array()) {
222
+		if ($render_class_name = $this->get_render_type_class($fieldtype)) {
223
+			$this->type = new $render_class_name($this, $args);
224 224
 
225
-			if ( ! ( $this->type instanceof CMB2_Type_Base ) ) {
226
-				throw new Exception( __( 'Custom CMB2 field type classes must extend CMB2_Type_Base.', 'cmb2' ) );
225
+			if ( ! ($this->type instanceof CMB2_Type_Base)) {
226
+				throw new Exception(__('Custom CMB2 field type classes must extend CMB2_Type_Base.', 'cmb2'));
227 227
 			}
228 228
 
229 229
 			return $this->type;
@@ -242,9 +242,9 @@  discard block
 block discarded – undo
242 242
 	 * @param  mixed  $additional        Optional additional argument to pass to type class.
243 243
 	 * @return CMB2_Type_Base            Type object.
244 244
 	 */
245
-	public function get_new_render_type( $fieldtype, $render_class_name = null, $args = array(), $additional = '' ) {
246
-		$render_class_name = $this->get_render_type_class( $fieldtype, $render_class_name );
247
-		$this->type = new $render_class_name( $this, $args, $additional );
245
+	public function get_new_render_type($fieldtype, $render_class_name = null, $args = array(), $additional = '') {
246
+		$render_class_name = $this->get_render_type_class($fieldtype, $render_class_name);
247
+		$this->type = new $render_class_name($this, $args, $additional);
248 248
 
249 249
 		return $this->type;
250 250
 	}
@@ -257,10 +257,10 @@  discard block
 block discarded – undo
257 257
 	 * @param  string $render_class_name The default field type class to use. Defaults to null.
258 258
 	 * @return string                    The field type class to use.
259 259
 	 */
260
-	public function get_render_type_class( $fieldtype, $render_class_name = null ) {
261
-		$render_class_name = $this->field->args( 'render_class' ) ? $this->field->args( 'render_class' ) : $render_class_name;
260
+	public function get_render_type_class($fieldtype, $render_class_name = null) {
261
+		$render_class_name = $this->field->args('render_class') ? $this->field->args('render_class') : $render_class_name;
262 262
 
263
-		if ( has_action( "cmb2_render_class_{$fieldtype}" ) ) {
263
+		if (has_action("cmb2_render_class_{$fieldtype}")) {
264 264
 
265 265
 			/**
266 266
 			 * Filters the custom field type class used for rendering the field. Class is required to extend CMB2_Type_Base.
@@ -272,10 +272,10 @@  discard block
 block discarded – undo
272 272
 			 * @param string $render_class_name The custom field type class to use. Default null.
273 273
 			 * @param object $field_type_object This `CMB2_Types` object.
274 274
 			 */
275
-			$render_class_name = apply_filters( "cmb2_render_class_{$fieldtype}", $render_class_name, $this );
275
+			$render_class_name = apply_filters("cmb2_render_class_{$fieldtype}", $render_class_name, $this);
276 276
 		}
277 277
 
278
-		return $render_class_name && class_exists( $render_class_name ) ? $render_class_name : false;
278
+		return $render_class_name && class_exists($render_class_name) ? $render_class_name : false;
279 279
 	}
280 280
 
281 281
 	/**
@@ -286,8 +286,8 @@  discard block
 block discarded – undo
286 286
 	 * @param  string $fallback Fallback text.
287 287
 	 * @return string
288 288
 	 */
289
-	public function _text( $text_key, $fallback = '' ) {
290
-		return $this->field->get_string( $text_key, $fallback );
289
+	public function _text($text_key, $fallback = '') {
290
+		return $this->field->get_string($text_key, $fallback);
291 291
 	}
292 292
 
293 293
 	/**
@@ -297,8 +297,8 @@  discard block
 block discarded – undo
297 297
 	 * @param  string $file File url
298 298
 	 * @return string|false File extension or false
299 299
 	 */
300
-	public function get_file_ext( $file ) {
301
-		return CMB2_Utils::get_file_ext( $file );
300
+	public function get_file_ext($file) {
301
+		return CMB2_Utils::get_file_ext($file);
302 302
 	}
303 303
 
304 304
 	/**
@@ -308,8 +308,8 @@  discard block
 block discarded – undo
308 308
 	 * @param  string $value File url or path
309 309
 	 * @return string        File name
310 310
 	 */
311
-	public function get_file_name_from_path( $value ) {
312
-		return CMB2_Utils::get_file_name_from_path( $value );
311
+	public function get_file_name_from_path($value) {
312
+		return CMB2_Utils::get_file_name_from_path($value);
313 313
 	}
314 314
 
315 315
 	/**
@@ -320,8 +320,8 @@  discard block
 block discarded – undo
320 320
 	 * @param  array $attr_exclude Attributes that should NOT be concatenated
321 321
 	 * @return string               String of attributes for form element
322 322
 	 */
323
-	public function concat_attrs( $attrs, $attr_exclude = array() ) {
324
-		return CMB2_Utils::concat_attrs( $attrs, $attr_exclude );
323
+	public function concat_attrs($attrs, $attr_exclude = array()) {
324
+		return CMB2_Utils::concat_attrs($attrs, $attr_exclude);
325 325
 	}
326 326
 
327 327
 	/**
@@ -332,7 +332,7 @@  discard block
 block discarded – undo
332 332
 	public function render_repeatable_field() {
333 333
 		$table_id = $this->field->id() . '_repeat';
334 334
 
335
-		$this->_desc( true, true, true );
335
+		$this->_desc(true, true, true);
336 336
 		?>
337 337
 
338 338
 		<div id="<?php echo $table_id; ?>" class="cmb-repeat-table cmb-nested">
@@ -341,7 +341,7 @@  discard block
 block discarded – undo
341 341
 			</div>
342 342
 		</div>
343 343
 		<p class="cmb-add-row">
344
-			<button type="button" data-selector="<?php echo $table_id; ?>" class="cmb-add-row-button button-secondary"><?php echo esc_html( $this->_text( 'add_row_text', esc_html__( 'Add Row', 'cmb2' ) ) ); ?></button>
344
+			<button type="button" data-selector="<?php echo $table_id; ?>" class="cmb-add-row-button button-secondary"><?php echo esc_html($this->_text('add_row_text', esc_html__('Add Row', 'cmb2'))); ?></button>
345 345
 		</p>
346 346
 
347 347
 		<?php
@@ -355,21 +355,21 @@  discard block
 block discarded – undo
355 355
 	 * @since  1.1.0
356 356
 	 */
357 357
 	public function repeatable_rows() {
358
-		$meta_value = array_filter( (array) $this->field->escaped_value() );
358
+		$meta_value = array_filter((array) $this->field->escaped_value());
359 359
 		// check for default content
360 360
 		$default    = $this->field->get_default();
361 361
 
362 362
 		// check for saved data
363
-		if ( ! empty( $meta_value ) ) {
364
-			$meta_value = is_array( $meta_value ) ? array_filter( $meta_value ) : $meta_value;
365
-			$meta_value = ! empty( $meta_value ) ? $meta_value : $default;
363
+		if ( ! empty($meta_value)) {
364
+			$meta_value = is_array($meta_value) ? array_filter($meta_value) : $meta_value;
365
+			$meta_value = ! empty($meta_value) ? $meta_value : $default;
366 366
 		} else {
367 367
 			$meta_value = $default;
368 368
 		}
369 369
 
370 370
 		// Loop value array and add a row
371
-		if ( ! empty( $meta_value ) ) {
372
-			foreach ( (array) $meta_value as $val ) {
371
+		if ( ! empty($meta_value)) {
372
+			foreach ((array) $meta_value as $val) {
373 373
 				$this->field->escaped_value = $val;
374 374
 				$this->repeat_row();
375 375
 				$this->iterator++;
@@ -386,7 +386,7 @@  discard block
 block discarded – undo
386 386
 		// Then add an empty row
387 387
 		$this->field->escaped_value = $default;
388 388
 		$this->iterator = $this->iterator ? $this->iterator : 1;
389
-		$this->repeat_row( 'empty-row hidden' );
389
+		$this->repeat_row('empty-row hidden');
390 390
 	}
391 391
 
392 392
 	/**
@@ -395,17 +395,17 @@  discard block
 block discarded – undo
395 395
 	 * @since 1.1.0
396 396
 	 * @param string $classes Repeatable table row's class
397 397
 	 */
398
-	protected function repeat_row( $classes = 'cmb-repeat-row' ) {
399
-		$classes = explode( ' ', $classes );
400
-		$classes = array_map( 'sanitize_html_class', $classes );
398
+	protected function repeat_row($classes = 'cmb-repeat-row') {
399
+		$classes = explode(' ', $classes);
400
+		$classes = array_map('sanitize_html_class', $classes);
401 401
 		?>
402 402
 
403
-		<div class="cmb-row <?php echo esc_attr( implode( ' ', $classes ) ); ?>">
403
+		<div class="cmb-row <?php echo esc_attr(implode(' ', $classes)); ?>">
404 404
 			<div class="cmb-td">
405 405
 				<?php $this->_render(); ?>
406 406
 			</div>
407 407
 			<div class="cmb-td cmb-remove-row">
408
-				<button type="button" class="button-secondary cmb-remove-row-button" title="<?php echo esc_attr( $this->_text( 'remove_row_button_title', esc_html__( 'Remove Row', 'cmb2' ) ) ); ?>"><?php echo esc_html( $this->_text( 'remove_row_text', esc_html__( 'Remove', 'cmb2' ) ) ); ?></button>
408
+				<button type="button" class="button-secondary cmb-remove-row-button" title="<?php echo esc_attr($this->_text('remove_row_button_title', esc_html__('Remove Row', 'cmb2'))); ?>"><?php echo esc_html($this->_text('remove_row_text', esc_html__('Remove', 'cmb2'))); ?></button>
409 409
 			</div>
410 410
 		</div>
411 411
 
@@ -421,22 +421,22 @@  discard block
 block discarded – undo
421 421
 	 * @param bool $repeat_group Whether to repeat the group.
422 422
 	 * @return string Field's description markup.
423 423
 	 */
424
-	public function _desc( $paragraph = false, $echo = false, $repeat_group = false ) {
424
+	public function _desc($paragraph = false, $echo = false, $repeat_group = false) {
425 425
 		// Prevent description from printing multiple times for repeatable fields
426
-		if ( ! $repeat_group && ( $this->field->args( 'repeatable' ) || $this->iterator > 0 ) ) {
426
+		if ( ! $repeat_group && ($this->field->args('repeatable') || $this->iterator > 0)) {
427 427
 			return '';
428 428
 		}
429 429
 
430
-		$desc = $this->field->args( 'description' );
430
+		$desc = $this->field->args('description');
431 431
 
432
-		if ( ! $desc ) {
432
+		if ( ! $desc) {
433 433
 			return;
434 434
 		}
435 435
 
436 436
 		$tag = $paragraph ? 'p' : 'span';
437
-		$desc = sprintf( "\n" . '<%1$s class="cmb2-metabox-description">%2$s</%1$s>' . "\n", $tag, $desc );
437
+		$desc = sprintf("\n" . '<%1$s class="cmb2-metabox-description">%2$s</%1$s>' . "\n", $tag, $desc);
438 438
 
439
-		if ( $echo ) {
439
+		if ($echo) {
440 440
 			echo $desc;
441 441
 		}
442 442
 
@@ -450,8 +450,8 @@  discard block
 block discarded – undo
450 450
 	 * @param  string $suffix For multi-part fields
451 451
 	 * @return string          Name attribute
452 452
 	 */
453
-	public function _name( $suffix = '' ) {
454
-		return $this->field->args( '_name' ) . ( $this->field->args( 'repeatable' ) ? '[' . $this->iterator . ']' : '' ) . $suffix;
453
+	public function _name($suffix = '') {
454
+		return $this->field->args('_name') . ($this->field->args('repeatable') ? '[' . $this->iterator . ']' : '') . $suffix;
455 455
 	}
456 456
 
457 457
 	/**
@@ -462,10 +462,10 @@  discard block
 block discarded – undo
462 462
 	 * @param  bool   $append_repeatable_iterator Whether to append the iterator attribue if the field is repeatable.
463 463
 	 * @return string                             Id attribute
464 464
 	 */
465
-	public function _id( $suffix = '', $append_repeatable_iterator = true ) {
466
-		$id = $this->field->id() . $suffix . ( $this->field->args( 'repeatable' ) ? '_' . $this->iterator : '' );
465
+	public function _id($suffix = '', $append_repeatable_iterator = true) {
466
+		$id = $this->field->id() . $suffix . ($this->field->args('repeatable') ? '_' . $this->iterator : '');
467 467
 
468
-		if ( $append_repeatable_iterator && $this->field->args( 'repeatable' ) ) {
468
+		if ($append_repeatable_iterator && $this->field->args('repeatable')) {
469 469
 			$id .= '" data-iterator="' . $this->iterator;
470 470
 		}
471 471
 
@@ -480,8 +480,8 @@  discard block
 block discarded – undo
480 480
 	 * @param  string $type Field type
481 481
 	 * @return string       Form input element
482 482
 	 */
483
-	public function input( $args = array(), $type = __FUNCTION__ ) {
484
-		return $this->get_new_render_type( 'text', 'CMB2_Type_Text', $args, $type )->render();
483
+	public function input($args = array(), $type = __FUNCTION__) {
484
+		return $this->get_new_render_type('text', 'CMB2_Type_Text', $args, $type)->render();
485 485
 	}
486 486
 
487 487
 	/**
@@ -491,8 +491,8 @@  discard block
 block discarded – undo
491 491
 	 * @param  array $args Override arguments
492 492
 	 * @return string       Form textarea element
493 493
 	 */
494
-	public function textarea( $args = array() ) {
495
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Textarea', $args )->render();
494
+	public function textarea($args = array()) {
495
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Textarea', $args)->render();
496 496
 	}
497 497
 
498 498
 	/**
@@ -509,167 +509,167 @@  discard block
 block discarded – undo
509 509
 			'desc'  => '',
510 510
 			'class' => 'cmb2-hidden',
511 511
 		);
512
-		if ( $this->field->group ) {
512
+		if ($this->field->group) {
513 513
 			$args['data-groupid'] = $this->field->group->id();
514 514
 			$args['data-iterator'] = $this->iterator;
515 515
 		}
516 516
 
517
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text', $args, 'input' )->render();
517
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text', $args, 'input')->render();
518 518
 	}
519 519
 
520 520
 	public function text_small() {
521
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text', array(
521
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text', array(
522 522
 			'class' => 'cmb2-text-small',
523 523
 			'desc'  => $this->_desc(),
524
-		), 'input' )->render();
524
+		), 'input')->render();
525 525
 	}
526 526
 
527 527
 	public function text_medium() {
528
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text', array(
528
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text', array(
529 529
 			'class' => 'cmb2-text-medium',
530 530
 			'desc'  => $this->_desc(),
531
-		), 'input' )->render();
531
+		), 'input')->render();
532 532
 	}
533 533
 
534 534
 	public function text_email() {
535
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text', array(
535
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text', array(
536 536
 			'class' => 'cmb2-text-email cmb2-text-medium',
537 537
 			'type'  => 'email',
538
-		), 'input' )->render();
538
+		), 'input')->render();
539 539
 	}
540 540
 
541 541
 	public function text_url() {
542
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text', array(
542
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text', array(
543 543
 			'class' => 'cmb2-text-url cmb2-text-medium regular-text',
544
-			'value' => $this->field->escaped_value( 'esc_url' ),
545
-		), 'input' )->render();
544
+			'value' => $this->field->escaped_value('esc_url'),
545
+		), 'input')->render();
546 546
 	}
547 547
 
548 548
 	public function text_money() {
549
-		$input = $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text', array(
549
+		$input = $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text', array(
550 550
 			'class' => 'cmb2-text-money',
551 551
 			'desc'  => $this->_desc(),
552
-		), 'input' )->render();
553
-		return ( ! $this->field->get_param_callback_result( 'before_field' ) ? '$ ' : ' ' ) . $input;
552
+		), 'input')->render();
553
+		return ( ! $this->field->get_param_callback_result('before_field') ? '$ ' : ' ') . $input;
554 554
 	}
555 555
 
556 556
 	public function textarea_small() {
557
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Textarea', array(
557
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Textarea', array(
558 558
 			'class' => 'cmb2-textarea-small',
559 559
 			'rows'  => 4,
560
-		) )->render();
560
+		))->render();
561 561
 	}
562 562
 
563
-	public function textarea_code( $args = array() ) {
564
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Textarea_Code', $args )->render();
563
+	public function textarea_code($args = array()) {
564
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Textarea_Code', $args)->render();
565 565
 	}
566 566
 
567
-	public function wysiwyg( $args = array() ) {
568
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Wysiwyg', $args )->render();
567
+	public function wysiwyg($args = array()) {
568
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Wysiwyg', $args)->render();
569 569
 	}
570 570
 
571
-	public function text_date( $args = array() ) {
572
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text_Date', $args )->render();
571
+	public function text_date($args = array()) {
572
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text_Date', $args)->render();
573 573
 	}
574 574
 
575 575
 	// Alias for text_date
576
-	public function text_date_timestamp( $args = array() ) {
577
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text_Date', $args )->render();
576
+	public function text_date_timestamp($args = array()) {
577
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text_Date', $args)->render();
578 578
 	}
579 579
 
580
-	public function text_time( $args = array() ) {
581
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text_Time', $args )->render();
580
+	public function text_time($args = array()) {
581
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text_Time', $args)->render();
582 582
 	}
583 583
 
584
-	public function text_datetime_timestamp( $args = array() ) {
585
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text_Datetime_Timestamp', $args )->render();
584
+	public function text_datetime_timestamp($args = array()) {
585
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text_Datetime_Timestamp', $args)->render();
586 586
 	}
587 587
 
588
-	public function text_datetime_timestamp_timezone( $args = array() ) {
589
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text_Datetime_Timestamp_Timezone', $args )->render();
588
+	public function text_datetime_timestamp_timezone($args = array()) {
589
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Text_Datetime_Timestamp_Timezone', $args)->render();
590 590
 	}
591 591
 
592
-	public function select_timezone( $args = array() ) {
593
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Select_Timezone', $args )->render();
592
+	public function select_timezone($args = array()) {
593
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Select_Timezone', $args)->render();
594 594
 	}
595 595
 
596
-	public function colorpicker( $args = array(), $meta_value = '' ) {
597
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Colorpicker', $args, $meta_value )->render();
596
+	public function colorpicker($args = array(), $meta_value = '') {
597
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Colorpicker', $args, $meta_value)->render();
598 598
 	}
599 599
 
600
-	public function title( $args = array() ) {
601
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Title', $args )->render();
600
+	public function title($args = array()) {
601
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Title', $args)->render();
602 602
 	}
603 603
 
604
-	public function select( $args = array() ) {
605
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Select', $args )->render();
604
+	public function select($args = array()) {
605
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Select', $args)->render();
606 606
 	}
607 607
 
608
-	public function taxonomy_select( $args = array() ) {
609
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Taxonomy_Select', $args )->render();
608
+	public function taxonomy_select($args = array()) {
609
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Taxonomy_Select', $args)->render();
610 610
 	}
611 611
 
612
-	public function taxonomy_select_hierarchical( $args = array() ) {
613
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Taxonomy_Select_Hierarchical', $args )->render();
612
+	public function taxonomy_select_hierarchical($args = array()) {
613
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Taxonomy_Select_Hierarchical', $args)->render();
614 614
 	}
615 615
 
616
-	public function radio( $args = array(), $type = __FUNCTION__ ) {
617
-		return $this->get_new_render_type( $type, 'CMB2_Type_Radio', $args, $type )->render();
616
+	public function radio($args = array(), $type = __FUNCTION__) {
617
+		return $this->get_new_render_type($type, 'CMB2_Type_Radio', $args, $type)->render();
618 618
 	}
619 619
 
620
-	public function radio_inline( $args = array() ) {
621
-		return $this->radio( $args, __FUNCTION__ );
620
+	public function radio_inline($args = array()) {
621
+		return $this->radio($args, __FUNCTION__);
622 622
 	}
623 623
 
624
-	public function multicheck( $type = 'checkbox' ) {
625
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Multicheck', array(), $type )->render();
624
+	public function multicheck($type = 'checkbox') {
625
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Multicheck', array(), $type)->render();
626 626
 	}
627 627
 
628 628
 	public function multicheck_inline() {
629
-		return $this->multicheck( 'multicheck_inline' );
629
+		return $this->multicheck('multicheck_inline');
630 630
 	}
631 631
 
632
-	public function checkbox( $args = array(), $is_checked = null ) {
632
+	public function checkbox($args = array(), $is_checked = null) {
633 633
 		// Avoid get_new_render_type since we need a different default for the 3rd argument than ''.
634
-		$render_class_name = $this->get_render_type_class( __FUNCTION__, 'CMB2_Type_Checkbox' );
635
-		$this->type = new $render_class_name( $this, $args, $is_checked );
634
+		$render_class_name = $this->get_render_type_class(__FUNCTION__, 'CMB2_Type_Checkbox');
635
+		$this->type = new $render_class_name($this, $args, $is_checked);
636 636
 		return $this->type->render();
637 637
 	}
638 638
 
639
-	public function taxonomy_radio( $args = array() ) {
640
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Taxonomy_Radio', $args )->render();
639
+	public function taxonomy_radio($args = array()) {
640
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Taxonomy_Radio', $args)->render();
641 641
 	}
642 642
 
643
-	public function taxonomy_radio_hierarchical( $args = array() ) {
644
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Taxonomy_Radio_Hierarchical', $args )->render();
643
+	public function taxonomy_radio_hierarchical($args = array()) {
644
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Taxonomy_Radio_Hierarchical', $args)->render();
645 645
 	}
646 646
 
647
-	public function taxonomy_radio_inline( $args = array() ) {
648
-		return $this->taxonomy_radio( $args );
647
+	public function taxonomy_radio_inline($args = array()) {
648
+		return $this->taxonomy_radio($args);
649 649
 	}
650 650
 
651
-	public function taxonomy_multicheck( $args = array() ) {
652
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Taxonomy_Multicheck', $args )->render();
651
+	public function taxonomy_multicheck($args = array()) {
652
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Taxonomy_Multicheck', $args)->render();
653 653
 	}
654 654
 
655
-	public function taxonomy_multicheck_hierarchical( $args = array() ) {
656
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Taxonomy_Multicheck_Hierarchical', $args )->render();
655
+	public function taxonomy_multicheck_hierarchical($args = array()) {
656
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Taxonomy_Multicheck_Hierarchical', $args)->render();
657 657
 	}
658 658
 
659
-	public function taxonomy_multicheck_inline( $args = array() ) {
660
-		return $this->taxonomy_multicheck( $args );
659
+	public function taxonomy_multicheck_inline($args = array()) {
660
+		return $this->taxonomy_multicheck($args);
661 661
 	}
662 662
 
663
-	public function oembed( $args = array() ) {
664
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Oembed', $args )->render();
663
+	public function oembed($args = array()) {
664
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_Oembed', $args)->render();
665 665
 	}
666 666
 
667
-	public function file_list( $args = array() ) {
668
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_File_List', $args )->render();
667
+	public function file_list($args = array()) {
668
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_File_List', $args)->render();
669 669
 	}
670 670
 
671
-	public function file( $args = array() ) {
672
-		return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_File', $args )->render();
671
+	public function file($args = array()) {
672
+		return $this->get_new_render_type(__FUNCTION__, 'CMB2_Type_File', $args)->render();
673 673
 	}
674 674
 
675 675
 }
Please login to merge, or discard this patch.
vendor/CMB2/includes/CMB2_Options_Hookup.php 1 patch
Spacing   +69 added lines, -69 removed lines patch added patch discarded remove patch
@@ -36,46 +36,46 @@  discard block
 block discarded – undo
36 36
 	 * @param CMB2   $cmb        The CMB2 object to hookup.
37 37
 	 * @param string $option_key Option key to use.
38 38
 	 */
39
-	public function __construct( CMB2 $cmb, $option_key ) {
39
+	public function __construct(CMB2 $cmb, $option_key) {
40 40
 		$this->cmb = $cmb;
41 41
 		$this->option_key = $option_key;
42 42
 	}
43 43
 
44 44
 	public function hooks() {
45
-		if ( empty( $this->option_key ) ) {
45
+		if (empty($this->option_key)) {
46 46
 			return;
47 47
 		}
48 48
 
49
-		if ( ! $this->cmb->prop( 'autoload', true ) ) {
49
+		if ( ! $this->cmb->prop('autoload', true)) {
50 50
 			// Disable option autoload if requested.
51
-			add_filter( "cmb2_should_autoload_{$this->option_key}", '__return_false' );
51
+			add_filter("cmb2_should_autoload_{$this->option_key}", '__return_false');
52 52
 		}
53 53
 
54 54
 		/**
55 55
 		 * For WP < 4.7. Ensure the register_setting function exists.
56 56
 		 */
57
-		if ( ! CMB2_Utils::wp_at_least( '4.7' ) && ! function_exists( 'register_setting' ) ) {
57
+		if ( ! CMB2_Utils::wp_at_least('4.7') && ! function_exists('register_setting')) {
58 58
 			require_once ABSPATH . 'wp-admin/includes/plugin.php';
59 59
 		}
60 60
 
61 61
 		// Register setting to cmb2 group.
62
-		register_setting( 'cmb2', $this->option_key );
62
+		register_setting('cmb2', $this->option_key);
63 63
 
64 64
 		// Handle saving the data.
65
-		add_action( 'admin_post_' . $this->option_key, array( $this, 'save_options' ) );
65
+		add_action('admin_post_' . $this->option_key, array($this, 'save_options'));
66 66
 
67 67
 		// Optionally network_admin_menu.
68
-		$hook = $this->cmb->prop( 'admin_menu_hook' );
68
+		$hook = $this->cmb->prop('admin_menu_hook');
69 69
 
70 70
 		// Hook in to add our menu.
71
-		add_action( $hook, array( $this, 'options_page_menu_hooks' ) );
71
+		add_action($hook, array($this, 'options_page_menu_hooks'));
72 72
 
73 73
 		// If in the network admin, need to use get/update_site_option.
74
-		if ( 'network_admin_menu' === $hook ) {
74
+		if ('network_admin_menu' === $hook) {
75 75
 			// Override CMB's getter.
76
-			add_filter( "cmb2_override_option_get_{$this->option_key}", array( $this, 'network_get_override' ), 10, 2 );
76
+			add_filter("cmb2_override_option_get_{$this->option_key}", array($this, 'network_get_override'), 10, 2);
77 77
 			// Override CMB's setter.
78
-			add_filter( "cmb2_override_option_save_{$this->option_key}", array( $this, 'network_update_override' ), 10, 2 );
78
+			add_filter("cmb2_override_option_save_{$this->option_key}", array($this, 'network_update_override'), 10, 2);
79 79
 		}
80 80
 	}
81 81
 
@@ -87,13 +87,13 @@  discard block
 block discarded – undo
87 87
 	 * @return void
88 88
 	 */
89 89
 	public function options_page_menu_hooks() {
90
-		$parent_slug = $this->cmb->prop( 'parent_slug' );
91
-		$title       = $this->cmb->prop( 'title' );
92
-		$menu_title  = $this->cmb->prop( 'menu_title', $title );
93
-		$capability  = $this->cmb->prop( 'capability' );
94
-		$callback    = array( $this, 'options_page_output' );
90
+		$parent_slug = $this->cmb->prop('parent_slug');
91
+		$title       = $this->cmb->prop('title');
92
+		$menu_title  = $this->cmb->prop('menu_title', $title);
93
+		$capability  = $this->cmb->prop('capability');
94
+		$callback    = array($this, 'options_page_output');
95 95
 
96
-		if ( $parent_slug ) {
96
+		if ($parent_slug) {
97 97
 			$page_hook = add_submenu_page(
98 98
 				$parent_slug,
99 99
 				$title,
@@ -109,14 +109,14 @@  discard block
 block discarded – undo
109 109
 				$capability,
110 110
 				$this->option_key,
111 111
 				$callback,
112
-				$this->cmb->prop( 'icon_url' ),
113
-				$this->cmb->prop( 'position' )
112
+				$this->cmb->prop('icon_url'),
113
+				$this->cmb->prop('position')
114 114
 			);
115 115
 		}
116 116
 
117
-		if ( $this->cmb->prop( 'cmb_styles' ) ) {
117
+		if ($this->cmb->prop('cmb_styles')) {
118 118
 			// Include CMB CSS in the head to avoid FOUC.
119
-			add_action( "admin_print_styles-{$page_hook}", array( 'CMB2_Hookup', 'enqueue_cmb_css' ) );
119
+			add_action("admin_print_styles-{$page_hook}", array('CMB2_Hookup', 'enqueue_cmb_css'));
120 120
 		}
121 121
 
122 122
 		$this->maybe_register_message();
@@ -131,21 +131,21 @@  discard block
 block discarded – undo
131 131
 	 * @return void
132 132
 	 */
133 133
 	public function maybe_register_message() {
134
-		$is_options_page = self::is_page( $this->option_key );
135
-		$should_notify   = ! $this->cmb->prop( 'disable_settings_errors' ) && isset( $_GET['settings-updated'] ) && $is_options_page;
134
+		$is_options_page = self::is_page($this->option_key);
135
+		$should_notify   = ! $this->cmb->prop('disable_settings_errors') && isset($_GET['settings-updated']) && $is_options_page;
136 136
 		$is_updated      = $should_notify && 'true' === $_GET['settings-updated'];
137 137
 		$setting         = "{$this->option_key}-notices";
138 138
 		$code            = '';
139
-		$message         = __( 'Nothing to update.', 'cmb2' );
139
+		$message         = __('Nothing to update.', 'cmb2');
140 140
 		$type            = 'notice-warning';
141 141
 
142
-		if ( $is_updated ) {
143
-			$message = __( 'Settings updated.', 'cmb2' );
142
+		if ($is_updated) {
143
+			$message = __('Settings updated.', 'cmb2');
144 144
 			$type    = 'updated';
145 145
 		}
146 146
 
147 147
 		// Check if parameter has registered a callback.
148
-		if ( $cb = $this->cmb->maybe_callback( 'message_cb' ) ) {
148
+		if ($cb = $this->cmb->maybe_callback('message_cb')) {
149 149
 
150 150
 			/**
151 151
 			 * The 'message_cb' callback will receive the following parameters.
@@ -171,13 +171,13 @@  discard block
 block discarded – undo
171 171
 			 *                                   Will be 'updated' if $is_updated is true, else 'notice-warning'.
172 172
 			 * }
173 173
 			 */
174
-			$args = compact( 'is_options_page', 'should_notify', 'is_updated', 'setting', 'code', 'message', 'type' );
174
+			$args = compact('is_options_page', 'should_notify', 'is_updated', 'setting', 'code', 'message', 'type');
175 175
 
176
-			$this->cmb->do_callback( $cb, $args );
176
+			$this->cmb->do_callback($cb, $args);
177 177
 
178
-		} elseif ( $should_notify ) {
178
+		} elseif ($should_notify) {
179 179
 
180
-			add_settings_error( $setting, $code, $message, $type );
180
+			add_settings_error($setting, $code, $message, $type);
181 181
 		}
182 182
 	}
183 183
 
@@ -189,28 +189,28 @@  discard block
 block discarded – undo
189 189
 	public function options_page_output() {
190 190
 		$this->maybe_output_settings_notices();
191 191
 
192
-		$callback = $this->cmb->prop( 'display_cb' );
193
-		if ( is_callable( $callback ) ) {
194
-			return call_user_func( $callback, $this );
192
+		$callback = $this->cmb->prop('display_cb');
193
+		if (is_callable($callback)) {
194
+			return call_user_func($callback, $this);
195 195
 		}
196 196
 
197 197
 		$tabs = $this->get_tab_group_tabs();
198 198
 		?>
199
-		<div class="wrap cmb2-options-page option-<?php echo esc_attr( sanitize_html_class( $this->option_key ) ); ?>">
200
-			<?php if ( $this->cmb->prop( 'title' ) ) : ?>
201
-				<h2><?php echo wp_kses_post( $this->cmb->prop( 'title' ) ); ?></h2>
199
+		<div class="wrap cmb2-options-page option-<?php echo esc_attr(sanitize_html_class($this->option_key)); ?>">
200
+			<?php if ($this->cmb->prop('title')) : ?>
201
+				<h2><?php echo wp_kses_post($this->cmb->prop('title')); ?></h2>
202 202
 			<?php endif; ?>
203
-			<?php if ( ! empty( $tabs ) ) : ?>
203
+			<?php if ( ! empty($tabs)) : ?>
204 204
 				<h2 class="nav-tab-wrapper">
205
-					<?php foreach ( $tabs as $option_key => $tab_title ) : ?>
206
-						<a class="nav-tab<?php if ( self::is_page( $option_key ) ) : ?> nav-tab-active<?php endif; ?>" href="<?php menu_page_url( $option_key ); ?>"><?php echo wp_kses_post( $tab_title ); ?></a>
205
+					<?php foreach ($tabs as $option_key => $tab_title) : ?>
206
+						<a class="nav-tab<?php if (self::is_page($option_key)) : ?> nav-tab-active<?php endif; ?>" href="<?php menu_page_url($option_key); ?>"><?php echo wp_kses_post($tab_title); ?></a>
207 207
 					<?php endforeach; ?>
208 208
 				</h2>
209 209
 			<?php endif; ?>
210
-			<form class="cmb-form" action="<?php echo esc_url( admin_url( 'admin-post.php' ) ); ?>" method="POST" id="<?php echo $this->cmb->cmb_id; ?>" enctype="multipart/form-data" encoding="multipart/form-data">
211
-				<input type="hidden" name="action" value="<?php echo esc_attr( $this->option_key ); ?>">
210
+			<form class="cmb-form" action="<?php echo esc_url(admin_url('admin-post.php')); ?>" method="POST" id="<?php echo $this->cmb->cmb_id; ?>" enctype="multipart/form-data" encoding="multipart/form-data">
211
+				<input type="hidden" name="action" value="<?php echo esc_attr($this->option_key); ?>">
212 212
 				<?php $this->options_page_metabox(); ?>
213
-				<?php submit_button( esc_attr( $this->cmb->prop( 'save_button' ) ), 'primary', 'submit-cmb' ); ?>
213
+				<?php submit_button(esc_attr($this->cmb->prop('save_button')), 'primary', 'submit-cmb'); ?>
214 214
 			</form>
215 215
 		</div>
216 216
 		<?php
@@ -228,8 +228,8 @@  discard block
 block discarded – undo
228 228
 		global $parent_file;
229 229
 
230 230
 		// The settings sub-pages will already have settings_errors() called in wp-admin/options-head.php.
231
-		if ( 'options-general.php' !== $parent_file ) {
232
-			settings_errors( "{$this->option_key}-notices" );
231
+		if ('options-general.php' !== $parent_file) {
232
+			settings_errors("{$this->option_key}-notices");
233 233
 		}
234 234
 	}
235 235
 
@@ -241,21 +241,21 @@  discard block
 block discarded – undo
241 241
 	 * @return array Array of tab information ($option_key => $tab_title)
242 242
 	 */
243 243
 	public function get_tab_group_tabs() {
244
-		$tab_group = $this->cmb->prop( 'tab_group' );
244
+		$tab_group = $this->cmb->prop('tab_group');
245 245
 		$tabs      = array();
246 246
 
247
-		if ( $tab_group ) {
248
-			$boxes = CMB2_Boxes::get_by( 'tab_group', $tab_group );
247
+		if ($tab_group) {
248
+			$boxes = CMB2_Boxes::get_by('tab_group', $tab_group);
249 249
 
250
-			foreach ( $boxes as $cmb_id => $cmb ) {
250
+			foreach ($boxes as $cmb_id => $cmb) {
251 251
 				$option_key = $cmb->options_page_keys();
252 252
 
253 253
 				// Must have an option key, must be an options page box.
254
-				if ( ! isset( $option_key[0] ) || 'options-page' !== $cmb->mb_object_type() ) {
254
+				if ( ! isset($option_key[0]) || 'options-page' !== $cmb->mb_object_type()) {
255 255
 					continue;
256 256
 				}
257 257
 
258
-				$tabs[ $option_key[0] ] = $cmb->prop( 'tab_title', $cmb->prop( 'title' ) );
258
+				$tabs[$option_key[0]] = $cmb->prop('tab_title', $cmb->prop('title'));
259 259
 			}
260 260
 		}
261 261
 
@@ -268,7 +268,7 @@  discard block
 block discarded – undo
268 268
 	 * @since  2.2.5
269 269
 	 */
270 270
 	public function options_page_metabox() {
271
-		$this->show_form_for_type( 'options-page' );
271
+		$this->show_form_for_type('options-page');
272 272
 	}
273 273
 
274 274
 	/**
@@ -279,26 +279,26 @@  discard block
 block discarded – undo
279 279
 	 */
280 280
 	public function save_options() {
281 281
 		$url = wp_get_referer();
282
-		if ( ! $url ) {
282
+		if ( ! $url) {
283 283
 			$url = admin_url();
284 284
 		}
285 285
 
286 286
 		if (
287
-			$this->can_save( 'options-page' )
287
+			$this->can_save('options-page')
288 288
 			// check params.
289
-			&& isset( $_POST['submit-cmb'], $_POST['action'] )
289
+			&& isset($_POST['submit-cmb'], $_POST['action'])
290 290
 			&& $this->option_key === $_POST['action']
291 291
 		) {
292 292
 
293 293
 			$updated = $this->cmb
294
-				->save_fields( $this->option_key, $this->cmb->object_type(), $_POST )
294
+				->save_fields($this->option_key, $this->cmb->object_type(), $_POST)
295 295
 				->was_updated(); // Will be false if no values were changed/updated.
296 296
 
297
-			$url = add_query_arg( 'settings-updated', $updated ? 'true' : 'false', $url );
298
-			$url = apply_filters( 'cmb2_options_page_redirect_url', $url );
297
+			$url = add_query_arg('settings-updated', $updated ? 'true' : 'false', $url);
298
+			$url = apply_filters('cmb2_options_page_redirect_url', $url);
299 299
 		}
300 300
 
301
-		wp_safe_redirect( esc_url_raw( $url ), 303 /* WP_Http::SEE_OTHER */ );
301
+		wp_safe_redirect(esc_url_raw($url), 303 /* WP_Http::SEE_OTHER */);
302 302
 		exit;
303 303
 	}
304 304
 
@@ -311,8 +311,8 @@  discard block
 block discarded – undo
311 311
 	 * @param mixed $default Default value to use.
312 312
 	 * @return mixed Value set for the network option.
313 313
 	 */
314
-	public function network_get_override( $test, $default = false ) {
315
-		return get_site_option( $this->option_key, $default );
314
+	public function network_get_override($test, $default = false) {
315
+		return get_site_option($this->option_key, $default);
316 316
 	}
317 317
 
318 318
 	/**
@@ -324,8 +324,8 @@  discard block
 block discarded – undo
324 324
 	 * @param mixed $option_value Value to use.
325 325
 	 * @return bool Success/Failure
326 326
 	 */
327
-	public function network_update_override( $test, $option_value ) {
328
-		return update_site_option( $this->option_key, $option_value );
327
+	public function network_update_override($test, $option_value) {
328
+		return update_site_option($this->option_key, $option_value);
329 329
 	}
330 330
 
331 331
 	/**
@@ -336,8 +336,8 @@  discard block
 block discarded – undo
336 336
 	 * @param  string $page Page slug.
337 337
 	 * @return boolean
338 338
 	 */
339
-	public static function is_page( $page ) {
340
-		return isset( $_GET['page'] ) && $page === $_GET['page'];
339
+	public static function is_page($page) {
340
+		return isset($_GET['page']) && $page === $_GET['page'];
341 341
 	}
342 342
 
343 343
 	/**
@@ -348,14 +348,14 @@  discard block
 block discarded – undo
348 348
 	 * @throws Exception Throws an exception if the field is invalid.
349 349
 	 * @return mixed
350 350
 	 */
351
-	public function __get( $field ) {
352
-		switch ( $field ) {
351
+	public function __get($field) {
352
+		switch ($field) {
353 353
 			case 'object_type':
354 354
 			case 'option_key':
355 355
 			case 'cmb':
356 356
 				return $this->{$field};
357 357
 			default:
358
-				throw new Exception( sprintf( esc_html__( 'Invalid %1$s property: %2$s', 'cmb2' ), __CLASS__, $field ) );
358
+				throw new Exception(sprintf(esc_html__('Invalid %1$s property: %2$s', 'cmb2'), __CLASS__, $field));
359 359
 		}
360 360
 	}
361 361
 }
Please login to merge, or discard this patch.
vendor/CMB2/includes/CMB2_Options.php 1 patch
Spacing   +36 added lines, -36 removed lines patch added patch discarded remove patch
@@ -24,13 +24,13 @@  discard block
 block discarded – undo
24 24
 	 */
25 25
 	protected static $option_sets = array();
26 26
 
27
-	public static function get( $option_key ) {
27
+	public static function get($option_key) {
28 28
 
29
-		if ( empty( self::$option_sets ) || empty( self::$option_sets[ $option_key ] ) ) {
30
-			self::$option_sets[ $option_key ] = new CMB2_Option( $option_key );
29
+		if (empty(self::$option_sets) || empty(self::$option_sets[$option_key])) {
30
+			self::$option_sets[$option_key] = new CMB2_Option($option_key);
31 31
 		}
32 32
 
33
-		return self::$option_sets[ $option_key ];
33
+		return self::$option_sets[$option_key];
34 34
 	}
35 35
 }
36 36
 
@@ -64,8 +64,8 @@  discard block
 block discarded – undo
64 64
 	 *                           Leave empty for temporary data store.
65 65
 	 * @since 2.0.0
66 66
 	 */
67
-	public function __construct( $option_key = '' ) {
68
-		$this->key = ! empty( $option_key ) ? $option_key : '';
67
+	public function __construct($option_key = '') {
68
+		$this->key = ! empty($option_key) ? $option_key : '';
69 69
 	}
70 70
 
71 71
 	/**
@@ -75,7 +75,7 @@  discard block
 block discarded – undo
75 75
 	 * @return mixed Delete success or failure
76 76
 	 */
77 77
 	public function delete_option() {
78
-		$deleted = $this->key ? delete_option( $this->key ) : true;
78
+		$deleted = $this->key ? delete_option($this->key) : true;
79 79
 		$this->options = $deleted ? array() : $this->options;
80 80
 		return $this->options;
81 81
 	}
@@ -88,15 +88,15 @@  discard block
 block discarded – undo
88 88
 	 * @param bool   $resave Whether or not to resave.
89 89
 	 * @return array             Modified options
90 90
 	 */
91
-	public function remove( $field_id, $resave = false ) {
91
+	public function remove($field_id, $resave = false) {
92 92
 
93 93
 		$this->get_options();
94 94
 
95
-		if ( isset( $this->options[ $field_id ] ) ) {
96
-			unset( $this->options[ $field_id ] );
95
+		if (isset($this->options[$field_id])) {
96
+			unset($this->options[$field_id]);
97 97
 		}
98 98
 
99
-		if ( $resave ) {
99
+		if ($resave) {
100 100
 			$this->set();
101 101
 		}
102 102
 
@@ -111,13 +111,13 @@  discard block
 block discarded – undo
111 111
 	 * @param mixed  $default  Fallback value for the option.
112 112
 	 * @return array             Requested field or default
113 113
 	 */
114
-	public function get( $field_id, $default = false ) {
114
+	public function get($field_id, $default = false) {
115 115
 		$opts = $this->get_options();
116 116
 
117
-		if ( 'all' == $field_id ) {
117
+		if ('all' == $field_id) {
118 118
 			return $opts;
119
-		} elseif ( array_key_exists( $field_id, $opts ) ) {
120
-			return false !== $opts[ $field_id ] ? $opts[ $field_id ] : $default;
119
+		} elseif (array_key_exists($field_id, $opts)) {
120
+			return false !== $opts[$field_id] ? $opts[$field_id] : $default;
121 121
 		}
122 122
 
123 123
 		return $default;
@@ -133,20 +133,20 @@  discard block
 block discarded – undo
133 133
 	 * @param bool   $single   Whether data should not be an array.
134 134
 	 * @return boolean Return status of update.
135 135
 	 */
136
-	public function update( $field_id, $value = '', $resave = false, $single = true ) {
136
+	public function update($field_id, $value = '', $resave = false, $single = true) {
137 137
 		$this->get_options();
138 138
 
139
-		if ( true !== $field_id ) {
139
+		if (true !== $field_id) {
140 140
 
141
-			if ( ! $single ) {
141
+			if ( ! $single) {
142 142
 				// If multiple, add to array.
143
-				$this->options[ $field_id ][] = $value;
143
+				$this->options[$field_id][] = $value;
144 144
 			} else {
145
-				$this->options[ $field_id ] = $value;
145
+				$this->options[$field_id] = $value;
146 146
 			}
147 147
 		}
148 148
 
149
-		if ( $resave || true === $field_id ) {
149
+		if ($resave || true === $field_id) {
150 150
 			return $this->set();
151 151
 		}
152 152
 
@@ -164,20 +164,20 @@  discard block
 block discarded – undo
164 164
 	 * @param  array $options Optional options to override.
165 165
 	 * @return bool           Success/Failure
166 166
 	 */
167
-	public function set( $options = array() ) {
168
-		if ( ! empty( $options ) || empty( $options ) && empty( $this->key ) ) {
167
+	public function set($options = array()) {
168
+		if ( ! empty($options) || empty($options) && empty($this->key)) {
169 169
 			$this->options = $options;
170 170
 		}
171 171
 
172
-		$this->options = wp_unslash( $this->options ); // get rid of those evil magic quotes.
172
+		$this->options = wp_unslash($this->options); // get rid of those evil magic quotes.
173 173
 
174
-		if ( empty( $this->key ) ) {
174
+		if (empty($this->key)) {
175 175
 			return false;
176 176
 		}
177 177
 
178
-		$test_save = apply_filters( "cmb2_override_option_save_{$this->key}", 'cmb2_no_override_option_save', $this->options, $this );
178
+		$test_save = apply_filters("cmb2_override_option_save_{$this->key}", 'cmb2_no_override_option_save', $this->options, $this);
179 179
 
180
-		if ( 'cmb2_no_override_option_save' !== $test_save ) {
180
+		if ('cmb2_no_override_option_save' !== $test_save) {
181 181
 			// If override, do not proceed to update the option, just return result.
182 182
 			return $test_save;
183 183
 		}
@@ -192,7 +192,7 @@  discard block
 block discarded – undo
192 192
 		 * @param bool        $autoload   Whether to load the option when WordPress starts up.
193 193
 		 * @param CMB2_Option $cmb_option This object.
194 194
 		 */
195
-		$autoload = apply_filters( "cmb2_should_autoload_{$this->key}", true, $this );
195
+		$autoload = apply_filters("cmb2_should_autoload_{$this->key}", true, $this);
196 196
 
197 197
 		return update_option(
198 198
 			$this->key,
@@ -211,16 +211,16 @@  discard block
 block discarded – undo
211 211
 	 * @param  mixed $default Optional. Default value to return if the option does not exist.
212 212
 	 * @return mixed          Value set for the option.
213 213
 	 */
214
-	public function get_options( $default = null ) {
215
-		if ( empty( $this->options ) && ! empty( $this->key ) ) {
214
+	public function get_options($default = null) {
215
+		if (empty($this->options) && ! empty($this->key)) {
216 216
 
217
-			$test_get = apply_filters( "cmb2_override_option_get_{$this->key}", 'cmb2_no_override_option_get', $default, $this );
217
+			$test_get = apply_filters("cmb2_override_option_get_{$this->key}", 'cmb2_no_override_option_get', $default, $this);
218 218
 
219
-			if ( 'cmb2_no_override_option_get' !== $test_get ) {
219
+			if ('cmb2_no_override_option_get' !== $test_get) {
220 220
 				$this->options = $test_get;
221 221
 			} else {
222 222
 				// If no override, get the option.
223
-				$this->options = get_option( $this->key, $default );
223
+				$this->options = get_option($this->key, $default);
224 224
 			}
225 225
 		}
226 226
 
@@ -238,13 +238,13 @@  discard block
 block discarded – undo
238 238
 	 * @throws Exception Throws an exception if the field is invalid.
239 239
 	 * @return mixed
240 240
 	 */
241
-	public function __get( $field ) {
242
-		switch ( $field ) {
241
+	public function __get($field) {
242
+		switch ($field) {
243 243
 			case 'options':
244 244
 			case 'key':
245 245
 				return $this->{$field};
246 246
 			default:
247
-				throw new Exception( sprintf( esc_html__( 'Invalid %1$s property: %2$s', 'cmb2' ), __CLASS__, $field ) );
247
+				throw new Exception(sprintf(esc_html__('Invalid %1$s property: %2$s', 'cmb2'), __CLASS__, $field));
248 248
 		}
249 249
 	}
250 250
 }
Please login to merge, or discard this patch.