X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/fef8173b8c3bad08f495551e43cfdeac1cae6021..b3ddbea8a296025a672b3c3ddca158dc51ed8080:/wp-admin/includes/class-wp-posts-list-table.php diff --git a/wp-admin/includes/class-wp-posts-list-table.php b/wp-admin/includes/class-wp-posts-list-table.php index e623ab59..bdd24a62 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -45,7 +45,7 @@ class WP_Posts_List_Table extends WP_List_Table { */ var $sticky_posts_count = 0; - function WP_Posts_List_Table() { + function __construct() { global $post_type_object, $post_type, $wpdb; if ( !isset( $_REQUEST['post_type'] ) ) @@ -74,7 +74,7 @@ class WP_Posts_List_Table extends WP_List_Table { $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) ); } - parent::WP_List_Table( array( + parent::__construct( array( 'plural' => 'posts', ) ); } @@ -281,7 +281,7 @@ class WP_Posts_List_Table extends WP_List_Table { $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all'; if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) ) - $posts_columns['comments'] = '
' . esc_attr__( 'Comments' ) . '
'; + $posts_columns['comments'] = '' . esc_attr__( 'Comments' ) . ''; $posts_columns['date'] = __( 'Date' ); @@ -310,6 +310,8 @@ class WP_Posts_List_Table extends WP_List_Table { if ( empty( $posts ) ) $posts = $wp_query->posts; + add_filter( 'the_title', 'esc_html' ); + if ( $this->hierarchical_display ) { $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page ); } else { @@ -320,8 +322,6 @@ class WP_Posts_List_Table extends WP_List_Table { function _display_rows( $posts ) { global $post, $mode; - add_filter( 'the_title', 'esc_html' ); - // Create array of post IDs. $post_ids = array(); @@ -522,7 +522,6 @@ class WP_Posts_List_Table extends WP_List_Table { } } - $post->post_title = esc_html( $post->post_title ); $pad = str_repeat( '— ', $level ); ?> >post_status != 'trash' ) { ?>labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?> @@ -551,11 +550,13 @@ class WP_Posts_List_Table extends WP_List_Table { if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) $actions['delete'] = "" . __( 'Delete Permanently' ) . ""; } - if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) { - if ( $can_edit_post ) - $actions['view'] = '' . __( 'Preview' ) . ''; - } elseif ( 'trash' != $post->post_status ) { - $actions['view'] = '' . __( 'View' ) . ''; + if ( $post_type_object->public ) { + if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) { + if ( $can_edit_post ) + $actions['view'] = '' . __( 'Preview' ) . ''; + } elseif ( 'trash' != $post->post_status ) { + $actions['view'] = '' . __( 'View' ) . ''; + } } $actions = apply_filters( is_post_type_hierarchical( $post->post_type ) ? 'page_row_actions' : 'post_row_actions', $actions, $post ); @@ -1004,6 +1005,7 @@ class WP_Posts_List_Table extends WP_List_Table { } ?> +