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