Coding Standards: Restore more descriptive variable names in a few class methods.
When various methods parameters in child classes were renamed to `$item` to match the parent class for PHP 8 named parameter support, most of the methods restored the more descriptive, specific name at the beginning for better readability, with several exceptions for methods consisting only of a few lines. To avoid confusion about why some methods do that and some don't, this commit aims to bring more consistency to the code, specifically in list tables' `::column_default()` methods. Follow-up to [51728], [51737], [51786]. See #58831. Built from https://develop.svn.wordpress.org/trunk@56586 git-svn-id: http://core.svn.wordpress.org/trunk@56098 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
6388ac820b
commit
1aca5e48e5
|
@ -61,7 +61,8 @@ class Walker_Nav_Menu_Edit extends Walker_Nav_Menu {
|
||||||
global $_wp_nav_menu_max_depth;
|
global $_wp_nav_menu_max_depth;
|
||||||
|
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$menu_item = $data_object;
|
$menu_item = $data_object;
|
||||||
|
|
||||||
$_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
|
$_wp_nav_menu_max_depth = $depth > $_wp_nav_menu_max_depth ? $depth : $_wp_nav_menu_max_depth;
|
||||||
|
|
||||||
ob_start();
|
ob_start();
|
||||||
|
|
|
@ -685,7 +685,8 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$comment = $item;
|
$comment = $item;
|
||||||
|
|
||||||
$the_comment_status = wp_get_comment_status( $comment );
|
$the_comment_status = wp_get_comment_status( $comment );
|
||||||
|
|
||||||
$output = '';
|
$output = '';
|
||||||
|
@ -1087,6 +1088,9 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
* @param string $column_name The custom column's name.
|
* @param string $column_name The custom column's name.
|
||||||
*/
|
*/
|
||||||
public function column_default( $item, $column_name ) {
|
public function column_default( $item, $column_name ) {
|
||||||
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
|
$comment = $item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires when the default column output is displayed for a single row.
|
* Fires when the default column output is displayed for a single row.
|
||||||
*
|
*
|
||||||
|
@ -1095,6 +1099,6 @@ class WP_Comments_List_Table extends WP_List_Table {
|
||||||
* @param string $column_name The custom column's name.
|
* @param string $column_name The custom column's name.
|
||||||
* @param string $comment_id The comment ID as a numeric string.
|
* @param string $comment_id The comment ID as a numeric string.
|
||||||
*/
|
*/
|
||||||
do_action( 'manage_comments_custom_column', $column_name, $item->comment_ID );
|
do_action( 'manage_comments_custom_column', $column_name, $comment->comment_ID );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -290,6 +290,9 @@ class WP_Links_List_Table extends WP_List_Table {
|
||||||
* @param string $column_name Current column name.
|
* @param string $column_name Current column name.
|
||||||
*/
|
*/
|
||||||
public function column_default( $item, $column_name ) {
|
public function column_default( $item, $column_name ) {
|
||||||
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
|
$link = $item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires for each registered custom link column.
|
* Fires for each registered custom link column.
|
||||||
*
|
*
|
||||||
|
@ -298,7 +301,7 @@ class WP_Links_List_Table extends WP_List_Table {
|
||||||
* @param string $column_name Name of the custom column.
|
* @param string $column_name Name of the custom column.
|
||||||
* @param int $link_id Link ID.
|
* @param int $link_id Link ID.
|
||||||
*/
|
*/
|
||||||
do_action( 'manage_link_custom_column', $column_name, $item->link_id );
|
do_action( 'manage_link_custom_column', $column_name, $link->link_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_rows() {
|
public function display_rows() {
|
||||||
|
@ -332,7 +335,8 @@ class WP_Links_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$link = $item;
|
$link = $item;
|
||||||
|
|
||||||
$edit_link = get_edit_bookmark_link( $link );
|
$edit_link = get_edit_bookmark_link( $link );
|
||||||
|
|
||||||
$actions = array();
|
$actions = array();
|
||||||
|
|
|
@ -880,11 +880,11 @@ class WP_Media_List_Table extends WP_List_Table {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
|
$post = $item;
|
||||||
|
|
||||||
$att_title = _draft_or_post_title();
|
$att_title = _draft_or_post_title();
|
||||||
$actions = $this->_get_row_actions(
|
$actions = $this->_get_row_actions( $post, $att_title );
|
||||||
$item, // WP_Post object for an attachment.
|
|
||||||
$att_title
|
|
||||||
);
|
|
||||||
|
|
||||||
return $this->row_actions( $actions );
|
return $this->row_actions( $actions );
|
||||||
}
|
}
|
||||||
|
|
|
@ -597,6 +597,9 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||||
* @param string $column_name Current column name.
|
* @param string $column_name Current column name.
|
||||||
*/
|
*/
|
||||||
public function column_default( $item, $column_name ) {
|
public function column_default( $item, $column_name ) {
|
||||||
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
|
$blog = $item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires for each registered custom column in the Sites list table.
|
* Fires for each registered custom column in the Sites list table.
|
||||||
*
|
*
|
||||||
|
@ -605,7 +608,7 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||||
* @param string $column_name The name of the column to display.
|
* @param string $column_name The name of the column to display.
|
||||||
* @param int $blog_id The site ID.
|
* @param int $blog_id The site ID.
|
||||||
*/
|
*/
|
||||||
do_action( 'manage_sites_custom_column', $column_name, $item['blog_id'] );
|
do_action( 'manage_sites_custom_column', $column_name, $blog['blog_id'] );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -714,7 +717,8 @@ class WP_MS_Sites_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$blog = $item;
|
$blog = $item;
|
||||||
|
|
||||||
$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
|
$blogname = untrailingslashit( $blog['domain'] . $blog['path'] );
|
||||||
|
|
||||||
// Preordered.
|
// Preordered.
|
||||||
|
|
|
@ -509,7 +509,8 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||||
*/
|
*/
|
||||||
public function column_cb( $item ) {
|
public function column_cb( $item ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$theme = $item;
|
$theme = $item;
|
||||||
|
|
||||||
$checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
|
$checkbox_id = 'checkbox_' . md5( $theme->get( 'Name' ) );
|
||||||
?>
|
?>
|
||||||
<label class="label-covers-full-cell" for="<?php echo $checkbox_id; ?>" >
|
<label class="label-covers-full-cell" for="<?php echo $checkbox_id; ?>" >
|
||||||
|
@ -878,6 +879,11 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||||
* @param string $column_name The current column name.
|
* @param string $column_name The current column name.
|
||||||
*/
|
*/
|
||||||
public function column_default( $item, $column_name ) {
|
public function column_default( $item, $column_name ) {
|
||||||
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
|
$theme = $item;
|
||||||
|
|
||||||
|
$stylesheet = $theme->get_stylesheet();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fires inside each custom column of the Multisite themes list table.
|
* Fires inside each custom column of the Multisite themes list table.
|
||||||
*
|
*
|
||||||
|
@ -887,12 +893,7 @@ class WP_MS_Themes_List_Table extends WP_List_Table {
|
||||||
* @param string $stylesheet Directory name of the theme.
|
* @param string $stylesheet Directory name of the theme.
|
||||||
* @param WP_Theme $theme Current WP_Theme object.
|
* @param WP_Theme $theme Current WP_Theme object.
|
||||||
*/
|
*/
|
||||||
do_action(
|
do_action( 'manage_themes_custom_column', $column_name, $stylesheet, $theme );
|
||||||
'manage_themes_custom_column',
|
|
||||||
$column_name,
|
|
||||||
$item->get_stylesheet(), // Directory name of the theme.
|
|
||||||
$item // Theme object.
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -458,13 +458,11 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
||||||
* @param string $column_name The current column name.
|
* @param string $column_name The current column name.
|
||||||
*/
|
*/
|
||||||
public function column_default( $item, $column_name ) {
|
public function column_default( $item, $column_name ) {
|
||||||
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
|
$user = $item;
|
||||||
|
|
||||||
/** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
|
/** This filter is documented in wp-admin/includes/class-wp-users-list-table.php */
|
||||||
echo apply_filters(
|
echo apply_filters( 'manage_users_custom_column', '', $column_name, $user->ID );
|
||||||
'manage_users_custom_column',
|
|
||||||
'', // Custom column output. Default empty.
|
|
||||||
$column_name,
|
|
||||||
$item->ID // User ID.
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function display_rows() {
|
public function display_rows() {
|
||||||
|
@ -519,10 +517,10 @@ class WP_MS_Users_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$user = $item;
|
$user = $item;
|
||||||
$super_admins = get_super_admins();
|
|
||||||
|
|
||||||
$actions = array();
|
$super_admins = get_super_admins();
|
||||||
|
$actions = array();
|
||||||
|
|
||||||
if ( current_user_can( 'edit_user', $user->ID ) ) {
|
if ( current_user_can( 'edit_user', $user->ID ) ) {
|
||||||
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
|
$edit_link = esc_url( add_query_arg( 'wp_http_referer', urlencode( wp_unslash( $_SERVER['REQUEST_URI'] ) ), get_edit_user_link( $user->ID ) ) );
|
||||||
|
|
|
@ -1019,6 +1019,7 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
public function column_cb( $item ) {
|
public function column_cb( $item ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$post = $item;
|
$post = $item;
|
||||||
|
|
||||||
$show = current_user_can( 'edit_post', $post->ID );
|
$show = current_user_can( 'edit_post', $post->ID );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -1458,7 +1459,8 @@ class WP_Posts_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$post = $item;
|
$post = $item;
|
||||||
|
|
||||||
$post_type_object = get_post_type_object( $post->post_type );
|
$post_type_object = get_post_type_object( $post->post_type );
|
||||||
$can_edit_post = current_user_can( 'edit_post', $post->ID );
|
$can_edit_post = current_user_can( 'edit_post', $post->ID );
|
||||||
$actions = array();
|
$actions = array();
|
||||||
|
|
|
@ -464,7 +464,8 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$tag = $item;
|
$tag = $item;
|
||||||
|
|
||||||
$taxonomy = $this->screen->taxonomy;
|
$taxonomy = $this->screen->taxonomy;
|
||||||
$uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
|
$uri = wp_doing_ajax() ? wp_get_referer() : $_SERVER['REQUEST_URI'];
|
||||||
|
|
||||||
|
@ -626,6 +627,9 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function column_default( $item, $column_name ) {
|
public function column_default( $item, $column_name ) {
|
||||||
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
|
$tag = $item;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Filters the displayed columns in the terms list table.
|
* Filters the displayed columns in the terms list table.
|
||||||
*
|
*
|
||||||
|
@ -643,7 +647,7 @@ class WP_Terms_List_Table extends WP_List_Table {
|
||||||
* @param string $column_name Name of the column.
|
* @param string $column_name Name of the column.
|
||||||
* @param int $term_id Term ID.
|
* @param int $term_id Term ID.
|
||||||
*/
|
*/
|
||||||
return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $item->term_id );
|
return apply_filters( "manage_{$this->screen->taxonomy}_custom_column", '', $column_name, $tag->term_id );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -59,7 +59,8 @@ class Walker_CategoryDropdown extends Walker {
|
||||||
public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$category = $data_object;
|
$category = $data_object;
|
||||||
$pad = str_repeat( ' ', $depth * 3 );
|
|
||||||
|
$pad = str_repeat( ' ', $depth * 3 );
|
||||||
|
|
||||||
/** This filter is documented in wp-includes/category-template.php */
|
/** This filter is documented in wp-includes/category-template.php */
|
||||||
$cat_name = apply_filters( 'list_cats', $category->name, $category );
|
$cat_name = apply_filters( 'list_cats', $category->name, $category );
|
||||||
|
|
|
@ -62,7 +62,8 @@ class Walker_PageDropdown extends Walker {
|
||||||
public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$page = $data_object;
|
$page = $data_object;
|
||||||
$pad = str_repeat( ' ', $depth * 3 );
|
|
||||||
|
$pad = str_repeat( ' ', $depth * 3 );
|
||||||
|
|
||||||
if ( ! isset( $args['value_field'] ) || ! isset( $page->{$args['value_field']} ) ) {
|
if ( ! isset( $args['value_field'] ) || ! isset( $page->{$args['value_field']} ) ) {
|
||||||
$args['value_field'] = 'ID';
|
$args['value_field'] = 'ID';
|
||||||
|
|
|
@ -104,7 +104,8 @@ class Walker_Page extends Walker {
|
||||||
*/
|
*/
|
||||||
public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
public function start_el( &$output, $data_object, $depth = 0, $args = array(), $current_object_id = 0 ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$page = $data_object;
|
$page = $data_object;
|
||||||
|
|
||||||
$current_page_id = $current_object_id;
|
$current_page_id = $current_object_id;
|
||||||
|
|
||||||
if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
|
if ( isset( $args['item_spacing'] ) && 'preserve' === $args['item_spacing'] ) {
|
||||||
|
|
|
@ -731,7 +731,8 @@ class WP_REST_Attachments_Controller extends WP_REST_Posts_Controller {
|
||||||
*/
|
*/
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$post = $item;
|
$post = $item;
|
||||||
|
|
||||||
$response = parent::prepare_item_for_response( $post, $request );
|
$response = parent::prepare_item_for_response( $post, $request );
|
||||||
$fields = $this->get_fields_for_response( $request );
|
$fields = $this->get_fields_for_response( $request );
|
||||||
$data = $response->get_data();
|
$data = $response->get_data();
|
||||||
|
|
|
@ -409,10 +409,10 @@ class WP_REST_Autosaves_Controller extends WP_REST_Revisions_Controller {
|
||||||
*/
|
*/
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$post = $item;
|
$post = $item;
|
||||||
$response = $this->revisions_controller->prepare_item_for_response( $post, $request );
|
|
||||||
|
|
||||||
$fields = $this->get_fields_for_response( $request );
|
$response = $this->revisions_controller->prepare_item_for_response( $post, $request );
|
||||||
|
$fields = $this->get_fields_for_response( $request );
|
||||||
|
|
||||||
if ( in_array( 'preview_link', $fields, true ) ) {
|
if ( in_array( 'preview_link', $fields, true ) ) {
|
||||||
$parent_id = wp_is_post_autosave( $post );
|
$parent_id = wp_is_post_autosave( $post );
|
||||||
|
|
|
@ -246,8 +246,9 @@ class WP_REST_Block_Types_Controller extends WP_REST_Controller {
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$block_type = $item;
|
$block_type = $item;
|
||||||
$fields = $this->get_fields_for_response( $request );
|
|
||||||
$data = array();
|
$fields = $this->get_fields_for_response( $request );
|
||||||
|
$data = array();
|
||||||
|
|
||||||
if ( rest_is_field_included( 'attributes', $fields ) ) {
|
if ( rest_is_field_included( 'attributes', $fields ) ) {
|
||||||
$data['attributes'] = $block_type->get_attributes();
|
$data['attributes'] = $block_type->get_attributes();
|
||||||
|
|
|
@ -1039,8 +1039,9 @@ class WP_REST_Comments_Controller extends WP_REST_Controller {
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$comment = $item;
|
$comment = $item;
|
||||||
$fields = $this->get_fields_for_response( $request );
|
|
||||||
$data = array();
|
$fields = $this->get_fields_for_response( $request );
|
||||||
|
$data = array();
|
||||||
|
|
||||||
if ( in_array( 'id', $fields, true ) ) {
|
if ( in_array( 'id', $fields, true ) ) {
|
||||||
$data['id'] = (int) $comment->comment_ID;
|
$data['id'] = (int) $comment->comment_ID;
|
||||||
|
|
|
@ -367,8 +367,8 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Base fields for every post.
|
// Base fields for every post.
|
||||||
$data = array();
|
|
||||||
$fields = $this->get_fields_for_response( $request );
|
$fields = $this->get_fields_for_response( $request );
|
||||||
|
$data = array();
|
||||||
|
|
||||||
if ( rest_is_field_included( 'id', $fields ) ) {
|
if ( rest_is_field_included( 'id', $fields ) ) {
|
||||||
$data['id'] = $post->ID;
|
$data['id'] = $post->ID;
|
||||||
|
@ -603,8 +603,8 @@ class WP_REST_Global_Styles_Controller extends WP_REST_Controller {
|
||||||
}
|
}
|
||||||
|
|
||||||
$theme = WP_Theme_JSON_Resolver::get_merged_data( 'theme' );
|
$theme = WP_Theme_JSON_Resolver::get_merged_data( 'theme' );
|
||||||
$data = array();
|
|
||||||
$fields = $this->get_fields_for_response( $request );
|
$fields = $this->get_fields_for_response( $request );
|
||||||
|
$data = array();
|
||||||
|
|
||||||
if ( rest_is_field_included( 'settings', $fields ) ) {
|
if ( rest_is_field_included( 'settings', $fields ) ) {
|
||||||
$data['settings'] = $theme->get_settings();
|
$data['settings'] = $theme->get_settings();
|
||||||
|
|
|
@ -168,7 +168,8 @@ class WP_REST_Menu_Locations_Controller extends WP_REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$location = $item;
|
$location = $item;
|
||||||
|
|
||||||
$locations = get_nav_menu_locations();
|
$locations = get_nav_menu_locations();
|
||||||
$menu = isset( $locations[ $location->name ] ) ? $locations[ $location->name ] : 0;
|
$menu = isset( $locations[ $location->name ] ) ? $locations[ $location->name ] : 0;
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,8 @@ class WP_REST_Pattern_Directory_Controller extends WP_REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$raw_pattern = $item;
|
$raw_pattern = $item;
|
||||||
|
|
||||||
$prepared_pattern = array(
|
$prepared_pattern = array(
|
||||||
'id' => absint( $raw_pattern->id ),
|
'id' => absint( $raw_pattern->id ),
|
||||||
'title' => sanitize_text_field( $raw_pattern->title->rendered ),
|
'title' => sanitize_text_field( $raw_pattern->title->rendered ),
|
||||||
|
|
|
@ -222,6 +222,7 @@ class WP_REST_Post_Statuses_Controller extends WP_REST_Controller {
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$status = $item;
|
$status = $item;
|
||||||
|
|
||||||
$fields = $this->get_fields_for_response( $request );
|
$fields = $this->get_fields_for_response( $request );
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,8 @@ class WP_REST_Post_Types_Controller extends WP_REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$post_type = $item;
|
$post_type = $item;
|
||||||
|
|
||||||
$taxonomies = wp_list_filter( get_object_taxonomies( $post_type->name, 'objects' ), array( 'show_in_rest' => true ) );
|
$taxonomies = wp_list_filter( get_object_taxonomies( $post_type->name, 'objects' ), array( 'show_in_rest' => true ) );
|
||||||
$taxonomies = wp_list_pluck( $taxonomies, 'name' );
|
$taxonomies = wp_list_pluck( $taxonomies, 'name' );
|
||||||
$base = ! empty( $post_type->rest_base ) ? $post_type->rest_base : $post_type->name;
|
$base = ! empty( $post_type->rest_base ) ? $post_type->rest_base : $post_type->name;
|
||||||
|
|
|
@ -1748,7 +1748,8 @@ class WP_REST_Posts_Controller extends WP_REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$post = $item;
|
$post = $item;
|
||||||
|
|
||||||
$GLOBALS['post'] = $post;
|
$GLOBALS['post'] = $post;
|
||||||
|
|
||||||
setup_postdata( $post );
|
setup_postdata( $post );
|
||||||
|
|
|
@ -547,7 +547,8 @@ class WP_REST_Revisions_Controller extends WP_REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$post = $item;
|
$post = $item;
|
||||||
|
|
||||||
$GLOBALS['post'] = $post;
|
$GLOBALS['post'] = $post;
|
||||||
|
|
||||||
setup_postdata( $post );
|
setup_postdata( $post );
|
||||||
|
|
|
@ -195,6 +195,7 @@ class WP_REST_Search_Controller extends WP_REST_Controller {
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$item_id = $item;
|
$item_id = $item;
|
||||||
|
|
||||||
$handler = $this->get_search_handler( $request );
|
$handler = $this->get_search_handler( $request );
|
||||||
if ( is_wp_error( $handler ) ) {
|
if ( is_wp_error( $handler ) ) {
|
||||||
return new WP_REST_Response();
|
return new WP_REST_Response();
|
||||||
|
|
|
@ -320,8 +320,9 @@ class WP_REST_Sidebars_Controller extends WP_REST_Controller {
|
||||||
|
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$raw_sidebar = $item;
|
$raw_sidebar = $item;
|
||||||
$id = $raw_sidebar['id'];
|
|
||||||
$sidebar = array( 'id' => $id );
|
$id = $raw_sidebar['id'];
|
||||||
|
$sidebar = array( 'id' => $id );
|
||||||
|
|
||||||
if ( isset( $wp_registered_sidebars[ $id ] ) ) {
|
if ( isset( $wp_registered_sidebars[ $id ] ) ) {
|
||||||
$registered_sidebar = $wp_registered_sidebars[ $id ];
|
$registered_sidebar = $wp_registered_sidebars[ $id ];
|
||||||
|
|
|
@ -209,7 +209,8 @@ class WP_REST_Taxonomies_Controller extends WP_REST_Controller {
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$taxonomy = $item;
|
$taxonomy = $item;
|
||||||
$base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
|
|
||||||
|
$base = ! empty( $taxonomy->rest_base ) ? $taxonomy->rest_base : $taxonomy->name;
|
||||||
|
|
||||||
$fields = $this->get_fields_for_response( $request );
|
$fields = $this->get_fields_for_response( $request );
|
||||||
$data = array();
|
$data = array();
|
||||||
|
|
|
@ -231,9 +231,10 @@ class WP_REST_Themes_Controller extends WP_REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$theme = $item;
|
$theme = $item;
|
||||||
$data = array();
|
|
||||||
$fields = $this->get_fields_for_response( $request );
|
$fields = $this->get_fields_for_response( $request );
|
||||||
|
$data = array();
|
||||||
|
|
||||||
if ( rest_is_field_included( 'stylesheet', $fields ) ) {
|
if ( rest_is_field_included( 'stylesheet', $fields ) ) {
|
||||||
$data['stylesheet'] = $theme->get_stylesheet();
|
$data['stylesheet'] = $theme->get_stylesheet();
|
||||||
|
|
|
@ -984,9 +984,10 @@ class WP_REST_Users_Controller extends WP_REST_Controller {
|
||||||
*/
|
*/
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$user = $item;
|
$user = $item;
|
||||||
$data = array();
|
|
||||||
$fields = $this->get_fields_for_response( $request );
|
$fields = $this->get_fields_for_response( $request );
|
||||||
|
$data = array();
|
||||||
|
|
||||||
if ( in_array( 'id', $fields, true ) ) {
|
if ( in_array( 'id', $fields, true ) ) {
|
||||||
$data['id'] = $user->ID;
|
$data['id'] = $user->ID;
|
||||||
|
|
|
@ -297,8 +297,9 @@ class WP_REST_Widget_Types_Controller extends WP_REST_Controller {
|
||||||
public function prepare_item_for_response( $item, $request ) {
|
public function prepare_item_for_response( $item, $request ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$widget_type = $item;
|
$widget_type = $item;
|
||||||
$fields = $this->get_fields_for_response( $request );
|
|
||||||
$data = array(
|
$fields = $this->get_fields_for_response( $request );
|
||||||
|
$data = array(
|
||||||
'id' => $widget_type['id'],
|
'id' => $widget_type['id'],
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,8 @@ class WP_Sitemaps_Taxonomies extends WP_Sitemaps_Provider {
|
||||||
*/
|
*/
|
||||||
public function get_url_list( $page_num, $object_subtype = '' ) {
|
public function get_url_list( $page_num, $object_subtype = '' ) {
|
||||||
// Restores the more descriptive, specific name for use within this method.
|
// Restores the more descriptive, specific name for use within this method.
|
||||||
$taxonomy = $object_subtype;
|
$taxonomy = $object_subtype;
|
||||||
|
|
||||||
$supported_types = $this->get_object_subtypes();
|
$supported_types = $this->get_object_subtypes();
|
||||||
|
|
||||||
// Bail early if the queried taxonomy is not supported.
|
// Bail early if the queried taxonomy is not supported.
|
||||||
|
|
|
@ -16,7 +16,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '6.4-alpha-56585';
|
$wp_version = '6.4-alpha-56586';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue