@@ -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 |
@@ -30,8 +30,8 @@ discard block |
||
30 | 30 | if ( $update ) { |
31 | 31 | $atts = $this->field->args( 'attributes' ); |
32 | 32 | } else { |
33 | - $atts = isset( $args['attributes'] ) |
|
34 | - ? $args['attributes'] |
|
33 | + $atts = isset( $args[ 'attributes' ] ) |
|
34 | + ? $args[ 'attributes' ] |
|
35 | 35 | : $atts; |
36 | 36 | } |
37 | 37 | |
@@ -47,7 +47,7 @@ discard block |
||
47 | 47 | } |
48 | 48 | |
49 | 49 | if ( $update ) { |
50 | - $this->field->args['attributes'] = $atts; |
|
50 | + $this->field->args[ 'attributes' ] = $atts; |
|
51 | 51 | } |
52 | 52 | |
53 | 53 | return array_merge( $args, $atts ); |
@@ -46,7 +46,7 @@ |
||
46 | 46 | } |
47 | 47 | |
48 | 48 | protected function ul( $a ) { |
49 | - return sprintf( '<ul class="%s">%s</ul>%s', $a['class'], $a['options'], $a['desc'] ); |
|
49 | + return sprintf( '<ul class="%s">%s</ul>%s', $a[ 'class' ], $a[ 'options' ], $a[ 'desc' ] ); |
|
50 | 50 | } |
51 | 51 | |
52 | 52 | } |
@@ -19,7 +19,7 @@ discard block |
||
19 | 19 | * @return string Generated option element html |
20 | 20 | */ |
21 | 21 | public function select_option( $args = array() ) { |
22 | - return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args['value'], selected( isset( $args['checked'] ) && $args['checked'], true, false ), $args['label'] ) . "\n"; |
|
22 | + return sprintf( "\t" . '<option value="%s" %s>%s</option>', $args[ 'value' ], selected( isset( $args[ 'checked' ] ) && $args[ 'checked' ], true, false ), $args[ 'label' ] ) . "\n"; |
|
23 | 23 | } |
24 | 24 | |
25 | 25 | /** |
@@ -39,7 +39,7 @@ discard block |
||
39 | 39 | 'label' => '', |
40 | 40 | ), $args ); |
41 | 41 | |
42 | - return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a['id'], $a['label'] ); |
|
42 | + return sprintf( "\t" . '<li><input%s/> <label for="%s">%s</label></li>' . "\n", $this->concat_attrs( $a, array( 'label' ) ), $a[ 'id' ], $a[ 'label' ] ); |
|
43 | 43 | } |
44 | 44 | |
45 | 45 | /** |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | */ |
52 | 52 | public function list_input_checkbox( $args, $i ) { |
53 | 53 | $saved_value = $this->field->escaped_value(); |
54 | - if ( is_array( $saved_value ) && in_array( $args['value'], $saved_value ) ) { |
|
55 | - $args['checked'] = 'checked'; |
|
54 | + if ( is_array( $saved_value ) && in_array( $args[ 'value' ], $saved_value ) ) { |
|
55 | + $args[ 'checked' ] = 'checked'; |
|
56 | 56 | } |
57 | - $args['type'] = 'checkbox'; |
|
57 | + $args[ 'type' ] = 'checkbox'; |
|
58 | 58 | return $this->list_input( $args, $i ); |
59 | 59 | } |
60 | 60 | |
@@ -67,8 +67,8 @@ discard block |
||
67 | 67 | public function concat_items( $args = array() ) { |
68 | 68 | $field = $this->field; |
69 | 69 | |
70 | - $method = isset( $args['method'] ) ? $args['method'] : 'select_option'; |
|
71 | - unset( $args['method'] ); |
|
70 | + $method = isset( $args[ 'method' ] ) ? $args[ 'method' ] : 'select_option'; |
|
71 | + unset( $args[ 'method' ] ); |
|
72 | 72 | |
73 | 73 | $value = $field->escaped_value() |
74 | 74 | ? $field->escaped_value() |
@@ -86,12 +86,12 @@ discard block |
||
86 | 86 | // Clone args & modify for just this item |
87 | 87 | $a = $args; |
88 | 88 | |
89 | - $a['value'] = $opt_value; |
|
90 | - $a['label'] = $opt_label; |
|
89 | + $a[ 'value' ] = $opt_value; |
|
90 | + $a[ 'label' ] = $opt_label; |
|
91 | 91 | |
92 | 92 | // Check if this option is the value of the input |
93 | 93 | if ( $value == $opt_value ) { |
94 | - $a['checked'] = 'checked'; |
|
94 | + $a[ 'checked' ] = 'checked'; |
|
95 | 95 | } |
96 | 96 | |
97 | 97 | $concatenated_items .= $this->$method( $a, $i++ ); |
@@ -24,7 +24,7 @@ |
||
24 | 24 | $attrs = $this->concat_attrs( $a, array( 'desc', 'options' ) ); |
25 | 25 | |
26 | 26 | return $this->rendered( |
27 | - sprintf( '<select%s>%s</select>%s', $attrs, $a['options'], $a['desc'] ) |
|
27 | + sprintf( '<select%s>%s</select>%s', $attrs, $a[ 'options' ], $a[ 'desc' ] ) |
|
28 | 28 | ); |
29 | 29 | } |
30 | 30 | } |
@@ -31,7 +31,7 @@ |
||
31 | 31 | ), $args ); |
32 | 32 | |
33 | 33 | return $this->rendered( |
34 | - sprintf( '<textarea%s>%s</textarea>%s', $this->concat_attrs( $a, array( 'desc', 'value' ) ), $a['value'], $a['desc'] ) |
|
34 | + sprintf( '<textarea%s>%s</textarea>%s', $this->concat_attrs( $a, array( 'desc', 'value' ) ), $a[ 'value' ], $a[ 'desc' ] ) |
|
35 | 35 | ); |
36 | 36 | } |
37 | 37 | } |
@@ -22,12 +22,12 @@ discard block |
||
22 | 22 | 'select_timezone' => array(), |
23 | 23 | ) ); |
24 | 24 | |
25 | - $args['value'] = $field->escaped_value(); |
|
26 | - if ( is_array( $args['value'] ) ) { |
|
27 | - $args['value'] = ''; |
|
25 | + $args[ 'value' ] = $field->escaped_value(); |
|
26 | + if ( is_array( $args[ 'value' ] ) ) { |
|
27 | + $args[ 'value' ] = ''; |
|
28 | 28 | } |
29 | 29 | |
30 | - $datetime = maybe_unserialize( $args['value'] ); |
|
30 | + $datetime = maybe_unserialize( $args[ 'value' ] ); |
|
31 | 31 | $value = $tzstring = ''; |
32 | 32 | |
33 | 33 | if ( $datetime && $datetime instanceof DateTime ) { |
@@ -36,19 +36,19 @@ discard block |
||
36 | 36 | $value = $datetime->getTimestamp(); |
37 | 37 | } |
38 | 38 | |
39 | - $timestamp_args = wp_parse_args( $args['text_datetime_timestamp'], array( |
|
39 | + $timestamp_args = wp_parse_args( $args[ 'text_datetime_timestamp' ], array( |
|
40 | 40 | 'desc' => '', |
41 | 41 | 'value' => $value, |
42 | 42 | 'rendered' => true, |
43 | 43 | ) ); |
44 | 44 | $datetime_timestamp = $this->types->text_datetime_timestamp( $timestamp_args ); |
45 | 45 | |
46 | - $timezone_select_args = wp_parse_args( $args['select_timezone'], array( |
|
46 | + $timezone_select_args = wp_parse_args( $args[ 'select_timezone' ], array( |
|
47 | 47 | 'class' => 'cmb2_select cmb2-select-timezone', |
48 | 48 | 'name' => $this->_name( '[timezone]' ), |
49 | 49 | 'id' => $this->_id( '_timezone' ), |
50 | 50 | 'options' => wp_timezone_choice( $tzstring ), |
51 | - 'desc' => $args['desc'], |
|
51 | + 'desc' => $args[ 'desc' ], |
|
52 | 52 | 'rendered' => true, |
53 | 53 | ) ); |
54 | 54 | $select = $this->types->select( $timezone_select_args ); |
@@ -22,16 +22,16 @@ discard block |
||
22 | 22 | 'timepicker' => array(), |
23 | 23 | ) ); |
24 | 24 | |
25 | - if ( empty( $args['value'] ) ) { |
|
26 | - $args['value'] = $field->escaped_value(); |
|
25 | + if ( empty( $args[ 'value' ] ) ) { |
|
26 | + $args[ 'value' ] = $field->escaped_value(); |
|
27 | 27 | // This will be used if there is a select_timezone set for this field |
28 | 28 | $tz_offset = $field->field_timezone_offset(); |
29 | 29 | if ( ! empty( $tz_offset ) ) { |
30 | - $args['value'] -= $tz_offset; |
|
30 | + $args[ 'value' ] -= $tz_offset; |
|
31 | 31 | } |
32 | 32 | } |
33 | 33 | |
34 | - $has_good_value = ! empty( $args['value'] ) && ! is_array( $args['value'] ); |
|
34 | + $has_good_value = ! empty( $args[ 'value' ] ) && ! is_array( $args[ 'value' ] ); |
|
35 | 35 | |
36 | 36 | $date_input = parent::render( $this->date_args( $args, $has_good_value ) ); |
37 | 37 | $time_input = parent::render( $this->time_args( $args, $has_good_value ) ); |
@@ -40,31 +40,31 @@ discard block |
||
40 | 40 | } |
41 | 41 | |
42 | 42 | public function date_args( $args, $has_good_value ) { |
43 | - $date_args = wp_parse_args( $args['datepicker'], array( |
|
43 | + $date_args = wp_parse_args( $args[ 'datepicker' ], array( |
|
44 | 44 | 'class' => 'cmb2-text-small cmb2-datepicker', |
45 | 45 | 'name' => $this->_name( '[date]' ), |
46 | 46 | 'id' => $this->_id( '_date' ), |
47 | - 'value' => $has_good_value ? $this->field->get_timestamp_format( 'date_format', $args['value'] ) : '', |
|
47 | + 'value' => $has_good_value ? $this->field->get_timestamp_format( 'date_format', $args[ 'value' ] ) : '', |
|
48 | 48 | 'desc' => '', |
49 | 49 | ) ); |
50 | 50 | |
51 | - $date_args['rendered'] = true; |
|
51 | + $date_args[ 'rendered' ] = true; |
|
52 | 52 | |
53 | 53 | // Let's get the date-format, and set it up as a data attr for the field. |
54 | 54 | return $this->parse_picker_options( 'date', $date_args ); |
55 | 55 | } |
56 | 56 | |
57 | 57 | public function time_args( $args, $has_good_value ) { |
58 | - $time_args = wp_parse_args( $args['timepicker'], array( |
|
58 | + $time_args = wp_parse_args( $args[ 'timepicker' ], array( |
|
59 | 59 | 'class' => 'cmb2-timepicker text-time', |
60 | 60 | 'name' => $this->_name( '[time]' ), |
61 | 61 | 'id' => $this->_id( '_time' ), |
62 | - 'value' => $has_good_value ? $this->field->get_timestamp_format( 'time_format', $args['value'] ) : '', |
|
63 | - 'desc' => $args['desc'], |
|
62 | + 'value' => $has_good_value ? $this->field->get_timestamp_format( 'time_format', $args[ 'value' ] ) : '', |
|
63 | + 'desc' => $args[ 'desc' ], |
|
64 | 64 | 'js_dependencies' => array( 'jquery-ui-core', 'jquery-ui-datepicker', 'jquery-ui-datetimepicker' ), |
65 | 65 | ) ); |
66 | 66 | |
67 | - $time_args['rendered'] = true; |
|
67 | + $time_args[ 'rendered' ] = true; |
|
68 | 68 | |
69 | 69 | // Let's get the time-format, and set it up as a data attr for the field. |
70 | 70 | return $this->parse_picker_options( 'time', $time_args ); |