Making WordPress.org


Ignore:
Timestamp:
04/30/2024 05:26:07 AM (3 years ago)
Author:
dd32
Message:

Plugin Directory: Expose the plugin closed status through the plugin_information API endpoint.

This only applies to v1.2+ clients, as v1.0/1.1 expect a null response for any error case.

See #7057.

File:
1 edited

Legend:

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

    r13600 r13620  
    209209                case 'disabled':
    210210                case 'closed':
    211                         $closed_date  = get_post_meta( get_the_ID(), 'plugin_closed_date', true );
    212                         $close_reason = Template::get_close_reason( $post );
    213 
    214                         if ( $closed_date ) {
     211                        $close_data = Template::get_close_data( $post );
     212
     213                        if ( $close_data['date'] ) {
    215214                                if ( 'disabled' === $post_status && current_user_can( 'plugin_approve' ) ) {
    216                                         /* translators: %s: plugin closing date */
    217                                         $message = sprintf( __( 'This plugin has been disabled as of %s -- this means it is closed, but actively serving updates.', 'wporg-plugins' ), mysql2date( get_option( 'date_format' ), $closed_date ) );
     215                                        $message = sprintf(
     216                                                /* translators: %s: plugin closing date */
     217                                                __( 'This plugin has been disabled as of %s -- this means it is closed, but actively serving updates.', 'wporg-plugins' ),
     218                                                mysql2date( get_option( 'date_format' ), $close_data['date'] )
     219                                        );
    218220                                } else {
    219                                         /* translators: %s: plugin closing date */
    220                                         $message = sprintf( __( 'This plugin has been closed as of %s and is not available for download.', 'wporg-plugins' ), mysql2date( get_option( 'date_format' ), $closed_date ) );
     221                                        $message = sprintf(
     222                                                /* translators: %s: plugin closing date */
     223                                                __( 'This plugin has been closed as of %s and is not available for download.', 'wporg-plugins' ),
     224                                                mysql2date( get_option( 'date_format' ), $close_data['date'] )
     225                                        );
    221226                                }
    222227
    223                                 // Determine permanence of closure.
    224                                 $committers = Tools::get_plugin_committers( $post->post_name );
    225                                 $permanent  = ( __( 'Author Request', 'wporg-plugins' ) === $close_reason || ! $committers );
    226 
    227                                 $days_passed = (int) ( ( current_time( 'timestamp' ) - mysql2date( 'U', $closed_date ) ) / DAY_IN_SECONDS );
    228 
    229228                                // If we're closed, it may be permanent.
    230                                 if ( $permanent ) {
     229                                if ( $close_data['permanent'] ) {
    231230                                        $message .= ' ' . __( 'This closure is permanent.', 'wporg-plugins' );
    232                                 } elseif ( $days_passed < 60 ) {
     231                                } elseif ( ! $close_data['public'] ) {
    233232                                        $message .= ' ' . __( 'This closure is temporary, pending a full review.', 'wporg-plugins' );
    234233                                }
    235234
    236                                 // Display close reason if more than 60 days have passed.
    237                                 if ( $days_passed >= 60 ) {
     235                                // Display close reason if it's now publicly known.
     236                                if ( $close_data['public'] && $close_data['reason'] ) {
    238237                                        /* translators: %s: plugin close/disable reason */
    239                                         $message .= ' ' . sprintf( __( 'Reason: %s.', 'wporg-plugins' ), $close_reason );
     238                                        $message .= ' ' . sprintf( __( 'Reason: %s.', 'wporg-plugins' ), $close_data['label'] );
    240239                                }
    241240                        } else {
Note: See TracChangeset for help on using the changeset viewer.