]> scripts.mit.edu Git - autoinstalls/wordpress.git/blob - wp-admin/includes/class-wp-posts-list-table.php
WordPress 4.1
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-posts-list-table.php
1 <?php
2 /**
3  * Posts List Table class.
4  *
5  * @package WordPress
6  * @subpackage List_Table
7  * @since 3.1.0
8  * @access private
9  */
10 class WP_Posts_List_Table extends WP_List_Table {
11
12         /**
13          * Whether the items should be displayed hierarchically or linearly
14          *
15          * @since 3.1.0
16          * @var bool
17          * @access protected
18          */
19         protected $hierarchical_display;
20
21         /**
22          * Holds the number of pending comments for each post
23          *
24          * @since 3.1.0
25          * @var int
26          * @access protected
27          */
28         protected $comment_pending_count;
29
30         /**
31          * Holds the number of posts for this user
32          *
33          * @since 3.1.0
34          * @var int
35          * @access private
36          */
37         private $user_posts_count;
38
39         /**
40          * Holds the number of posts which are sticky.
41          *
42          * @since 3.1.0
43          * @var int
44          * @access private
45          */
46         private $sticky_posts_count = 0;
47
48         /**
49          * Constructor.
50          *
51          * @since 3.1.0
52          * @access public
53          *
54          * @see WP_List_Table::__construct() for more information on default arguments.
55          *
56          * @param array $args An associative array of arguments.
57          */
58         public function __construct( $args = array() ) {
59                 global $post_type_object, $wpdb;
60
61                 parent::__construct( array(
62                         'plural' => 'posts',
63                         'screen' => isset( $args['screen'] ) ? $args['screen'] : null,
64                 ) );
65
66                 $post_type = $this->screen->post_type;
67                 $post_type_object = get_post_type_object( $post_type );
68
69                 if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
70                         $exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false ) );
71                         $this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
72                                 SELECT COUNT( 1 ) FROM $wpdb->posts
73                                 WHERE post_type = %s AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )
74                                 AND post_author = %d
75                         ", $post_type, get_current_user_id() ) );
76
77                         if ( $this->user_posts_count && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['all_posts'] ) && empty( $_REQUEST['author'] ) && empty( $_REQUEST['show_sticky'] ) )
78                                 $_GET['author'] = get_current_user_id();
79                 }
80
81                 if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
82                         $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
83                         $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 ) );
84                 }
85         }
86
87         public function ajax_user_can() {
88                 return current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_posts );
89         }
90
91         public function prepare_items() {
92                 global $avail_post_stati, $wp_query, $per_page, $mode;
93
94                 $avail_post_stati = wp_edit_posts_query();
95
96                 $this->hierarchical_display = ( is_post_type_hierarchical( $this->screen->post_type ) && 'menu_order title' == $wp_query->query['orderby'] );
97
98                 $total_items = $this->hierarchical_display ? $wp_query->post_count : $wp_query->found_posts;
99
100                 $post_type = $this->screen->post_type;
101                 $per_page = $this->get_items_per_page( 'edit_' . $post_type . '_per_page' );
102
103                 /** This filter is documented in wp-admin/includes/post.php */
104                 $per_page = apply_filters( 'edit_posts_per_page', $per_page, $post_type );
105
106                 if ( $this->hierarchical_display )
107                         $total_pages = ceil( $total_items / $per_page );
108                 else
109                         $total_pages = $wp_query->max_num_pages;
110
111                 if ( ! empty( $_REQUEST['mode'] ) ) {
112                         $mode = $_REQUEST['mode'] == 'excerpt' ? 'excerpt' : 'list';
113                         set_user_setting ( 'posts_list_mode', $mode );
114                 } else {
115                         $mode = get_user_setting ( 'posts_list_mode', 'list' );
116                 }
117
118                 $this->is_trash = isset( $_REQUEST['post_status'] ) && $_REQUEST['post_status'] == 'trash';
119
120                 $this->set_pagination_args( array(
121                         'total_items' => $total_items,
122                         'total_pages' => $total_pages,
123                         'per_page' => $per_page
124                 ) );
125         }
126
127         public function has_items() {
128                 return have_posts();
129         }
130
131         public function no_items() {
132                 if ( isset( $_REQUEST['post_status'] ) && 'trash' == $_REQUEST['post_status'] )
133                         echo get_post_type_object( $this->screen->post_type )->labels->not_found_in_trash;
134                 else
135                         echo get_post_type_object( $this->screen->post_type )->labels->not_found;
136         }
137
138         protected function get_views() {
139                 global $locked_post_status, $avail_post_stati;
140
141                 $post_type = $this->screen->post_type;
142
143                 if ( !empty($locked_post_status) )
144                         return array();
145
146                 $status_links = array();
147                 $num_posts = wp_count_posts( $post_type, 'readable' );
148                 $class = '';
149                 $allposts = '';
150
151                 $current_user_id = get_current_user_id();
152
153                 if ( $this->user_posts_count ) {
154                         if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user_id ) )
155                                 $class = ' class="current"';
156                         $status_links['mine'] = "<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>', $this->user_posts_count, 'posts' ), number_format_i18n( $this->user_posts_count ) ) . '</a>';
157                         $allposts = '&all_posts=1';
158                 }
159
160                 $total_posts = array_sum( (array) $num_posts );
161
162                 // Subtract post types that are not included in the admin all list.
163                 foreach ( get_post_stati( array('show_in_admin_all_list' => false) ) as $state )
164                         $total_posts -= $num_posts->$state;
165
166                 $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
167                 $status_links['all'] = "<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>';
168
169                 foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) {
170                         $class = '';
171
172                         $status_name = $status->name;
173
174                         if ( !in_array( $status_name, $avail_post_stati ) )
175                                 continue;
176
177                         if ( empty( $num_posts->$status_name ) )
178                                 continue;
179
180                         if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] )
181                                 $class = ' class="current"';
182
183                         $status_links[$status_name] = "<a href='edit.php?post_status=$status_name&amp;post_type=$post_type'$class>" . sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>';
184                 }
185
186                 if ( ! empty( $this->sticky_posts_count ) ) {
187                         $class = ! empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : '';
188
189                         $sticky_link = array( 'sticky' => "<a href='edit.php?post_type=$post_type&amp;show_sticky=1'$class>" . sprintf( _nx( 'Sticky <span class="count">(%s)</span>', 'Sticky <span class="count">(%s)</span>', $this->sticky_posts_count, 'posts' ), number_format_i18n( $this->sticky_posts_count ) ) . '</a>' );
190
191                         // Sticky comes after Publish, or if not listed, after All.
192                         $split = 1 + array_search( ( isset( $status_links['publish'] ) ? 'publish' : 'all' ), array_keys( $status_links ) );
193                         $status_links = array_merge( array_slice( $status_links, 0, $split ), $sticky_link, array_slice( $status_links, $split ) );
194                 }
195
196                 return $status_links;
197         }
198
199         protected function get_bulk_actions() {
200                 $actions = array();
201                 $post_type_obj = get_post_type_object( $this->screen->post_type );
202
203                 if ( $this->is_trash ) {
204                         $actions['untrash'] = __( 'Restore' );
205                 } else {
206                         $actions['edit'] = __( 'Edit' );
207                 }
208
209                 if ( current_user_can( $post_type_obj->cap->delete_posts ) ) {
210                         if ( $this->is_trash || ! EMPTY_TRASH_DAYS ) {
211                                 $actions['delete'] = __( 'Delete Permanently' );
212                         } else {
213                                 $actions['trash'] = __( 'Move to Trash' );
214                         }
215                 }
216
217                 return $actions;
218         }
219
220         /**
221          * @global int $cat
222          * @param string $which
223          */
224         protected function extra_tablenav( $which ) {
225                 global $cat;
226 ?>
227                 <div class="alignleft actions">
228 <?php
229                 if ( 'top' == $which && !is_singular() ) {
230
231                         $this->months_dropdown( $this->screen->post_type );
232
233                         if ( is_object_in_taxonomy( $this->screen->post_type, 'category' ) ) {
234                                 $dropdown_options = array(
235                                         'show_option_all' => __( 'All categories' ),
236                                         'hide_empty' => 0,
237                                         'hierarchical' => 1,
238                                         'show_count' => 0,
239                                         'orderby' => 'name',
240                                         'selected' => $cat
241                                 );
242
243                                 echo '<label class="screen-reader-text" for="cat">' . __( 'Filter by category' ) . '</label>';
244                                 wp_dropdown_categories( $dropdown_options );
245                         }
246
247                         /**
248                          * Fires before the Filter button on the Posts and Pages list tables.
249                          *
250                          * The Filter button allows sorting by date and/or category on the
251                          * Posts list table, and sorting by date on the Pages list table.
252                          *
253                          * @since 2.1.0
254                          */
255                         do_action( 'restrict_manage_posts' );
256
257                         submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
258                 }
259
260                 if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) {
261                         submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
262                 }
263 ?>
264                 </div>
265 <?php
266         }
267
268         public function current_action() {
269                 if ( isset( $_REQUEST['delete_all'] ) || isset( $_REQUEST['delete_all2'] ) )
270                         return 'delete_all';
271
272                 return parent::current_action();
273         }
274
275         /**
276          * @global string $mode
277          * @param string $which
278          */
279         protected function pagination( $which ) {
280                 global $mode;
281
282                 parent::pagination( $which );
283
284                 if ( 'top' == $which && ! is_post_type_hierarchical( $this->screen->post_type ) )
285                         $this->view_switcher( $mode );
286         }
287
288         protected function get_table_classes() {
289                 return array( 'widefat', 'fixed', is_post_type_hierarchical( $this->screen->post_type ) ? 'pages' : 'posts' );
290         }
291
292         public function get_columns() {
293                 $post_type = $this->screen->post_type;
294
295                 $posts_columns = array();
296
297                 $posts_columns['cb'] = '<input type="checkbox" />';
298
299                 /* translators: manage posts column name */
300                 $posts_columns['title'] = _x( 'Title', 'column name' );
301
302                 if ( post_type_supports( $post_type, 'author' ) ) {
303                         $posts_columns['author'] = __( 'Author' );
304                 }
305
306                 $taxonomies = get_object_taxonomies( $post_type, 'objects' );
307                 $taxonomies = wp_filter_object_list( $taxonomies, array( 'show_admin_column' => true ), 'and', 'name' );
308
309                 /**
310                  * Filter the taxonomy columns in the Posts list table.
311                  *
312                  * The dynamic portion of the hook name, `$post_type`, refers to the post
313                  * type slug.
314                  *
315                  * @since 3.5.0
316                  *
317                  * @param array  $taxonomies Array of taxonomies to show columns for.
318                  * @param string $post_type  The post type.
319                  */
320                 $taxonomies = apply_filters( "manage_taxonomies_for_{$post_type}_columns", $taxonomies, $post_type );
321                 $taxonomies = array_filter( $taxonomies, 'taxonomy_exists' );
322
323                 foreach ( $taxonomies as $taxonomy ) {
324                         if ( 'category' == $taxonomy )
325                                 $column_key = 'categories';
326                         elseif ( 'post_tag' == $taxonomy )
327                                 $column_key = 'tags';
328                         else
329                                 $column_key = 'taxonomy-' . $taxonomy;
330
331                         $posts_columns[ $column_key ] = get_taxonomy( $taxonomy )->labels->name;
332                 }
333
334                 $post_status = !empty( $_REQUEST['post_status'] ) ? $_REQUEST['post_status'] : 'all';
335                 if ( post_type_supports( $post_type, 'comments' ) && !in_array( $post_status, array( 'pending', 'draft', 'future' ) ) )
336                         $posts_columns['comments'] = '<span class="vers"><span title="' . esc_attr__( 'Comments' ) . '" class="comment-grey-bubble"></span></span>';
337
338                 $posts_columns['date'] = __( 'Date' );
339
340                 if ( 'page' == $post_type ) {
341
342                         /**
343                          * Filter the columns displayed in the Pages list table.
344                          *
345                          * @since 2.5.0
346                          *
347                          * @param array $post_columns An array of column names.
348                          */
349                         $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns );
350                 } else {
351
352                         /**
353                          * Filter the columns displayed in the Posts list table.
354                          *
355                          * @since 1.5.0
356                          *
357                          * @param array  $posts_columns An array of column names.
358                          * @param string $post_type     The post type slug.
359                          */
360                         $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type );
361                 }
362
363                 /**
364                  * Filter the columns displayed in the Posts list table for a specific post type.
365                  *
366                  * The dynamic portion of the hook name, `$post_type`, refers to the post type slug.
367                  *
368                  * @since 3.0.0
369                  *
370                  * @param array $post_columns An array of column names.
371                  */
372                 $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns );
373
374                 return $posts_columns;
375         }
376
377         protected function get_sortable_columns() {
378                 return array(
379                         'title'    => 'title',
380                         'parent'   => 'parent',
381                         'comments' => 'comment_count',
382                         'date'     => array( 'date', true )
383                 );
384         }
385
386         /**
387          * @global WP_Query $wp_query
388          * @global int $per_page
389          * @param array $posts
390          * @param int $level
391          */
392         public function display_rows( $posts = array(), $level = 0 ) {
393                 global $wp_query, $per_page;
394
395                 if ( empty( $posts ) )
396                         $posts = $wp_query->posts;
397
398                 add_filter( 'the_title', 'esc_html' );
399
400                 if ( $this->hierarchical_display ) {
401                         $this->_display_rows_hierarchical( $posts, $this->get_pagenum(), $per_page );
402                 } else {
403                         $this->_display_rows( $posts, $level );
404                 }
405         }
406
407         /**
408          * @global string $mode
409          * @param array $posts
410          * @param int $level
411          */
412         private function _display_rows( $posts, $level = 0 ) {
413                 global $mode;
414
415                 // Create array of post IDs.
416                 $post_ids = array();
417
418                 foreach ( $posts as $a_post )
419                         $post_ids[] = $a_post->ID;
420
421                 $this->comment_pending_count = get_pending_comments_num( $post_ids );
422
423                 foreach ( $posts as $post )
424                         $this->single_row( $post, $level );
425         }
426
427         /**
428          * @global wpdb $wpdb
429          * @param array $pages
430          * @param int $pagenum
431          * @param int $per_page
432          * @return bool|null
433          */
434         private function _display_rows_hierarchical( $pages, $pagenum = 1, $per_page = 20 ) {
435                 global $wpdb;
436
437                 $level = 0;
438
439                 if ( ! $pages ) {
440                         $pages = get_pages( array( 'sort_column' => 'menu_order' ) );
441
442                         if ( ! $pages )
443                                 return false;
444                 }
445
446                 /*
447                  * Arrange pages into two parts: top level pages and children_pages
448                  * children_pages is two dimensional array, eg.
449                  * children_pages[10][] contains all sub-pages whose parent is 10.
450                  * It only takes O( N ) to arrange this and it takes O( 1 ) for subsequent lookup operations
451                  * If searching, ignore hierarchy and treat everything as top level
452                  */
453                 if ( empty( $_REQUEST['s'] ) ) {
454
455                         $top_level_pages = array();
456                         $children_pages = array();
457
458                         foreach ( $pages as $page ) {
459
460                                 // Catch and repair bad pages.
461                                 if ( $page->post_parent == $page->ID ) {
462                                         $page->post_parent = 0;
463                                         $wpdb->update( $wpdb->posts, array( 'post_parent' => 0 ), array( 'ID' => $page->ID ) );
464                                         clean_post_cache( $page );
465                                 }
466
467                                 if ( 0 == $page->post_parent )
468                                         $top_level_pages[] = $page;
469                                 else
470                                         $children_pages[ $page->post_parent ][] = $page;
471                         }
472
473                         $pages = &$top_level_pages;
474                 }
475
476                 $count = 0;
477                 $start = ( $pagenum - 1 ) * $per_page;
478                 $end = $start + $per_page;
479
480                 foreach ( $pages as $page ) {
481                         if ( $count >= $end )
482                                 break;
483
484                         if ( $count >= $start ) {
485                                 echo "\t";
486                                 $this->single_row( $page, $level );
487                         }
488
489                         $count++;
490
491                         if ( isset( $children_pages ) )
492                                 $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
493                 }
494
495                 // If it is the last pagenum and there are orphaned pages, display them with paging as well.
496                 if ( isset( $children_pages ) && $count < $end ){
497                         foreach ( $children_pages as $orphans ){
498                                 foreach ( $orphans as $op ) {
499                                         if ( $count >= $end )
500                                                 break;
501
502                                         if ( $count >= $start ) {
503                                                 echo "\t";
504                                                 $this->single_row( $op, 0 );
505                                         }
506
507                                         $count++;
508                                 }
509                         }
510                 }
511         }
512
513         /**
514          * Given a top level page ID, display the nested hierarchy of sub-pages
515          * together with paging support
516          *
517          * @since 3.1.0 (Standalone function exists since 2.6.0)
518          *
519          * @param array $children_pages
520          * @param int $count
521          * @param int $parent
522          * @param int $level
523          * @param int $pagenum
524          * @param int $per_page
525          */
526         private function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
527
528                 if ( ! isset( $children_pages[$parent] ) )
529                         return;
530
531                 $start = ( $pagenum - 1 ) * $per_page;
532                 $end = $start + $per_page;
533
534                 foreach ( $children_pages[$parent] as $page ) {
535
536                         if ( $count >= $end )
537                                 break;
538
539                         // If the page starts in a subtree, print the parents.
540                         if ( $count == $start && $page->post_parent > 0 ) {
541                                 $my_parents = array();
542                                 $my_parent = $page->post_parent;
543                                 while ( $my_parent ) {
544                                         $my_parent = get_post( $my_parent );
545                                         $my_parents[] = $my_parent;
546                                         if ( !$my_parent->post_parent )
547                                                 break;
548                                         $my_parent = $my_parent->post_parent;
549                                 }
550                                 $num_parents = count( $my_parents );
551                                 while ( $my_parent = array_pop( $my_parents ) ) {
552                                         echo "\t";
553                                         $this->single_row( $my_parent, $level - $num_parents );
554                                         $num_parents--;
555                                 }
556                         }
557
558                         if ( $count >= $start ) {
559                                 echo "\t";
560                                 $this->single_row( $page, $level );
561                         }
562
563                         $count++;
564
565                         $this->_page_rows( $children_pages, $count, $page->ID, $level + 1, $pagenum, $per_page );
566                 }
567
568                 unset( $children_pages[$parent] ); //required in order to keep track of orphans
569         }
570
571         /**
572          * @global string $mode
573          * @staticvar string $alternate
574          * @param WP_Post $post
575          * @param int $level
576          */
577         public function single_row( $post, $level = 0 ) {
578                 global $mode;
579                 static $alternate;
580
581                 $global_post = get_post();
582                 $GLOBALS['post'] = $post;
583                 setup_postdata( $post );
584
585                 $edit_link = get_edit_post_link( $post->ID );
586                 $title = _draft_or_post_title();
587                 $post_type_object = get_post_type_object( $post->post_type );
588                 $can_edit_post = current_user_can( 'edit_post', $post->ID );
589
590                 $alternate = 'alternate' == $alternate ? '' : 'alternate';
591                 $classes = $alternate . ' iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
592
593                 $lock_holder = wp_check_post_lock( $post->ID );
594                 if ( $lock_holder ) {
595                         $classes .= ' wp-locked';
596                         $lock_holder = get_userdata( $lock_holder );
597                 }
598
599                 if ( $post->post_parent ) {
600                     $count = count( get_post_ancestors( $post->ID ) );
601                     $classes .= ' level-'. $count;
602                 } else {
603                     $classes .= ' level-0';
604                 }
605         ?>
606                 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>">
607         <?php
608
609                 list( $columns, $hidden ) = $this->get_column_info();
610
611                 foreach ( $columns as $column_name => $column_display_name ) {
612                         $class = "class=\"$column_name column-$column_name\"";
613
614                         $style = '';
615                         if ( in_array( $column_name, $hidden ) )
616                                 $style = ' style="display:none;"';
617
618                         $attributes = "$class$style";
619
620                         switch ( $column_name ) {
621
622                         case 'cb':
623                         ?>
624                         <th scope="row" class="check-column">
625                                 <?php
626                                 if ( $can_edit_post ) {
627
628                                 ?>
629                                 <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php printf( __( 'Select %s' ), $title ); ?></label>
630                                 <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
631                                 <div class="locked-indicator"></div>
632                                 <?php
633                                 }
634                                 ?>
635                         </th>
636                         <?php
637                         break;
638
639                         case 'title':
640                                 $attributes = 'class="post-title page-title column-title"' . $style;
641                                 if ( $this->hierarchical_display ) {
642                                         if ( 0 == $level && (int) $post->post_parent > 0 ) {
643                                                 // Sent level 0 by accident, by default, or because we don't know the actual level.
644                                                 $find_main_page = (int) $post->post_parent;
645                                                 while ( $find_main_page > 0 ) {
646                                                         $parent = get_post( $find_main_page );
647
648                                                         if ( is_null( $parent ) )
649                                                                 break;
650
651                                                         $level++;
652                                                         $find_main_page = (int) $parent->post_parent;
653
654                                                         if ( !isset( $parent_name ) ) {
655                                                                 /** This filter is documented in wp-includes/post-template.php */
656                                                                 $parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
657                                                         }
658                                                 }
659                                         }
660                                 }
661
662                                 $pad = str_repeat( '&#8212; ', $level );
663                                 echo "<td $attributes><strong>";
664
665                                 if ( $format = get_post_format( $post->ID ) ) {
666                                         $label = get_post_format_string( $format );
667
668                                         echo '<a href="' . esc_url( add_query_arg( array( 'post_format' => $format, 'post_type' => $post->post_type ), 'edit.php' ) ) . '" class="post-state-format post-format-icon post-format-' . $format . '" title="' . $label . '">' . $label . ":</a> ";
669                                 }
670
671                                 if ( $can_edit_post && $post->post_status != 'trash' ) {
672                                         echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit &#8220;%s&#8221;' ), $title ) ) . '">' . $pad . $title . '</a>';
673                                 } else {
674                                         echo $pad . $title;
675                                 }
676                                 _post_states( $post );
677
678                                 if ( isset( $parent_name ) )
679                                         echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
680
681                                 echo "</strong>\n";
682
683                                 if ( $can_edit_post && $post->post_status != 'trash' ) {
684                                         if ( $lock_holder ) {
685                                                 $locked_avatar = get_avatar( $lock_holder->ID, 18 );
686                                                 $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
687                                         } else {
688                                                 $locked_avatar = $locked_text = '';
689                                         }
690
691                                         echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
692                                 }
693
694                                 if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
695                                                 the_excerpt();
696
697                                 $actions = array();
698                                 if ( $can_edit_post && 'trash' != $post->post_status ) {
699                                         $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr__( 'Edit this item' ) . '">' . __( 'Edit' ) . '</a>';
700                                         $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr__( 'Edit this item inline' ) . '">' . __( 'Quick&nbsp;Edit' ) . '</a>';
701                                 }
702                                 if ( current_user_can( 'delete_post', $post->ID ) ) {
703                                         if ( 'trash' == $post->post_status )
704                                                 $actions['untrash'] = "<a title='" . esc_attr__( 'Restore this item from the Trash' ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&amp;action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
705                                         elseif ( EMPTY_TRASH_DAYS )
706                                                 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr__( 'Move this item to the Trash' ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>";
707                                         if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS )
708                                                 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr__( 'Delete this item permanently' ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>";
709                                 }
710                                 if ( $post_type_object->public ) {
711                                         if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
712                                                 if ( $can_edit_post ) {
713                                                         $preview_link = set_url_scheme( get_permalink( $post->ID ) );
714                                                         /** This filter is documented in wp-admin/includes/meta-boxes.php */
715                                                         $preview_link = apply_filters( 'preview_post_link', add_query_arg( 'preview', 'true', $preview_link ), $post );
716                                                         $actions['view'] = '<a href="' . esc_url( $preview_link ) . '" title="' . esc_attr( sprintf( __( 'Preview &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
717                                                 }
718                                         } elseif ( 'trash' != $post->post_status ) {
719                                                 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View &#8220;%s&#8221;' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
720                                         }
721                                 }
722
723                                 if ( is_post_type_hierarchical( $post->post_type ) ) {
724
725                                         /**
726                                          * Filter the array of row action links on the Pages list table.
727                                          *
728                                          * The filter is evaluated only for hierarchical post types.
729                                          *
730                                          * @since 2.8.0
731                                          *
732                                          * @param array   $actions An array of row action links. Defaults are
733                                          *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
734                                          *                         'Delete Permanently', 'Preview', and 'View'.
735                                          * @param WP_Post $post    The post object.
736                                          */
737                                         $actions = apply_filters( 'page_row_actions', $actions, $post );
738                                 } else {
739
740                                         /**
741                                          * Filter the array of row action links on the Posts list table.
742                                          *
743                                          * The filter is evaluated only for non-hierarchical post types.
744                                          *
745                                          * @since 2.8.0
746                                          *
747                                          * @param array   $actions An array of row action links. Defaults are
748                                          *                         'Edit', 'Quick Edit', 'Restore, 'Trash',
749                                          *                         'Delete Permanently', 'Preview', and 'View'.
750                                          * @param WP_Post $post    The post object.
751                                          */
752                                         $actions = apply_filters( 'post_row_actions', $actions, $post );
753                                 }
754
755                                 echo $this->row_actions( $actions );
756
757                                 get_inline_data( $post );
758                                 echo '</td>';
759                         break;
760
761                         case 'date':
762                                 if ( '0000-00-00 00:00:00' == $post->post_date ) {
763                                         $t_time = $h_time = __( 'Unpublished' );
764                                         $time_diff = 0;
765                                 } else {
766                                         $t_time = get_the_time( __( 'Y/m/d g:i:s A' ) );
767                                         $m_time = $post->post_date;
768                                         $time = get_post_time( 'G', true, $post );
769
770                                         $time_diff = time() - $time;
771
772                                         if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
773                                                 $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
774                                         else
775                                                 $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
776                                 }
777
778                                 echo '<td ' . $attributes . '>';
779                                 if ( 'excerpt' == $mode ) {
780
781                                         /**
782                                          * Filter the published time of the post.
783                                          *
784                                          * If $mode equals 'excerpt', the published time and date are both displayed.
785                                          * If $mode equals 'list' (default), the publish date is displayed, with the
786                                          * time and date together available as an abbreviation definition.
787                                          *
788                                          * @since 2.5.1
789                                          *
790                                          * @param array   $t_time      The published time.
791                                          * @param WP_Post $post        Post object.
792                                          * @param string  $column_name The column name.
793                                          * @param string  $mode        The list display mode ('excerpt' or 'list').
794                                          */
795                                         echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
796                                 } else {
797
798                                         /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
799                                         echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
800                                 }
801                                 echo '<br />';
802                                 if ( 'publish' == $post->post_status ) {
803                                         _e( 'Published' );
804                                 } elseif ( 'future' == $post->post_status ) {
805                                         if ( $time_diff > 0 )
806                                                 echo '<strong class="attention">' . __( 'Missed schedule' ) . '</strong>';
807                                         else
808                                                 _e( 'Scheduled' );
809                                 } else {
810                                         _e( 'Last Modified' );
811                                 }
812                                 echo '</td>';
813                         break;
814
815                         case 'comments':
816                         ?>
817                         <td <?php echo $attributes ?>><div class="post-com-count-wrapper">
818                         <?php
819                                 $pending_comments = isset( $this->comment_pending_count[$post->ID] ) ? $this->comment_pending_count[$post->ID] : 0;
820
821                                 $this->comments_bubble( $post->ID, $pending_comments );
822                         ?>
823                         </div></td>
824                         <?php
825                         break;
826
827                         case 'author':
828                         ?>
829                         <td <?php echo $attributes ?>><?php
830                                 printf( '<a href="%s">%s</a>',
831                                         esc_url( add_query_arg( array( 'post_type' => $post->post_type, 'author' => get_the_author_meta( 'ID' ) ), 'edit.php' )),
832                                         get_the_author()
833                                 );
834                         ?></td>
835                         <?php
836                         break;
837
838                         default:
839                                 if ( 'categories' == $column_name )
840                                         $taxonomy = 'category';
841                                 elseif ( 'tags' == $column_name )
842                                         $taxonomy = 'post_tag';
843                                 elseif ( 0 === strpos( $column_name, 'taxonomy-' ) )
844                                         $taxonomy = substr( $column_name, 9 );
845                                 else
846                                         $taxonomy = false;
847
848                                 if ( $taxonomy ) {
849                                         $taxonomy_object = get_taxonomy( $taxonomy );
850                                         echo '<td ' . $attributes . '>';
851                                         if ( $terms = get_the_terms( $post->ID, $taxonomy ) ) {
852                                                 $out = array();
853                                                 foreach ( $terms as $t ) {
854                                                         $posts_in_term_qv = array();
855                                                         if ( 'post' != $post->post_type )
856                                                                 $posts_in_term_qv['post_type'] = $post->post_type;
857                                                         if ( $taxonomy_object->query_var ) {
858                                                                 $posts_in_term_qv[ $taxonomy_object->query_var ] = $t->slug;
859                                                         } else {
860                                                                 $posts_in_term_qv['taxonomy'] = $taxonomy;
861                                                                 $posts_in_term_qv['term'] = $t->slug;
862                                                         }
863
864                                                         $out[] = sprintf( '<a href="%s">%s</a>',
865                                                                 esc_url( add_query_arg( $posts_in_term_qv, 'edit.php' ) ),
866                                                                 esc_html( sanitize_term_field( 'name', $t->name, $t->term_id, $taxonomy, 'display' ) )
867                                                         );
868                                                 }
869                                                 /* translators: used between list items, there is a space after the comma */
870                                                 echo join( __( ', ' ), $out );
871                                         } else {
872                                                 echo '&#8212;';
873                                         }
874                                         echo '</td>';
875                                         break;
876                                 }
877                         ?>
878                         <td <?php echo $attributes ?>><?php
879                                 if ( is_post_type_hierarchical( $post->post_type ) ) {
880
881                                         /**
882                                          * Fires in each custom column on the Posts list table.
883                                          *
884                                          * This hook only fires if the current post type is hierarchical,
885                                          * such as pages.
886                                          *
887                                          * @since 2.5.0
888                                          *
889                                          * @param string $column_name The name of the column to display.
890                                          * @param int    $post_id     The current post ID.
891                                          */
892                                         do_action( 'manage_pages_custom_column', $column_name, $post->ID );
893                                 } else {
894
895                                         /**
896                                          * Fires in each custom column in the Posts list table.
897                                          *
898                                          * This hook only fires if the current post type is non-hierarchical,
899                                          * such as posts.
900                                          *
901                                          * @since 1.5.0
902                                          *
903                                          * @param string $column_name The name of the column to display.
904                                          * @param int    $post_id     The current post ID.
905                                          */
906                                         do_action( 'manage_posts_custom_column', $column_name, $post->ID );
907                                 }
908
909                                 /**
910                                  * Fires for each custom column of a specific post type in the Posts list table.
911                                  *
912                                  * The dynamic portion of the hook name, `$post->post_type`, refers to the post type.
913                                  *
914                                  * @since 3.1.0
915                                  *
916                                  * @param string $column_name The name of the column to display.
917                                  * @param int    $post_id     The current post ID.
918                                  */
919                                 do_action( "manage_{$post->post_type}_posts_custom_column", $column_name, $post->ID );
920                         ?></td>
921                         <?php
922                         break;
923                         }
924                 }
925         ?>
926                 </tr>
927         <?php
928                 $GLOBALS['post'] = $global_post;
929         }
930
931         /**
932          * Outputs the hidden row displayed when inline editing
933          *
934          * @since 3.1.0
935          */
936         public function inline_edit() {
937                 global $mode;
938
939                 $screen = $this->screen;
940
941                 $post = get_default_post_to_edit( $screen->post_type );
942                 $post_type_object = get_post_type_object( $screen->post_type );
943
944                 $taxonomy_names = get_object_taxonomies( $screen->post_type );
945                 $hierarchical_taxonomies = array();
946                 $flat_taxonomies = array();
947                 foreach ( $taxonomy_names as $taxonomy_name ) {
948                         $taxonomy = get_taxonomy( $taxonomy_name );
949
950                         if ( !$taxonomy->show_ui )
951                                 continue;
952
953                         if ( $taxonomy->hierarchical )
954                                 $hierarchical_taxonomies[] = $taxonomy;
955                         else
956                                 $flat_taxonomies[] = $taxonomy;
957                 }
958
959                 $m = ( isset( $mode ) && 'excerpt' == $mode ) ? 'excerpt' : 'list';
960                 $can_publish = current_user_can( $post_type_object->cap->publish_posts );
961                 $core_columns = array( 'cb' => true, 'date' => true, 'title' => true, 'categories' => true, 'tags' => true, 'comments' => true, 'author' => true );
962
963         ?>
964
965         <form method="get" action=""><table style="display: none"><tbody id="inlineedit">
966                 <?php
967                 $hclass = count( $hierarchical_taxonomies ) ? 'post' : 'page';
968                 $bulk = 0;
969                 while ( $bulk < 2 ) { ?>
970
971                 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-" . $screen->post_type;
972                         echo $bulk ? " bulk-edit-row bulk-edit-row-$hclass bulk-edit-{$screen->post_type}" : " quick-edit-row quick-edit-row-$hclass inline-edit-{$screen->post_type}";
973                 ?>" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange">
974
975                 <fieldset class="inline-edit-col-left"><div class="inline-edit-col">
976                         <h4><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></h4>
977         <?php
978
979         if ( post_type_supports( $screen->post_type, 'title' ) ) :
980                 if ( $bulk ) : ?>
981                         <div id="bulk-title-div">
982                                 <div id="bulk-titles"></div>
983                         </div>
984
985         <?php else : // $bulk ?>
986
987                         <label>
988                                 <span class="title"><?php _e( 'Title' ); ?></span>
989                                 <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span>
990                         </label>
991
992                         <label>
993                                 <span class="title"><?php _e( 'Slug' ); ?></span>
994                                 <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span>
995                         </label>
996
997         <?php endif; // $bulk
998         endif; // post_type_supports title ?>
999
1000         <?php if ( !$bulk ) : ?>
1001                         <label><span class="title"><?php _e( 'Date' ); ?></span></label>
1002                         <div class="inline-edit-date">
1003                                 <?php touch_time( 1, 1, 0, 1 ); ?>
1004                         </div>
1005                         <br class="clear" />
1006         <?php endif; // $bulk
1007
1008                 if ( post_type_supports( $screen->post_type, 'author' ) ) :
1009                         $authors_dropdown = '';
1010
1011                         if ( is_super_admin() || current_user_can( $post_type_object->cap->edit_others_posts ) ) :
1012                                 $users_opt = array(
1013                                         'hide_if_only_one_author' => false,
1014                                         'who' => 'authors',
1015                                         'name' => 'post_author',
1016                                         'class'=> 'authors',
1017                                         'multi' => 1,
1018                                         'echo' => 0
1019                                 );
1020                                 if ( $bulk )
1021                                         $users_opt['show_option_none'] = __( '&mdash; No Change &mdash;' );
1022
1023                                 if ( $authors = wp_dropdown_users( $users_opt ) ) :
1024                                         $authors_dropdown  = '<label class="inline-edit-author">';
1025                                         $authors_dropdown .= '<span class="title">' . __( 'Author' ) . '</span>';
1026                                         $authors_dropdown .= $authors;
1027                                         $authors_dropdown .= '</label>';
1028                                 endif;
1029                         endif; // authors
1030         ?>
1031
1032         <?php if ( !$bulk ) echo $authors_dropdown;
1033         endif; // post_type_supports author
1034
1035         if ( !$bulk && $can_publish ) :
1036         ?>
1037
1038                         <div class="inline-edit-group">
1039                                 <label class="alignleft">
1040                                         <span class="title"><?php _e( 'Password' ); ?></span>
1041                                         <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span>
1042                                 </label>
1043
1044                                 <em style="margin:5px 10px 0 0" class="alignleft">
1045                                         <?php
1046                                         /* translators: Between password field and private checkbox on post quick edit interface */
1047                                         echo __( '&ndash;OR&ndash;' );
1048                                         ?>
1049                                 </em>
1050                                 <label class="alignleft inline-edit-private">
1051                                         <input type="checkbox" name="keep_private" value="private" />
1052                                         <span class="checkbox-title"><?php echo __( 'Private' ); ?></span>
1053                                 </label>
1054                         </div>
1055
1056         <?php endif; ?>
1057
1058                 </div></fieldset>
1059
1060         <?php if ( count( $hierarchical_taxonomies ) && !$bulk ) : ?>
1061
1062                 <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col">
1063
1064         <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
1065
1066                         <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
1067                         <input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
1068                         <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
1069                                 <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
1070                         </ul>
1071
1072         <?php endforeach; //$hierarchical_taxonomies as $taxonomy ?>
1073
1074                 </div></fieldset>
1075
1076         <?php endif; // count( $hierarchical_taxonomies ) && !$bulk ?>
1077
1078                 <fieldset class="inline-edit-col-right"><div class="inline-edit-col">
1079
1080         <?php
1081                 if ( post_type_supports( $screen->post_type, 'author' ) && $bulk )
1082                         echo $authors_dropdown;
1083
1084                 if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :
1085
1086                         if ( $post_type_object->hierarchical ) :
1087                 ?>
1088                         <label>
1089                                 <span class="title"><?php _e( 'Parent' ); ?></span>
1090         <?php
1091                 $dropdown_args = array(
1092                         'post_type'         => $post_type_object->name,
1093                         'selected'          => $post->post_parent,
1094                         'name'              => 'post_parent',
1095                         'show_option_none'  => __( 'Main Page (no parent)' ),
1096                         'option_none_value' => 0,
1097                         'sort_column'       => 'menu_order, post_title',
1098                 );
1099
1100                 if ( $bulk )
1101                         $dropdown_args['show_option_no_change'] =  __( '&mdash; No Change &mdash;' );
1102
1103                 /**
1104                  * Filter the arguments used to generate the Quick Edit page-parent drop-down.
1105                  *
1106                  * @since 2.7.0
1107                  *
1108                  * @see wp_dropdown_pages()
1109                  *
1110                  * @param array $dropdown_args An array of arguments.
1111                  */
1112                 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
1113
1114                 wp_dropdown_pages( $dropdown_args );
1115         ?>
1116                         </label>
1117
1118         <?php
1119                         endif; // hierarchical
1120
1121                         if ( !$bulk ) : ?>
1122
1123                         <label>
1124                                 <span class="title"><?php _e( 'Order' ); ?></span>
1125                                 <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
1126                         </label>
1127
1128         <?php   endif; // !$bulk
1129
1130                         if ( 'page' == $screen->post_type ) :
1131         ?>
1132
1133                         <label>
1134                                 <span class="title"><?php _e( 'Template' ); ?></span>
1135                                 <select name="page_template">
1136         <?php   if ( $bulk ) : ?>
1137                                         <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1138         <?php   endif; // $bulk ?>
1139                                 <?php
1140                                         /** This filter is documented in wp-admin/includes/meta-boxes.php */
1141                                         $default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'quick-edit' );
1142                                 ?>
1143                                         <option value="default"><?php echo esc_html( $default_title ); ?></option>
1144                                         <?php page_template_dropdown() ?>
1145                                 </select>
1146                         </label>
1147
1148         <?php
1149                         endif; // page post_type
1150                 endif; // page-attributes
1151         ?>
1152
1153         <?php if ( count( $flat_taxonomies ) && !$bulk ) : ?>
1154
1155         <?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
1156                 <?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?>
1157                         <label class="inline-edit-tags">
1158                                 <span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
1159                                 <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name )?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name )?>"></textarea>
1160                         </label>
1161                 <?php endif; ?>
1162
1163         <?php endforeach; //$flat_taxonomies as $taxonomy ?>
1164
1165         <?php endif; // count( $flat_taxonomies ) && !$bulk  ?>
1166
1167         <?php if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :
1168                 if ( $bulk ) : ?>
1169
1170                         <div class="inline-edit-group">
1171                 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
1172                         <label class="alignleft">
1173                                 <span class="title"><?php _e( 'Comments' ); ?></span>
1174                                 <select name="comment_status">
1175                                         <option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1176                                         <option value="open"><?php _e( 'Allow' ); ?></option>
1177                                         <option value="closed"><?php _e( 'Do not allow' ); ?></option>
1178                                 </select>
1179                         </label>
1180                 <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
1181                         <label class="alignright">
1182                                 <span class="title"><?php _e( 'Pings' ); ?></span>
1183                                 <select name="ping_status">
1184                                         <option value=""><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1185                                         <option value="open"><?php _e( 'Allow' ); ?></option>
1186                                         <option value="closed"><?php _e( 'Do not allow' ); ?></option>
1187                                 </select>
1188                         </label>
1189                 <?php endif; ?>
1190                         </div>
1191
1192         <?php else : // $bulk ?>
1193
1194                         <div class="inline-edit-group">
1195                         <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>
1196                                 <label class="alignleft">
1197                                         <input type="checkbox" name="comment_status" value="open" />
1198                                         <span class="checkbox-title"><?php _e( 'Allow Comments' ); ?></span>
1199                                 </label>
1200                         <?php endif; if ( post_type_supports( $screen->post_type, 'trackbacks' ) ) : ?>
1201                                 <label class="alignleft">
1202                                         <input type="checkbox" name="ping_status" value="open" />
1203                                         <span class="checkbox-title"><?php _e( 'Allow Pings' ); ?></span>
1204                                 </label>
1205                         <?php endif; ?>
1206                         </div>
1207
1208         <?php endif; // $bulk
1209         endif; // post_type_supports comments or pings ?>
1210
1211                         <div class="inline-edit-group">
1212                                 <label class="inline-edit-status alignleft">
1213                                         <span class="title"><?php _e( 'Status' ); ?></span>
1214                                         <select name="_status">
1215         <?php if ( $bulk ) : ?>
1216                                                 <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1217         <?php endif; // $bulk ?>
1218                                         <?php if ( $can_publish ) : // Contributors only get "Unpublished" and "Pending Review" ?>
1219                                                 <option value="publish"><?php _e( 'Published' ); ?></option>
1220                                                 <option value="future"><?php _e( 'Scheduled' ); ?></option>
1221         <?php if ( $bulk ) : ?>
1222                                                 <option value="private"><?php _e( 'Private' ) ?></option>
1223         <?php endif; // $bulk ?>
1224                                         <?php endif; ?>
1225                                                 <option value="pending"><?php _e( 'Pending Review' ); ?></option>
1226                                                 <option value="draft"><?php _e( 'Draft' ); ?></option>
1227                                         </select>
1228                                 </label>
1229
1230         <?php if ( 'post' == $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>
1231
1232         <?php   if ( $bulk ) : ?>
1233
1234                                 <label class="alignright">
1235                                         <span class="title"><?php _e( 'Sticky' ); ?></span>
1236                                         <select name="sticky">
1237                                                 <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1238                                                 <option value="sticky"><?php _e( 'Sticky' ); ?></option>
1239                                                 <option value="unsticky"><?php _e( 'Not Sticky' ); ?></option>
1240                                         </select>
1241                                 </label>
1242
1243         <?php   else : // $bulk ?>
1244
1245                                 <label class="alignleft">
1246                                         <input type="checkbox" name="sticky" value="sticky" />
1247                                         <span class="checkbox-title"><?php _e( 'Make this post sticky' ); ?></span>
1248                                 </label>
1249
1250         <?php   endif; // $bulk ?>
1251
1252         <?php endif; // 'post' && $can_publish && current_user_can( 'edit_others_cap' ) ?>
1253
1254                         </div>
1255
1256         <?php
1257
1258         if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) {
1259                 $post_formats = get_theme_support( 'post-formats' );
1260
1261                 ?>
1262                 <label class="alignleft" for="post_format">
1263                 <span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
1264                 <select name="post_format">
1265                         <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
1266                         <option value="0"><?php echo get_post_format_string( 'standard' ); ?></option>
1267                         <?php
1268
1269                         foreach ( $post_formats[0] as $format ) {
1270                                 ?>
1271                                 <option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option>
1272                                 <?php
1273                         }
1274
1275                         ?>
1276                 </select></label>
1277         <?php
1278
1279         }
1280
1281         ?>
1282
1283                 </div></fieldset>
1284
1285         <?php
1286                 list( $columns ) = $this->get_column_info();
1287
1288                 foreach ( $columns as $column_name => $column_display_name ) {
1289                         if ( isset( $core_columns[$column_name] ) )
1290                                 continue;
1291
1292                         if ( $bulk ) {
1293
1294                                 /**
1295                                  * Fires once for each column in Bulk Edit mode.
1296                                  *
1297                                  * @since 2.7.0
1298                                  *
1299                                  * @param string  $column_name Name of the column to edit.
1300                                  * @param WP_Post $post_type   The post type slug.
1301                                  */
1302                                 do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type );
1303                         } else {
1304
1305                                 /**
1306                                  * Fires once for each column in Quick Edit mode.
1307                                  *
1308                                  * @since 2.7.0
1309                                  *
1310                                  * @param string  $column_name Name of the column to edit.
1311                                  * @param WP_Post $post_type   The post type slug.
1312                                  */
1313                                 do_action( 'quick_edit_custom_box', $column_name, $screen->post_type );
1314                         }
1315
1316                 }
1317         ?>
1318                 <p class="submit inline-edit-save">
1319                         <a accesskey="c" href="#inline-edit" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></a>
1320                         <?php if ( ! $bulk ) {
1321                                 wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
1322                                 ?>
1323                                 <a accesskey="s" href="#inline-edit" class="button-primary save alignright"><?php _e( 'Update' ); ?></a>
1324                                 <span class="spinner"></span>
1325                         <?php } else {
1326                                 submit_button( __( 'Update' ), 'button-primary alignright', 'bulk_edit', false, array( 'accesskey' => 's' ) );
1327                         } ?>
1328                         <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
1329                         <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
1330                         <?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) { ?>
1331                                 <input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
1332                         <?php } ?>
1333                         <span class="error" style="display:none"></span>
1334                         <br class="clear" />
1335                 </p>
1336                 </td></tr>
1337         <?php
1338                 $bulk++;
1339                 }
1340 ?>
1341                 </tbody></table></form>
1342 <?php
1343         }
1344 }