@@ -27,15 +27,15 @@ discard block |
||
| 27 | 27 | * @return mixed show_on key or false |
| 28 | 28 | */ |
| 29 | 29 | private static function get_show_on_key( $meta_box_args ) { |
| 30 | - $show_on = isset( $meta_box_args['show_on'] ) ? (array) $meta_box_args['show_on'] : false; |
|
| 30 | + $show_on = isset( $meta_box_args[ 'show_on' ] ) ? (array) $meta_box_args[ 'show_on' ] : false; |
|
| 31 | 31 | if ( $show_on && is_array( $show_on ) ) { |
| 32 | 32 | |
| 33 | 33 | if ( array_key_exists( 'key', $show_on ) ) { |
| 34 | - return $show_on['key']; |
|
| 34 | + return $show_on[ 'key' ]; |
|
| 35 | 35 | } |
| 36 | 36 | |
| 37 | 37 | $keys = array_keys( $show_on ); |
| 38 | - return $keys[0]; |
|
| 38 | + return $keys[ 0 ]; |
|
| 39 | 39 | } |
| 40 | 40 | |
| 41 | 41 | return false; |
@@ -51,17 +51,17 @@ discard block |
||
| 51 | 51 | * @return mixed show_on value or false |
| 52 | 52 | */ |
| 53 | 53 | private static function get_show_on_value( $meta_box_args ) { |
| 54 | - $show_on = isset( $meta_box_args['show_on'] ) ? (array) $meta_box_args['show_on'] : false; |
|
| 54 | + $show_on = isset( $meta_box_args[ 'show_on' ] ) ? (array) $meta_box_args[ 'show_on' ] : false; |
|
| 55 | 55 | |
| 56 | 56 | if ( $show_on && is_array( $show_on ) ) { |
| 57 | 57 | |
| 58 | 58 | if ( array_key_exists( 'value', $show_on ) ) { |
| 59 | - return $show_on['value']; |
|
| 59 | + return $show_on[ 'value' ]; |
|
| 60 | 60 | } |
| 61 | 61 | |
| 62 | 62 | $keys = array_keys( $show_on ); |
| 63 | 63 | |
| 64 | - return $show_on[ $keys[0] ]; |
|
| 64 | + return $show_on[ $keys[ 0 ] ]; |
|
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | return array(); |
@@ -145,7 +145,7 @@ discard block |
||
| 145 | 145 | if ( is_admin() ) { |
| 146 | 146 | |
| 147 | 147 | // If there is no 'page' query var, our filter isn't applicable |
| 148 | - if ( ! isset( $_GET['page'] ) ) { |
|
| 148 | + if ( ! isset( $_GET[ 'page' ] ) ) { |
|
| 149 | 149 | return $display; |
| 150 | 150 | } |
| 151 | 151 | |
@@ -157,12 +157,12 @@ discard block |
||
| 157 | 157 | |
| 158 | 158 | if ( is_array( $show_on ) ) { |
| 159 | 159 | foreach ( $show_on as $page ) { |
| 160 | - if ( $_GET['page'] == $page ) { |
|
| 160 | + if ( $_GET[ 'page' ] == $page ) { |
|
| 161 | 161 | return true; |
| 162 | 162 | } |
| 163 | 163 | } |
| 164 | 164 | } else { |
| 165 | - if ( $_GET['page'] == $show_on ) { |
|
| 165 | + if ( $_GET[ 'page' ] == $show_on ) { |
|
| 166 | 166 | return true; |
| 167 | 167 | } |
| 168 | 168 | } |
@@ -205,8 +205,8 @@ discard block |
||
| 205 | 205 | $options = $this->field->options(); |
| 206 | 206 | |
| 207 | 207 | $fallback = $this->field->args( 'show_option_none' ); |
| 208 | - if ( ! $fallback && isset( $options[''] ) ) { |
|
| 209 | - $fallback = $options['']; |
|
| 208 | + if ( ! $fallback && isset( $options[ '' ] ) ) { |
|
| 209 | + $fallback = $options[ '' ]; |
|
| 210 | 210 | } |
| 211 | 211 | if ( ! $this->value && $fallback ) { |
| 212 | 212 | echo $fallback; |
@@ -234,9 +234,9 @@ discard block |
||
| 234 | 234 | $output = array(); |
| 235 | 235 | foreach ( $this->value as $val ) { |
| 236 | 236 | if ( isset( $options[ $val ] ) ) { |
| 237 | - $output[] = $options[ $val ]; |
|
| 237 | + $output[ ] = $options[ $val ]; |
|
| 238 | 238 | } else { |
| 239 | - $output[] = esc_attr( $val ); |
|
| 239 | + $output[ ] = esc_attr( $val ); |
|
| 240 | 240 | } |
| 241 | 241 | } |
| 242 | 242 | |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | if ( $datetime && $datetime instanceof DateTime ) { |
| 308 | 308 | $tz = $datetime->getTimezone(); |
| 309 | 309 | $tzstring = $tz->getName(); |
| 310 | - $this->value = $datetime->getTimestamp(); |
|
| 310 | + $this->value = $datetime->getTimestamp(); |
|
| 311 | 311 | } |
| 312 | 312 | |
| 313 | 313 | $date = $this->field->get_timestamp_format( 'date_format', $this->value ); |
@@ -359,10 +359,10 @@ discard block |
||
| 359 | 359 | $terms = array(); |
| 360 | 360 | if ( is_array( $default ) ) { |
| 361 | 361 | foreach ( $default as $slug ) { |
| 362 | - $terms[] = get_term_by( 'slug', $slug, $taxonomy ); |
|
| 362 | + $terms[ ] = get_term_by( 'slug', $slug, $taxonomy ); |
|
| 363 | 363 | } |
| 364 | 364 | } else { |
| 365 | - $terms[] = get_term_by( 'slug', $default, $taxonomy ); |
|
| 365 | + $terms[ ] = get_term_by( 'slug', $default, $taxonomy ); |
|
| 366 | 366 | } |
| 367 | 367 | } |
| 368 | 368 | |
@@ -371,7 +371,7 @@ discard block |
||
| 371 | 371 | $links = array(); |
| 372 | 372 | foreach ( $terms as $term ) { |
| 373 | 373 | $link = get_edit_term_link( $term->term_id, $taxonomy ); |
| 374 | - $links[] = '<a href="' . esc_url( $link ) . '">' . esc_html( $term->name ) . '</a>'; |
|
| 374 | + $links[ ] = '<a href="' . esc_url( $link ) . '">' . esc_html( $term->name ) . '</a>'; |
|
| 375 | 375 | } |
| 376 | 376 | // Then loop and output. |
| 377 | 377 | echo '<div class="cmb2-taxonomy-terms-', esc_attr( $taxonomy ), '">'; |
@@ -418,7 +418,7 @@ discard block |
||
| 418 | 418 | 'class' => 'cmb-image-display', |
| 419 | 419 | ) ); |
| 420 | 420 | } else { |
| 421 | - $size = is_array( $img_size ) ? $img_size[0] : 200; |
|
| 421 | + $size = is_array( $img_size ) ? $img_size[ 0 ] : 200; |
|
| 422 | 422 | $image = '<img class="cmb-image-display" style="max-width: ' . absint( $size ) . 'px; width: 100%; height: auto;" src="' . $url_value . '" alt="" />'; |
| 423 | 423 | } |
| 424 | 424 | |
@@ -57,7 +57,7 @@ discard block |
||
| 57 | 57 | |
| 58 | 58 | // Check for methods to be proxied to the CMB2_Type_Base object. |
| 59 | 59 | if ( $exists = $this->maybe_proxy_method( $fieldtype, $arguments ) ) { |
| 60 | - return $exists['value']; |
|
| 60 | + return $exists[ 'value' ]; |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | // Check for custom field type class. |
@@ -503,8 +503,8 @@ discard block |
||
| 503 | 503 | 'class' => 'cmb2-hidden', |
| 504 | 504 | ); |
| 505 | 505 | if ( $this->field->group ) { |
| 506 | - $args['data-groupid'] = $this->field->group->id(); |
|
| 507 | - $args['data-iterator'] = $this->iterator; |
|
| 506 | + $args[ 'data-groupid' ] = $this->field->group->id(); |
|
| 507 | + $args[ 'data-iterator' ] = $this->iterator; |
|
| 508 | 508 | } |
| 509 | 509 | |
| 510 | 510 | return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text', $args, 'input' )->render(); |
@@ -233,7 +233,8 @@ |
||
| 233 | 233 | $tzstring = ''; |
| 234 | 234 | } |
| 235 | 235 | |
| 236 | - if ( empty( $tzstring ) ) { // Create a UTC+- zone if no timezone string exists |
|
| 236 | + if ( empty( $tzstring ) ) { |
|
| 237 | +// Create a UTC+- zone if no timezone string exists |
|
| 237 | 238 | if ( 0 == $current_offset ) { |
| 238 | 239 | $tzstring = 'UTC+0'; |
| 239 | 240 | } elseif ( $current_offset < 0 ) { |
@@ -510,7 +510,7 @@ |
||
| 510 | 510 | */ |
| 511 | 511 | public static function log_if_debug( $function, $line, $msg, $debug = null ) { |
| 512 | 512 | if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) { |
| 513 | - error_log( "In $function, $line:" . print_r( $msg, true ) . ( $debug ? print_r( $debug, true ) : '' ) ); |
|
| 513 | + error_log( "in $function, $line:" . print_r( $msg, true ) . ( $debug ? print_r( $debug, true ) : '' ) ); |
|
| 514 | 514 | } |
| 515 | 515 | } |
| 516 | 516 | |
@@ -40,7 +40,7 @@ discard block |
||
| 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 | |
@@ -65,8 +65,8 @@ discard block |
||
| 65 | 65 | |
| 66 | 66 | foreach ( $query->posts as $post_id ) { |
| 67 | 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(); |
|
| 68 | + $original_file = basename( $meta[ 'file' ] ); |
|
| 69 | + $cropped_image_files = isset( $meta[ 'sizes' ] ) ? wp_list_pluck( $meta[ 'sizes' ], 'file' ) : array(); |
|
| 70 | 70 | if ( $original_file === $file || in_array( $file, $cropped_image_files ) ) { |
| 71 | 71 | $attachment_id = $post_id; |
| 72 | 72 | break; |
@@ -128,31 +128,31 @@ discard block |
||
| 128 | 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 | 154 | if ( $matched ) { |
| 155 | - $candidates[ $data['width'] * $data['height'] ] = array( $_size, $data ); |
|
| 155 | + $candidates[ $data[ 'width' ] * $data[ 'height' ] ] = array( $_size, $data ); |
|
| 156 | 156 | } |
| 157 | 157 | } |
| 158 | 158 | } |
@@ -164,8 +164,8 @@ discard block |
||
| 164 | 164 | } |
| 165 | 165 | |
| 166 | 166 | $data = array_shift( $candidates ); |
| 167 | - $data = $data[0]; |
|
| 168 | - } elseif ( ! empty( $image_sizes['thumbnail'] ) && $image_sizes['thumbnail']['width'] >= $size[0] && $image_sizes['thumbnail']['width'] >= $size[1] ) { |
|
| 167 | + $data = $data[ 0 ]; |
|
| 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. |
@@ -259,8 +259,7 @@ discard block |
||
| 259 | 259 | } |
| 260 | 260 | |
| 261 | 261 | return self::is_valid_time_stamp( $string ) |
| 262 | - ? (int) $string : |
|
| 263 | - strtotime( (string) $string ); |
|
| 262 | + ? (int) $string : strtotime( (string) $string ); |
|
| 264 | 263 | } |
| 265 | 264 | |
| 266 | 265 | /** |
@@ -467,27 +466,27 @@ discard block |
||
| 467 | 466 | |
| 468 | 467 | // order is relevant here, since the replacement will be done sequentially. |
| 469 | 468 | $supported_options = array( |
| 470 | - 'd' => 'dd', // Day, leading 0 |
|
| 471 | - 'j' => 'd', // Day, no 0 |
|
| 472 | - 'z' => 'o', // Day of the year, no leading zeroes, |
|
| 469 | + 'd' => 'dd', // Day, leading 0 |
|
| 470 | + 'j' => 'd', // Day, no 0 |
|
| 471 | + 'z' => 'o', // Day of the year, no leading zeroes, |
|
| 473 | 472 | // 'D' => 'D', // Day name short, not sure how it'll work with translations |
| 474 | - 'l ' => 'DD ', // Day name full, idem before |
|
| 475 | - 'l, ' => 'DD, ', // Day name full, idem before |
|
| 476 | - 'm' => 'mm', // Month of the year, leading 0 |
|
| 477 | - 'n' => 'm', // Month of the year, no leading 0 |
|
| 473 | + 'l ' => 'DD ', // Day name full, idem before |
|
| 474 | + 'l, ' => 'DD, ', // Day name full, idem before |
|
| 475 | + 'm' => 'mm', // Month of the year, leading 0 |
|
| 476 | + 'n' => 'm', // Month of the year, no leading 0 |
|
| 478 | 477 | // 'M' => 'M', // Month, Short name |
| 479 | - 'F ' => 'MM ', // Month, full name, |
|
| 480 | - 'F, ' => 'MM, ', // Month, full name, |
|
| 481 | - 'y' => 'y', // Year, two digit |
|
| 482 | - 'Y' => 'yy', // Year, full |
|
| 483 | - 'H' => 'HH', // Hour with leading 0 (24 hour) |
|
| 484 | - 'G' => 'H', // Hour with no leading 0 (24 hour) |
|
| 485 | - 'h' => 'hh', // Hour with leading 0 (12 hour) |
|
| 486 | - 'g' => 'h', // Hour with no leading 0 (12 hour), |
|
| 487 | - 'i' => 'mm', // Minute with leading 0, |
|
| 488 | - 's' => 'ss', // Second with leading 0, |
|
| 489 | - 'a' => 'tt', // am/pm |
|
| 490 | - 'A' => 'TT',// AM/PM |
|
| 478 | + 'F ' => 'MM ', // Month, full name, |
|
| 479 | + 'F, ' => 'MM, ', // Month, full name, |
|
| 480 | + 'y' => 'y', // Year, two digit |
|
| 481 | + 'Y' => 'yy', // Year, full |
|
| 482 | + 'H' => 'HH', // Hour with leading 0 (24 hour) |
|
| 483 | + 'G' => 'H', // Hour with no leading 0 (24 hour) |
|
| 484 | + 'h' => 'hh', // Hour with leading 0 (12 hour) |
|
| 485 | + 'g' => 'h', // Hour with no leading 0 (12 hour), |
|
| 486 | + 'i' => 'mm', // Minute with leading 0, |
|
| 487 | + 's' => 'ss', // Second with leading 0, |
|
| 488 | + 'a' => 'tt', // am/pm |
|
| 489 | + 'A' => 'TT', // AM/PM |
|
| 491 | 490 | ); |
| 492 | 491 | |
| 493 | 492 | foreach ( $supported_options as $php => $js ) { |
@@ -496,8 +495,8 @@ discard block |
||
| 496 | 495 | } |
| 497 | 496 | |
| 498 | 497 | $supported_options = array( |
| 499 | - 'l' => 'DD', // Day name full, idem before |
|
| 500 | - 'F' => 'MM', // Month, full name, |
|
| 498 | + 'l' => 'DD', // Day name full, idem before |
|
| 499 | + 'F' => 'MM', // Month, full name, |
|
| 501 | 500 | ); |
| 502 | 501 | |
| 503 | 502 | if ( isset( $supported_options[ $format ] ) ) { |
@@ -517,7 +516,7 @@ discard block |
||
| 517 | 516 | * @return string Modified value |
| 518 | 517 | */ |
| 519 | 518 | public static function wrap_escaped_chars( $value ) { |
| 520 | - return ''' . str_replace( '\\', '', $value[0] ) . '''; |
|
| 519 | + return ''' . str_replace( '\\', '', $value[ 0 ] ) . '''; |
|
| 521 | 520 | } |
| 522 | 521 | |
| 523 | 522 | /** |
@@ -580,7 +579,7 @@ discard block |
||
| 580 | 579 | * @return string String of attributes for form element. |
| 581 | 580 | */ |
| 582 | 581 | public static function concat_attrs( $attrs, $attr_exclude = array() ) { |
| 583 | - $attr_exclude[] = 'rendered'; |
|
| 582 | + $attr_exclude[ ] = 'rendered'; |
|
| 584 | 583 | $attributes = ''; |
| 585 | 584 | foreach ( $attrs as $attr => $val ) { |
| 586 | 585 | $excluded = in_array( $attr, (array) $attr_exclude, true ); |
@@ -96,18 +96,18 @@ discard block |
||
| 96 | 96 | $oembed = cmb2_ajax()->get_oembed_no_edit( $args ); |
| 97 | 97 | |
| 98 | 98 | // Send back our embed |
| 99 | - if ( $oembed['embed'] && $oembed['embed'] != $oembed['fallback'] ) { |
|
| 100 | - return '<div class="cmb2-oembed">' . $oembed['embed'] . '</div>'; |
|
| 99 | + if ( $oembed[ 'embed' ] && $oembed[ 'embed' ] != $oembed[ 'fallback' ] ) { |
|
| 100 | + return '<div class="cmb2-oembed">' . $oembed[ 'embed' ] . '</div>'; |
|
| 101 | 101 | } |
| 102 | 102 | |
| 103 | 103 | $error = sprintf( |
| 104 | 104 | /* translators: 1: results for. 2: link to codex.wordpress.org/Embeds */ |
| 105 | 105 | esc_html__( 'No oEmbed Results Found for %1$s. View more info at %2$s.', 'cmb2' ), |
| 106 | - $oembed['fallback'], |
|
| 106 | + $oembed[ 'fallback' ], |
|
| 107 | 107 | '<a href="https://codex.wordpress.org/Embeds" target="_blank">codex.wordpress.org/Embeds</a>' |
| 108 | 108 | ); |
| 109 | 109 | |
| 110 | - if ( isset( $args['wp_error'] ) && $args['wp_error'] ) { |
|
| 110 | + if ( isset( $args[ 'wp_error' ] ) && $args[ 'wp_error' ] ) { |
|
| 111 | 111 | return new WP_Error( 'cmb2_get_oembed_result', $error, compact( 'oembed', 'args' ) ); |
| 112 | 112 | } |
| 113 | 113 | |
@@ -229,7 +229,7 @@ discard block |
||
| 229 | 229 | $cmb = CMB2_Boxes::get( $meta_box ); |
| 230 | 230 | } else { |
| 231 | 231 | // See if we already have an instance of this metabox |
| 232 | - $cmb = CMB2_Boxes::get( $meta_box['id'] ); |
|
| 232 | + $cmb = CMB2_Boxes::get( $meta_box[ 'id' ] ); |
|
| 233 | 233 | // If not, we'll initate a new metabox |
| 234 | 234 | $cmb = $cmb ? $cmb : new CMB2( $meta_box, $object_id ); |
| 235 | 235 | } |
@@ -307,7 +307,7 @@ discard block |
||
| 307 | 307 | ) ); |
| 308 | 308 | |
| 309 | 309 | // Set object type explicitly (rather than trying to guess from context) |
| 310 | - $cmb->object_type( $args['object_type'] ); |
|
| 310 | + $cmb->object_type( $args[ 'object_type' ] ); |
|
| 311 | 311 | |
| 312 | 312 | // Save the metabox if it's been submitted |
| 313 | 313 | // check permissions |
@@ -315,32 +315,32 @@ discard block |
||
| 315 | 315 | if ( |
| 316 | 316 | $cmb->prop( 'save_fields' ) |
| 317 | 317 | // check nonce |
| 318 | - && isset( $_POST['submit-cmb'], $_POST['object_id'], $_POST[ $cmb->nonce() ] ) |
|
| 318 | + && isset( $_POST[ 'submit-cmb' ], $_POST[ 'object_id' ], $_POST[ $cmb->nonce() ] ) |
|
| 319 | 319 | && wp_verify_nonce( $_POST[ $cmb->nonce() ], $cmb->nonce() ) |
| 320 | - && $object_id && $_POST['object_id'] == $object_id |
|
| 320 | + && $object_id && $_POST[ 'object_id' ] == $object_id |
|
| 321 | 321 | ) { |
| 322 | 322 | $cmb->save_fields( $object_id, $cmb->object_type(), $_POST ); |
| 323 | 323 | } |
| 324 | 324 | |
| 325 | 325 | // Enqueue JS/CSS |
| 326 | - if ( $args['cmb_styles'] ) { |
|
| 326 | + if ( $args[ 'cmb_styles' ] ) { |
|
| 327 | 327 | CMB2_hookup::enqueue_cmb_css(); |
| 328 | 328 | } |
| 329 | 329 | |
| 330 | - if ( $args['enqueue_js'] ) { |
|
| 330 | + if ( $args[ 'enqueue_js' ] ) { |
|
| 331 | 331 | CMB2_hookup::enqueue_cmb_js(); |
| 332 | 332 | } |
| 333 | 333 | |
| 334 | - $form_format = apply_filters( 'cmb2_get_metabox_form_format', $args['form_format'], $object_id, $cmb ); |
|
| 334 | + $form_format = apply_filters( 'cmb2_get_metabox_form_format', $args[ 'form_format' ], $object_id, $cmb ); |
|
| 335 | 335 | |
| 336 | 336 | $format_parts = explode( '%3$s', $form_format ); |
| 337 | 337 | |
| 338 | 338 | // Show cmb form |
| 339 | - printf( $format_parts[0], $cmb->cmb_id, $object_id ); |
|
| 339 | + printf( $format_parts[ 0 ], $cmb->cmb_id, $object_id ); |
|
| 340 | 340 | $cmb->show_form(); |
| 341 | 341 | |
| 342 | - if ( isset( $format_parts[1] ) && $format_parts[1] ) { |
|
| 343 | - printf( str_ireplace( '%4$s', '%1$s', $format_parts[1] ), $args['save_button'] ); |
|
| 342 | + if ( isset( $format_parts[ 1 ] ) && $format_parts[ 1 ] ) { |
|
| 343 | + printf( str_ireplace( '%4$s', '%1$s', $format_parts[ 1 ] ), $args[ 'save_button' ] ); |
|
| 344 | 344 | } |
| 345 | 345 | |
| 346 | 346 | } |
@@ -354,7 +354,7 @@ discard block |
||
| 354 | 354 | * @param array $args Optional arguments array |
| 355 | 355 | */ |
| 356 | 356 | function cmb2_metabox_form( $meta_box, $object_id = 0, $args = array() ) { |
| 357 | - if ( ! isset( $args['echo'] ) || $args['echo'] ) { |
|
| 357 | + if ( ! isset( $args[ 'echo' ] ) || $args[ 'echo' ] ) { |
|
| 358 | 358 | cmb2_print_metabox_form( $meta_box, $object_id, $args ); |
| 359 | 359 | } else { |
| 360 | 360 | return cmb2_get_metabox_form( $meta_box, $object_id, $args ); |
@@ -393,12 +393,12 @@ discard block |
||
| 393 | 393 | * 4 or 2 characters, as needed |
| 394 | 394 | */ |
| 395 | 395 | '%04d-%02d-%02d %02d:%02d:%02d', |
| 396 | - $parsed_time['tm_year'] + 1900, // This will be "111", so we need to add 1900. |
|
| 397 | - $parsed_time['tm_mon'] + 1, // This will be the month minus one, so we add one. |
|
| 398 | - $parsed_time['tm_mday'], |
|
| 399 | - $parsed_time['tm_hour'], |
|
| 400 | - $parsed_time['tm_min'], |
|
| 401 | - $parsed_time['tm_sec'] |
|
| 396 | + $parsed_time[ 'tm_year' ] + 1900, // This will be "111", so we need to add 1900. |
|
| 397 | + $parsed_time[ 'tm_mon' ] + 1, // This will be the month minus one, so we add one. |
|
| 398 | + $parsed_time[ 'tm_mday' ], |
|
| 399 | + $parsed_time[ 'tm_hour' ], |
|
| 400 | + $parsed_time[ 'tm_min' ], |
|
| 401 | + $parsed_time[ 'tm_sec' ] |
|
| 402 | 402 | ); |
| 403 | 403 | |
| 404 | 404 | return new DateTime( $ymd ); |
@@ -55,9 +55,9 @@ |
||
| 55 | 55 | |
| 56 | 56 | // Get object hash.. This bypasses issues with serializing closures. |
| 57 | 57 | if ( is_object( $hook ) ) { |
| 58 | - $args[1] = spl_object_hash( $args[1] ); |
|
| 59 | - } elseif ( is_array( $hook ) && is_object( $hook[0] ) ) { |
|
| 60 | - $args[1][0] = spl_object_hash( $hook[0] ); |
|
| 58 | + $args[ 1 ] = spl_object_hash( $args[ 1 ] ); |
|
| 59 | + } elseif ( is_array( $hook ) && is_object( $hook[ 0 ] ) ) { |
|
| 60 | + $args[ 1 ][ 0 ] = spl_object_hash( $hook[ 0 ] ); |
|
| 61 | 61 | } |
| 62 | 62 | |
| 63 | 63 | $key = md5( serialize( $args ) ); |
@@ -14,7 +14,7 @@ |
||
| 14 | 14 | |
| 15 | 15 | public function render() { |
| 16 | 16 | |
| 17 | - $this->field->args['default'] = $this->field->get_default() |
|
| 17 | + $this->field->args[ 'default' ] = $this->field->get_default() |
|
| 18 | 18 | ? $this->field->get_default() |
| 19 | 19 | : CMB2_Utils::timezone_string(); |
| 20 | 20 | |
@@ -47,7 +47,7 @@ |
||
| 47 | 47 | : $this->is_checked; |
| 48 | 48 | |
| 49 | 49 | if ( $is_checked ) { |
| 50 | - $defaults['checked'] = 'checked'; |
|
| 50 | + $defaults[ 'checked' ] = 'checked'; |
|
| 51 | 51 | } |
| 52 | 52 | |
| 53 | 53 | $args = $this->parse_args( 'checkbox', $defaults ); |
@@ -20,7 +20,7 @@ |
||
| 20 | 20 | 'js_dependencies' => array( 'jquery-ui-core', 'jquery-ui-datepicker' ), |
| 21 | 21 | ) ); |
| 22 | 22 | |
| 23 | - if ( false === strpos( $args['class'], 'timepicker' ) ) { |
|
| 23 | + if ( false === strpos( $args[ 'class' ], 'timepicker' ) ) { |
|
| 24 | 24 | $this->parse_picker_options( 'date' ); |
| 25 | 25 | } |
| 26 | 26 | |