Making WordPress.org

Changeset 14246


Ignore:
Timestamp:
12/06/2024 04:45:07 AM (5 months ago)
Author:
dd32
Message:

Pugin Directory: Guess the submission date for pre-2017-April plugins, avoids showing it as '55 years ago'.

Followup to [14244].
See #7761.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/plugins/plugin-directory/admin/metabox/class-controls.php

    r14244 r14246  
    190190            <tr>
    191191                <td><?php _e( 'Updated:', 'wporg-plugins' ); ?></td>
    192                 <td><strong><?php printf( '<span title="%s">%s ago</span>', esc_attr( $post->last_updated ), human_time_diff( strtotime( $post->last_updated ) ) ); ?></strong></td>
     192                <td><strong><?php
     193                    printf(
     194                        '<span title="%s">%s ago</span>',
     195                        esc_attr( $post->last_updated ),
     196                        human_time_diff( strtotime( $post->last_updated ) )
     197                    );
     198                ?></strong></td>
    193199            </tr>
    194200
    195201            <tr>
    196202                <td><?php _e( 'Submitted:', 'wporg-plugins' ); ?></td>
    197                 <td><strong><?php printf( '<span title="%s">%s ago</span>', esc_attr( gmdate( 'Y-m-d H:i:s', $post->_submitted_date ?? 0 ) ), human_time_diff( $post->_submitted_date ) ); ?></strong></td>
     203                <td><strong><?php
     204                    $submitted_date = min( array_filter( [
     205                        $post->_submitted_date,           // Submitted date stored since 2017-04-11
     206                        $post->_approved,                 // The approval date is the next best thing.
     207                        strtotime( $post->post_date_gmt ) // Fallback to the post_date, which should be similar to approval date.
     208                    ] ) );
     209
     210                    printf(
     211                        '<span title="%s">%s ago</span>',
     212                        esc_attr( gmdate( 'Y-m-d H:i:s', $submitted_date ) ),
     213                        human_time_diff( $submitted_date )
     214                    );
     215                ?></strong></td>
    198216            </tr>
    199217
Note: See TracChangeset for help on using the changeset viewer.