wp/wp-admin/edit.php
changeset 16 a86126ab1dd4
parent 9 177826044cd9
child 18 be944660c56a
equal deleted inserted replaced
15:3d4e9c994f10 16:a86126ab1dd4
     5  * @package WordPress
     5  * @package WordPress
     6  * @subpackage Administration
     6  * @subpackage Administration
     7  */
     7  */
     8 
     8 
     9 /** WordPress Administration Bootstrap */
     9 /** WordPress Administration Bootstrap */
    10 require_once( dirname( __FILE__ ) . '/admin.php' );
    10 require_once __DIR__ . '/admin.php';
    11 
    11 
    12 if ( ! $typenow ) {
    12 if ( ! $typenow ) {
    13 	wp_die( __( 'Invalid post type.' ) );
    13 	wp_die( __( 'Invalid post type.' ) );
    14 }
    14 }
    15 
    15 
    16 if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
    16 if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ), true ) ) {
    17 	wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
    17 	wp_die( __( 'Sorry, you are not allowed to edit posts in this post type.' ) );
    18 }
    18 }
    19 
    19 
    20 if ( 'attachment' === $typenow ) {
    20 if ( 'attachment' === $typenow ) {
    21 	if ( wp_redirect( admin_url( 'upload.php' ) ) ) {
    21 	if ( wp_redirect( admin_url( 'upload.php' ) ) ) {
    45 }
    45 }
    46 
    46 
    47 $wp_list_table = _get_list_table( 'WP_Posts_List_Table' );
    47 $wp_list_table = _get_list_table( 'WP_Posts_List_Table' );
    48 $pagenum       = $wp_list_table->get_pagenum();
    48 $pagenum       = $wp_list_table->get_pagenum();
    49 
    49 
    50 // Back-compat for viewing comments of an entry
    50 // Back-compat for viewing comments of an entry.
    51 foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
    51 foreach ( array( 'p', 'attachment_id', 'page_id' ) as $_redirect ) {
    52 	if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
    52 	if ( ! empty( $_REQUEST[ $_redirect ] ) ) {
    53 		wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
    53 		wp_redirect( admin_url( 'edit-comments.php?p=' . absint( $_REQUEST[ $_redirect ] ) ) );
    54 		exit;
    54 		exit;
    55 	}
    55 	}
    56 }
    56 }
    57 unset( $_redirect );
    57 unset( $_redirect );
    58 
    58 
    59 if ( 'post' != $post_type ) {
    59 if ( 'post' !== $post_type ) {
    60 	$parent_file   = "edit.php?post_type=$post_type";
    60 	$parent_file   = "edit.php?post_type=$post_type";
    61 	$submenu_file  = "edit.php?post_type=$post_type";
    61 	$submenu_file  = "edit.php?post_type=$post_type";
    62 	$post_new_file = "post-new.php?post_type=$post_type";
    62 	$post_new_file = "post-new.php?post_type=$post_type";
    63 } else {
    63 } else {
    64 	$parent_file   = 'edit.php';
    64 	$parent_file   = 'edit.php';
    78 	$sendback = add_query_arg( 'paged', $pagenum, $sendback );
    78 	$sendback = add_query_arg( 'paged', $pagenum, $sendback );
    79 	if ( strpos( $sendback, 'post.php' ) !== false ) {
    79 	if ( strpos( $sendback, 'post.php' ) !== false ) {
    80 		$sendback = admin_url( $post_new_file );
    80 		$sendback = admin_url( $post_new_file );
    81 	}
    81 	}
    82 
    82 
    83 	if ( 'delete_all' == $doaction ) {
    83 	if ( 'delete_all' === $doaction ) {
    84 		// Prepare for deletion of all posts with a specified post status (i.e. Empty trash).
    84 		// Prepare for deletion of all posts with a specified post status (i.e. Empty Trash).
    85 		$post_status = preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['post_status'] );
    85 		$post_status = preg_replace( '/[^a-z0-9_-]+/i', '', $_REQUEST['post_status'] );
    86 		// Validate the post status exists.
    86 		// Validate the post status exists.
    87 		if ( get_post_status_object( $post_status ) ) {
    87 		if ( get_post_status_object( $post_status ) ) {
    88 			$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
    88 			$post_ids = $wpdb->get_col( $wpdb->prepare( "SELECT ID FROM $wpdb->posts WHERE post_type=%s AND post_status = %s", $post_type, $post_status ) );
    89 		}
    89 		}
   101 		exit;
   101 		exit;
   102 	}
   102 	}
   103 
   103 
   104 	switch ( $doaction ) {
   104 	switch ( $doaction ) {
   105 		case 'trash':
   105 		case 'trash':
   106 			$trashed = $locked = 0;
   106 			$trashed = 0;
       
   107 			$locked  = 0;
   107 
   108 
   108 			foreach ( (array) $post_ids as $post_id ) {
   109 			foreach ( (array) $post_ids as $post_id ) {
   109 				if ( ! current_user_can( 'delete_post', $post_id ) ) {
   110 				if ( ! current_user_can( 'delete_post', $post_id ) ) {
   110 					wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
   111 					wp_die( __( 'Sorry, you are not allowed to move this item to the Trash.' ) );
   111 				}
   112 				}
   114 					$locked++;
   115 					$locked++;
   115 					continue;
   116 					continue;
   116 				}
   117 				}
   117 
   118 
   118 				if ( ! wp_trash_post( $post_id ) ) {
   119 				if ( ! wp_trash_post( $post_id ) ) {
   119 					wp_die( __( 'Error in moving to Trash.' ) );
   120 					wp_die( __( 'Error in moving the item to Trash.' ) );
   120 				}
   121 				}
   121 
   122 
   122 				$trashed++;
   123 				$trashed++;
   123 			}
   124 			}
   124 
   125 
   137 				if ( ! current_user_can( 'delete_post', $post_id ) ) {
   138 				if ( ! current_user_can( 'delete_post', $post_id ) ) {
   138 					wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
   139 					wp_die( __( 'Sorry, you are not allowed to restore this item from the Trash.' ) );
   139 				}
   140 				}
   140 
   141 
   141 				if ( ! wp_untrash_post( $post_id ) ) {
   142 				if ( ! wp_untrash_post( $post_id ) ) {
   142 					wp_die( __( 'Error in restoring from Trash.' ) );
   143 					wp_die( __( 'Error in restoring the item from Trash.' ) );
   143 				}
   144 				}
   144 
   145 
   145 				$untrashed++;
   146 				$untrashed++;
   146 			}
   147 			}
   147 			$sendback = add_query_arg( 'untrashed', $untrashed, $sendback );
   148 			$sendback = add_query_arg( 'untrashed', $untrashed, $sendback );
   153 
   154 
   154 				if ( ! current_user_can( 'delete_post', $post_id ) ) {
   155 				if ( ! current_user_can( 'delete_post', $post_id ) ) {
   155 					wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
   156 					wp_die( __( 'Sorry, you are not allowed to delete this item.' ) );
   156 				}
   157 				}
   157 
   158 
   158 				if ( $post_del->post_type == 'attachment' ) {
   159 				if ( 'attachment' === $post_del->post_type ) {
   159 					if ( ! wp_delete_attachment( $post_id ) ) {
   160 					if ( ! wp_delete_attachment( $post_id ) ) {
   160 						wp_die( __( 'Error in deleting.' ) );
   161 						wp_die( __( 'Error in deleting the attachment.' ) );
   161 					}
   162 					}
   162 				} else {
   163 				} else {
   163 					if ( ! wp_delete_post( $post_id ) ) {
   164 					if ( ! wp_delete_post( $post_id ) ) {
   164 						wp_die( __( 'Error in deleting.' ) );
   165 						wp_die( __( 'Error in deleting the item.' ) );
   165 					}
   166 					}
   166 				}
   167 				}
   167 				$deleted++;
   168 				$deleted++;
   168 			}
   169 			}
   169 			$sendback = add_query_arg( 'deleted', $deleted, $sendback );
   170 			$sendback = add_query_arg( 'deleted', $deleted, $sendback );
   179 					$sendback        = add_query_arg( $done, $sendback );
   180 					$sendback        = add_query_arg( $done, $sendback );
   180 				}
   181 				}
   181 			}
   182 			}
   182 			break;
   183 			break;
   183 		default:
   184 		default:
   184 			/** This action is documented in wp-admin/edit-comments.php */
   185 			$screen = get_current_screen()->id;
   185 			$sendback = apply_filters( 'handle_bulk_actions-' . get_current_screen()->id, $sendback, $doaction, $post_ids );
   186 
       
   187 			/**
       
   188 			 * Fires when a custom bulk action should be handled.
       
   189 			 *
       
   190 			 * The redirect link should be modified with success or failure feedback
       
   191 			 * from the action to be used to display feedback to the user.
       
   192 			 *
       
   193 			 * The dynamic portion of the hook name, `$screen`, refers to the current screen ID.
       
   194 			 *
       
   195 			 * @since 4.7.0
       
   196 			 *
       
   197 			 * @param string $sendback The redirect URL.
       
   198 			 * @param string $doaction The action being taken.
       
   199 			 * @param array  $items    The items to take the action on. Accepts an array of IDs of posts,
       
   200 			 *                         comments, terms, links, plugins, attachments, or users.
       
   201 			 */
       
   202 			$sendback = apply_filters( "handle_bulk_actions-{$screen}", $sendback, $doaction, $post_ids ); // phpcs:ignore WordPress.NamingConventions.ValidHookName.UseUnderscores
   186 			break;
   203 			break;
   187 	}
   204 	}
   188 
   205 
   189 	$sendback = remove_query_arg( array( 'action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view' ), $sendback );
   206 	$sendback = remove_query_arg( array( 'action', 'action2', 'tags_input', 'post_author', 'comment_status', 'ping_status', '_status', 'post', 'bulk_edit', 'post_view' ), $sendback );
   190 
   207 
   191 	wp_redirect( $sendback );
   208 	wp_redirect( $sendback );
   192 	exit();
   209 	exit;
   193 } elseif ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
   210 } elseif ( ! empty( $_REQUEST['_wp_http_referer'] ) ) {
   194 	wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
   211 	wp_redirect( remove_query_arg( array( '_wp_http_referer', '_wpnonce' ), wp_unslash( $_SERVER['REQUEST_URI'] ) ) );
   195 	exit;
   212 	exit;
   196 }
   213 }
   197 
   214 
   205 	wp_enqueue_style( 'wp-list-reusable-blocks' );
   222 	wp_enqueue_style( 'wp-list-reusable-blocks' );
   206 }
   223 }
   207 
   224 
   208 $title = $post_type_object->labels->name;
   225 $title = $post_type_object->labels->name;
   209 
   226 
   210 if ( 'post' == $post_type ) {
   227 if ( 'post' === $post_type ) {
   211 	get_current_screen()->add_help_tab(
   228 	get_current_screen()->add_help_tab(
   212 		array(
   229 		array(
   213 			'id'      => 'overview',
   230 			'id'      => 'overview',
   214 			'title'   => __( 'Overview' ),
   231 			'title'   => __( 'Overview' ),
   215 			'content' =>
   232 			'content' =>
   216 					 '<p>' . __( 'This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.' ) . '</p>',
   233 					'<p>' . __( 'This screen provides access to all of your posts. You can customize the display of this screen to suit your workflow.' ) . '</p>',
   217 		)
   234 		)
   218 	);
   235 	);
   219 	get_current_screen()->add_help_tab(
   236 	get_current_screen()->add_help_tab(
   220 		array(
   237 		array(
   221 			'id'      => 'screen-content',
   238 			'id'      => 'screen-content',
   222 			'title'   => __( 'Screen Content' ),
   239 			'title'   => __( 'Screen Content' ),
   223 			'content' =>
   240 			'content' =>
   224 					 '<p>' . __( 'You can customize the display of this screen&#8217;s contents in a number of ways:' ) . '</p>' .
   241 					'<p>' . __( 'You can customize the display of this screen&#8217;s contents in a number of ways:' ) . '</p>' .
   225 					 '<ul>' .
   242 					'<ul>' .
   226 						 '<li>' . __( 'You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.' ) . '</li>' .
   243 						'<li>' . __( 'You can hide/display columns based on your needs and decide how many posts to list per screen using the Screen Options tab.' ) . '</li>' .
   227 						 '<li>' . __( 'You can filter the list of posts by post status using the text links above the posts list to only show posts with that status. The default view is to show all posts.' ) . '</li>' .
   244 						'<li>' . __( 'You can filter the list of posts by post status using the text links above the posts list to only show posts with that status. The default view is to show all posts.' ) . '</li>' .
   228 						 '<li>' . __( 'You can view posts in a simple title list or with an excerpt using the Screen Options tab.' ) . '</li>' .
   245 						'<li>' . __( 'You can view posts in a simple title list or with an excerpt using the Screen Options tab.' ) . '</li>' .
   229 						 '<li>' . __( 'You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.' ) . '</li>' .
   246 						'<li>' . __( 'You can refine the list to show only posts in a specific category or from a specific month by using the dropdown menus above the posts list. Click the Filter button after making your selection. You also can refine the list by clicking on the post author, category or tag in the posts list.' ) . '</li>' .
   230 					 '</ul>',
   247 					'</ul>',
   231 		)
   248 		)
   232 	);
   249 	);
   233 	get_current_screen()->add_help_tab(
   250 	get_current_screen()->add_help_tab(
   234 		array(
   251 		array(
   235 			'id'      => 'action-links',
   252 			'id'      => 'action-links',
   236 			'title'   => __( 'Available Actions' ),
   253 			'title'   => __( 'Available Actions' ),
   237 			'content' =>
   254 			'content' =>
   238 					 '<p>' . __( 'Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:' ) . '</p>' .
   255 					'<p>' . __( 'Hovering over a row in the posts list will display action links that allow you to manage your post. You can perform the following actions:' ) . '</p>' .
   239 					 '<ul>' .
   256 					'<ul>' .
   240 						 '<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.' ) . '</li>' .
   257 						'<li>' . __( '<strong>Edit</strong> takes you to the editing screen for that post. You can also reach that screen by clicking on the post title.' ) . '</li>' .
   241 						 '<li>' . __( '<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.' ) . '</li>' .
   258 						'<li>' . __( '<strong>Quick Edit</strong> provides inline access to the metadata of your post, allowing you to update post details without leaving this screen.' ) . '</li>' .
   242 						 '<li>' . __( '<strong>Trash</strong> removes your post from this list and places it in the trash, from which you can permanently delete it.' ) . '</li>' .
   259 						'<li>' . __( '<strong>Trash</strong> removes your post from this list and places it in the Trash, from which you can permanently delete it.' ) . '</li>' .
   243 						 '<li>' . __( '<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post&#8217;s status.' ) . '</li>' .
   260 						'<li>' . __( '<strong>Preview</strong> will show you what your draft post will look like if you publish it. View will take you to your live site to view the post. Which link is available depends on your post&#8217;s status.' ) . '</li>' .
   244 					 '</ul>',
   261 					'</ul>',
   245 		)
   262 		)
   246 	);
   263 	);
   247 	get_current_screen()->add_help_tab(
   264 	get_current_screen()->add_help_tab(
   248 		array(
   265 		array(
   249 			'id'      => 'bulk-actions',
   266 			'id'      => 'bulk-actions',
   250 			'title'   => __( 'Bulk Actions' ),
   267 			'title'   => __( 'Bulk actions' ),
   251 			'content' =>
   268 			'content' =>
   252 					 '<p>' . __( '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.' ) . '</p>' .
   269 					'<p>' . __( '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.' ) . '</p>' .
   253 							 '<p>' . __( '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.' ) . '</p>',
   270 							'<p>' . __( '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.' ) . '</p>',
   254 		)
   271 		)
   255 	);
   272 	);
   256 
   273 
   257 	get_current_screen()->set_help_sidebar(
   274 	get_current_screen()->set_help_sidebar(
   258 		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   275 		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   259 		'<p>' . __( '<a href="https://codex.wordpress.org/Posts_Screen">Documentation on Managing Posts</a>' ) . '</p>' .
   276 		'<p>' . __( '<a href="https://wordpress.org/support/article/posts-screen/">Documentation on Managing Posts</a>' ) . '</p>' .
   260 		'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   277 		'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   261 	);
   278 	);
   262 
   279 
   263 } elseif ( 'page' == $post_type ) {
   280 } elseif ( 'page' === $post_type ) {
   264 	get_current_screen()->add_help_tab(
   281 	get_current_screen()->add_help_tab(
   265 		array(
   282 		array(
   266 			'id'      => 'overview',
   283 			'id'      => 'overview',
   267 			'title'   => __( 'Overview' ),
   284 			'title'   => __( 'Overview' ),
   268 			'content' =>
   285 			'content' =>
   269 					 '<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.' ) . '</p>',
   286 					'<p>' . __( 'Pages are similar to posts in that they have a title, body text, and associated metadata, but they are different in that they are not part of the chronological blog stream, kind of like permanent posts. Pages are not categorized or tagged, but can have a hierarchy. You can nest pages under other pages by making one the &#8220;Parent&#8221; of the other, creating a group of pages.' ) . '</p>',
   270 		)
   287 		)
   271 	);
   288 	);
   272 	get_current_screen()->add_help_tab(
   289 	get_current_screen()->add_help_tab(
   273 		array(
   290 		array(
   274 			'id'      => 'managing-pages',
   291 			'id'      => 'managing-pages',
   275 			'title'   => __( 'Managing Pages' ),
   292 			'title'   => __( 'Managing Pages' ),
   276 			'content' =>
   293 			'content' =>
   277 					 '<p>' . __( 'Managing pages is very similar to managing posts, and the screens can be customized in the same way.' ) . '</p>' .
   294 					'<p>' . __( 'Managing pages is very similar to managing posts, and the screens can be customized in the same way.' ) . '</p>' .
   278 					 '<p>' . __( 'You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk Actions menu to edit the metadata for multiple pages at once.' ) . '</p>',
   295 					'<p>' . __( 'You can also perform the same types of actions, including narrowing the list by using the filters, acting on a page using the action links that appear when you hover over a row, or using the Bulk actions menu to edit the metadata for multiple pages at once.' ) . '</p>',
   279 		)
   296 		)
   280 	);
   297 	);
   281 
   298 
   282 	get_current_screen()->set_help_sidebar(
   299 	get_current_screen()->set_help_sidebar(
   283 		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   300 		'<p><strong>' . __( 'For more information:' ) . '</strong></p>' .
   284 		'<p>' . __( '<a href="https://codex.wordpress.org/Pages_Screen">Documentation on Managing Pages</a>' ) . '</p>' .
   301 		'<p>' . __( '<a href="https://wordpress.org/support/article/pages-screen/">Documentation on Managing Pages</a>' ) . '</p>' .
   285 		'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   302 		'<p>' . __( '<a href="https://wordpress.org/support/">Support</a>' ) . '</p>'
   286 	);
   303 	);
   287 
   304 
   288 }
   305 }
   289 
   306 
   311 	'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0,
   328 	'untrashed' => isset( $_REQUEST['untrashed'] ) ? absint( $_REQUEST['untrashed'] ) : 0,
   312 );
   329 );
   313 
   330 
   314 $bulk_messages             = array();
   331 $bulk_messages             = array();
   315 $bulk_messages['post']     = array(
   332 $bulk_messages['post']     = array(
       
   333 	/* translators: %s: Number of posts. */
   316 	'updated'   => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
   334 	'updated'   => _n( '%s post updated.', '%s posts updated.', $bulk_counts['updated'] ),
   317 	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
   335 	'locked'    => ( 1 === $bulk_counts['locked'] ) ? __( '1 post not updated, somebody is editing it.' ) :
       
   336 					/* translators: %s: Number of posts. */
   318 					_n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
   337 					_n( '%s post not updated, somebody is editing it.', '%s posts not updated, somebody is editing them.', $bulk_counts['locked'] ),
       
   338 	/* translators: %s: Number of posts. */
   319 	'deleted'   => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ),
   339 	'deleted'   => _n( '%s post permanently deleted.', '%s posts permanently deleted.', $bulk_counts['deleted'] ),
       
   340 	/* translators: %s: Number of posts. */
   320 	'trashed'   => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),
   341 	'trashed'   => _n( '%s post moved to the Trash.', '%s posts moved to the Trash.', $bulk_counts['trashed'] ),
       
   342 	/* translators: %s: Number of posts. */
   321 	'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ),
   343 	'untrashed' => _n( '%s post restored from the Trash.', '%s posts restored from the Trash.', $bulk_counts['untrashed'] ),
   322 );
   344 );
   323 $bulk_messages['page']     = array(
   345 $bulk_messages['page']     = array(
       
   346 	/* translators: %s: Number of pages. */
   324 	'updated'   => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
   347 	'updated'   => _n( '%s page updated.', '%s pages updated.', $bulk_counts['updated'] ),
   325 	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
   348 	'locked'    => ( 1 === $bulk_counts['locked'] ) ? __( '1 page not updated, somebody is editing it.' ) :
       
   349 					/* translators: %s: Number of pages. */
   326 					_n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
   350 					_n( '%s page not updated, somebody is editing it.', '%s pages not updated, somebody is editing them.', $bulk_counts['locked'] ),
       
   351 	/* translators: %s: Number of pages. */
   327 	'deleted'   => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ),
   352 	'deleted'   => _n( '%s page permanently deleted.', '%s pages permanently deleted.', $bulk_counts['deleted'] ),
       
   353 	/* translators: %s: Number of pages. */
   328 	'trashed'   => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ),
   354 	'trashed'   => _n( '%s page moved to the Trash.', '%s pages moved to the Trash.', $bulk_counts['trashed'] ),
       
   355 	/* translators: %s: Number of pages. */
   329 	'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ),
   356 	'untrashed' => _n( '%s page restored from the Trash.', '%s pages restored from the Trash.', $bulk_counts['untrashed'] ),
   330 );
   357 );
   331 $bulk_messages['wp_block'] = array(
   358 $bulk_messages['wp_block'] = array(
       
   359 	/* translators: %s: Number of blocks. */
   332 	'updated'   => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'] ),
   360 	'updated'   => _n( '%s block updated.', '%s blocks updated.', $bulk_counts['updated'] ),
   333 	'locked'    => ( 1 == $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) : _n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'] ),
   361 	'locked'    => ( 1 === $bulk_counts['locked'] ) ? __( '1 block not updated, somebody is editing it.' ) :
       
   362 					/* translators: %s: Number of blocks. */
       
   363 					_n( '%s block not updated, somebody is editing it.', '%s blocks not updated, somebody is editing them.', $bulk_counts['locked'] ),
       
   364 	/* translators: %s: Number of blocks. */
   334 	'deleted'   => _n( '%s block permanently deleted.', '%s blocks permanently deleted.', $bulk_counts['deleted'] ),
   365 	'deleted'   => _n( '%s block permanently deleted.', '%s blocks permanently deleted.', $bulk_counts['deleted'] ),
       
   366 	/* translators: %s: Number of blocks. */
   335 	'trashed'   => _n( '%s block moved to the Trash.', '%s blocks moved to the Trash.', $bulk_counts['trashed'] ),
   367 	'trashed'   => _n( '%s block moved to the Trash.', '%s blocks moved to the Trash.', $bulk_counts['trashed'] ),
       
   368 	/* translators: %s: Number of blocks. */
   336 	'untrashed' => _n( '%s block restored from the Trash.', '%s blocks restored from the Trash.', $bulk_counts['untrashed'] ),
   369 	'untrashed' => _n( '%s block restored from the Trash.', '%s blocks restored from the Trash.', $bulk_counts['untrashed'] ),
   337 );
   370 );
   338 
   371 
   339 /**
   372 /**
   340  * Filters the bulk action updated messages.
   373  * Filters the bulk action updated messages.
   348  * @param int[]   $bulk_counts   Array of item counts for each message, used to build internationalized strings.
   381  * @param int[]   $bulk_counts   Array of item counts for each message, used to build internationalized strings.
   349  */
   382  */
   350 $bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts );
   383 $bulk_messages = apply_filters( 'bulk_post_updated_messages', $bulk_messages, $bulk_counts );
   351 $bulk_counts   = array_filter( $bulk_counts );
   384 $bulk_counts   = array_filter( $bulk_counts );
   352 
   385 
   353 require_once( ABSPATH . 'wp-admin/admin-header.php' );
   386 require_once ABSPATH . 'wp-admin/admin-header.php';
   354 ?>
   387 ?>
   355 <div class="wrap">
   388 <div class="wrap">
   356 <h1 class="wp-heading-inline">
   389 <h1 class="wp-heading-inline">
   357 <?php
   390 <?php
   358 echo esc_html( $post_type_object->labels->name );
   391 echo esc_html( $post_type_object->labels->name );
   363 if ( current_user_can( $post_type_object->cap->create_posts ) ) {
   396 if ( current_user_can( $post_type_object->cap->create_posts ) ) {
   364 	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
   397 	echo ' <a href="' . esc_url( admin_url( $post_new_file ) ) . '" class="page-title-action">' . esc_html( $post_type_object->labels->add_new ) . '</a>';
   365 }
   398 }
   366 
   399 
   367 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
   400 if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) {
   368 	/* translators: %s: search keywords */
   401 	/* translators: %s: Search query. */
   369 	printf( ' <span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
   402 	printf( ' <span class="subtitle">' . __( 'Search results for &#8220;%s&#8221;' ) . '</span>', get_search_query() );
   370 }
   403 }
   371 ?>
   404 ?>
   372 
   405 
   373 <hr class="wp-header-end">
   406 <hr class="wp-header-end">
   380 		$messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) );
   413 		$messages[] = sprintf( $bulk_messages[ $post_type ][ $message ], number_format_i18n( $count ) );
   381 	} elseif ( isset( $bulk_messages['post'][ $message ] ) ) {
   414 	} elseif ( isset( $bulk_messages['post'][ $message ] ) ) {
   382 		$messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) );
   415 		$messages[] = sprintf( $bulk_messages['post'][ $message ], number_format_i18n( $count ) );
   383 	}
   416 	}
   384 
   417 
   385 	if ( $message == 'trashed' && isset( $_REQUEST['ids'] ) ) {
   418 	if ( 'trashed' === $message && isset( $_REQUEST['ids'] ) ) {
   386 		$ids        = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] );
   419 		$ids        = preg_replace( '/[^0-9,]/', '', $_REQUEST['ids'] );
   387 		$messages[] = '<a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", 'bulk-posts' ) ) . '">' . __( 'Undo' ) . '</a>';
   420 		$messages[] = '<a href="' . esc_url( wp_nonce_url( "edit.php?post_type=$post_type&doaction=undo&action=untrash&ids=$ids", 'bulk-posts' ) ) . '">' . __( 'Undo' ) . '</a>';
   388 	}
   421 	}
   389 }
   422 }
   390 
   423 
   426 <div id="ajax-response"></div>
   459 <div id="ajax-response"></div>
   427 <br class="clear" />
   460 <br class="clear" />
   428 </div>
   461 </div>
   429 
   462 
   430 <?php
   463 <?php
   431 include( ABSPATH . 'wp-admin/admin-footer.php' );
   464 require_once ABSPATH . 'wp-admin/admin-footer.php';