@@ -30,7 +30,7 @@ discard block |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $file = cmb2_dir( "includes/{$class_name}.php" ); |
| 33 | - if( file_exists( $file ) ) |
|
| 33 | + if ( file_exists( $file ) ) |
|
| 34 | 34 | include_once( $file ); |
| 35 | 35 | } |
| 36 | 36 | |
@@ -180,7 +180,7 @@ discard block |
||
| 180 | 180 | $cmb = CMB2_Boxes::get( $meta_box ); |
| 181 | 181 | } else { |
| 182 | 182 | // See if we already have an instance of this metabox |
| 183 | - $cmb = CMB2_Boxes::get( $meta_box['id'] ); |
|
| 183 | + $cmb = CMB2_Boxes::get( $meta_box[ 'id' ] ); |
|
| 184 | 184 | // If not, we'll initate a new metabox |
| 185 | 185 | $cmb = $cmb ? $cmb : new CMB2( $meta_box, $object_id ); |
| 186 | 186 | } |
@@ -256,7 +256,7 @@ discard block |
||
| 256 | 256 | ) ); |
| 257 | 257 | |
| 258 | 258 | // Set object type explicitly (rather than trying to guess from context) |
| 259 | - $cmb->object_type( $args['object_type'] ); |
|
| 259 | + $cmb->object_type( $args[ 'object_type' ] ); |
|
| 260 | 260 | |
| 261 | 261 | // Save the metabox if it's been submitted |
| 262 | 262 | // check permissions |
@@ -264,32 +264,32 @@ discard block |
||
| 264 | 264 | if ( |
| 265 | 265 | $cmb->prop( 'save_fields' ) |
| 266 | 266 | // check nonce |
| 267 | - && isset( $_POST['submit-cmb'], $_POST['object_id'], $_POST[ $cmb->nonce() ] ) |
|
| 267 | + && isset( $_POST[ 'submit-cmb' ], $_POST[ 'object_id' ], $_POST[ $cmb->nonce() ] ) |
|
| 268 | 268 | && wp_verify_nonce( $_POST[ $cmb->nonce() ], $cmb->nonce() ) |
| 269 | - && $object_id && $_POST['object_id'] == $object_id |
|
| 269 | + && $object_id && $_POST[ 'object_id' ] == $object_id |
|
| 270 | 270 | ) { |
| 271 | 271 | $cmb->save_fields( $object_id, $cmb->object_type(), $_POST ); |
| 272 | 272 | } |
| 273 | 273 | |
| 274 | 274 | // Enqueue JS/CSS |
| 275 | - if ( $args['cmb_styles'] ) { |
|
| 275 | + if ( $args[ 'cmb_styles' ] ) { |
|
| 276 | 276 | CMB2_hookup::enqueue_cmb_css(); |
| 277 | 277 | } |
| 278 | 278 | |
| 279 | - if ( $args['enqueue_js'] ) { |
|
| 279 | + if ( $args[ 'enqueue_js' ] ) { |
|
| 280 | 280 | CMB2_hookup::enqueue_cmb_js(); |
| 281 | 281 | } |
| 282 | 282 | |
| 283 | - $form_format = apply_filters( 'cmb2_get_metabox_form_format', $args['form_format'], $object_id, $cmb ); |
|
| 283 | + $form_format = apply_filters( 'cmb2_get_metabox_form_format', $args[ 'form_format' ], $object_id, $cmb ); |
|
| 284 | 284 | |
| 285 | 285 | $format_parts = explode( '%3$s', $form_format ); |
| 286 | 286 | |
| 287 | 287 | // Show cmb form |
| 288 | - printf( $format_parts[0], $cmb->cmb_id, $object_id ); |
|
| 288 | + printf( $format_parts[ 0 ], $cmb->cmb_id, $object_id ); |
|
| 289 | 289 | $cmb->show_form(); |
| 290 | 290 | |
| 291 | - if ( isset( $format_parts[1] ) && $format_parts[1] ) { |
|
| 292 | - printf( str_ireplace( '%4$s', '%1$s', $format_parts[1] ), $args['save_button'] ); |
|
| 291 | + if ( isset( $format_parts[ 1 ] ) && $format_parts[ 1 ] ) { |
|
| 292 | + printf( str_ireplace( '%4$s', '%1$s', $format_parts[ 1 ] ), $args[ 'save_button' ] ); |
|
| 293 | 293 | } |
| 294 | 294 | |
| 295 | 295 | } |
@@ -302,7 +302,7 @@ discard block |
||
| 302 | 302 | * @param array $args Optional arguments array |
| 303 | 303 | */ |
| 304 | 304 | function cmb2_metabox_form( $meta_box, $object_id = 0, $args = array() ) { |
| 305 | - if ( ! isset( $args['echo'] ) || $args['echo'] ) { |
|
| 305 | + if ( ! isset( $args[ 'echo' ] ) || $args[ 'echo' ] ) { |
|
| 306 | 306 | cmb2_print_metabox_form( $meta_box, $object_id, $args ); |
| 307 | 307 | } else { |
| 308 | 308 | return cmb2_get_metabox_form( $meta_box, $object_id, $args ); |
@@ -324,7 +324,7 @@ discard block |
||
| 324 | 324 | |
| 325 | 325 | $schedule_format = str_replace( |
| 326 | 326 | array( 'M', 'Y', 'm', 'd', 'H', 'i', 'a' ), |
| 327 | - array('%b', '%Y', '%m', '%d', '%H', '%M', '%p' ), |
|
| 327 | + array( '%b', '%Y', '%m', '%d', '%H', '%M', '%p' ), |
|
| 328 | 328 | $date_format |
| 329 | 329 | ); |
| 330 | 330 | |
@@ -341,14 +341,14 @@ discard block |
||
| 341 | 341 | * 4 or 2 characters, as needed |
| 342 | 342 | */ |
| 343 | 343 | '%04d-%02d-%02d %02d:%02d:%02d', |
| 344 | - $parsed_time['tm_year'] + 1900, // This will be "111", so we need to add 1900. |
|
| 345 | - $parsed_time['tm_mon'] + 1, // This will be the month minus one, so we add one. |
|
| 346 | - $parsed_time['tm_mday'], |
|
| 347 | - $parsed_time['tm_hour'], |
|
| 348 | - $parsed_time['tm_min'], |
|
| 349 | - $parsed_time['tm_sec'] |
|
| 344 | + $parsed_time[ 'tm_year' ] + 1900, // This will be "111", so we need to add 1900. |
|
| 345 | + $parsed_time[ 'tm_mon' ] + 1, // This will be the month minus one, so we add one. |
|
| 346 | + $parsed_time[ 'tm_mday' ], |
|
| 347 | + $parsed_time[ 'tm_hour' ], |
|
| 348 | + $parsed_time[ 'tm_min' ], |
|
| 349 | + $parsed_time[ 'tm_sec' ] |
|
| 350 | 350 | ); |
| 351 | 351 | |
| 352 | - return new DateTime($ymd); |
|
| 352 | + return new DateTime( $ymd ); |
|
| 353 | 353 | } |
| 354 | 354 | } |
@@ -30,9 +30,10 @@ |
||
| 30 | 30 | } |
| 31 | 31 | |
| 32 | 32 | $file = cmb2_dir( "includes/{$class_name}.php" ); |
| 33 | - if( file_exists( $file ) ) |
|
| 34 | - include_once( $file ); |
|
| 35 | -} |
|
| 33 | + if( file_exists( $file ) ) { |
|
| 34 | + include_once( $file ); |
|
| 35 | + } |
|
| 36 | + } |
|
| 36 | 37 | |
| 37 | 38 | /** |
| 38 | 39 | * Get instance of the CMB2_Utils class |