Make WordPress Core

Ticket #8592: 8592.2.patch

File 8592.2.patch, 4.5 KB (added by SergeyBiryukov, 12 years ago)
  • wp-admin/includes/class-wp-posts-list-table.php

     
    847847                        <label>
    848848                                <span class="title"><?php _e( 'Parent' ); ?></span>
    849849        <?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' );
     850                if ( current_user_can( $post_type_object->cap->read_private_posts ) )
     851                        $post_status = array( 'publish', 'private' );
     852                else
     853                        $post_status = 'publish';
     854
     855                $dropdown_args = array(
     856                        'post_type'         => $post_type_object->name,
     857                        'selected'          => $post->post_parent,
     858                        'name'              => 'post_parent',
     859                        'show_option_none'  => __( 'Main Page (no parent)' ),
     860                        'option_none_value' => 0,
     861                        'sort_column'       => 'menu_order, post_title',
     862                        'post_status'       => $post_status
     863                );
     864
    851865                if ( $bulk )
    852866                        $dropdown_args['show_option_no_change'] =  __( '&mdash; No Change &mdash;' );
    853867                $dropdown_args = apply_filters( 'quick_edit_dropdown_pages_args', $dropdown_args );
  • wp-admin/includes/meta-boxes.php

     
    560560function page_attributes_meta_box($post) {
    561561        $post_type_object = get_post_type_object($post->post_type);
    562562        if ( $post_type_object->hierarchical ) {
    563                 $pages = wp_dropdown_pages(array('post_type' => $post->post_type, 'exclude_tree' => $post->ID, 'selected' => $post->post_parent, 'name' => 'parent_id', 'show_option_none' => __('(no parent)'), 'sort_column'=> 'menu_order, post_title', 'echo' => 0));
     563                if ( current_user_can( $post_type_object->cap->read_private_posts ) )
     564                        $post_status = array( 'publish', 'private' );
     565                else
     566                        $post_status = 'publish';
     567
     568                $dropdown_args = array(
     569                        'post_type'        => $post->post_type,
     570                        'exclude_tree'     => $post->ID,
     571                        'selected'         => $post->post_parent,
     572                        'name'             => 'parent_id',
     573                        'show_option_none' => __('(no parent)'),
     574                        'sort_column'      => 'menu_order, post_title',
     575                        'echo'             => 0,
     576                        'post_status'      => $post_status
     577                );
     578
     579                $dropdown_args = apply_filters( 'page_attributes_dropdown_pages_args', $dropdown_args );
     580                $pages = wp_dropdown_pages( $dropdown_args );
    564581                if ( ! empty($pages) ) {
    565582?>
    566583<p><strong><?php _e('Parent') ?></strong></p>
  • wp-includes/post-template.php

     
    765765                'selected' => 0, 'echo' => 1,
    766766                'name' => 'page_id', 'id' => '',
    767767                'show_option_none' => '', 'show_option_no_change' => '',
    768                 'option_none_value' => ''
     768                'option_none_value' => '',
     769                'post_status' => 'publish'
    769770        );
    770771
    771772        $r = wp_parse_args( $args, $defaults );
     
    10991100         * @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element.
    11001101         */
    11011102        function start_el(&$output, $page, $depth, $args) {
     1103                $post_states = array();
    11021104                $pad = str_repeat('&nbsp;', $depth * 3);
    11031105
    11041106                $output .= "\t<option class=\"level-$depth\" value=\"$page->ID\"";
    11051107                if ( $page->ID == $args['selected'] )
    11061108                        $output .= ' selected="selected"';
    11071109                $output .= '>';
    1108                 $title = apply_filters( 'list_pages', $page->post_title );
     1110
     1111                $title = $page->post_title;
     1112
     1113                if ( !empty( $page->post_password ) )
     1114                        $post_states['protected'] = __( 'Password protected' );
     1115
     1116                if ( 'private' == $page->post_status )
     1117                        $post_states['private'] = __( 'Private' );
     1118
     1119                if ( 'draft' == $page->post_status )
     1120                        $post_states['draft'] = __( 'Draft' );
     1121
     1122                if ( 'pending' == $page->post_status )
     1123                        // translators: post state
     1124                        $post_states['pending'] = _x( 'Pending', 'post state' );
     1125
     1126                if ( is_sticky( $page->ID ) )
     1127                        $post_states['sticky'] = __( 'Sticky' );
     1128
     1129                $post_states = apply_filters( 'display_post_states', $post_states );
     1130
     1131                if ( ! empty( $post_states ) ) {
     1132                        $states = implode( ', ', $post_states );
     1133                        $title  = $title . sprintf( ' (%s)', $states );
     1134                }
     1135
     1136                $title = apply_filters( 'list_pages', $title );
     1137
    11091138                $output .= $pad . esc_html( $title );
    11101139                $output .= "</option>\n";
    11111140        }