@@ -143,30 +143,30 @@ discard block |
||
143 | 143 | foreach ( self::$boxes as $cmb_id => $rest_box ) { |
144 | 144 | $types = array_flip( $rest_box->cmb->box_types() ); |
145 | 145 | |
146 | - if ( isset( $types['user'] ) ) { |
|
147 | - unset( $types['user'] ); |
|
148 | - self::$type_boxes['user'][ $cmb_id ] = $cmb_id; |
|
146 | + if ( isset( $types[ 'user' ] ) ) { |
|
147 | + unset( $types[ 'user' ] ); |
|
148 | + self::$type_boxes[ 'user' ][ $cmb_id ] = $cmb_id; |
|
149 | 149 | } |
150 | 150 | |
151 | - if ( isset( $types['comment'] ) ) { |
|
152 | - unset( $types['comment'] ); |
|
153 | - self::$type_boxes['comment'][ $cmb_id ] = $cmb_id; |
|
151 | + if ( isset( $types[ 'comment' ] ) ) { |
|
152 | + unset( $types[ 'comment' ] ); |
|
153 | + self::$type_boxes[ 'comment' ][ $cmb_id ] = $cmb_id; |
|
154 | 154 | } |
155 | 155 | |
156 | - if ( isset( $types['term'] ) ) { |
|
157 | - unset( $types['term'] ); |
|
156 | + if ( isset( $types[ 'term' ] ) ) { |
|
157 | + unset( $types[ 'term' ] ); |
|
158 | 158 | |
159 | 159 | $taxonomies = array_merge( |
160 | 160 | $taxonomies, |
161 | 161 | CMB2_Utils::ensure_array( $rest_box->cmb->prop( 'taxonomies' ) ) |
162 | 162 | ); |
163 | 163 | |
164 | - self::$type_boxes['term'][ $cmb_id ] = $cmb_id; |
|
164 | + self::$type_boxes[ 'term' ][ $cmb_id ] = $cmb_id; |
|
165 | 165 | } |
166 | 166 | |
167 | 167 | if ( ! empty( $types ) ) { |
168 | 168 | $alltypes = array_merge( $alltypes, array_flip( $types ) ); |
169 | - self::$type_boxes['post'][ $cmb_id ] = $cmb_id; |
|
169 | + self::$type_boxes[ 'post' ][ $cmb_id ] = $cmb_id; |
|
170 | 170 | } |
171 | 171 | } |
172 | 172 | |
@@ -176,15 +176,15 @@ discard block |
||
176 | 176 | self::register_rest_field( $alltypes, 'post' ); |
177 | 177 | } |
178 | 178 | |
179 | - if ( ! empty( self::$type_boxes['user'] ) ) { |
|
179 | + if ( ! empty( self::$type_boxes[ 'user' ] ) ) { |
|
180 | 180 | self::register_rest_field( 'user', 'user' ); |
181 | 181 | } |
182 | 182 | |
183 | - if ( ! empty( self::$type_boxes['comment'] ) ) { |
|
183 | + if ( ! empty( self::$type_boxes[ 'comment' ] ) ) { |
|
184 | 184 | self::register_rest_field( 'comment', 'comment' ); |
185 | 185 | } |
186 | 186 | |
187 | - if ( ! empty( self::$type_boxes['term'] ) ) { |
|
187 | + if ( ! empty( self::$type_boxes[ 'term' ] ) ) { |
|
188 | 188 | self::register_rest_field( $taxonomies, 'term' ); |
189 | 189 | } |
190 | 190 | } |
@@ -217,18 +217,18 @@ discard block |
||
217 | 217 | */ |
218 | 218 | protected function declare_read_edit_fields() { |
219 | 219 | foreach ( $this->cmb->prop( 'fields' ) as $field ) { |
220 | - $show_in_rest = isset( $field['show_in_rest'] ) ? $field['show_in_rest'] : null; |
|
220 | + $show_in_rest = isset( $field[ 'show_in_rest' ] ) ? $field[ 'show_in_rest' ] : null; |
|
221 | 221 | |
222 | 222 | if ( false === $show_in_rest ) { |
223 | 223 | continue; |
224 | 224 | } |
225 | 225 | |
226 | 226 | if ( $this->can_read( $show_in_rest ) ) { |
227 | - $this->read_fields[] = $field['id']; |
|
227 | + $this->read_fields[ ] = $field[ 'id' ]; |
|
228 | 228 | } |
229 | 229 | |
230 | 230 | if ( $this->can_edit( $show_in_rest ) ) { |
231 | - $this->edit_fields[] = $field['id']; |
|
231 | + $this->edit_fields[ ] = $field[ 'id' ]; |
|
232 | 232 | } |
233 | 233 | |
234 | 234 | } |
@@ -359,7 +359,7 @@ discard block |
||
359 | 359 | * @return mixed |
360 | 360 | */ |
361 | 361 | protected static function get_rest_values( $object, $request, $object_type, $main_object_type = 'post' ) { |
362 | - if ( ! isset( $object['id'] ) ) { |
|
362 | + if ( ! isset( $object[ 'id' ] ) ) { |
|
363 | 363 | return; |
364 | 364 | } |
365 | 365 | |
@@ -370,12 +370,12 @@ discard block |
||
370 | 370 | $rest_box = self::$boxes[ $cmb_id ]; |
371 | 371 | |
372 | 372 | foreach ( $rest_box->read_fields as $field_id ) { |
373 | - $rest_box->cmb->object_id( $object['id'] ); |
|
373 | + $rest_box->cmb->object_id( $object[ 'id' ] ); |
|
374 | 374 | $rest_box->cmb->object_type( $main_object_type ); |
375 | 375 | |
376 | 376 | $field = $rest_box->cmb->get_field( $field_id ); |
377 | 377 | |
378 | - $field->object_id( $object['id'] ); |
|
378 | + $field->object_id( $object[ 'id' ] ); |
|
379 | 379 | $field->object_type( $main_object_type ); |
380 | 380 | |
381 | 381 | $values[ $cmb_id ][ $field->id( true ) ] = $field->get_data(); |
@@ -609,8 +609,8 @@ discard block |
||
609 | 609 | return intval( $object->comment_ID ); |
610 | 610 | } |
611 | 611 | case 'term': |
612 | - if ( is_array( $object ) && isset( $object['term_id'] ) ) { |
|
613 | - return intval( $object['term_id'] ); |
|
612 | + if ( is_array( $object ) && isset( $object[ 'term_id' ] ) ) { |
|
613 | + return intval( $object[ 'term_id' ] ); |
|
614 | 614 | } elseif ( isset( $object->term_id ) ) { |
615 | 615 | return intval( $object->term_id ); |
616 | 616 | } |
@@ -68,7 +68,7 @@ discard block |
||
68 | 68 | 'schema' => array( $this, 'get_item_schema' ), |
69 | 69 | ) ); |
70 | 70 | |
71 | - $args['_rendered'] = array( |
|
71 | + $args[ '_rendered' ] = array( |
|
72 | 72 | 'description' => __( 'Includes the fully rendered attributes, \'form_open\', \'form_close\', as well as the enqueued \'js_dependencies\' script handles, and \'css_dependencies\' stylesheet handles.', 'cmb2' ), |
73 | 73 | ); |
74 | 74 | |
@@ -132,9 +132,9 @@ discard block |
||
132 | 132 | // And make sure current user can view this box. |
133 | 133 | && $this->get_item_permissions_check_filter( $this->request ) |
134 | 134 | ) { |
135 | - $boxes_data[] = $this->server->response_to_data( |
|
135 | + $boxes_data[ ] = $this->server->response_to_data( |
|
136 | 136 | $this->get_rest_box(), |
137 | - isset( $this->request['_embed'] ) |
|
137 | + isset( $this->request[ '_embed' ] ) |
|
138 | 138 | ); |
139 | 139 | } |
140 | 140 | } |
@@ -210,9 +210,9 @@ discard block |
||
210 | 210 | |
211 | 211 | $boxes_data = $cmb->meta_box; |
212 | 212 | |
213 | - if ( isset( $this->request['_rendered'] ) && $this->namespace_base !== ltrim( CMB2_REST_Controller::get_intial_route(), '/' ) ) { |
|
214 | - $boxes_data['form_open'] = $this->get_cb_results( array( $cmb, 'render_form_open' ) ); |
|
215 | - $boxes_data['form_close'] = $this->get_cb_results( array( $cmb, 'render_form_close' ) ); |
|
213 | + if ( isset( $this->request[ '_rendered' ] ) && $this->namespace_base !== ltrim( CMB2_REST_Controller::get_intial_route(), '/' ) ) { |
|
214 | + $boxes_data[ 'form_open' ] = $this->get_cb_results( array( $cmb, 'render_form_open' ) ); |
|
215 | + $boxes_data[ 'form_close' ] = $this->get_cb_results( array( $cmb, 'render_form_close' ) ); |
|
216 | 216 | |
217 | 217 | global $wp_scripts, $wp_styles; |
218 | 218 | $before_css = $wp_styles->queue; |
@@ -220,15 +220,15 @@ discard block |
||
220 | 220 | |
221 | 221 | CMB2_JS::enqueue(); |
222 | 222 | |
223 | - $boxes_data['js_dependencies'] = array_values( array_diff( $wp_scripts->queue, $before_js ) ); |
|
224 | - $boxes_data['css_dependencies'] = array_values( array_diff( $wp_styles->queue, $before_css ) ); |
|
223 | + $boxes_data[ 'js_dependencies' ] = array_values( array_diff( $wp_scripts->queue, $before_js ) ); |
|
224 | + $boxes_data[ 'css_dependencies' ] = array_values( array_diff( $wp_styles->queue, $before_css ) ); |
|
225 | 225 | } |
226 | 226 | |
227 | 227 | // TODO: look into 'embed' parameter. |
228 | 228 | // http://demo.wp-api.org/wp-json/wp/v2/posts?_embed |
229 | - unset( $boxes_data['fields'] ); |
|
229 | + unset( $boxes_data[ 'fields' ] ); |
|
230 | 230 | // Handle callable properties. |
231 | - unset( $boxes_data['show_on_cb'] ); |
|
231 | + unset( $boxes_data[ 'show_on_cb' ] ); |
|
232 | 232 | |
233 | 233 | $response = rest_ensure_response( $boxes_data ); |
234 | 234 |
@@ -49,8 +49,8 @@ discard block |
||
49 | 49 | ) ); |
50 | 50 | |
51 | 51 | $delete_args = $args; |
52 | - $delete_args['object_id']['required'] = true; |
|
53 | - $delete_args['object_type']['required'] = true; |
|
52 | + $delete_args[ 'object_id' ][ 'required' ] = true; |
|
53 | + $delete_args[ 'object_type' ][ 'required' ] = true; |
|
54 | 54 | |
55 | 55 | // Returns specific field data. |
56 | 56 | register_rest_route( $this->namespace, '/' . $this->rest_base . '/(?P<cmb_id>[\w-]+)/fields/(?P<field_id>[\w-]+)', array( |
@@ -122,13 +122,13 @@ discard block |
||
122 | 122 | foreach ( $this->rest_box->cmb->prop( 'fields', array() ) as $field ) { |
123 | 123 | |
124 | 124 | // Make sure this field can be read. |
125 | - $this->field = $this->rest_box->field_can_read( $field['id'], true ); |
|
125 | + $this->field = $this->rest_box->field_can_read( $field[ 'id' ], true ); |
|
126 | 126 | |
127 | 127 | // And make sure current user can view this box. |
128 | 128 | if ( $this->field && $this->get_item_permissions_check_filter() ) { |
129 | - $fields[ $field['id'] ] = $this->server->response_to_data( |
|
129 | + $fields[ $field[ 'id' ] ] = $this->server->response_to_data( |
|
130 | 130 | $this->prepare_field_response(), |
131 | - isset( $this->request['_embed'] ) |
|
131 | + isset( $this->request[ '_embed' ] ) |
|
132 | 132 | ); |
133 | 133 | } |
134 | 134 | } |
@@ -234,7 +234,7 @@ discard block |
||
234 | 234 | public function update_item( $request ) { |
235 | 235 | $this->initiate_rest_read_box( $request, 'field_value_update' ); |
236 | 236 | |
237 | - if ( ! $this->request['value'] ) { |
|
237 | + if ( ! $this->request[ 'value' ] ) { |
|
238 | 238 | return new WP_Error( 'cmb2_rest_update_field_error', __( 'CMB2 Field value cannot be updated without the value parameter specified.', 'cmb2' ), array( 'status' => 400 ) ); |
239 | 239 | } |
240 | 240 | |
@@ -291,9 +291,9 @@ discard block |
||
291 | 291 | * @param string $activity The modification activity (updated or deleted). |
292 | 292 | * @return WP_Error|WP_REST_Response |
293 | 293 | */ |
294 | - public function modify_field_value( $activity) { |
|
294 | + public function modify_field_value( $activity ) { |
|
295 | 295 | |
296 | - if ( ! $this->request['object_id'] || ! $this->request['object_type'] ) { |
|
296 | + if ( ! $this->request[ 'object_id' ] || ! $this->request[ 'object_type' ] ) { |
|
297 | 297 | return new WP_Error( 'cmb2_rest_modify_field_value_error', __( 'CMB2 Field value cannot be modified without the object_id and object_type parameters specified.', 'cmb2' ), array( 'status' => 400 ) ); |
298 | 298 | } |
299 | 299 | |
@@ -310,13 +310,13 @@ discard block |
||
310 | 310 | return new WP_Error( 'cmb2_rest_no_field_by_id_error', __( 'No field found by that id.', 'cmb2' ), array( 'status' => 403 ) ); |
311 | 311 | } |
312 | 312 | |
313 | - $this->field->args["value_{$activity}"] = (bool) 'deleted' === $activity |
|
313 | + $this->field->args[ "value_{$activity}" ] = (bool) 'deleted' === $activity |
|
314 | 314 | ? $this->field->remove_data() |
315 | - : $this->field->save_field( $this->request['value'] ); |
|
315 | + : $this->field->save_field( $this->request[ 'value' ] ); |
|
316 | 316 | |
317 | 317 | // If options page, save the $activity options |
318 | - if ( 'options-page' == $this->request['object_type'] ) { |
|
319 | - $this->field->args["value_{$activity}"] = cmb2_options( $this->request['object_id'] )->set(); |
|
318 | + if ( 'options-page' == $this->request[ 'object_type' ] ) { |
|
319 | + $this->field->args[ "value_{$activity}" ] = cmb2_options( $this->request[ 'object_id' ] )->set(); |
|
320 | 320 | } |
321 | 321 | |
322 | 322 | return $this->prepare_read_field( $this->field ); |
@@ -391,13 +391,13 @@ discard block |
||
391 | 391 | $value = $field->options(); |
392 | 392 | } elseif ( in_array( $key, CMB2_Field::$callable_fields, true ) ) { |
393 | 393 | |
394 | - if ( isset( $this->request['_rendered'] ) ) { |
|
394 | + if ( isset( $this->request[ '_rendered' ] ) ) { |
|
395 | 395 | $value = $key === 'render_row_cb' ? $rendered : $field->get_param_callback_result( $key ); |
396 | 396 | } elseif ( is_array( $value ) ) { |
397 | 397 | // We need to rewrite callbacks as string as they will cause |
398 | 398 | // JSON recursion errors. |
399 | - $class = is_string( $value[0] ) ? $value[0] : get_class( $value[0] ); |
|
400 | - $value = $class . '::' . $value[1]; |
|
399 | + $class = is_string( $value[ 0 ] ) ? $value[ 0 ] : get_class( $value[ 0 ] ); |
|
400 | + $value = $class . '::' . $value[ 1 ]; |
|
401 | 401 | } |
402 | 402 | } |
403 | 403 | |
@@ -410,8 +410,8 @@ discard block |
||
410 | 410 | } |
411 | 411 | } |
412 | 412 | |
413 | - if ( $this->request['object_id'] && $this->request['object_type'] ) { |
|
414 | - $field_data['value'] = $field->get_data(); |
|
413 | + if ( $this->request[ 'object_id' ] && $this->request[ 'object_type' ] ) { |
|
414 | + $field_data[ 'value' ] = $field->get_data(); |
|
415 | 415 | } |
416 | 416 | |
417 | 417 | return $field_data; |
@@ -115,7 +115,7 @@ discard block |
||
115 | 115 | $cmb_demo = new_cmb2_box( array( |
116 | 116 | 'id' => $prefix . 'metabox', |
117 | 117 | 'title' => esc_html__( 'Test Metabox', 'cmb2' ), |
118 | - 'object_types' => array( 'page', ), // Post type |
|
118 | + 'object_types' => array( 'page',), // Post type |
|
119 | 119 | // 'show_on_cb' => 'yourprefix_show_if_front_page', // function should return a bool value |
120 | 120 | // 'context' => 'normal', |
121 | 121 | // 'priority' => 'high', |
@@ -385,7 +385,7 @@ discard block |
||
385 | 385 | 'desc' => esc_html__( 'field description (optional)', 'cmb2' ), |
386 | 386 | 'id' => $prefix . 'wysiwyg', |
387 | 387 | 'type' => 'wysiwyg', |
388 | - 'options' => array( 'textarea_rows' => 5, ), |
|
388 | + 'options' => array( 'textarea_rows' => 5,), |
|
389 | 389 | ) ); |
390 | 390 | |
391 | 391 | $cmb_demo->add_field( array( |
@@ -441,11 +441,11 @@ discard block |
||
441 | 441 | $cmb_about_page = new_cmb2_box( array( |
442 | 442 | 'id' => $prefix . 'metabox', |
443 | 443 | 'title' => esc_html__( 'About Page Metabox', 'cmb2' ), |
444 | - 'object_types' => array( 'page', ), // Post type |
|
444 | + 'object_types' => array( 'page',), // Post type |
|
445 | 445 | 'context' => 'normal', |
446 | 446 | 'priority' => 'high', |
447 | 447 | 'show_names' => true, // Show field names on the left |
448 | - 'show_on' => array( 'id' => array( 2, ) ), // Specific post IDs to display this metabox |
|
448 | + 'show_on' => array( 'id' => array( 2,) ), // Specific post IDs to display this metabox |
|
449 | 449 | ) ); |
450 | 450 | |
451 | 451 | $cmb_about_page->add_field( array( |
@@ -470,7 +470,7 @@ discard block |
||
470 | 470 | $cmb_group = new_cmb2_box( array( |
471 | 471 | 'id' => $prefix . 'metabox', |
472 | 472 | 'title' => esc_html__( 'Repeating Field Group', 'cmb2' ), |
473 | - 'object_types' => array( 'page', ), |
|
473 | + 'object_types' => array( 'page',), |
|
474 | 474 | ) ); |
475 | 475 | |
476 | 476 | // $group_field_id is the field id string, so in this case: $prefix . 'demo' |
@@ -699,7 +699,7 @@ discard block |
||
699 | 699 | $cmb_rest = new_cmb2_box( array( |
700 | 700 | 'id' => $prefix . 'metabox', |
701 | 701 | 'title' => esc_html__( 'REST Test Box', 'cmb2' ), |
702 | - 'object_types' => array( 'page', ), // Post type |
|
702 | + 'object_types' => array( 'page',), // Post type |
|
703 | 703 | 'show_in_rest' => WP_REST_Server::ALLMETHODS, // WP_REST_Server::READABLE|WP_REST_Server::EDITABLE, // Determines which HTTP methods the box is visible in. |
704 | 704 | // Optional callback to limit box visibility. |
705 | 705 | // See: https://github.com/WebDevStudios/CMB2/wiki/REST-API#permissions |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | if ( ! $terms ) { |
25 | 25 | $options .= sprintf( '<li><label>%s</label></li>', esc_html( $this->_text( 'no_terms_text', esc_html__( 'No terms', 'cmb2' ) ) ) ); |
26 | 26 | } else { |
27 | - $option_none = $field->args( 'show_option_none' ); |
|
27 | + $option_none = $field->args( 'show_option_none' ); |
|
28 | 28 | if ( ! empty( $option_none ) ) { |
29 | 29 | |
30 | 30 | $field_id = $this->_id(); |
@@ -54,7 +54,7 @@ discard block |
||
54 | 54 | 'label' => $option_none, |
55 | 55 | ); |
56 | 56 | if ( $saved_term == $option_none_value ) { |
57 | - $args['checked'] = 'checked'; |
|
57 | + $args[ 'checked' ] = 'checked'; |
|
58 | 58 | } |
59 | 59 | $options .= $this->list_input( $args, $i ); |
60 | 60 | $i++; |
@@ -67,7 +67,7 @@ discard block |
||
67 | 67 | ); |
68 | 68 | |
69 | 69 | if ( $saved_term == $term->slug ) { |
70 | - $args['checked'] = 'checked'; |
|
70 | + $args[ 'checked' ] = 'checked'; |
|
71 | 71 | } |
72 | 72 | $options .= $this->list_input( $args, $i ); |
73 | 73 | $i++; |
@@ -29,8 +29,8 @@ |
||
29 | 29 | 'type' => 'hidden', |
30 | 30 | 'class' => 'cmb2-upload-file cmb2-upload-list', |
31 | 31 | 'size' => 45, 'desc' => '', 'value' => '', |
32 | - 'data-previewsize' => sprintf( '[%d,%d]', $img_size_data['width'], $img_size_data['height'] ), |
|
33 | - 'data-sizename' => $img_size_data['name'], |
|
32 | + 'data-previewsize' => sprintf( '[%d,%d]', $img_size_data[ 'width' ], $img_size_data[ 'height' ] ), |
|
33 | + 'data-sizename' => $img_size_data[ 'name' ], |
|
34 | 34 | 'data-queryargs' => ! empty( $query_args ) ? json_encode( $query_args ) : '', |
35 | 35 | 'js_dependencies' => 'media-editor', |
36 | 36 | ) ); |
@@ -358,7 +358,7 @@ discard block |
||
358 | 358 | } |
359 | 359 | |
360 | 360 | // Cast to bool. |
361 | - return !! $val; |
|
361 | + return ! ! $val; |
|
362 | 362 | } |
363 | 363 | |
364 | 364 | /** |
@@ -386,11 +386,11 @@ discard block |
||
386 | 386 | switch ( $message ) { |
387 | 387 | |
388 | 388 | case self::DEPRECATED_PARAM: |
389 | - $message = sprintf( __( 'The "%s" field parameter has been deprecated in favor of the "%s" parameter.', 'cmb2' ), $args[3], $args[4] ); |
|
389 | + $message = sprintf( __( 'The "%s" field parameter has been deprecated in favor of the "%s" parameter.', 'cmb2' ), $args[ 3 ], $args[ 4 ] ); |
|
390 | 390 | break; |
391 | 391 | |
392 | 392 | case self::DEPRECATED_CB_PARAM: |
393 | - $message = sprintf( __( 'Using the "%s" field parameter as a callback has been deprecated in favor of the "%s" parameter.', 'cmb2' ), $args[3], $args[4] ); |
|
393 | + $message = sprintf( __( 'Using the "%s" field parameter as a callback has been deprecated in favor of the "%s" parameter.', 'cmb2' ), $args[ 3 ], $args[ 4 ] ); |
|
394 | 394 | break; |
395 | 395 | |
396 | 396 | default: |
@@ -469,7 +469,7 @@ discard block |
||
469 | 469 | public function __call( $method, $args ) { |
470 | 470 | $object_class = strtolower( get_class( $this ) ); |
471 | 471 | |
472 | - if ( ! has_filter( "{$object_class}_inherit_{$method}" ) ) { |
|
472 | + if ( ! has_filter( "{$object_class}_inherit_{$method}" ) ) { |
|
473 | 473 | throw new Exception( sprintf( esc_html__( 'Invalid %1$s method: %2$s', 'cmb2' ), get_class( $this ), $method ) ); |
474 | 474 | } |
475 | 475 |
@@ -122,7 +122,7 @@ discard block |
||
122 | 122 | |
123 | 123 | if ( $this->cmb->has_columns ) { |
124 | 124 | add_filter( 'manage_edit-comments_columns', array( $this, 'register_column_headers' ) ); |
125 | - add_action( 'manage_comments_custom_column', array( $this, 'column_display' ), 10, 3 ); |
|
125 | + add_action( 'manage_comments_custom_column', array( $this, 'column_display' ), 10, 3 ); |
|
126 | 126 | } |
127 | 127 | } |
128 | 128 | |
@@ -139,7 +139,7 @@ discard block |
||
139 | 139 | |
140 | 140 | if ( $this->cmb->has_columns ) { |
141 | 141 | add_filter( 'manage_users_columns', array( $this, 'register_column_headers' ) ); |
142 | - add_filter( 'manage_users_custom_column', array( $this, 'return_column_display' ), 10, 3 ); |
|
142 | + add_filter( 'manage_users_custom_column', array( $this, 'return_column_display' ), 10, 3 ); |
|
143 | 143 | } |
144 | 144 | } |
145 | 145 | |
@@ -173,7 +173,7 @@ discard block |
||
173 | 173 | |
174 | 174 | if ( $this->cmb->has_columns ) { |
175 | 175 | add_filter( "manage_edit-{$taxonomy}_columns", array( $this, 'register_column_headers' ) ); |
176 | - add_filter( "manage_{$taxonomy}_custom_column", array( $this, 'return_column_display' ), 10, 3 ); |
|
176 | + add_filter( "manage_{$taxonomy}_custom_column", array( $this, 'return_column_display' ), 10, 3 ); |
|
177 | 177 | } |
178 | 178 | } |
179 | 179 | |
@@ -266,25 +266,25 @@ discard block |
||
266 | 266 | $fields = $this->cmb->prop( 'fields' ); |
267 | 267 | |
268 | 268 | foreach ( $fields as $key => $field ) { |
269 | - if ( ! isset( $field['column'] ) ) { |
|
269 | + if ( ! isset( $field[ 'column' ] ) ) { |
|
270 | 270 | continue; |
271 | 271 | } |
272 | 272 | |
273 | - $column = $field['column']; |
|
273 | + $column = $field[ 'column' ]; |
|
274 | 274 | |
275 | - if ( false === $column['position'] ) { |
|
275 | + if ( false === $column[ 'position' ] ) { |
|
276 | 276 | |
277 | - $columns[ $field['id'] ] = $column['name']; |
|
277 | + $columns[ $field[ 'id' ] ] = $column[ 'name' ]; |
|
278 | 278 | |
279 | 279 | } else { |
280 | 280 | |
281 | - $before = array_slice( $columns, 0, absint( $column['position'] ) ); |
|
282 | - $before[ $field['id'] ] = $column['name']; |
|
281 | + $before = array_slice( $columns, 0, absint( $column[ 'position' ] ) ); |
|
282 | + $before[ $field[ 'id' ] ] = $column[ 'name' ]; |
|
283 | 283 | $columns = $before + $columns; |
284 | 284 | } |
285 | 285 | |
286 | - $column['field'] = $field; |
|
287 | - $this->columns[ $field['id'] ] = $column; |
|
286 | + $column[ 'field' ] = $field; |
|
287 | + $this->columns[ $field[ 'id' ] ] = $column; |
|
288 | 288 | } |
289 | 289 | |
290 | 290 | return $columns; |
@@ -297,7 +297,7 @@ discard block |
||
297 | 297 | public function column_display( $column_name, $object_id ) { |
298 | 298 | if ( isset( $this->columns[ $column_name ] ) ) { |
299 | 299 | $field = new CMB2_Field( array( |
300 | - 'field_args' => $this->columns[ $column_name ]['field'], |
|
300 | + 'field_args' => $this->columns[ $column_name ][ 'field' ], |
|
301 | 301 | 'object_type' => $this->object_type, |
302 | 302 | 'object_id' => $this->cmb->object_id( $object_id ), |
303 | 303 | 'cmb_id' => $this->cmb->cmb_id, |
@@ -469,13 +469,13 @@ discard block |
||
469 | 469 | */ |
470 | 470 | public function postbox_classes( $classes ) { |
471 | 471 | if ( $this->cmb->prop( 'closed' ) && ! in_array( 'closed', $classes ) ) { |
472 | - $classes[] = 'closed'; |
|
472 | + $classes[ ] = 'closed'; |
|
473 | 473 | } |
474 | 474 | |
475 | 475 | if ( $this->cmb->is_alternate_context_box() ) { |
476 | 476 | $classes = $this->alternate_context_postbox_classes( $classes ); |
477 | 477 | } else { |
478 | - $classes[] = 'cmb2-postbox'; |
|
478 | + $classes[ ] = 'cmb2-postbox'; |
|
479 | 479 | } |
480 | 480 | |
481 | 481 | return $classes; |
@@ -488,19 +488,19 @@ discard block |
||
488 | 488 | * @return array Modified array of classes |
489 | 489 | */ |
490 | 490 | protected function alternate_context_postbox_classes( $classes ) { |
491 | - $classes[] = 'context-box'; |
|
492 | - $classes[] = 'context-' . $this->cmb->prop( 'context' ) . '-box'; |
|
491 | + $classes[ ] = 'context-box'; |
|
492 | + $classes[ ] = 'context-' . $this->cmb->prop( 'context' ) . '-box'; |
|
493 | 493 | |
494 | 494 | if ( in_array( $this->cmb->cmb_id, get_hidden_meta_boxes( get_current_screen() ) ) ) { |
495 | - $classes[] = 'hide-if-js'; |
|
495 | + $classes[ ] = 'hide-if-js'; |
|
496 | 496 | } |
497 | 497 | |
498 | 498 | $add_wrap = $this->cmb->prop( 'title' ) || ! $this->cmb->prop( 'remove_box_wrap' ); |
499 | 499 | |
500 | 500 | if ( $add_wrap ) { |
501 | - $classes[] = 'cmb2-postbox postbox'; |
|
501 | + $classes[ ] = 'cmb2-postbox postbox'; |
|
502 | 502 | } else { |
503 | - $classes[] = 'cmb2-no-box-wrap'; |
|
503 | + $classes[ ] = 'cmb2-no-box-wrap'; |
|
504 | 504 | } |
505 | 505 | |
506 | 506 | return $classes; |
@@ -522,7 +522,7 @@ discard block |
||
522 | 522 | public function user_new_metabox( $section ) { |
523 | 523 | if ( $section == $this->cmb->prop( 'new_user_section' ) ) { |
524 | 524 | $object_id = $this->cmb->object_id(); |
525 | - $this->cmb->object_id( isset( $_REQUEST['user_id'] ) ? $_REQUEST['user_id'] : $object_id ); |
|
525 | + $this->cmb->object_id( isset( $_REQUEST[ 'user_id' ] ) ? $_REQUEST[ 'user_id' ] : $object_id ); |
|
526 | 526 | $this->user_metabox(); |
527 | 527 | } |
528 | 528 | } |
@@ -703,7 +703,7 @@ discard block |
||
703 | 703 | |
704 | 704 | $data_to_delete = array(); |
705 | 705 | foreach ( $this->cmb->prop( 'fields' ) as $field ) { |
706 | - $data_to_delete[ $field['id'] ] = ''; |
|
706 | + $data_to_delete[ $field[ 'id' ] ] = ''; |
|
707 | 707 | } |
708 | 708 | |
709 | 709 | $this->cmb->save_fields( $term_id, 'term', $data_to_delete ); |
@@ -53,7 +53,7 @@ discard block |
||
53 | 53 | |
54 | 54 | // Check for methods to be proxied to the CMB2_Type_Base object. |
55 | 55 | if ( $exists = $this->maybe_proxy_method( $fieldtype, $arguments ) ) { |
56 | - return $exists['value']; |
|
56 | + return $exists[ 'value' ]; |
|
57 | 57 | } |
58 | 58 | |
59 | 59 | // Check for custom field type class. |
@@ -481,8 +481,8 @@ discard block |
||
481 | 481 | 'class' => 'cmb2-hidden', |
482 | 482 | ); |
483 | 483 | if ( $this->field->group ) { |
484 | - $args['data-groupid'] = $this->field->group->id(); |
|
485 | - $args['data-iterator'] = $this->iterator; |
|
484 | + $args[ 'data-groupid' ] = $this->field->group->id(); |
|
485 | + $args[ 'data-iterator' ] = $this->iterator; |
|
486 | 486 | } |
487 | 487 | |
488 | 488 | return $this->get_new_render_type( __FUNCTION__, 'CMB2_Type_Text', $args, 'input' )->render(); |