Changeset 61429
- Timestamp:
- 01/05/2026 04:31:14 AM (3 months ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 18 edited
-
rest-api.php (modified) (3 diffs)
-
rest-api/class-wp-rest-server.php (modified) (5 diffs)
-
rest-api/endpoints/class-wp-rest-attachments-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-autosaves-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-block-directory-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-blocks-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-global-styles-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-menu-locations-controller.php (modified) (2 diffs)
-
rest-api/endpoints/class-wp-rest-pattern-directory-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-settings-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-sidebars-controller.php (modified) (2 diffs)
-
rest-api/endpoints/class-wp-rest-templates-controller.php (modified) (2 diffs)
-
rest-api/endpoints/class-wp-rest-themes-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-users-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-widget-types-controller.php (modified) (1 diff)
-
rest-api/endpoints/class-wp-rest-widgets-controller.php (modified) (1 diff)
-
rest-api/fields/class-wp-rest-meta-fields.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/rest-api.php
r61178 r61429 953 953 break 2; 954 954 } 955 $ref[ $next ] = isset( $ref[ $next ] ) ? $ref[ $next ] :array();955 $ref[ $next ] = $ref[ $next ] ?? array(); 956 956 $ref = &$ref[ $next ]; 957 957 } … … 3089 3089 3090 3090 if ( $is_array_type ) { 3091 $check = isset( $schema['items'] ) ? $schema['items'] :array();3091 $check = $schema['items'] ?? array(); 3092 3092 } elseif ( $is_object_type ) { 3093 3093 if ( isset( $schema['properties'][ $key ] ) ) { … … 3418 3418 $error->get_all_error_data(), 3419 3419 static function ( $status, $error_data ) { 3420 return is_array( $error_data ) && isset( $error_data['status'] ) ? $error_data['status'] :$status;3420 return $error_data['status'] ?? $status; 3421 3421 }, 3422 3422 500 -
trunk/src/wp-includes/rest-api/class-wp-rest-server.php
r61428 r61429 1375 1375 $response = new WP_REST_Response( $available ); 1376 1376 1377 $fields = isset( $request['_fields'] ) ? $request['_fields'] :'';1377 $fields = $request['_fields'] ?? ''; 1378 1378 $fields = wp_parse_list( $fields ); 1379 1379 if ( empty( $fields ) ) { … … 1619 1619 } 1620 1620 1621 $allow_batch = isset( $options['allow_batch'] ) ? $options['allow_batch'] :false;1621 $allow_batch = $options['allow_batch'] ?? false; 1622 1622 1623 1623 if ( isset( $options['schema'] ) && 'help' === $context ) { … … 1641 1641 ); 1642 1642 1643 $callback_batch = isset( $callback['allow_batch'] ) ? $callback['allow_batch'] :$allow_batch;1643 $callback_batch = $callback['allow_batch'] ?? $allow_batch; 1644 1644 1645 1645 if ( $callback_batch ) { … … 1723 1723 } 1724 1724 1725 $single_request = new WP_REST_Request( isset( $args['method'] ) ? $args['method'] :'POST', $parsed_url['path'] );1725 $single_request = new WP_REST_Request( $args['method'] ?? 'POST', $parsed_url['path'] ); 1726 1726 1727 1727 if ( ! empty( $parsed_url['query'] ) ) { … … 1768 1768 } else { 1769 1769 $route_options = $this->get_route_options( $route ); 1770 $allow_batch = isset( $route_options['allow_batch'] ) ? $route_options['allow_batch'] :false;1770 $allow_batch = $route_options['allow_batch'] ?? false; 1771 1771 } 1772 1772 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-attachments-controller.php
r61065 r61429 160 160 * @param string|null $mime_type The mime type of the file being uploaded (if available). 161 161 */ 162 $prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, isset( $files['file']['type'] ) ? $files['file']['type'] :null );162 $prevent_unsupported_uploads = apply_filters( 'wp_prevent_unsupported_mime_type_uploads', true, $files['file']['type'] ?? null ); 163 163 164 164 // If the upload is an image, check if the server can handle the mime type. -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-autosaves-controller.php
r59970 r61429 390 390 // get_metadata_raw is used to avoid retrieving the default value. 391 391 $old_meta = get_metadata_raw( 'post', $post_id, $meta_key, true ); 392 $new_meta = isset( $meta[ $meta_key ] ) ? $meta[ $meta_key ] :'';392 $new_meta = $meta[ $meta_key ] ?? ''; 393 393 394 394 if ( $new_meta !== $old_meta ) { -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-block-directory-controller.php
r59501 r61429 137 137 'author_block_count' => (int) $plugin['author_block_count'], 138 138 'author' => wp_strip_all_tags( $plugin['author'] ), 139 'icon' => ( isset( $plugin['icons']['1x'] ) ? $plugin['icons']['1x'] : 'block-default' ),139 'icon' => $plugin['icons']['1x'] ?? 'block-default', 140 140 'last_updated' => gmdate( 'Y-m-d\TH:i:s', strtotime( $plugin['last_updated'] ) ), 141 141 'humanized_updated' => sprintf( -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-blocks-controller.php
r57033 r61429 59 59 60 60 // Add the core wp_pattern_sync_status meta as top level property to the response. 61 $data['wp_pattern_sync_status'] = isset( $data['meta']['wp_pattern_sync_status'] ) ? $data['meta']['wp_pattern_sync_status'] :'';61 $data['wp_pattern_sync_status'] = $data['meta']['wp_pattern_sync_status'] ?? ''; 62 62 unset( $data['meta']['wp_pattern_sync_status'] ); 63 63 return $data; -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-controller.php
r60249 r61429 572 572 public function get_fields_for_response( $request ) { 573 573 $schema = $this->get_item_schema(); 574 $properties = isset( $schema['properties'] ) ? $schema['properties'] :array();574 $properties = $schema['properties'] ?? array(); 575 575 576 576 $additional_fields = $this->get_additional_fields(); -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-global-styles-controller.php
r60359 r61429 574 574 if ( rest_is_field_included( 'styles', $fields ) ) { 575 575 $raw_data = $theme->get_raw_data(); 576 $data['styles'] = isset( $raw_data['styles'] ) ? $raw_data['styles'] :array();576 $data['styles'] = $raw_data['styles'] ?? array(); 577 577 } 578 578 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-menu-locations-controller.php
r59718 r61429 182 182 183 183 $locations = get_nav_menu_locations(); 184 $menu = isset( $locations[ $location->name ] ) ? $locations[ $location->name ] :0;184 $menu = $locations[ $location->name ] ?? 0; 185 185 186 186 $fields = $this->get_fields_for_response( $request ); … … 243 243 244 244 $locations = get_nav_menu_locations(); 245 $menu = isset( $locations[ $location->name ] ) ? $locations[ $location->name ] :0;245 $menu = $locations[ $location->name ] ?? 0; 246 246 if ( $menu ) { 247 247 $path = rest_get_route_for_term( $menu ); -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-pattern-directory-controller.php
r59970 r61429 101 101 $query_args['locale'] = get_user_locale(); 102 102 $query_args['wp-version'] = wp_get_wp_version(); 103 $query_args['pattern-categories'] = isset( $request['category'] ) ? $request['category'] :false;104 $query_args['pattern-keywords'] = isset( $request['keyword'] ) ? $request['keyword'] :false;103 $query_args['pattern-categories'] = $request['category'] ?? false; 104 $query_args['pattern-keywords'] = $request['keyword'] ?? false; 105 105 106 106 $query_args = array_filter( $query_args ); -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-settings-controller.php
r61324 r61429 240 240 'title' => empty( $args['label'] ) ? '' : $args['label'], 241 241 'description' => empty( $args['description'] ) ? '' : $args['description'], 242 'default' => isset( $args['default'] ) ? $args['default'] :null,242 'default' => $args['default'] ?? null, 243 243 ); 244 244 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-sidebars-controller.php
r59970 r61429 340 340 341 341 $sidebar['status'] = 'active'; 342 $sidebar['name'] = isset( $registered_sidebar['name'] ) ? $registered_sidebar['name'] :'';342 $sidebar['name'] = $registered_sidebar['name'] ?? ''; 343 343 $sidebar['description'] = isset( $registered_sidebar['description'] ) ? wp_sidebar_description( $id ) : ''; 344 $sidebar['class'] = isset( $registered_sidebar['class'] ) ? $registered_sidebar['class'] :'';345 $sidebar['before_widget'] = isset( $registered_sidebar['before_widget'] ) ? $registered_sidebar['before_widget'] :'';346 $sidebar['after_widget'] = isset( $registered_sidebar['after_widget'] ) ? $registered_sidebar['after_widget'] :'';347 $sidebar['before_title'] = isset( $registered_sidebar['before_title'] ) ? $registered_sidebar['before_title'] :'';348 $sidebar['after_title'] = isset( $registered_sidebar['after_title'] ) ? $registered_sidebar['after_title'] :'';344 $sidebar['class'] = $registered_sidebar['class'] ?? ''; 345 $sidebar['before_widget'] = $registered_sidebar['before_widget'] ?? ''; 346 $sidebar['after_widget'] = $registered_sidebar['after_widget'] ?? ''; 347 $sidebar['before_title'] = $registered_sidebar['before_title'] ?? ''; 348 $sidebar['after_title'] = $registered_sidebar['after_title'] ?? ''; 349 349 } else { 350 350 $sidebar['status'] = 'inactive'; … … 362 362 $sidebars = wp_get_sidebars_widgets(); 363 363 $widgets = array_filter( 364 isset( $sidebars[ $sidebar['id'] ] ) ? $sidebars[ $sidebar['id'] ] :array(),364 $sidebars[ $sidebar['id'] ] ?? array(), 365 365 static function ( $widget_id ) use ( $wp_registered_widgets ) { 366 366 return isset( $wp_registered_widgets[ $widget_id ] ); -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-templates-controller.php
r59970 r61429 580 580 $changes->post_status = 'publish'; 581 581 $changes->tax_input = array( 582 'wp_theme' => isset( $request['theme'] ) ? $request['theme'] :get_stylesheet(),582 'wp_theme' => $request['theme'] ?? get_stylesheet(), 583 583 ); 584 584 } elseif ( 'custom' !== $template->source ) { … … 915 915 return $plugins[ $plugin_basename ]['Name']; 916 916 } 917 return isset( $template_object->plugin ) ? 918 $template_object->plugin : 917 return $template_object->plugin ?? 919 918 $template_object->theme; 920 919 case 'site': -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-themes-controller.php
r60984 r61429 406 406 } else { 407 407 $user_cpt = WP_Theme_JSON_Resolver::get_user_data_from_wp_global_styles( $theme ); 408 $id = isset( $user_cpt['ID'] ) ? $user_cpt['ID'] :null;408 $id = $user_cpt['ID'] ?? null; 409 409 } 410 410 -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-users-controller.php
r61002 r61429 334 334 } 335 335 $search_columns = $request->get_param( 'search_columns' ); 336 $valid_columns = isset( $prepared_args['search_columns'] ) 337 ? $prepared_args['search_columns'] 338 : array( 'ID', 'user_login', 'user_nicename', 'user_email', 'display_name' ); 336 $valid_columns = $prepared_args['search_columns'] ?? array( 'ID', 'user_login', 'user_nicename', 'user_email', 'display_name' ); 339 337 $search_columns_mapping = array( 340 338 'id' => 'ID', -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-widget-types-controller.php
r59970 r61429 612 612 'preview' => $this->render_legacy_widget_preview_iframe( 613 613 $request['id'], 614 isset( $request['instance'] ) ? $request['instance'] :null614 $request['instance'] ?? null 615 615 ), 616 616 ); -
trunk/src/wp-includes/rest-api/endpoints/class-wp-rest-widgets-controller.php
r60044 r61429 534 534 $parsed_id = wp_parse_widget_id( $id ); 535 535 $id_base = $parsed_id['id_base']; 536 $number = isset( $parsed_id['number'] ) ? $parsed_id['number'] :null;536 $number = $parsed_id['number'] ?? null; 537 537 $widget_object = $wp_widget_factory->get_widget_object( $id_base ); 538 538 $creating = false; -
trunk/src/wp-includes/rest-api/fields/class-wp-rest-meta-fields.php
r59023 r61429 481 481 'title' => empty( $args['label'] ) ? '' : $args['label'], 482 482 'description' => empty( $args['description'] ) ? '' : $args['description'], 483 'default' => isset( $args['default'] ) ? $args['default'] :null,483 'default' => $args['default'] ?? null, 484 484 ); 485 485
Note: See TracChangeset
for help on using the changeset viewer.