WordPress.org

Make WordPress Core

Changeset 46578


Ignore:
Timestamp:
10/25/2019 12:49:40 PM (2 years ago)
Author:
SergeyBiryukov
Message:

Date/Time: Correct the logic in WP_Posts_List_Table::column_date() and WP_Media_List_Table::column_date() to check for a valid post timestamp.

Props Rarst.
Reviewed by azaozz, SergeyBiryukov.
See #48384.

Location:
trunk/src/wp-admin/includes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/class-wp-media-list-table.php

    r46418 r46578  
    453453            $h_time = __( 'Unpublished' );
    454454        } else {
    455             $m_time = $post->post_date;
    456             $time   = get_post_time( 'G', true, $post, false );
    457             $t_diff = time() - $time;
    458             if ( ( abs( $t_diff ) ) < DAY_IN_SECONDS ) {
    459                 if ( $t_diff < 0 ) {
    460                     /* translators: %s: Human-readable time difference. */
    461                     $h_time = sprintf( __( '%s from now' ), human_time_diff( $time ) );
    462                 } else {
    463                     /* translators: %s: Human-readable time difference. */
    464                     $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
    465                 }
     455            $time      = get_post_timestamp( $post );
     456            $time_diff = time() - $time;
     457
     458            if ( $time && $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
     459                /* translators: %s: Human-readable time difference. */
     460                $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
    466461            } else {
    467                 $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
     462                $h_time = get_the_time( __( 'Y/m/d' ), $post );
    468463            }
    469464        }
  • trunk/src/wp-admin/includes/class-wp-posts-list-table.php

    r45932 r46578  
    10671067            $time_diff = 0;
    10681068        } else {
    1069             $t_time = get_the_time( __( 'Y/m/d g:i:s a' ) );
    1070             $m_time = $post->post_date;
    1071             $time   = get_post_time( 'G', true, $post );
    1072 
     1069            $t_time    = get_the_time( __( 'Y/m/d g:i:s a' ), $post );
     1070            $time      = get_post_timestamp( $post );
    10731071            $time_diff = time() - $time;
    10741072
    1075             if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
     1073            if ( $time && $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
    10761074                /* translators: %s: Human-readable time difference. */
    10771075                $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
    10781076            } else {
    1079                 $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
     1077                $h_time = get_the_time( __( 'Y/m/d' ), $post );
    10801078            }
    10811079        }
     
    15841582                        $users_opt['show_option_none'] = __( '&mdash; No Change &mdash;' );
    15851583                    }
     1584
     1585                    /**
     1586                     * Filters the arguments used to generate the Quick Edit authors drop-down.
     1587                     *
     1588                     * @since 5.3.0
     1589                     *
     1590                     * @see wp_dropdown_users()
     1591                     *
     1592                     * @param array $users_opt An array of arguments for wp_dropdown_users function.
     1593                     * @param bool  $bulk      A boolean to know if it's a bulk action or not.
     1594                     */
     1595                    $users_opt = apply_filters( 'quick_edit_authors_query_args', $users_opt, $bulk );
    15861596
    15871597                    $authors = wp_dropdown_users( $users_opt );
Note: See TracChangeset for help on using the changeset viewer.