diff -r 7b1b88e27a20 -r 48c4eec2b7e6 wp/wp-admin/edit.php --- a/wp/wp-admin/edit.php Thu Sep 29 08:06:27 2022 +0200 +++ b/wp/wp-admin/edit.php Fri Sep 05 18:40:08 2025 +0200 @@ -9,6 +9,11 @@ /** WordPress Administration Bootstrap */ require_once __DIR__ . '/admin.php'; +/** + * @global string $typenow The post type of the current screen. + */ +global $typenow; + if ( ! $typenow ) { wp_die( __( 'Invalid post type.' ) ); } @@ -24,8 +29,8 @@ } /** - * @global string $post_type - * @global WP_Post_Type $post_type_object + * @global string $post_type Global post type. + * @global WP_Post_Type $post_type_object Global post type object. */ global $post_type, $post_type_object; @@ -76,7 +81,7 @@ $sendback = admin_url( $parent_file ); } $sendback = add_query_arg( 'paged', $pagenum, $sendback ); - if ( strpos( $sendback, 'post.php' ) !== false ) { + if ( str_contains( $sendback, 'post.php' ) ) { $sendback = admin_url( $post_new_file ); } @@ -87,6 +92,11 @@ $post_status = preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['post_status'] ); // Validate the post status exists. if ( get_post_status_object( $post_status ) ) { + /** + * @global wpdb $wpdb WordPress database abstraction object. + */ + global $wpdb; + $post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) ); } $doaction = 'delete'; @@ -114,7 +124,7 @@ } if ( wp_check_post_lock( $post_id ) ) { - $locked++; + ++$locked; continue; } @@ -122,7 +132,7 @@ wp_die( __( 'Error in moving the item to Trash.' ) ); } - $trashed++; + ++$trashed; } $sendback = add_query_arg( @@ -150,7 +160,7 @@ wp_die( __( 'Error in restoring the item from Trash.' ) ); } - $untrashed++; + ++$untrashed; } $sendback = add_query_arg( 'untrashed', $untrashed, $sendback ); @@ -175,7 +185,7 @@ wp_die( __( 'Error in deleting the item.' ) ); } } - $deleted++; + ++$deleted; } $sendback = add_query_arg( 'deleted', $deleted, $sendback ); break; @@ -278,14 +288,18 @@ 'title' => __( 'Bulk actions' ), 'content' => '

' . __( 'You can also edit or move multiple posts to the Trash at once. Select the posts you want to act on using the checkboxes, then select the action you want to take from the Bulk actions menu and click Apply.' ) . '

' . - '

' . __( 'When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the x next to its name in the Bulk Edit area that appears.' ) . '

', + '

' . sprintf( + /* translators: %s: The dismiss dashicon used for buttons that dismiss or remove. */ + __( 'When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected posts at once. To remove a post from the grouping, just click the %sremove button next to its name in the Bulk Edit area that appears.' ), + '' + ) . '

', ) ); get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . - '

' . __( 'Documentation on Managing Posts' ) . '

' . - '

' . __( 'Support' ) . '

' + '

' . __( 'Documentation on Managing Posts' ) . '

' . + '

' . __( 'Support forums' ) . '

' ); } elseif ( 'page' === $post_type ) { @@ -309,8 +323,8 @@ get_current_screen()->set_help_sidebar( '

' . __( 'For more information:' ) . '

' . - '

' . __( 'Documentation on Managing Pages' ) . '

' . - '

' . __( 'Support' ) . '

' + '

' . __( 'Documentation on Managing Pages' ) . '

' . + '

' . __( 'Support forums' ) . '

' ); } @@ -367,17 +381,17 @@ 'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ), ); $bulk_messages['wp_block'] = array( - /* translators: %s: Number of blocks. */ - 'updated' => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'] ), - 'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) : - /* translators: %s: Number of blocks. */ - _n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'] ), - /* translators: %s: Number of blocks. */ - 'deleted' => _n( '%s block permanently deleted.', '%s blocks permanently deleted.', $bulk_counts['deleted'] ), - /* translators: %s: Number of blocks. */ - 'trashed' => _n( '%s block moved to the Trash.', '%s blocks moved to the Trash.', $bulk_counts['trashed'] ), - /* translators: %s: Number of blocks. */ - 'untrashed' => _n( '%s block restored from the Trash.', '%s blocks restored from the Trash.', $bulk_counts['untrashed'] ), + /* translators: %s: Number of patterns. */ + 'updated' => _n( '%s pattern updated.', '%s patterns updated.', $bulk_counts['updated'] ), + 'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 pattern not updated, somebody is editing it.' ) : + /* translators: %s: Number of patterns. */ + _n( '%s pattern not updated, somebody is editing it.', '%s patterns not updated, somebody is editing them.', $bulk_counts['locked'] ), + /* translators: %s: Number of patterns. */ + 'deleted' => _n( '%s pattern permanently deleted.', '%s patterns permanently deleted.', $bulk_counts['deleted'] ), + /* translators: %s: Number of patterns. */ + 'trashed' => _n( '%s pattern moved to the Trash.', '%s patterns moved to the Trash.', $bulk_counts['trashed'] ), + /* translators: %s: Number of patterns. */ + 'untrashed' => _n( '%s pattern restored from the Trash.', '%s patterns restored from the Trash.', $bulk_counts['untrashed'] ), ); /** @@ -432,8 +446,13 @@ } if ( 'trashed' === $message && isset( $_REQUEST['ids'] ) ) { - $ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] ); - $messages[] = '' . __( 'Undo' ) . ''; + $ids = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] ); + + $messages[] = sprintf( + '%2$s', + esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", 'bulk-posts' ) ), + __( 'Undo' ) + ); } if ( 'untrashed' === $message && isset( $_REQUEST['ids'] ) ) { @@ -450,7 +469,14 @@ } if ( $messages ) { - echo '

' . implode( ' ', $messages ) . '

'; + wp_admin_notice( + implode( ' ', $messages ), + array( + 'id' => 'message', + 'additional_classes' => array( 'updated' ), + 'dismissible' => true, + ) + ); } unset( $messages ); @@ -464,7 +490,7 @@ search_box( $post_type_object->labels->search_items, 'post' ); ?> - +