$post_type_object = get_post_type_object( $post_type );
if ( !current_user_can( $post_type_object->cap->edit_others_posts ) ) {
+ $exclude_states = get_post_stati( array( 'show_in_admin_all_list' => false ) );
$this->user_posts_count = $wpdb->get_var( $wpdb->prepare( "
SELECT COUNT( 1 ) FROM $wpdb->posts
- WHERE post_type = %s AND post_status NOT IN ( 'trash', 'auto-draft' )
+ WHERE post_type = %s AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' )
AND post_author = %d
", $post_type, get_current_user_id() ) );
if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) {
$sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) );
- $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status != 'trash' AND ID IN ($sticky_posts)", $post_type ) );
+ $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( "SELECT COUNT( 1 ) FROM $wpdb->posts WHERE post_type = %s AND post_status NOT IN ('trash', 'auto-draft') AND ID IN ($sticky_posts)", $post_type ) );
}
}
if ( $count >= $end )
break;
- if ( $count >= $start )
- echo "\t" . $this->single_row( $page, $level );
+ if ( $count >= $start ) {
+ echo "\t";
+ $this->single_row( $page, $level );
+ }
$count++;
foreach ( $orphans as $op ) {
if ( $count >= $end )
break;
- if ( $count >= $start )
- echo "\t" . $this->single_row( $op, 0 );
+
+ if ( $count >= $start ) {
+ echo "\t";
+ $this->single_row( $op, 0 );
+ }
+
$count++;
}
}
*
* @since 3.1.0 (Standalone function exists since 2.6.0)
*
- * @param unknown_type $children_pages
- * @param unknown_type $count
- * @param unknown_type $parent
- * @param unknown_type $level
- * @param unknown_type $pagenum
- * @param unknown_type $per_page
+ * @param array $children_pages
+ * @param int $count
+ * @param int $parent
+ * @param int $level
+ * @param int $pagenum
+ * @param int $per_page
*/
function _page_rows( &$children_pages, &$count, $parent, $level, $pagenum, $per_page ) {
}
$num_parents = count( $my_parents );
while ( $my_parent = array_pop( $my_parents ) ) {
- echo "\t" . $this->single_row( $my_parent, $level - $num_parents );
+ echo "\t";
+ $this->single_row( $my_parent, $level - $num_parents );
$num_parents--;
}
}
- if ( $count >= $start )
- echo "\t" . $this->single_row( $page, $level );
+ if ( $count >= $start ) {
+ echo "\t";
+ $this->single_row( $page, $level );
+ }
$count++;
$edit_link = get_edit_post_link( $post->ID );
$title = _draft_or_post_title();
$post_type_object = get_post_type_object( $post->post_type );
- $can_edit_post = current_user_can( $post_type_object->cap->edit_post, $post->ID );
+ $can_edit_post = current_user_can( 'edit_post', $post->ID );
$alternate = 'alternate' == $alternate ? '' : 'alternate';
$classes = $alternate . ' iedit author-' . ( get_current_user_id() == $post->post_author ? 'self' : 'other' );
+
+ $lock_holder = wp_check_post_lock( $post->ID );
+ if ( $lock_holder ) {
+ $classes .= ' wp-locked';
+ $lock_holder = get_userdata( $lock_holder );
+ }
?>
<tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>" valign="top">
<?php
case 'cb':
?>
<th scope="row" class="check-column">
- <?php if ( $can_edit_post ) { ?>
+ <?php
+ if ( $can_edit_post ) {
+
+ ?>
<label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"><?php printf( __( 'Select %s' ), $title ); ?></label>
<input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
- <?php } ?>
+ <div class="locked-indicator"></div>
+ <?php
+ }
+ ?>
</th>
<?php
break;
case 'title':
+ $attributes = 'class="post-title page-title column-title"' . $style;
if ( $this->hierarchical_display ) {
- $attributes = 'class="post-title page-title column-title"' . $style;
-
if ( 0 == $level && (int) $post->post_parent > 0 ) {
//sent level 0 by accident, by default, or because we don't know the actual level
$find_main_page = (int) $post->post_parent;
$level++;
$find_main_page = (int) $parent->post_parent;
- if ( !isset( $parent_name ) )
+ if ( !isset( $parent_name ) ) {
+ /** This filter is documented in wp-includes/post-template.php */
$parent_name = apply_filters( 'the_title', $parent->post_title, $parent->ID );
+ }
}
}
+ }
- $pad = str_repeat( '— ', $level );
-?>
- <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); echo isset( $parent_name ) ? ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ) : ''; ?></strong>
-<?php
+ $pad = str_repeat( '— ', $level );
+ echo "<td $attributes><strong>";
+
+ if ( $format = get_post_format( $post->ID ) ) {
+ $label = get_post_format_string( $format );
+
+ 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> ";
}
- else {
- $attributes = 'class="post-title page-title column-title"' . $style;
- $pad = str_repeat( '— ', $level );
-?>
- <td <?php echo $attributes ?>><strong><?php if ( $can_edit_post && $post->post_status != 'trash' ) { ?><a class="row-title" href="<?php echo $edit_link; ?>" title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ); ?>"><?php echo $pad; echo $title ?></a><?php } else { echo $pad; echo $title; }; _post_states( $post ); ?></strong>
-<?php
- if ( 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
- the_excerpt();
+ if ( $can_edit_post && $post->post_status != 'trash' ) {
+ echo '<a class="row-title" href="' . $edit_link . '" title="' . esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ) . '">' . $pad . $title . '</a>';
+ } else {
+ echo $pad . $title;
}
+ _post_states( $post );
+
+ if ( isset( $parent_name ) )
+ echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name );
+
+ echo "</strong>\n";
+
+ if ( $can_edit_post && $post->post_status != 'trash' ) {
+ if ( $lock_holder ) {
+ $locked_avatar = get_avatar( $lock_holder->ID, 18 );
+ $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
+ } else {
+ $locked_avatar = $locked_text = '';
+ }
+
+ echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
+ }
+
+ if ( ! $this->hierarchical_display && 'excerpt' == $mode && current_user_can( 'read_post', $post->ID ) )
+ the_excerpt();
$actions = array();
if ( $can_edit_post && 'trash' != $post->post_status ) {
$actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>';
$actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick Edit' ) . '</a>';
}
- if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) {
+ if ( current_user_can( 'delete_post', $post->ID ) ) {
if ( 'trash' == $post->post_status )
$actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-post_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>";
elseif ( EMPTY_TRASH_DAYS )
if ( $post_type_object->public ) {
if ( in_array( $post->post_status, array( 'pending', 'draft', 'future' ) ) ) {
if ( $can_edit_post )
- $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
+ $actions['view'] = '<a href="' . esc_url( apply_filters( 'preview_post_link', set_url_scheme( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) ) ) . '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . '" rel="permalink">' . __( 'Preview' ) . '</a>';
} elseif ( 'trash' != $post->post_status ) {
$actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>';
}
<?php if ( !$bulk ) echo $authors_dropdown;
endif; // post_type_supports author
- if ( !$bulk ) :
+ if ( !$bulk && $can_publish ) :
?>
<div class="inline-edit-group">
<?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>
- <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?>
- <span class="catshow"><?php _e( '[more]' ); ?></span>
- <span class="cathide" style="display:none;"><?php _e( '[less]' ); ?></span>
- </span>
+ <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
<input type="hidden" name="<?php echo ( $taxonomy->name == 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" />
<ul class="cat-checklist <?php echo esc_attr( $taxonomy->name )?>-checklist">
<?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ) ?>
</div>
- <?php if ( post_type_supports( $screen->post_type, 'post-formats' ) && current_theme_supports( 'post-formats' ) ) :
- $post_formats = get_theme_support( 'post-formats' );
- if ( isset( $post_formats[0] ) && is_array( $post_formats[0] ) ) :
- $all_post_formats = get_post_format_strings();
- unset( $all_post_formats['standard'] ); ?>
- <div class="inline-edit-group">
- <label class="alignleft" for="post_format">
- <span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
- <select name="post_format">
- <?php if ( $bulk ) : ?>
- <option value="-1"><?php _e( '— No Change —' ); ?></option>
- <?php endif; ?>
- <option value="0"><?php _ex( 'Standard', 'Post format' ); ?></option>
- <?php foreach ( $all_post_formats as $slug => $format ) :
- $unsupported = ! in_array( $slug, $post_formats[0] );
- if ( $bulk && $unsupported )
- continue;
- ?>
- <option value="<?php echo esc_attr( $slug ); ?>"<?php if ( $unsupported ) echo ' class="unsupported"'; ?>><?php echo esc_html( $format ); ?></option>
- <?php endforeach; ?>
- </select></label>
- </div>
- <?php endif; ?>
- <?php endif; // post-formats ?>
+ <?php
+
+ if ( $bulk && post_type_supports( $screen->post_type, 'post-formats' ) ) {
+ $all_post_formats = get_post_format_strings();
+
+ ?>
+ <label class="alignleft" for="post_format">
+ <span class="title"><?php _ex( 'Format', 'post format' ); ?></span>
+ <select name="post_format">
+ <option value="-1"><?php _e( '— No Change —' ); ?></option>
+ <?php
+
+ foreach ( $all_post_formats as $slug => $format ) {
+ ?>
+ <option value="<?php echo esc_attr( $slug ); ?>"><?php echo esc_html( $format ); ?></option>
+ <?php
+ }
+
+ ?>
+ </select></label>
+ <?php
+
+ }
+
+ ?>
</div></fieldset>
}
?>
<p class="submit inline-edit-save">
- <a accesskey="c" href="#inline-edit" title="<?php esc_attr_e( 'Cancel' ); ?>" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></a>
+ <a accesskey="c" href="#inline-edit" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></a>
<?php if ( ! $bulk ) {
wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
- $update_text = __( 'Update' );
?>
- <a accesskey="s" href="#inline-edit" title="<?php esc_attr_e( 'Update' ); ?>" class="button-primary save alignright"><?php echo esc_attr( $update_text ); ?></a>
+ <a accesskey="s" href="#inline-edit" class="button-primary save alignright"><?php _e( 'Update' ); ?></a>
<span class="spinner"></span>
<?php } else {
submit_button( __( 'Update' ), 'button-primary alignright', 'bulk_edit', false, array( 'accesskey' => 's' ) );
} ?>
<input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
<input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />
+ <?php if ( ! $bulk && ! post_type_supports( $screen->post_type, 'author' ) ) { ?>
+ <input type="hidden" name="post_author" value="<?php echo esc_attr( $post->post_author ); ?>" />
+ <?php } ?>
<span class="error" style="display:none"></span>
<br class="clear" />
</p>