X-Git-Url: https://scripts.mit.edu/gitweb/autoinstalls/wordpress.git/blobdiff_plain/6c8f14c09105d0afa4c1574215c59b5021040e76..refs/tags/wordpress-3.7:/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 c772fa63..016a726b 100644 --- a/wp-admin/includes/class-wp-posts-list-table.php +++ b/wp-admin/includes/class-wp-posts-list-table.php @@ -57,9 +57,10 @@ class WP_Posts_List_Table extends WP_List_Table { $post_type_object = get_post_type_object( $post_type ); if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) { + $exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false ) ); $this->user_posts_count = $wpdb->get_var( $wpdb->prepare( " SELECT COUNT( 1 ) FROM $wpdb->posts - WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' ) + WHERE post_type = %s AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) AND post_author = %d ", $post_type, get_current_user_id() ) ); @@ -69,7 +70,7 @@ class WP_Posts_List_Table extends WP_List_Table { if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) { $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); - $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 ) ); + $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) ); } } @@ -382,8 +383,10 @@ class WP_Posts_List_Table extends WP_List_Table { if ( $count >= $end ) break; - if ( $count >= $start ) - echo "\t" . $this->single_row( $page, $level ); + if ( $count >= $start ) { + echo "\t"; + $this->single_row( $page, $level ); + } $count++; @@ -397,8 +400,12 @@ class WP_Posts_List_Table extends WP_List_Table { foreach ( $orphans as $op ) { if ( $count >= $end ) break; - if ( $count >= $start ) - echo "\t" . $this->single_row( $op, 0 ); + + if ( $count >= $start ) { + echo "\t"; + $this->single_row( $op, 0 ); + } + $count++; } } @@ -411,12 +418,12 @@ class WP_Posts_List_Table extends WP_List_Table { * * @since 3.1.0 (Standalone function exists since 2.6.0) * - * @param unknown_type $children_pages - * @param unknown_type $count - * @param unknown_type $parent - * @param unknown_type $level - * @param unknown_type $pagenum - * @param unknown_type $per_page + * @param array $children_pages + * @param int $count + * @param int $parent + * @param int $level + * @param int $pagenum + * @param int $per_page */ function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) { @@ -444,13 +451,16 @@ class WP_Posts_List_Table extends WP_List_Table { } $num_parents = count( $my_parents ); while ( $my_parent = array_pop( $my_parents ) ) { - echo "\t" . $this->single_row( $my_parent, $level - $num_parents ); + echo "\t"; + $this->single_row( $my_parent, $level - $num_parents ); $num_parents--; } } - if ( $count >= $start ) - echo "\t" . $this->single_row( $page, $level ); + if ( $count >= $start ) { + echo "\t"; + $this->single_row( $page, $level ); + } $count++; @@ -471,10 +481,16 @@ class WP_Posts_List_Table extends WP_List_Table { $edit_link = get_edit_post_link( $post->ID ); $title = _draft_or_post_title(); $post_type_object = get_post_type_object( $post->post_type ); - $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID ); + $can_edit_post = current_user_can( 'edit_post', $post->ID ); $alternate = 'alternate' == $alternate ? '' : 'alternate'; $classes = $alternate . ' iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' ); + + $lock_holder = wp_check_post_lock( $post->ID ); + if ( $lock_holder ) { + $classes .= ' wp-locked'; + $lock_holder = get_userdata( $lock_holder ); + } ?> - + - +
+ hierarchical_display ) { - $attributes = 'class="post-title page-title column-title"' . $style; - if ( 0 == $level && (int) $post->post_parent > 0 ) { //sent level 0 by accident, by default, or because we don't know the actual level $find_main_page = (int) $post->post_parent; @@ -519,33 +540,55 @@ class WP_Posts_List_Table extends WP_List_Table { $level++; $find_main_page = (int) $parent->post_parent; - if ( !isset( $parent_name ) ) + if ( !isset( $parent_name ) ) { + /** This filter is documented in wp-includes/post-template.php */ $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID ); + } } } + } - $pad = str_repeat( '— ', $level ); -?> - >post_status != 'trash' ) { ?>labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?> -"; + + if ( $format = get_post_format( $post->ID ) ) { + $label = get_post_format_string( $format ); + + echo '' . $label . ": "; } - else { - $attributes = 'class="post-title page-title column-title"' . $style; - $pad = str_repeat( '— ', $level ); -?> - >post_status != 'trash' ) { ?> -ID ) ) - the_excerpt(); + if ( $can_edit_post && $post->post_status != 'trash' ) { + echo '' . $pad . $title . ''; + } else { + echo $pad . $title; } + _post_states( $post ); + + if ( isset( $parent_name ) ) + echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ); + + echo "\n"; + + if ( $can_edit_post && $post->post_status != 'trash' ) { + if ( $lock_holder ) { + $locked_avatar = get_avatar( $lock_holder->ID, 18 ); + $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) ); + } else { + $locked_avatar = $locked_text = ''; + } + + echo '
' . $locked_avatar . ' ' . $locked_text . "
\n"; + } + + if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) ) + the_excerpt(); $actions = array(); if ( $can_edit_post && 'trash' != $post->post_status ) { $actions['edit'] = '' . __( 'Edit' ) . ''; $actions['inline hide-if-no-js'] = '' . __( 'Quick Edit' ) . ''; } - if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) { + if ( current_user_can( 'delete_post', $post->ID ) ) { if ( 'trash' == $post->post_status ) $actions['untrash'] = "ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . ""; elseif ( EMPTY_TRASH_DAYS ) @@ -556,7 +599,7 @@ class WP_Posts_List_Table extends WP_List_Table { if ( $post_type_object->public ) { if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) { if ( $can_edit_post ) - $actions['view'] = '' . __( 'Preview' ) . ''; + $actions['view'] = '' . __( 'Preview' ) . ''; } elseif ( 'trash' != $post->post_status ) { $actions['view'] = '' . __( 'View' ) . ''; } @@ -820,10 +863,7 @@ class WP_Posts_List_Table extends WP_List_Table { - labels->name ) ?> - - - + labels->name ) ?>