Changeset 15578 for trunk/wp-admin/edit.php
- Timestamp:
- 09/05/2010 09:26:27 PM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/wp-admin/edit.php
r15528 r15578 208 208 <?php } ?> 209 209 210 <?php $wp_list_table->views(); ?> 211 210 212 <form id="posts-filter" action="" method="get"> 211 212 <ul class="subsubsub">213 <?php214 if ( empty($locked_post_status) ) :215 $status_links = array();216 $num_posts = wp_count_posts( $post_type, 'readable' );217 $class = '';218 $allposts = '';219 220 $user_posts = false;221 if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {222 $user_posts = true;223 224 $user_posts_count = $wpdb->get_var( $wpdb->prepare( "225 SELECT COUNT( 1 ) FROM $wpdb->posts226 WHERE post_type = '%s' AND post_status NOT IN ( 'trash', 'auto-draft' )227 AND post_author = %d228 ", $post_type, get_current_user_id() ) );229 230 if ( $user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) )231 $_REQUEST['author'] = get_current_user_id();232 }233 234 if ( $user_posts ) {235 if ( isset( $_REQUEST['author'] ) && ( $_REQUEST['author'] == $current_user->ID ) )236 $class = ' class="current"';237 $status_links[] = "<li><a href='edit.php?post_type=$post_type&author=$current_user->ID'$class>" . sprintf( _nx( 'Mine <span class="count">(%s)</span>', 'Mine <span class="count">(%s)</span>', $user_posts_count, 'posts' ), number_format_i18n( $user_posts_count ) ) . '</a>';238 $allposts = '&all_posts=1';239 }240 241 $total_posts = array_sum( (array) $num_posts );242 243 // Subtract post types that are not included in the admin all list.244 foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )245 $total_posts -= $num_posts->$state;246 247 $class = empty($class) && empty($_REQUEST['post_status']) ? ' class="current"' : '';248 $status_links[] = "<li><a href='edit.php?post_type=$post_type{$allposts}'$class>" . sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>';249 250 foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {251 $class = '';252 253 $status_name = $status->name;254 255 if ( !in_array( $status_name, $avail_post_stati ) )256 continue;257 258 if ( empty( $num_posts->$status_name ) )259 continue;260 261 if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )262 $class = ' class="current"';263 264 $status_links[] = "<li><a href='edit.php?post_status=$status_name&post_type=$post_type'$class>" . sprintf( _n( $status->label_count[0], $status->label_count[1], $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';265 }266 echo implode( " |</li>\n", $status_links ) . '</li>';267 unset( $status_links );268 endif;269 ?>270 </ul>271 272 213 <p class="search-box"> 273 214 <label class="screen-reader-text" for="post-search-input"><?php echo $post_type_object->labels->search_items; ?>:</label>
Note: See TracChangeset
for help on using the changeset viewer.