Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/wp-admin/includes/class-theme-installer-skin.php
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ private function do_overwrite() {

$is_invalid_parent = false;
if ( ! empty( $new_theme_data['Template'] ) ) {
$is_invalid_parent = ! in_array( $new_theme_data['Template'], array_keys( $all_themes ), true );
$is_invalid_parent = ! isset( $all_themes[ $new_theme_data['Template'] ] );
}

$rows = array(
Expand Down
8 changes: 5 additions & 3 deletions src/wp-admin/includes/dashboard.php
Original file line number Diff line number Diff line change
Expand Up @@ -568,11 +568,13 @@ function wp_dashboard_quick_press( $message = false, $notice_type = 'error' ) {
$post->post_title = ''; // Remove the auto draft title.
}
} else {
$post = get_default_post_to_edit( 'post', true );
$user_id = get_current_user_id();
$post = get_default_post_to_edit( 'post', true );
$user_id = get_current_user_id();
$user_blogs = get_blogs_of_user( $user_id );
$current_blog_id = get_current_blog_id();

// Don't create an option if this is a super admin who does not belong to this site.
if ( in_array( get_current_blog_id(), array_keys( get_blogs_of_user( $user_id ) ), true ) ) {
if ( isset( $user_blogs[ $current_blog_id ] ) ) {
update_user_option( $user_id, 'dashboard_quick_press_last_post_id', (int) $post->ID ); // Save post_ID.
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/wp-admin/nav-menus.php
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@

// If this menu item is a child of the previous.
if ( ! empty( $menu_item_data['menu_item_parent'] )
&& in_array( (int) $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ), true )
&& isset( $dbids_to_orders[ (int) $menu_item_data['menu_item_parent'] ] )
&& isset( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] )
&& ( (int) $menu_item_data['menu_item_parent'] === $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] )
) {
Expand Down Expand Up @@ -230,7 +230,7 @@
) {
$_possible_parent_id = (int) get_post_meta( $orders_to_dbids[ $dbids_to_orders[ $parent_db_id ] - 1 ], '_menu_item_menu_item_parent', true );

if ( in_array( $_possible_parent_id, array_keys( $dbids_to_orders ), true ) ) {
if ( isset( $dbids_to_orders[ $_possible_parent_id ] ) ) {
$menu_item_data['menu_item_parent'] = $_possible_parent_id;
} else {
$menu_item_data['menu_item_parent'] = 0;
Expand All @@ -256,7 +256,7 @@
// Else this menu item is not a child of the previous.
} elseif ( empty( $menu_item_data['menu_order'] )
|| empty( $menu_item_data['menu_item_parent'] )
|| ! in_array( (int) $menu_item_data['menu_item_parent'], array_keys( $dbids_to_orders ), true )
|| ! isset( $dbids_to_orders[ (int) $menu_item_data['menu_item_parent'] ] )
|| empty( $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] )
|| $orders_to_dbids[ $dbids_to_orders[ $menu_item_id ] - 1 ] !== (int) $menu_item_data['menu_item_parent']
) {
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/block-editor.php
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ function get_default_block_editor_settings() {
}

$default_size = get_option( 'image_default_size', 'large' );
$image_default_size = in_array( $default_size, array_keys( $image_size_names ), true ) ? $default_size : 'large';
$image_default_size = isset( $image_size_names[ $default_size ] ) ? $default_size : 'large';

$image_dimensions = array();
$all_sizes = wp_get_registered_image_subsizes();
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/link-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -3993,7 +3993,7 @@ function get_dashboard_url( $user_id = 0, $path = '', $scheme = 'admin' ) {
} else {
$current_blog = get_current_blog_id();

if ( $current_blog && ( user_can( $user_id, 'manage_network' ) || in_array( $current_blog, array_keys( $blogs ), true ) ) ) {
if ( $current_blog && ( user_can( $user_id, 'manage_network' ) || isset( $blogs[ $current_blog ] ) ) ) {
$url = admin_url( $path, $scheme );
} else {
$active = get_active_blog_for_user( $user_id );
Expand Down
2 changes: 1 addition & 1 deletion src/wp-includes/media.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ function image_constrain_size_for_editor( $width, $height, $size = 'medium', $co
if ( (int) $content_width > 0 ) {
$max_width = min( (int) $content_width, $max_width );
}
} elseif ( ! empty( $_wp_additional_image_sizes ) && in_array( $size, array_keys( $_wp_additional_image_sizes ), true ) ) {
} elseif ( isset( $_wp_additional_image_sizes[ $size ] ) ) {
$max_width = (int) $_wp_additional_image_sizes[ $size ]['width'];
$max_height = (int) $_wp_additional_image_sizes[ $size ]['height'];
// Only in admin. Assume that theme authors know what they're doing.
Expand Down
8 changes: 6 additions & 2 deletions src/wp-includes/sitemaps.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,12 @@ function get_sitemap_url( $name, $subtype_name = '', $page = 1 ) {
return false;
}

if ( $subtype_name && ! in_array( $subtype_name, array_keys( $provider->get_object_subtypes() ), true ) ) {
return false;
if ( $subtype_name ) {
$object_subtypes = $provider->get_object_subtypes();

if ( ! isset( $object_subtypes[ $subtype_name ] ) ) {
return false;
}
}

$page = absint( $page );
Expand Down
Loading