Ticket #18664: 18664.diff
File 18664.diff, 12.8 KB (added by , 13 years ago) |
---|
-
wp-admin/includes/class-wp-posts-list-table.php
71 71 72 72 if ( 'post' == $post_type && $sticky_posts = get_option( 'sticky_posts' ) ) { 73 73 $sticky_posts = implode( ', ', array_map( 'absint', (array) $sticky_posts ) ); 74 $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 ) ); 74 75 $this->sticky_posts_count = $wpdb->get_var( $wpdb->prepare( " 76 SELECT COUNT( 1 ) FROM $wpdb->posts 77 WHERE post_type = %s AND post_status != 'trash' 78 AND ID IN ($sticky_posts) 79 ", $post_type ) ); 75 80 } 76 81 77 82 parent::__construct( array( … … 142 147 if ( $this->user_posts_count ) { 143 148 if ( isset( $_GET['author'] ) && ( $_GET['author'] == $current_user_id ) ) 144 149 $class = ' class="current"'; 145 $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>'; 150 151 $status_links['mine'] = "<a href='edit.php?post_type=$post_type&author=$current_user_id'$class>" . 152 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>'; 153 146 154 $allposts = '&all_posts=1'; 147 155 } 148 156 … … 153 161 $total_posts -= $num_posts->$state; 154 162 155 163 $class = empty( $class ) && empty( $_REQUEST['post_status'] ) && empty( $_REQUEST['show_sticky'] ) ? ' class="current"' : ''; 156 $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>'; 164 $status_links['all'] = "<a href='edit.php?post_type=$post_type{$allposts}'$class>" . 165 sprintf( _nx( 'All <span class="count">(%s)</span>', 'All <span class="count">(%s)</span>', $total_posts, 'posts' ), number_format_i18n( $total_posts ) ) . '</a>'; 157 166 158 167 foreach ( get_post_stati(array('show_in_admin_status_list' => true), 'objects') as $status ) { 159 168 $class = ''; … … 169 178 if ( isset($_REQUEST['post_status']) && $status_name == $_REQUEST['post_status'] ) 170 179 $class = ' class="current"'; 171 180 172 $status_links[$status_name] = "<a href='edit.php?post_status=$status_name&post_type=$post_type'$class>" . sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>'; 181 $status_links[$status_name] = "<a href='edit.php?post_status=$status_name&post_type=$post_type'$class>" . 182 sprintf( translate_nooped_plural( $status->label_count, $num_posts->$status_name ), number_format_i18n( $num_posts->$status_name ) ) . '</a>'; 173 183 } 174 184 175 185 if ( ! empty( $this->sticky_posts_count ) ) { … … 289 299 $posts_columns = apply_filters( 'manage_pages_columns', $posts_columns ); 290 300 else 291 301 $posts_columns = apply_filters( 'manage_posts_columns', $posts_columns, $post_type ); 302 292 303 $posts_columns = apply_filters( "manage_{$post_type}_posts_columns", $posts_columns ); 293 304 294 305 return $posts_columns; … … 479 490 $post_format = get_post_format( $post->ID ); 480 491 $post_format_class = ( $post_format && !is_wp_error($post_format) ) ? 'format-' . sanitize_html_class( $post_format ) : 'format-default'; 481 492 ?> 482 <tr id='post-<?php echo $post->ID; ?>' class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status . ' ' . $post_format_class); ?> iedit' valign="top"> 493 <tr id='post-<?php echo $post->ID; ?>' 494 class='<?php echo trim( $rowclass . ' author-' . $post_owner . ' status-' . $post->post_status . ' ' . $post_format_class); ?> iedit' 495 valign="top"> 483 496 <?php 484 497 485 498 list( $columns, $hidden ) = $this->get_column_info(); … … 497 510 498 511 case 'cb': 499 512 ?> 500 <th scope="row" class="check-column"><?php if ( $can_edit_post ) { ?><input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /><?php } ?></th> 513 <th scope="row" class="check-column"> 514 <?php if ( $can_edit_post ) { ?> 515 <input type="checkbox" name="post[]" value="<?php the_ID(); ?>" /> 516 <?php } ?></th> 501 517 <?php 502 518 break; 503 519 … … 523 539 } 524 540 525 541 $pad = str_repeat( '— ', $level ); 526 ?> 527 <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> 528 <?php 542 } else { 543 $pad = ''; 529 544 } 530 else { 531 $attributes = 'class="post-title page-title column-title"' . $style; 532 ?> 533 <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 $title ?></a><?php } else { echo $title; }; _post_states( $post ); ?></strong> 534 <?php 535 if ( 'excerpt' == $mode ) { 545 ?> 546 <td <?php echo $attributes ?>><strong><?php 547 if ( $can_edit_post && $post->post_status != 'trash' ) : ?> 548 <a class="row-title" href="<?php echo $edit_link; ?>" 549 title="<?php echo esc_attr( sprintf( __( 'Edit “%s”' ), $title ) ); ?>"> 550 <?php echo $pad . $title; ?></a> 551 <?php 552 else : 553 echo $pad . $title; 554 endif; 555 _post_states( $post ); 556 if ( $this->hierarchical_display ) { 557 if ( isset( $parent_name ) ) 558 echo ' | ' . $post_type_object->labels->parent_item_colon . ' ' . esc_html( $parent_name ); 559 } elseif ( 'excerpt' == $mode ) { 536 560 the_excerpt(); 537 561 } 538 }562 ?></strong> 539 563 564 <?php 540 565 $actions = array(); 541 566 if ( $can_edit_post && 'trash' != $post->post_status ) { 542 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' . __( 'Edit' ) . '</a>'; 543 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline" title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . __( 'Quick Edit' ) . '</a>'; 567 $actions['edit'] = '<a href="' . get_edit_post_link( $post->ID, true ) . 568 '" title="' . esc_attr( __( 'Edit this item' ) ) . '">' 569 . __( 'Edit' ) . '</a>'; 570 571 $actions['inline hide-if-no-js'] = '<a href="#" class="editinline"' . 572 ' title="' . esc_attr( __( 'Edit this item inline' ) ) . '">' . 573 __( 'Quick Edit' ) . '</a>'; 544 574 } 545 575 if ( current_user_can( $post_type_object->cap->delete_post, $post->ID ) ) { 546 576 if ( 'trash' == $post->post_status ) 547 $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_type . '_' . $post->ID ) . "'>" . __( 'Restore' ) . "</a>"; 577 $actions['untrash'] = "<a title='" . esc_attr( __( 'Restore this item from the Trash' ) ) . 578 "' href='" . wp_nonce_url( admin_url( sprintf( $post_type_object->_edit_link . '&action=untrash', $post->ID ) ), 'untrash-' . $post->post_type . '_' . $post->ID ) . "'>" 579 . __( 'Restore' ) . "</a>"; 580 548 581 elseif ( EMPTY_TRASH_DAYS ) 549 $actions['trash'] = "<a class='submitdelete' title='" . esc_attr( __( 'Move this item to the Trash' ) ) . "' href='" . get_delete_post_link( $post->ID ) . "'>" . __( 'Trash' ) . "</a>"; 582 $actions['trash'] = "<a class='submitdelete'" . 583 " title='" . esc_attr( __( 'Move this item to the Trash' ) ) . 584 "' href='" . get_delete_post_link( $post->ID ) . "'>" . 585 __( 'Trash' ) . "</a>"; 586 550 587 if ( 'trash' == $post->post_status || !EMPTY_TRASH_DAYS ) 551 $actions['delete'] = "<a class='submitdelete' title='" . esc_attr( __( 'Delete this item permanently' ) ) . "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . __( 'Delete Permanently' ) . "</a>"; 588 $actions['delete'] = "<a class='submitdelete'" . 589 "title='" . esc_attr( __( 'Delete this item permanently' ) ) . 590 "' href='" . get_delete_post_link( $post->ID, '', true ) . "'>" . 591 __( 'Delete Permanently' ) . "</a>"; 552 592 } 553 593 if ( $post_type_object->public ) { 554 594 if ( in_array( $post->post_status, array( 'pending', 'draft' ) ) ) { 555 595 if ( $can_edit_post ) 556 $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>'; 596 $actions['view'] = '<a href="' . esc_url( add_query_arg( 'preview', 'true', get_permalink( $post->ID ) ) ) . 597 '" title="' . esc_attr( sprintf( __( 'Preview “%s”' ), $title ) ) . 598 '" rel="permalink">' . 599 __( 'Preview' ) . '</a>'; 600 557 601 } elseif ( 'trash' != $post->post_status ) { 558 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . '" rel="permalink">' . __( 'View' ) . '</a>'; 602 $actions['view'] = '<a href="' . get_permalink( $post->ID ) . 603 '" title="' . esc_attr( sprintf( __( 'View “%s”' ), $title ) ) . 604 '" rel="permalink">' . 605 __( 'View' ) . '</a>'; 559 606 } 560 607 } 561 608 … … 724 771 $bulk = 0; 725 772 while ( $bulk < 2 ) { ?> 726 773 727 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type "; 774 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" 775 class="inline-edit-row inline-edit-row-<?php echo "$hclass inline-edit-$screen->post_type "; 728 776 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"; 729 777 ?>" style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> 730 778 … … 742 790 743 791 <label> 744 792 <span class="title"><?php _e( 'Title' ); ?></span> 745 <span class="input-text-wrap"><input type="text" name="post_title" class="ptitle" value="" /></span> 793 <span class="input-text-wrap"> 794 <input type="text" name="post_title" class="ptitle" value="" /></span> 746 795 </label> 747 796 748 797 <label> 749 798 <span class="title"><?php _e( 'Slug' ); ?></span> 750 <span class="input-text-wrap"><input type="text" name="post_name" value="" /></span> 799 <span class="input-text-wrap"> 800 <input type="text" name="post_name" value="" /></span> 751 801 </label> 752 802 753 803 <?php endif; // $bulk … … 794 844 <div class="inline-edit-group"> 795 845 <label class="alignleft"> 796 846 <span class="title"><?php _e( 'Password' ); ?></span> 797 <span class="input-text-wrap"><input type="text" name="post_password" class="inline-edit-password-input" value="" /></span> 847 <span class="input-text-wrap"> 848 <input type="text" name="post_password" class="inline-edit-password-input" value="" /></span> 798 849 </label> 799 850 800 851 <em style="margin:5px 10px 0 0" class="alignleft"> … … 847 898 <label> 848 899 <span class="title"><?php _e( 'Parent' ); ?></span> 849 900 <?php 850 $dropdown_args = array( 'post_type' => $post_type_object->name, 'selected' => $post->post_parent, 'name' => 'post_parent', 'show_option_none' => __( 'Main Page (no parent)' ), 'option_none_value' => 0, 'sort_column'=> 'menu_order, post_title' ); 901 $dropdown_args = array( 902 'post_type' => $post_type_object->name, 903 'selected' => $post->post_parent, 904 'name' => 'post_parent', 905 'show_option_none' => __( 'Main Page (no parent)' ), 906 'option_none_value' => 0, 907 'sort_column'=> 'menu_order, post_title' 908 ); 909 851 910 if ( $bulk ) 852 911 $dropdown_args['show_option_no_change'] = __( '— No Change —' ); 912 853 913 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args ); 854 914 wp_dropdown_pages( $dropdown_args ); 855 915 ?> … … 862 922 863 923 <label> 864 924 <span class="title"><?php _e( 'Order' ); ?></span> 865 <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span> 925 <span class="input-text-wrap"> 926 <input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span> 866 927 </label> 867 928 868 929 <?php endif; // !$bulk