Coding Standards: Improve code layout in `wp-admin/includes/class-wp-media-list-table.php`.
This allows for better readability and easier understanding of where each section opens and closes. Props laxman-prajapati, hansjovisyoast, audrasjb. Fixes #51014. Built from https://develop.svn.wordpress.org/trunk@49975 git-svn-id: http://core.svn.wordpress.org/trunk@49676 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
a817f47d30
commit
b88116d24f
|
@ -196,20 +196,20 @@ class WP_Media_List_Table extends WP_List_Table {
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
<div class="actions">
|
<div class="actions">
|
||||||
<?php
|
<?php
|
||||||
if ( ! $this->is_trash ) {
|
if ( ! $this->is_trash ) {
|
||||||
$this->months_dropdown( 'attachment' );
|
$this->months_dropdown( 'attachment' );
|
||||||
}
|
}
|
||||||
|
|
||||||
/** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
|
/** This action is documented in wp-admin/includes/class-wp-posts-list-table.php */
|
||||||
do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
|
do_action( 'restrict_manage_posts', $this->screen->post_type, $which );
|
||||||
|
|
||||||
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
|
submit_button( __( 'Filter' ), '', 'filter_action', false, array( 'id' => 'post-query-submit' ) );
|
||||||
|
|
||||||
if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
|
if ( $this->is_trash && current_user_can( 'edit_others_posts' ) && $this->has_items() ) {
|
||||||
submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
|
submit_button( __( 'Empty Trash' ), 'apply', 'delete_all', false );
|
||||||
}
|
}
|
||||||
?>
|
?>
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
@ -262,42 +262,43 @@ class WP_Media_List_Table extends WP_List_Table {
|
||||||
|
|
||||||
$this->screen->render_screen_reader_content( 'heading_views' );
|
$this->screen->render_screen_reader_content( 'heading_views' );
|
||||||
?>
|
?>
|
||||||
<div class="wp-filter">
|
<div class="wp-filter">
|
||||||
<div class="filter-items">
|
<div class="filter-items">
|
||||||
<?php $this->view_switcher( $mode ); ?>
|
<?php $this->view_switcher( $mode ); ?>
|
||||||
|
|
||||||
<label for="attachment-filter" class="screen-reader-text"><?php _e( 'Filter by type' ); ?></label>
|
<label for="attachment-filter" class="screen-reader-text"><?php _e( 'Filter by type' ); ?></label>
|
||||||
<select class="attachment-filters" name="attachment-filter" id="attachment-filter">
|
<select class="attachment-filters" name="attachment-filter" id="attachment-filter">
|
||||||
<?php
|
<?php
|
||||||
if ( ! empty( $views ) ) {
|
if ( ! empty( $views ) ) {
|
||||||
foreach ( $views as $class => $view ) {
|
foreach ( $views as $class => $view ) {
|
||||||
echo "\t$view\n";
|
echo "\t$view\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<?php
|
||||||
|
$this->extra_tablenav( 'bar' );
|
||||||
|
|
||||||
|
/** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
|
||||||
|
$views = apply_filters( "views_{$this->screen->id}", array() );
|
||||||
|
|
||||||
|
// Back compat for pre-4.0 view links.
|
||||||
|
if ( ! empty( $views ) ) {
|
||||||
|
echo '<ul class="filter-links">';
|
||||||
|
foreach ( $views as $class => $view ) {
|
||||||
|
echo "<li class='$class'>$view</li>";
|
||||||
|
}
|
||||||
|
echo '</ul>';
|
||||||
}
|
}
|
||||||
}
|
?>
|
||||||
?>
|
</div>
|
||||||
</select>
|
|
||||||
|
|
||||||
<?php
|
<div class="search-form">
|
||||||
$this->extra_tablenav( 'bar' );
|
<label for="media-search-input" class="media-search-input-label"><?php esc_html_e( 'Search' ); ?></label>
|
||||||
|
<input type="search" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>">
|
||||||
/** This filter is documented in wp-admin/inclues/class-wp-list-table.php */
|
</div>
|
||||||
$views = apply_filters( "views_{$this->screen->id}", array() );
|
</div>
|
||||||
|
|
||||||
// Back compat for pre-4.0 view links.
|
|
||||||
if ( ! empty( $views ) ) {
|
|
||||||
echo '<ul class="filter-links">';
|
|
||||||
foreach ( $views as $class => $view ) {
|
|
||||||
echo "<li class='$class'>$view</li>";
|
|
||||||
}
|
|
||||||
echo '</ul>';
|
|
||||||
}
|
|
||||||
?>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="search-form">
|
|
||||||
<label for="media-search-input" class="media-search-input-label"><?php esc_html_e( 'Search' ); ?></label>
|
|
||||||
<input type="search" id="media-search-input" class="search" name="s" value="<?php _admin_search_query(); ?>"></div>
|
|
||||||
</div>
|
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -512,14 +513,9 @@ class WP_Media_List_Table extends WP_List_Table {
|
||||||
$parent_type = get_post_type_object( $parent->post_type );
|
$parent_type = get_post_type_object( $parent->post_type );
|
||||||
|
|
||||||
if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) {
|
if ( $parent_type && $parent_type->show_ui && current_user_can( 'edit_post', $post->post_parent ) ) {
|
||||||
?>
|
printf( '<strong><a href="%s">%s</a></strong>', get_edit_post_link( $post->post_parent ), $title );
|
||||||
<strong><a href="<?php echo get_edit_post_link( $post->post_parent ); ?>">
|
|
||||||
<?php echo $title; ?></a></strong>
|
|
||||||
<?php
|
|
||||||
} elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) {
|
} elseif ( $parent_type && current_user_can( 'read_post', $post->post_parent ) ) {
|
||||||
?>
|
printf( '<strong>%s</strong>', $title );
|
||||||
<strong><?php echo $title; ?></strong>
|
|
||||||
<?php
|
|
||||||
} else {
|
} else {
|
||||||
_e( '(Private post)' );
|
_e( '(Private post)' );
|
||||||
}
|
}
|
||||||
|
@ -650,9 +646,8 @@ class WP_Media_List_Table extends WP_List_Table {
|
||||||
|
|
||||||
while ( have_posts() ) :
|
while ( have_posts() ) :
|
||||||
the_post();
|
the_post();
|
||||||
if (
|
if ( $this->is_trash && 'trash' !== $post->post_status
|
||||||
( $this->is_trash && 'trash' !== $post->post_status )
|
|| ! $this->is_trash && 'trash' === $post->post_status
|
||||||
|| ( ! $this->is_trash && 'trash' === $post->post_status )
|
|
||||||
) {
|
) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
*
|
*
|
||||||
* @global string $wp_version
|
* @global string $wp_version
|
||||||
*/
|
*/
|
||||||
$wp_version = '5.7-alpha-49974';
|
$wp_version = '5.7-alpha-49975';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||||
|
|
Loading…
Reference in New Issue