Make WordPress Core

Ticket #32386: 32386.3.diff

File 32386.3.diff, 2.5 KB (added by obenland, 10 years ago)
  • src/wp-admin/includes/class-wp-posts-list-table.php

     
    819819
    820820                        case 'date':
    821821                                if ( '0000-00-00 00:00:00' == $post->post_date ) {
    822                                         $t_time = $h_time = __( 'Unpublished' );
    823                                         $time_diff = 0;
    824                                 } else {
    825                                         $t_time = get_the_time( __( 'Y/m/d g:i:s a' ) );
    826                                         $m_time = $post->post_date;
    827                                         $time = get_post_time( 'G', true, $post );
    828 
    829                                         $time_diff = time() - $time;
     822                                        printf( '<td %s>%s</td>', $attributes, __( 'Unpublished' ) );
     823                                        break;
     824                                }
    830825
    831                                         if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS )
    832                                                 $h_time = sprintf( __( '%s ago' ), human_time_diff( $time ) );
    833                                         else
    834                                                 $h_time = mysql2date( __( 'Y/m/d' ), $m_time );
     826                                if ( 'draft' == $post->post_status ) {
     827                                        $time     = get_the_modified_time( __( 'Y/m/d g:i:s a' ) );
     828                                        $time_gmt = get_post_modified_time( 'G', true, $post );
     829                                } else {
     830                                        $time     = get_the_time( __( 'Y/m/d g:i:s a' ) );
     831                                        $time_gmt = get_post_time( 'G', true, $post );
    835832                                }
    836833
     834                                $time_diff = time() - $time_gmt;
     835
    837836                                echo '<td ' . $attributes . '>';
    838837                                if ( 'excerpt' == $mode ) {
    839838
     
    846845                                         *
    847846                                         * @since 2.5.1
    848847                                         *
    849                                          * @param array   $t_time      The published time.
     848                                         * @param string  $time        The published time.
    850849                                         * @param WP_Post $post        Post object.
    851850                                         * @param string  $column_name The column name.
    852851                                         * @param string  $mode        The list display mode ('excerpt' or 'list').
    853852                                         */
    854                                         echo apply_filters( 'post_date_column_time', $t_time, $post, $column_name, $mode );
     853                                        echo apply_filters( 'post_date_column_time', $time, $post, $column_name, $mode );
    855854                                } else {
    856855
     856                                        if ( $time_diff > 0 && $time_diff < DAY_IN_SECONDS ) {
     857                                                $time_abbr = sprintf( __( '%s ago' ), human_time_diff( $time_gmt ) );
     858                                        } else {
     859                                                $time_abbr = mysql2date( __( 'Y/m/d' ), $time );
     860                                        }
     861
    857862                                        /** This filter is documented in wp-admin/includes/class-wp-posts-list-table.php */
    858                                         echo '<abbr title="' . $t_time . '">' . apply_filters( 'post_date_column_time', $h_time, $post, $column_name, $mode ) . '</abbr>';
     863                                        echo '<abbr title="' . $time . '">' . apply_filters( 'post_date_column_time', $time_abbr, $post, $column_name, $mode ) . '</abbr>';
    859864                                }
    860865                                echo '<br />';
    861866                                if ( 'publish' == $post->post_status ) {