Completed
Pull Request — trunk (#593)
by
unknown
13:03
created
includes/helper-functions.php 1 patch
Spacing   +19 added lines, -19 removed lines patch added patch discarded remove patch
@@ -178,7 +178,7 @@  discard block
 block discarded – undo
178 178
 		$cmb = CMB2_Boxes::get( $meta_box );
179 179
 	} else {
180 180
 		// See if we already have an instance of this metabox
181
-		$cmb = CMB2_Boxes::get( $meta_box['id'] );
181
+		$cmb = CMB2_Boxes::get( $meta_box[ 'id' ] );
182 182
 		// If not, we'll initate a new metabox
183 183
 		$cmb = $cmb ? $cmb : new CMB2( $meta_box, $object_id );
184 184
 	}
@@ -254,7 +254,7 @@  discard block
 block discarded – undo
254 254
 	) );
255 255
 
256 256
 	// Set object type explicitly (rather than trying to guess from context)
257
-	$cmb->object_type( $args['object_type'] );
257
+	$cmb->object_type( $args[ 'object_type' ] );
258 258
 
259 259
 	// Save the metabox if it's been submitted
260 260
 	// check permissions
@@ -262,32 +262,32 @@  discard block
 block discarded – undo
262 262
 	if (
263 263
 		$cmb->prop( 'save_fields' )
264 264
 		// check nonce
265
-		&& isset( $_POST['submit-cmb'], $_POST['object_id'], $_POST[ $cmb->nonce() ] )
265
+		&& isset( $_POST[ 'submit-cmb' ], $_POST[ 'object_id' ], $_POST[ $cmb->nonce() ] )
266 266
 		&& wp_verify_nonce( $_POST[ $cmb->nonce() ], $cmb->nonce() )
267
-		&& $object_id && $_POST['object_id'] == $object_id
267
+		&& $object_id && $_POST[ 'object_id' ] == $object_id
268 268
 	) {
269 269
 		$cmb->save_fields( $object_id, $cmb->object_type(), $_POST );
270 270
 	}
271 271
 
272 272
 	// Enqueue JS/CSS
273
-	if ( $args['cmb_styles'] ) {
273
+	if ( $args[ 'cmb_styles' ] ) {
274 274
 		CMB2_hookup::enqueue_cmb_css();
275 275
 	}
276 276
 
277
-	if ( $args['enqueue_js'] ) {
277
+	if ( $args[ 'enqueue_js' ] ) {
278 278
 		CMB2_hookup::enqueue_cmb_js();
279 279
 	}
280 280
 
281
-	$form_format = apply_filters( 'cmb2_get_metabox_form_format', $args['form_format'], $object_id, $cmb );
281
+	$form_format = apply_filters( 'cmb2_get_metabox_form_format', $args[ 'form_format' ], $object_id, $cmb );
282 282
 
283 283
 	$format_parts = explode( '%3$s', $form_format );
284 284
 
285 285
 	// Show cmb form
286
-	printf( $format_parts[0], $cmb->cmb_id, $object_id );
286
+	printf( $format_parts[ 0 ], $cmb->cmb_id, $object_id );
287 287
 	$cmb->show_form();
288 288
 
289
-	if ( isset( $format_parts[1] ) && $format_parts[1] ) {
290
-		printf( str_ireplace( '%4$s', '%1$s', $format_parts[1] ), $args['save_button'] );
289
+	if ( isset( $format_parts[ 1 ] ) && $format_parts[ 1 ] ) {
290
+		printf( str_ireplace( '%4$s', '%1$s', $format_parts[ 1 ] ), $args[ 'save_button' ] );
291 291
 	}
292 292
 
293 293
 }
@@ -300,7 +300,7 @@  discard block
 block discarded – undo
300 300
  * @param  array   $args      Optional arguments array
301 301
  */
302 302
 function cmb2_metabox_form( $meta_box, $object_id = 0, $args = array() ) {
303
-	if ( ! isset( $args['echo'] ) || $args['echo'] ) {
303
+	if ( ! isset( $args[ 'echo' ] ) || $args[ 'echo' ] ) {
304 304
 		cmb2_print_metabox_form( $meta_box, $object_id, $args );
305 305
 	} else {
306 306
 		return cmb2_get_metabox_form( $meta_box, $object_id, $args );
@@ -322,7 +322,7 @@  discard block
 block discarded – undo
322 322
 
323 323
 		$schedule_format = str_replace(
324 324
 			array( 'M', 'Y', 'm', 'd', 'H', 'i', 'a' ),
325
-			array('%b', '%Y', '%m', '%d', '%H', '%M', '%p' ),
325
+			array( '%b', '%Y', '%m', '%d', '%H', '%M', '%p' ),
326 326
 			$date_format
327 327
 		);
328 328
 
@@ -339,14 +339,14 @@  discard block
 block discarded – undo
339 339
 			 * 4 or 2 characters, as needed
340 340
 			 */
341 341
 			'%04d-%02d-%02d %02d:%02d:%02d',
342
-			$parsed_time['tm_year'] + 1900,  // This will be "111", so we need to add 1900.
343
-			$parsed_time['tm_mon'] + 1,      // This will be the month minus one, so we add one.
344
-			$parsed_time['tm_mday'],
345
-			$parsed_time['tm_hour'],
346
-			$parsed_time['tm_min'],
347
-			$parsed_time['tm_sec']
342
+			$parsed_time[ 'tm_year' ] + 1900, // This will be "111", so we need to add 1900.
343
+			$parsed_time[ 'tm_mon' ] + 1, // This will be the month minus one, so we add one.
344
+			$parsed_time[ 'tm_mday' ],
345
+			$parsed_time[ 'tm_hour' ],
346
+			$parsed_time[ 'tm_min' ],
347
+			$parsed_time[ 'tm_sec' ]
348 348
 		);
349 349
 
350
-		return new DateTime($ymd);
350
+		return new DateTime( $ymd );
351 351
 	}
352 352
 }
Please login to merge, or discard this patch.
includes/CMB2_hookup.php 1 patch
Spacing   +9 added lines, -9 removed lines patch added patch discarded remove patch
@@ -243,14 +243,14 @@  discard block
 block discarded – undo
243 243
 				}
244 244
 
245 245
 				foreach ( $this->cmb->prop( 'fields' ) as $meta_box => $field ) {
246
-					if ( isset( $field['taxonomy'] ) && ! empty( $field['remove_default'] ) ) {
247
-						if ( ! is_taxonomy( $field['taxonomy'] ) ) {
246
+					if ( isset( $field[ 'taxonomy' ] ) && ! empty( $field[ 'remove_default' ] ) ) {
247
+						if ( ! is_taxonomy( $field[ 'taxonomy' ] ) ) {
248 248
 							continue;
249 249
 						}
250
-						if ( is_taxonomy_hierarchical( $field['taxonomy'] ) ) {
251
-							remove_meta_box( $field['taxonomy'] . 'div', $post_type, 'side' );
250
+						if ( is_taxonomy_hierarchical( $field[ 'taxonomy' ] ) ) {
251
+							remove_meta_box( $field[ 'taxonomy' ] . 'div', $post_type, 'side' );
252 252
 						} else {
253
-							remove_meta_box( 'tagsdiv-' . $field['taxnomy'], $post_type, 'side' );
253
+							remove_meta_box( 'tagsdiv-' . $field[ 'taxnomy' ], $post_type, 'side' );
254 254
 						}
255 255
 					}
256 256
 				}
@@ -267,7 +267,7 @@  discard block
 block discarded – undo
267 267
 	 * @return array           Modified array of classes
268 268
 	 */
269 269
 	public function close_metabox_class( $classes ) {
270
-		$classes[] = 'closed';
270
+		$classes[ ] = 'closed';
271 271
 		return $classes;
272 272
 	}
273 273
 
@@ -287,7 +287,7 @@  discard block
 block discarded – undo
287 287
 	public function user_new_metabox( $section ) {
288 288
 		if ( $section == $this->cmb->prop( 'new_user_section' ) ) {
289 289
 			$object_id = $this->cmb->object_id();
290
-			$this->cmb->object_id( isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id );
290
+			$this->cmb->object_id( isset( $_REQUEST[ 'user_id' ] ) ? $_REQUEST[ 'user_id' ] : $object_id );
291 291
 			$this->user_metabox();
292 292
 		}
293 293
 	}
@@ -467,7 +467,7 @@  discard block
 block discarded – undo
467 467
 		if ( $this->taxonomy_can_save( $taxonomy ) ) {
468 468
 
469 469
 			foreach ( $this->cmb->prop( 'fields' ) as $field ) {
470
-				$data_to_delete[ $field['id'] ] = '';
470
+				$data_to_delete[ $field[ 'id' ] ] = '';
471 471
 			}
472 472
 
473 473
 			$this->cmb->save_fields( $term_id, 'term', $data_to_delete );
@@ -530,7 +530,7 @@  discard block
 block discarded – undo
530 530
 			return;
531 531
 		}
532 532
 
533
-		self::$hooks_completed[] = $key;
533
+		self::$hooks_completed[ ] = $key;
534 534
 		add_filter( $action, $hook, $priority, $accepted_args );
535 535
 	}
536 536
 
Please login to merge, or discard this patch.