Changeset 59767 for trunk/src/wp-admin/includes/media.php
- Timestamp:
- 02/06/2025 12:22:22 PM (6 hours ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/includes/media.php
r59751 r59767 2846 2846 <div class="alignleft actions"> 2847 2847 <?php 2848 2849 $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"; 2850 2851 $arc_result = $wpdb->get_results( $arc_query ); 2852 2853 $month_count = count( $arc_result ); 2854 $selected_month = isset( $_GET['m'] ) ? $_GET['m'] : 0; 2855 2856 if ( $month_count && ! ( 1 == $month_count && 0 == $arc_result[0]->mmonth ) ) { 2848 $months = $wpdb->get_results( 2849 "SELECT DISTINCT YEAR( post_date ) AS year, MONTH( post_date ) AS month 2850 FROM $wpdb->posts 2851 WHERE post_type = 'attachment' 2852 ORDER BY post_date DESC" 2853 ); 2854 2855 $month_count = count( $months ); 2856 $selected_month = isset( $_GET['m'] ) ? (int) $_GET['m'] : 0; 2857 2858 if ( $month_count && ( 1 !== $month_count || 0 !== (int) $months[0]->month ) ) { 2857 2859 ?> 2858 2860 <select name='m'> 2859 <option<?php selected( $selected_month, 0 ); ?> value='0'><?php _e( 'All dates' ); ?></option>2861 <option<?php selected( $selected_month, 0 ); ?> value='0'><?php _e( 'All dates' ); ?></option> 2860 2862 <?php 2861 2862 foreach ( $arc_result as $arc_row ) { 2863 if ( 0 == $arc_row->yyear ) { 2863 foreach ( $months as $arc_row ) { 2864 if ( 0 === (int) $arc_row->year ) { 2864 2865 continue; 2865 2866 } 2866 2867 2867 $arc_row->mmonth = zeroise( $arc_row->mmonth, 2 ); 2868 2869 if ( $arc_row->yyear . $arc_row->mmonth == $selected_month ) { 2870 $default = ' selected="selected"'; 2871 } else { 2872 $default = ''; 2873 } 2874 2875 echo "<option$default value='" . esc_attr( $arc_row->yyear . $arc_row->mmonth ) . "'>"; 2876 echo esc_html( $wp_locale->get_month( $arc_row->mmonth ) . " $arc_row->yyear" ); 2877 echo "</option>\n"; 2878 } 2879 2868 $month = zeroise( $arc_row->month, 2 ); 2869 $year = $arc_row->year; 2870 2871 printf( 2872 "<option %s value='%s'>%s</option>\n", 2873 selected( $selected_month, $year . $month, false ), 2874 esc_attr( $year . $month ), 2875 /* translators: 1: Month name, 2: 4-digit year. */ 2876 esc_html( sprintf( __( '%1$s %2$d' ), $wp_locale->get_month( $month ), $year ) ) 2877 ); 2878 } 2880 2879 ?> 2881 2880 </select>
Note: See TracChangeset
for help on using the changeset viewer.