Make WordPress Core

Ticket #8592: 8592.patch

File 8592.patch, 5.2 KB (added by johnjamesjacoby, 12 years ago)

Refresh + combination of patches

  • wp-admin/includes/class-wp-posts-list-table.php

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

     
    556556function page_attributes_meta_box($post) {
    557557        $post_type_object = get_post_type_object($post->post_type);
    558558        if ( $post_type_object->hierarchical ) {
    559                 $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));
     559                if ( current_user_can( $post_type_object->cap->read_private_posts ) )
     560                        $post_status = array( 'publish', 'private' );
     561                else
     562                        $post_status = 'publish';
     563
     564                $pages = wp_dropdown_pages( array(
     565                        'post_type' => $post->post_type,
     566                        'exclude_tree' => $post->ID,
     567                        'selected' => $post->post_parent,
     568                        'name' => 'parent_id',
     569                        'show_option_none' => __( '(no parent)' ),
     570                        'sort_column'=> 'menu_order, post_title',
     571                        'echo' => 0,
     572                        'post_status' => $post_status
     573                ) );
    560574                if ( ! empty($pages) ) {
    561575?>
    562576<p><strong><?php _e('Parent') ?></strong></p>
  • wp-includes/post-template.php

     
    760760                'selected' => 0, 'echo' => 1,
    761761                'name' => 'page_id', 'id' => '',
    762762                'show_option_none' => '', 'show_option_no_change' => '',
    763                 'option_none_value' => ''
     763                'option_none_value' => '',
     764                'post_status' => 'publish'
    764765        );
    765766
    766767        $r = wp_parse_args( $args, $defaults );
     
    10941095         * @param array $args Uses 'selected' argument for selected page to set selected HTML attribute for option element.
    10951096         */
    10961097        function start_el(&$output, $page, $depth, $args) {
     1098                $post_states = array();
    10971099                $pad = str_repeat('&nbsp;', $depth * 3);
    10981100
    10991101                $output .= "\t<option class=\"level-$depth\" value=\"$page->ID\"";
    11001102                if ( $page->ID == $args['selected'] )
    11011103                        $output .= ' selected="selected"';
    11021104                $output .= '>';
    1103                 $title = apply_filters( 'list_pages', $page->post_title );
     1105                $title = $page->post_title;
     1106
     1107                if ( !empty( $page->post_password ) )
     1108                        $post_states['protected'] = __( 'Password protected' );
     1109
     1110                if ( 'private' == $page->post_status )
     1111                        $post_states['private'] = __( 'Private' );
     1112
     1113                if ( 'draft' == $page->post_status )
     1114                        $post_states['draft'] = __( 'Draft' );
     1115
     1116                if ( 'pending' == $page->post_status )
     1117                        // translators: post state
     1118                        $post_states['pending'] = _x( 'Pending', 'post state' );
     1119
     1120                if ( is_sticky( $page->ID ) )
     1121                        $post_states['sticky'] = __( 'Sticky' );
     1122
     1123                $post_states = apply_filters( 'display_post_states', $post_states );
     1124
     1125                if ( ! empty( $post_states ) ) {
     1126                        $states = implode( ', ', $post_states );
     1127                        $title  = $title . sprintf( ' (%s)', $states );
     1128                }
     1129
     1130                $title = apply_filters( 'list_pages', $title );
     1131                $title = esc_html($title);
    11041132                $output .= $pad . esc_html( $title );
    11051133                $output .= "</option>\n";
    11061134        }
  • wp-includes/post.php

     
    33223322                return false;
    33233323
    33243324        // Make sure we have a valid post status
    3325         if ( !in_array($post_status, get_post_stati()) )
     3325        if ( !is_array( $post_status ) )
     3326                $post_status = explode( ',', $post_status );
     3327        if ( count( array_diff( $post_status, get_post_stati() ) ) )
    33263328                return false;
    33273329
    33283330        $cache = array();
     
    34173419        if ( $parent >= 0 )
    34183420                $where .= $wpdb->prepare(' AND post_parent = %d ', $parent);
    34193421
    3420         $where_post_type = $wpdb->prepare( "post_type = '%s' AND post_status = '%s'", $post_type, $post_status );
     3422        if ( 1 == count( $post_status ) ) {
     3423                $where_post_type = $wpdb->prepare( "post_type = %s AND post_status = %s", $post_type, array_shift( $post_status ) );
     3424        } else {
     3425                $post_status = implode( "', '", $post_status );
     3426                $where_post_type = $wpdb->prepare( "post_type = %s AND post_status IN ('$post_status')", $post_type );
     3427        }
    34213428
    34223429        $query = "SELECT * FROM $wpdb->posts $join WHERE ($where_post_type) $where ";
    34233430        $query .= $author_query;