]> scripts.mit.edu Git - autoinstalls/wordpress.git/blobdiff - wp-admin/edit.php
WordPress 4.4
[autoinstalls/wordpress.git] / wp-admin / edit.php
index 6c285d78ecf2207ba7af2c0e45141c75f59ff59c..62c70e2bc3eb66e2a54ccc1579f9c44016e26124 100644 (file)
@@ -12,6 +12,10 @@ require_once( dirname( __FILE__ ) . '/admin.php' );
 if ( ! $typenow )
        wp_die( __( 'Invalid post type' ) );
 
+if ( ! in_array( $typenow, get_post_types( array( 'show_ui' => true ) ) ) ) {
+       wp_die( __( 'You are not allowed to edit posts in this post type.' ) );
+}
+
 if ( 'attachment' === $typenow ) {
        if ( wp_redirect( admin_url( 'upload.php' ) ) ) {
                exit;
@@ -30,8 +34,13 @@ $post_type_object = get_post_type_object( $post_type );
 if ( ! $post_type_object )
        wp_die( __( 'Invalid post type' ) );
 
-if ( ! current_user_can( $post_type_object->cap->edit_posts ) )
-       wp_die( __( 'Cheatin’ uh?' ), 403 );
+if ( ! current_user_can( $post_type_object->cap->edit_posts ) ) {
+       wp_die(
+               '<h1>' . __( 'Cheatin&#8217; uh?' ) . '</h1>' .
+               '<p>' . __( 'You are not allowed to edit posts in this post type.' ) . '</p>',
+               403
+       );
+}
 
 $wp_list_table = _get_list_table('WP_Posts_List_Table');
 $pagenum = $wp_list_table->get_pagenum();
@@ -92,7 +101,7 @@ if ( $doaction ) {
                case 'trash':
                        $trashed = $locked = 0;
 
-                       foreach( (array) $post_ids as $post_id ) {
+                       foreach ( (array) $post_ids as $post_id ) {
                                if ( !current_user_can( 'delete_post', $post_id) )
                                        wp_die( __('You are not allowed to move this item to the Trash.') );
 
@@ -111,7 +120,7 @@ if ( $doaction ) {
                        break;
                case 'untrash':
                        $untrashed = 0;
-                       foreach( (array) $post_ids as $post_id ) {
+                       foreach ( (array) $post_ids as $post_id ) {
                                if ( !current_user_can( 'delete_post', $post_id) )
                                        wp_die( __('You are not allowed to restore this item from the Trash.') );
 
@@ -124,7 +133,7 @@ if ( $doaction ) {
                        break;
                case 'delete':
                        $deleted = 0;
-                       foreach( (array) $post_ids as $post_id ) {
+                       foreach ( (array) $post_ids as $post_id ) {
                                $post_del = get_post($post_id);
 
                                if ( !current_user_can( 'delete_post', $post_id ) )
@@ -186,7 +195,7 @@ if ( 'post' == $post_type ) {
                '<ul>' .
                        '<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>' .
                        '<li>' . __('You can filter the list of posts by post status using the text links in the upper left to show All, Published, Draft, or Trashed posts. The default view is to show all posts.') . '</li>' .
-                       '<li>' . __('You can view posts in a simple title list or with an excerpt. Choose the view you prefer by clicking on the icons at the top of the list on the right.') . '</li>' .
+                       '<li>' . __('You can view posts in a simple title list or with an excerpt using the Screen Options tab.') . '</li>' .
                        '<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>' .
                '</ul>'
        ) );
@@ -236,8 +245,15 @@ if ( 'post' == $post_type ) {
        '<p>' . __('<a href="https://codex.wordpress.org/Pages_Screen" target="_blank">Documentation on Managing Pages</a>') . '</p>' .
        '<p>' . __('<a href="https://wordpress.org/support/" target="_blank">Support Forums</a>') . '</p>'
        );
+
 }
 
+get_current_screen()->set_screen_reader_content( array(
+       'heading_views'      => $post_type_object->labels->filter_items_list,
+       'heading_pagination' => $post_type_object->labels->items_list_navigation,
+       'heading_list'       => $post_type_object->labels->items_list,
+) );
+
 add_screen_option( 'per_page', array( 'default' => 20, 'option' => 'edit_' . $post_type . '_per_page' ) );
 
 $bulk_counts = array(