@@ -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(); |
@@ -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 ) ); |
@@ -32,7 +32,7 @@ |
||
32 | 32 | ), $args ); |
33 | 33 | |
34 | 34 | return $this->rendered( |
35 | - sprintf( '<textarea%s>%s</textarea>%s', $this->concat_attrs( $a, array( 'desc', 'value' ) ), $a['value'], $a['desc'] ) |
|
35 | + sprintf( '<textarea%s>%s</textarea>%s', $this->concat_attrs( $a, array( 'desc', 'value' ) ), $a[ 'value' ], $a[ 'desc' ] ) |
|
36 | 36 | ); |
37 | 37 | } |
38 | 38 | } |
@@ -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 |
@@ -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 ); |
@@ -57,11 +57,11 @@ discard block |
||
57 | 57 | */ |
58 | 58 | public function img_status_output( $args ) { |
59 | 59 | return sprintf( '<%1$s class="img-status cmb2-media-item">%2$s<p class="cmb2-remove-wrapper"><a href="#" class="cmb2-remove-file-button"%3$s>%4$s</a></p>%5$s</%1$s>', |
60 | - $args['tag'], |
|
61 | - $args['image'], |
|
62 | - isset( $args['cached_id'] ) ? ' rel="' . $args['cached_id'] . '"' : '', |
|
60 | + $args[ 'tag' ], |
|
61 | + $args[ 'image' ], |
|
62 | + isset( $args[ 'cached_id' ] ) ? ' rel="' . $args[ 'cached_id' ] . '"' : '', |
|
63 | 63 | esc_html( $this->_text( 'remove_image_text', esc_html__( 'Remove Image', 'cmb2' ) ) ), |
64 | - isset( $args['id_input'] ) ? $args['id_input'] : '' |
|
64 | + isset( $args[ 'id_input' ] ) ? $args[ 'id_input' ] : '' |
|
65 | 65 | ); |
66 | 66 | } |
67 | 67 | |
@@ -74,14 +74,14 @@ discard block |
||
74 | 74 | */ |
75 | 75 | public function file_status_output( $args ) { |
76 | 76 | return sprintf( '<%1$s class="file-status cmb2-media-item"><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>', |
77 | - $args['tag'], |
|
77 | + $args[ 'tag' ], |
|
78 | 78 | esc_html( $this->_text( 'file_text', esc_html__( 'File:', 'cmb2' ) ) ), |
79 | - CMB2_Utils::get_file_name_from_path( $args['value'] ), |
|
80 | - $args['value'], |
|
79 | + CMB2_Utils::get_file_name_from_path( $args[ 'value' ] ), |
|
80 | + $args[ 'value' ], |
|
81 | 81 | esc_html( $this->_text( 'file_download_text', esc_html__( 'Download', 'cmb2' ) ) ), |
82 | - isset( $args['cached_id'] ) ? ' rel="' . $args['cached_id'] . '"' : '', |
|
82 | + isset( $args[ 'cached_id' ] ) ? ' rel="' . $args[ 'cached_id' ] . '"' : '', |
|
83 | 83 | esc_html( $this->_text( 'remove_text', esc_html__( 'Remove', 'cmb2' ) ) ), |
84 | - isset( $args['id_input'] ) ? $args['id_input'] : '' |
|
84 | + isset( $args[ 'id_input' ] ) ? $args[ 'id_input' ] : '' |
|
85 | 85 | ); |
86 | 86 | } |
87 | 87 | |
@@ -141,13 +141,13 @@ discard block |
||
141 | 141 | $data = array(); |
142 | 142 | |
143 | 143 | if ( is_array( $img_size ) ) { |
144 | - $data['width'] = intval( $img_size[0] ); |
|
145 | - $data['height'] = intval( $img_size[1] ); |
|
146 | - $data['name'] = ''; |
|
144 | + $data[ 'width' ] = intval( $img_size[ 0 ] ); |
|
145 | + $data[ 'height' ] = intval( $img_size[ 1 ] ); |
|
146 | + $data[ 'name' ] = ''; |
|
147 | 147 | |
148 | 148 | // Try and get the closest named size from our array of dimensions |
149 | 149 | if ( $named_size = CMB2_Utils::get_named_size( $img_size ) ) { |
150 | - $data['name'] = $named_size; |
|
150 | + $data[ 'name' ] = $named_size; |
|
151 | 151 | } |
152 | 152 | } else { |
153 | 153 | |
@@ -164,9 +164,9 @@ discard block |
||
164 | 164 | } |
165 | 165 | |
166 | 166 | // Get image dimensions from named sizes |
167 | - $data['width'] = intval( $image_sizes[ $img_size ]['width'] ); |
|
168 | - $data['height'] = intval( $image_sizes[ $img_size ]['height'] ); |
|
169 | - $data['name'] = $img_size; |
|
167 | + $data[ 'width' ] = intval( $image_sizes[ $img_size ][ 'width' ] ); |
|
168 | + $data[ 'height' ] = intval( $image_sizes[ $img_size ][ 'height' ] ); |
|
169 | + $data[ 'name' ] = $img_size; |
|
170 | 170 | } |
171 | 171 | |
172 | 172 | return $data; |
@@ -188,17 +188,17 @@ discard block |
||
188 | 188 | foreach ( CMB2_Utils::get_available_image_sizes() as $size => $info ) { |
189 | 189 | |
190 | 190 | // registered image size exists for this attachment |
191 | - if ( isset( $meta['sizes'][ $size ] ) ) { |
|
191 | + if ( isset( $meta[ 'sizes' ][ $size ] ) ) { |
|
192 | 192 | |
193 | 193 | $attachment_url = wp_get_attachment_url( $attachment->ID ); |
194 | 194 | $base_url = str_replace( wp_basename( $attachment_url ), '', $attachment_url ); |
195 | - $size_meta = $meta['sizes'][ $size ]; |
|
195 | + $size_meta = $meta[ 'sizes' ][ $size ]; |
|
196 | 196 | |
197 | - $response['sizes'][ $size ] = array( |
|
198 | - 'url' => $base_url . $size_meta['file'], |
|
199 | - 'height' => $size_meta['height'], |
|
200 | - 'width' => $size_meta['width'], |
|
201 | - 'orientation' => $size_meta['height'] > $size_meta['width'] ? 'portrait' : 'landscape', |
|
197 | + $response[ 'sizes' ][ $size ] = array( |
|
198 | + 'url' => $base_url . $size_meta[ 'file' ], |
|
199 | + 'height' => $size_meta[ 'height' ], |
|
200 | + 'width' => $size_meta[ 'width' ], |
|
201 | + 'orientation' => $size_meta[ 'height' ] > $size_meta[ 'width' ] ? 'portrait' : 'landscape', |
|
202 | 202 | ); |
203 | 203 | } |
204 | 204 | } |