X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/7f1521bf193b382565eb753043c161f4cb3fcda7..e8f61417994be715a90671aa87f1cd70d8ba132a:/wp-admin/edit.php diff --git a/wp-admin/edit.php b/wp-admin/edit.php index ad8c0786..27d8f689 100644 --- a/wp-admin/edit.php +++ b/wp-admin/edit.php @@ -12,12 +12,20 @@ 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; } } +/** + * @global string $post_type + * @global object $post_type_object + */ global $post_type, $post_type_object; $post_type = $typenow; @@ -26,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( + '

' . __( 'Cheatin’ uh?' ) . '

' . + '

' . __( 'You are not allowed to edit posts in this post type.' ) . '

', + 403 + ); +} $wp_list_table = _get_list_table('WP_Posts_List_Table'); $pagenum = $wp_list_table->get_pagenum(); @@ -88,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.') ); @@ -107,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.') ); @@ -120,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 ) ) @@ -182,7 +195,7 @@ if ( 'post' == $post_type ) { '' ) ); @@ -232,8 +245,15 @@ if ( 'post' == $post_type ) { '

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

' . '

' . __('Support Forums') . '

' ); + } +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( @@ -279,13 +299,16 @@ $bulk_counts = array_filter( $bulk_counts ); require_once( ABSPATH . 'wp-admin/admin-header.php' ); ?>
-

labels->name ); if ( current_user_can( $post_type_object->cap->create_posts ) ) - echo ' ' . esc_html( $post_type_object->labels->add_new ) . ''; -if ( ! empty( $_REQUEST['s'] ) ) - printf( ' ' . __('Search results for “%s”') . '', get_search_query() ); -?>

+ echo ' ' . esc_html( $post_type_object->labels->add_new ) . ''; + +if ( isset( $_REQUEST['s'] ) && strlen( $_REQUEST['s'] ) ) { + /* translators: %s: search keywords */ + printf( ' ' . __( 'Search results for “%s”' ) . '', get_search_query() ); +} +?>