Make WordPress Core

Ticket #51014: 51014-2.patch

File 51014-2.patch, 5.4 KB (added by hansjovisyoast, 3 years ago)
  • src/wp-admin/includes/class-wp-media-list-table.php

    diff --git a/src/wp-admin/includes/class-wp-media-list-table.php b/src/wp-admin/includes/class-wp-media-list-table.php
    index fdc26de6ea..145e77e589 100644
    a b class WP_Media_List_Table extends WP_List_Table { 
    196196                }
    197197                ?>
    198198                <div class="actions">
    199                 <?php
    200                 if ( ! $this->is_trash ) {
    201                         $this->months_dropdown( 'attachment' );
    202                 }
     199                        <?php
     200                        if ( ! $this->is_trash ) {
     201                                $this->months_dropdown( 'attachment' );
     202                        }
    203203
    204                 /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
    205                 do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
     204                        /** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
     205                        do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
    206206
    207                 submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
     207                        submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
    208208
    209                 if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
    210                         submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
    211                 }
    212                 ?>
     209                        if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
     210                                submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
     211                        }
     212                        ?>
    213213                </div>
    214214                <?php
    215215        }
    class WP_Media_List_Table extends WP_List_Table { 
    262262
    263263                $this->screen->render_screen_reader_content( 'heading_views' );
    264264                ?>
    265 <div class="wp-filter">
    266         <div class="filter-items">
    267                 <?php $this->view_switcher( $mode ); ?>
     265                <div class="wp-filter">
     266                        <div class="filter-items">
     267                                <?php $this->view_switcher( $mode ); ?>
     268
     269                                <label for="attachment-filter" class="screen-reader-text"><?php _e( 'Filter by type' ); ?></label>
     270                                <select class="attachment-filters" name="attachment-filter" id="attachment-filter">
     271                                        <?php
     272                                        if ( ! empty( $views ) ) {
     273                                                foreach ( $views as $class => $view ) {
     274                                                        echo "\t$view\n";
     275                                                }
     276                                        }
     277                                        ?>
     278                                </select>
    268279
    269                 <label for="attachment-filter" class="screen-reader-text"><?php _e( 'Filter by type' ); ?></label>
    270                 <select class="attachment-filters" name="attachment-filter" id="attachment-filter">
    271                         <?php
    272                         if ( ! empty( $views ) ) {
    273                                 foreach ( $views as $class => $view ) {
    274                                         echo "\t$view\n";
     280                                <?php
     281                                $this->extra_tablenav( 'bar' );
     282
     283                                /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
     284                                $views = apply_filters( "views_{$this->screen->id}", array() );
     285
     286                                // Back compat for pre-4.0 view links.
     287                                if ( ! empty( $views ) ) {
     288                                        echo '<ul class="filter-links">';
     289                                        foreach ( $views as $class => $view ) {
     290                                                echo "<li class='$class'>$view</li>";
     291                                        }
     292                                        echo '</ul>';
    275293                                }
    276                         }
    277                         ?>
    278                 </select>
    279 
    280                 <?php
    281                 $this->extra_tablenav( 'bar' );
    282 
    283                 /** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
    284                 $views = apply_filters( "views_{$this->screen->id}", array() );
    285 
    286                 // Back compat for pre-4.0 view links.
    287                 if ( ! empty( $views ) ) {
    288                         echo '<ul class="filter-links">';
    289                         foreach ( $views as $class => $view ) {
    290                                 echo "<li class='$class'>$view</li>";
    291                         }
    292                         echo '</ul>';
    293                 }
    294                 ?>
    295         </div>
     294                                ?>
     295                        </div>
    296296
    297         <div class="search-form">
    298                 <label for="media-search-input" class="media-search-input-label"><?php esc_html_e( 'Search' ); ?></label>
    299                 <input type="search" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div>
    300         </div>
     297                        <div class="search-form">
     298                                <label for="media-search-input" class="media-search-input-label"><?php esc_html_e( 'Search' ); ?></label>
     299                                <input type="search" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>">
     300                        </div>
     301                </div>
    301302                <?php
    302303        }
    303304
    class WP_Media_List_Table extends WP_List_Table { 
    433434                <p class="filename">
    434435                        <span class="screen-reader-text"><?php _e( 'File name:' ); ?> </span>
    435436                        <?php
    436                         $file = get_attached_file( $post->ID );
    437                         echo esc_html( wp_basename( $file ) );
     437                                $file = get_attached_file( $post->ID );
     438                                echo esc_html( wp_basename( $file ) );
    438439                        ?>
    439440                </p>
    440441                <?php
    class WP_Media_List_Table extends WP_List_Table { 
    513514
    514515                        if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) {
    515516                                ?>
    516                                 <strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
    517                                         <?php echo $title; ?></a></strong>
    518                                                                 <?php
     517                                <strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>"><?php echo $title; ?></a></strong>
     518                                <?php
    519519                        } elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) {
    520520                                ?>
    521521                                <strong><?php echo $title; ?></strong>
    522                                                                         <?php
     522                                <?php
    523523                        } else {
    524524                                _e( '(Private post)' );
    525525                        }
    class WP_Media_List_Table extends WP_List_Table { 
    650650
    651651                while ( have_posts() ) :
    652652                        the_post();
    653                         if (
    654                                 ( $this->is_trash && 'trash' !== $post->post_status )
    655                                 || ( ! $this->is_trash && 'trash' === $post->post_status )
    656                         ) {
     653                        if ( ( $this->is_trash && 'trash' !== $post->post_status ) || ( ! $this->is_trash && 'trash' === $post->post_status ) ) {
    657654                                continue;
    658655                        }
    659656                        $post_owner = ( get_current_user_id() == $post->post_author ) ? 'self' : 'other';