WordPress 4.7.2
[autoinstalls/wordpress.git] / wp-admin / includes / class-wp-posts-list-table.php
index 39c2d682680cf5ef7d284d8e242a8685be37bf14..4e1ba34f173ddd3228e3a1fd353bd801cf2874c4 100644 (file)
@@ -459,6 +459,7 @@ class WP_Posts_List_Table extends WP_List_Table {
                <div class="alignleft actions">
 <?php
                if ( 'top' === $which && !is_singular() ) {
+                       ob_start();
 
                        $this->months_dropdown( $this->screen->post_type );
                        $this->categories_dropdown( $this->screen->post_type );
@@ -479,7 +480,12 @@ class WP_Posts_List_Table extends WP_List_Table {
                         */
                        do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
 
-                       submit_button( __( 'Filter' ), 'button', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
+                       $output = ob_get_clean();
+
+                       if ( ! empty( $output ) ) {
+                               echo $output;
+                               submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
+                       }
                }
 
                if ( $this->is_trash && current_user_can( get_post_type_object( $this->screen->post_type )->cap->edit_others_posts ) ) {
@@ -829,7 +835,16 @@ class WP_Posts_List_Table extends WP_List_Table {
                                printf( __( 'Select %s' ), _draft_or_post_title() );
                        ?></label>
                        <input id="cb-select-<?php the_ID(); ?>" type="checkbox" name="post[]" value="<?php the_ID(); ?>" />
-                       <div class="locked-indicator"></div>
+                       <div class="locked-indicator">
+                               <span class="locked-indicator-icon" aria-hidden="true"></span>
+                               <span class="screen-reader-text"><?php
+                               printf(
+                                       /* translators: %s: post title */
+                                       __( '&#8220;%s&#8221; is locked' ),
+                                       _draft_or_post_title()
+                               );
+                               ?></span>
+                       </div>
                <?php endif;
        }
 
@@ -884,6 +899,22 @@ class WP_Posts_List_Table extends WP_List_Table {
                        }
                }
 
+               $can_edit_post = current_user_can( 'edit_post', $post->ID );
+
+               if ( $can_edit_post && $post->post_status != 'trash' ) {
+                       $lock_holder = wp_check_post_lock( $post->ID );
+
+                       if ( $lock_holder ) {
+                               $lock_holder = get_userdata( $lock_holder );
+                               $locked_avatar = get_avatar( $lock_holder->ID, 18 );
+                               $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
+                       } else {
+                               $locked_avatar = $locked_text = '';
+                       }
+
+                       echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
+               }
+
                $pad = str_repeat( '&#8212; ', $this->current_level );
                echo "<strong>";
 
@@ -901,7 +932,6 @@ class WP_Posts_List_Table extends WP_List_Table {
                        echo $this->get_edit_link( $format_args, $label . ':', $format_class );
                }
 
-               $can_edit_post = current_user_can( 'edit_post', $post->ID );
                $title = _draft_or_post_title();
 
                if ( $can_edit_post && $post->post_status != 'trash' ) {
@@ -924,20 +954,6 @@ class WP_Posts_List_Table extends WP_List_Table {
                }
                echo "</strong>\n";
 
-               if ( $can_edit_post && $post->post_status != 'trash' ) {
-                       $lock_holder = wp_check_post_lock( $post->ID );
-
-                       if ( $lock_holder ) {
-                               $lock_holder = get_userdata( $lock_holder );
-                               $locked_avatar = get_avatar( $lock_holder->ID, 18 );
-                               $locked_text = esc_html( sprintf( __( '%s is currently editing' ), $lock_holder->display_name ) );
-                       } else {
-                               $locked_avatar = $locked_text = '';
-                       }
-
-                       echo '<div class="locked-info"><span class="locked-avatar">' . $locked_avatar . '</span> <span class="locked-text">' . $locked_text . "</span></div>\n";
-               }
-
                if ( ! is_post_type_hierarchical( $this->screen->post_type ) && 'excerpt' === $mode && current_user_can( 'read_post', $post->ID ) ) {
                        echo esc_html( get_the_excerpt() );
                }
@@ -1522,38 +1538,38 @@ class WP_Posts_List_Table extends WP_List_Table {
                                <span class="input-text-wrap"><input type="text" name="menu_order" class="inline-edit-menu-order-input" value="<?php echo $post->menu_order ?>" /></span>
                        </label>
 
-       <?php   endif; // !$bulk
-
-                       if ( 'page' === $screen->post_type ) :
-       ?>
-
-                       <label>
-                               <span class="title"><?php _e( 'Template' ); ?></span>
-                               <select name="page_template">
-       <?php   if ( $bulk ) : ?>
-                                       <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
-       <?php   endif; // $bulk ?>
-                               <?php
-                                       /** This filter is documented in wp-admin/includes/meta-boxes.php */
-                                       $default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'quick-edit' );
-                               ?>
-                                       <option value="default"><?php echo esc_html( $default_title ); ?></option>
-                                       <?php page_template_dropdown() ?>
-                               </select>
-                       </label>
-
        <?php
-                       endif; // page post_type
+                       endif; // !$bulk
                endif; // page-attributes
        ?>
 
+       <?php if ( 0 < count( get_page_templates( null, $screen->post_type ) ) ) : ?>
+               <label>
+                       <span class="title"><?php _e( 'Template' ); ?></span>
+                       <select name="page_template">
+<?php  if ( $bulk ) : ?>
+                               <option value="-1"><?php _e( '&mdash; No Change &mdash;' ); ?></option>
+<?php  endif; // $bulk ?>
+                <?php
+                               /** This filter is documented in wp-admin/includes/meta-boxes.php */
+                               $default_title = apply_filters( 'default_page_template_title',  __( 'Default Template' ), 'quick-edit' );
+                ?>
+                               <option value="default"><?php echo esc_html( $default_title ); ?></option>
+                               <?php page_template_dropdown( '', $screen->post_type ) ?>
+                       </select>
+               </label>
+       <?php endif; ?>
+
        <?php if ( count( $flat_taxonomies ) && !$bulk ) : ?>
 
        <?php foreach ( $flat_taxonomies as $taxonomy ) : ?>
-               <?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) : ?>
+               <?php if ( current_user_can( $taxonomy->cap->assign_terms ) ) :
+                       $taxonomy_name = esc_attr( $taxonomy->name );
+
+                       ?>
                        <label class="inline-edit-tags">
                                <span class="title"><?php echo esc_html( $taxonomy->labels->name ) ?></span>
-                               <textarea cols="22" rows="1" name="tax_input[<?php echo esc_attr( $taxonomy->name )?>]" class="tax_input_<?php echo esc_attr( $taxonomy->name )?>"></textarea>
+                               <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>
                        </label>
                <?php endif; ?>
 
@@ -1713,14 +1729,14 @@ class WP_Posts_List_Table extends WP_List_Table {
                }
        ?>
                <p class="submit inline-edit-save">
-                       <button type="button" class="button-secondary cancel alignleft"><?php _e( 'Cancel' ); ?></button>
+                       <button type="button" class="button cancel alignleft"><?php _e( 'Cancel' ); ?></button>
                        <?php if ( ! $bulk ) {
                                wp_nonce_field( 'inlineeditnonce', '_inline_edit', false );
                                ?>
-                               <button type="button" class="button-primary save alignright"><?php _e( 'Update' ); ?></button>
+                               <button type="button" class="button button-primary save alignright"><?php _e( 'Update' ); ?></button>
                                <span class="spinner"></span>
                        <?php } else {
-                               submit_button( __( 'Update' ), 'button-primary alignright', 'bulk_edit', false );
+                               submit_button( __( 'Update' ), 'primary alignright', 'bulk_edit', false );
                        } ?>
                        <input type="hidden" name="post_view" value="<?php echo esc_attr( $m ); ?>" />
                        <input type="hidden" name="screen" value="<?php echo esc_attr( $screen->id ); ?>" />