@@ -172,7 +172,7 @@ discard block |
||
172 | 172 | |
173 | 173 | global $wp_locale; |
174 | 174 | |
175 | - $search = array( $wp_locale->number_format['thousands_sep'], $wp_locale->number_format['decimal_point'] ); |
|
175 | + $search = array( $wp_locale->number_format[ 'thousands_sep' ], $wp_locale->number_format[ 'decimal_point' ] ); |
|
176 | 176 | $replace = array( '', '.' ); |
177 | 177 | |
178 | 178 | // for repeatable |
@@ -193,15 +193,15 @@ discard block |
||
193 | 193 | * @return string Timestring |
194 | 194 | */ |
195 | 195 | public function text_date_timestamp() { |
196 | - if (is_array($this->value)) { |
|
197 | - $returnValue = []; |
|
198 | - foreach ($this->value as $value) { |
|
199 | - $date_object = DateTime::createFromFormat($this->field->args['date_format'], $value); |
|
200 | - $returnValue[] = $date_object ? $date_object->setTime(0, 0, 0)->getTimeStamp() : ''; |
|
196 | + if ( is_array( $this->value ) ) { |
|
197 | + $returnValue = [ ]; |
|
198 | + foreach ( $this->value as $value ) { |
|
199 | + $date_object = DateTime::createFromFormat( $this->field->args[ 'date_format' ], $value ); |
|
200 | + $returnValue[ ] = $date_object ? $date_object->setTime( 0, 0, 0 )->getTimeStamp() : ''; |
|
201 | 201 | } |
202 | 202 | } else { |
203 | - $date_object = DateTime::createFromFormat($this->field->args['date_format'], $this->value); |
|
204 | - $returnValue = $date_object ? $date_object->setTime(0, 0, 0)->getTimeStamp() : ''; |
|
203 | + $date_object = DateTime::createFromFormat( $this->field->args[ 'date_format' ], $this->value ); |
|
204 | + $returnValue = $date_object ? $date_object->setTime( 0, 0, 0 )->getTimeStamp() : ''; |
|
205 | 205 | } |
206 | 206 | |
207 | 207 | return $returnValue; |
@@ -224,8 +224,8 @@ discard block |
||
224 | 224 | return $repeat_value; |
225 | 225 | } |
226 | 226 | |
227 | - if ( isset( $this->value['date'], $this->value['time'] ) ) { |
|
228 | - $this->value = $this->field->get_timestamp_from_value( $this->value['date'] . ' ' . $this->value['time'] ); |
|
227 | + if ( isset( $this->value[ 'date' ], $this->value[ 'time' ] ) ) { |
|
228 | + $this->value = $this->field->get_timestamp_from_value( $this->value[ 'date' ] . ' ' . $this->value[ 'time' ] ); |
|
229 | 229 | } |
230 | 230 | |
231 | 231 | if ( $tz_offset = $this->field->field_timezone_offset() ) { |
@@ -263,7 +263,7 @@ discard block |
||
263 | 263 | $tzstring = null; |
264 | 264 | |
265 | 265 | if ( is_array( $this->value ) && array_key_exists( 'timezone', $this->value ) ) { |
266 | - $tzstring = $this->value['timezone']; |
|
266 | + $tzstring = $this->value[ 'timezone' ]; |
|
267 | 267 | } |
268 | 268 | |
269 | 269 | if ( empty( $tzstring ) ) { |
@@ -283,8 +283,8 @@ discard block |
||
283 | 283 | $tzstring = false !== $tzstring ? $tzstring : timezone_name_from_abbr( '', 0, 0 ); |
284 | 284 | } |
285 | 285 | |
286 | - $full_format = $this->field->args['date_format'] . ' ' . $this->field->args['time_format']; |
|
287 | - $full_date = $this->value['date'] . ' ' . $this->value['time']; |
|
286 | + $full_format = $this->field->args[ 'date_format' ] . ' ' . $this->field->args[ 'time_format' ]; |
|
287 | + $full_date = $this->value[ 'date' ] . ' ' . $this->value[ 'time' ]; |
|
288 | 288 | |
289 | 289 | try { |
290 | 290 | |
@@ -307,7 +307,7 @@ discard block |
||
307 | 307 | } else { |
308 | 308 | // Save the utc timestamp supporting field |
309 | 309 | if ( $repeat ) { |
310 | - $utc_values[ $utc_key ][] = $utc_stamp; |
|
310 | + $utc_values[ $utc_key ][ ] = $utc_stamp; |
|
311 | 311 | } else { |
312 | 312 | $this->_save_utc_value( $utc_key, $utc_stamp ); |
313 | 313 | } |
@@ -418,10 +418,10 @@ discard block |
||
418 | 418 | */ |
419 | 419 | public function _new_supporting_field( $new_field_id ) { |
420 | 420 | $args = $this->field->args(); |
421 | - unset( $args['_id'], $args['_name'] ); |
|
421 | + unset( $args[ '_id' ], $args[ '_name' ] ); |
|
422 | 422 | |
423 | - $args['id'] = $new_field_id; |
|
424 | - $args['sanitization_cb'] = false; |
|
423 | + $args[ 'id' ] = $new_field_id; |
|
424 | + $args[ 'sanitization_cb' ] = false; |
|
425 | 425 | |
426 | 426 | // And get new field object |
427 | 427 | return new CMB2_Field( array( |
@@ -451,7 +451,7 @@ discard block |
||
451 | 451 | if ( $this->value ) { |
452 | 452 | $val = $this->$method( true ); |
453 | 453 | if ( ! empty( $val ) ) { |
454 | - $new_value[] = $val; |
|
454 | + $new_value[ ] = $val; |
|
455 | 455 | } |
456 | 456 | } |
457 | 457 | } |
@@ -200,8 +200,8 @@ discard block |
||
200 | 200 | */ |
201 | 201 | public function concat_items( $args = array() ) { |
202 | 202 | |
203 | - $method = isset( $args['method'] ) ? $args['method'] : 'select_option'; |
|
204 | - unset( $args['method'] ); |
|
203 | + $method = isset( $args[ 'method' ] ) ? $args[ 'method' ] : 'select_option'; |
|
204 | + unset( $args[ 'method' ] ); |
|
205 | 205 | |
206 | 206 | $value = $this->field->escaped_value() |
207 | 207 | ? $this->field->escaped_value() |
@@ -219,12 +219,12 @@ discard block |
||
219 | 219 | // Clone args & modify for just this item |
220 | 220 | $a = $args; |
221 | 221 | |
222 | - $a['value'] = $opt_value; |
|
223 | - $a['label'] = $opt_label; |
|
222 | + $a[ 'value' ] = $opt_value; |
|
223 | + $a[ 'label' ] = $opt_label; |
|
224 | 224 | |
225 | 225 | // Check if this option is the value of the input |
226 | 226 | if ( $value == $opt_value ) { |
227 | - $a['checked'] = 'checked'; |
|
227 | + $a[ 'checked' ] = 'checked'; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | $concatenated_items .= $this->$method( $a, $i++ ); |
@@ -240,7 +240,7 @@ discard block |
||
240 | 240 | * @return string Generated option element html |
241 | 241 | */ |
242 | 242 | public function select_option( $args = array() ) { |
243 | - return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args['value'], selected( isset( $args['checked'] ) && $args['checked'], true, false ), $args['label'] ) . "\n"; |
|
243 | + return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args[ 'value' ], selected( isset( $args[ 'checked' ] ) && $args[ 'checked' ], true, false ), $args[ 'label' ] ) . "\n"; |
|
244 | 244 | } |
245 | 245 | |
246 | 246 | /** |
@@ -260,7 +260,7 @@ discard block |
||
260 | 260 | 'label' => '', |
261 | 261 | ) ); |
262 | 262 | |
263 | - return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a['id'], $a['label'] ); |
|
263 | + return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a[ 'id' ], $a[ 'label' ] ); |
|
264 | 264 | } |
265 | 265 | |
266 | 266 | /** |
@@ -272,10 +272,10 @@ discard block |
||
272 | 272 | */ |
273 | 273 | public function list_input_checkbox( $args, $i ) { |
274 | 274 | $saved_value = $this->field->escaped_value(); |
275 | - if ( is_array( $saved_value ) && in_array( $args['value'], $saved_value ) ) { |
|
276 | - $args['checked'] = 'checked'; |
|
275 | + if ( is_array( $saved_value ) && in_array( $args[ 'value' ], $saved_value ) ) { |
|
276 | + $args[ 'checked' ] = 'checked'; |
|
277 | 277 | } |
278 | - $args['type'] = 'checkbox'; |
|
278 | + $args[ 'type' ] = 'checkbox'; |
|
279 | 279 | return $this->list_input( $args, $i ); |
280 | 280 | } |
281 | 281 | |
@@ -426,11 +426,11 @@ discard block |
||
426 | 426 | 'js_dependencies' => array(), |
427 | 427 | ) ); |
428 | 428 | |
429 | - if ( ! empty( $a['js_dependencies'] ) ) { |
|
430 | - CMB2_JS::add_dependencies( $a['js_dependencies'] ); |
|
429 | + if ( ! empty( $a[ 'js_dependencies' ] ) ) { |
|
430 | + CMB2_JS::add_dependencies( $a[ 'js_dependencies' ] ); |
|
431 | 431 | } |
432 | 432 | |
433 | - return sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc', 'js_dependencies' ) ), $a['desc'] ); |
|
433 | + return sprintf( '<input%s/>%s', $this->concat_attrs( $a, array( 'desc', 'js_dependencies' ) ), $a[ 'desc' ] ); |
|
434 | 434 | } |
435 | 435 | |
436 | 436 | /** |
@@ -449,7 +449,7 @@ discard block |
||
449 | 449 | 'value' => $this->field->escaped_value( 'esc_textarea' ), |
450 | 450 | 'desc' => $this->_desc( true ), |
451 | 451 | ) ); |
452 | - return sprintf( '<textarea%s>%s</textarea>%s', $this->concat_attrs( $a, array( 'desc', 'value' ) ), $a['value'], $a['desc'] ); |
|
452 | + return sprintf( '<textarea%s>%s</textarea>%s', $this->concat_attrs( $a, array( 'desc', 'value' ) ), $a[ 'value' ], $a[ 'desc' ] ); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
@@ -500,8 +500,8 @@ discard block |
||
500 | 500 | 'options' => $this->field->options(), |
501 | 501 | ) ); |
502 | 502 | |
503 | - wp_editor( $a['value'], $a['id'], $a['options'] ); |
|
504 | - echo $a['desc']; |
|
503 | + wp_editor( $a[ 'value' ], $a[ 'id' ], $a[ 'options' ] ); |
|
504 | + echo $a[ 'desc' ]; |
|
505 | 505 | } |
506 | 506 | |
507 | 507 | public function text_date( $args = array() ) { |
@@ -512,10 +512,10 @@ discard block |
||
512 | 512 | 'value' => $this->field->get_timestamp_format(), |
513 | 513 | 'desc' => $this->_desc(), |
514 | 514 | 'js_dependencies' => array( 'jquery-ui-core', 'jquery-ui-datepicker' ), |
515 | - 'data-datepicker' => '{ "dateFormat": "' . $dateFormat . '" }' |
|
515 | + 'data-datepicker' => '{ "dateFormat": "' . $dateFormat . '" }' |
|
516 | 516 | ) ); |
517 | 517 | |
518 | - if ( false === strpos( $args['class'], 'timepicker' ) ) { |
|
518 | + if ( false === strpos( $args[ 'class' ], 'timepicker' ) ) { |
|
519 | 519 | $this->parse_picker_options( 'date' ); |
520 | 520 | } |
521 | 521 | |
@@ -525,7 +525,7 @@ discard block |
||
525 | 525 | // Alias for text_date |
526 | 526 | public function text_date_timestamp( $args = array() ) { |
527 | 527 | $dateFormat = cmb2_utils()->php_to_js_dateformat( $this->field->args( 'date_format' ) ); |
528 | - $args['data-datepicker'] = '{ "dateFormat": "' . $dateFormat . '" }'; |
|
528 | + $args[ 'data-datepicker' ] = '{ "dateFormat": "' . $dateFormat . '" }'; |
|
529 | 529 | |
530 | 530 | return $this->text_date( $args ); |
531 | 531 | } |
@@ -550,34 +550,34 @@ discard block |
||
550 | 550 | 'timepicker' => array(), |
551 | 551 | ) ); |
552 | 552 | |
553 | - if ( empty( $args['value'] ) ) { |
|
554 | - $args['value'] = $this->field->escaped_value(); |
|
553 | + if ( empty( $args[ 'value' ] ) ) { |
|
554 | + $args[ 'value' ] = $this->field->escaped_value(); |
|
555 | 555 | // This will be used if there is a select_timezone set for this field |
556 | 556 | $tz_offset = $this->field->field_timezone_offset(); |
557 | 557 | if ( ! empty( $tz_offset ) ) { |
558 | - $args['value'] -= $tz_offset; |
|
558 | + $args[ 'value' ] -= $tz_offset; |
|
559 | 559 | } |
560 | 560 | } |
561 | 561 | |
562 | - $has_good_value = ! empty( $args['value'] ) && ! is_array( $args['value'] ); |
|
562 | + $has_good_value = ! empty( $args[ 'value' ] ) && ! is_array( $args[ 'value' ] ); |
|
563 | 563 | |
564 | - $date_args = wp_parse_args( $args['datepicker'], array( |
|
564 | + $date_args = wp_parse_args( $args[ 'datepicker' ], array( |
|
565 | 565 | 'class' => 'cmb2-text-small cmb2-datepicker', |
566 | 566 | 'name' => $this->_name( '[date]' ), |
567 | 567 | 'id' => $this->_id( '_date' ), |
568 | - 'value' => $has_good_value ? $this->field->get_timestamp_format( 'date_format', $args['value'] ) : '', |
|
568 | + 'value' => $has_good_value ? $this->field->get_timestamp_format( 'date_format', $args[ 'value' ] ) : '', |
|
569 | 569 | 'desc' => '', |
570 | 570 | ) ); |
571 | 571 | |
572 | 572 | // Let's get the date-format, and set it up as a data attr for the field. |
573 | 573 | $date_args = $this->parse_picker_options( 'date', $date_args ); |
574 | 574 | |
575 | - $time_args = wp_parse_args( $args['timepicker'], array( |
|
575 | + $time_args = wp_parse_args( $args[ 'timepicker' ], array( |
|
576 | 576 | 'class' => 'cmb2-timepicker text-time', |
577 | 577 | 'name' => $this->_name( '[time]' ), |
578 | 578 | 'id' => $this->_id( '_time' ), |
579 | - 'value' => $has_good_value ? $this->field->get_timestamp_format( 'time_format', $args['value'] ) : '', |
|
580 | - 'desc' => $args['desc'], |
|
579 | + 'value' => $has_good_value ? $this->field->get_timestamp_format( 'time_format', $args[ 'value' ] ) : '', |
|
580 | + 'desc' => $args[ 'desc' ], |
|
581 | 581 | 'js_dependencies' => array( 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-datetimepicker' ), |
582 | 582 | ) ); |
583 | 583 | |
@@ -595,12 +595,12 @@ discard block |
||
595 | 595 | 'select_timezone' => array(), |
596 | 596 | ) ); |
597 | 597 | |
598 | - $args['value'] = $this->field->escaped_value(); |
|
599 | - if ( is_array( $args['value'] ) ) { |
|
600 | - $args['value'] = ''; |
|
598 | + $args[ 'value' ] = $this->field->escaped_value(); |
|
599 | + if ( is_array( $args[ 'value' ] ) ) { |
|
600 | + $args[ 'value' ] = ''; |
|
601 | 601 | } |
602 | 602 | |
603 | - $datetime = maybe_unserialize( $args['value'] ); |
|
603 | + $datetime = maybe_unserialize( $args[ 'value' ] ); |
|
604 | 604 | $value = $tzstring = ''; |
605 | 605 | |
606 | 606 | if ( $datetime && $datetime instanceof DateTime ) { |
@@ -609,24 +609,24 @@ discard block |
||
609 | 609 | $value = $datetime->getTimestamp(); |
610 | 610 | } |
611 | 611 | |
612 | - $timestamp_args = wp_parse_args( $args['text_datetime_timestamp'], array( |
|
612 | + $timestamp_args = wp_parse_args( $args[ 'text_datetime_timestamp' ], array( |
|
613 | 613 | 'desc' => '', |
614 | 614 | 'value' => $value, |
615 | 615 | ) ); |
616 | 616 | |
617 | - $timezone_args = wp_parse_args( $args['select_timezone'], array( |
|
617 | + $timezone_args = wp_parse_args( $args[ 'select_timezone' ], array( |
|
618 | 618 | 'class' => 'cmb2_select cmb2-select-timezone', |
619 | 619 | 'name' => $this->_name( '[timezone]' ), |
620 | 620 | 'id' => $this->_id( '_timezone' ), |
621 | 621 | 'options' => wp_timezone_choice( $tzstring ), |
622 | - 'desc' => $args['desc'], |
|
622 | + 'desc' => $args[ 'desc' ], |
|
623 | 623 | ) ); |
624 | 624 | |
625 | 625 | return $this->text_datetime_timestamp( $timestamp_args ) . "\n" . $this->select( $timezone_args ); |
626 | 626 | } |
627 | 627 | |
628 | 628 | public function select_timezone() { |
629 | - $this->field->args['default'] = $this->field->args( 'default' ) |
|
629 | + $this->field->args[ 'default' ] = $this->field->args( 'default' ) |
|
630 | 630 | ? $this->field->args( 'default' ) |
631 | 631 | : cmb2_utils()->timezone_string(); |
632 | 632 | |
@@ -668,7 +668,7 @@ discard block |
||
668 | 668 | 'desc' => $this->_desc( true ), |
669 | 669 | ) ); |
670 | 670 | |
671 | - return sprintf( '<%1$s class="%2$s">%3$s</%1$s>%4$s', $a['tag'], $a['class'], $a['name'], $a['desc'] ); |
|
671 | + return sprintf( '<%1$s class="%2$s">%3$s</%1$s>%4$s', $a[ 'tag' ], $a[ 'class' ], $a[ 'name' ], $a[ 'desc' ] ); |
|
672 | 672 | } |
673 | 673 | |
674 | 674 | public function select( $args = array() ) { |
@@ -681,17 +681,17 @@ discard block |
||
681 | 681 | ) ); |
682 | 682 | |
683 | 683 | $attrs = $this->concat_attrs( $a, array( 'desc', 'options' ) ); |
684 | - return sprintf( '<select%s>%s</select>%s', $attrs, $a['options'], $a['desc'] ); |
|
684 | + return sprintf( '<select%s>%s</select>%s', $attrs, $a[ 'options' ], $a[ 'desc' ] ); |
|
685 | 685 | } |
686 | 686 | |
687 | 687 | public function taxonomy_select() { |
688 | 688 | |
689 | 689 | $names = $this->get_object_terms(); |
690 | - $saved_term = is_wp_error( $names ) || empty( $names ) ? $this->field->args( 'default' ) : $names[key( $names )]->slug; |
|
690 | + $saved_term = is_wp_error( $names ) || empty( $names ) ? $this->field->args( 'default' ) : $names[ key( $names ) ]->slug; |
|
691 | 691 | $terms = get_terms( $this->field->args( 'taxonomy' ), 'hide_empty=0' ); |
692 | 692 | $options = ''; |
693 | 693 | |
694 | - $option_none = $this->field->args( 'show_option_none' ); |
|
694 | + $option_none = $this->field->args( 'show_option_none' ); |
|
695 | 695 | if ( ! empty( $option_none ) ) { |
696 | 696 | $option_none_value = apply_filters( 'cmb2_taxonomy_select_default_value', '' ); |
697 | 697 | $option_none_value = apply_filters( "cmb2_taxonomy_select_{$this->_id()}_default_value", $option_none_value ); |
@@ -721,7 +721,7 @@ discard block |
||
721 | 721 | 'desc' => $this->_desc( true ), |
722 | 722 | ) ); |
723 | 723 | |
724 | - return sprintf( '<ul class="%s">%s</ul>%s', $a['class'], $a['options'], $a['desc'] ); |
|
724 | + return sprintf( '<ul class="%s">%s</ul>%s', $a[ 'class' ], $a[ 'options' ], $a[ 'desc' ] ); |
|
725 | 725 | } |
726 | 726 | |
727 | 727 | public function radio_inline() { |
@@ -756,7 +756,7 @@ discard block |
||
756 | 756 | : $is_checked; |
757 | 757 | |
758 | 758 | if ( $is_checked ) { |
759 | - $defaults['checked'] = 'checked'; |
|
759 | + $defaults[ 'checked' ] = 'checked'; |
|
760 | 760 | } |
761 | 761 | |
762 | 762 | $args = $this->parse_args( $args, 'checkbox', $defaults ); |
@@ -766,14 +766,14 @@ discard block |
||
766 | 766 | |
767 | 767 | public function taxonomy_radio() { |
768 | 768 | $names = $this->get_object_terms(); |
769 | - $saved_term = is_wp_error( $names ) || empty( $names ) ? $this->field->args( 'default' ) : $names[key( $names )]->slug; |
|
769 | + $saved_term = is_wp_error( $names ) || empty( $names ) ? $this->field->args( 'default' ) : $names[ key( $names ) ]->slug; |
|
770 | 770 | $terms = get_terms( $this->field->args( 'taxonomy' ), 'hide_empty=0' ); |
771 | 771 | $options = ''; $i = 1; |
772 | 772 | |
773 | 773 | if ( ! $terms ) { |
774 | 774 | $options .= sprintf( '<li><label>%s</label></li>', esc_html( $this->_text( 'no_terms_text', __( 'No terms', 'cmb2' ) ) ) ); |
775 | 775 | } else { |
776 | - $option_none = $this->field->args( 'show_option_none' ); |
|
776 | + $option_none = $this->field->args( 'show_option_none' ); |
|
777 | 777 | if ( ! empty( $option_none ) ) { |
778 | 778 | $option_none_value = apply_filters( "cmb2_taxonomy_radio_{$this->_id()}_default_value", apply_filters( 'cmb2_taxonomy_radio_default_value', '' ) ); |
779 | 779 | $args = array( |
@@ -781,7 +781,7 @@ discard block |
||
781 | 781 | 'label' => $option_none, |
782 | 782 | ); |
783 | 783 | if ( $saved_term == $option_none_value ) { |
784 | - $args['checked'] = 'checked'; |
|
784 | + $args[ 'checked' ] = 'checked'; |
|
785 | 785 | } |
786 | 786 | $options .= $this->list_input( $args, $i ); |
787 | 787 | $i++; |
@@ -794,7 +794,7 @@ discard block |
||
794 | 794 | ); |
795 | 795 | |
796 | 796 | if ( $saved_term == $term->slug ) { |
797 | - $args['checked'] = 'checked'; |
|
797 | + $args[ 'checked' ] = 'checked'; |
|
798 | 798 | } |
799 | 799 | $options .= $this->list_input( $args, $i ); |
800 | 800 | $i++; |
@@ -831,7 +831,7 @@ discard block |
||
831 | 831 | ); |
832 | 832 | |
833 | 833 | if ( is_array( $saved_terms ) && in_array( $term->slug, $saved_terms ) ) { |
834 | - $args['checked'] = 'checked'; |
|
834 | + $args[ 'checked' ] = 'checked'; |
|
835 | 835 | } |
836 | 836 | $options .= $this->list_input( $args, $i ); |
837 | 837 | $i++; |
@@ -936,7 +936,7 @@ discard block |
||
936 | 936 | $query_args = $this->field->args( 'query_args' ); |
937 | 937 | |
938 | 938 | // if options array and 'url' => false, then hide the url field |
939 | - $input_type = array_key_exists( 'url', $options ) && false === $options['url'] ? 'hidden' : 'text'; |
|
939 | + $input_type = array_key_exists( 'url', $options ) && false === $options[ 'url' ] ? 'hidden' : 'text'; |
|
940 | 940 | |
941 | 941 | echo $this->input( array( |
942 | 942 | 'type' => $input_type, |
@@ -957,8 +957,8 @@ discard block |
||
957 | 957 | // Reset field args for attachment ID |
958 | 958 | $args = $this->field->args(); |
959 | 959 | // If we're looking at a file in a group, we need to get the non-prefixed id |
960 | - $args['id'] = ( $this->field->group ? $this->field->args( '_id' ) : $cached_id ) . '_id'; |
|
961 | - unset( $args['_id'], $args['_name'] ); |
|
960 | + $args[ 'id' ] = ( $this->field->group ? $this->field->args( '_id' ) : $cached_id ) . '_id'; |
|
961 | + unset( $args[ '_id' ], $args[ '_name' ] ); |
|
962 | 962 | |
963 | 963 | // And get new field object |
964 | 964 | $this->field = new CMB2_Field( array( |
@@ -990,7 +990,7 @@ discard block |
||
990 | 990 | if ( $_id_value ) { |
991 | 991 | $image = wp_get_attachment_image( $_id_value, $img_size, null, array( 'class' => 'cmb-file-field-image' ) ); |
992 | 992 | } else { |
993 | - $size = is_array( $img_size ) ? $img_size[0] : 350; |
|
993 | + $size = is_array( $img_size ) ? $img_size[ 0 ] : 350; |
|
994 | 994 | $image = '<img style="max-width: ' . absint( $size ) . 'px; width: 100%; height: auto;" src="' . $meta_value . '" alt="" />'; |
995 | 995 | } |
996 | 996 | |
@@ -1021,11 +1021,11 @@ discard block |
||
1021 | 1021 | */ |
1022 | 1022 | public function img_status_output( $args ) { |
1023 | 1023 | printf( '<%1$s class="img-status">%2$s<p class="cmb2-remove-wrapper"><a href="#" class="cmb2-remove-file-button"%3$s>%4$s</a></p>%5$s</%1$s>', |
1024 | - $args['tag'], |
|
1025 | - $args['image'], |
|
1026 | - isset( $args['cached_id'] ) ? ' rel="' . $args['cached_id'] . '"' : '', |
|
1024 | + $args[ 'tag' ], |
|
1025 | + $args[ 'image' ], |
|
1026 | + isset( $args[ 'cached_id' ] ) ? ' rel="' . $args[ 'cached_id' ] . '"' : '', |
|
1027 | 1027 | esc_html( $this->_text( 'remove_image_text', __( 'Remove Image', 'cmb2' ) ) ), |
1028 | - isset( $args['id_input'] ) ? $args['id_input'] : '' |
|
1028 | + isset( $args[ 'id_input' ] ) ? $args[ 'id_input' ] : '' |
|
1029 | 1029 | ); |
1030 | 1030 | } |
1031 | 1031 | |
@@ -1037,14 +1037,14 @@ discard block |
||
1037 | 1037 | */ |
1038 | 1038 | public function file_status_output( $args ) { |
1039 | 1039 | printf( '<%1$s class="file-status"><span>%2$s <strong>%3$s</strong></span> (<a href="%4$s" target="_blank" rel="external">%5$s</a> / <a href="#" class="cmb2-remove-file-button"%6$s>%7$s</a>)%8$s</%1$s>', |
1040 | - $args['tag'], |
|
1040 | + $args[ 'tag' ], |
|
1041 | 1041 | esc_html( $this->_text( 'file_text', __( 'File:', 'cmb2' ) ) ), |
1042 | - $this->get_file_name_from_path( $args['value'] ), |
|
1043 | - $args['value'], |
|
1042 | + $this->get_file_name_from_path( $args[ 'value' ] ), |
|
1043 | + $args[ 'value' ], |
|
1044 | 1044 | esc_html( $this->_text( 'file_download_text', __( 'Download', 'cmb2' ) ) ), |
1045 | - isset( $args['cached_id'] ) ? ' rel="' . $args['cached_id'] . '"' : '', |
|
1045 | + isset( $args[ 'cached_id' ] ) ? ' rel="' . $args[ 'cached_id' ] . '"' : '', |
|
1046 | 1046 | esc_html( $this->_text( 'remove_text', __( 'Remove', 'cmb2' ) ) ), |
1047 | - isset( $args['id_input'] ) ? $args['id_input'] : '' |
|
1047 | + isset( $args[ 'id_input' ] ) ? $args[ 'id_input' ] : '' |
|
1048 | 1048 | ); |
1049 | 1049 | } |
1050 | 1050 | |
@@ -1066,8 +1066,8 @@ discard block |
||
1066 | 1066 | if ( $update ) { |
1067 | 1067 | $atts = $this->field->args( 'attributes' ); |
1068 | 1068 | } else { |
1069 | - $atts = isset( $args['attributes'] ) |
|
1070 | - ? $args['attributes'] |
|
1069 | + $atts = isset( $args[ 'attributes' ] ) |
|
1070 | + ? $args[ 'attributes' ] |
|
1071 | 1071 | : $atts; |
1072 | 1072 | } |
1073 | 1073 | |
@@ -1083,7 +1083,7 @@ discard block |
||
1083 | 1083 | } |
1084 | 1084 | |
1085 | 1085 | if ( $update ) { |
1086 | - $this->field->args['attributes'] = $atts; |
|
1086 | + $this->field->args[ 'attributes' ] = $atts; |
|
1087 | 1087 | } |
1088 | 1088 | |
1089 | 1089 | return array_merge( $args, $atts ); |