- Timestamp:
- 08/17/2018 01:50:26 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/class-wp-posts-list-table.php
r42871 r43571 99 99 AND post_status NOT IN ( '" . implode( "','", $exclude_states ) . "' ) 100 100 AND post_author = %d 101 ", $post_type, get_current_user_id() 101 ", 102 $post_type, 103 get_current_user_id() 102 104 ) 103 105 ) … … 461 463 */ 462 464 protected function extra_tablenav( $which ) { 463 ?>465 ?> 464 466 <div class="alignleft actions"> 465 <?php466 if ( 'top' === $which && ! is_singular() ) {467 ob_start();468 469 $this->months_dropdown( $this->screen->post_type );470 $this->categories_dropdown( $this->screen->post_type );471 472 /**473 * Fires before the Filter button on the Posts and Pages list tables.474 *475 * The Filter button allows sorting by date and/or category on the476 * Posts list table, and sorting by date on the Pages list table.477 *478 * @since 2.1.0479 * @since 4.4.0 The `$post_type` parameter was added.480 * @since 4.6.0 The `$which` parameter was added.481 *482 * @param string $post_type The post type slug.483 * @param string $which The location of the extra table nav markup:484 * 'top' or 'bottom' for WP_Posts_List_Table,485 * 'bar' for WP_Media_List_Table.486 */487 do_action( 'restrict_manage_posts', $this->screen->post_type, $which );488 489 $output = ob_get_clean();490 491 if ( ! empty( $output ) ) {492 echo $output;493 submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );494 }495 }496 497 if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) && $this->has_items() ) {498 submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );499 }500 ?>467 <?php 468 if ( 'top' === $which && ! is_singular() ) { 469 ob_start(); 470 471 $this->months_dropdown( $this->screen->post_type ); 472 $this->categories_dropdown( $this->screen->post_type ); 473 474 /** 475 * Fires before the Filter button on the Posts and Pages list tables. 476 * 477 * The Filter button allows sorting by date and/or category on the 478 * Posts list table, and sorting by date on the Pages list table. 479 * 480 * @since 2.1.0 481 * @since 4.4.0 The `$post_type` parameter was added. 482 * @since 4.6.0 The `$which` parameter was added. 483 * 484 * @param string $post_type The post type slug. 485 * @param string $which The location of the extra table nav markup: 486 * 'top' or 'bottom' for WP_Posts_List_Table, 487 * 'bar' for WP_Media_List_Table. 488 */ 489 do_action( 'restrict_manage_posts', $this->screen->post_type, $which ); 490 491 $output = ob_get_clean(); 492 493 if ( ! empty( $output ) ) { 494 echo $output; 495 submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) ); 496 } 497 } 498 499 if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) && $this->has_items() ) { 500 submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false ); 501 } 502 ?> 501 503 </div> 502 <?php504 <?php 503 505 /** 504 506 * Fires immediately following the closing "actions" div in the tablenav for the posts … … 851 853 public function column_cb( $post ) { 852 854 if ( current_user_can( 'edit_post', $post->ID ) ) : 853 ?>855 ?> 854 856 <label class="screen-reader-text" for="cb-select-<?php the_ID(); ?>"> 855 857 <?php 856 858 printf( __( 'Select %s' ), _draft_or_post_title() ); 857 ?>859 ?> 858 860 </label> 859 861 <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" /> … … 870 872 </span> 871 873 </div> 872 <?php874 <?php 873 875 endif; 874 876 } … … 1220 1222 $classes .= ' level-0'; 1221 1223 } 1222 ?>1224 ?> 1223 1225 <tr id="post-<?php echo $post->ID; ?>" class="<?php echo implode( ' ', get_post_class( $classes, $post->ID ) ); ?>"> 1224 1226 <?php $this->single_row_columns( $post ); ?> 1225 1227 </tr> 1226 <?php1228 <?php 1227 1229 $GLOBALS['post'] = $global_post; 1228 1230 } … … 1418 1420 ); 1419 1421 1420 ?>1422 ?> 1421 1423 1422 1424 <form method="get"><table style="display: none"><tbody id="inlineedit"> … … 1429 1431 $bulk = 0; 1430 1432 while ( $bulk < 2 ) { 1431 ?>1433 ?> 1432 1434 1433 1435 <tr id="<?php echo $bulk ? 'bulk-edit' : 'inline-edit'; ?>" class=" … … 1435 1437 echo $inline_edit_classes . ' '; 1436 1438 echo $bulk ? $bulk_edit_classes : $quick_edit_classes; 1437 ?>1439 ?> 1438 1440 " style="display: none"><td colspan="<?php echo $this->get_column_count(); ?>" class="colspanchange"> 1439 1441 … … 1441 1443 <legend class="inline-edit-legend"><?php echo $bulk ? __( 'Bulk Edit' ) : __( 'Quick Edit' ); ?></legend> 1442 1444 <div class="inline-edit-col"> 1443 <?php1444 1445 if ( post_type_supports( $screen->post_type, 'title' ) ) :1446 if ( $bulk ) :1447 ?>1445 <?php 1446 1447 if ( post_type_supports( $screen->post_type, 'title' ) ) : 1448 if ( $bulk ) : 1449 ?> 1448 1450 <div id="bulk-title-div"> 1449 1451 <div id="bulk-titles"></div> 1450 1452 </div> 1451 1453 1452 <?php else : // $bulk ?>1454 <?php else : // $bulk ?> 1453 1455 1454 1456 <label> … … 1465 1467 endif; // $bulk 1466 1468 endif; // post_type_supports title 1467 ?>1468 1469 <?php if ( ! $bulk ) : ?>1469 ?> 1470 1471 <?php if ( ! $bulk ) : ?> 1470 1472 <fieldset class="inline-edit-date"> 1471 1473 <legend><span class="title"><?php _e( 'Date' ); ?></span></legend> … … 1473 1475 </fieldset> 1474 1476 <br class="clear" /> 1475 <?php1477 <?php 1476 1478 endif; // $bulk 1477 1479 … … 1532 1534 </div></fieldset> 1533 1535 1534 <?php if ( count( $hierarchical_taxonomies ) && ! $bulk ) : ?>1536 <?php if ( count( $hierarchical_taxonomies ) && ! $bulk ) : ?> 1535 1537 1536 1538 <fieldset class="inline-edit-col-center inline-edit-categories"><div class="inline-edit-col"> 1537 1539 1538 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?>1540 <?php foreach ( $hierarchical_taxonomies as $taxonomy ) : ?> 1539 1541 1540 1542 <span class="title inline-edit-categories-label"><?php echo esc_html( $taxonomy->labels->name ); ?></span> 1541 1543 <input type="hidden" name="<?php echo ( $taxonomy->name === 'category' ) ? 'post_category[]' : 'tax_input[' . esc_attr( $taxonomy->name ) . '][]'; ?>" value="0" /> 1542 1544 <ul class="cat-checklist <?php echo esc_attr( $taxonomy->name ); ?>-checklist"> 1543 <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ); ?>1545 <?php wp_terms_checklist( null, array( 'taxonomy' => $taxonomy->name ) ); ?> 1544 1546 </ul> 1545 1547 … … 1552 1554 <fieldset class="inline-edit-col-right"><div class="inline-edit-col"> 1553 1555 1554 <?php1555 if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) {1556 echo $authors_dropdown;1557 }1558 1559 if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) :1560 1561 if ( $post_type_object->hierarchical ) :1562 ?>1556 <?php 1557 if ( post_type_supports( $screen->post_type, 'author' ) && $bulk ) { 1558 echo $authors_dropdown; 1559 } 1560 1561 if ( post_type_supports( $screen->post_type, 'page-attributes' ) ) : 1562 1563 if ( $post_type_object->hierarchical ) : 1564 ?> 1563 1565 <label> 1564 1566 <span class="title"><?php _e( 'Parent' ); ?></span> 1565 <?php1566 $dropdown_args = array(1567 'post_type' => $post_type_object->name,1568 'selected' => $post->post_parent,1569 'name' => 'post_parent',1570 'show_option_none' => __( 'Main Page (no parent)' ),1571 'option_none_value' => 0,1572 'sort_column' => 'menu_order, post_title',1573 );1574 1575 if ( $bulk ) {1576 $dropdown_args['show_option_no_change'] = __( '— No Change —' );1577 }1578 1579 /**1580 * Filters the arguments used to generate the Quick Edit page-parent drop-down.1581 *1582 * @since 2.7.01583 *1584 * @see wp_dropdown_pages()1585 *1586 * @param array $dropdown_args An array of arguments.1587 */1588 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );1589 1590 wp_dropdown_pages( $dropdown_args );1591 ?>1567 <?php 1568 $dropdown_args = array( 1569 'post_type' => $post_type_object->name, 1570 'selected' => $post->post_parent, 1571 'name' => 'post_parent', 1572 'show_option_none' => __( 'Main Page (no parent)' ), 1573 'option_none_value' => 0, 1574 'sort_column' => 'menu_order, post_title', 1575 ); 1576 1577 if ( $bulk ) { 1578 $dropdown_args['show_option_no_change'] = __( '— No Change —' ); 1579 } 1580 1581 /** 1582 * Filters the arguments used to generate the Quick Edit page-parent drop-down. 1583 * 1584 * @since 2.7.0 1585 * 1586 * @see wp_dropdown_pages() 1587 * 1588 * @param array $dropdown_args An array of arguments. 1589 */ 1590 $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args ); 1591 1592 wp_dropdown_pages( $dropdown_args ); 1593 ?> 1592 1594 </label> 1593 1595 1594 <?php1595 endif; // hierarchical1596 1597 if ( ! $bulk ) :1598 ?>1596 <?php 1597 endif; // hierarchical 1598 1599 if ( ! $bulk ) : 1600 ?> 1599 1601 1600 1602 <label> … … 1603 1605 </label> 1604 1606 1605 <?php1606 endif; // !$bulk1607 <?php 1608 endif; // !$bulk 1607 1609 endif; // page-attributes 1608 ?>1609 1610 <?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?>1610 ?> 1611 1612 <?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?> 1611 1613 <label> 1612 1614 <span class="title"><?php _e( 'Template' ); ?></span> 1613 1615 <select name="page_template"> 1614 <?php if ( $bulk ) : ?>1616 <?php if ( $bulk ) : ?> 1615 1617 <option value="-1"><?php _e( '— No Change —' ); ?></option> 1616 <?php endif; // $bulk ?>1618 <?php endif; // $bulk ?> 1617 1619 <?php 1618 1620 /** This filter is documented in wp-admin/includes/meta-boxes.php */ … … 1625 1627 <?php endif; ?> 1626 1628 1627 <?php if ( count( $flat_taxonomies ) && ! $bulk ) : ?>1628 1629 <?php foreach ( $flat_taxonomies as $taxonomy ) : ?>1630 <?php1631 if ( current_user_can( $taxonomy->cap->assign_terms ) ) :1632 $taxonomy_name = esc_attr( $taxonomy->name );1633 1634 ?>1629 <?php if ( count( $flat_taxonomies ) && ! $bulk ) : ?> 1630 1631 <?php foreach ( $flat_taxonomies as $taxonomy ) : ?> 1632 <?php 1633 if ( current_user_can( $taxonomy->cap->assign_terms ) ) : 1634 $taxonomy_name = esc_attr( $taxonomy->name ); 1635 1636 ?> 1635 1637 <label class="inline-edit-tags"> 1636 1638 <span class="title"><?php echo esc_html( $taxonomy->labels->name ); ?></span> 1637 1639 <textarea data-wp-taxonomy="<?php echo $taxonomy_name; ?>" cols="22" rows="1" name="tax_input[<?php echo $taxonomy_name; ?>]" class="tax_input_<?php echo $taxonomy_name; ?>"></textarea> 1638 1640 </label> 1639 <?php endif; ?>1641 <?php endif; ?> 1640 1642 1641 1643 <?php endforeach; //$flat_taxonomies as $taxonomy ?> … … 1643 1645 <?php endif; // count( $flat_taxonomies ) && !$bulk ?> 1644 1646 1645 <?php1646 if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) :1647 if ( $bulk ) :1648 ?>1647 <?php 1648 if ( post_type_supports( $screen->post_type, 'comments' ) || post_type_supports( $screen->post_type, 'trackbacks' ) ) : 1649 if ( $bulk ) : 1650 ?> 1649 1651 1650 1652 <div class="inline-edit-group wp-clearfix"> 1651 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?>1653 <?php if ( post_type_supports( $screen->post_type, 'comments' ) ) : ?> 1652 1654 <label class="alignleft"> 1653 1655 <span class="title"><?php _e( 'Comments' ); ?></span> … … 1670 1672 </div> 1671 1673 1672 <?php else : // $bulk ?>1674 <?php else : // $bulk ?> 1673 1675 1674 1676 <div class="inline-edit-group wp-clearfix"> … … 1689 1691 endif; // $bulk 1690 1692 endif; // post_type_supports comments or pings 1691 ?>1693 ?> 1692 1694 1693 1695 <div class="inline-edit-group wp-clearfix"> … … 1695 1697 <span class="title"><?php _e( 'Status' ); ?></span> 1696 1698 <select name="_status"> 1697 <?php if ( $bulk ) : ?>1699 <?php if ( $bulk ) : ?> 1698 1700 <option value="-1"><?php _e( '— No Change —' ); ?></option> 1699 1701 <?php endif; // $bulk ?> … … 1701 1703 <option value="publish"><?php _e( 'Published' ); ?></option> 1702 1704 <option value="future"><?php _e( 'Scheduled' ); ?></option> 1703 <?php if ( $bulk ) : ?>1705 <?php if ( $bulk ) : ?> 1704 1706 <option value="private"><?php _e( 'Private' ); ?></option> 1705 1707 <?php endif; // $bulk ?> … … 1710 1712 </label> 1711 1713 1712 <?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?>1713 1714 <?php if ( $bulk ) : ?>1714 <?php if ( 'post' === $screen->post_type && $can_publish && current_user_can( $post_type_object->cap->edit_others_posts ) ) : ?> 1715 1716 <?php if ( $bulk ) : ?> 1715 1717 1716 1718 <label class="alignright"> … … 1736 1738 </div> 1737 1739 1738 <?php1739 1740 if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) {1741 $post_formats = get_theme_support( 'post-formats' );1742 1743 ?>1740 <?php 1741 1742 if ( $bulk && current_theme_supports( 'post-formats' ) && post_type_supports( $screen->post_type, 'post-formats' ) ) { 1743 $post_formats = get_theme_support( 'post-formats' ); 1744 1745 ?> 1744 1746 <label class="alignleft"> 1745 1747 <span class="title"><?php _ex( 'Format', 'post format' ); ?></span> … … 1747 1749 <option value="-1"><?php _e( '— No Change —' ); ?></option> 1748 1750 <option value="0"><?php echo get_post_format_string( 'standard' ); ?></option> 1751 <?php 1752 if ( is_array( $post_formats[0] ) ) { 1753 foreach ( $post_formats[0] as $format ) { 1754 ?> 1755 <option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option> 1756 <?php 1757 } 1758 } 1759 ?> 1760 </select></label> 1761 <?php 1762 1763 } 1764 1765 ?> 1766 1767 </div></fieldset> 1768 1749 1769 <?php 1750 if ( is_array( $post_formats[0] ) ) {1751 foreach ( $post_formats[0] as $format ) { 1752 ?>1753 <option value="<?php echo esc_attr( $format ); ?>"><?php echo esc_html( get_post_format_string( $format ) ); ?></option>1754 <?php1770 list( $columns ) = $this->get_column_info(); 1771 1772 foreach ( $columns as $column_name => $column_display_name ) { 1773 if ( isset( $core_columns[ $column_name ] ) ) { 1774 continue; 1755 1775 } 1776 1777 if ( $bulk ) { 1778 1779 /** 1780 * Fires once for each column in Bulk Edit mode. 1781 * 1782 * @since 2.7.0 1783 * 1784 * @param string $column_name Name of the column to edit. 1785 * @param WP_Post $post_type The post type slug. 1786 */ 1787 do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type ); 1788 } else { 1789 1790 /** 1791 * Fires once for each column in Quick Edit mode. 1792 * 1793 * @since 2.7.0 1794 * 1795 * @param string $column_name Name of the column to edit. 1796 * @param string $post_type The post type slug, or current screen name if this is a taxonomy list table. 1797 * @param string taxonomy The taxonomy name, if any. 1798 */ 1799 do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' ); 1800 } 1756 1801 } 1757 1802 ?> 1758 </select></label>1759 <?php1760 1761 }1762 1763 ?>1764 1765 </div></fieldset>1766 1767 <?php1768 list( $columns ) = $this->get_column_info();1769 1770 foreach ( $columns as $column_name => $column_display_name ) {1771 if ( isset( $core_columns[ $column_name ] ) ) {1772 continue;1773 }1774 1775 if ( $bulk ) {1776 1777 /**1778 * Fires once for each column in Bulk Edit mode.1779 *1780 * @since 2.7.01781 *1782 * @param string $column_name Name of the column to edit.1783 * @param WP_Post $post_type The post type slug.1784 */1785 do_action( 'bulk_edit_custom_box', $column_name, $screen->post_type );1786 } else {1787 1788 /**1789 * Fires once for each column in Quick Edit mode.1790 *1791 * @since 2.7.01792 *1793 * @param string $column_name Name of the column to edit.1794 * @param string $post_type The post type slug, or current screen name if this is a taxonomy list table.1795 * @param string taxonomy The taxonomy name, if any.1796 */1797 do_action( 'quick_edit_custom_box', $column_name, $screen->post_type, '' );1798 }1799 }1800 ?>1801 1803 <div class="submit inline-edit-save"> 1802 1804 <button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button> … … 1807 1809 <button type="button" class="button button-primary save alignright"><?php _e( 'Update' ); ?></button> 1808 1810 <span class="spinner"></span> 1809 <?php1811 <?php 1810 1812 } else { 1811 1813 submit_button( __( 'Update' ), 'primary alignright', 'bulk_edit', false ); … … 1823 1825 </div> 1824 1826 </td></tr> 1825 <?php1826 $bulk++;1827 } 1828 ?>1827 <?php 1828 $bulk++; 1829 } 1830 ?> 1829 1831 </tbody></table></form> 1830 <?php1832 <?php 1831 1833 } 1832 1834 }
Note: See TracChangeset
for help on using the changeset viewer.