WordPress.org

Making WordPress.org

Changeset 6541


Ignore:
Timestamp:
02/05/2018 03:54:26 PM (3 years ago)
Author:
SergeyBiryukov
Message:

Plugin Directory: Display plugin close reason if more than 60 days have passed.

Fixes #3356.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/inc/template-tags.php

    r6474 r6541  
    220220        case 'closed':
    221221            $closed_date = get_post_meta( get_the_ID(), 'plugin_closed_date', true );
    222             if ( ! empty( $closed_date ) ) {
    223                 /* translators: Closing date. */
     222
     223            if ( $closed_date ) {
     224                /* translators: %s: plugin closing date */
    224225                $message = sprintf( __( 'This plugin was closed on %s and is no longer available for download.', 'wporg-plugins' ), mysql2date( get_option( 'date_format' ), $closed_date ) );
     226
     227                $days_passed = (int) ( ( current_time( 'timestamp' ) - mysql2date( 'U', $closed_date ) ) / DAY_IN_SECONDS );
     228
     229                // Display close reason if more than 60 days have passed.
     230                if ( $days_passed > 60 ) {
     231                    /* translators: %s: plugin close/disable reason */
     232                    $message .= ' ' . sprintf( __( 'Reason: %s.', 'wporg-plugins' ), Template::get_close_reason( $post ) );
     233                }
    225234            } else {
    226235                $message = __( 'This plugin has been closed and is no longer available for download.', 'wporg-plugins' );
Note: See TracChangeset for help on using the changeset viewer.