mirror of
https://github.com/WordPress/WordPress.git
synced 2025-03-12 14:49:55 +01:00
Coding Standards: Use strict comparison in media_upload_library_form()
.
Includes bringing some consistency with a similar fragment in `WP_List_Table::months_dropdown()`. Follow-up to [3724], [7062], [15491], [59755]. Props aristath, poena, afercia, SergeyBiryukov. See #62279. Built from https://develop.svn.wordpress.org/trunk@59767 git-svn-id: http://core.svn.wordpress.org/trunk@59109 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
38025026ac
commit
f548f56548
@ -780,9 +780,9 @@ class WP_List_Table {
|
||||
printf(
|
||||
"<option %s value='%s'>%s</option>\n",
|
||||
selected( $selected_month, $year . $month, false ),
|
||||
esc_attr( $arc_row->year . $month ),
|
||||
esc_attr( $year . $month ),
|
||||
/* translators: 1: Month name, 2: 4-digit year. */
|
||||
sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year )
|
||||
esc_html( sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year ) )
|
||||
);
|
||||
}
|
||||
?>
|
||||
|
@ -2845,38 +2845,37 @@ function media_upload_library_form( $errors ) {
|
||||
|
||||
<div class="alignleft actions">
|
||||
<?php
|
||||
$months = $wpdb->get_results(
|
||||
"SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month
|
||||
FROM $wpdb->posts
|
||||
WHERE post_type = 'attachment'
|
||||
ORDER BY post_date DESC"
|
||||
);
|
||||
|
||||
$arc_query = "SELECT DISTINCT YEAR(post_date) AS yyear, MONTH(post_date) AS mmonth FROM $wpdb->posts WHERE post_type = 'attachment' ORDER BY post_date DESC";
|
||||
$month_count = count( $months );
|
||||
$selected_month = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0;
|
||||
|
||||
$arc_result = $wpdb->get_results( $arc_query );
|
||||
|
||||
$month_count = count( $arc_result );
|
||||
$selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0;
|
||||
|
||||
if ( $month_count && ! ( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) {
|
||||
if ( $month_count && ( 1 !== $month_count || 0 !== (int) $months[0]->month ) ) {
|
||||
?>
|
||||
<select name='m'>
|
||||
<option<?php selected( $selected_month, 0 ); ?> value='0'><?php _e( 'All dates' ); ?></option>
|
||||
<option<?php selected( $selected_month, 0 ); ?> value='0'><?php _e( 'All dates' ); ?></option>
|
||||
<?php
|
||||
|
||||
foreach ( $arc_result as $arc_row ) {
|
||||
if ( 0 == $arc_row->yyear ) {
|
||||
foreach ( $months as $arc_row ) {
|
||||
if ( 0 === (int) $arc_row->year ) {
|
||||
continue;
|
||||
}
|
||||
|
||||
$arc_row->mmonth = zeroise( $arc_row->mmonth, 2 );
|
||||
$month = zeroise( $arc_row->month, 2 );
|
||||
$year = $arc_row->year;
|
||||
|
||||
if ( $arc_row->yyear . $arc_row->mmonth == $selected_month ) {
|
||||
$default = ' selected="selected"';
|
||||
} else {
|
||||
$default = '';
|
||||
}
|
||||
|
||||
echo "<option$default value='" . esc_attr( $arc_row->yyear . $arc_row->mmonth ) . "'>";
|
||||
echo esc_html( $wp_locale->get_month( $arc_row->mmonth ) . " $arc_row->yyear" );
|
||||
echo "</option>\n";
|
||||
printf(
|
||||
"<option %s value='%s'>%s</option>\n",
|
||||
selected( $selected_month, $year . $month, false ),
|
||||
esc_attr( $year . $month ),
|
||||
/* translators: 1: Month name, 2: 4-digit year. */
|
||||
esc_html( sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year ) )
|
||||
);
|
||||
}
|
||||
|
||||
?>
|
||||
</select>
|
||||
<?php } ?>
|
||||
|
@ -16,7 +16,7 @@
|
||||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '6.8-alpha-59766';
|
||||
$wp_version = '6.8-alpha-59767';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
Loading…
Reference in New Issue
Block a user